iio:adc:ad7476: Handle the different regulators used by various parts.
authorJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 25 Apr 2021 16:31:53 +0000 (17:31 +0100)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Mon, 17 May 2021 12:49:08 +0000 (13:49 +0100)
commit7bf50a968a1cd02728e9120ad0216dc80f7a6fb0
treed0966d8f028d3a0ed13d53c88ec0eb113a1264ea
parent7f9ef8ed0f4020348342a5c87b0559aad90a29a9
iio:adc:ad7476: Handle the different regulators used by various parts.

Not all of the parts supported by this driver use single supply.
Hence we add chip_info fields to say what additional supplies exist
and in the case of vref, ensure that is used for the reference voltage
rather than vcc.

One corner case is the ad7091r which has an internal reference that
can be over-driven by an external reference connected on the vref pin.
To handle that force_ext_vref is introduced and set if an optional
vref regulator is present.

Tested using really simple QEMU model and some fixed regulators.

The devm_add_action_or_reset() callback is changed to take the
regulator as it's parameter so we can use one callback for all the
different regulators without having to store pointers to them in
the iio_priv() structure.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Michael Hennerich <michael.hennerich@analog.com>
Reported-by: kernel test robot <lkp@intel.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Link: https://lore.kernel.org/r/20210425163154.73209-2-jic23@kernel.org
drivers/iio/adc/ad7476.c