[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <r2tlw3yhjjqwytyswv7onglo7rvedyyireofyiqkwxiosrbiyl@tlk6ijhbr3cp>
Date: Thu, 22 May 2025 14:47:41 +0200
From: Angelo Dureghello <adureghello@...libre.com>
To: Andy Shevchenko <andy@...nel.org>
Cc: Jonathan Cameron <jic23@...nel.org>,
David Lechner <dlechner@...libre.com>, Nuno Sá <nuno.sa@...log.com>,
Lars-Peter Clausen <lars@...afoo.de>, Michael Hennerich <Michael.Hennerich@...log.com>,
Rob Herring <robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>, linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org,
devicetree@...r.kernel.org
Subject: Re: [PATCH v4 5/5] iio: adc: ad7606: add gain calibration support
Hi Andy,
On 19.05.2025 13:14, Andy Shevchenko wrote:
> On Mon, May 19, 2025 at 11:40:09AM +0200, Angelo Dureghello wrote:
> > On 08.05.2025 22:00, Andy Shevchenko wrote:
> > > On Thu, May 08, 2025 at 12:06:09PM +0200, Angelo Dureghello wrote:
>
> ...
>
> > > > + device_for_each_child_node_scoped(dev, child) {
> > > > + u32 reg, r_gain;
> > > > +
> > > > + ret = fwnode_property_read_u32(child, "reg", ®);
> > > > + if (ret)
> > > > + continue;
> > >
> > > > + /* Chan reg is a 1-based index. */
> > > > + if (reg < 1 || reg > num_channels) {
> > > > + dev_warn(dev, "wrong ch number (ignoring): %d\n", reg);
> > > > + continue;
> > > > + }
> > >
> > > But this will allow to have a broken DT. This check basically diminishes the
> > > effort of the DT schema validation. If there are limits one still would be able
> > > to create a DT that passes the driver but doesn't pass the validation.
> >
> > fixed all your points on other patches of this patch-set. Still your
> > emails are going to google spam, just could catch them on friday.
> > Really not clear why.
>
> DKIM which I still need to configure...
>
> > About the above, i understand, but the check is actually the same as
> > in ad7606_get_chan_config(), a warning that fdt is not correct,
> > i dont see a blocking issue here now, so not going to change it
> > in this next patchset.
>
> I think the 'continue' above is simply wrong. We should not allow to have
> broken tables. And I think it's kinda blocking issue.
>
Actually the driver is informing of an incorrect channel node and passes
to the next channel, instead of a probe-fail. It is not introducing any
non-functionality, just skipping that channel.
Not a big issue for me to fix it and issue a v6.
If it's really wrong and needed, then i should fix this same issue that
is there in other previously accepted parts.
> > > > + ret = fwnode_property_read_u32(child, "adi,rfilter-ohms",
> > > > + &r_gain);
> > > > + if (ret)
> > > > + /* Keep the default register value. */
> > > > + continue;
> > > > +
> > > > + if (r_gain > AD7606_CALIB_GAIN_MAX) {
> > > > + dev_warn(dev, "wrong gain calibration value");
> > > > + continue;
> > > > + }
> > > > +
> > > > + ret = st->bops->reg_write(st, AD7606_CALIB_GAIN(reg - 1),
> > > > + DIV_ROUND_CLOSEST(r_gain, AD7606_CALIB_GAIN_STEP));
> > > > + if (ret) {
> > > > + dev_warn(dev, "error writing r_gain");
> > > > + continue;
> > > > + }
> > > > + }
>
> --
> With Best Regards,
> Andy Shevchenko
>
>
Regards,
angelo
Powered by blists - more mailing lists