[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aEreFQUZXsdsgBSm@debian-BULLSEYE-live-builder-AMD64>
Date: Thu, 12 Jun 2025 11:03:01 -0300
From: Marcelo Schmitt <marcelo.schmitt1@...il.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: Marcelo Schmitt <marcelo.schmitt@...log.com>, linux-iio@...r.kernel.org,
devicetree@...r.kernel.org, linux-gpio@...r.kernel.org,
linux-kernel@...r.kernel.org,
Ana-Maria Cusco <ana-maria.cusco@...log.com>, jic23@...nel.org,
lars@...afoo.de, Michael.Hennerich@...log.com,
dlechner@...libre.com, nuno.sa@...log.com, robh@...nel.org,
krzk+dt@...nel.org, conor+dt@...nel.org, linus.walleij@...aro.org,
brgl@...ev.pl
Subject: Re: [PATCH v5 02/11] iio: adc: Add basic support for AD4170
On 06/12, Andy Shevchenko wrote:
> On Wed, Jun 11, 2025 at 06:04:49PM -0300, Marcelo Schmitt wrote:
> > On 06/11, Andy Shevchenko wrote:
> > > On Tue, Jun 10, 2025 at 05:31:25PM -0300, Marcelo Schmitt wrote:
>
> ...
>
> > > > + return spi_write(st->spi, st->tx_buf, size + 2);
> > >
> > > ... + sizeof(reg) ?
> >
> > The size of the specific ADC register is stored in the size variable.
> > The result of sizeof(reg) can be different on different machines and will
> > probably not be equal to the size of the register in the ADC chip.
>
> Hmm... But shouldn't we have a variable type that respects the sizeof() of the
> register in HW to keep it there? 2 is magic.
>
I'll add a define for that constant.
For clarification, there is a 2 byte instruction phase during which the driver
sends the R/W flag and register address. After that, it sends the data to be
written to the register. There are 1 byte, 2 byte, and 3 byte long registers.
So, the total transfer length is 2 + reg size.
...
>
> > > > + /* Assume AVSS at GND (0V) if not provided */
> > > > + st->vrefs_uv[AD4170_AVSS_SUP] = ret == -ENODEV ? 0 : -ret;
> > >
> > > -ret ?!?!
> >
> > That's because AVSS is never above system ground level (i.e. AVSS is either GND
> > or a negative voltage). But we currently don't have support for reading negative
> > voltages with the regulator framework. So, the current AD4170 support reads
> > a positive value from the regulator, then inverts signal to make it negative :)
>
> This needs a good comment and ideally a TODO item in the regulator framework.
> (It might be easy to implement by adding a flag without changing the type of
> the field, if it's unsigned.)
I'll add a TODO mark and expand the comment in the driver.
Not sure about sending a patch only adding a TODO to the regulator framework.
Aren't developers expected to propose things?
I'm anticipating 'talk is cheap, show me the code' coming.
Thanks,
Marcelo
Powered by blists - more mailing lists