enum adxl345_device_type type; }; #define ADXL345_CHANNEL(index, axis) { \ .type = IIO_ACCEL, \ .modified = 1, \ .channel2 = IIO_MOD_##axis, \ .address = index, \ .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ BIT(IIO_CHAN_INFO_CALIBBIAS), \ .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE) | \ BIT(IIO_CHAN_INFO_SAMP_FREQ), \ } static const struct iio_chan_spec adxl345_channels[] = { ADXL345_CHANNEL(0, X), ADXL345_CHANNEL(1, Y), ADXL345_CHANNEL(2, Z), }; static int adxl345_read_raw(struct iio_dev *indio_dev, struct iio_chan_spec const *chan, int *val, int *val2, long mask) { struct adxl345_data *data = iio_priv(indio_dev); __le16 accel; long long samp_freq_nhz; unsigned int regval; int ret; switch (mask) {
struct adxl345_data { struct regmap *regmap; u8 data_range; }; #define ADXL345_CHANNEL(reg, axis) { \ .type = IIO_ACCEL, \ .modified = 1, \ .channel2 = IIO_MOD_##axis, \ .address = reg, \ .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \ .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \ } static const struct iio_chan_spec adxl345_channels[] = { ADXL345_CHANNEL(ADXL345_REG_DATAX0, X), ADXL345_CHANNEL(ADXL345_REG_DATAY0, Y), ADXL345_CHANNEL(ADXL345_REG_DATAZ0, Z), }; static int adxl345_read_raw(struct iio_dev *indio_dev, struct iio_chan_spec const *chan, int *val, int *val2, long mask) { struct adxl345_data *data = iio_priv(indio_dev); __le16 regval; int ret; switch (mask) { case IIO_CHAN_INFO_RAW: /*