diff options
-rw-r--r-- | drivers/gpu/drm/bochs/bochs.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/bochs/bochs_drv.c | 44 |
2 files changed, 45 insertions, 0 deletions
diff --git a/drivers/gpu/drm/bochs/bochs.h b/drivers/gpu/drm/bochs/bochs.h index 741965c001a6..460820551b09 100644 --- a/drivers/gpu/drm/bochs/bochs.h +++ b/drivers/gpu/drm/bochs/bochs.h | |||
@@ -1,5 +1,6 @@ | |||
1 | #include <linux/io.h> | 1 | #include <linux/io.h> |
2 | #include <linux/fb.h> | 2 | #include <linux/fb.h> |
3 | #include <linux/console.h> | ||
3 | 4 | ||
4 | #include <drm/drmP.h> | 5 | #include <drm/drmP.h> |
5 | #include <drm/drm_crtc.h> | 6 | #include <drm/drm_crtc.h> |
diff --git a/drivers/gpu/drm/bochs/bochs_drv.c b/drivers/gpu/drm/bochs/bochs_drv.c index 395bba261c9a..9c13df29fd20 100644 --- a/drivers/gpu/drm/bochs/bochs_drv.c +++ b/drivers/gpu/drm/bochs/bochs_drv.c | |||
@@ -95,6 +95,49 @@ static struct drm_driver bochs_driver = { | |||
95 | }; | 95 | }; |
96 | 96 | ||
97 | /* ---------------------------------------------------------------------- */ | 97 | /* ---------------------------------------------------------------------- */ |
98 | /* pm interface */ | ||
99 | |||
100 | static int bochs_pm_suspend(struct device *dev) | ||
101 | { | ||
102 | struct pci_dev *pdev = to_pci_dev(dev); | ||
103 | struct drm_device *drm_dev = pci_get_drvdata(pdev); | ||
104 | struct bochs_device *bochs = drm_dev->dev_private; | ||
105 | |||
106 | drm_kms_helper_poll_disable(drm_dev); | ||
107 | |||
108 | if (bochs->fb.initialized) { | ||
109 | console_lock(); | ||
110 | fb_set_suspend(bochs->fb.helper.fbdev, 1); | ||
111 | console_unlock(); | ||
112 | } | ||
113 | |||
114 | return 0; | ||
115 | } | ||
116 | |||
117 | static int bochs_pm_resume(struct device *dev) | ||
118 | { | ||
119 | struct pci_dev *pdev = to_pci_dev(dev); | ||
120 | struct drm_device *drm_dev = pci_get_drvdata(pdev); | ||
121 | struct bochs_device *bochs = drm_dev->dev_private; | ||
122 | |||
123 | drm_helper_resume_force_mode(drm_dev); | ||
124 | |||
125 | if (bochs->fb.initialized) { | ||
126 | console_lock(); | ||
127 | fb_set_suspend(bochs->fb.helper.fbdev, 0); | ||
128 | console_unlock(); | ||
129 | } | ||
130 | |||
131 | drm_kms_helper_poll_enable(drm_dev); | ||
132 | return 0; | ||
133 | } | ||
134 | |||
135 | static const struct dev_pm_ops bochs_pm_ops = { | ||
136 | SET_SYSTEM_SLEEP_PM_OPS(bochs_pm_suspend, | ||
137 | bochs_pm_resume) | ||
138 | }; | ||
139 | |||
140 | /* ---------------------------------------------------------------------- */ | ||
98 | /* pci interface */ | 141 | /* pci interface */ |
99 | 142 | ||
100 | static int bochs_kick_out_firmware_fb(struct pci_dev *pdev) | 143 | static int bochs_kick_out_firmware_fb(struct pci_dev *pdev) |
@@ -155,6 +198,7 @@ static struct pci_driver bochs_pci_driver = { | |||
155 | .id_table = bochs_pci_tbl, | 198 | .id_table = bochs_pci_tbl, |
156 | .probe = bochs_pci_probe, | 199 | .probe = bochs_pci_probe, |
157 | .remove = bochs_pci_remove, | 200 | .remove = bochs_pci_remove, |
201 | .driver.pm = &bochs_pm_ops, | ||
158 | }; | 202 | }; |
159 | 203 | ||
160 | /* ---------------------------------------------------------------------- */ | 204 | /* ---------------------------------------------------------------------- */ |