summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRakesh Bodla <rbodla@nvidia.com>2011-02-22 19:38:18 +0530
committerVarun Colbert <vcolbert@nvidia.com>2011-02-22 18:12:06 -0800
commit9618759e4a002ee3d121cf090545509bfedb6bff (patch)
tree2696a200a6fb7ae03b4b74c4e464ed018136a01e
parentf1cfb55a423603ba06755df42d27e5f6c08454f0 (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 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>
-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 413a79191578..5230f9f6ee82 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)
+{
+ 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)