From: Saikiran <bjsaikiran@gmail.com>
To: linux-media@vger.kernel.org
Cc: linux-arm-msm@vger.kernel.org, rfoss@kernel.org,
todor.too@gmail.com, bryan.odonoghue@linaro.org, bod@kernel.org,
vladimir.zapolskiy@linaro.org, hansg@kernel.org,
sakari.ailus@linux.intel.com, mchehab@kernel.org,
stable@vger.kernel.org, Saikiran <bjsaikiran@gmail.com>
Subject: [PATCH v4 2/2] media: i2c: ov02c10: Correct power-on sequence and timing
Date: Tue, 27 Jan 2026 22:20:24 +0530 [thread overview]
Message-ID: <20260127165024.46156-3-bjsaikiran@gmail.com> (raw)
In-Reply-To: <20260127165024.46156-1-bjsaikiran@gmail.com>
The previous power-on sequence did not strictly follow the hardware timing
requirements (T1), potentially leading to initialization failures on some
platforms.
Update the sequence to match the datasheet and maintainer recommendations:
1. Assert XSHUTDOWN (reset) for 5ms (T1 >= 5ms) before enabling power
resources.
2. Enable clock and regulators in the standard order.
3. De-assert XSHUTDOWN.
4. Wait 5ms (T2 >= 5ms) for sensor boot before I2C access (using a wider
range for timer coalescing).
This ensures the sensor enters a clean state during cold boot.
Tested-on: Lenovo Yoga Slim 7x (Snapdragon X Elite)
Fixes: 44f8901 ("media: i2c: add OmniVision OV02C10 sensor driver")
Cc: stable@vger.kernel.org
Signed-off-by: Saikiran <bjsaikiran@gmail.com>
---
drivers/media/i2c/ov02c10.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/media/i2c/ov02c10.c b/drivers/media/i2c/ov02c10.c
index fa7cc48b769a..3bfbd0deb126 100644
--- a/drivers/media/i2c/ov02c10.c
+++ b/drivers/media/i2c/ov02c10.c
@@ -676,6 +676,12 @@ static int ov02c10_power_on(struct device *dev)
struct ov02c10 *ov02c10 = to_ov02c10(sd);
int ret;
+ /* Assert reset for 5ms to ensure sensor is in reset state */
+ if (ov02c10->reset) {
+ gpiod_set_value_cansleep(ov02c10->reset, 1);
+ usleep_range(5000, 6000);
+ }
+
ret = clk_prepare_enable(ov02c10->img_clk);
if (ret < 0) {
dev_err(dev, "failed to enable imaging clock: %d", ret);
@@ -691,10 +697,8 @@ static int ov02c10_power_on(struct device *dev)
}
if (ov02c10->reset) {
- /* Assert reset for at least 2ms on back to back off-on */
- usleep_range(2000, 2200);
gpiod_set_value_cansleep(ov02c10->reset, 0);
- usleep_range(5000, 5100);
+ usleep_range(5000, 5500);
}
return 0;
--
2.51.0
next prev parent reply other threads:[~2026-01-27 16:50 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-27 16:50 [PATCH v4 0/2] media: i2c: ov02c10: Fix race condition and power sequence Saikiran
2026-01-27 16:50 ` [PATCH v4 1/2] media: i2c: ov02c10: Fix use-after-free in remove function Saikiran
2026-01-27 16:50 ` Saikiran [this message]
2026-01-27 17:07 ` [PATCH v4 2/2] media: i2c: ov02c10: Correct power-on sequence and timing Sakari Ailus
2026-01-27 17:11 ` Saikiran B
2026-01-27 22:20 ` Bryan O'Donoghue
2026-01-28 6:13 ` Saikiran B
[not found] ` <MZajBkG4hU2kIZFDZbpq0WZOF_tJmASpmGr-7IH_qheO0We0Z45KNZPrQY4UmoqsWKOX3lSx1W_hnLtfKocXPw==@protonmail.internalid>
[not found] ` <CAAFDt1vmXg9L6axsDN6kpCQKZifOCRxtQeDpmRpHyejS1ORR+Q@mail.gmail.com>
2026-01-28 9:47 ` Bryan O'Donoghue
[not found] ` <CAAFDt1sqh=O-CpxbdcWueyqbiq4qyCrJHVH-_SS+KjEC9CyRhg@mail.gmail.com>
2026-01-28 10:41 ` Bryan O'Donoghue
2026-01-28 11:06 ` Saikiran B
2026-01-28 11:24 ` Bryan O'Donoghue
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=20260127165024.46156-3-bjsaikiran@gmail.com \
--to=bjsaikiran@gmail.com \
--cc=bod@kernel.org \
--cc=bryan.odonoghue@linaro.org \
--cc=hansg@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=rfoss@kernel.org \
--cc=sakari.ailus@linux.intel.com \
--cc=stable@vger.kernel.org \
--cc=todor.too@gmail.com \
--cc=vladimir.zapolskiy@linaro.org \
/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