All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Rodrigo Alencar via B4 Relay
	<devnull+rodrigo.alencar.analog.com@kernel.org>
Cc: rodrigo.alencar@analog.com, linux-iio@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-doc@vger.kernel.org, linux-hardening@vger.kernel.org,
	Lars-Peter Clausen <lars@metafoo.de>,
	Michael Hennerich <Michael.Hennerich@analog.com>,
	David Lechner <dlechner@baylibre.com>,
	Andy Shevchenko <andy@kernel.org>, Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Jonathan Corbet <corbet@lwn.net>,
	Shuah Khan <skhan@linuxfoundation.org>,
	Kees Cook <kees@kernel.org>,
	"Gustavo A. R. Silva" <gustavoars@kernel.org>
Subject: Re: [PATCH v5 06/13] iio: frequency: ad9910: initial driver implementation
Date: Fri, 22 May 2026 19:03:32 +0100	[thread overview]
Message-ID: <20260522190332.1f4affba@jic23-huawei> (raw)
In-Reply-To: <20260517-ad9910-iio-driver-v5-6-31599c88314a@analog.com>

On Sun, 17 May 2026 19:37:50 +0100
Rodrigo Alencar via B4 Relay <devnull+rodrigo.alencar.analog.com@kernel.org> wrote:

> From: Rodrigo Alencar <rodrigo.alencar@analog.com>
> 
> Add the core AD9910 DDS driver infrastructure with single tone mode
> support. This includes SPI register access, profile management via GPIO
> pins, PLL/DAC configuration from firmware properties, and single tone
> frequency/phase/amplitude control through IIO attributes.
> 
> Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
Hi Rodrigo

A couple of potential nice to haves.

Jonathan


> +
> +static int ad9910_parse_fw(struct ad9910_state *st)
> +{
> +	static const char * const refclk_out_drv0[] = {
> +		"disabled", "low", "medium", "high",
> +	};
> +	struct device *dev = &st->spi->dev;
> +	u32 tmp[2];
> +	int ret;
> +
> +	st->data.pll_enabled = device_property_read_bool(dev, "adi,pll-enable");
> +	if (st->data.pll_enabled) {
> +		tmp[0] = AD9910_ICP_MIN_uA;
> +		device_property_read_u32(dev, "adi,charge-pump-current-microamp", &tmp[0]);
Might be a good idea to move to the pattern that seems to be becoming
the preferred way to do this and do
		if (device_property_present()) {
			ret = device_property_read_u32()...
...
		} else {
			...
		}

That is slightly nicer ad picks up malformed DT.  I know I was the advocate for
the set a default and don't check ret but I'm learning!


> +		if (tmp[0] < AD9910_ICP_MIN_uA || tmp[0] > AD9910_ICP_MAX_uA)
> +			return dev_err_probe(dev, -ERANGE,
> +					     "invalid charge pump current %u\n", tmp[0]);
> +		st->data.pll_charge_pump_current = tmp[0];
> +
> +		ret = device_property_match_property_string(dev,
> +							    "adi,refclk-out-drive-strength",
> +							    refclk_out_drv0,
> +							    ARRAY_SIZE(refclk_out_drv0));
> +		if (ret < 0)
Similarly good to know if failure to match actually means wasn't there or not.

> +			st->data.refclk_out_drv = AD9910_REFCLK_OUT_DRV_DISABLED;
> +		else
> +			st->data.refclk_out_drv = ret;
> +	}
> +
> +	tmp[1] = AD9910_DAC_IOUT_DEFAULT_uA;
And similar again.

> +	device_property_read_u32_array(dev, "output-range-microamp", tmp,
> +				       ARRAY_SIZE(tmp));
> +	if (tmp[1] < AD9910_DAC_IOUT_MIN_uA || tmp[1] > AD9910_DAC_IOUT_MAX_uA)
> +		return dev_err_probe(dev, -ERANGE,
> +				     "Invalid DAC output current %u uA\n", tmp[1]);
> +	st->data.dac_output_current = tmp[1];
> +
> +	return 0;
> +}


