Commit 4efefd1d authored by Christian Trefzer's avatar Christian Trefzer Committed by Linus Torvalds

[PATCH] neofb: fix unblank logic interfering with lid toggled backlight

This is a fix for the most annoying problem that remained with neofb:

After "setterm -powersave powerdown" the console blanker will disable the
backlight after the given timeout expires.  If this happens after the lid
has been shut, we read "LCD off" from the register and store that in the
driver.  Once the lid is opened, the backlight turns on, but any key press
that would awaken the blanked console will switch the backlight off again.

The workaround so far was to use the "display config toggle" Fn key combo -
once if no external display is attached, otherwise as often as required to
restore the desired display setup.

The following patch fixes the issue at least for the LCD-only case, with no
external monitor attached.  Other display setup permutations are pending
further testing, but so far I can guarantee at least no negative change in
behaviour, if any at all.
Signed-off-by: default avatarChristian Trefzer <ctrefzer@gmx.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent dc1c43e9
...@@ -1333,17 +1333,22 @@ static int neofb_blank(int blank_mode, struct fb_info *info) ...@@ -1333,17 +1333,22 @@ static int neofb_blank(int blank_mode, struct fb_info *info)
* run "setterm -powersave powerdown" to take advantage * run "setterm -powersave powerdown" to take advantage
*/ */
struct neofb_par *par = info->par; struct neofb_par *par = info->par;
int seqflags, lcdflags, dpmsflags, reg; int seqflags, lcdflags, dpmsflags, reg, tmpdisp;
/* /*
* Reload the value stored in the register, if sensible. It might have * Read back the register bits related to display configuration. They might
* been changed via FN keystroke. * have been changed underneath the driver via Fn key stroke.
*/ */
if (par->PanelDispCntlRegRead) {
neoUnlock(); neoUnlock();
par->PanelDispCntlReg1 = vga_rgfx(NULL, 0x20) & 0x03; tmpdisp = vga_rgfx(NULL, 0x20) & 0x03;
neoLock(&par->state); neoLock(&par->state);
/* In case we blank the screen, we want to store the possibly new
* configuration in the driver. During un-blank, we re-apply this setting,
* since the LCD bit will be cleared in order to switch off the backlight.
*/
if (par->PanelDispCntlRegRead) {
par->PanelDispCntlReg1 = tmpdisp;
} }
par->PanelDispCntlRegRead = !blank_mode; par->PanelDispCntlRegRead = !blank_mode;
...@@ -1378,12 +1383,21 @@ static int neofb_blank(int blank_mode, struct fb_info *info) ...@@ -1378,12 +1383,21 @@ static int neofb_blank(int blank_mode, struct fb_info *info)
break; break;
case FB_BLANK_NORMAL: /* just blank screen (backlight stays on) */ case FB_BLANK_NORMAL: /* just blank screen (backlight stays on) */
seqflags = VGA_SR01_SCREEN_OFF; /* Disable sequencer */ seqflags = VGA_SR01_SCREEN_OFF; /* Disable sequencer */
lcdflags = par->PanelDispCntlReg1 & 0x02; /* LCD normal */ /*
* During a blank operation with the LID shut, we might store "LCD off"
* by mistake. Due to timing issues, the BIOS may switch the lights
* back on, and we turn it back off once we "unblank".
*
* So here is an attempt to implement ">=" - if we are in the process
* of unblanking, and the LCD bit is unset in the driver but set in the
* register, we must keep it.
*/
lcdflags = ((par->PanelDispCntlReg1 | tmpdisp) & 0x02); /* LCD normal */
dpmsflags = 0x00; /* no hsync/vsync suppression */ dpmsflags = 0x00; /* no hsync/vsync suppression */
break; break;
case FB_BLANK_UNBLANK: /* unblank */ case FB_BLANK_UNBLANK: /* unblank */
seqflags = 0; /* Enable sequencer */ seqflags = 0; /* Enable sequencer */
lcdflags = par->PanelDispCntlReg1 & 0x02; /* LCD normal */ lcdflags = ((par->PanelDispCntlReg1 | tmpdisp) & 0x02); /* LCD normal */
dpmsflags = 0x00; /* no hsync/vsync suppression */ dpmsflags = 0x00; /* no hsync/vsync suppression */
#ifdef CONFIG_TOSHIBA #ifdef CONFIG_TOSHIBA
/* Do we still need this ? */ /* Do we still need this ? */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment