From: Jonathan Cameron <jic23@kernel.org>
To: Petr Hodina via B4 Relay <devnull+petr.hodina.protonmail.com@kernel.org>
Cc: petr.hodina@protonmail.com,
"Song Qiang" <songqiang1304521@gmail.com>,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Liam Girdwood" <lgirdwood@gmail.com>,
"Mark Brown" <broonie@kernel.org>,
"David Heidelberg" <david@ixit.cz>,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/4] iio: proximity: vl53l0x-i2c: Add optional vddio supply
Date: Fri, 23 Jan 2026 09:13:53 +0000 [thread overview]
Message-ID: <20260123091353.420218cc@jic23-huawei> (raw)
In-Reply-To: <20260119-vl53l0x-v1-2-cf71715a1353@protonmail.com>
On Mon, 19 Jan 2026 18:19:56 +0100
Petr Hodina via B4 Relay <devnull+petr.hodina.protonmail.com@kernel.org> wrote:
> From: Petr Hodina <petr.hodina@protonmail.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@protonmail.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),
>
next prev parent reply other threads:[~2026-01-23 9:14 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-19 17:19 [PATCH 0/4] iio: proximity: vl53l0x: power sequencing, optional VDDIO, raw I2C ID read Petr Hodina via B4 Relay
2026-01-19 17:19 ` [PATCH 1/4] iio: proximity: vl53l0x-i2c: Add optional vddio regulator Petr Hodina via B4 Relay
2026-01-20 10:35 ` Krzysztof Kozlowski
2026-01-20 10:41 ` Krzysztof Kozlowski
2026-01-19 17:19 ` [PATCH 2/4] iio: proximity: vl53l0x-i2c: Add optional vddio supply Petr Hodina via B4 Relay
2026-01-23 9:13 ` Jonathan Cameron [this message]
2026-01-19 17:19 ` [PATCH 3/4] iio: proximity: vl53l0x-i2c: Fix reset sequence Petr Hodina via B4 Relay
2026-01-19 18:22 ` Andy Shevchenko
2026-01-20 10:33 ` Krzysztof Kozlowski
2026-01-19 17:19 ` [PATCH 4/4] iio: proximity: vl53l0x-i2c: Use raw I2C access and read full device ID Petr Hodina via B4 Relay
2026-01-19 18:44 ` Andy Shevchenko
2026-01-20 10:42 ` Krzysztof Kozlowski
2026-01-23 9:25 ` Jonathan Cameron
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260123091353.420218cc@jic23-huawei \
--to=jic23@kernel.org \
--cc=andy@kernel.org \
--cc=broonie@kernel.org \
--cc=conor+dt@kernel.org \
--cc=david@ixit.cz \
--cc=devicetree@vger.kernel.org \
--cc=devnull+petr.hodina.protonmail.com@kernel.org \
--cc=dlechner@baylibre.com \
--cc=krzk+dt@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=petr.hodina@protonmail.com \
--cc=robh@kernel.org \
--cc=songqiang1304521@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox