[PATCH 2/4] iio: proximity: vl53l0x-i2c: Add optional vddio supply

From: Petr Hodina via B4 Relay

Date: Mon Jan 19 2026 - 12:20:09 EST


From: Petr Hodina <petr.hodina@xxxxxxxxxxxxxx>

The VL53L0X can be powered using separate core (VDD) and I/O (VDDIO)
supplies.

Add support for an optional vio regulator and enable/disable it during
power on/off when present. Update the device tree binding to document the
new optional supply.

Signed-off-by: Petr Hodina <petr.hodina@xxxxxxxxxxxxxx>
---
drivers/iio/proximity/vl53l0x-i2c.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)

diff --git a/drivers/iio/proximity/vl53l0x-i2c.c b/drivers/iio/proximity/vl53l0x-i2c.c
index ad3e46d47fa8..7bfab396377a 100644
--- a/drivers/iio/proximity/vl53l0x-i2c.c
+++ b/drivers/iio/proximity/vl53l0x-i2c.c
@@ -55,6 +55,7 @@ struct vl53l0x_data {
struct i2c_client *client;
struct completion completion;
struct regulator *vdd_supply;
+ struct regulator *vio_supply;
struct gpio_desc *reset_gpio;
struct iio_trigger *trig;
};
@@ -256,6 +257,8 @@ static void vl53l0x_power_off(void *_data)
gpiod_set_value_cansleep(data->reset_gpio, 1);

regulator_disable(data->vdd_supply);
+ if (data->vio_supply)
+ regulator_disable(data->vio_supply);
}

static int vl53l0x_power_on(struct vl53l0x_data *data)
@@ -266,6 +269,12 @@ static int vl53l0x_power_on(struct vl53l0x_data *data)
if (ret)
return ret;

+ if (data->vio_supply) {
+ ret = regulator_enable(data->vio_supply);
+ if (ret)
+ return ret;
+ }
+
gpiod_set_value_cansleep(data->reset_gpio, 0);

usleep_range(3200, 5000);
@@ -338,6 +347,13 @@ static int vl53l0x_probe(struct i2c_client *client)
return dev_err_probe(&client->dev, PTR_ERR(data->vdd_supply),
"Unable to get VDD regulator\n");

+ data->vio_supply = devm_regulator_get_optional(&client->dev, "vio");
+ if (PTR_ERR(data->vio_supply) == -ENODEV)
+ data->vio_supply = NULL;
+ else if (IS_ERR(data->vio_supply))
+ return dev_err_probe(&client->dev, PTR_ERR(data->vio_supply),
+ "Unable to get VDDIO regulator\n");
+
data->reset_gpio = devm_gpiod_get_optional(&client->dev, "reset", GPIOD_OUT_HIGH);
if (IS_ERR(data->reset_gpio))
return dev_err_probe(&client->dev, PTR_ERR(data->reset_gpio),

--
2.52.0