jbt6k74: Fix display power on sequence jbt6k74-2.6.34
authorLars-Peter Clausen <lars@metafoo.de>
Wed, 29 Dec 2010 19:38:44 +0000 (20:38 +0100)
committerLars-Peter Clausen <lars@metafoo.de>
Wed, 29 Dec 2010 19:41:30 +0000 (20:41 +0100)
According to the datasheet, first the regulators need to be turned on, then the
reset pin has to be set to high and then we have to wait 100ms before starting
to send commands.
This patch changes the init sequence accordingly.

It has proven very effective when it comes to fixing the WSOD.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>

drivers/video/backlight/jbt6k74.c

index 8450904..58547b5 100644 (file)
@@ -265,8 +265,12 @@ static int jbt_standby_to_sleep(struct jbt_info *jbt)
        int ret;
        struct jbt6k74_platform_data *pdata = jbt->spi->dev.platform_data;
 
-       gpio_set_value_cansleep(pdata->gpio_reset, 1);
        ret = regulator_bulk_enable(ARRAY_SIZE(jbt->supplies), jbt->supplies);
+       if (ret)
+               return ret;
+
+       gpio_set_value_cansleep(pdata->gpio_reset, 1);
+       mdelay(100);
 
        /* three times command zero */
        ret |= jbt_reg_write_nodata(jbt, 0x00);
@@ -354,11 +358,10 @@ static int jbt_sleep_to_standby(struct jbt_info *jbt)
 
        ret = jbt_reg_write(jbt, JBT_REG_POWER_ON_OFF, 0x00);
 
-       if (!ret)
-               ret = regulator_bulk_disable(ARRAY_SIZE(jbt->supplies), jbt->supplies);
-
-       if (!ret)
+       if (!ret) {
                gpio_set_value_cansleep(pdata->gpio_reset, 0);
+               ret = regulator_bulk_disable(ARRAY_SIZE(jbt->supplies), jbt->supplies);
+       }
 
        return ret;
 }