@@ -355,11 +355,8 @@ static int usb3503_platform_remove(struct platform_device *pdev)
}
#ifdef CONFIG_PM_SLEEP
-static int usb3503_i2c_suspend(struct device *dev)
+static int usb3503_suspend(struct usb3503 *hub)
{
- 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)
@@ -368,11 +365,8 @@ static int usb3503_i2c_suspend(struct device *dev)
return 0;
}
-static int usb3503_i2c_resume(struct device *dev)
+static int usb3503_resume(struct usb3503 *hub)
{
- struct i2c_client *client = to_i2c_client(dev);
- struct usb3503 *hub = i2c_get_clientdata(client);
-
if (hub->clk)
clk_prepare_enable(hub->clk);
@@ -380,11 +374,38 @@ static int usb3503_i2c_resume(struct device *dev)
return 0;
}
+
+static int usb3503_i2c_suspend(struct device *dev)
+{
+ struct i2c_client *client = to_i2c_client(dev);
+
+ return usb3503_suspend(i2c_get_clientdata(client));
+}
+
+static int usb3503_i2c_resume(struct device *dev)
+{
+ struct i2c_client *client = to_i2c_client(dev);
+
+ return usb3503_resume(i2c_get_clientdata(client));
+}
+
+static int usb3503_platform_suspend(struct device *dev)
+{
+ return usb3503_suspend(dev_get_drvdata(dev));
+}
+
+static int usb3503_platform_resume(struct device *dev)
+{
+ return usb3503_resume(dev_get_drvdata(dev));
+}
#endif
static SIMPLE_DEV_PM_OPS(usb3503_i2c_pm_ops, usb3503_i2c_suspend,
usb3503_i2c_resume);
+static SIMPLE_DEV_PM_OPS(usb3503_platform_pm_ops, usb3503_platform_suspend,
+ usb3503_platform_resume);
+
static const struct i2c_device_id usb3503_id[] = {
{ USB3503_I2C_NAME, 0 },
{ }
@@ -415,6 +436,7 @@ static struct platform_driver usb3503_platform_driver = {
.driver = {
.name = USB3503_I2C_NAME,
.of_match_table = of_match_ptr(usb3503_of_match),
+ .pm = &usb3503_platform_pm_ops,
},
.probe = usb3503_platform_probe,
.remove = usb3503_platform_remove,
USB3503 chip can be used without any I2C connection, what is handled by a simple platform device driver. Add support for resetting the chip (via GPIO lines) during system suspend/resume cycle by adding calls to existing suspend/resume functions used for E2C device. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> --- drivers/usb/misc/usb3503.c | 38 ++++++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-) -- 2.17.1