[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260123091353.420218cc@jic23-huawei>
Date: Fri, 23 Jan 2026 09:13:53 +0000
From: Jonathan Cameron <jic23@...nel.org>
To: Petr Hodina via B4 Relay <devnull+petr.hodina.protonmail.com@...nel.org>
Cc: petr.hodina@...tonmail.com, Song Qiang <songqiang1304521@...il.com>,
David Lechner <dlechner@...libre.com>, Nuno Sá
<nuno.sa@...log.com>, Andy Shevchenko <andy@...nel.org>, Rob Herring
<robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor Dooley
<conor+dt@...nel.org>, Liam Girdwood <lgirdwood@...il.com>, Mark Brown
<broonie@...nel.org>, David Heidelberg <david@...t.cz>,
linux-iio@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/4] iio: proximity: vl53l0x-i2c: Add optional vddio
supply
On Mon, 19 Jan 2026 18:19:56 +0100
Petr Hodina via B4 Relay <devnull+petr.hodina.protonmail.com@...nel.org> wrote:
> From: Petr Hodina <petr.hodina@...tonmail.com>
>
> 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.
In what sense is it optional? Some change to device config to say don't
use it, or simply might not be in DT binding but in that case is always on?
If the second just let the regulator framework provide a stub regulator.
That is in the driver don't treat it as optional and all should work fine.
>
> Signed-off-by: Petr Hodina <petr.hodina@...tonmail.com>
> ---
> 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),
>
Powered by blists - more mailing lists