Linux-GPIO Archive mirror
 help / color / mirror / Atom feed
From: "Sabau, Radu bogdan" <Radu.Sabau@analog.com>
To: "David Lechner" <dlechner@baylibre.com>,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	"Hennerich, Michael" <Michael.Hennerich@analog.com>,
	"Jonathan Cameron" <jic23@kernel.org>,
	"Sa, Nuno" <Nuno.Sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Uwe Kleine-König" <ukleinek@kernel.org>,
	"Liam Girdwood" <lgirdwood@gmail.com>,
	"Mark Brown" <broonie@kernel.org>,
	"Linus Walleij" <linusw@kernel.org>,
	"Bartosz Golaszewski" <brgl@kernel.org>,
	"Philipp Zabel" <p.zabel@pengutronix.de>
Cc: "linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-pwm@vger.kernel.org" <linux-pwm@vger.kernel.org>,
	"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>
Subject: RE: [PATCH v3 2/4] iio: adc: ad4691: add initial driver for AD4691 family
Date: Mon, 16 Mar 2026 13:01:26 +0000	[thread overview]
Message-ID: <LV9PR03MB841449F615E4B08570E9F9E4F740A@LV9PR03MB8414.namprd03.prod.outlook.com> (raw)
In-Reply-To: <aa83d2ab-a531-4f3c-869b-85c323c469c7@baylibre.com>



> -----Original Message-----
> From: David Lechner <dlechner@baylibre.com>
> Sent: Saturday, March 14, 2026 6:37 PM
> On 3/13/26 5:07 AM, Radu Sabau via B4 Relay wrote:
> > From: Radu Sabau <radu.sabau@analog.com>
> >

...

> > +
> > +static const struct iio_chan_spec ad4691_manual_channels[] = {
> > +	AD4691_CHANNEL(0, 0, 16, 24, 8),
> > +	AD4691_CHANNEL(1, 1, 16, 24, 8),
> > +	AD4691_CHANNEL(2, 2, 16, 24, 8),
> > +	AD4691_CHANNEL(3, 3, 16, 24, 8),
> > +	AD4691_CHANNEL(4, 4, 16, 24, 8),
> > +	AD4691_CHANNEL(5, 5, 16, 24, 8),
> > +	AD4691_CHANNEL(6, 6, 16, 24, 8),
> > +	AD4691_CHANNEL(7, 7, 16, 24, 8),
> > +	AD4691_CHANNEL(8, 8, 16, 24, 8),
> > +	AD4691_CHANNEL(9, 9, 16, 24, 8),
> > +	AD4691_CHANNEL(10, 10, 16, 24, 8),
> > +	AD4691_CHANNEL(11, 11, 16, 24, 8),
> > +	AD4691_CHANNEL(12, 12, 16, 24, 8),
> > +	AD4691_CHANNEL(13, 13, 16, 24, 8),
> > +	AD4691_CHANNEL(14, 14, 16, 24, 8),
> > +	AD4691_CHANNEL(15, 15, 16, 24, 8)
> > +};
> 
> Can't have 24-bit storage, but I guess that got fixed in a later patch.
> 

Will have this changed here on the next version.

