#include <linux/bitfield.h>
#include <linux/bits.h>
#include <linux/delay.h>
#include <linux/module.h>
#include <linux/i2c.h>
#include <linux/regmap.h>
#include <linux/pm_runtime.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
#define TMAG5273_DEVICE_CONFIG_1 …
#define TMAG5273_DEVICE_CONFIG_2 …
#define TMAG5273_SENSOR_CONFIG_1 …
#define TMAG5273_SENSOR_CONFIG_2 …
#define TMAG5273_X_THR_CONFIG …
#define TMAG5273_Y_THR_CONFIG …
#define TMAG5273_Z_THR_CONFIG …
#define TMAG5273_T_CONFIG …
#define TMAG5273_INT_CONFIG_1 …
#define TMAG5273_MAG_GAIN_CONFIG …
#define TMAG5273_MAG_OFFSET_CONFIG_1 …
#define TMAG5273_MAG_OFFSET_CONFIG_2 …
#define TMAG5273_I2C_ADDRESS …
#define TMAG5273_DEVICE_ID …
#define TMAG5273_MANUFACTURER_ID_LSB …
#define TMAG5273_MANUFACTURER_ID_MSB …
#define TMAG5273_T_MSB_RESULT …
#define TMAG5273_T_LSB_RESULT …
#define TMAG5273_X_MSB_RESULT …
#define TMAG5273_X_LSB_RESULT …
#define TMAG5273_Y_MSB_RESULT …
#define TMAG5273_Y_LSB_RESULT …
#define TMAG5273_Z_MSB_RESULT …
#define TMAG5273_Z_LSB_RESULT …
#define TMAG5273_CONV_STATUS …
#define TMAG5273_ANGLE_RESULT_MSB …
#define TMAG5273_ANGLE_RESULT_LSB …
#define TMAG5273_MAGNITUDE_RESULT …
#define TMAG5273_DEVICE_STATUS …
#define TMAG5273_MAX_REG …
#define TMAG5273_AUTOSLEEP_DELAY_MS …
#define TMAG5273_MAX_AVERAGE …
#define TMAG5273_MANUFACTURER_ID …
#define TMAG5273_AVG_MODE_MASK …
#define TMAG5273_AVG_1_MODE …
#define TMAG5273_AVG_2_MODE …
#define TMAG5273_AVG_4_MODE …
#define TMAG5273_AVG_8_MODE …
#define TMAG5273_AVG_16_MODE …
#define TMAG5273_AVG_32_MODE …
#define TMAG5273_OP_MODE_MASK …
#define TMAG5273_OP_MODE_STANDBY …
#define TMAG5273_OP_MODE_SLEEP …
#define TMAG5273_OP_MODE_CONT …
#define TMAG5273_OP_MODE_WAKEUP …
#define TMAG5273_MAG_CH_EN_MASK …
#define TMAG5273_MAG_CH_EN_X_Y_Z …
#define TMAG5273_Z_RANGE_MASK …
#define TMAG5273_X_Y_RANGE_MASK …
#define TMAG5273_ANGLE_EN_MASK …
#define TMAG5273_ANGLE_EN_OFF …
#define TMAG5273_ANGLE_EN_X_Y …
#define TMAG5273_ANGLE_EN_Y_Z …
#define TMAG5273_ANGLE_EN_X_Z …
#define TMAG5273_T_CH_EN …
#define TMAG5273_VERSION_MASK …
#define TMAG5273_CONV_STATUS_COMPLETE …
enum tmag5273_channels { … };
enum tmag5273_scale_index { … };
struct tmag5273_data { … };
static const char *const tmag5273_angle_names[] = …;
static const unsigned int tmag5273_avg_table[] = …;
static const struct iio_val_int_plus_micro tmag5273_scale[][MAGN_RANGE_NUM] = …;
static int tmag5273_get_measure(struct tmag5273_data *data, s16 *t, s16 *x,
s16 *y, s16 *z, u16 *angle, u16 *magnitude)
{ … }
static int tmag5273_write_osr(struct tmag5273_data *data, int val)
{ … }
static int tmag5273_write_scale(struct tmag5273_data *data, int scale_micro)
{ … }
static int tmag5273_read_avail(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
const int **vals, int *type, int *length,
long mask)
{ … }
static int tmag5273_read_raw(struct iio_dev *indio_dev,
const struct iio_chan_spec *chan, int *val,
int *val2, long mask)
{ … }
static int tmag5273_write_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan, int val,
int val2, long mask)
{ … }
#define TMAG5273_AXIS_CHANNEL(axis, index) …
static const struct iio_chan_spec tmag5273_channels[] = …;
static const struct iio_info tmag5273_info = …;
static bool tmag5273_volatile_reg(struct device *dev, unsigned int reg)
{ … }
static const struct regmap_config tmag5273_regmap_config = …;
static int tmag5273_set_operating_mode(struct tmag5273_data *data,
unsigned int val)
{ … }
static void tmag5273_read_device_property(struct tmag5273_data *data)
{ … }
static void tmag5273_wake_up(struct tmag5273_data *data)
{ … }
static int tmag5273_chip_init(struct tmag5273_data *data)
{ … }
static int tmag5273_check_device_id(struct tmag5273_data *data)
{ … }
static void tmag5273_power_down(void *data)
{ … }
static int tmag5273_probe(struct i2c_client *i2c)
{ … }
static int tmag5273_runtime_suspend(struct device *dev)
{ … }
static int tmag5273_runtime_resume(struct device *dev)
{ … }
static DEFINE_RUNTIME_DEV_PM_OPS(tmag5273_pm_ops,
tmag5273_runtime_suspend, tmag5273_runtime_resume,
NULL);
static const struct i2c_device_id tmag5273_id[] = …;
MODULE_DEVICE_TABLE(i2c, tmag5273_id);
static const struct of_device_id tmag5273_of_match[] = …;
MODULE_DEVICE_TABLE(of, tmag5273_of_match);
static struct i2c_driver tmag5273_driver = …;
module_i2c_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;