Commit 5138806f authored by Matt Ranostay's avatar Matt Ranostay Committed by Jonathan Cameron

iio: proximity: as3935: correct IIO_CHAN_INFO_RAW output

IIO_CHAN_INFO_RAW was returning processed data which was incorrect.
This also adds the IIO_CHAN_INFO_SCALE value to convert to a processed value.
Signed-off-by: default avatarMatt Ranostay <mranostay@gmail.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent 14f2461b
What /sys/bus/iio/devices/iio:deviceX/in_proximity_raw What /sys/bus/iio/devices/iio:deviceX/in_proximity_input
Date: March 2014 Date: March 2014
KernelVersion: 3.15 KernelVersion: 3.15
Contact: Matt Ranostay <mranostay@gmail.com> Contact: Matt Ranostay <mranostay@gmail.com>
......
...@@ -72,7 +72,8 @@ static const struct iio_chan_spec as3935_channels[] = { ...@@ -72,7 +72,8 @@ static const struct iio_chan_spec as3935_channels[] = {
.type = IIO_PROXIMITY, .type = IIO_PROXIMITY,
.info_mask_separate = .info_mask_separate =
BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_RAW) |
BIT(IIO_CHAN_INFO_PROCESSED), BIT(IIO_CHAN_INFO_PROCESSED) |
BIT(IIO_CHAN_INFO_SCALE),
.scan_index = 0, .scan_index = 0,
.scan_type = { .scan_type = {
.sign = 'u', .sign = 'u',
...@@ -181,8 +182,13 @@ static int as3935_read_raw(struct iio_dev *indio_dev, ...@@ -181,8 +182,13 @@ static int as3935_read_raw(struct iio_dev *indio_dev,
/* storm out of range */ /* storm out of range */
if (*val == AS3935_DATA_MASK) if (*val == AS3935_DATA_MASK)
return -EINVAL; return -EINVAL;
if (m == IIO_CHAN_INFO_PROCESSED)
*val *= 1000; *val *= 1000;
break; break;
case IIO_CHAN_INFO_SCALE:
*val = 1000;
break;
default: default:
return -EINVAL; return -EINVAL;
} }
......
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