> 
> > +
> > +static const struct iio_chan_spec ad4693_manual_channels[] = {
> > +	AD4691_CHANNEL(0, 0, 16, 24, 8),

...

> > +
> > +	ret = regmap_write(st->regmap, AD4691_REF_CTRL,
> > +			   FIELD_PREP(AD4691_REF_CTRL_MASK, ref_val));
> 
> As mentioned elsewhere, also expect to set REFBUF_EN here if needed.

You are also right about the REBUF_EN functionality, here and in probe.
The internal reference should be used if an external one is not present,
with the default reset value (no change to the ref_ctrl value in this case,
only to refbuf_en).
And if an external one is present, the reference voltage will be set
accordingly.

> 
> > +	if (ret)
> > +		return dev_err_probe(dev, ret, "Failed to write REF_CTRL\n");
> > +
> > +	/* Both CNV_CLOCK and MANUAL devices start in AUTONOMOUS
> mode. */
> > +	ret = regmap_write(st->regmap, AD4691_ADC_SETUP,
> AD4691_AUTONOMOUS_MODE_VAL);
> > +	if (ret)
> > +		return dev_err_probe(dev, ret, "Failed to write
> ADC_SETUP\n");
> > +
> > +	return regmap_write(st->regmap, AD4691_GPIO_MODE1_REG,
> AD4691_ADC_BUSY);
> 
> We should not be setting anything about the gpios without checking what the
> devicetree says is wired up.
> 
> I would defer adding all of the pwm/CNV_CLOCK/samling_freqnecy/GP0
> trigger
> stuff to the patch that actually adds SPI offload support for it to logically
> make sense.
> 

I understand your point, but these are also used in triggered buffer mode
as well so perhaps they should be moved there.


  reply	other threads:[~2026-03-16 13:01 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-13 10:07 [PATCH v3 0/4] iio: adc: ad4691: add driver for AD4691 multichannel SAR ADC family Radu Sabau via B4 Relay
2026-03-13 10:07 ` [PATCH v3 1/4] dt-bindings: iio: adc: add bindings for AD4691 family Radu Sabau via B4 Relay
2026-03-14  9:41   ` Krzysztof Kozlowski
2026-03-16 11:55     ` Sabau, Radu bogdan
2026-03-14 15:29   ` David Lechner
2026-03-14 16:19     ` David Lechner
2026-03-16 12:39     ` Sabau, Radu bogdan
2026-03-16 12:55       ` Sabau, Radu bogdan
2026-03-16 15:14       ` David Lechner
2026-03-16 15:47         ` Sabau, Radu bogdan
2026-03-14 18:18   ` David Lechner
2026-03-13 10:07 ` [PATCH v3 2/4] iio: adc: ad4691: add initial driver " Radu Sabau via B4 Relay
2026-03-13 10:58   ` Andy Shevchenko
2026-03-16 15:29     ` Sabau, Radu bogdan
2026-03-16 15:51       ` David Lechner
2026-03-16 15:57         ` Sabau, Radu bogdan
2026-03-16 16:13           ` Andy Shevchenko
2026-03-14 11:04   ` Nuno Sá
2026-03-16 14:29     ` Sabau, Radu bogdan
2026-03-16 16:00     ` Sabau, Radu bogdan
2026-03-14 16:36   ` David Lechner
2026-03-16 13:01     ` Sabau, Radu bogdan [this message]
2026-03-25 15:01   ` kernel test robot
2026-03-13 10:07 ` [PATCH v3 3/4] iio: adc: ad4691: add triggered buffer support Radu Sabau via B4 Relay
2026-03-13 11:13   ` Andy Shevchenko
2026-03-13 12:09     ` Sabau, Radu bogdan
2026-03-13 14:40       ` Andy Shevchenko
2026-03-14 18:37   ` David Lechner
2026-03-16 13:22     ` Sabau, Radu bogdan
2026-03-16 15:37       ` David Lechner
2026-03-16 15:56         ` Sabau, Radu bogdan
2026-03-16 16:44           ` David Lechner
2026-03-17  9:27             ` Sabau, Radu bogdan
2026-03-13 10:07 ` [PATCH v3 4/4] iio: adc: ad4691: add SPI offload support Radu Sabau via B4 Relay
2026-03-14 19:37   ` David Lechner
2026-03-16 13:31     ` Sabau, Radu bogdan
2026-03-13 11:14 ` [PATCH v3 0/4] iio: adc: ad4691: add driver for AD4691 multichannel SAR ADC family Andy Shevchenko

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=LV9PR03MB841449F615E4B08570E9F9E4F740A@LV9PR03MB8414.namprd03.prod.outlook.com \
    --to=radu.sabau@analog.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=Nuno.Sa@analog.com \
    --cc=andy@kernel.org \
    --cc=brgl@kernel.org \
    --cc=broonie@kernel.org \
    --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=lgirdwood@gmail.com \
    --cc=linusw@kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=robh@kernel.org \
    --cc=ukleinek@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).