aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/geode/lxfb_core.c
diff options
context:
space:
mode:
authorAndres Salomon <dilinger@queued.net>2008-04-28 05:15:27 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-28 11:58:39 -0400
commitf694e53bd0db69557ee8e0db2d1602818ff173b0 (patch)
treed904b492105055a2adf00c60fa0324c0905b3bbe /drivers/video/geode/lxfb_core.c
parentaec40532c4d1183fa1ec415bb7dae08e19fc6b01 (diff)
lxfb: add power management functionality
This adds the ability to suspend/resume the lxfb driver, which includes: - Register and palette saving code; registers are stored in lxfb_par. A few MSR values are saved as well. - lx_powerup and lx_powerdown functions which restore/save registers and enable/disable graphic engines. - lxfb_suspend/lxfb_resume Originally based on a patch by Jordan Crouse. [akpm@linux-foundation.org: be conventional, save an ifdef] Signed-off-by: Andres Salomon <dilinger@debian.org> Cc: "Antonino A. Daplas" <adaplas@pol.net> Cc: Jordan Crouse <jordan.crouse@amd.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video/geode/lxfb_core.c')
-rw-r--r--drivers/video/geode/lxfb_core.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/drivers/video/geode/lxfb_core.c b/drivers/video/geode/lxfb_core.c
index 19eabef1077..b565882eee3 100644
--- a/drivers/video/geode/lxfb_core.c
+++ b/drivers/video/geode/lxfb_core.c
@@ -428,6 +428,45 @@ static struct fb_info * __init lxfb_init_fbinfo(struct device *dev)
428 return info; 428 return info;
429} 429}
430 430
431#ifdef CONFIG_PM
432static int lxfb_suspend(struct pci_dev *pdev, pm_message_t state)
433{
434 struct fb_info *info = pci_get_drvdata(pdev);
435
436 if (state.event == PM_EVENT_SUSPEND) {
437 acquire_console_sem();
438 lx_powerdown(info);
439 fb_set_suspend(info, 1);
440 release_console_sem();
441 }
442
443 /* there's no point in setting PCI states; we emulate PCI, so
444 * we don't end up getting power savings anyways */
445
446 return 0;
447}
448
449static int lxfb_resume(struct pci_dev *pdev)
450{
451 struct fb_info *info = pci_get_drvdata(pdev);
452 int ret;
453
454 acquire_console_sem();
455 ret = lx_powerup(info);
456 if (ret) {
457 printk(KERN_ERR "lxfb: power up failed!\n");
458 return ret;
459 }
460
461 fb_set_suspend(info, 0);
462 release_console_sem();
463 return 0;
464}
465#else
466#define lxfb_suspend NULL
467#define lxfb_resume NULL
468#endif
469
431static int __init lxfb_probe(struct pci_dev *pdev, 470static int __init lxfb_probe(struct pci_dev *pdev,
432 const struct pci_device_id *id) 471 const struct pci_device_id *id)
433{ 472{
@@ -553,6 +592,8 @@ static struct pci_driver lxfb_driver = {
553 .id_table = lxfb_id_table, 592 .id_table = lxfb_id_table,
554 .probe = lxfb_probe, 593 .probe = lxfb_probe,
555 .remove = lxfb_remove, 594 .remove = lxfb_remove,
595 .suspend = lxfb_suspend,
596 .resume = lxfb_resume,
556}; 597};
557 598
558#ifndef MODULE 599#ifndef MODULE