Re: [PATCH v3 2/3] iio: adc: hx711: refactor to per-chip hx711_chip_info structure

From: Andy Shevchenko

Date: Wed Apr 22 2026 - 16:17:00 EST


On Wed, Apr 22, 2026 at 11:29:09PM +0530, Piyush Patle wrote:

...

> config HX711
> - tristate "AVIA HX711 ADC for weight cells"
> + tristate "AVIA HX711 and compatible ADCs"
> depends on GPIOLIB
> select IIO_BUFFER
> select IIO_TRIGGERED_BUFFER
> help
> - If you say yes here you get support for AVIA HX711 ADC which is used
> - for weigh cells
> + If you say Y here you get support for the following AVIA ADCs:
> + - HX711
> + which are used for bridge sensors such as weigh cells.
>
> This driver uses two GPIOs, one acts as the clock and controls the
> channel selection and gain, the other one is used for the measurement

This along with top comment and other text doesn't belong to the change, please
split into separate patch.

> +/**
> + * struct hx711_chip_info - per-variant static configuration
> + * @name: IIO device name
> + * @channels: channel specification
> + * @num_channels: number of channels
> + * @iio_info: IIO info ops for this variant
> + */
> +struct hx711_chip_info {
> + const char *name;
> + const struct iio_chan_spec *channels;
> + unsigned int num_channels;
> + const struct iio_info *iio_info;
> +};


...

> /*
> - * delay after a rising edge on SCK until the data is ready DOUT
> - * this is dependent on the hx711 where the datasheet tells a
> - * maximum value of 100 ns
> - * but also on potential parasitic capacities on the wiring
> + * Delay after SCK rising edge before sampling DOUT.
> */

Doesn't seem like a part of this change.

...

> - for (i = 0; i < 24; i++) {
> + for (int i = 0; i < 24; i++) {

Be consistent. Why here is 'i' signed?

In any case doesn't belong to this change.

...

> - ret = hx711_read(hx711_data);
> + ret = hx711_read(hx711_data,
> + hx711_get_gain_to_pulse(hx711_data->gain_set));

This sounds like a separate change to me.

...

> -MODULE_DESCRIPTION("HX711 bitbanging driver - ADC for weight cells");
> +MODULE_DESCRIPTION("HX711 and compatible bitbanging ADC driver");

Doesn't belong to this change.

...

This needs to be split to 3 or even more patches!
- text in the MODULE_*(), top comments, and Kconfig
- chip_info initial change

- modifying the existing code to prepare for new HW support
(the above ^^^ might be done in a couple of patches)

--
With Best Regards,
Andy Shevchenko