Re: [PATCH v9 1/3] iio: adc: ti-ads1100: Fix incorrect reading when datarate changed in single mode

From: Andy Shevchenko

Date: Mon Aug 10 2026 - 14:47:20 EST


On Tue, Aug 04, 2026 at 09:28:38PM +0200, Jakub Szczudlo wrote:
> When device is suspended and it is in single mode then changing
> datarate doesn't make it actually wait for new measurement, so to
> be sure that read after change is correct, functions that changes
> datarate and gain will wait for a new data.

A couple of minor issues (no need to resend just for these).

...

> +static int ads1100_start_single_conversion(struct ads1100_data *data)
> +{
> + u8 config = data->config | ADS1100_CFG_SC;
> + int ret;
> +
> + ret = i2c_master_send(data->client, &config, sizeof(config));
> + if (ret < 0) {
> + dev_err(&data->client->dev, "I2C write fail: %d\n", ret);
> + return ret;
> + }

> + /* Need to wait because of change from continuous to single mode */

Broken indentation.

> + ret = ads1100_wait_single_conversion(data);
> + if (ret)
> + return ret;
> +
> + config |= ADS1100_CFG_ST_BSY;
> +
> + ret = i2c_master_send(data->client, &config, sizeof(config));
> + if (ret < 0) {
> + dev_err(&data->client->dev, "I2C write fail: %d\n", ret);
> + return ret;
> + }
> +
> + /* No need to cache it, it's status bit */
> + data->config = config & ~ADS1100_CFG_ST_BSY;
> +
> + return 0;
> +}
> +
> +static int ads1100_poll_data_ready(struct ads1100_data *data)
> +{
> + int ret;
> +
> + ret = ads1100_start_single_conversion(data);
> + if (ret)
> + return ret;
> +
> + ret = ads1100_wait_single_conversion(data);
> + if (ret)
> + return ret;
> +
> + return ads1100_set_config_bits(data, ADS1100_CFG_SC,
> + ADS1100_CONTINUOUS);

It's one line (81 characters which is acceptable).

> +}

--
With Best Regards,
Andy Shevchenko