public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy@kernel.org>
To: Angelo Dureghello <adureghello@baylibre.com>
Cc: "Jonathan Cameron" <jic23@kernel.org>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	"Michael Hennerich" <Michael.Hennerich@analog.com>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	devicetree@vger.kernel.org
Subject: Re: [PATCH v4 5/5] iio: adc: ad7606: add gain calibration support
Date: Mon, 19 May 2025 13:14:17 +0300	[thread overview]
Message-ID: <aCsEeQQyGdBg2ex9@smile.fi.intel.com> (raw)
In-Reply-To: <shzx67wrpzaxje4vj6owwnof3pi5cuipdavd3k5svucyt5y527@mvytnov6zunk>

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", &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.

> > > +		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



  reply	other threads:[~2025-05-19 10:14 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-08 10:06 [PATCH v4 0/5] iio: adc: add ad7606 calibration support Angelo Dureghello
2025-05-08 10:06 ` [PATCH v4 1/5] Documentation: ABI: IIO: add calibconv_delay documentation Angelo Dureghello
2025-05-08 18:35   ` Andy Shevchenko
2025-05-11 15:37   ` Jonathan Cameron
2025-05-08 10:06 ` [PATCH v4 2/5] iio: core: add ADC delay calibration definition Angelo Dureghello
2025-05-08 10:06 ` [PATCH v4 3/5] iio: adc: ad7606: add offset and phase calibration support Angelo Dureghello
2025-05-08 18:39   ` Andy Shevchenko
2025-05-08 10:06 ` [PATCH v4 4/5] dt-bindings: iio: adc: adi,ad7606: add gain " Angelo Dureghello
2025-05-08 11:11   ` Rob Herring (Arm)
2025-05-08 12:09     ` Angelo Dureghello
2025-05-08 14:48       ` Conor Dooley
2025-05-08 10:06 ` [PATCH v4 5/5] iio: adc: ad7606: " Angelo Dureghello
2025-05-08 19:00   ` Andy Shevchenko
2025-05-19  9:40     ` Angelo Dureghello
2025-05-19 10:14       ` Andy Shevchenko [this message]
2025-05-22 12:47         ` Angelo Dureghello

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=aCsEeQQyGdBg2ex9@smile.fi.intel.com \
    --to=andy@kernel.org \
    --cc=Michael.Hennerich@analog.com \
    --cc=adureghello@baylibre.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=robh@kernel.org \
    /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