All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ariana Lazar" <ariana.lazar@microchip.com>
Cc: robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v4 9/9] iio: dac: add support for Microchip MCP48FEB02
Date: Wed, 19 Aug 2026 12:53:00 +0000	[thread overview]
Message-ID: <20260819125300.6B9211F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260819-mcp47feb02_refactor-v4-9-beb2aa3bfd09@microchip.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] The EEPROM write cycle polling timeout is too short, leading to sporadic -ETIMEDOUT errors and partial EEPROM updates.
--

--- Patch [9]: [PATCH v4 9/9] iio: dac: add support for Microchip MCP48FEB02 ---
commit f9a8ca3d3f3e9e1b7296c59e5fdc69c68349d1ae
Author: Ariana Lazar <ariana.lazar@microchip.com>

iio: dac: add support for Microchip MCP48FEB02

This patch adds SPI support for the Microchip MCP48FxBy1/2/4/8 series of DACs.
It introduces a new SPI driver module that registers devices using the common
core probe function.

[ ... ]

> diff --git a/drivers/iio/dac/mcp47feb02-spi.c b/drivers/iio/dac/mcp47feb02-spi.c
> new file mode 100644
> index 0000000000000..0c68d7c318cb2
> --- /dev/null
> +++ b/drivers/iio/dac/mcp47feb02-spi.c
> @@ -0,0 +1,145 @@
[ ... ]
> +static int mcp47feb02_spi_probe(struct spi_device *spi)
> +{
> +	const struct mcp47feb02_features *chip_features;
> +	struct device *dev = &spi->dev;
> +	struct regmap *regmap;
> +
> +	chip_features = spi_get_device_match_data(spi);
> +	if (!chip_features)
> +		return dev_err_probe(dev, -ENODEV, "No SPI device found\n");
> +
> +	if (chip_features->have_eeprom)
> +		regmap = devm_regmap_init_spi(spi, &mcp47feb02_regmap_config);
> +	else
> +		regmap = devm_regmap_init_spi(spi, &mcp47fvb02_regmap_config);
> +
> +	if (IS_ERR(regmap))
> +		return dev_err_probe(dev, PTR_ERR(regmap), "Error initializing SPI regmap\n");
> +
> +	return mcp47feb02_common_probe(chip_features, regmap);
> +}

[Severity: High]
This isn't a bug introduced by this patch, but I noticed a potential timeout
problem in the core driver that might affect these newly supported SPI devices.

In drivers/iio/dac/mcp47feb02-core.c:mcp47feb02_write_to_eeprom(), the EEPROM
write cycle polling timeout is set to 5 ms:

	ret = regmap_read_poll_timeout(data->regmap, MCP47FEB02_GAIN_CTRL_STATUS_REG_ADDR,
				       eewa_val,
				       !(eewa_val & MCP47FEB02_GAIN_BIT_STATUS_EEWA_MASK),
				       USEC_PER_MSEC, USEC_PER_MSEC * 5);

Could this short timeout cause sporadic -ETIMEDOUT errors during EEPROM writes?

The EEPROM write cycle (t_WC) for the MCP47/48FEBxx series can take up to 10 ms.
When a user writes to the store_eeprom sysfs attribute, this function is called
in a loop. Could a timeout here cause the sequence to abort midway, leaving
the EEPROM in an inconsistent, partially updated state?

The same 5 ms timeout appears again in store_eeprom_store():

	ret = regmap_read_poll_timeout(data->regmap, MCP47FEB02_GAIN_CTRL_STATUS_REG_ADDR, eewa_val,
				       !(eewa_val & MCP47FEB02_GAIN_BIT_STATUS_EEWA_MASK),
				       USEC_PER_MSEC, USEC_PER_MSEC * 5);

Would it be better to increase the timeout to at least 10 ms to match the
hardware maximum?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260819-mcp47feb02_refactor-v4-0-beb2aa3bfd09@microchip.com?part=9

      reply	other threads:[~2026-08-19 12:53 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-19 12:41 [PATCH v4 0/9] Refactor Microchip MCP47FEB02 I2C driver in separate modules to add support for MCP48FEB02 SPI driver Ariana Lazar
2026-08-19 12:41 ` [PATCH v4 1/9] iio: dac: mcp47feb02: initialize dac_data field in channel data struct at probe Ariana Lazar
2026-08-19 14:17   ` Andy Shevchenko
2026-08-19 12:41 ` [PATCH v4 2/9] iio: dac: mcp47feb02: correct gain bitshift " Ariana Lazar
2026-08-19 12:50   ` sashiko-bot
2026-08-19 14:15   ` Andy Shevchenko
2026-08-19 12:41 ` [PATCH v4 3/9] iio: dac: mcp47feb02: correct false state case in store_eeprom_store Ariana Lazar
2026-08-19 12:51   ` sashiko-bot
2026-08-19 14:18   ` Andy Shevchenko
2026-08-19 12:41 ` [PATCH v4 4/9] iio: dac: mcp47feb02: use dev_dbg for invalid label Ariana Lazar
2026-08-19 12:49   ` sashiko-bot
2026-08-19 14:23   ` Andy Shevchenko
2026-08-19 12:41 ` [PATCH v4 5/9] iio: dac: mcp47feb02: correct typo from a comment Ariana Lazar
2026-08-19 12:41 ` [PATCH v4 6/9] iio: dac: mcp47feb02: rename command mask define Ariana Lazar
2026-08-19 12:46   ` sashiko-bot
2026-08-19 12:41 ` [PATCH v4 7/9] iio: dac: mcp47feb02: refactor MCP47FEB02 I2C driver into two modules Ariana Lazar
2026-08-19 12:52   ` sashiko-bot
2026-08-19 12:41 ` [PATCH v4 8/9] dt-bindings: iio: dac: add support for MCP48FEB02 SPI Ariana Lazar
2026-08-19 12:41 ` [PATCH v4 9/9] iio: dac: add support for Microchip MCP48FEB02 Ariana Lazar
2026-08-19 12:53   ` sashiko-bot [this message]

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=20260819125300.6B9211F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=ariana.lazar@microchip.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --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 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.