[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aUQh3KAvgm5_QIMO@Lewboski.localdomain>
Date: Thu, 18 Dec 2025 12:46:36 -0300
From: Tomas Borquez <tomasborquez13@...il.com>
To: Marcelo Schmitt <marcelo.schmitt1@...il.com>
Cc: Jonathan Cameron <jic23@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Lars-Peter Clausen <lars@...afoo.de>,
Michael Hennerich <Michael.Hennerich@...log.com>,
David Lechner <dlechner@...libre.com>,
Nuno Sá <nuno.sa@...log.com>,
Andy Shevchenko <andy@...nel.org>, linux-kernel@...r.kernel.org,
linux-iio@...r.kernel.org, linux-staging@...ts.linux.dev
Subject: Re: [PATCH 4/5] staging: iio: ad9832: convert to iio channels and
ext_info attrs
On Thu, Dec 18, 2025 at 12:04:37PM -0300, Marcelo Schmitt wrote:
> Hi Tomas,
...
> > Convert ad9832 from custom sysfs attributes to standard channel interface
> > using a single IIO_ALTCURRENT channel with ext_info attributes, as this
> > device is a current source DAC with one output, as well as removing the
> > dds.h header.
> >
> > Changes:
> > - Add single iio_chan_spec with ext_info for frequency0/1 and phase0-3
> > - Phase attributes accept radians directly, driver converts internally
> > - Frequency attributes accept Hz (unchanged)
> > - Cache frequency and phase values in driver state for readback
> > - Remove dependency on dds.h macros
> I'm not sure, was the dds stuff being used before this patch? Maybe dds.h
> removal would be better as another separate clean up patch.
Yep it was used, dds.h contains some macros for creating the sysfs
attributes, I could make a separate patch which transforms the custom
macros to "native" ones.
> > - Rename symbol attributes to frequency_symbol and phase_symbol
> It's nice to have a change log between patch versions. Though, it's usually
> provided as part of extra patch info, not commit message.
You are right mb, I realized too late I'll add it next time under ---
...
> This patch fails to apply? I've tried getting it applied on top of current
> IIO testing branch with b4 shazam, git am <individual patches>, and
> git apply <patch4 on top of applied patch3>, but patch 4 fails to apply either way.
> Couldn't figure out how to fix that.
I think I made some weird change which makes it unappliable but I'll make
sure that does not happen next version.
...
> > +static ssize_t ad9832_write_phase(struct iio_dev *indio_dev,
> > + uintptr_t private,
> > + struct iio_chan_spec const *chan,
> > + const char *buf, size_t len)
> > {
> > + struct ad9832_state *st = iio_priv(indio_dev);
> > u8 phase_bytes[2];
> > u16 phase_cmd;
> > + u32 phase_urad, phase;
> > + int val, val2, ret;
> >
> > - if (phase >= BIT(AD9832_PHASE_BITS))
> > + if (private >= ARRAY_SIZE(ad9832_phase_addr))
> > return -EINVAL;
> >
> > + ret = iio_str_to_fixpoint(buf, 100000, &val, &val2);
> Maybe I'm missing something but, why 100000 here? Should it be MICRO instead?
iio_str_to_fixpoint parses one more decimal digit than the fract_mult
suggests, passing 100000 gives 6 decimal digits (microradians precision).
Using MICRO here would parse 7 digits instead, as far as I understood.
> We can use macros to make it easier to read values that are related to metric units.
Agreed, I'll use MICRO for the multiplication and division/modulo operations.
...
> Best regards,
> Marcelo
Agree on the rest of the feedback, thanks for the comments from these and
previous patches
Tomas
Powered by blists - more mailing lists