Re: [PATCH 3/4] iio: proximity: vl53l0x-i2c: Fix reset sequence
From: Krzysztof Kozlowski
Date: Tue Jan 20 2026 - 05:33:28 EST
On Mon, Jan 19, 2026 at 06:19:57PM +0100, Petr Hodina wrote:
> Fix the reset GPIO handling and power-up timing to better match the
> VL53L0X reset requirements.
>
> Signed-off-by: Petr Hodina <petr.hodina@xxxxxxxxxxxxxx>
> ---
> drivers/iio/proximity/vl53l0x-i2c.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/iio/proximity/vl53l0x-i2c.c b/drivers/iio/proximity/vl53l0x-i2c.c
> index 7bfab396377a..6901ce7dd835 100644
> --- a/drivers/iio/proximity/vl53l0x-i2c.c
> +++ b/drivers/iio/proximity/vl53l0x-i2c.c
> @@ -275,9 +275,13 @@ static int vl53l0x_power_on(struct vl53l0x_data *data)
> return ret;
> }
>
> - gpiod_set_value_cansleep(data->reset_gpio, 0);
> -
> - usleep_range(3200, 5000);
> + usleep_range(5000, 6000);
> + if (data->reset_gpio) {
> + gpiod_set_value_cansleep(data->reset_gpio, 1);
> + usleep_range(5000, 6000);
> + gpiod_set_value_cansleep(data->reset_gpio, 0);
> + usleep_range(5000, 6000);
> + }
>
> return 0;
> }
> @@ -354,7 +358,7 @@ static int vl53l0x_probe(struct i2c_client *client)
> 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);
> + data->reset_gpio = devm_gpiod_get_optional(&client->dev, "reset", GPIOD_OUT_LOW);
This feels wrong - you are now bringing the device out of reset without
observing any of the reset sequence constraints.
Best regards,
Krzysztof