Re: [PATCH 06/18] iio: adc: ad4170-4: Fix voltage bias programming

From: Andy Shevchenko

Date: Thu Dec 03 2026 - 12:12:33 EST


On Thu, Dec 03, 2026 at 04:19:46PM +0100, Janani Sunil wrote:
> The adi,vbias-pins are recorded in pins_fn[] when parsing the firmware,
> but V_BIAS is only written while setting up a thermocouple with
> excitation properties. The bias is therefore never applied for other
> channels, each thermocouple write replaces the whole register so a
> later channel clears the bias of an earlier one, and a write failure is
> logged and then discarded.
>
> Program V_BIAS once with all the listed pins after parsing them, and
> fail probe if the write fails.

...

> - unsigned int num_exc_pins, reg_val;
> + unsigned int num_exc_pins;
> struct device *dev = &st->spi->dev;
> u32 pins[2], exc_pins[4], exc_curs[4];
> bool ac_excited;

Preserve reversed xmas tree order.

...

> unsigned int vbias_pins[AD4170_MAX_ANALOG_PINS];
> struct ad4170_state *st = iio_priv(indio_dev);
> struct device *dev = &st->spi->dev;
> - unsigned int num_vbias_pins;
> + unsigned int num_vbias_pins, vbias_mask = 0;
> int reg_data, ret;
> u32 int_pin_sel;
> unsigned int i;

Ditto.

--
With Best Regards,
Andy Shevchenko