[PATCH 06/11] usb: chipidea: imx: call set_wakeup when necessary
Peter Chen
peter.chen at freescale.com
Sat Oct 12 05:35:08 EDT 2013
- Disable wakeup after probe
- Enable wakeup during the suspend
- Disable wakeup after controller is active
Signed-off-by: Peter Chen <peter.chen at freescale.com>
---
drivers/usb/chipidea/ci_hdrc_imx.c | 36 ++++++++++++++++++++++++++++++++++++
1 files changed, 36 insertions(+), 0 deletions(-)
diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c
index 9f66f93..0424cbf 100644
--- a/drivers/usb/chipidea/ci_hdrc_imx.c
+++ b/drivers/usb/chipidea/ci_hdrc_imx.c
@@ -157,6 +157,15 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
}
}
+ if (data->usbmisc_data) {
+ ret = imx_usbmisc_set_wakeup(data->usbmisc_data, false);
+ if (ret) {
+ dev_err(&pdev->dev, "usbmisc set_wakeup failed, ret=%d\n",
+ ret);
+ goto disable_device;
+ }
+ }
+
platform_set_drvdata(pdev, data);
device_set_wakeup_capable(&pdev->dev, true);
@@ -194,12 +203,23 @@ static int ci_hdrc_imx_remove(struct platform_device *pdev)
static int imx_controller_suspend(struct device *dev)
{
struct ci_hdrc_imx_data *data = dev_get_drvdata(dev);
+ int ret;
dev_dbg(dev, "at %s\n", __func__);
if (atomic_read(&data->in_lpm))
return 0;
+ if (data->usbmisc_data) {
+ ret = imx_usbmisc_set_wakeup(data->usbmisc_data, true);
+ if (ret) {
+ dev_err(dev,
+ "usbmisc set_wakeup failed, ret=%d\n",
+ ret);
+ return ret;
+ }
+ }
+
clk_disable_unprepare(data->clk);
atomic_set(&data->in_lpm, 1);
@@ -221,8 +241,24 @@ static int imx_controller_resume(struct device *dev)
if (ret)
return ret;
+ if (data->usbmisc_data) {
+ ret = imx_usbmisc_set_wakeup(data->usbmisc_data, false);
+ if (ret) {
+ dev_err(dev,
+ "usbmisc set_wakeup failed, ret=%d\n",
+ ret);
+ ret = -EINVAL;
+ goto clk_disable;
+ }
+ }
+
atomic_set(&data->in_lpm, 0);
+ return 0;
+
+clk_disable:
+ clk_disable_unprepare(data->clk);
+
return ret;
}
--
1.7.1
More information about the linux-arm-kernel
mailing list