> +static const struct spi_device_id ad9910_id[] = {
> +	{ "ad9910" },

Request to simplify what Uwe is busy doing (assuming he'll get to spi
at somepoint). Please use a named initializer like we always do for
of_device_id.

> +	{ }
> +};
> +MODULE_DEVICE_TABLE(spi, ad9910_id);


  parent reply	other threads:[~2026-05-22 18:03 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-17 18:37 [PATCH v5 00/13] AD9910 Direct Digital Synthesizer Rodrigo Alencar via B4 Relay
2026-05-17 18:37 ` Rodrigo Alencar
2026-05-17 18:37 ` [PATCH v5 01/13] iio: core: validate file offset in iio_debugfs_write_reg() Rodrigo Alencar via B4 Relay
2026-05-17 18:37   ` Rodrigo Alencar
2026-05-17 19:04   ` sashiko-bot
2026-05-18 10:43   ` Rodrigo Alencar
2026-05-17 18:37 ` [PATCH v5 02/13] iio: core: support 64-bit register through debugfs Rodrigo Alencar via B4 Relay
2026-05-17 18:37   ` Rodrigo Alencar
2026-05-17 18:56   ` sashiko-bot
2026-05-18 13:56   ` Rodrigo Alencar
2026-05-20 11:31     ` Jonathan Cameron
2026-05-17 18:37 ` [PATCH v5 03/13] iio: core: add hierarchical channel relationships Rodrigo Alencar via B4 Relay
2026-05-17 18:37   ` Rodrigo Alencar
2026-05-17 18:56   ` sashiko-bot
2026-05-18 14:26     ` Rodrigo Alencar
2026-05-21 13:48   ` Rodrigo Alencar
2026-05-22 17:45     ` Jonathan Cameron
2026-05-17 18:37 ` [PATCH v5 04/13] Documentation: ABI: testing: add parent entry for iio channels Rodrigo Alencar via B4 Relay
2026-05-17 18:37   ` Rodrigo Alencar
2026-05-17 18:45   ` sashiko-bot
2026-05-22 17:47   ` Jonathan Cameron
2026-05-17 18:37 ` [PATCH v5 05/13] dt-bindings: iio: frequency: add ad9910 Rodrigo Alencar via B4 Relay
2026-05-17 18:37   ` Rodrigo Alencar
2026-05-17 18:44   ` sashiko-bot
2026-05-18  7:52   ` Krzysztof Kozlowski
2026-05-18 10:03     ` Rodrigo Alencar
2026-05-17 18:37 ` [PATCH v5 06/13] iio: frequency: ad9910: initial driver implementation Rodrigo Alencar via B4 Relay
2026-05-17 18:37   ` Rodrigo Alencar
2026-05-17 19:20   ` sashiko-bot
2026-05-18 11:45   ` Rodrigo Alencar
2026-05-22 18:03   ` Jonathan Cameron [this message]
2026-05-17 18:37 ` [PATCH v5 07/13] iio: frequency: ad9910: add basic parallel port support Rodrigo Alencar via B4 Relay
2026-05-17 18:37   ` Rodrigo Alencar
2026-05-17 18:37 ` [PATCH v5 08/13] iio: frequency: ad9910: add digital ramp generator support Rodrigo Alencar via B4 Relay
2026-05-17 18:37   ` Rodrigo Alencar
2026-05-17 18:37 ` [PATCH v5 09/13] iio: frequency: ad9910: add RAM mode support Rodrigo Alencar via B4 Relay
2026-05-17 18:37   ` Rodrigo Alencar
2026-05-17 19:19   ` sashiko-bot
2026-05-18 13:50   ` Rodrigo Alencar
2026-05-17 18:37 ` [PATCH v5 10/13] iio: frequency: ad9910: add output shift keying support Rodrigo Alencar via B4 Relay
2026-05-17 18:37   ` Rodrigo Alencar
2026-05-17 18:37 ` [PATCH v5 11/13] iio: frequency: ad9910: show channel priority in debugfs Rodrigo Alencar via B4 Relay
2026-05-17 18:37   ` Rodrigo Alencar
2026-05-22 18:07   ` Jonathan Cameron
2026-05-26 15:21     ` Rodrigo Alencar
2026-05-17 18:37 ` [PATCH v5 12/13] Documentation: ABI: testing: add docs for ad9910 sysfs entries Rodrigo Alencar via B4 Relay
2026-05-17 18:37   ` Rodrigo Alencar
2026-05-17 19:00   ` sashiko-bot
2026-05-20 18:47   ` Rodrigo Alencar
2026-05-22 18:20     ` Jonathan Cameron
2026-05-26 17:08       ` Rodrigo Alencar
2026-05-26 10:07   ` Rodrigo Alencar
2026-05-17 18:37 ` [PATCH v5 13/13] docs: iio: add documentation for ad9910 driver Rodrigo Alencar via B4 Relay
2026-05-17 18:37   ` Rodrigo Alencar
2026-05-17 19:00   ` sashiko-bot

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=20260522190332.1f4affba@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=Michael.Hennerich@analog.com \
    --cc=andy@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=corbet@lwn.net \
    --cc=devicetree@vger.kernel.org \
    --cc=devnull+rodrigo.alencar.analog.com@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=gustavoars@kernel.org \
    --cc=kees@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=robh@kernel.org \
    --cc=rodrigo.alencar@analog.com \
    --cc=skhan@linuxfoundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.