OMAP: DSS2: Taal: Make driver more fault tolerant
authorTomi Valkeinen <tomi.valkeinen@ti.com>
Tue, 31 May 2011 13:39:01 +0000 (16:39 +0300)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Fri, 1 Jul 2011 09:01:15 +0000 (12:01 +0300)
If ULPS exit fails, and the following reset fails also, Taal driver was
left in state where it thinks DSI is enabled while it really isn't,
leading to crash.

This patch checks the return value of taal_panel_reset, and if that
fails, ulps_enabled is left true, causing the driver to retry ulps exit
later.

Also the return value of taal_wake_up is checked at taal_disable, and if
wake up fails, we'll skip the power_off. This could leave the panel into
a not-quite-valid state, but there's nothing we can do about it in that
situation.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
drivers/video/omap2/displays/panel-taal.c

index 221579f75d840bdd89cae3a6f6e534176c4247af..4cb0449d50980919b4bb68566b5e28e5e720f314 100644 (file)
@@ -504,14 +504,18 @@ static int taal_exit_ulps(struct omap_dss_device *dssdev)
                return 0;
 
        r = omapdss_dsi_display_enable(dssdev);
-       if (r)
-               goto err;
+       if (r) {
+               dev_err(&dssdev->dev, "failed to enable DSI\n");
+               goto err1;
+       }
 
        omapdss_dsi_vc_enable_hs(dssdev, td->channel, true);
 
        r = _taal_enable_te(dssdev, true);
-       if (r)
-               goto err;
+       if (r) {
+               dev_err(&dssdev->dev, "failed to re-enable TE");
+               goto err2;
+       }
 
        enable_irq(gpio_to_irq(panel_data->ext_te_gpio));
 
@@ -521,13 +525,15 @@ static int taal_exit_ulps(struct omap_dss_device *dssdev)
 
        return 0;
 
-err:
-       dev_err(&dssdev->dev, "exit ULPS failed");
-       r = taal_panel_reset(dssdev);
-
-       enable_irq(gpio_to_irq(panel_data->ext_te_gpio));
-       td->ulps_enabled = false;
+err2:
+       dev_err(&dssdev->dev, "failed to exit ULPS");
 
+       r = taal_panel_reset(dssdev);
+       if (!r) {
+               enable_irq(gpio_to_irq(panel_data->ext_te_gpio));
+               td->ulps_enabled = false;
+       }
+err1:
        taal_queue_ulps_work(dssdev);
 
        return r;
@@ -1317,8 +1323,11 @@ static void taal_disable(struct omap_dss_device *dssdev)
        dsi_bus_lock(dssdev);
 
        if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE) {
-               taal_wake_up(dssdev);
-               taal_power_off(dssdev);
+               int r;
+
+               r = taal_wake_up(dssdev);
+               if (!r)
+                       taal_power_off(dssdev);
        }
 
        dsi_bus_unlock(dssdev);