* [PATCH v2] media: i2c: ov5645: Keep the sensor in software power-down during init
@ 2026-09-14 2:42 Xiaolei Wang
2026-10-08 8:54 ` xiaolei
0 siblings, 1 reply; 2+ messages in thread
From: Xiaolei Wang @ 2026-09-14 2:42 UTC (permalink / raw)
To: hverkuil+cisco, sakari.ailus, mehdi.djait, u.kleine-koenig,
laurent.pinchart, jacopo, p.zabel, ezequiel, mchehab+samsung,
festevam, xiaoleiwangxiaolei
Cc: linux-media, linux-kernel, stable
On the RK3576 platform, after ov5645_global_init_setting completes and
before stream on, the CSI host reports a high rate of CRC errors:
MIPI_CSI2 ERR1:0x1000000 (crc,vc: 0)
These errors occur exclusively in the window between init completion and
stream on. Once preview starts and the sensor outputs valid HS data, no
further CRC errors are observed.
Commit 092e8eb90a7d ("media: i2c: ov5645: Fix power sequence") reworked
the power sequence to properly enter LP-11 during power-up. As part of
this change, the SYSTEM_CTRL0_STOP (0x42) write on the power-up path was
replaced with usleep_range(500, 1000). Since ov5645_global_init_setting[]
ends with SYSTEM_CTRL0_START (0x02), the sensor core is left awake from
the end of initialisation all the way to stream on, driving the data
lanes while the host is not expecting any traffic. Reverting the commit
resolves the CRC errors, confirming it as the triggering change.
ov5645_global_init_setting[] writes SYSTEM_CTRL0 four times: STOP at the
very beginning, then START, STOP and START again near the end. Register
writes are accepted over I2C while the sensor is in software power-down,
so there is no reason to leave it briefly, and the three trailing writes
serve no purpose. Drop them and keep the sensor in software power-down
for the whole initialisation sequence. It is woken up only by
ov5645_enable_streams(), once the host is ready to receive data.
This preserves the LP-11 compliance improvements from commit
092e8eb90a7d ("media: i2c: ov5645: Fix power sequence"), as the MIPI PHY
stays powered and parked in LP-11, while eliminating the CRC errors on
RK3576.
While at it, use the register macros for the remaining SYSTEM_CTRL0
write.
Fixes: 092e8eb90a7d ("media: i2c: ov5645: Fix power sequence")
Cc: stable@kernel.org
Signed-off-by: Xiaolei Wang <xiaoleiwangxiaolei@gmail.com>
---
Changes in v2:
- Instead of appending another SYSTEM_CTRL0_STOP write, remove the three
redundant SYSTEM_CTRL0 writes at the end of the init sequence, so the
sensor simply stays in software power-down from the initial STOP until
stream on
- Use OV5645_SYSTEM_CTRL0 / OV5645_SYSTEM_CTRL0_STOP instead of raw
values for the remaining write
Link to v1: https://patchwork.linuxtv.org/project/linux-media/patch/20260826085432.1482348-1-xiaoleiwangxiaolei@gmail.com/
drivers/media/i2c/ov5645.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/media/i2c/ov5645.c b/drivers/media/i2c/ov5645.c
index c772ef6e51d2..2985966ab09f 100644
--- a/drivers/media/i2c/ov5645.c
+++ b/drivers/media/i2c/ov5645.c
@@ -115,7 +115,7 @@ static inline struct ov5645 *to_ov5645(struct v4l2_subdev *sd)
static const struct reg_value ov5645_global_init_setting[] = {
{ 0x3103, 0x11 },
- { 0x3008, 0x42 },
+ { OV5645_SYSTEM_CTRL0, OV5645_SYSTEM_CTRL0_STOP },
{ 0x3103, 0x03 },
{ 0x3503, 0x07 },
{ 0x3002, 0x1c },
@@ -198,7 +198,6 @@ static const struct reg_value ov5645_global_init_setting[] = {
{ 0x5a00, 0x08 },
{ 0x5a21, 0x00 },
{ 0x5a24, 0x00 },
- { 0x3008, 0x02 },
{ 0x3503, 0x00 },
{ 0x5180, 0xff },
{ 0x5181, 0xf2 },
@@ -347,8 +346,6 @@ static const struct reg_value ov5645_global_init_setting[] = {
{ 0x3a11, 0x60 },
{ 0x3a1f, 0x14 },
{ 0x0601, 0x02 },
- { 0x3008, 0x42 },
- { 0x3008, 0x02 },
{ OV5645_IO_MIPI_CTRL00, 0x40 },
{ OV5645_MIPI_CTRL00, 0x24 },
{ OV5645_PAD_OUTPUT00, 0x70 }
--
2.34.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v2] media: i2c: ov5645: Keep the sensor in software power-down during init
2026-09-14 2:42 [PATCH v2] media: i2c: ov5645: Keep the sensor in software power-down during init Xiaolei Wang
@ 2026-10-08 8:54 ` xiaolei
0 siblings, 0 replies; 2+ messages in thread
From: xiaolei @ 2026-10-08 8:54 UTC (permalink / raw)
To: hverkuil+cisco, sakari.ailus, mehdi.djait, u.kleine-koenig,
laurent.pinchart, jacopo, p.zabel, ezequiel, mchehab+samsung,
festevam
Cc: linux-media, linux-kernel, stable
Humble ping...
thanks
xiaolei
On 9/14/26 10:42, Xiaolei Wang wrote:
> On the RK3576 platform, after ov5645_global_init_setting completes and
> before stream on, the CSI host reports a high rate of CRC errors:
>
> MIPI_CSI2 ERR1:0x1000000 (crc,vc: 0)
>
> These errors occur exclusively in the window between init completion and
> stream on. Once preview starts and the sensor outputs valid HS data, no
> further CRC errors are observed.
>
> Commit 092e8eb90a7d ("media: i2c: ov5645: Fix power sequence") reworked
> the power sequence to properly enter LP-11 during power-up. As part of
> this change, the SYSTEM_CTRL0_STOP (0x42) write on the power-up path was
> replaced with usleep_range(500, 1000). Since ov5645_global_init_setting[]
> ends with SYSTEM_CTRL0_START (0x02), the sensor core is left awake from
> the end of initialisation all the way to stream on, driving the data
> lanes while the host is not expecting any traffic. Reverting the commit
> resolves the CRC errors, confirming it as the triggering change.
>
> ov5645_global_init_setting[] writes SYSTEM_CTRL0 four times: STOP at the
> very beginning, then START, STOP and START again near the end. Register
> writes are accepted over I2C while the sensor is in software power-down,
> so there is no reason to leave it briefly, and the three trailing writes
> serve no purpose. Drop them and keep the sensor in software power-down
> for the whole initialisation sequence. It is woken up only by
> ov5645_enable_streams(), once the host is ready to receive data.
>
> This preserves the LP-11 compliance improvements from commit
> 092e8eb90a7d ("media: i2c: ov5645: Fix power sequence"), as the MIPI PHY
> stays powered and parked in LP-11, while eliminating the CRC errors on
> RK3576.
>
> While at it, use the register macros for the remaining SYSTEM_CTRL0
> write.
>
> Fixes: 092e8eb90a7d ("media: i2c: ov5645: Fix power sequence")
> Cc: stable@kernel.org
> Signed-off-by: Xiaolei Wang <xiaoleiwangxiaolei@gmail.com>
> ---
>
> Changes in v2:
> - Instead of appending another SYSTEM_CTRL0_STOP write, remove the three
> redundant SYSTEM_CTRL0 writes at the end of the init sequence, so the
> sensor simply stays in software power-down from the initial STOP until
> stream on
> - Use OV5645_SYSTEM_CTRL0 / OV5645_SYSTEM_CTRL0_STOP instead of raw
> values for the remaining write
>
> Link to v1: https://patchwork.linuxtv.org/project/linux-media/patch/20260826085432.1482348-1-xiaoleiwangxiaolei@gmail.com/
>
> drivers/media/i2c/ov5645.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/media/i2c/ov5645.c b/drivers/media/i2c/ov5645.c
> index c772ef6e51d2..2985966ab09f 100644
> --- a/drivers/media/i2c/ov5645.c
> +++ b/drivers/media/i2c/ov5645.c
> @@ -115,7 +115,7 @@ static inline struct ov5645 *to_ov5645(struct v4l2_subdev *sd)
>
> static const struct reg_value ov5645_global_init_setting[] = {
> { 0x3103, 0x11 },
> - { 0x3008, 0x42 },
> + { OV5645_SYSTEM_CTRL0, OV5645_SYSTEM_CTRL0_STOP },
> { 0x3103, 0x03 },
> { 0x3503, 0x07 },
> { 0x3002, 0x1c },
> @@ -198,7 +198,6 @@ static const struct reg_value ov5645_global_init_setting[] = {
> { 0x5a00, 0x08 },
> { 0x5a21, 0x00 },
> { 0x5a24, 0x00 },
> - { 0x3008, 0x02 },
> { 0x3503, 0x00 },
> { 0x5180, 0xff },
> { 0x5181, 0xf2 },
> @@ -347,8 +346,6 @@ static const struct reg_value ov5645_global_init_setting[] = {
> { 0x3a11, 0x60 },
> { 0x3a1f, 0x14 },
> { 0x0601, 0x02 },
> - { 0x3008, 0x42 },
> - { 0x3008, 0x02 },
> { OV5645_IO_MIPI_CTRL00, 0x40 },
> { OV5645_MIPI_CTRL00, 0x24 },
> { OV5645_PAD_OUTPUT00, 0x70 }
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-08 8:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-14 2:42 [PATCH v2] media: i2c: ov5645: Keep the sensor in software power-down during init Xiaolei Wang
2026-10-08 8:54 ` xiaolei
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®