Ticket #1841: jbt6k74_cleanup_no_deep_sleep.patch

File jbt6k74_cleanup_no_deep_sleep.patch, 4.0 KB (added by nicolas.dufresne, 10 years ago)

This is an enhancement on top of previous patch. This implementation does not break switching from VGA to QVGA.

  • drivers/video/display/jbt6k74.c

    diff --git a/drivers/video/display/jbt6k74.c b/drivers/video/display/jbt6k74.c
    index 0635823..b1b5b1e 100644
    a b static int jbt_init_regs(struct jbt_info *jbt, int qvga) 
    252252        return rc ? -EIO : 0; 
    253253} 
    254254 
    255 int jbt6k74_display_onoff(struct jbt_info *jbt, int on) 
    256 { 
    257         if (on) 
    258                 return jbt_reg_write_nodata(jbt, JBT_REG_DISPLAY_ON); 
    259         else 
    260                 return jbt_reg_write_nodata(jbt, JBT_REG_DISPLAY_OFF); 
    261 } 
    262 EXPORT_SYMBOL_GPL(jbt6k74_display_onoff); 
    263  
    264255static int standby_to_sleep(struct jbt_info *jbt) 
    265256{ 
    266     static int once = 0; 
    267     if (!once++) { 
    268         int rc; 
    269  
    270         /* three times command zero */ 
    271         rc = jbt_reg_write_nodata(jbt, 0x00); 
    272         mdelay(1); 
    273         rc |= jbt_reg_write_nodata(jbt, 0x00); 
    274         mdelay(1); 
    275         rc |= jbt_reg_write_nodata(jbt, 0x00); 
    276         mdelay(1); 
    277  
    278         /* deep standby out */ 
    279         rc |= jbt_reg_write(jbt, JBT_REG_POWER_ON_OFF, 0x17); 
    280  
    281         return rc ? -EIO : 0; 
    282     } 
    283     else  
    284         return 0; 
     257        int rc; 
     258 
     259        /* three times command zero */ 
     260        rc = jbt_reg_write_nodata(jbt, 0x00); 
     261        mdelay(1); 
     262        rc |= jbt_reg_write_nodata(jbt, 0x00); 
     263        mdelay(1); 
     264        rc |= jbt_reg_write_nodata(jbt, 0x00); 
     265        mdelay(1); 
     266 
     267        /* deep standby out */ 
     268        rc |= jbt_reg_write(jbt, JBT_REG_POWER_ON_OFF, 0x17); 
     269 
     270        return rc ? -EIO : 0; 
    285271} 
    286272 
    287273static int sleep_to_normal(struct jbt_info *jbt) 
    static int sleep_to_normal(struct jbt_info *jbt) 
    307293        rc |= jbt_init_regs(jbt, 0); 
    308294 
    309295        /* Turn on display */ 
    310         rc |= jbt6k74_display_onoff(jbt, 1); 
     296        rc |= jbt_reg_write_nodata(jbt, JBT_REG_DISPLAY_ON); 
    311297 
    312298        return rc ? -EIO : 0; 
    313299} 
    static int sleep_to_qvga_normal(struct jbt_info *jbt) 
    335321        rc |= jbt_init_regs(jbt, 1); 
    336322 
    337323        /* Turn on display */ 
    338         rc |= jbt6k74_display_onoff(jbt, 1); 
     324        rc |= jbt_reg_write_nodata(jbt, JBT_REG_DISPLAY_ON); 
    339325 
    340326        return rc ? -EIO : 0; 
    341327} 
    static int normal_to_sleep(struct jbt_info *jbt) 
    344330{ 
    345331        int rc; 
    346332 
    347         rc = jbt6k74_display_onoff(jbt, 0); 
    348         rc |= jbt_reg_write_nodata(jbt, JBT_REG_DISPLAY_OFF); 
     333        rc = jbt_reg_write_nodata(jbt, JBT_REG_DISPLAY_OFF); 
    349334        rc |= jbt_reg_write16(jbt, JBT_REG_OUTPUT_CONTROL, 0x8002); 
    350335        rc |= jbt_reg_write_nodata(jbt, JBT_REG_SLEEP_IN); 
    351336 
    static int normal_to_sleep(struct jbt_info *jbt) 
    354339 
    355340static int sleep_to_standby(struct jbt_info *jbt) 
    356341{ 
    357 #if 0 
    358342        return jbt_reg_write(jbt, JBT_REG_POWER_ON_OFF, 0x00); 
    359 #else 
    360     return 0; 
    361 #endif 
    362343} 
    363344 
    364345/* frontend function */ 
    static int fb_notifier_callback(struct notifier_block *self, 
    576557        switch (fb_blank) { 
    577558        case FB_BLANK_UNBLANK: 
    578559                dev_info(&jbt->spi_dev->dev, "**** jbt6k74 unblank\n"); 
     560                jbt6k74_enter_state(jbt, JBT_STATE_NORMAL); 
    579561                break; 
    580562        case FB_BLANK_NORMAL: 
    581563                dev_info(&jbt->spi_dev->dev, "**** jbt6k74 normal\n"); 
    582                 /*jbt6k74_enter_state(jbt, JBT_STATE_NORMAL); 
    583                 jbt6k74_display_onoff(jbt, 1); */ 
    584564                break; 
    585565        case FB_BLANK_VSYNC_SUSPEND: 
    586566                dev_info(&jbt->spi_dev->dev, "**** jbt6k74 vsync suspend\n"); 
    static int fb_notifier_callback(struct notifier_block *self, 
    591571                 * a visible artefact (white screen) before the backlight 
    592572                 * is dimmed to a dark enough level */ 
    593573                /* jbt6k74_enter_state(jbt, JBT_STATE_SLEEP); */ 
    594                 /*jbt6k74_display_onoff(jbt, 0);*/ 
    595574                break; 
    596575        case FB_BLANK_POWERDOWN: 
    597576                dev_info(&jbt->spi_dev->dev, "**** jbt6k74 powerdown\n"); 
    598                 /*jbt6k74_enter_state(jbt, JBT_STATE_DEEP_STANDBY);*/ 
     577        /* FIXME: deep standby causes WSOD on certain devices. We use 
     578         * sleep as workaround */ 
     579                jbt6k74_enter_state(jbt, JBT_STATE_SLEEP); 
    599580                break; 
    600581        } 
    601582 
    static int jbt_suspend(struct spi_device *spi, pm_message_t state) 
    692673 
    693674        /* Save mode for resume */ 
    694675        jbt->last_state = jbt->state; 
    695  
    696         jbt6k74_enter_state(jbt, JBT_STATE_DEEP_STANDBY); 
     676        /* FIXME: deep standby causes WSOD on certain devices. We use 
     677         * sleep as workaround */ 
     678        jbt6k74_enter_state(jbt, JBT_STATE_SLEEP); 
    697679 
    698680        jbt->have_resumed = 0; 
    699681 
    700 /*      (jbt6k74_pdata->reset)(0, 0); */ 
    701  
    702682        dev_info(&spi->dev, "**** jbt6k74 suspend end\n"); 
    703683 
    704684        return 0;