From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: rodrigo.alencar@analog.com
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
linux@analog.com, devicetree@vger.kernel.org,
linux-pwm@vger.kernel.org, linux-doc@vger.kernel.org,
"Jonathan Cameron" <jonathan.cameron@oss.qualcomm.com>,
"Olivier Moysan" <olivier.moysan@foss.st.com>,
"Jonathan Cameron" <jic23@kernel.org>,
"David Lechner" <dlechner@baylibre.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Michael Hennerich" <Michael.Hennerich@analog.com>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Uwe Kleine-König" <ukleinek@kernel.org>,
"Jonathan Corbet" <corbet@lwn.net>,
"Shuah Khan" <skhan@linuxfoundation.org>,
"Randy Dunlap" <rdunlap@infradead.org>
Subject: Re: [PATCH v3 08/10] iio: frequency: ad9910: support iio backend
Date: Tue, 3 Nov 2026 18:52:33 +0200 [thread overview]
Message-ID: <auoRUS-tsK4X0KoU@ashevche-desk.local> (raw)
In-Reply-To: <20261103-ad9910-backend-support-v3-8-0e9224ddf7b7@analog.com>
On Tue, Nov 03, 2026 at 11:53:04AM -0300, Rodrigo Alencar via B4 Relay wrote:
>
> The AD9910 parallel data port allows modulation of the DDS core parameters
> at up to the PDCLK rate, which requires a high-speed data source. Add
> support for an optional IIO backend that provides such interface, with
> data streamed into the device through an output buffer.
>
> The parallel port channels get scan indexes and scan types according to
> the data destination: 14-bit amplitude, 16-bit phase, 16-bit frequency,
> or the 8-bit amplitude and phase pair for polar modulation. As only one
> destination can be active at a time, this is enforced by the available
> scan masks. On buffer enable, the destination is configured in the
> backend and the parallel data port is enabled. The sampling_frequency
> attribute of the parallel port channels controls the backend data rate.
>
> The backend is also notified about profile changes, as it may drive the
> PROFILE[2:0] pins, and the debugfs source attributes now consider the
> parallel data port when reporting which channel controls each DDS core
> parameter.
...
> +enum {
> + AD9910_SCAN_IDX_AMP = 0,
Why explicit assignment? Either we do all (for HW bits) or none and
let the C programming language standard take care about these.
> + AD9910_SCAN_IDX_PHASE,
> + AD9910_SCAN_IDX_FREQ,
> + /* polar phase goes first, as it is placed in the lower byte, D[7:0] */
> + AD9910_SCAN_IDX_POLAR_PHASE,
> + AD9910_SCAN_IDX_POLAR_AMP,
> +};
...
> +static u32 ad9910_buffer_chan_idx(struct iio_dev *indio_dev)
> +{
> + unsigned int scan_idx = find_first_bit(indio_dev->active_scan_mask,
> + iio_get_masklength(indio_dev));
Split assignment.
> + return ad9910_scan_chan_idx[scan_idx];
Who guarantees the scan_idx to be in the boundaries?
> +}
...
> +static int ad9910_buffer_postdisable(struct iio_dev *indio_dev)
> +{
> + struct ad9910_state *st = iio_priv(indio_dev);
> + int ret, ret2;
> +
> + guard(mutex)(&st->lock);
> +
> + st->scan_mask = 0;
> + ret = ad9910_reg32_update(st, AD9910_REG_CFR2,
> + AD9910_CFR2_PARALLEL_DATA_PORT_EN_MSK,
> + 0, true);
> +
> + /* disable the backend channel regardless, return the first error */
> + ret2 = iio_backend_chan_disable(st->back,
> + ad9910_buffer_chan_idx(indio_dev));
I believe the second part of the previous comment should be split to standalone
comment here:
/* Return first occurred error */
Maybe even with more elaboration on how the caller is supposed to react in both
cases.
> + return ret ?: ret2;
> +}
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2026-11-03 16:52 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 14:52 [PATCH v3 00/10] iio: frequency: ad9910: add IIO backend support Rodrigo Alencar via B4 Relay
2026-11-03 14:52 ` [PATCH v3 01/10] iio: frequency: ad9910: powerdown fix Rodrigo Alencar via B4 Relay
2026-11-04 0:20 ` Jonathan Cameron
2026-11-03 14:52 ` [PATCH v3 02/10] iio: backend: add devm_iio_backend_get_optional() Rodrigo Alencar via B4 Relay
2026-11-03 14:52 ` [PATCH v3 03/10] dt-bindings: iio: frequency: add adi,ad9910-axi-backend Rodrigo Alencar via B4 Relay
2026-11-03 14:53 ` [PATCH v3 04/10] dt-bindings: iio: frequency: ad9910: add io-backends property Rodrigo Alencar via B4 Relay
2026-11-03 14:53 ` [PATCH v3 05/10] iio: frequency: ad9910: move channel indexes into a shared header Rodrigo Alencar via B4 Relay
2026-11-03 14:53 ` [PATCH v3 06/10] iio: frequency: ad9910: add axi backend driver Rodrigo Alencar via B4 Relay
2026-11-04 0:09 ` Jonathan Cameron
2026-11-03 14:53 ` [PATCH v3 07/10] iio: frequency: ad9910: support drctl control Rodrigo Alencar via B4 Relay
2026-11-03 16:47 ` Andy Shevchenko
2026-11-04 0:15 ` Jonathan Cameron
2026-11-03 14:53 ` [PATCH v3 08/10] iio: frequency: ad9910: support iio backend Rodrigo Alencar via B4 Relay
2026-11-03 16:52 ` Andy Shevchenko [this message]
2026-11-03 14:53 ` [PATCH v3 09/10] iio: ABI: add integration_time for output channels Rodrigo Alencar via B4 Relay
2026-11-03 14:53 ` [PATCH v3 10/10] docs: iio: ad9910: document DRCTL pin control Rodrigo Alencar via B4 Relay
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=auoRUS-tsK4X0KoU@ashevche-desk.local \
--to=andriy.shevchenko@intel.com \
--cc=Michael.Hennerich@analog.com \
--cc=andy@kernel.org \
--cc=conor+dt@kernel.org \
--cc=corbet@lwn.net \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=jonathan.cameron@oss.qualcomm.com \
--cc=krzk+dt@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=linux@analog.com \
--cc=olivier.moysan@foss.st.com \
--cc=rdunlap@infradead.org \
--cc=robh@kernel.org \
--cc=rodrigo.alencar@analog.com \
--cc=skhan@linuxfoundation.org \
--cc=ukleinek@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®