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.

Usb Suspend Resume issues



We are using Linux-3.2.0-PSP04.06.00.11. for Sitara AM335x , 

We’re facing issues with activating Siatara’s USBs :

 suspend/resume and remote wakeup (we're using CDC ( ecm and acm ) over USBs ( usb0 and USB1 ) 

USB0  ( Peripheral )

we enabled the usb suspend/resume support from the menu config ,

We changed the value in .../power/control from “ON” to "auto" –

in this case we didn't saw any indication that USB went to suspend ( when there is no activity on the line ) 

please see cat * output of : /power is 

active_duration    297940

async                     enabled

autosuspend                     2

autosuspend_delay_ms               2000

connected_duration      1280680

control                  auto

level                      auto

runtime_active_kids      0

runtime_active_time     297940

runtime_enabled            enabled

runtime_status                 suspended

runtime_suspended_time          982740

runtime_usage                                 0

wakeup                enabled

USB1 ( Host  )

2 issues :

1.Basic suspend resume support

 there is no indication that USB goes to suspend - and even than - we're not sure if remote wakeup is supported .

When USB Host's usbx  device is up setting both 1-1 and usb1

power/control to "auto" does not affect USB state:

musb_runtime_suspend is not called.

o the first and foremost question is:

how to put USB Host side to sleep when using CDC Ethernet device

on the other side?

2. Remote wakeup support

our design based on the assumption that Sitara ( in USB Host side ) is supporting USB remote wakeup . ( In band wakeup  ) we did some experiments using a simple mouse connected to the sitara – we didn’t saw that pressing the mouse’s button waking up the sitara .  We  also tried it using advanced SDK ( 10 ) and we saw that remote wakeup from mouse is supported , HOWEVER , there is a delay in the sitara response time to the remote wakeup and there is a usb phy reset which occurring before the reconnection  .

  • Shay Avivi said:

    in this case we didn't saw any indication that USB went to suspend ( when there is no activity on the line ) 

    please see cat * output of : /power is 

    ......

    runtime_status                 suspended

    What kind of indication are you looking for? "runtime_status" tells the bus is already suspended.

    Shay Avivi said:
    how to put USB Host side to sleep when using CDC Ethernet device

    Did you turn down the USB device on the host, for example, "ifconfig usb0 down"? The audosuspend is only invoked when the bus is idle.

    Shay Avivi said:
    we did some experiments using a simple mouse connected to the sitara – we didn’t saw that pressing the mouse’s button waking up the sitara .

    Remote Wakeup is supported in SDK6. Please note that Linux does not support Remote Wakeup on mouse by default due to unreliable scroll wheel event from different vendors, keyboard is better device to run the test. And Remote Wakeup is only supported in system suspend 'echo standy > /sys/power/state', not 'echo mem > ...', as the latter turns off the USB PHY power.

  • Shay Avivi

    in this case we didn't saw any indication that USB went to suspend ( when there is no activity on the line ) 

    please see cat * output of : /power is 

    ......

    runtime_status                 suspended

    What kind of indication are you looking for? "runtime_status" tells the bus is already suspended.

    [Shay] : I'm not seeing any change in the current consumption - in addition there is no logs from sitara ( KMSG ) that tells me USB went to suspend/resume 

    Shay Avivi
    how to put USB Host side to sleep when using CDC Ethernet device

    Did you turn down the USB device on the host, for example, "ifconfig usb0 down"? The audosuspend is only invoked when the bus is idle.

    [Shay] : I can't turn down the interface since I'm using it - I'm expecting  that the Sitara will see that there is no activity on the line and will go to auto suspend

     

     

    Shay Avivi
    we did some experiments using a simple mouse connected to the sitara – we didn’t saw that pressing the mouse’s button waking up the sitara .

    Remote Wakeup is supported in SDK6. Please note that Linux does not support Remote Wakeup on mouse by default due to unreliable scroll wheel event from different vendors, keyboard is better device to run the test. And Remote Wakeup is only supported in system suspend 'echo standy > /sys/power/state', not 'echo mem > ...', as the latter turns off the USB PHY power.

    [Shay] : I'm not sure I understand ......remote wakeup is not supported when th Sitara ( peripheral ) in runtime suspend ?  only in system suspend ? 

    BR , 

    Shay

     

     

  • Well, I don't think you understand what autosuspend is, it has nothing to do directly with power consumption on the AM335x side.

    Would you mind to explain what is your final goal to archive? We might have better solution for you.
  • Can we have a conference call tommorow morning?
  • Shay, I'd like to have better understanding of your USB use case before having a conf call.
  • Hi ,
    in our product we're using the 2 Sitara's USBs - one as device and the other as Host
    on both USbs we're using CDC ( ECM and ACM ) over USB .
    our all power management architecture based on USB suspend - resume - it means that on both sides - the trigger for the processors that connected to the sitara to go to suspend mode ( runtime suspend and suspend ) as well as resume based on the fact the Sitara support it in Host and peripheral side .
    on the Sitara's Host side - the trigger for going out from suspend is remote wake-up ( in band - based on J/K state )
    Hope the description is helpful....I can share some more details and block diagram in the conf' call....

    Thanks ,
    Shay
  • Shay, you want the AM335x system does suspend/resume based on USB activities on both ports, right?

    The Linux system power management supports suspend to standby and mem (/sys/power/state), the system power consumption will be different in both cases, but you can only put the system into standby mode to be able to wake up from Remote Wakeup via the host port, because the USB PHY is powered off in suspend-to-mem mode, which does not support Remote Wakeup.

    How do you want the USB device port activity to control the system suspend/resume?
  • Hi
    it seem like I'm missing something ,
    anyway I don't understand why there are not logs at all from USB - when I turned it from on to auto ( I'm expecting to see something )
    appreciate your support here
    BR ,
    Shay
  • Shay, the kernel logs for autosuspend transitions do not exist in the kernel, similar to many other sysfs entry status changes. One of the reasons I can think of is the logging overhead - as the autosuspend transition could happen very frequently at runtime.

  • Hi
    I think that a live debug session will be very helpful here
    appreciate if you can schedule for Monday
    shayavivi@motorolasolutions.com

    Thanks ,
    Shay
  • Shay,

    Sorry if I missed anything, now I am not sure what issue you want to debug together. In the first post you mentioned three issues, I thought I have answered them.

    1. No kernel log during autosuspend state change.
    Answer: kernel does not have log facility for this. Use runtime_status in the power sysfs entry to check the status.

    2. CDC Ethernet device does go to suspend.
    Answer: Something similar to 'ifconfig usb0 down' is required, otherwise the network layer still holds the USB device, then autosuspend will not be triggered.

    3. Remote Wakeup by mouse does not work.
    Kernel by default does not support Remote Wakeup from mouse. The easiest way is to test with USB keyboard.

    If there is still something not clear, please let me know.

    Or if there is a new issue which you want to debug, please let me know the detail of the problem first, so that I can be prepared for the debug session.
  • Shay,

    Continue on this discussion, regarding on remote-wakeup on AM335x USB peripheral port, I confirm none of USB gadget drivers in Linux, including CDC-Ethernet gadget, supports remote-wakeup, it is just a missing feature in current kernel USB gadget subsystem.

    However, I want you to understand that even if Linux gadget remote-wakeup was supported, it would not save you any power in your project.

    I am unable to talk much about the USB host, since it is not a TI product, but in general the USB host controller will not go into power saving mode when the USB bus is suspended.

    On the AM335x gadget side, the MUSB controller does go to suspend mode when the USB bus is suspended, but the power saving of MUSB controller suspend mode is really tiny comparing to the whole AM335x device. The best way to save power on AM335x USB subsystem is to turn off the USB PHY, but it is not applicable in your use case, since turning off the PHY will lost the USB connection.

    So remote-wakeup will not help you much.
  • Hi

    [Bin Liu] : Continue on this discussion, regarding on remote-wakeup on AM335x USB peripheral port, I confirm none of USB gadget drivers in Linux, including CDC-Ethernet gadget, supports remote-wakeup, it is just a missing feature in current kernel USB gadget subsystem.
    [Shay A] : what should be done in order to support it ? Can you please provide some technical guidelines to implement it ( or even code example that doing it ? )

    [Bin Liu] :However, I want you to understand that even if Linux gadget remote-wakeup was supported, it would not save you any power in your project.
    [ShayA]: I understand that BUT we need it not only for current saving but also as the logical trigger to resume all processor chain data flow .

    [Bin Liu] : I am unable to talk much about the USB host, since it is not a TI product, but in general the USB host controller will not go into power saving mode when the USB bus is suspended.
    [ShayA]: I understand - but still interested to have that feature supported - How TI can support/provide it ?

    [Bin Liu] : On the AM335x gadget side, the MUSB controller does go to suspend mode when the USB bus is suspended, but the power saving of MUSB controller suspend mode is really tiny comparing to the whole AM335x device. The best way to save power on AM335x USB subsystem is to turn off the USB PHY, but it is not applicable in your use case, since turning off the PHY will lost the USB connection.
    [ShayA]: thats exactly why we need the runtime suspend/resume to be supported - anyway we're not going standby mode/DS0/DS1 so - the runtime suspend/resume is needed here .


    [Bin Liu] : So remote-wakeup will not help you much.
    [ShayA]: remote wakeup will be the trigger to wake up the application processor

    [ShayA] : In addition and as I described in the meeting we had - we also use the Sitara's other USB as a host which connected to a modem - Can you please add your feedback for that as well ? so my question here is if as USB host - is it going to support suspend/resume and runtime suspend/resume ? is it going to support remote wakeup from the modem side ?


    BR ,
    Shay
  • Shay,

    Shay Avivi said:
    [Shay A] : what should be done in order to support it ? Can you please provide some technical guidelines to implement it ( or even code example that doing it ? )

    It is not clear to me either. None of the Linux gadget drivers has remote wakeup support, so we don't have an reference for the implementation. The MUSB controller driver does have to the callback API to support remote wakeup though, it is just no any gadget driver using it.

    Shay Avivi said:
    [ShayA]: I understand that BUT we need it not only for current saving but also as the logical trigger to resume all processor chain data flow .

    By processor chain, you meant only AP, or both AP & AM335x? I cannot talk about AP, but runtime-suspend on AM335x USB does not buy you anything, why you use suspend on AM335x USB?

    Shay Avivi said:
    [ShayA]: I understand - but still interested to have that feature supported - How TI can support/provide it ?

    It is a meanlingless feature for you, which does not exist in current Linux, why you want it?

    Shay Avivi said:
    [ShayA]: thats exactly why we need the runtime suspend/resume to be supported - anyway we're not going standby mode/DS0/DS1 so - the runtime suspend/resume is needed here .

    Again, runtime suspend does not save anything on AM335x USB, I don't understand why you need it.

    Shay Avivi said:
    [ShayA]: remote wakeup will be the trigger to wake up the application processor

    Is the application prcessor AM335x in here? If so, please note that USB runtime-suspend will not suspend AM335x, it is only about AM335x MUSB module.

    Shay Avivi said:
    so my question here is if as USB host - is it going to support suspend/resume and runtime suspend/resume ? is it going to support remote wakeup from the modem side ?

    Yes, runtime suspend/resume is supported on MUSB as host too. remote wakeup is supported as while, it has been validated with USB keyboard. To wakeup from a modem, please ensure the modem supports remote wakeup, its descriptor dump can quickly tell that.

  • Hi Bin Liu
    we want to operate remote wakeup directly on top of MUSB - can you please provide an API or HW specification if SW API doesn't exist ?
    BR ,
    Shay
  • Shay,

    Sorry for my late response, I was traveling.

    You meant MUSB in device mode, right? If so, the wakeup function is musb_gadget_wakeup() in musb_gadget.c.

    Please be aware that if want to implement remote wakeup yourself, I wouldn't be able to support you if you run into any issue, because musb_gadget_wakeup() is not used in current kernel so I don't have any reference code for debugging.