Commit f9279d3a authored by Peter Meerwald's avatar Peter Meerwald Committed by Jonathan Cameron

iio:magnetometer:mag3110: Scale factor missing for temperature

temperature is reported in milli-Celsius
Signed-off-by: default avatarPeter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent cc7c0f7e
...@@ -183,9 +183,18 @@ static int mag3110_read_raw(struct iio_dev *indio_dev, ...@@ -183,9 +183,18 @@ static int mag3110_read_raw(struct iio_dev *indio_dev,
return -EINVAL; return -EINVAL;
} }
case IIO_CHAN_INFO_SCALE: case IIO_CHAN_INFO_SCALE:
switch (chan->type) {
case IIO_MAGN:
*val = 0; *val = 0;
*val2 = 1000; *val2 = 1000;
return IIO_VAL_INT_PLUS_MICRO; return IIO_VAL_INT_PLUS_MICRO;
case IIO_TEMP:
*val = 1000;
return IIO_VAL_INT;
default:
return -EINVAL;
}
return IIO_VAL_INT_PLUS_MICRO;
case IIO_CHAN_INFO_SAMP_FREQ: case IIO_CHAN_INFO_SAMP_FREQ:
i = data->ctrl_reg1 >> MAG3110_CTRL_DR_SHIFT; i = data->ctrl_reg1 >> MAG3110_CTRL_DR_SHIFT;
*val = mag3110_samp_freq[i][0]; *val = mag3110_samp_freq[i][0];
...@@ -270,7 +279,8 @@ static const struct iio_chan_spec mag3110_channels[] = { ...@@ -270,7 +279,8 @@ static const struct iio_chan_spec mag3110_channels[] = {
MAG3110_CHANNEL(Z, 2), MAG3110_CHANNEL(Z, 2),
{ {
.type = IIO_TEMP, .type = IIO_TEMP,
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW), .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
BIT(IIO_CHAN_INFO_SCALE),
.scan_index = 3, .scan_index = 3,
.scan_type = { .scan_type = {
.sign = 's', .sign = 's',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment