summaryrefslogtreecommitdiffstats
path: root/drivers/iio/buffer
diff options
context:
space:
mode:
authorArnaud Pouliquen <arnaud.pouliquen@st.com>2018-01-10 11:13:13 +0100
committerMark Brown <broonie@kernel.org>2018-01-10 11:30:14 +0100
commit16cbca06fa8288a4f58426fc898b141e12ee8008 (patch)
tree74b875e2df0adae7b84afae5531fedaa7253029b /drivers/iio/buffer
parentIIO: ADC: add stm32 DFSDM support for PDM microphone (diff)
downloadlinux-16cbca06fa8288a4f58426fc898b141e12ee8008.tar.xz
linux-16cbca06fa8288a4f58426fc898b141e12ee8008.zip
IIO: consumer: allow to set buffer sizes
Add iio consumer API to set buffer size and watermark according to sysfs API. Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/iio/buffer')
-rw-r--r--drivers/iio/buffer/industrialio-buffer-cb.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/iio/buffer/industrialio-buffer-cb.c b/drivers/iio/buffer/industrialio-buffer-cb.c
index 4847534700e7..ea63c838eeae 100644
--- a/drivers/iio/buffer/industrialio-buffer-cb.c
+++ b/drivers/iio/buffer/industrialio-buffer-cb.c
@@ -104,6 +104,17 @@ error_free_cb_buff:
}
EXPORT_SYMBOL_GPL(iio_channel_get_all_cb);
+int iio_channel_cb_set_buffer_watermark(struct iio_cb_buffer *cb_buff,
+ size_t watermark)
+{
+ if (!watermark)
+ return -EINVAL;
+ cb_buff->buffer.watermark = watermark;
+
+ return 0;
+}
+EXPORT_SYMBOL_GPL(iio_channel_cb_set_buffer_watermark);
+
int iio_channel_start_all_cb(struct iio_cb_buffer *cb_buff)
{
return iio_update_buffers(cb_buff->indio_dev, &cb_buff->buffer,