aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/via/viafbdev.c
diff options
context:
space:
mode:
authorFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>2010-09-07 10:28:26 -0400
committerFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>2010-09-23 22:15:03 -0400
commit6f9422d4e407bd63a9bd665ea09e57c1e3800c47 (patch)
treea8db0fe983bf177ed2653249aa55c9c846a0ce25 /drivers/video/via/viafbdev.c
parentc2a07c932dad49b3b80b11132183b8b2ec8ea1aa (diff)
viafb: introduce per output device power management
This patch moves common parts of dvi.c, lcd.c and vt1636.c to hw.c to start a per output device power management. There should be no runtime changes aside that this patch enables the proc interface to enable/disable devices when needed which greatly increases the chances that changes to the output device configuration will work. However the power management is not yet complete so it might fail on some configurations. As this area is quite complex and touches undocumented things there is a slight chance of regressions. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> Cc: Joseph Chan <JosephChan@via.com.tw>
Diffstat (limited to 'drivers/video/via/viafbdev.c')
-rw-r--r--drivers/video/via/viafbdev.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
index 80ce43a318bb..164c6ea603d2 100644
--- a/drivers/video/via/viafbdev.c
+++ b/drivers/video/via/viafbdev.c
@@ -332,22 +332,22 @@ static int viafb_blank(int blank_mode, struct fb_info *info)
332 case FB_BLANK_UNBLANK: 332 case FB_BLANK_UNBLANK:
333 /* Screen: On, HSync: On, VSync: On */ 333 /* Screen: On, HSync: On, VSync: On */
334 /* control CRT monitor power management */ 334 /* control CRT monitor power management */
335 viafb_write_reg_mask(CR36, VIACR, 0x00, BIT4 + BIT5); 335 via_set_state(VIA_CRT, VIA_STATE_ON);
336 break; 336 break;
337 case FB_BLANK_HSYNC_SUSPEND: 337 case FB_BLANK_HSYNC_SUSPEND:
338 /* Screen: Off, HSync: Off, VSync: On */ 338 /* Screen: Off, HSync: Off, VSync: On */
339 /* control CRT monitor power management */ 339 /* control CRT monitor power management */
340 viafb_write_reg_mask(CR36, VIACR, 0x10, BIT4 + BIT5); 340 via_set_state(VIA_CRT, VIA_STATE_STANDBY);
341 break; 341 break;
342 case FB_BLANK_VSYNC_SUSPEND: 342 case FB_BLANK_VSYNC_SUSPEND:
343 /* Screen: Off, HSync: On, VSync: Off */ 343 /* Screen: Off, HSync: On, VSync: Off */
344 /* control CRT monitor power management */ 344 /* control CRT monitor power management */
345 viafb_write_reg_mask(CR36, VIACR, 0x20, BIT4 + BIT5); 345 via_set_state(VIA_CRT, VIA_STATE_SUSPEND);
346 break; 346 break;
347 case FB_BLANK_POWERDOWN: 347 case FB_BLANK_POWERDOWN:
348 /* Screen: Off, HSync: Off, VSync: Off */ 348 /* Screen: Off, HSync: Off, VSync: Off */
349 /* control CRT monitor power management */ 349 /* control CRT monitor power management */
350 viafb_write_reg_mask(CR36, VIACR, 0x30, BIT4 + BIT5); 350 via_set_state(VIA_CRT, VIA_STATE_OFF);
351 break; 351 break;
352 } 352 }
353 353
@@ -457,7 +457,7 @@ static int viafb_ioctl(struct fb_info *info, u_int cmd, u_long arg)
457 if (copy_from_user(&gpu32, argp, sizeof(gpu32))) 457 if (copy_from_user(&gpu32, argp, sizeof(gpu32)))
458 return -EFAULT; 458 return -EFAULT;
459 if (gpu32 & CRT_Device) 459 if (gpu32 & CRT_Device)
460 viafb_crt_enable(); 460 via_set_state(VIA_CRT, VIA_STATE_ON);
461 if (gpu32 & DVI_Device) 461 if (gpu32 & DVI_Device)
462 viafb_dvi_enable(); 462 viafb_dvi_enable();
463 if (gpu32 & LCD_Device) 463 if (gpu32 & LCD_Device)
@@ -467,7 +467,7 @@ static int viafb_ioctl(struct fb_info *info, u_int cmd, u_long arg)
467 if (copy_from_user(&gpu32, argp, sizeof(gpu32))) 467 if (copy_from_user(&gpu32, argp, sizeof(gpu32)))
468 return -EFAULT; 468 return -EFAULT;
469 if (gpu32 & CRT_Device) 469 if (gpu32 & CRT_Device)
470 viafb_crt_disable(); 470 via_set_state(VIA_CRT, VIA_STATE_OFF);
471 if (gpu32 & DVI_Device) 471 if (gpu32 & DVI_Device)
472 viafb_dvi_disable(); 472 viafb_dvi_disable();
473 if (gpu32 & LCD_Device) 473 if (gpu32 & LCD_Device)
@@ -1487,7 +1487,9 @@ static ssize_t viafb_iga1_odev_proc_write(struct file *file,
1487 dev_on = dev_new & ~dev_old; 1487 dev_on = dev_new & ~dev_old;
1488 viaparinfo->shared->iga1_devices = dev_new; 1488 viaparinfo->shared->iga1_devices = dev_new;
1489 viaparinfo->shared->iga2_devices &= ~dev_new; 1489 viaparinfo->shared->iga2_devices &= ~dev_new;
1490 via_set_state(dev_off, VIA_STATE_OFF);
1490 via_set_source(dev_new, IGA1); 1491 via_set_source(dev_new, IGA1);
1492 via_set_state(dev_on, VIA_STATE_ON);
1491 return res; 1493 return res;
1492} 1494}
1493 1495
@@ -1525,7 +1527,9 @@ static ssize_t viafb_iga2_odev_proc_write(struct file *file,
1525 dev_on = dev_new & ~dev_old; 1527 dev_on = dev_new & ~dev_old;
1526 viaparinfo->shared->iga2_devices = dev_new; 1528 viaparinfo->shared->iga2_devices = dev_new;
1527 viaparinfo->shared->iga1_devices &= ~dev_new; 1529 viaparinfo->shared->iga1_devices &= ~dev_new;
1530 via_set_state(dev_off, VIA_STATE_OFF);
1528 via_set_source(dev_new, IGA2); 1531 via_set_source(dev_new, IGA2);
1532 via_set_state(dev_on, VIA_STATE_ON);
1529 return res; 1533 return res;
1530} 1534}
1531 1535