summaryrefslogtreecommitdiff
path: root/drivers/iio
diff options
context:
space:
mode:
authorPeter Meerwald <pmeerw@pmeerw.net>2014-10-01 21:59:00 +0100
committerJonathan Cameron <jic23@kernel.org>2014-02-15 09:54:46 +0000
commitf9279d3a8cc8e518d21784d0152f04b5ee6635cb (patch)
tree6f00aa69d249d4b10b777a25fce579376162b2f8 /drivers/iio
parentcc7c0f7e078a19da3d50fb9ecb7b34d01fd521d2 (diff)
iio:magnetometer:mag3110: Scale factor missing for temperature
temperature is reported in milli-Celsius Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio')
-rw-r--r--drivers/iio/magnetometer/mag3110.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/drivers/iio/magnetometer/mag3110.c b/drivers/iio/magnetometer/mag3110.c
index f66955fb3509..02e4f9765889 100644
--- a/drivers/iio/magnetometer/mag3110.c
+++ b/drivers/iio/magnetometer/mag3110.c
@@ -183,8 +183,17 @@ static int mag3110_read_raw(struct iio_dev *indio_dev,
return -EINVAL;
}
case IIO_CHAN_INFO_SCALE:
- *val = 0;
- *val2 = 1000;
+ switch (chan->type) {
+ case IIO_MAGN:
+ *val = 0;
+ *val2 = 1000;
+ 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:
i = data->ctrl_reg1 >> MAG3110_CTRL_DR_SHIFT;
@@ -270,7 +279,8 @@ static const struct iio_chan_spec mag3110_channels[] = {
MAG3110_CHANNEL(Z, 2),
{
.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_type = {
.sign = 's',