summaryrefslogtreecommitdiffstats
path: root/drivers/iio/proximity/as3935.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-06-25 07:29:44 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-06-25 07:29:44 -0700
commit194c8581eb9b6d42e9232c7693d86d2ee3799986 (patch)
tree86d926b7407c33379dd719fad2ccaf03d5c5228a /drivers/iio/proximity/as3935.c
parentc0ff9019ee64101fda8f19338da799fda8217e14 (diff)
parent33688abb2802ff3a230bd2441f765477b94cc89e (diff)
downloadtalos-obmc-linux-194c8581eb9b6d42e9232c7693d86d2ee3799986.tar.gz
talos-obmc-linux-194c8581eb9b6d42e9232c7693d86d2ee3799986.zip
Merge 4.7-rc4 into char-misc-next
We want those fixes in here to help with merge issues. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/iio/proximity/as3935.c')
-rw-r--r--drivers/iio/proximity/as3935.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/iio/proximity/as3935.c b/drivers/iio/proximity/as3935.c
index f4d29d5dbd5f..e2f926cdcad2 100644
--- a/drivers/iio/proximity/as3935.c
+++ b/drivers/iio/proximity/as3935.c
@@ -64,6 +64,7 @@ struct as3935_state {
struct delayed_work work;
u32 tune_cap;
+ u8 buffer[16]; /* 8-bit data + 56-bit padding + 64-bit timestamp */
u8 buf[2] ____cacheline_aligned;
};
@@ -72,7 +73,8 @@ static const struct iio_chan_spec as3935_channels[] = {
.type = IIO_PROXIMITY,
.info_mask_separate =
BIT(IIO_CHAN_INFO_RAW) |
- BIT(IIO_CHAN_INFO_PROCESSED),
+ BIT(IIO_CHAN_INFO_PROCESSED) |
+ BIT(IIO_CHAN_INFO_SCALE),
.scan_index = 0,
.scan_type = {
.sign = 'u',
@@ -181,7 +183,12 @@ static int as3935_read_raw(struct iio_dev *indio_dev,
/* storm out of range */
if (*val == AS3935_DATA_MASK)
return -EINVAL;
- *val *= 1000;
+
+ if (m == IIO_CHAN_INFO_PROCESSED)
+ *val *= 1000;
+ break;
+ case IIO_CHAN_INFO_SCALE:
+ *val = 1000;
break;
default:
return -EINVAL;
@@ -206,10 +213,10 @@ static irqreturn_t as3935_trigger_handler(int irq, void *private)
ret = as3935_read(st, AS3935_DATA, &val);
if (ret)
goto err_read;
- val &= AS3935_DATA_MASK;
- val *= 1000;
- iio_push_to_buffers_with_timestamp(indio_dev, &val, pf->timestamp);
+ st->buffer[0] = val & AS3935_DATA_MASK;
+ iio_push_to_buffers_with_timestamp(indio_dev, &st->buffer,
+ pf->timestamp);
err_read:
iio_trigger_notify_done(indio_dev->trig);
OpenPOWER on IntegriCloud