diff options
author | Christian Trefzer <ctrefzer@gmx.de> | 2006-06-26 03:26:55 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-26 12:58:31 -0400 |
commit | 4efefd1d8ea4eaf71bacc4f71fa017c202fa67ec (patch) | |
tree | a4dfb7b415cc9591f3450ee2220b520af9517c38 | |
parent | dc1c43e972c95b82416cc87258dbc037d6de5923 (diff) |
[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: Christian Trefzer <ctrefzer@gmx.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | drivers/video/neofb.c | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/drivers/video/neofb.c b/drivers/video/neofb.c index 24b12f71d5a8..2f156b724d1c 100644 --- a/drivers/video/neofb.c +++ b/drivers/video/neofb.c | |||
@@ -1333,17 +1333,22 @@ static int neofb_blank(int blank_mode, struct fb_info *info) | |||
1333 | * run "setterm -powersave powerdown" to take advantage | 1333 | * run "setterm -powersave powerdown" to take advantage |
1334 | */ | 1334 | */ |
1335 | struct neofb_par *par = info->par; | 1335 | struct neofb_par *par = info->par; |
1336 | int seqflags, lcdflags, dpmsflags, reg; | 1336 | int seqflags, lcdflags, dpmsflags, reg, tmpdisp; |
1337 | |||
1338 | 1337 | ||
1339 | /* | 1338 | /* |
1340 | * Reload the value stored in the register, if sensible. It might have | 1339 | * Read back the register bits related to display configuration. They might |
1341 | * been changed via FN keystroke. | 1340 | * have been changed underneath the driver via Fn key stroke. |
1341 | */ | ||
1342 | neoUnlock(); | ||
1343 | tmpdisp = vga_rgfx(NULL, 0x20) & 0x03; | ||
1344 | neoLock(&par->state); | ||
1345 | |||
1346 | /* In case we blank the screen, we want to store the possibly new | ||
1347 | * configuration in the driver. During un-blank, we re-apply this setting, | ||
1348 | * since the LCD bit will be cleared in order to switch off the backlight. | ||
1342 | */ | 1349 | */ |
1343 | if (par->PanelDispCntlRegRead) { | 1350 | if (par->PanelDispCntlRegRead) { |
1344 | neoUnlock(); | 1351 | par->PanelDispCntlReg1 = tmpdisp; |
1345 | par->PanelDispCntlReg1 = vga_rgfx(NULL, 0x20) & 0x03; | ||
1346 | neoLock(&par->state); | ||
1347 | } | 1352 | } |
1348 | par->PanelDispCntlRegRead = !blank_mode; | 1353 | par->PanelDispCntlRegRead = !blank_mode; |
1349 | 1354 | ||
@@ -1378,12 +1383,21 @@ static int neofb_blank(int blank_mode, struct fb_info *info) | |||
1378 | break; | 1383 | break; |
1379 | case FB_BLANK_NORMAL: /* just blank screen (backlight stays on) */ | 1384 | case FB_BLANK_NORMAL: /* just blank screen (backlight stays on) */ |
1380 | seqflags = VGA_SR01_SCREEN_OFF; /* Disable sequencer */ | 1385 | seqflags = VGA_SR01_SCREEN_OFF; /* Disable sequencer */ |
1381 | lcdflags = par->PanelDispCntlReg1 & 0x02; /* LCD normal */ | 1386 | /* |
1387 | * During a blank operation with the LID shut, we might store "LCD off" | ||
1388 | * by mistake. Due to timing issues, the BIOS may switch the lights | ||
1389 | * back on, and we turn it back off once we "unblank". | ||
1390 | * | ||
1391 | * So here is an attempt to implement ">=" - if we are in the process | ||
1392 | * of unblanking, and the LCD bit is unset in the driver but set in the | ||
1393 | * register, we must keep it. | ||
1394 | */ | ||
1395 | lcdflags = ((par->PanelDispCntlReg1 | tmpdisp) & 0x02); /* LCD normal */ | ||
1382 | dpmsflags = 0x00; /* no hsync/vsync suppression */ | 1396 | dpmsflags = 0x00; /* no hsync/vsync suppression */ |
1383 | break; | 1397 | break; |
1384 | case FB_BLANK_UNBLANK: /* unblank */ | 1398 | case FB_BLANK_UNBLANK: /* unblank */ |
1385 | seqflags = 0; /* Enable sequencer */ | 1399 | seqflags = 0; /* Enable sequencer */ |
1386 | lcdflags = par->PanelDispCntlReg1 & 0x02; /* LCD normal */ | 1400 | lcdflags = ((par->PanelDispCntlReg1 | tmpdisp) & 0x02); /* LCD normal */ |
1387 | dpmsflags = 0x00; /* no hsync/vsync suppression */ | 1401 | dpmsflags = 0x00; /* no hsync/vsync suppression */ |
1388 | #ifdef CONFIG_TOSHIBA | 1402 | #ifdef CONFIG_TOSHIBA |
1389 | /* Do we still need this ? */ | 1403 | /* Do we still need this ? */ |