summaryrefslogtreecommitdiff
path: root/drivers/usb/otg/tegra-otg.c
diff options
context:
space:
mode:
authorRakesh Bodla <rbodla@nvidia.com>2011-02-22 19:38:18 +0530
committerDan Willemsen <dwillemsen@nvidia.com>2011-11-30 21:43:26 -0800
commit702083bf7fce0a55705b225758645782270c84c3 (patch)
tree9f074ba3a37e5b69800c8eae57fa4e9eac0d114f /drivers/usb/otg/tegra-otg.c
parentafdb939b6ac90ff07391d396d982429f087c56fa (diff)
tegra: usb: otg: Adding suspend/resume function call
For USB, in OTG mode driver interrupt enable registers must be saved when device goes into suspend mode and must be retained when device resume. Bug 791252 Original-Change-Id: I349a629105d4f5a236c35ef5cd37aeefcd2cece7 Reviewed-on: http://git-master/r/20375 Reviewed-by: Rakesh Bodla <rbodla@nvidia.com> Tested-by: Rakesh Bodla <rbodla@nvidia.com> Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com> Rebase-Id: Reea46990e3ed6215f5bbebb9de3c843111d77fe5
Diffstat (limited to 'drivers/usb/otg/tegra-otg.c')
-rw-r--r--drivers/usb/otg/tegra-otg.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/drivers/usb/otg/tegra-otg.c b/drivers/usb/otg/tegra-otg.c
index e3b7d5f38eaa..b4804c022098 100644
--- a/drivers/usb/otg/tegra-otg.c
+++ b/drivers/usb/otg/tegra-otg.c
@@ -53,6 +53,7 @@ struct tegra_otg_data {
struct platform_device *host;
struct platform_device *pdev;
struct work_struct work;
+ unsigned int intr_reg_data;
};
static inline unsigned long otg_readl(struct tegra_otg_data *tegra,
@@ -337,12 +338,38 @@ static int __exit tegra_otg_remove(struct platform_device *pdev)
return 0;
}
+#ifdef CONFIG_PM
+static int tegra_otg_suspend(struct platform_device *pdev, pm_message_t state)
+{
+ struct tegra_otg_data *tegra_otg = platform_get_drvdata(pdev);
+
+ /* store the interupt enable for cable ID and VBUS */
+ tegra_otg->intr_reg_data = readl(tegra_otg->regs + USB_PHY_WAKEUP);
+
+ return 0;
+}
+
+static int tegra_otg_resume(struct platform_device * pdev)
+{
+ struct tegra_otg_data *tegra_otg = platform_get_drvdata(pdev);
+
+ /* restore the interupt enable for cable ID and VBUS */
+ writel(tegra_otg->intr_reg_data, (tegra_otg->regs + USB_PHY_WAKEUP));
+
+ return 0;
+}
+#endif
+
static struct platform_driver tegra_otg_driver = {
.driver = {
.name = "tegra-otg",
},
.remove = __exit_p(tegra_otg_remove),
.probe = tegra_otg_probe,
+#ifdef CONFIG_PM
+ .suspend = tegra_otg_suspend,
+ .resume = tegra_otg_resume,
+#endif
};
static int __init tegra_otg_init(void)