iio: dac: ad5624r: Fix incorrect handling of an optional regulator.
authorJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 27 Jun 2021 16:32:37 +0000 (17:32 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 18 Sep 2021 11:40:18 +0000 (13:40 +0200)
commit9f11de56012c413140390de736d8c44800602750
treedfddbc1d6ead2b6213271723e9c03b8459ae35b1
parente78a0b4a339e8cc5343947680829f35a942b64fa
iio: dac: ad5624r: Fix incorrect handling of an optional regulator.

[ Upstream commit 97683c851f9cdbd3ea55697cbe2dcb6af4287bbd ]

The naming of the regulator is problematic.  VCC is usually a supply
voltage whereas these devices have a separate VREF pin.

Secondly, the regulator core might have provided a stub regulator if
a real regulator wasn't provided. That would in turn have failed to
provide a voltage when queried. So reality was that there was no way
to use the internal reference.

In order to avoid breaking any dts out in the wild, make sure to fallback
to the original vcc naming if vref is not available.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reported-by: kernel test robot <lkp@intel.com>
Acked-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20210627163244.1090296-9-jic23@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/iio/dac/ad5624r_spi.c