From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796512186; b=lAWabrdcj2NTlGGAWkj1mI/N3cMyODWiiGTaJDu3y9VpLRkChFwDeBR1IY8BKVTYR8P2 dvUnYAjhFXkdJ5650ay1rv1r2sEcyvUO/j/h9PoFHf11JTtqUlA1JjeHI5oZjByHnIXhj 2U8pHRCqIGxLz1gvM7+/b/WegRcfoMDhLETuH8ItHg0tG7EJx4UxvKaqrrHZ1o5oP0oAJ t6LUoSIMbQ3wS1XRkOkslEYksNkaqleWvpplM2J0l6VjRibTOVm/KN3JAkmH68qKti0O9 zMChNdaGOj87BLDn+D4ArusTAZmBkI0GGZAl+HbOWvnjw5oSR7wne3WQTAgbxL/RS9Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796512186; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: In-Reply-To:References:X-Mailer:MIME-Version:Content-Type: Content-Transfer-Encoding; bh=ek50676KUj2iP3ikChQreAq2iLAJMcUo9b8Ja1sgL2c=; b=cg+fAp3iWG3KjzokJt6UZIw5YuKL6PG6XNq7glo8710vwkjZYg66621ERmvSVJu2qlXH H1c25jcmCprLPws+2QmG32v2XHZE1+/tpwNj6zUTf6uh4dWIAEonjcRi22OT+xDNzigZV rysqq/VFPWuN6ruhlZoR4MuVKwo/hmNyQ+htoAj8jcgOxaFngRwKlCf6PblaF0p0hRMjA IIEiT70Li4seMvmUKQciV2f8DSnWlN7ZeTMBOjq0L8XotHSSHjgZv8VqQfphrx0dR2lI/ bkqYFcgUVigprNT4kk9TPZRqoQaAJW02Ft/kPhYEYO5TGE7K90xCNP1s6lseIJGgfpw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=jQ1GGo7o; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 49725606A31F; Sat, 5 Dec 2026 23:09:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=jQ1GGo7o Received: by smtp.kernel.org (Postfix) with ESMTPSA id E03271F0092B; Sat, 5 Dec 2026 23:09:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796512186; bh=ek50676KUj2iP3ikChQreAq2iLAJMcUo9b8Ja1sgL2c=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=jQ1GGo7oN9ES4dtg4/e7cLaGXOXNPbt+pO51wAmL8tFRbvyKW0zIXOVB8HM0/Zedl U//qWjZe5rnFiVLmGc/i983B2fyGbMqmp/kUcE4G3NL4GUtgme4cgyfjyhQwtzJbzS S9iHGSwKkwv6LMgLYQUreP+sikVG4ry/A7JUNJkUJY27SpsPUn8tyDuPHf8e7ZdIeg x5xHitx1r+p6/DsK8Vl78JUwTwxnJkhIDdXub1/LrQBkB+B3LLJvw0TNo9zpOTbvZd Dhr9LHNsbh9i1KE0de65EJ0Fo0Eges8XToUJRQbTNrZq2e436upeZKkR0ofGZBacV7 c+1lrJX8uJQDw== Date: Sat, 5 Dec 2026 23:09:38 +0000 From: Jonathan Cameron To: Nuno =?UTF-8?B?U8Oh?= Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Michael Hennerich , David Lechner , Andy Shevchenko , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Arnd Bergmann , linux@analog.com Subject: Re: [PATCH 13/16] iio: frequency: ad9523: add firmware support and drop platform data Message-ID: <20261205230938.36e20f35@jic23-hlaptop> In-Reply-To: <20261130-iio-ad9523-fw-v1-13-9aee15b7a7a2@analog.com> References: <20261130-iio-ad9523-fw-v1-0-9aee15b7a7a2@analog.com> <20261130-iio-ad9523-fw-v1-13-9aee15b7a7a2@analog.com> X-Mailer: Claws Mail 4.4.0 (GTK 3.24.52; x86_64-pc-linux-gnu) X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Mon, 30 Nov 2026 17:37:11 +0000 Nuno S=C3=A1 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. >=20 > Get the configuration from firmware properties instead, following the > new binding, and drop the platform data support: >=20 > - 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. >=20 > 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. >=20 > Signed-off-by: Nuno S=C3=A1 Hi Nuno, Just one small thing inline. Thanks, Jonathan > --- > drivers/iio/frequency/ad9523.c | 341 +++++++++++++++++++++++++++++++++++= +++--- > 1 file changed, 321 insertions(+), 20 deletions(-) >=20 > diff --git a/drivers/iio/frequency/ad9523.c b/drivers/iio/frequency/ad952= 3.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 =3D 3250, rpole2 =3D 900, cpole1 =3D 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", &rpol= e2); > + 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 =3D "adi,pll2-loop-filter-rzero-ohms"; if (device_property_present(dev, propname)) { ret =3D device_property_read_u32(dev, propname, &rzero); if (ret) return ret; } else { rzero =3D 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 =3D true; > + } else { > + ret =3D 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 =3D ret; > + } > + > + ret =3D 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 =3D ret; > + > + ret =3D 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 =3D ret; > + > + return 0; > +}