Skip to contentSkip to conversation

media: ov5640: Enable MIPI interface in ov5640_set_power_mipi()

PATCH In review Marek Vasut 2 participants 2 messages Aug 2, 2023 – Aug 3, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 media: ov5640: Enable MIPI interface in ov5640_set_power_mipi()

Set OV5640_REG_IO_MIPI_CTRL00 bit 2 to 1 instead of 0, since 1 means MIPI CSI2 interface, while 0 means CPI parallel interface.

In the ov5640_set_power_mipi() the interface should obviously be set to MIPI CSI2 since this functions is used to power up the sensor when operated in MIPI CSI2 mode. The sensor should not be in CPI mode in that case.

This fixes a corner case where capturing the first frame on i.MX8MN with CSI/ISI resulted in corrupted frame.

Fixes aa4bb8b8838f ("media: ov5640: Re-work MIPI startup sequence")

---
Cc: Aishwarya Kothari <[email protected]>
Cc: Francesco Dolcini <[email protected]>
Cc: Hans Verkuil <[email protected]>
Cc: Hugues FRUCHET <[email protected]>
Cc: Jacopo Mondi <[email protected]>
Cc: Jai Luthra <[email protected]>
Cc: Marcel Ziswiler <[email protected]>
Cc: Mauro Carvalho Chehab <[email protected]>
Cc: Philipp Zabel <[email protected]>
Cc: Sakari Ailus <[email protected]>
Cc: Steve Longerbeam <[email protected]>
Cc: [email protected]
---
V2: - Update commit message to mention this fixes the first corrupted frame
- Collect RB/TB
- Expand CC list

---
 drivers/media/i2c/ov5640.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/i2c/ov5640.c +2 -2
index ff0aef915fca5..5fe85aa2d2ec4 100644
@@ -2539,9 +2539,9 @@ static int ov5640_set_power_mipi(struct ov5640_dev *sensor, bool on)
 	 *		  "ov5640_set_stream_mipi()")
 	 * [4] = 0	: Power up MIPI HS Tx
 	 * [3] = 0	: Power up MIPI LS Rx
-	 * [2] = 0	: MIPI interface disabled
+	 * [2] = 1	: MIPI interface enabled
 	 */
-	ret = ov5640_write_reg(sensor, OV5640_REG_IO_MIPI_CTRL00, 0x40);
+	ret = ov5640_write_reg(sensor, OV5640_REG_IO_MIPI_CTRL00, 0x44);
 	if (ret)
 		return ret;
 
Signature · 1 line
2.40.1
Tested-by on v2 1/1
#1 lore raw

Hi Marek,

Thanks for the patch.

Quoted 8 lines · Marek Vasut

Set OV5640_REG_IO_MIPI_CTRL00 bit 2 to 1 instead of 0, since 1 means MIPI CSI2 interface, while 0 means CPI parallel interface.

In the ov5640_set_power_mipi() the interface should obviously be set to MIPI CSI2 since this functions is used to power up the sensor when operated in MIPI CSI2 mode. The sensor should not be in CPI mode in that case.

Quoted 6 lines

This fixes a corner case where capturing the first frame on i.MX8MN with CSI/ISI resulted in corrupted frame.

Fixes aa4bb8b8838f ("media: ov5640: Re-work MIPI startup sequence")
Quoted 42 lines

---
Cc: Aishwarya Kothari <[email protected]>
Cc: Francesco Dolcini <[email protected]>
Cc: Hans Verkuil <[email protected]>
Cc: Hugues FRUCHET <[email protected]>
Cc: Jacopo Mondi <[email protected]>
Cc: Jai Luthra <[email protected]>
Cc: Marcel Ziswiler <[email protected]>
Cc: Mauro Carvalho Chehab <[email protected]>
Cc: Philipp Zabel <[email protected]>
Cc: Sakari Ailus <[email protected]>
Cc: Steve Longerbeam <[email protected]>
Cc: [email protected]
---
V2: - Update commit message to mention this fixes the first corrupted frame
- Collect RB/TB
- Expand CC list

---
 drivers/media/i2c/ov5640.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/i2c/ov5640.c +2 -2
index ff0aef915fca5..5fe85aa2d2ec4 100644
@@ -2539,9 +2539,9 @@ static int ov5640_set_power_mipi(struct ov5640_dev *sensor, bool on)
 	 *		  "ov5640_set_stream_mipi()")
 	 * [4] = 0	: Power up MIPI HS Tx
 	 * [3] = 0	: Power up MIPI LS Rx
-	 * [2] = 0	: MIPI interface disabled
+	 * [2] = 1	: MIPI interface enabled
 	 */
-	ret = ov5640_write_reg(sensor, OV5640_REG_IO_MIPI_CTRL00, 0x40);
+	ret = ov5640_write_reg(sensor, OV5640_REG_IO_MIPI_CTRL00, 0x44);
 	if (ret)
 		return ret;
 
Signature · 1 line
2.40.1
Signature · 4 lines
Thanks,
Jai

GPG Fingerprint: 4DE0 D818 E5D5 75E8 D45A AFC5 43DE 91F9 249A 7145