From: Jonathan Cameron <jic23@kernel.org>
To: David Lechner <dlechner@baylibre.com>
Cc: "Kurt Borja" <kuurtb@gmail.com>, "Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/7] iio: adc: Add ti-ads1262 driver
Date: Tue, 30 Jun 2026 01:28:55 +0100 [thread overview]
Message-ID: <20260630012855.4b47b548@jic23-huawei> (raw)
In-Reply-To: <0d7a5a3b-dc11-472f-a09a-44df887d5147@baylibre.com>
> > +static int ads1262_read_raw(struct iio_dev *indio_dev,
> > + struct iio_chan_spec const *chan, int *val,
> > + int *val2, long mask)
> > +{
> > + struct ads1262 *st = iio_priv(indio_dev);
> > + struct ads1262_channel *chan_data = &st->channels[chan->scan_index];
> > + u8 realbits = chan->scan_type.realbits;
> > + __be32 raw;
> > + int ret;
> > +
> > + switch (mask) {
> > + case IIO_CHAN_INFO_RAW:
> > + ret = ads1262_channel_read(st, chan_data, &raw);
> > + if (ret)
> > + return ret;
> > + *val = sign_extend32(be32_to_cpu(raw), realbits - 1);
> > +
> > + return IIO_VAL_INT;
> > +
> > + case IIO_CHAN_INFO_SCALE: {
> > + guard(mutex)(&st->chan_lock);
> > +
> > + ret = ads1262_channel_get_scale(st, chan, val, val2);
> > + if (ret)
> > + return ret;
> > +
> > + return IIO_VAL_INT_PLUS_NANO;
> > + }
> > +
> > + case IIO_CHAN_INFO_HARDWAREGAIN: {
>
> There is only one other ADC that uses "hardwaregain". Usually, we just make
> scale writeable to control the gain. I don't remember what the rules for
> that attribute are. Using it for in_voltage is not documented in the ABI.
Roughly speaking it should only be used when the gain is no affecting
the thing being measured (so we can't do it with _scale).
Examples are things like the gain on a time of flight sensor - it
affects how likely we are to get a measurement, not what the measurement is.
Hmm. The one ADC using is the ina2xx - that's a weird device so it
would take some digging to try and figure out why that one go through
review.
>
> > + guard(mutex)(&st->chan_lock);
> > +
> > + *val = ads1262_pga_gain_avail[chan_data->gain];
> > +
> > + return IIO_VAL_INT;
> > + }
> > +
> > + case IIO_CHAN_INFO_SAMP_FREQ: {
> > + guard(mutex)(&st->chan_lock);
> > +
> > + *val = ads1262_data_rate_avail[chan_data->data_rate][0];
> > + *val2 = ads1262_data_rate_avail[chan_data->data_rate][1];
> > +
> > + return IIO_VAL_INT_PLUS_MICRO;
> > + }
> > +
> > + default:
> > + return -EOPNOTSUPP;
> > + }
> > +}
next prev parent reply other threads:[~2026-06-30 0:29 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-28 5:36 [PATCH v2 0/7] iio: adc: Add TI ADS126X ADC family support Kurt Borja
2026-06-28 5:36 ` [PATCH v2 1/7] dt-bindings: iio: adc: Add TI ADS126x ADC family Kurt Borja
2026-06-28 15:45 ` David Lechner
2026-06-28 19:12 ` Kurt Borja
2026-06-29 14:21 ` David Lechner
2026-06-29 16:27 ` Kurt Borja
2026-06-29 16:43 ` David Lechner
2026-06-30 17:14 ` Kurt Borja
2026-06-30 18:38 ` David Lechner
2026-07-01 0:28 ` Jonathan Cameron
2026-06-28 5:36 ` [PATCH v2 2/7] iio: adc: Add ti-ads1262 driver Kurt Borja
2026-06-28 17:15 ` David Lechner
2026-06-28 20:00 ` Kurt Borja
2026-06-29 14:38 ` David Lechner
2026-06-30 0:32 ` Jonathan Cameron
2026-06-30 17:17 ` Kurt Borja
2026-06-30 0:28 ` Jonathan Cameron [this message]
2026-06-30 0:43 ` Jonathan Cameron
2026-06-28 5:36 ` [PATCH v2 3/7] iio: adc: ti-ads1262: Add channel filter support Kurt Borja
2026-06-28 5:36 ` [PATCH v2 4/7] iio: adc: ti-ads1262: Add excitation current support Kurt Borja
2026-06-30 0:47 ` Jonathan Cameron
2026-06-30 17:18 ` Kurt Borja
2026-06-28 5:36 ` [PATCH v2 5/7] iio: adc: ti-ads1262: Add conversion delay support Kurt Borja
2026-06-30 0:50 ` Jonathan Cameron
2026-06-30 17:23 ` Kurt Borja
2026-06-30 18:44 ` David Lechner
2026-07-01 0:20 ` Jonathan Cameron
2026-06-28 5:36 ` [PATCH v2 6/7] iio: adc: ti-ads1262: Add buffer and trigger support Kurt Borja
2026-06-30 0:54 ` Jonathan Cameron
2026-06-28 5:36 ` [PATCH v2 7/7] iio: adc: Add ti-ads1263-adc2 driver Kurt Borja
2026-06-28 17:22 ` David Lechner
2026-06-28 20:08 ` Kurt Borja
2026-06-29 16:38 ` David Lechner
2026-06-30 1:00 ` Jonathan Cameron
2026-06-30 17:57 ` Kurt Borja
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=20260630012855.4b47b548@jic23-huawei \
--to=jic23@kernel.org \
--cc=andy@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=krzk+dt@kernel.org \
--cc=kuurtb@gmail.com \
--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