diff mbox series

[6/8] media: i2c: ov02e10: Implement specification t3 and t5 delays on power-up

Message ID 20250317-b4-media-comitters-next-25-03-13-ov02e10-v1-6-bd924634b889@linaro.org (mailing list archive)
State New
Headers show
Series RFT/RFC: Import IPU6 ov02e10 sensor driver and enable OF usage of it | expand

Commit Message

Bryan O'Donoghue March 17, 2025, 12:39 a.m. UTC
The ov02e10 specification says for power-on:

t3 = the time between dvdd stable and XSHUTDOWN deassert
t5 = the time between XSHUTDOWN deassert and SCCB ready

The power-off path in the spec shows no required delays between XSHUTDONW
and power-rail shut off so power-off is left alone.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 drivers/media/i2c/ov02e10.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Hans de Goede March 17, 2025, 9:04 a.m. UTC | #1
Hi,

On 17-Mar-25 01:39, Bryan O'Donoghue wrote:
> The ov02e10 specification says for power-on:
> 
> t3 = the time between dvdd stable and XSHUTDOWN deassert
> t5 = the time between XSHUTDOWN deassert and SCCB ready
> 
> The power-off path in the spec shows no required delays between XSHUTDONW
> and power-rail shut off so power-off is left alone.
> 
> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> ---
>  drivers/media/i2c/ov02e10.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/i2c/ov02e10.c b/drivers/media/i2c/ov02e10.c
> index 9ad70671a718ea0aaf80ad3adcc5738ee57a7ff6..40c4d3ee36e3e2a0bb8be3ff10d016e2bb9bbc9d 100644
> --- a/drivers/media/i2c/ov02e10.c
> +++ b/drivers/media/i2c/ov02e10.c
> @@ -579,7 +579,11 @@ static int ov02e10_power_on(struct device *dev)
>  		goto disable_clk;
>  	}
>  
> -	gpiod_set_value_cansleep(ov02e10->reset, 0);
> +	if (ov02e10->reset) {
> +		usleep_range(5000, 5100);
> +		gpiod_set_value_cansleep(ov02e10->reset, 0);
> +		usleep_range(8000, 8100);
> +	}
>  
>  	return 0;
>  


Note ATM ov02e10->reset is requested with GPIOD_OUT_LOW and it is not
guaranteed that it was high before that. It really should be requested
with GPIOD_OUT_HIGH so that it is guaranteed to be high before
ov02e10_power_on() gets called as the code expects here.

Regards,

Hans
diff mbox series

Patch

diff --git a/drivers/media/i2c/ov02e10.c b/drivers/media/i2c/ov02e10.c
index 9ad70671a718ea0aaf80ad3adcc5738ee57a7ff6..40c4d3ee36e3e2a0bb8be3ff10d016e2bb9bbc9d 100644
--- a/drivers/media/i2c/ov02e10.c
+++ b/drivers/media/i2c/ov02e10.c
@@ -579,7 +579,11 @@  static int ov02e10_power_on(struct device *dev)
 		goto disable_clk;
 	}
 
-	gpiod_set_value_cansleep(ov02e10->reset, 0);
+	if (ov02e10->reset) {
+		usleep_range(5000, 5100);
+		gpiod_set_value_cansleep(ov02e10->reset, 0);
+		usleep_range(8000, 8100);
+	}
 
 	return 0;