@@ -256,6 +256,7 @@ struct twl4030_usb {
u8 linkstat;
u8 asleep;
bool irq_enabled;
+ bool suspend_enabled;
};
/* internal define on top of container_of */
@@ -618,6 +619,7 @@ static int __init twl4030_usb_probe(struct
platform_device *pdev)
twl->otg.set_suspend = twl4030_set_suspend;
twl->usb_mode = pdata->usb_mode;
twl->asleep = 1;
+ twl->suspend_enabled = pdata->suspend_enabled;
/* init spinlock for workqueue */
spin_lock_init(&twl->lock);
@@ -694,9 +696,32 @@ static int __exit twl4030_usb_remove(struct
platform_device *pdev)
return 0;
}
+int twl4030_usb_suspend(struct platform_device *pdev, pm_message_t state)
+{
+ struct twl4030_usb *twl = platform_get_drvdata(pdev);
+
+ if (!twl->suspend_enabled)
+ return 0;
+
+ twl->otg.set_suspend(&twl->otg, 1);
+
+ return 0;
+}
+
+int twl4030_usb_resume(struct platform_device *pdev)
+{
+ struct twl4030_usb *twl = platform_get_drvdata(pdev);
+
+ twl->otg.set_suspend(&twl->otg, 0);
+
+ return 0;
+}
+
static struct platform_driver twl4030_usb_driver = {
.probe = twl4030_usb_probe,
.remove = __exit_p(twl4030_usb_remove),
+ .suspend = twl4030_usb_suspend,
+ .resume = twl4030_usb_resume,
.driver = {
.name = "twl4030_usb",
.owner = THIS_MODULE,
@@ -325,6 +325,7 @@ enum twl4030_usb_mode {
struct twl4030_usb_data {
enum twl4030_usb_mode usb_mode;
+ bool suspend_enabled;
};
struct twl4030_ins {