From f3e07cec62fb10d0c09d4bb96309ebe01a8f3fae Mon Sep 17 00:00:00 2001 From: Vladimir Barinov 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 --- 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