Skip to content

Commit

Permalink
iio: pressure: ms5611: Add IIO_CHAN_INFO_SCALE to mask
Browse files Browse the repository at this point in the history
This allows data exported via buffer interface to be converted
to standard units in userspace.

Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
  • Loading branch information
Daniel Baluta authored and Jonathan Cameron committed Feb 6, 2016
1 parent 478375c commit 1ad1ce9
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions drivers/iio/pressure/ms5611_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,18 @@ static int ms5611_read_raw(struct iio_dev *indio_dev,
default:
return -EINVAL;
}
case IIO_CHAN_INFO_SCALE:
switch (chan->type) {
case IIO_TEMP:
*val = 10;
return IIO_VAL_INT;
case IIO_PRESSURE:
*val = 0;
*val2 = 1000;
return IIO_VAL_INT_PLUS_MICRO;
default:
return -EINVAL;
}
}

return -EINVAL;
Expand All @@ -218,11 +230,13 @@ static struct ms5611_chip_info chip_info_tbl[] = {
static const struct iio_chan_spec ms5611_channels[] = {
{
.type = IIO_PRESSURE,
.info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED),
.info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED) |
BIT(IIO_CHAN_INFO_SCALE),
},
{
.type = IIO_TEMP,
.info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED),
.info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED) |
BIT(IIO_CHAN_INFO_SCALE),
}
};

Expand Down

0 comments on commit 1ad1ce9

Please sign in to comment.