[{"id":3682323,"web_url":"http://patchwork.ozlabs.org/comment/3682323/","msgid":"<20260425185028.6023661e@jic23-huawei>","list_archive_url":null,"date":"2026-04-25T17:50:28","subject":"Re: [PATCH v8 3/6] iio: adc: ad4691: add triggered buffer support","submitter":{"id":10151,"url":"http://patchwork.ozlabs.org/api/people/10151/","name":"Jonathan Cameron","email":"jic23@kernel.org"},"content":"On Thu, 16 Apr 2026 12:18:48 +0300\nRadu Sabau via B4 Relay <devnull+radu.sabau.analog.com@kernel.org> wrote:\n\n> From: Radu Sabau <radu.sabau@analog.com>\n> \n> Add buffered capture support using the IIO triggered buffer framework.\n> \n> CNV Burst Mode: the GP pin identified by interrupt-names in the device\n> tree is configured as DATA_READY output. The IRQ handler stops\n> conversions and fires the IIO trigger; the trigger handler executes a\n> pre-built SPI message that reads all active channels from the AVG_IN\n> accumulator registers and then resets accumulator state and restarts\n> conversions for the next cycle.\n> \n> Manual Mode: CNV is tied to SPI CS so each transfer simultaneously\n> reads the previous result and starts the next conversion (pipelined\n> N+1 scheme). At preenable time a pre-built, optimised SPI message of\n> N+1 transfers is constructed (N channel reads plus one NOOP to drain\n> the pipeline). The trigger handler executes the message in a single\n> spi_sync() call and collects the results. An external trigger (e.g.\n> iio-trig-hrtimer) is required to drive the trigger at the desired\n> sample rate.\n> \n> Both modes share the same trigger handler and push a complete scan —\n> one u16 slot per channel at its scan_index position, followed by a\n> timestamp — to the IIO buffer via iio_push_to_buffers_with_ts().\n> \n> The CNV Burst Mode sampling frequency (PWM period) is exposed as a\n> buffer-level attribute via IIO_DEVICE_ATTR.\n> \n> Signed-off-by: Radu Sabau <radu.sabau@analog.com>\nHi Radu,\n\nA couple of comments inline, but only for things to change\nif you end up doing a v9 for other reasons.\n\nthanks,\n\nJonathan\n\n> ---\n>  drivers/iio/adc/Kconfig  |   2 +\n>  drivers/iio/adc/ad4691.c | 537 +++++++++++++++++++++++++++++++++++++++++++++--\n>  2 files changed, 524 insertions(+), 15 deletions(-)\n> \n> diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig\n> index 3685a03aa8dc..d498f16c0816 100644\n> --- a/drivers/iio/adc/Kconfig\n> +++ b/drivers/iio/adc/Kconfig\n\n> @@ -84,19 +104,23 @@ enum ad4691_ref_ctrl {\n>  \tAD4691_VREF_5P0   = 4,\n>  };\n>  \n> -struct ad4691_chip_info {\n> +struct ad4691_channel_info {\n>  \tconst struct iio_chan_spec *channels;\n\nWe could mark this __counted_by_ptr()  but that's new so no drivers\nare doing so yet.  At somepoint I'll have a look at whether it's\nworth pushing it into existing drivers and if it is do this\none at that time.  If you are respinning for other reasons though\nthen nice to have.\n\n> -\tconst char *name;\n>  \tunsigned int num_channels;\n> +};\n> +\n> +struct ad4691_chip_info {\n> +\tconst char *name;\n>  \tunsigned int max_rate;\n> +\tconst struct ad4691_channel_info *sw_info;\n>  };\nI'm not going to ask you to respin just for this, but it would have\nbeen neater to push this factoring out of channels + num_channels\ninto the previous patch.","headers":{"Return-Path":"\n <linux-pwm+bounces-8691-incoming=patchwork.ozlabs.org@vger.kernel.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linux-pwm@vger.kernel.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=FVxMT9NE;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org;\n envelope-from=linux-pwm+bounces-8691-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=\"FVxMT9NE\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=10.30.226.201"],"Received":["from sea.lore.kernel.org (sea.lore.kernel.org\n [IPv6:2600:3c0a:e001:db::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g2yN62hMrz1yHS\n\tfor <incoming@patchwork.ozlabs.org>; Sun, 26 Apr 2026 04:02:30 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id 95537309F0DD\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 25 Apr 2026 17:53:25 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 6A0A039B943;\n\tSat, 25 Apr 2026 17:50:43 +0000 (UTC)","from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org\n [10.30.226.201])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 340E539B497;\n\tSat, 25 Apr 2026 17:50:42 +0000 (UTC)","by smtp.kernel.org (Postfix) with ESMTPSA id AF8C5C4AF1C;\n\tSat, 25 Apr 2026 17:50:33 +0000 (UTC)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1777139443; cv=none;\n b=OP32vKwXBca76w3II3BUSchtv17oAKG5SlQCDBXKAPy/g54gCJieK6pKwmvgtJNJ/j8tayYaOl3RbDRvIA5/wOCuT25tUiqb+tx5OA7gLZXB54/Rjh0MP2jMtZetRmo3Y4HsV/D6KxH01WtzajjA9dhFmtkGI0ztuLk0S5v8qp4=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1777139443; c=relaxed/simple;\n\tbh=Eq1gWbdZCyBkPLyU8ZI7KGDNpjNSiEaS1D+uvztVezk=;\n\th=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References:\n\t MIME-Version:Content-Type;\n b=sBO0RWbRPzFy35H7frU7629+M6G3PXBpSMYCFT6uFavNZfX56a0kh52inzbU8B3LTYiBi6xGhdbN3u45/boL4A+6lFppx6XdROQmyyj3yr4S+oi5JV/slMVcKuEjllVB/NEAjBrkks/hvN3VcL4qSJeyVU7xpkjwW8NR5f86kcg=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=FVxMT9NE; arc=none smtp.client-ip=10.30.226.201","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n\ts=k20201202; t=1777139442;\n\tbh=Eq1gWbdZCyBkPLyU8ZI7KGDNpjNSiEaS1D+uvztVezk=;\n\th=Date:From:To:Cc:Subject:In-Reply-To:References:From;\n\tb=FVxMT9NETDxJ0HO1pCnX4MSfJsyyRyC0Fbn1Ja0AOjAkO/s9g0NF0cN8kd7e/JGQW\n\t WQICJhgz8AR+HBSG/FADsC0A2SnH6qRZt/CRW2uwVBrRVGK18Xge55RFJjSCDIktM2\n\t 4fGZt8E4nxSFgx58l7hR3XfZi3XzHL1ohjsn9J+B2cjkdKMjpwvz1fOPlEtwYhyy0r\n\t X5TkXeskeHTWIZKvJl+6v86LKI2TiD/X73qMlu+YxVlbWQ1O5BISKtQe2CLaFJ42NI\n\t d2RrSQtwMN9arEXeuALwEkTgey1H97RsYm/GMaNkpJMrJIRCAfRi70pIxHaOciEN1H\n\t xN7XmJLdM6+Og==","Date":"Sat, 25 Apr 2026 18:50:28 +0100","From":"Jonathan Cameron <jic23@kernel.org>","To":"Radu Sabau via B4 Relay <devnull+radu.sabau.analog.com@kernel.org>","Cc":"radu.sabau@analog.com, Lars-Peter Clausen <lars@metafoo.de>,\n Michael Hennerich <Michael.Hennerich@analog.com>,\n David Lechner <dlechner@baylibre.com>,\n Nuno =?utf-8?b?U8Oh?= <nuno.sa@analog.com>,\n Andy Shevchenko <andy@kernel.org>, Rob Herring <robh@kernel.org>,\n Krzysztof Kozlowski <krzk+dt@kernel.org>, Conor Dooley <conor+dt@kernel.org>,\n Uwe =?utf-8?q?Kleine-K=C3=B6nig?= <ukleinek@kernel.org>,\n Liam Girdwood <lgirdwood@gmail.com>, Mark Brown <broonie@kernel.org>,\n Linus Walleij <linusw@kernel.org>, Bartosz Golaszewski <brgl@kernel.org>,\n Philipp Zabel <p.zabel@pengutronix.de>, Jonathan Corbet <corbet@lwn.net>,\n Shuah Khan <skhan@linuxfoundation.org>, linux-iio@vger.kernel.org,\n devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,\n linux-pwm@vger.kernel.org, linux-gpio@vger.kernel.org,\n linux-doc@vger.kernel.org","Subject":"Re: [PATCH v8 3/6] iio: adc: ad4691: add triggered buffer support","Message-ID":"<20260425185028.6023661e@jic23-huawei>","In-Reply-To":"\n <20260416-ad4692-multichannel-sar-adc-driver-v8-3-c415bd048fa3@analog.com>","References":"\n <20260416-ad4692-multichannel-sar-adc-driver-v8-0-c415bd048fa3@analog.com>\n\t<20260416-ad4692-multichannel-sar-adc-driver-v8-3-c415bd048fa3@analog.com>","X-Mailer":"Claws Mail 4.4.0 (GTK 3.24.52; x86_64-pc-linux-gnu)","Precedence":"bulk","X-Mailing-List":"linux-pwm@vger.kernel.org","List-Id":"<linux-pwm.vger.kernel.org>","List-Subscribe":"<mailto:linux-pwm+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:linux-pwm+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"quoted-printable"}}]