From: Jonathan Cameron <jic23@kernel.org>
To: "Nuno Sá" <nuno.sa@analog.com>
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
devicetree@vger.kernel.org,
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>, Arnd Bergmann <arnd@arndb.de>,
linux@analog.com
Subject: Re: [PATCH 13/16] iio: frequency: ad9523: add firmware support and drop platform data
Date: Sat, 5 Dec 2026 23:09:38 +0000 [thread overview]
Message-ID: <20261205230938.36e20f35@jic23-hlaptop> (raw)
In-Reply-To: <20261130-iio-ad9523-fw-v1-13-9aee15b7a7a2@analog.com>
On Mon, 30 Nov 2026 17:37:11 +0000
Nuno Sá <nuno.sa@analog.com> wrote:
> The driver refuses to probe without platform data, and there are no
> in-tree users of it. That means the driver can not be used at all on a
> modern system.
>
> Get the configuration from firmware properties instead, following the
> new binding, and drop the platform data support:
>
> - The OSC_IN (VCXO) frequency comes from the oscin clock.
> - The PLL2 dividers are computed from the M1 (and optional M2) output
> frequency. The VCO frequency follows from the M1 frequency, and the
> feedback divider from the VCO frequency and the PFD frequency, given
> by the reference divider and doubler.
> - The charge pump current and the loop filter components are given in
> physical units.
> - Each output channel has a child node with its driver mode, polarity
> and label.
>
> While at it, get the supplies as named in the datasheet instead of the
> single vcc supply. The option to override the IIO device name is gone,
> the standard label property can be used instead.
>
> Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Hi Nuno,
Just one small thing inline.
Thanks,
Jonathan
> ---
> drivers/iio/frequency/ad9523.c | 341 ++++++++++++++++++++++++++++++++++++++---
> 1 file changed, 321 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/iio/frequency/ad9523.c b/drivers/iio/frequency/ad9523.c
> index dbf29797130b..f0caaae4d39a 100644
> --- a/drivers/iio/frequency/ad9523.c
> +++ b/drivers/iio/frequency/ad9523.c
> +
> +static int ad9523_parse_loop_filter(struct device *dev,
> + struct ad9523_config *cfg)
> +{
> + u32 rzero = 3250, rpole2 = 900, cpole1 = 0;
> + int ret;
> +
> + device_property_read_u32(dev, "adi,pll2-loop-filter-rzero-ohms", &rzero);
> + device_property_read_u32(dev, "adi,pll2-loop-filter-rpole2-ohms", &rpole2);
> + device_property_read_u32(dev, "adi,pll2-loop-filter-cpole1-picofarads",
> + &cpole1);
Even though it is a fair bit more code, we have pretty much standardized
today on
propname = "adi,pll2-loop-filter-rzero-ohms";
if (device_property_present(dev, propname)) {
ret = device_property_read_u32(dev, propname, &rzero);
if (ret)
return ret;
} else {
rzero = 3250;
}
etc
you could group them with the handling of each one rather than
get all properties, then process the property values for all of them.
Not sure if it would end up easier to follow or not.
> +
> + /* 0 ohms means the internal zero resistor is bypassed */
> + if (!rzero) {
> + cfg->rzero_bypass_en = true;
> + } else {
> + ret = ad9523_lookup_loop_filter(dev, "PLL2 loop filter rzero",
> + ad9523_rzero_ohms,
> + ARRAY_SIZE(ad9523_rzero_ohms),
> + rzero);
> + if (ret < 0)
> + return ret;
> +
> + cfg->rzero = ret;
> + }
> +
> + ret = ad9523_lookup_loop_filter(dev, "PLL2 loop filter rpole2",
> + ad9523_rpole2_ohms,
> + ARRAY_SIZE(ad9523_rpole2_ohms), rpole2);
> + if (ret < 0)
> + return ret;
> +
> + cfg->rpole2 = ret;
> +
> + ret = ad9523_lookup_loop_filter(dev, "PLL2 loop filter cpole1",
> + ad9523_cpole1_pf,
> + ARRAY_SIZE(ad9523_cpole1_pf), cpole1);
> + if (ret < 0)
> + return ret;
> +
> + cfg->cpole1 = ret;
> +
> + return 0;
> +}
next prev parent reply other threads:[~2026-12-05 23:09 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 17:36 [PATCH 00/16] iio: frequency: ad9523: add firmware support Nuno Sá
2026-11-30 17:36 ` [PATCH 01/16] iio: frequency: ad9523: fix out of bounds access of vco_out_map Nuno Sá
2026-11-30 17:37 ` [PATCH 02/16] iio: frequency: ad9523: don't select a powered down M2 divider Nuno Sá
2026-11-30 17:37 ` [PATCH 03/16] iio: frequency: ad9523: fix the M2 divider selection Nuno Sá
2026-12-03 12:16 ` Andy Shevchenko
2026-11-30 17:37 ` [PATCH 04/16] iio: frequency: ad9523: fix GPIO polarity handling Nuno Sá
2026-12-05 22:50 ` Jonathan Cameron
2026-11-30 17:37 ` [PATCH 05/16] iio: frequency: ad9523: factor out the channel divider calculation Nuno Sá
2026-12-03 12:18 ` Andy Shevchenko
2026-11-30 17:37 ` [PATCH 06/16] MAINTAINERS: add an entry for the AD9523 driver Nuno Sá
2026-11-30 17:37 ` [PATCH 07/16] iio: frequency: ad9523: move the platform data into the driver Nuno Sá
2026-12-03 12:19 ` Andy Shevchenko
2026-11-30 17:37 ` [PATCH 08/16] iio: frequency: ad9523: rename the platform data to config Nuno Sá
2026-12-03 12:20 ` Andy Shevchenko
2026-11-30 17:37 ` [PATCH 09/16] iio: frequency: ad9523: always bypass PLL1 Nuno Sá
2026-12-03 12:21 ` Andy Shevchenko
2026-11-30 17:37 ` [PATCH 10/16] iio: frequency: ad9523: drop unused channel options Nuno Sá
2026-11-30 17:37 ` [PATCH 11/16] iio: frequency: ad9523: use read_label() for channel names Nuno Sá
2026-11-30 17:37 ` [PATCH 12/16] dt-bindings: iio: frequency: Add AD9523-1 Nuno Sá
2026-11-30 18:50 ` Conor Dooley
2026-12-02 11:29 ` Nuno Sá
2026-12-02 18:17 ` Conor Dooley
2026-12-03 9:37 ` Nuno Sá
2026-11-30 17:37 ` [PATCH 13/16] iio: frequency: ad9523: add firmware support and drop platform data Nuno Sá
2026-12-05 23:09 ` Jonathan Cameron [this message]
2026-11-30 17:37 ` [PATCH 14/16] iio: frequency: ad9523: sync the dividers at the end of probe Nuno Sá
2026-12-05 23:10 ` Jonathan Cameron
2026-11-30 17:37 ` [PATCH 15/16] iio: frequency: ad9523: split the clock source selection Nuno Sá
2026-11-30 17:37 ` [PATCH 16/16] iio: frequency: ad9523: add clock provider support Nuno Sá
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=20261205230938.36e20f35@jic23-hlaptop \
--to=jic23@kernel.org \
--cc=Michael.Hennerich@analog.com \
--cc=andy@kernel.org \
--cc=arnd@arndb.de \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=krzk+dt@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@analog.com \
--cc=nuno.sa@analog.com \
--cc=robh@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®