From: sashiko-bot@kernel.org
To: "Kurt Borja" <kuurtb@gmail.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v3 2/9] iio: adc: add the ti-ads1262 driver
Date: Sat, 08 Aug 2026 04:11:45 +0000 [thread overview]
Message-ID: <20260808041146.24D991F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260807-ads126x-v3-2-f89925d72792@gmail.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Inadequate delay after device reset will cause initialization to fail or silently leave the ADC in its default state, corrupting all data reads.
- [Medium] Regmap debugfs accesses bypass the driver's custom transfer lock, causing an unconditional lockdep splat.
--
--- Patch [2]: [PATCH v3 2/9] iio: adc: add the ti-ads1262 driver ---
commit 4680c0f9dff8858f99d46d1498d733421fe96922
Author: Kurt Borja <kuurtb@gmail.com>
iio: adc: add the ti-ads1262 driver
Add the ti-ads1262 driver with initial support for the primary ADC (ADC1).
The ADS1263 auxiliary ADC (ADC2) is handled by a separate driver and
interoperability considerations were taken into account.
> diff --git a/drivers/iio/adc/ti-ads1262.c b/drivers/iio/adc/ti-ads1262.c
> new file mode 100644
> index 0000000000000..d78e5e3ae13ee
> --- /dev/null
> +++ b/drivers/iio/adc/ti-ads1262.c
[ ... ]
> +static int ads1262_dev_reset(struct ads1262 *st)
> +{
> + int ret;
> +
> + if (st->reset_gpiod) {
> + ret = gpiod_set_value_cansleep(st->reset_gpiod, 1);
> + if (ret)
> + return ret;
> +
> + /*
> + * The RESET pulse timing requirement is 4 clock cycles, at the
> + * minimum clock rate this is 4 microseconds.
> + */
> + fsleep(4);
> +
> + ret = gpiod_set_value_cansleep(st->reset_gpiod, 0);
> + if (ret)
> + return ret;
> +
> + /*
> + * The RESET timing requirement is 8 clock cycles, at the
> + * minimum clock rate this is 8 microseconds
> + */
> + fsleep(8);
> + } else {
> + ret = ads1262_dev_cmd(st, ADS1262_OPCODE_RESET);
> + if (ret)
> + return ret;
> +
> + /*
> + * The RESET timing requirement is 8 clock cycles, at the
> + * minimum clock rate this is 8 microseconds
> + */
> + fsleep(8);
[Severity: High]
Is the 8 microsecond delay sufficient for the device to initialize after reset?
The standard ADC initialization requirement is typically much longer, requiring
4096 clock cycles for recovery (which corresponds to ~555 microseconds at
7.3728 MHz or ~4 milliseconds at 1 MHz).
If the delay is severely inadequate, the device might ignore the subsequent
SPI configuration writes in ads1262_dev_configure().
This could leave the STATUS and CRC bytes enabled in the data output format
by default, causing ads1262_channel_read() to read the 1-byte STATUS followed
by the upper 24 bits of data instead of the actual 32-bit conversion data,
corrupting the readings.
> + }
> +
> + return 0;
> +}
[ ... ]
> +static const struct regmap_config ads1262_regmap_config = {
> + .reg_bits = 8,
> + .val_bits = 8,
> + .writeable_reg = ads1262_writeable_reg,
> + .readable_reg = ads1262_readable_reg,
> + .volatile_reg = ads1262_volatile_reg,
> + .reg_defaults = ads1262_reg_defaults,
> + .num_reg_defaults = ARRAY_SIZE(ads1262_reg_defaults),
> + .max_register = ADS1262_ADC2FSC1_REG,
> + .can_sleep = true,
> + .cache_type = REGCACHE_MAPLE,
> +};
[Severity: Medium]
Could this configuration cause a lockdep warning when accessing the regmap
debugfs interface?
The driver provides custom regmap callbacks that assert st->xfer_lock is held,
but ads1262_regmap_config does not define custom .lock and .unlock callbacks.
Because of this, the regmap core will use its default internal mutex.
When userspace reads the regmap debugfs file, it will call into
ads1262_regmap_read() without holding st->xfer_lock:
> +static int ads1262_regmap_read(void *context, const void *reg_buf,
> + size_t reg_size, void *val_buf, size_t val_size)
> +{
> + struct ads1262 *st = context;
> + u8 tx[2];
> +
> + lockdep_assert_held(&st->xfer_lock);
This assertion would unconditionally fail.
> +
> + /*
> + * The register read operation uses a two byte command header followed
> + * by the register data:
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260807-ads126x-v3-0-f89925d72792@gmail.com?part=2
next prev parent reply other threads:[~2026-08-08 4:11 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-08 3:58 [PATCH v3 0/9] iio: adc: Add TI ADS126X ADC family support Kurt Borja
2026-08-08 3:58 ` [PATCH v3 1/9] dt-bindings: iio: adc: support the TI ADS126x ADC family Kurt Borja
2026-08-08 4:08 ` sashiko-bot
2026-08-08 18:38 ` David Lechner
2026-08-09 8:26 ` Kurt Borja
2026-08-08 3:58 ` [PATCH v3 2/9] iio: adc: add the ti-ads1262 driver Kurt Borja
2026-08-08 4:11 ` sashiko-bot [this message]
2026-08-08 18:39 ` David Lechner
2026-08-09 8:26 ` Kurt Borja
2026-08-08 22:28 ` Uwe Kleine-König
2026-08-09 16:24 ` Kurt Borja
2026-08-08 3:58 ` [PATCH v3 3/9] iio: adc: ti-ads1262: support per-channel sampling frequency Kurt Borja
2026-08-08 4:11 ` sashiko-bot
2026-08-08 18:39 ` David Lechner
2026-08-09 8:27 ` Kurt Borja
2026-08-08 3:58 ` [PATCH v3 4/9] iio: adc: ti-ads1262: support per-channel reference and gain Kurt Borja
2026-08-08 18:39 ` David Lechner
2026-08-09 8:28 ` Kurt Borja
2026-08-08 3:58 ` [PATCH v3 5/9] iio: adc: ti-ads1262: support input chopping Kurt Borja
2026-08-08 18:39 ` David Lechner
2026-08-08 3:58 ` [PATCH v3 6/9] iio: adc: ti-ads1262: support excitation currents Kurt Borja
2026-08-08 4:13 ` sashiko-bot
2026-08-08 18:39 ` David Lechner
2026-08-08 3:58 ` [PATCH v3 7/9] iio: adc: ti-ads1262: support triggered buffer sampling Kurt Borja
2026-08-08 4:09 ` sashiko-bot
2026-08-08 18:39 ` David Lechner
2026-08-09 8:28 ` Kurt Borja
2026-08-08 3:58 ` [PATCH v3 8/9] iio: adc: ti-ads1262: support REFOUT and VBIAS regulators Kurt Borja
2026-08-08 4:11 ` sashiko-bot
2026-08-08 18:40 ` David Lechner
2026-08-09 8:28 ` Kurt Borja
2026-08-08 3:58 ` [PATCH v3 9/9] iio: adc: ti-ads1262: support common mode supplies Kurt Borja
2026-08-08 18:40 ` David Lechner
2026-08-09 8:29 ` Kurt Borja
2026-08-08 18:37 ` [PATCH v3 0/9] iio: adc: Add TI ADS126X ADC family support David Lechner
2026-08-09 8:29 ` 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=20260808041146.24D991F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=kuurtb@gmail.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