#include <linux/bits.h>
#include <linux/bitops.h>
#include <linux/device.h>
#include <linux/err.h>
#include <linux/gpio/consumer.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
#include <linux/kernel.h>
#include <linux/math.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/slab.h>
#include <linux/regulator/consumer.h>
#include <linux/sysfs.h>
#define LTC6373_CONVERSION_CONSTANT …
#define LTC6373_MIN_GAIN_CODE …
#define LTC6373_CONVERSION_MASK …
#define LTC6373_SHUTDOWN …
enum hmc425a_type { … };
struct hmc425a_chip_info { … };
struct hmc425a_state { … };
static int gain_dB_to_code(struct hmc425a_state *st, int val, int val2, int *code)
{ … }
static int hmc425a_gain_dB_to_code(int gain, int *code)
{ … }
static int hmc540s_gain_dB_to_code(int gain, int *code)
{ … }
static int adrf5740_gain_dB_to_code(int gain, int *code)
{ … }
static int ltc6373_gain_dB_to_code(int gain, int *code)
{ … }
static int code_to_gain_dB(struct hmc425a_state *st, int *val, int *val2)
{ … }
static int hmc425a_code_to_gain_dB(int code, int *val, int *val2)
{ … }
static int hmc540s_code_to_gain_dB(int code, int *val, int *val2)
{ … }
static int adrf5740_code_to_gain_dB(int code, int *val, int *val2)
{ … }
static int ltc6373_code_to_gain_dB(int code, int *val, int *val2)
{ … }
static int hmc425a_write(struct iio_dev *indio_dev, u32 value)
{ … }
static int hmc425a_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan, int *val,
int *val2, long m)
{
struct hmc425a_state *st = iio_priv(indio_dev);
int ret;
mutex_lock(&st->lock);
switch (m) {
case IIO_CHAN_INFO_HARDWAREGAIN:
ret = code_to_gain_dB(st, val, val2);
if (ret)
break;
ret = IIO_VAL_INT_PLUS_MICRO_DB;
break;
default:
ret = -EINVAL;
}
mutex_unlock(&st->lock);
return ret;
};
static int hmc425a_write_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan, int val,
int val2, long mask)
{ … }
static int hmc425a_write_raw_get_fmt(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
long mask)
{ … }
static const struct iio_info hmc425a_info = …;
static ssize_t ltc6373_read_powerdown(struct iio_dev *indio_dev,
uintptr_t private,
const struct iio_chan_spec *chan,
char *buf)
{ … }
static ssize_t ltc6373_write_powerdown(struct iio_dev *indio_dev,
uintptr_t private,
const struct iio_chan_spec *chan,
const char *buf,
size_t len)
{ … }
static const struct iio_chan_spec_ext_info ltc6373_ext_info[] = …;
#define HMC425A_CHAN(_channel) …
#define LTC6373_CHAN(_channel) …
static const struct iio_chan_spec hmc425a_channels[] = …;
static const struct iio_chan_spec ltc6373_channels[] = …;
static const struct hmc425a_chip_info hmc425a_chip_info_tbl[] = …;
static int hmc425a_probe(struct platform_device *pdev)
{ … }
static const struct of_device_id hmc425a_of_match[] = …;
MODULE_DEVICE_TABLE(of, hmc425a_of_match);
static struct platform_driver hmc425a_driver = …;
module_platform_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;