From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
To: David Lechner <dlechner@baylibre.com>
Cc: "Hans de Goede" <hansg@kernel.org>,
"Jonathan Cameron" <jic23@kernel.org>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
linux-iio@vger.kernel.org
Subject: Re: [PATCH v3 2/2] iio: adc: Add Intel Dollar Cove TI PMIC ADC driver
Date: Thu, 31 Jul 2025 12:12:55 +0100 [thread overview]
Message-ID: <20250731121255.000025c5@huawei.com> (raw)
In-Reply-To: <9536f598-1d49-4742-92e3-0d2603c5267e@baylibre.com>
On Tue, 29 Jul 2025 12:50:36 -0500
David Lechner <dlechner@baylibre.com> wrote:
> On 7/27/25 4:06 PM, Hans de Goede wrote:
>
> ...
>
> > +static const struct iio_chan_spec dc_ti_adc_channels[] = {
> > + {
> > + .indexed = 1,
> > + .type = IIO_VOLTAGE,
> > + .channel = DC_TI_ADC_VBAT,
> > + .address = DC_TI_ADC_DATA_REG_CH(0),
> > + .datasheet_name = "CH0",
> > + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
> > + BIT(IIO_CHAN_INFO_SCALE) |
> > + BIT(IIO_CHAN_INFO_PROCESSED),
> > + }, {
> > + .indexed = 1,
> > + .type = IIO_TEMP,
> > + .channel = DC_TI_ADC_PMICTEMP,
> > + .address = DC_TI_ADC_DATA_REG_CH(1),
> > + .datasheet_name = "CH1",
> > + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
> > + }, {
> > + .indexed = 1,
> > + .type = IIO_TEMP,
> > + .channel = DC_TI_ADC_BATTEMP,
> > + .address = DC_TI_ADC_DATA_REG_CH(2),
> > + .datasheet_name = "CH2",
> > + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
> > + }, {
> > + .indexed = 1,
> > + .type = IIO_TEMP,
> > + .channel = DC_TI_ADC_SYSTEMP0,
> > + .address = DC_TI_ADC_DATA_REG_CH(3),
> > + .datasheet_name = "CH3",
> > + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
> > + }
> > +};
>
> Question for Jonathan: If we don't know the scale on these
> temperature channels, should we implement IIO_CHAN_INFO_SCALE
> and just always return an error? My understanding is that
> by not implementing it, the scale is assumed to be 1, which
> likely isn't correct in in this case.
Good question. We have quite a bit of precedence of just
not providing scale in these cases. The docs for the main block of _scale
do say
"If known for a device, scale to be applied to <type>Y[_name]_raw
post addition of <type>[Y][_name]_offset in order to obtain the
measured value in <type> units as specified in
<type>[Y][_name]_raw documentation. "
Rather than trying to fix all those, shall we tweak the docs
to say that scale is assumed to be 1 if offset is provided?
If neither is there, the channel can be _PROCESSED anyway.
Your suggestion of returning an error would have been somewhat neat
long ago, but now I think it will just be too confusing for userspace.
Jonathan
>
>
next prev parent reply other threads:[~2025-07-31 11:12 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-27 21:06 [PATCH v3 0/2] iio: adc: Add Intel Dollar Cove TI PMIC ADC driver Hans de Goede
2025-07-27 21:06 ` [PATCH v3 1/2] iio: Improve iio_read_channel_processed_scale() precision Hans de Goede
2025-07-29 17:26 ` David Lechner
2025-08-10 19:25 ` Hans de Goede
2025-08-10 21:12 ` Hans de Goede
2025-08-11 12:37 ` Andy Shevchenko
2025-08-11 14:35 ` Hans de Goede
2025-08-11 14:50 ` Andy Shevchenko
2025-07-27 21:06 ` [PATCH v3 2/2] iio: adc: Add Intel Dollar Cove TI PMIC ADC driver Hans de Goede
2025-07-28 18:41 ` Jonathan Cameron
2025-07-29 17:50 ` David Lechner
2025-07-31 11:12 ` Jonathan Cameron [this message]
2025-08-02 11:46 ` Jonathan Cameron
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=20250731121255.000025c5@huawei.com \
--to=jonathan.cameron@huawei.com \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=hansg@kernel.org \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=nuno.sa@analog.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.