From: sashiko-bot@kernel.org
To: "Marcelo Schmitt" <marcelo.schmitt@analog.com>
Cc: robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v8 2/5] iio: adc: ltc2378: Add support for LTC2378-20 and similar ADCs
Date: Thu, 23 Jul 2026 20:04:51 +0000 [thread overview]
Message-ID: <20260723200452.082871F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <1c12e37f273d4f99916768e1a9b44dbae30f9d0c.1784835663.git.marcelo.schmitt@analog.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The IIO scale factor exported for the LTC2338-18 is incorrect due to an unaccounted internal resistor divider (missing 2.5x multiplier).
--
--- Patch [2]: [PATCH v8 2/5] iio: adc: ltc2378: Add support for LTC2378-20 and similar ADCs ---
commit 79bd7cc98e49057401d7fb8d26685b9092c4787e
Author: Marcelo Schmitt <marcelo.schmitt@analog.com>
iio: adc: ltc2378: Add support for LTC2378-20 and similar ADCs
Support for LTC2378-20 and similar analog-to-digital converters.
> diff --git a/drivers/iio/adc/ltc2378.c b/drivers/iio/adc/ltc2378.c
> new file mode 100644
> index 0000000000000..107388f870626
> --- /dev/null
> +++ b/drivers/iio/adc/ltc2378.c
[ ... ]
> +static const struct ltc2378_chip_info ltc2338_18_chip_info = {
> + .name = "ltc2338-18",
> + .internal_ref_uV = 2048000,
> + .chan = LTC2378_DIFF_CHANNEL(18),
> +};
[Severity: Medium]
Does this chip info need a field to indicate the scale multiplier?
The LTC2338-18 has an internal resistor divider which acts as a 2.5x multiplier,
but this struct doesn't currently contain a way to specify it.
[ ... ]
> +static int ltc2378_read_raw(struct iio_dev *indio_dev,
> + const struct iio_chan_spec *chan,
> + int *val, int *val2, long mask)
> +{
> + struct ltc2378_state *st = iio_priv(indio_dev);
> + int ret;
> +
> + switch (mask) {
[ ... ]
> + case IIO_CHAN_INFO_SCALE:
> + *val = st->ref_uV / MILLI;
[Severity: Medium]
Will this return an incorrect IIO scale factor for the LTC2338-18?
The scale is calculated purely based on the reference voltage here, which does
not account for the LTC2338-18's internal divider (missing the 2.5x multiplier).
This could lead to incorrect voltage calculations in userspace.
> + /*
> + * For all LTC2378-like devices, the amount of bits that express
> + * voltage magnitude depend on the polarity / output code format:
> + * - straight binary: All precision/resolution bits are used.
> + * - 2's complement: One of the precision bits is used for sign.
> + */
> + if (chan->scan_type.format == IIO_SCAN_FORMAT_SIGNED_INT)
> + *val2 = chan->scan_type.realbits - 1;
> + else
> + *val2 = chan->scan_type.realbits;
> +
> + return IIO_VAL_FRACTIONAL_LOG2;
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1784835663.git.marcelo.schmitt@analog.com?part=2
next prev parent reply other threads:[~2026-07-23 20:04 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-23 19:51 [PATCH v8 0/5] iio: adc: Add support for LTC2378 and similar ADCs Marcelo Schmitt
2026-07-23 19:52 ` [PATCH v8 1/5] dt-bindings: iio: adc: Add ltc2378 Marcelo Schmitt
2026-07-23 19:52 ` [PATCH v8 2/5] iio: adc: ltc2378: Add support for LTC2378-20 and similar ADCs Marcelo Schmitt
2026-07-23 20:04 ` sashiko-bot [this message]
2026-07-23 19:52 ` [PATCH v8 3/5] iio: adc: ltc2378: Enable high-speed data capture Marcelo Schmitt
2026-07-23 20:13 ` sashiko-bot
2026-07-23 19:53 ` [PATCH v8 4/5] iio: adc: ltc2378: Enable triggered buffer " Marcelo Schmitt
2026-07-23 19:53 ` [PATCH v8 5/5] iio: ABI: Encourage differential voltage ABI usage Marcelo Schmitt
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=20260723200452.082871F00A3D@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=marcelo.schmitt@analog.com \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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