drm/bridge: tc358767: fix tc_aux_get_status error handling
authorTomi Valkeinen <tomi.valkeinen@ti.com>
Tue, 28 May 2019 08:27:24 +0000 (11:27 +0300)
committerAndrzej Hajda <a.hajda@samsung.com>
Fri, 31 May 2019 13:41:15 +0000 (15:41 +0200)
tc_aux_get_status() does not report AUX_TIMEOUT correctly, as it only
checks the AUX_TIMEOUT if aux is still busy. Fix this by always checking
for AUX_TIMEOUT.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190528082747.3631-2-tomi.valkeinen@ti.com
drivers/gpu/drm/bridge/tc358767.c

index e570c9dee180f455686aee6ff305df9dd684eca4..b6c4d1063ccb33ed608e108adc0bee18209d6d40 100644 (file)
@@ -286,14 +286,17 @@ static int tc_aux_get_status(struct tc_data *tc, u8 *reply)
        ret = regmap_read(tc->regmap, DP0_AUXSTATUS, &value);
        if (ret < 0)
                return ret;
+
        if (value & AUX_BUSY) {
-               if (value & AUX_TIMEOUT) {
-                       dev_err(tc->dev, "i2c access timeout!\n");
-                       return -ETIMEDOUT;
-               }
+               dev_err(tc->dev, "aux busy!\n");
                return -EBUSY;
        }
 
+       if (value & AUX_TIMEOUT) {
+               dev_err(tc->dev, "aux access timeout!\n");
+               return -ETIMEDOUT;
+       }
+
        *reply = (value & AUX_STATUS_MASK) >> AUX_STATUS_SHIFT;
        return 0;
 }