summaryrefslogtreecommitdiff
path: root/drivers/usb
diff options
context:
space:
mode:
authorJoonyoung Shim <jy0922.shim@samsung.com>2014-07-10 14:22:34 +0900
committerChanho Park <chanho61.park@samsung.com>2014-11-18 12:00:03 +0900
commitb57a13fdf7f94c7c8ae5a5df7cebc35cf9386491 (patch)
tree31c97bf13c52bd88ca64ba820ca2a49fae1031e8 /drivers/usb
parentbd199b499db1370e2a82824fbea8c1e1cfd29be7 (diff)
downloadlinux-3.10-b57a13fdf7f94c7c8ae5a5df7cebc35cf9386491.tar.gz
linux-3.10-b57a13fdf7f94c7c8ae5a5df7cebc35cf9386491.tar.bz2
linux-3.10-b57a13fdf7f94c7c8ae5a5df7cebc35cf9386491.zip
usb: usb3503: add PM functions
The usb3503 needs to switch to standby mode while suspending and should switch to hub mode when resumed. Also we can control clock on PM function. Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Change-Id: Iaba4a22e52bc3be58c099107dcddc390f57d3e88
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/misc/usb3503.c34
1 files changed, 32 insertions, 2 deletions
diff --git a/drivers/usb/misc/usb3503.c b/drivers/usb/misc/usb3503.c
index 652855b4028..47cb143716a 100644
--- a/drivers/usb/misc/usb3503.c
+++ b/drivers/usb/misc/usb3503.c
@@ -149,8 +149,6 @@ static int usb3503_switch_mode(struct usb3503 *hub, enum usb3503_mode mode)
case USB3503_MODE_STANDBY:
usb3503_reset(hub, 0);
-
- hub->mode = mode;
dev_info(dev, "switched to STANDBY mode\n");
break;
@@ -347,6 +345,37 @@ static int usb3503_platform_probe(struct platform_device *pdev)
return usb3503_probe(hub);
}
+#ifdef CONFIG_PM_SLEEP
+static int usb3503_i2c_suspend(struct device *dev)
+{
+ struct i2c_client *client = to_i2c_client(dev);
+ struct usb3503 *hub = i2c_get_clientdata(client);
+
+ usb3503_switch_mode(hub, USB3503_MODE_STANDBY);
+
+ if (hub->clk)
+ clk_disable_unprepare(hub->clk);
+
+ return 0;
+}
+
+static int usb3503_i2c_resume(struct device *dev)
+{
+ struct i2c_client *client = to_i2c_client(dev);
+ struct usb3503 *hub = i2c_get_clientdata(client);
+
+ if (hub->clk)
+ clk_prepare_enable(hub->clk);
+
+ usb3503_switch_mode(hub, hub->mode);
+
+ return 0;
+}
+#endif
+
+static SIMPLE_DEV_PM_OPS(usb3503_i2c_pm_ops, usb3503_i2c_suspend,
+ usb3503_i2c_resume);
+
static const struct i2c_device_id usb3503_id[] = {
{ USB3503_I2C_NAME, 0 },
{ }
@@ -365,6 +394,7 @@ MODULE_DEVICE_TABLE(of, usb3503_of_match);
static struct i2c_driver usb3503_i2c_driver = {
.driver = {
.name = USB3503_I2C_NAME,
+ .pm = &usb3503_i2c_pm_ops,
.of_match_table = of_match_ptr(usb3503_of_match),
},
.probe = usb3503_i2c_probe,