diff options
author | Daniel Drake <dsd@laptop.org> | 2010-10-28 13:23:01 -0400 |
---|---|---|
committer | Florian Tobias Schandinat <FlorianSchandinat@gmx.de> | 2010-11-09 11:17:02 -0500 |
commit | 751305d9b2fd3e03eaab7808e976241d85ca4353 (patch) | |
tree | 93a78e80739f07a225fe35da11eafa1ab71e936c /drivers/video/via/viafbdev.c | |
parent | 51f4332bb5fef869e8a89895a7bac6b4c03b4946 (diff) |
viafb: General power management infrastructure
Multiple devices need S/R hooks (framebuffer, GPIO, camera).
Add infrastructure and convert existing framebuffer code to the new
model.
This patch should create no functional change.
Based on earlier work by Jonathan Corbet.
Signed-off-by: Daniel Drake <dsd@laptop.org>
Acked-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Diffstat (limited to 'drivers/video/via/viafbdev.c')
-rw-r--r-- | drivers/video/via/viafbdev.c | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c index d298cfccd6fc..289edd519527 100644 --- a/drivers/video/via/viafbdev.c +++ b/drivers/video/via/viafbdev.c | |||
@@ -1672,31 +1672,19 @@ static int parse_mode(const char *str, u32 *xres, u32 *yres) | |||
1672 | 1672 | ||
1673 | 1673 | ||
1674 | #ifdef CONFIG_PM | 1674 | #ifdef CONFIG_PM |
1675 | int viafb_suspend(struct pci_dev *pdev, pm_message_t state) | 1675 | static int viafb_suspend(void *unused) |
1676 | { | 1676 | { |
1677 | if (state.event == PM_EVENT_SUSPEND) { | 1677 | acquire_console_sem(); |
1678 | acquire_console_sem(); | 1678 | fb_set_suspend(viafbinfo, 1); |
1679 | fb_set_suspend(viafbinfo, 1); | 1679 | viafb_sync(viafbinfo); |
1680 | 1680 | release_console_sem(); | |
1681 | viafb_sync(viafbinfo); | ||
1682 | |||
1683 | pci_save_state(pdev); | ||
1684 | pci_disable_device(pdev); | ||
1685 | pci_set_power_state(pdev, pci_choose_state(pdev, state)); | ||
1686 | release_console_sem(); | ||
1687 | } | ||
1688 | 1681 | ||
1689 | return 0; | 1682 | return 0; |
1690 | } | 1683 | } |
1691 | 1684 | ||
1692 | int viafb_resume(struct pci_dev *pdev) | 1685 | static int viafb_resume(void *unused) |
1693 | { | 1686 | { |
1694 | acquire_console_sem(); | 1687 | acquire_console_sem(); |
1695 | pci_set_power_state(pdev, PCI_D0); | ||
1696 | pci_restore_state(pdev); | ||
1697 | if (pci_enable_device(pdev)) | ||
1698 | goto fail; | ||
1699 | pci_set_master(pdev); | ||
1700 | if (viaparinfo->shared->vdev->engine_mmio) | 1688 | if (viaparinfo->shared->vdev->engine_mmio) |
1701 | viafb_reset_engine(viaparinfo); | 1689 | viafb_reset_engine(viaparinfo); |
1702 | viafb_set_par(viafbinfo); | 1690 | viafb_set_par(viafbinfo); |
@@ -1704,11 +1692,15 @@ int viafb_resume(struct pci_dev *pdev) | |||
1704 | viafb_set_par(viafbinfo1); | 1692 | viafb_set_par(viafbinfo1); |
1705 | fb_set_suspend(viafbinfo, 0); | 1693 | fb_set_suspend(viafbinfo, 0); |
1706 | 1694 | ||
1707 | fail: | ||
1708 | release_console_sem(); | 1695 | release_console_sem(); |
1709 | return 0; | 1696 | return 0; |
1710 | } | 1697 | } |
1711 | 1698 | ||
1699 | static struct viafb_pm_hooks viafb_fb_pm_hooks = { | ||
1700 | .suspend = viafb_suspend, | ||
1701 | .resume = viafb_resume | ||
1702 | }; | ||
1703 | |||
1712 | #endif | 1704 | #endif |
1713 | 1705 | ||
1714 | 1706 | ||
@@ -1899,6 +1891,10 @@ int __devinit via_fb_pci_probe(struct viafb_dev *vdev) | |||
1899 | 1891 | ||
1900 | viafb_init_proc(viaparinfo->shared); | 1892 | viafb_init_proc(viaparinfo->shared); |
1901 | viafb_init_dac(IGA2); | 1893 | viafb_init_dac(IGA2); |
1894 | |||
1895 | #ifdef CONFIG_PM | ||
1896 | viafb_pm_register(&viafb_fb_pm_hooks); | ||
1897 | #endif | ||
1902 | return 0; | 1898 | return 0; |
1903 | 1899 | ||
1904 | out_fb_unreg: | 1900 | out_fb_unreg: |