drm: bridge: sii8620: retry hw reset with i2c failure 74/86274/2
authorJoonyoung Shim <jy0922.shim@samsung.com>
Wed, 31 Aug 2016 09:17:48 +0000 (18:17 +0900)
committerJoonyoung Shim <jy0922.shim@samsung.com>
Thu, 1 Sep 2016 00:26:50 +0000 (09:26 +0900)
With specific targets, sometimes(almost) i2c read is failed when hdmi
cable is plugged.

[  341.285875] sii8620 7-0039: I2C read of [0x0000] failed with code -6.
[  341.286149] sii8620 7-0039: Error accessing I2C bus, -6.

Retry hw reset operation of sii8620 mhl if i2c read is failed then can
do normal i2c operation. This solution came from android kernel.

Change-Id: Icf9f54eb941e3ac5a8728fb9552b51928578d508
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
drivers/gpu/drm/bridge/sii8620.c

index 90d93af..08d8e2e 100644 (file)
@@ -1411,12 +1411,20 @@ static void sii8620_cable_in(struct sii8620 *ctx)
        sii8620_hw_on(ctx);
        clk_prepare_enable(ctx->clk_xtal);
        sii8620_hw_reset(ctx);
+       msleep(100);
 
        sii8620_read_buf(ctx, REG_VND_IDL, ver, ARRAY_SIZE(ver));
        ret = sii8620_clear_error(ctx);
        if (ret) {
-               dev_err(dev, "Error accessing I2C bus, %d.\n", ret);
-               return;
+               dev_err(dev, "Error 1st accessing I2C bus, %d.\n", ret);
+               sii8620_hw_reset(ctx);
+               msleep(20);
+               sii8620_read_buf(ctx, REG_VND_IDL, ver, ARRAY_SIZE(ver));
+               ret = sii8620_clear_error(ctx);
+               if (ret) {
+                       dev_err(dev, "Error 2nd accessing I2C bus, %d.\n", ret);
+                       return;
+               }
        }
 
        dev_info(dev, "ChipID %02x%02x:%02x%02x rev %02x.\n", ver[1], ver[0],