#include <linux/bitfield.h>
#include <linux/bitops.h>
#include <linux/delay.h>
#include <linux/err.h>
#include <linux/gpio/consumer.h>
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/mod_devicetable.h>
#include <linux/mutex.h>
#include <linux/pm_runtime.h>
#include <linux/property.h>
#include <linux/regmap.h>
#include <linux/regulator/consumer.h>
#include <linux/random.h>
#include <linux/units.h>
#include <linux/iio/buffer.h>
#include <linux/iio/iio.h>
#include <linux/iio/trigger_consumer.h>
#include <linux/iio/triggered_buffer.h>
#include <asm/unaligned.h>
#define YAS5XX_DEVICE_ID …
#define YAS5XX_MEASURE_DATA …
#define YAS530_ACTUATE_INIT_COIL …
#define YAS530_MEASURE …
#define YAS530_CONFIG …
#define YAS530_MEASURE_INTERVAL …
#define YAS530_OFFSET_X …
#define YAS530_OFFSET_Y1 …
#define YAS530_OFFSET_Y2 …
#define YAS530_TEST1 …
#define YAS530_TEST2 …
#define YAS530_CAL …
#define YAS537_MEASURE …
#define YAS537_CONFIG …
#define YAS537_MEASURE_INTERVAL …
#define YAS537_OFFSET_X …
#define YAS537_OFFSET_Y1 …
#define YAS537_OFFSET_Y2 …
#define YAS537_AVR …
#define YAS537_HCK …
#define YAS537_LCK …
#define YAS537_SRST …
#define YAS537_ADCCAL …
#define YAS537_MTC …
#define YAS537_OC …
#define YAS537_TRM …
#define YAS537_CAL …
#define YAS5XX_CONFIG_INTON …
#define YAS5XX_CONFIG_INTHACT …
#define YAS5XX_CONFIG_CCK_MASK …
#define YAS5XX_CONFIG_CCK_SHIFT …
#define YAS5XX_MEASURE_START …
#define YAS5XX_MEASURE_LDTC …
#define YAS5XX_MEASURE_FORS …
#define YAS5XX_MEASURE_DLYMES …
#define YAS5XX_MEASURE_CONT …
#define YAS5XX_MEASURE_DATA_BUSY …
#define YAS530_DEVICE_ID …
#define YAS530_VERSION_A …
#define YAS530_VERSION_B …
#define YAS530_VERSION_A_COEF …
#define YAS530_VERSION_B_COEF …
#define YAS530_DATA_BITS …
#define YAS530_DATA_CENTER …
#define YAS530_DATA_OVERFLOW …
#define YAS532_DEVICE_ID …
#define YAS532_VERSION_AB …
#define YAS532_VERSION_AC …
#define YAS532_VERSION_AB_COEF …
#define YAS532_VERSION_AC_COEF_X …
#define YAS532_VERSION_AC_COEF_Y1 …
#define YAS532_VERSION_AC_COEF_Y2 …
#define YAS532_DATA_BITS …
#define YAS532_DATA_CENTER …
#define YAS532_DATA_OVERFLOW …
#define YAS537_DEVICE_ID …
#define YAS537_VERSION_0 …
#define YAS537_VERSION_1 …
#define YAS537_MAG_AVERAGE_32_MASK …
#define YAS537_MEASURE_TIME_WORST_US …
#define YAS537_DEFAULT_SENSOR_DELAY_MS …
#define YAS537_MAG_RCOIL_TIME_US …
#define YAS537_MTC3_MASK_PREP …
#define YAS537_MTC3_MASK_GET …
#define YAS537_MTC3_ADD_BIT …
#define YAS537_HCK_MASK_PREP …
#define YAS537_HCK_MASK_GET …
#define YAS537_LCK_MASK_PREP …
#define YAS537_LCK_MASK_GET …
#define YAS537_OC_MASK_GET …
#define YAS5XX_AUTOSUSPEND_DELAY_MS …
enum chip_ids { … };
static const int yas530_volatile_reg[] = …;
static const int yas537_volatile_reg[] = …;
struct yas5xx_calibration { … };
struct yas5xx;
struct yas5xx_chip_info { … };
struct yas5xx { … };
static u16 yas530_extract_axis(u8 *data)
{ … }
static u16 yas532_extract_axis(u8 *data)
{ … }
static int yas530_measure(struct yas5xx *yas5xx, u16 *t, u16 *x, u16 *y1, u16 *y2)
{ … }
static int yas537_measure(struct yas5xx *yas5xx, u16 *t, u16 *x, u16 *y1, u16 *y2)
{ … }
static s32 yas530_linearize(struct yas5xx *yas5xx, u16 val, int axis)
{ … }
static s32 yas5xx_calc_temperature(struct yas5xx *yas5xx, u16 t)
{ … }
static int yas530_get_measure(struct yas5xx *yas5xx, s32 *to, s32 *xo, s32 *yo, s32 *zo)
{ … }
static int yas537_get_measure(struct yas5xx *yas5xx, s32 *to, s32 *xo, s32 *yo, s32 *zo)
{ … }
static int yas5xx_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int *val, int *val2,
long mask)
{ … }
static void yas5xx_fill_buffer(struct iio_dev *indio_dev)
{ … }
static irqreturn_t yas5xx_handle_trigger(int irq, void *p)
{ … }
static const struct iio_mount_matrix *
yas5xx_get_mount_matrix(const struct iio_dev *indio_dev,
const struct iio_chan_spec *chan)
{ … }
static const struct iio_chan_spec_ext_info yas5xx_ext_info[] = …;
#define YAS5XX_AXIS_CHANNEL(axis, index) …
static const struct iio_chan_spec yas5xx_channels[] = …;
static const unsigned long yas5xx_scan_masks[] = …;
static const struct iio_info yas5xx_info = …;
static bool yas5xx_volatile_reg(struct device *dev, unsigned int reg)
{ … }
static const struct regmap_config yas5xx_regmap_config = …;
static void yas530_extract_calibration(u8 *data, struct yas5xx_calibration *c)
{ … }
static int yas530_get_calibration_data(struct yas5xx *yas5xx)
{ … }
static int yas532_get_calibration_data(struct yas5xx *yas5xx)
{ … }
static int yas537_get_calibration_data(struct yas5xx *yas5xx)
{ … }
static void yas530_dump_calibration(struct yas5xx *yas5xx)
{ … }
static void yas537_dump_calibration(struct yas5xx *yas5xx)
{ … }
static int yas530_set_offsets(struct yas5xx *yas5xx, s8 ox, s8 oy1, s8 oy2)
{ … }
static s8 yas530_adjust_offset(s8 old, int bit, u16 center, u16 measure)
{ … }
static int yas530_measure_offsets(struct yas5xx *yas5xx)
{ … }
static int yas530_power_on(struct yas5xx *yas5xx)
{ … }
static int yas537_power_on(struct yas5xx *yas5xx)
{ … }
static const struct yas5xx_chip_info yas5xx_chip_info_tbl[] = …;
static int yas5xx_probe(struct i2c_client *i2c)
{ … }
static void yas5xx_remove(struct i2c_client *i2c)
{ … }
static int yas5xx_runtime_suspend(struct device *dev)
{ … }
static int yas5xx_runtime_resume(struct device *dev)
{ … }
static DEFINE_RUNTIME_DEV_PM_OPS(yas5xx_dev_pm_ops, yas5xx_runtime_suspend,
yas5xx_runtime_resume, NULL);
static const struct i2c_device_id yas5xx_id[] = …;
MODULE_DEVICE_TABLE(i2c, yas5xx_id);
static const struct of_device_id yas5xx_of_match[] = …;
MODULE_DEVICE_TABLE(of, yas5xx_of_match);
static struct i2c_driver yas5xx_driver = …;
module_i2c_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;