#include <linux/module.h>
#include <linux/mod_devicetable.h>
#include <linux/init.h>
#include <linux/i2c.h>
#include <linux/delay.h>
#include <linux/regmap.h>
#include <linux/pm.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
#define MMC35240_DRV_NAME …
#define MMC35240_REGMAP_NAME …
#define MMC35240_REG_XOUT_L …
#define MMC35240_REG_XOUT_H …
#define MMC35240_REG_YOUT_L …
#define MMC35240_REG_YOUT_H …
#define MMC35240_REG_ZOUT_L …
#define MMC35240_REG_ZOUT_H …
#define MMC35240_REG_STATUS …
#define MMC35240_REG_CTRL0 …
#define MMC35240_REG_CTRL1 …
#define MMC35240_REG_ID …
#define MMC35240_STATUS_MEAS_DONE_BIT …
#define MMC35240_CTRL0_REFILL_BIT …
#define MMC35240_CTRL0_RESET_BIT …
#define MMC35240_CTRL0_SET_BIT …
#define MMC35240_CTRL0_CMM_BIT …
#define MMC35240_CTRL0_TM_BIT …
#define MMC35240_CTRL1_BW0_BIT …
#define MMC35240_CTRL1_BW1_BIT …
#define MMC35240_CTRL1_BW_MASK …
#define MMC35240_CTRL1_BW_SHIFT …
#define MMC35240_WAIT_CHARGE_PUMP …
#define MMC35240_WAIT_SET_RESET …
#define MMC35240_OTP_CONVERT_Y(REG) …
#define MMC35240_OTP_CONVERT_Z(REG) …
#define MMC35240_X_COEFF(x) …
#define MMC35240_Y_COEFF(y) …
#define MMC35240_Z_COEFF(z) …
#define MMC35240_OTP_START_ADDR …
enum mmc35240_resolution { … };
enum mmc35240_axis { … };
static const struct { … } mmc35240_props_table[] = …;
struct mmc35240_data { … };
static const struct { … } mmc35240_samp_freq[] = …;
static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("1.5 13 25 50");
#define MMC35240_CHANNEL(_axis) …
static const struct iio_chan_spec mmc35240_channels[] = …;
static struct attribute *mmc35240_attributes[] = …;
static const struct attribute_group mmc35240_attribute_group = …;
static int mmc35240_get_samp_freq_index(struct mmc35240_data *data,
int val, int val2)
{ … }
static int mmc35240_hw_set(struct mmc35240_data *data, bool set)
{ … }
static int mmc35240_init(struct mmc35240_data *data)
{ … }
static int mmc35240_take_measurement(struct mmc35240_data *data)
{ … }
static int mmc35240_read_measurement(struct mmc35240_data *data, __le16 buf[3])
{ … }
static int mmc35240_raw_to_mgauss(struct mmc35240_data *data, int index,
__le16 buf[], int *val)
{ … }
static int mmc35240_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan, int *val,
int *val2, long mask)
{ … }
static int mmc35240_write_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan, int val,
int val2, long mask)
{ … }
static const struct iio_info mmc35240_info = …;
static bool mmc35240_is_writeable_reg(struct device *dev, unsigned int reg)
{ … }
static bool mmc35240_is_readable_reg(struct device *dev, unsigned int reg)
{ … }
static bool mmc35240_is_volatile_reg(struct device *dev, unsigned int reg)
{ … }
static const struct reg_default mmc35240_reg_defaults[] = …;
static const struct regmap_config mmc35240_regmap_config = …;
static int mmc35240_probe(struct i2c_client *client)
{ … }
static int mmc35240_suspend(struct device *dev)
{ … }
static int mmc35240_resume(struct device *dev)
{ … }
static DEFINE_SIMPLE_DEV_PM_OPS(mmc35240_pm_ops, mmc35240_suspend,
mmc35240_resume);
static const struct of_device_id mmc35240_of_match[] = …;
MODULE_DEVICE_TABLE(of, mmc35240_of_match);
static const struct acpi_device_id mmc35240_acpi_match[] = …;
MODULE_DEVICE_TABLE(acpi, mmc35240_acpi_match);
static const struct i2c_device_id mmc35240_id[] = …;
MODULE_DEVICE_TABLE(i2c, mmc35240_id);
static struct i2c_driver mmc35240_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;