From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jonathan Cameron Subject: Re: [PATCH v3 07/11] IIO: consumer: allow to set buffer sizes Date: Sat, 25 Mar 2017 16:01:21 +0000 Message-ID: <91627cf5-5fb5-c3aa-c0cb-760688ec3ed9@kernel.org> References: <1489759704-30217-1-git-send-email-arnaud.pouliquen@st.com> <1489759704-30217-8-git-send-email-arnaud.pouliquen@st.com> <951c19fa-d3b8-f4cd-cac1-64e3b8d1cf01@kernel.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Arnaud Pouliquen , Rob Herring , Mark Rutland , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Jaroslav Kysela , Takashi Iwai , Liam Girdwood , Mark Brown Cc: "devicetree@vger.kernel.org" , "alsa-devel@alsa-project.org" , Olivier MOYSAN , "kernel@stlinux.com" , "linux-iio@vger.kernel.org" , Maxime Coquelin , "linux-arm-kernel@lists.infradead.org" , Alexandre TORGUE List-Id: devicetree@vger.kernel.org On 20/03/17 11:30, Arnaud Pouliquen wrote: > > > On 03/19/2017 11:44 PM, Jonathan Cameron wrote: >> On 17/03/17 14:08, Arnaud Pouliquen wrote: >>> Add iio consumer API to set buffer size and watermark according >>> to sysfs API. >>> >>> Signed-off-by: Arnaud Pouliquen >> Hmm. Not keen on the length one. Setting a requested watermark >> is fair enough. There is no actually buffer in these cases though >> so setting it's length is downright odd.. > Length and watermark are configurable from user land through sysfs. > Seems to me logic to also propose it in inkern API... > But I can clean length , no problem. The concept of length for the consumer interface doesn't currently make sense as it refers to an actual buffer. The consumer interface currently passes one entry at a time... > >> >> Guess this is part of the hacks we need to clean up by doing >> the dma buffer consumer stuff right... > Yes all is linked :-). > >> >> Jonathan >>> --- >>> drivers/iio/buffer/industrialio-buffer-cb.c | 12 ++++++++++++ >>> include/linux/iio/consumer.h | 13 +++++++++++++ >>> 2 files changed, 25 insertions(+) >>> >>> diff --git a/drivers/iio/buffer/industrialio-buffer-cb.c b/drivers/iio/buffer/industrialio-buffer-cb.c >>> index b8f550e..43c066a 100644 >>> --- a/drivers/iio/buffer/industrialio-buffer-cb.c >>> +++ b/drivers/iio/buffer/industrialio-buffer-cb.c >>> @@ -103,6 +103,18 @@ struct iio_cb_buffer *iio_channel_get_all_cb(struct device *dev, >>> } >>> EXPORT_SYMBOL_GPL(iio_channel_get_all_cb); >>> >>> +int iio_channel_cb_set_buffer_params(struct iio_cb_buffer *cb_buff, >>> + size_t length, size_t watermark) >>> +{ >>> + if (!length || length < watermark) >>> + return -EINVAL; >>> + cb_buff->buffer.watermark = watermark; >>> + cb_buff->buffer.length = length; >>> + >>> + return 0; >>> +} >>> +EXPORT_SYMBOL_GPL(iio_channel_start_all_cb); >>> + >>> int iio_channel_start_all_cb(struct iio_cb_buffer *cb_buff) >>> { >>> return iio_update_buffers(cb_buff->indio_dev, &cb_buff->buffer, >>> diff --git a/include/linux/iio/consumer.h b/include/linux/iio/consumer.h >>> index cb44771..0f6e94d 100644 >>> --- a/include/linux/iio/consumer.h >>> +++ b/include/linux/iio/consumer.h >>> @@ -134,6 +134,19 @@ struct iio_cb_buffer *iio_channel_get_all_cb(struct device *dev, >>> void *private), >>> void *private); >>> /** >>> + * iio_channel_cb_set_buffer_size() - set the buffer length. >>> + * @cb_buffer: The callback buffer from whom we want the channel >>> + * information. >>> + * @length: buffer length in bytes >>> + * @watermark: buffer watermark in bytes >>> + * >>> + * This function allows to configure the buffer length. The watermark if >>> + * forced to half of the buffer. >>> + */ >>> +int iio_channel_cb_set_buffer_params(struct iio_cb_buffer *cb_buffer, >>> + size_t length, size_t watermark); >>> + >>> +/** >>> * iio_channel_release_all_cb() - release and unregister the callback. >>> * @cb_buffer: The callback buffer that was allocated. >>> */ >>> >> >> -- >> To unsubscribe from this list: send the line "unsubscribe linux-iio" in >> the body of a message to majordomo@vger.kernel.org >> More majordomo info at http://vger.kernel.org/majordomo-info.html >> > -- > To unsubscribe from this list: send the line "unsubscribe linux-iio" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html >