#include <linux/module.h>
#include <linux/regmap.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
#include <linux/iio/trigger_consumer.h>
#include <linux/iio/buffer.h>
#include <linux/iio/triggered_buffer.h>
#include <linux/delay.h>
#include "hmc5843.h"
#define HMC5843_RANGE_GAIN_OFFSET …
#define HMC5843_RANGE_GAIN_DEFAULT …
#define HMC5843_RANGE_GAIN_MASK …
#define HMC5843_DATA_READY …
#define HMC5843_DATA_OUTPUT_LOCK …
#define HMC5843_MODE_CONVERSION_CONTINUOUS …
#define HMC5843_MODE_CONVERSION_SINGLE …
#define HMC5843_MODE_IDLE …
#define HMC5843_MODE_SLEEP …
#define HMC5843_MODE_MASK …
#define HMC5843_RATE_OFFSET …
#define HMC5843_RATE_DEFAULT …
#define HMC5843_RATE_MASK …
#define HMC5843_MEAS_CONF_NORMAL …
#define HMC5843_MEAS_CONF_POSITIVE_BIAS …
#define HMC5843_MEAS_CONF_NEGATIVE_BIAS …
#define HMC5843_MEAS_CONF_MASK …
static const char *const hmc5843_meas_conf_modes[] = …;
static const char *const hmc5983_meas_conf_modes[] = …;
static const int hmc5843_regval_to_nanoscale[] = …;
static const int hmc5883_regval_to_nanoscale[] = …;
static const int hmc5883l_regval_to_nanoscale[] = …;
static const int hmc5843_regval_to_samp_freq[][2] = …;
static const int hmc5883_regval_to_samp_freq[][2] = …;
static const int hmc5983_regval_to_samp_freq[][2] = …;
struct hmc5843_chip_info { … };
static s32 hmc5843_set_mode(struct hmc5843_data *data, u8 operating_mode)
{ … }
static int hmc5843_wait_measurement(struct hmc5843_data *data)
{ … }
static int hmc5843_read_measurement(struct hmc5843_data *data,
int idx, int *val)
{ … }
static int hmc5843_set_meas_conf(struct hmc5843_data *data, u8 meas_conf)
{ … }
static
int hmc5843_show_measurement_configuration(struct iio_dev *indio_dev,
const struct iio_chan_spec *chan)
{ … }
static
int hmc5843_set_measurement_configuration(struct iio_dev *indio_dev,
const struct iio_chan_spec *chan,
unsigned int meas_conf)
{ … }
static const struct iio_mount_matrix *
hmc5843_get_mount_matrix(const struct iio_dev *indio_dev,
const struct iio_chan_spec *chan)
{ … }
static const struct iio_enum hmc5843_meas_conf_enum = …;
static const struct iio_chan_spec_ext_info hmc5843_ext_info[] = …;
static const struct iio_enum hmc5983_meas_conf_enum = …;
static const struct iio_chan_spec_ext_info hmc5983_ext_info[] = …;
static
ssize_t hmc5843_show_samp_freq_avail(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static IIO_DEV_ATTR_SAMP_FREQ_AVAIL(hmc5843_show_samp_freq_avail);
static int hmc5843_set_samp_freq(struct hmc5843_data *data, u8 rate)
{ … }
static int hmc5843_get_samp_freq_index(struct hmc5843_data *data,
int val, int val2)
{ … }
static int hmc5843_set_range_gain(struct hmc5843_data *data, u8 range)
{ … }
static ssize_t hmc5843_show_scale_avail(struct device *dev,
struct device_attribute *attr,
char *buf)
{ … }
static IIO_DEVICE_ATTR(scale_available, S_IRUGO,
hmc5843_show_scale_avail, NULL, 0);
static int hmc5843_get_scale_index(struct hmc5843_data *data, int val, int val2)
{ … }
static int hmc5843_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int *val, int *val2, long mask)
{ … }
static int hmc5843_write_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int val, int val2, long mask)
{ … }
static int hmc5843_write_raw_get_fmt(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
long mask)
{ … }
static irqreturn_t hmc5843_trigger_handler(int irq, void *p)
{ … }
#define HMC5843_CHANNEL(axis, idx) …
#define HMC5983_CHANNEL(axis, idx) …
static const struct iio_chan_spec hmc5843_channels[] = …;
static const struct iio_chan_spec hmc5883_channels[] = …;
static const struct iio_chan_spec hmc5983_channels[] = …;
static struct attribute *hmc5843_attributes[] = …;
static const struct attribute_group hmc5843_group = …;
static const struct hmc5843_chip_info hmc5843_chip_info_tbl[] = …;
static int hmc5843_init(struct hmc5843_data *data)
{ … }
static const struct iio_info hmc5843_info = …;
static const unsigned long hmc5843_scan_masks[] = …;
static int hmc5843_common_suspend(struct device *dev)
{ … }
static int hmc5843_common_resume(struct device *dev)
{ … }
EXPORT_NS_SIMPLE_DEV_PM_OPS(hmc5843_pm_ops, hmc5843_common_suspend,
hmc5843_common_resume, IIO_HMC5843);
int hmc5843_common_probe(struct device *dev, struct regmap *regmap,
enum hmc5843_ids id, const char *name)
{ … }
EXPORT_SYMBOL_NS(…);
void hmc5843_common_remove(struct device *dev)
{ … }
EXPORT_SYMBOL_NS(…);
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;