diff mbox series

[v2] media: ov5640: Enable MIPI interface in ov5640_set_power_mipi()

Message ID 20230802144725.34099-1-marex@denx.de (mailing list archive)
State New, archived
Headers show
Series [v2] media: ov5640: Enable MIPI interface in ov5640_set_power_mipi() | expand

Commit Message

Marek Vasut Aug. 2, 2023, 2:47 p.m. UTC
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")
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Tested-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> # [Test on imx6q]
Signed-off-by: Marek Vasut <marex@denx.de>
---
Cc: Aishwarya Kothari <aishwarya.kothari@toradex.com>
Cc: Francesco Dolcini <francesco@dolcini.it>
Cc: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Cc: Hugues FRUCHET <hugues.fruchet@foss.st.com>
Cc: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Cc: Jai Luthra <j-luthra@ti.com>
Cc: Marcel Ziswiler <marcel@ziswiler.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Philipp Zabel <p.zabel@pengutronix.de>
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Steve Longerbeam <slongerbeam@gmail.com>
Cc: linux-media@vger.kernel.org
---
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(-)

Comments

Jai Luthra Aug. 3, 2023, 8:58 a.m. UTC | #1
Hi Marek,

Thanks for the patch.

On Aug 02, 2023 at 16:47:25 +0200, Marek Vasut wrote:
> 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")
> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
> Tested-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> # [Test on imx6q]

Tested-by: Jai Luthra <j-luthra@ti.com> # [Test on bplay, sk-am62]

> Signed-off-by: Marek Vasut <marex@denx.de>
> ---
> Cc: Aishwarya Kothari <aishwarya.kothari@toradex.com>
> Cc: Francesco Dolcini <francesco@dolcini.it>
> Cc: Hans Verkuil <hverkuil-cisco@xs4all.nl>
> Cc: Hugues FRUCHET <hugues.fruchet@foss.st.com>
> Cc: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
> Cc: Jai Luthra <j-luthra@ti.com>
> Cc: Marcel Ziswiler <marcel@ziswiler.com>
> Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
> Cc: Philipp Zabel <p.zabel@pengutronix.de>
> Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
> Cc: Steve Longerbeam <slongerbeam@gmail.com>
> Cc: linux-media@vger.kernel.org
> ---
> 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(-)
> 
> diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c
> index ff0aef915fca5..5fe85aa2d2ec4 100644
> --- a/drivers/media/i2c/ov5640.c
> +++ b/drivers/media/i2c/ov5640.c
> @@ -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;
>  
> -- 
> 2.40.1
> 
>
diff mbox series

Patch

diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c
index ff0aef915fca5..5fe85aa2d2ec4 100644
--- a/drivers/media/i2c/ov5640.c
+++ b/drivers/media/i2c/ov5640.c
@@ -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;