diff options
author | Peter Chen <peter.chen@freescale.com> | 2010-09-29 14:05:11 +0800 |
---|---|---|
committer | Alan Tull <alan.tull@freescale.com> | 2010-10-08 13:33:10 -0500 |
commit | ffd4c24b9d66147c0960b687817b5535166672ef (patch) | |
tree | e3f5eb4c5e3bff538208b602c91291dd7f4c6f27 /drivers/usb/host | |
parent | f89ac0af8d6fbc1de406c44107b0c851ad729755 (diff) |
ENGR00132073-2 usb: wakeup capability should be controlled by user
Driver part
The usb wakeup system capability should be controlled by user,
For example, the users don't expect wakeup system at below situations:
1. When they plug in Micro B line, maybe the users just want to charge
from PC
2. Plug in a usb device, such as usb camera or usb 3G moden
The wakeup capability can be controlled by sys interface
1. At otg mode:
echo enabled > /sys/devices/platform/fsl-usb2-otg/power/wakeup
2. At non-otg mode:
device mode:
echo enabled > /sys/devices/platform/fsl-usb2-otg/power/wakeup
host mode
echo enabled > /sys/devices/platform/fsl-ehci.x/power/wakeup
x is the usb port num (from 0 to n-1)
NOTE: The user must load one gadget module if he wants to usb otg wakeup
function.
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Diffstat (limited to 'drivers/usb/host')
-rw-r--r-- | drivers/usb/host/ehci-arc.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/drivers/usb/host/ehci-arc.c b/drivers/usb/host/ehci-arc.c index b4bea17b9e03..60e11b913e63 100644 --- a/drivers/usb/host/ehci-arc.c +++ b/drivers/usb/host/ehci-arc.c @@ -539,6 +539,25 @@ static int ehci_fsl_drv_remove(struct platform_device *pdev) } #ifdef CONFIG_PM + +static bool host_can_wakeup_system(struct platform_device *pdev) +{ + struct usb_hcd *hcd = platform_get_drvdata(pdev); + struct ehci_hcd *ehci = hcd_to_ehci(hcd); + struct fsl_usb2_platform_data *pdata = pdev->dev.platform_data; + + if (pdata->operating_mode == FSL_USB2_DR_OTG) + if (device_may_wakeup(ehci->transceiver->dev)) + return true; + else + return false; + else + if (device_may_wakeup(&(pdev->dev))) + return true; + else + return false; +} + /* suspend/resume, section 4.3 */ /* These routines rely on the bus (pci, platform, etc) @@ -561,7 +580,7 @@ static int ehci_fsl_drv_suspend(struct platform_device *pdev, /* Only handles OTG mode switch event, system suspend event will be done in bus suspend */ if (pdev->dev.power.status == DPM_SUSPENDING) { printk(KERN_DEBUG "%s, pm event \n", __func__); - if (!device_may_wakeup(&(pdev->dev))) { + if (!host_can_wakeup_system(pdev)) { int mask; /* Need open clock for register access */ if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)) @@ -643,7 +662,7 @@ static int ehci_fsl_drv_resume(struct platform_device *pdev) printk(KERN_DEBUG "ehci fsl drv resume begins: %s\n", pdata->name); if (pdev->dev.power.status == DPM_RESUMING) { printk(KERN_DEBUG "%s, pm event \n", __func__); - if (!device_may_wakeup(&(pdev->dev))) { + if (!host_can_wakeup_system(pdev)) { if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)) { fsl_usb_clk_gate(hcd->self.controller->platform_data, true); } |