summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gm12u320_drv.c31
-rw-r--r--gm12u320_drv.h1
-rw-r--r--gm12u320_main.c14
3 files changed, 42 insertions, 4 deletions
diff --git a/gm12u320_drv.c b/gm12u320_drv.c
index bf9d9a7..039e793 100644
--- a/gm12u320_drv.c
+++ b/gm12u320_drv.c
@@ -111,6 +111,32 @@ static void gm12u320_usb_disconnect(struct usb_interface *interface)
drm_unplug_dev(dev);
}
+#ifdef CONFIG_PM
+
+int gm12u320_suspend(struct usb_interface *interface, pm_message_t message)
+{
+ struct drm_device *dev = usb_get_intfdata(interface);
+
+ if (!dev)
+ return 0;
+
+ gm12u320_stop_fb_update(dev);
+ return 0;
+}
+
+int gm12u320_resume(struct usb_interface *interface)
+{
+ struct drm_device *dev = usb_get_intfdata(interface);
+
+ if (!dev)
+ return 0;
+
+ gm12u320_set_ecomode(dev);
+ gm12u320_start_fb_update(dev);
+ return 0;
+}
+#endif
+
static struct usb_device_id id_table[] = {
{ USB_DEVICE(0x1de1, 0xc102) },
{},
@@ -122,6 +148,11 @@ static struct usb_driver gm12u320_driver = {
.probe = gm12u320_usb_probe,
.disconnect = gm12u320_usb_disconnect,
.id_table = id_table,
+#ifdef CONFIG_PM
+ .suspend = gm12u320_suspend,
+ .resume = gm12u320_resume,
+ .reset_resume = gm12u320_resume,
+#endif
};
module_usb_driver(gm12u320_driver);
diff --git a/gm12u320_drv.h b/gm12u320_drv.h
index 76620e8..09d5d6d 100644
--- a/gm12u320_drv.h
+++ b/gm12u320_drv.h
@@ -125,5 +125,6 @@ void gm12u320_fb_mark_dirty(struct gm12u320_framebuffer *fb,
int x1, int x2, int y1, int y2);
void gm12u320_start_fb_update(struct drm_device *dev);
void gm12u320_stop_fb_update(struct drm_device *dev);
+int gm12u320_set_ecomode(struct drm_device *dev);
#endif
diff --git a/gm12u320_main.c b/gm12u320_main.c
index e51fcd3..935cbf9 100644
--- a/gm12u320_main.c
+++ b/gm12u320_main.c
@@ -437,9 +437,7 @@ int gm12u320_driver_load(struct drm_device *dev, unsigned long flags)
spin_lock_init(&gm12u320->fb_update.lock);
init_waitqueue_head(&gm12u320->fb_update.waitq);
- ret = gm12u320_misc_request(gm12u320, MISC_REQ_GET_SET_ECO_A,
- MISC_REQ_GET_SET_ECO_B, 0x01 /* set */,
- eco_mode ? 0x01 : 0x00, 0x00, 0x01);
+ ret = gm12u320_set_ecomode(dev);
if (ret)
goto err;
@@ -482,7 +480,6 @@ int gm12u320_driver_unload(struct drm_device *dev)
{
struct gm12u320_device *gm12u320 = dev->dev_private;
-
drm_vblank_cleanup(dev);
gm12u320_fbdev_cleanup(dev);
gm12u320_modeset_cleanup(dev);
@@ -491,3 +488,12 @@ int gm12u320_driver_unload(struct drm_device *dev)
kfree(gm12u320);
return 0;
}
+
+int gm12u320_set_ecomode(struct drm_device *dev)
+{
+ struct gm12u320_device *gm12u320 = dev->dev_private;
+
+ return gm12u320_misc_request(gm12u320, MISC_REQ_GET_SET_ECO_A,
+ MISC_REQ_GET_SET_ECO_B, 0x01 /* set */,
+ eco_mode ? 0x01 : 0x00, 0x00, 0x01);
+}