aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Trefzer <ctrefzer@gmx.de>2006-02-15 18:17:34 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-02-15 18:32:21 -0500
commit9f672004ab1a8094bec1785b39ac683ab9eebebc (patch)
tree75fc630226b2401ed7d2b5d15c2b149f2645cfd6
parent5ecfbae093f0c37311e89b29bfc0c9d586eace87 (diff)
[PATCH] neofb: avoid resetting display config on unblank (v2)
There were two mistakes in the register-read-on-(un)blank approach. - First, without proper register (un)locking the value read back will always be zero, and this is what I missed entirely until just now. Due to this, the logic could not be verified at all and I tried some bogus checks which are completely stupid. - Second, the LCD status bit will always be set to zero when the backlight has been turned off. Reading the value back during unblank will disable the LCD unconditionally, regardless of the state it is supposed to be in, since we set it to zero beforehand. So this is what we do now: - create a new variable in struct neofb_par, and use that to determine whether to read back registers (initialized to true) - before actually blanking the screen, read back the register to sense any possible change made through Fn key combo - use proper neoUnlock() / neoLock() to actually read something - every call to neofb_blank() determines if we read back next time: blanking disables readback, unblanking (FB_BLANK_UNBLANK) enables it This should give us a nice and clean state machine. Has been thoroughly tested on a Dell Latitude CPiA / NM220 Chip docked to a C/Dock2 with attached CRT in all possible combinations of LCD/CRT on/off. I changed the config via Fn key, let the console blank, unblanked by keypress - works flawlessly. Signed-off-by: Christian Trefzer <ctrefzer@gmx.de> Cc: "Antonino A. Daplas" <adaplas@pol.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--drivers/video/neofb.c15
-rw-r--r--include/video/neomagic.h1
2 files changed, 13 insertions, 3 deletions
diff --git a/drivers/video/neofb.c b/drivers/video/neofb.c
index b85e2b180a44..a2e201dc40f7 100644
--- a/drivers/video/neofb.c
+++ b/drivers/video/neofb.c
@@ -843,6 +843,9 @@ static int neofb_set_par(struct fb_info *info)
843 843
844 par->SysIfaceCntl2 = 0xc0; /* VESA Bios sets this to 0x80! */ 844 par->SysIfaceCntl2 = 0xc0; /* VESA Bios sets this to 0x80! */
845 845
846 /* Initialize: by default, we want display config register to be read */
847 par->PanelDispCntlRegRead = 1;
848
846 /* Enable any user specified display devices. */ 849 /* Enable any user specified display devices. */
847 par->PanelDispCntlReg1 = 0x00; 850 par->PanelDispCntlReg1 = 0x00;
848 if (par->internal_display) 851 if (par->internal_display)
@@ -1334,11 +1337,17 @@ static int neofb_blank(int blank_mode, struct fb_info *info)
1334 struct neofb_par *par = info->par; 1337 struct neofb_par *par = info->par;
1335 int seqflags, lcdflags, dpmsflags, reg; 1338 int seqflags, lcdflags, dpmsflags, reg;
1336 1339
1340
1337 /* 1341 /*
1338 * Reload the value stored in the register, might have been changed via 1342 * Reload the value stored in the register, if sensible. It might have
1339 * FN keystroke 1343 * been changed via FN keystroke.
1340 */ 1344 */
1341 par->PanelDispCntlReg1 = vga_rgfx(NULL, 0x20) & 0x03; 1345 if (par->PanelDispCntlRegRead) {
1346 neoUnlock();
1347 par->PanelDispCntlReg1 = vga_rgfx(NULL, 0x20) & 0x03;
1348 neoLock(&par->state);
1349 }
1350 par->PanelDispCntlRegRead = !blank_mode;
1342 1351
1343 switch (blank_mode) { 1352 switch (blank_mode) {
1344 case FB_BLANK_POWERDOWN: /* powerdown - both sync lines down */ 1353 case FB_BLANK_POWERDOWN: /* powerdown - both sync lines down */
diff --git a/include/video/neomagic.h b/include/video/neomagic.h
index 1d69049bd4c1..78b1f15a538f 100644
--- a/include/video/neomagic.h
+++ b/include/video/neomagic.h
@@ -159,6 +159,7 @@ struct neofb_par {
159 unsigned char PanelDispCntlReg1; 159 unsigned char PanelDispCntlReg1;
160 unsigned char PanelDispCntlReg2; 160 unsigned char PanelDispCntlReg2;
161 unsigned char PanelDispCntlReg3; 161 unsigned char PanelDispCntlReg3;
162 unsigned char PanelDispCntlRegRead;
162 unsigned char PanelVertCenterReg1; 163 unsigned char PanelVertCenterReg1;
163 unsigned char PanelVertCenterReg2; 164 unsigned char PanelVertCenterReg2;
164 unsigned char PanelVertCenterReg3; 165 unsigned char PanelVertCenterReg3;