[PATCH 11/13] media: i2c: ov5640: Initialize DVP polarities as default

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



With the bindings now updated to initialize the DVP synchronism
signals to the values reported by the datasheet, update the driver
to respect the same default values.

The driver works-around a documentation bug and reports the VSYNC
polarity control bit to be inverted. Regardless of the actual
value written to the hardware register, initialize the DVP configuration
to the defaults reported by the chip manual and the bindings document:

- VSYNC: active low
- HREF:	active low
- PCLK:	active high

Signed-off-by: Jacopo Mondi <jacopo+renesas@xxxxxxxxxx>
---
 drivers/media/i2c/ov5640.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c
index 2fe4a7ac0592..012ef1df59aa 100644
--- a/drivers/media/i2c/ov5640.c
+++ b/drivers/media/i2c/ov5640.c
@@ -1212,9 +1212,9 @@ static int ov5640_set_stream_dvp(struct ov5640_dev *sensor, bool on)
 {
 	int ret;
 	unsigned int flags = sensor->ep.bus.parallel.flags;
-	u8 pclk_pol = 0;
+	u8 pclk_pol = 1;
 	u8 hsync_pol = 0;
-	u8 vsync_pol = 0;
+	u8 vsync_pol = 1;
 
 	/*
 	 * Note about parallel port configuration.
@@ -1229,9 +1229,9 @@ static int ov5640_set_stream_dvp(struct ov5640_dev *sensor, bool on)
 	 * devicetree endpoint control lines properties.
 	 * If no endpoint control lines properties are set,
 	 * polarity will be as below:
-	 * - VSYNC:	active high
+	 * - VSYNC:	active low
 	 * - HREF:	active low
-	 * - PCLK:	active low
+	 * - PCLK:	active high
 	 */
 
 	if (on) {
@@ -1245,12 +1245,12 @@ static int ov5640_set_stream_dvp(struct ov5640_dev *sensor, bool on)
 		 *		datasheet and hardware, 0 is active high
 		 *		and 1 is active low...)
 		 */
-		if (flags & V4L2_MBUS_PCLK_SAMPLE_RISING)
-			pclk_pol = 1;
+		if (flags & V4L2_MBUS_PCLK_SAMPLE_FALLING)
+			pclk_pol = 0;
 		if (flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH)
 			hsync_pol = 1;
-		if (flags & V4L2_MBUS_VSYNC_ACTIVE_LOW)
-			vsync_pol = 1;
+		if (flags & V4L2_MBUS_VSYNC_ACTIVE_HIGH)
+			vsync_pol = 0;
 
 		ret = ov5640_write_reg(sensor,
 				       OV5640_REG_POLARITY_CTRL00,
-- 
2.27.0




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux