From: Jonathan Cameron <jic23@kernel.org>
To: Tomas Borquez <tomasborquez13@gmail.com>
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Lars-Peter Clausen" <lars@metafoo.de>,
"Michael Hennerich" <Michael.Hennerich@analog.com>,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org,
linux-staging@lists.linux.dev
Subject: Re: [PATCH v2 4/6] staging: iio: ad9832: remove dds.h dependency
Date: Wed, 31 Dec 2025 18:11:53 +0000 [thread overview]
Message-ID: <20251231181153.556f14fe@jic23-huawei> (raw)
In-Reply-To: <20251231180939.422e9e62@jic23-huawei>
On Wed, 31 Dec 2025 18:09:39 +0000
Jonathan Cameron <jic23@kernel.org> wrote:
> On Tue, 30 Dec 2025 17:34:57 -0300
> Tomas Borquez <tomasborquez13@gmail.com> wrote:
>
> > Remove dependency on dds.h by converting custom macros to standard IIO
> > attribute declarations.
> >
> > Signed-off-by: Tomas Borquez <tomasborquez13@gmail.com>
> Hi Tomas,
>
> Happy new year (almost)
>
> > ---
> > drivers/staging/iio/frequency/ad9832.c | 37 +++++++++++---------------
> > 1 file changed, 15 insertions(+), 22 deletions(-)
> >
> > diff --git a/drivers/staging/iio/frequency/ad9832.c b/drivers/staging/iio/frequency/ad9832.c
> > index 4bb203a67046..aa78973c3a3c 100644
> > --- a/drivers/staging/iio/frequency/ad9832.c
> > +++ b/drivers/staging/iio/frequency/ad9832.c
> > @@ -24,8 +24,6 @@
> > #include <linux/iio/iio.h>
> > #include <linux/iio/sysfs.h>
> >
> > -#include "dds.h"
> > -
> > /* Registers */
> > #define AD9832_FREQ0LL 0x0
> > #define AD9832_FREQ0HL 0x1
> > @@ -238,27 +236,22 @@ static ssize_t ad9832_write(struct device *dev, struct device_attribute *attr,
> > }
> > }
> >
> > -/*
> > - * see dds.h for further information
> > - */
> > +static IIO_DEVICE_ATTR(out_altvoltage0_frequency0, 0200, NULL, ad9832_write, AD9832_FREQ0HM);
> > +static IIO_DEVICE_ATTR(out_altvoltage0_frequency1, 0200, NULL, ad9832_write, AD9832_FREQ1HM);
> > +
> > +static IIO_DEVICE_ATTR(out_altvoltage0_frequencysymbol, 0200, NULL, ad9832_write, AD9832_FREQ_SYM);
> > +static IIO_CONST_ATTR(out_altvoltage0_frequency_scale, "1"); /* 1Hz */
>
> This seems like a pointless attribute. Default scaling for everything in IIO when
> attributes don't tell us otherwise is 1 so should be fine dropping this one.
>
> > +
> > +static IIO_DEVICE_ATTR(out_altvoltage0_phase0, 0200, NULL, ad9832_write, AD9832_PHASE0H);
> > +static IIO_DEVICE_ATTR(out_altvoltage0_phase1, 0200, NULL, ad9832_write, AD9832_PHASE1H);
> > +static IIO_DEVICE_ATTR(out_altvoltage0_phase2, 0200, NULL, ad9832_write, AD9832_PHASE2H);
> > +static IIO_DEVICE_ATTR(out_altvoltage0_phase3, 0200, NULL, ad9832_write, AD9832_PHASE3H);
> > +
> > +static IIO_DEVICE_ATTR(out_altvoltage0_phasesymbol, 0200, NULL, ad9832_write, AD9832_PHASE_SYM);
> > +static IIO_CONST_ATTR(out_altvoltage0_phase_scale, "0.0015339808"); /* 2PI/2^12 rad */
>
> I can't immediately think of precedence for scaling of an attribute other than
> _raw. Whilst it's painful, this isn't a high perf path, so we should probably
> just do fixed point inputs for phase0,phase1 etc and deal with the scaling
> in the driver. That avoids adding new ABI for this very rare case.
>
> >
> > -static IIO_DEV_ATTR_FREQ(0, 0, 0200, NULL, ad9832_write, AD9832_FREQ0HM);
> > -static IIO_DEV_ATTR_FREQ(0, 1, 0200, NULL, ad9832_write, AD9832_FREQ1HM);
> > -static IIO_DEV_ATTR_FREQSYMBOL(0, 0200, NULL, ad9832_write, AD9832_FREQ_SYM);
> > -static IIO_CONST_ATTR_FREQ_SCALE(0, "1"); /* 1Hz */
> > -
> > -static IIO_DEV_ATTR_PHASE(0, 0, 0200, NULL, ad9832_write, AD9832_PHASE0H);
> > -static IIO_DEV_ATTR_PHASE(0, 1, 0200, NULL, ad9832_write, AD9832_PHASE1H);
> > -static IIO_DEV_ATTR_PHASE(0, 2, 0200, NULL, ad9832_write, AD9832_PHASE2H);
> > -static IIO_DEV_ATTR_PHASE(0, 3, 0200, NULL, ad9832_write, AD9832_PHASE3H);
> > -static IIO_DEV_ATTR_PHASESYMBOL(0, 0200, NULL,
> > - ad9832_write, AD9832_PHASE_SYM);
> > -static IIO_CONST_ATTR_PHASE_SCALE(0, "0.0015339808"); /* 2PI/2^12 rad*/
> > -
> > -static IIO_DEV_ATTR_PINCONTROL_EN(0, 0200, NULL,
> > - ad9832_write, AD9832_PINCTRL_EN);
> > -static IIO_DEV_ATTR_OUT_ENABLE(0, 0200, NULL,
> > - ad9832_write, AD9832_OUTPUT_EN);
> > +static IIO_DEVICE_ATTR(out_altvoltage0_pincontrol_en, 0200, NULL, ad9832_write, AD9832_PINCTRL_EN);
>
> I'm not that keen on having the documentation only several patches later. Drag that
> before this patch or combine adding the new ABI and documentation in the same patch
Ah. I'd missed that this is deliberately a no change patch with old abi.
So ignore the stuff that doesn't make sense with that in mind!
>
> Jonathan
>
>
> > +static IIO_DEVICE_ATTR(out_altvoltage0_out_enable, 0200, NULL, ad9832_write, AD9832_OUTPUT_EN);
> >
> > static struct attribute *ad9832_attributes[] = {
> > &iio_dev_attr_out_altvoltage0_frequency0.dev_attr.attr,
>
next prev parent reply other threads:[~2025-12-31 18:12 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-30 20:34 [PATCH v2 0/6] staging: ad9832: driver cleanup Tomas Borquez
2025-12-30 20:34 ` [PATCH v2 1/6] staging: iio: ad9832: cleanup dev_err_probe() Tomas Borquez
2025-12-30 22:47 ` Andy Shevchenko
2025-12-31 18:02 ` Jonathan Cameron
2025-12-30 20:34 ` [PATCH v2 2/6] staging: iio: ad9832: convert to guard(mutex) Tomas Borquez
2025-12-30 22:50 ` Andy Shevchenko
2025-12-31 17:01 ` Tomas Borquez
2025-12-30 20:34 ` [PATCH v2 3/6] staging: iio: ad9832: convert to devm_mutex_init() Tomas Borquez
2026-01-14 1:34 ` Marcelo Schmitt
2025-12-30 20:34 ` [PATCH v2 4/6] staging: iio: ad9832: remove dds.h dependency Tomas Borquez
2025-12-30 22:46 ` Andy Shevchenko
2026-01-04 5:25 ` Tomas Borquez
2026-01-05 15:52 ` Andy Shevchenko
2025-12-31 18:09 ` Jonathan Cameron
2025-12-31 18:11 ` Jonathan Cameron [this message]
2026-01-04 5:38 ` Tomas Borquez
2026-01-11 12:13 ` Jonathan Cameron
2025-12-30 20:34 ` [PATCH v2 5/6] staging: iio: ad9832: convert to iio channels and ext_info attrs Tomas Borquez
2025-12-30 22:55 ` Andy Shevchenko
2025-12-31 17:08 ` Tomas Borquez
2026-01-11 12:20 ` Jonathan Cameron
2025-12-31 18:21 ` Jonathan Cameron
2025-12-30 20:34 ` [PATCH v2 6/6] staging: iio: ad9832: add sysfs documentation Tomas Borquez
2025-12-30 22:57 ` Andy Shevchenko
2025-12-31 18:35 ` Jonathan Cameron
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=20251231181153.556f14fe@jic23-huawei \
--to=jic23@kernel.org \
--cc=Michael.Hennerich@analog.com \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=gregkh@linuxfoundation.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=nuno.sa@analog.com \
--cc=tomasborquez13@gmail.com \
/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