This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

am335x USB remote wake up function



hi,

I test AM335x USB remote wake up function : I connect usb mouse to am335x USB , when AM335x enter suspend,the log is

[ 3832.488067] PM: Syncing filesystems ... done.                      
[ 3832.499023] Freezing user space processes ... (elapsed 0.01 seconds) done.                  
[ 3832.519226] Freezing remaining freezable tasks ... (elapsed 0.01 seconds) done.
[ 3832.539245] Suspending console(s) (use no_console_suspend to debug)

and the light of mouse  go off,but I can't wakeup am335x when I click clicke mouse!

in this wiki :http://processors.wiki.ti.com/index.php/AM335x_Power_Management_Standby_User%27s_Guide say:

"USB insertion /removal wakeup is supported for standby. USB 
connect-disconnect wakeup cannot happen via MPU_WAKE it happens only via
 PHY_WAKE. However, wakeup from standby is supported only through 
MPU_WAKE. Thus only remote wakeup is possible. Wakeup from standby 
happens on a mouse click or keyboard press but not on insertion/removal 
of mouse."

so my question is: how to test function of am335x usb remote wake up.
 
  • other question: if I will wake up am335x through usb remote function, am335x only can enter standby mode??

    is It  possible that am335x enter deepsleep0 (or deepsleep1\deepsleep2)and wake up from remote usb.

    pls help me!!!

  • Remote Wakeup is not supported in DeepSleep0(DS0), because MUSB module power is off in DS0, but Remote Wakeup requires MUSB should be on to detect the wakeup event.

    DS1/2 are not supported in kernel, but you can hack the DS0 mode using the attached patch to keep MUSB power on in DS0, then Remote wakeup will work.

    Please note that you have to follow the standard procedure for remote wakeup (change the corresponding sysfs entries) to work. For testing purpose, I use the following script to do so.

    cd /sys/devices/platform/omap/musb-ti81xx
    lst=`find . -name wakeup`
    for ent in $lst; do
            echo $ent
            echo enabled > $ent
    done

    find . -name wakeup -exec cat {} \;

    From 4cb04f5371d38dc6256145f3e43905b17431c46f Mon Sep 17 00:00:00 2001
    From: Vaibhav Bedia <vaibhav.bedia@ti.com>
    Date: Thu, 1 Nov 2012 00:13:28 +0530
    Subject: [PATCH] ARM: OMAP: PM: AM33XX: Force DS1 transition by keeping I2C in PD_PER enabled
    
    Due to a HW bug USB wakeup feature is not working as intended in DeepSleep0
    mode which is the lowest power state of the SoC and hence the suspend state
    of the kernel.
    
    Based on experimentations done, USB wakeup was found to be working when
    PD_PER is kept ON. Keeping PD_PER on translates to DeepSleep1 mode as defined
    in the AM335x TRM (SPRUH73E). In the current implementation of suspend-resume
    in the kernel this can be achieved by forcing a peripheral clock to stay
    active.
    To enable USB wakeup feature this patch forces the clock to I2C module in
    PD_PER to be always active.
    
    The sole objective of this patch is to enable USB wakeup which is broken in
    DeepSleep0. Due to the intrusive nature of the changes, the SoC will always
    transition to DeepSleep1 mode when the device is suspended.
    
    Signed-off-by: Vaibhav Bedia <vaibhav.bedia@ti.com>
    ---
     arch/arm/mach-omap2/pm33xx.c |   19 +++++++++++++++++++
     1 files changed, 19 insertions(+), 0 deletions(-)
    
    diff --git a/arch/arm/mach-omap2/pm33xx.c b/arch/arm/mach-omap2/pm33xx.c
    index d57630e..d2c0d46 100644
    --- a/arch/arm/mach-omap2/pm33xx.c
    +++ b/arch/arm/mach-omap2/pm33xx.c
    @@ -61,6 +61,8 @@ bool enable_deep_sleep = true;
     static suspend_state_t suspend_state = PM_SUSPEND_ON;
     
     static struct device *mpu_dev;
    +static struct device *i2c_dev;
    +struct platform_device *i2c_pdev;
     static struct omap_mbox *m3_mbox;
     static struct powerdomain *cefuse_pwrdm, *gfx_pwrdm, *per_pwrdm;
     static struct clockdomain *gfx_l3_clkdm, *gfx_l4ls_clkdm;
    @@ -314,8 +316,14 @@ static int am33xx_verify_lp_state(int core_suspend_stat)
     			per_pwrdm->ret_logic_off_counter++;
     		goto clear_old_status;
     	} else if (status == 0x10000) {
    +		/*
    +		 * We know that this message will come up
    +		 * To avoid any confusion just skip this for now
    +		 */
    +#if 0
     		pr_err("Could not enter low power state\n"
     			"Please check for active clocks in PER domain\n");
    +#endif
     		ret = -1;
     		goto clear_old_status;
     	} else {
    @@ -516,6 +524,17 @@ static int __init am33xx_pm_init(void)
     
     	pr_info("Power Management for AM33XX family\n");
     
    +	i2c_dev = omap_device_get_by_hwmod_name("i2c2");
    +
    +	if (!i2c_dev) {
    +		pr_warning("%s: unable to get the i2c device\n", __func__);
    +		return -EINVAL;
    +	} else {
    +		pm_runtime_forbid(i2c_dev);
    +		i2c_pdev = to_platform_device(i2c_dev);
    +		omap_device_disable_idle_on_suspend(i2c_pdev);
    +	}
    +
     #ifdef CONFIG_SUSPEND
     /* Read SDRAM_CONFIG register to determine Memory Type */
     	base = am33xx_get_ram_base();
    -- 
    1.7.0.4
    
    
  • hi,bin

    thank for your reply.

    I have done the patch,and now MUSB power is on in DS0, But I still can't remote wakeup from USB, and I can't exect the scrip:

    cd /sys/devices/platform/omap/musb-ti81xx
    lst=`find . -name wakeup`
    for ent in $lst; do
            echo $ent
            echo enabled > $ent
    done

    I test with android jb of am335x.
    thank you for your help

  • Basically what the script does is to set 'enabled' to 'wakeup' entry for every node in /sys/devices/platform/omap/musb-ti81xx/, before enter suspend mode.

    Can you manually set the entry without the script? Android has limited shell command set, so the script might not run.

  • Hi Bin Liu, 

    I'm facing same issue in am335x based custom board and SDK 7 .The USB wake up is not working via keyboard or mouse. The Keyboard and mouse power goes off after executing below command.

    echo standby > /sys/power/state" 

    Have tried the patch file which you given in this thread but it is failing in Linux version 3.12.

    How can I do the remote wake up in SDK7?

    Thanks

    -Durai


  • Durai,

    It seems your issue is similar to this one: marc.info;m=141443331412397&w=2

    Can you please try SDK8.0 to see if it fixes the issue?