]> www.infradead.org Git - users/hch/misc.git/commitdiff
iio: adc: ad7606: add enabling of optional Vrefin voltage
authorAngelo Dureghello <adureghello@baylibre.com>
Fri, 30 May 2025 14:27:57 +0000 (16:27 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Mon, 9 Jun 2025 06:45:36 +0000 (07:45 +0100)
Add optional refin voltage enabling. The property "refin-supply" is
already available and optional in the current fdt dt_schema.

Note that the driver does not need to take any actions if the supply
is not present because a pin strap is used to change the behavior
of the device if an external reference is connected.

Signed-off-by: Angelo Dureghello <adureghello@baylibre.com>
Link: https://patch.msgid.link/20250530-wip-bl-ad7606-reference-voltages-v2-2-d5e1ad7e6f14@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/ad7606.c

index 3bbe9c05b5edbc11e8016c995c6ab64104836e7b..9e489c05dea6f0a9fd144640fb0e23775eb4f3d8 100644 (file)
@@ -1335,6 +1335,11 @@ int ad7606_probe(struct device *dev, int irq, void __iomem *base_address,
                return dev_err_probe(dev, ret,
                                     "Failed to enable Vdrive supply\n");
 
+       ret = devm_regulator_get_enable_optional(dev, "refin");
+       if (ret && ret != -ENODEV)
+               return dev_err_probe(dev, ret,
+                                    "Failed to enable REFIN supply\n");
+
        st->chip_info = chip_info;
 
        if (st->chip_info->oversampling_num) {