aboutsummaryrefslogtreecommitdiff
path: root/drivers/staging/asus_oled
diff options
context:
space:
mode:
authorJonathan Brett <jonbrett.dev@gmail.com>2012-08-17 21:13:18 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-09-04 13:12:13 -0700
commit0e4da5cbaefa02ed408f8a78d759baef2905bf34 (patch)
tree9ef9ce185371f1d27a7a0bc64d0e88504e186863 /drivers/staging/asus_oled
parent411c076a2e8faad165f3504f4bad89cdfa5989cc (diff)
downloadlinaro-lsk-0e4da5cbaefa02ed408f8a78d759baef2905bf34.tar.gz
Staging: asus_oled: Add suspend/resume callbacks
- Add simple suspend/resume PM callbacks to disable oled display on suspend and return to previous state on resume Signed-off-by: Jonathan Brett <jonbrett.dev@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/asus_oled')
-rw-r--r--drivers/staging/asus_oled/asus_oled.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/drivers/staging/asus_oled/asus_oled.c b/drivers/staging/asus_oled/asus_oled.c
index 42a5e7ab512..00185478647 100644
--- a/drivers/staging/asus_oled/asus_oled.c
+++ b/drivers/staging/asus_oled/asus_oled.c
@@ -137,6 +137,7 @@ struct asus_oled_dev {
size_t buf_size;
char *buf;
uint8_t enabled;
+ uint8_t enabled_post_resume;
struct device *dev;
};
@@ -765,11 +766,45 @@ static void asus_oled_disconnect(struct usb_interface *interface)
dev_info(&interface->dev, "Disconnected Asus OLED device\n");
}
+#ifdef CONFIG_PM
+static int asus_oled_suspend(struct usb_interface *intf, pm_message_t message)
+{
+ struct asus_oled_dev *odev;
+
+ odev = usb_get_intfdata(intf);
+ if (!odev)
+ return -ENODEV;
+
+ odev->enabled_post_resume = odev->enabled;
+ enable_oled(odev, 0);
+
+ return 0;
+}
+
+static int asus_oled_resume(struct usb_interface *intf)
+{
+ struct asus_oled_dev *odev;
+
+ odev = usb_get_intfdata(intf);
+ if (!odev)
+ return -ENODEV;
+
+ enable_oled(odev, odev->enabled_post_resume);
+
+ return 0;
+}
+#else
+#define asus_oled_suspend NULL
+#define asus_oled_resume NULL
+#endif
+
static struct usb_driver oled_driver = {
.name = ASUS_OLED_NAME,
.probe = asus_oled_probe,
.disconnect = asus_oled_disconnect,
.id_table = id_table,
+ .suspend = asus_oled_suspend,
+ .resume = asus_oled_resume,
};
static CLASS_ATTR_STRING(version, S_IRUGO,