summaryrefslogtreecommitdiffstats
path: root/bsp/meta-rcar/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0456-media-i2c-max9286-fix-resetb-handling.patch
blob: 2cffe36239d2e11333327458a63cad6bcd33761f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
From f3e07cec62fb10d0c09d4bb96309ebe01a8f3fae Mon Sep 17 00:00:00 2001
From: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
Date: Thu, 26 Dec 2019 15:26:45 +0300
Subject: [PATCH] media: i2c: max9286: fix resetb handling

This fixed the RESETB handling for other then GPIOn=1 pins

Signed-off-by: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
---
 drivers/media/i2c/soc_camera/max9286.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/media/i2c/soc_camera/max9286.c b/drivers/media/i2c/soc_camera/max9286.c
index b185566..f6c6b0a 100644
--- a/drivers/media/i2c/soc_camera/max9286.c
+++ b/drivers/media/i2c/soc_camera/max9286.c
@@ -232,10 +232,12 @@ static void max9286_sensor_reset(struct i2c_client *client, int addr, int reset_
 	if (priv->gpio_resetb < 1 || priv->gpio_resetb > 5)
 		return;
 
-	/* sensor reset/unreset */
-	client->addr = addr;					/* MAX9271-CAMx I2C */
-	reg8_write(client, 0x0f, (0xfe & ~BIT(priv->gpio_resetb)) | /* set GPIOn value to reset/unreset */
-		   ((priv->active_low_resetb ? BIT(priv->gpio_resetb) : 0) ^ reset_on));
+	if (priv->active_low_resetb)
+		reset_on = !reset_on;
+
+	/* sensor reset/unreset using serializer gpio */
+	client->addr = addr;
+	reg8_write(client, 0x0f, (0xfe & ~BIT(priv->gpio_resetb)) | (reset_on ? BIT(priv->gpio_resetb) : 0)); /* set GPIOn value */
 	reg8_write(client, 0x0e, 0x42 | BIT(priv->gpio_resetb)); /* set GPIOn direction output */
 }
 
-- 
2.7.4