diff mbox

[1/3] drm/bridge/sii8620: perform I2C bus recovery after reset

Message ID 20180115173357.31067-2-a.hajda@samsung.com (mailing list archive)
State Not Applicable
Headers show

Commit Message

Andrzej Hajda Jan. 15, 2018, 5:33 p.m. UTC
Chip has known bug which causes I2C client state machine to frequently
enter non-idle mode after chip reset. Let's ask I2C adapter to perform
bus recovery to mitigate this bug.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
---
 drivers/gpu/drm/bridge/sil-sii8620.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Andrzej Hajda Jan. 26, 2018, 2:05 p.m. UTC | #1
On 15.01.2018 18:33, Andrzej Hajda wrote:
> Chip has known bug which causes I2C client state machine to frequently
> enter non-idle mode after chip reset. Let's ask I2C adapter to perform
> bus recovery to mitigate this bug.
>
> Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
> ---
>  drivers/gpu/drm/bridge/sil-sii8620.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/drivers/gpu/drm/bridge/sil-sii8620.c b/drivers/gpu/drm/bridge/sil-sii8620.c
> index 86789f8918a4..db93e5e0497c 100644
> --- a/drivers/gpu/drm/bridge/sil-sii8620.c
> +++ b/drivers/gpu/drm/bridge/sil-sii8620.c
> @@ -978,6 +978,8 @@ static int sii8620_hw_off(struct sii8620 *ctx)
>  
>  static void sii8620_hw_reset(struct sii8620 *ctx)
>  {
> +	struct i2c_client *i2c = to_i2c_client(ctx->dev);
> +
>  	usleep_range(10000, 20000);
>  	gpiod_set_value(ctx->gpio_reset, 0);
>  	usleep_range(5000, 20000);
> @@ -985,6 +987,9 @@ static void sii8620_hw_reset(struct sii8620 *ctx)
>  	usleep_range(10000, 20000);
>  	gpiod_set_value(ctx->gpio_reset, 0);
>  	msleep(300);
> +
> +	/* I2C bus recovery prevents I2C errors due to known bug in the chip */
> +	i2c_recover_bus(i2c->adapter);
>  }
>  
>  static void sii8620_cbus_reset(struct sii8620 *ctx)

I have just posted patch which deals with the problem directly in i2c
adapter, so this patch can be dropped[1].

[1]: https://marc.info/?l=linux-i2c&m=151696860906805


Regards

Andrzej


--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/gpu/drm/bridge/sil-sii8620.c b/drivers/gpu/drm/bridge/sil-sii8620.c
index 86789f8918a4..db93e5e0497c 100644
--- a/drivers/gpu/drm/bridge/sil-sii8620.c
+++ b/drivers/gpu/drm/bridge/sil-sii8620.c
@@ -978,6 +978,8 @@  static int sii8620_hw_off(struct sii8620 *ctx)
 
 static void sii8620_hw_reset(struct sii8620 *ctx)
 {
+	struct i2c_client *i2c = to_i2c_client(ctx->dev);
+
 	usleep_range(10000, 20000);
 	gpiod_set_value(ctx->gpio_reset, 0);
 	usleep_range(5000, 20000);
@@ -985,6 +987,9 @@  static void sii8620_hw_reset(struct sii8620 *ctx)
 	usleep_range(10000, 20000);
 	gpiod_set_value(ctx->gpio_reset, 0);
 	msleep(300);
+
+	/* I2C bus recovery prevents I2C errors due to known bug in the chip */
+	i2c_recover_bus(i2c->adapter);
 }
 
 static void sii8620_cbus_reset(struct sii8620 *ctx)