summaryrefslogtreecommitdiffstats
path: root/drivers/staging/iio
diff options
context:
space:
mode:
authorJonathan Cameron <Jonathan.Cameron@huawei.com>2021-03-14 18:14:56 +0000
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2021-04-07 08:36:36 +0100
commitd5723c679bb81123f9c038392ba2d4aab928ba32 (patch)
tree573b09c4d4735e119fa14815da617adaff369ab2 /drivers/staging/iio
parentf1be99299ef1224892433ba5c9628cdeb34d1758 (diff)
downloadlinux-d5723c679bb81123f9c038392ba2d4aab928ba32.tar.bz2
staging:iio:cdc:ad7150: Add sampling_frequency support
Device uses a fixed sampling frequency. Let us expose it to userspace. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Link: https://lore.kernel.org/r/20210314181511.531414-10-jic23@kernel.org
Diffstat (limited to 'drivers/staging/iio')
-rw-r--r--drivers/staging/iio/cdc/ad7150.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/staging/iio/cdc/ad7150.c b/drivers/staging/iio/cdc/ad7150.c
index 8f8e472e3240..54f31aadc92a 100644
--- a/drivers/staging/iio/cdc/ad7150.c
+++ b/drivers/staging/iio/cdc/ad7150.c
@@ -127,6 +127,10 @@ static int ad7150_read_raw(struct iio_dev *indio_dev,
*val = ret;
return IIO_VAL_INT;
+ case IIO_CHAN_INFO_SAMP_FREQ:
+ /* Strangely same for both 1 and 2 chan parts */
+ *val = 100;
+ return IIO_VAL_INT;
default:
return -EINVAL;
}
@@ -449,6 +453,7 @@ static const struct iio_event_spec ad7150_events[] = {
.channel = _chan, \
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
BIT(IIO_CHAN_INFO_AVERAGE_RAW), \
+ .info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ),\
.event_spec = ad7150_events, \
.num_event_specs = ARRAY_SIZE(ad7150_events), \
}
@@ -459,6 +464,7 @@ static const struct iio_event_spec ad7150_events[] = {
.channel = _chan, \
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
BIT(IIO_CHAN_INFO_AVERAGE_RAW), \
+ .info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ),\
}
static const struct iio_chan_spec ad7150_channels[] = {