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 devices suspend/Resume with AM335x

HI All,

I want to suspend/Resume USB devices on AM335x platorm with Linux.

How do I need to do?

 thanks!

  • I run the command  as below,. but can't run into suspend mode

    echo suspend > /sys/bus/usb/devices/usb1/power/level

     

  • [ Incorrect information. Deleted by the author. ]

  • Sorry, I meant something else. Selective suspend/resume is supported.

    /sys/bus/usb/devices/usb1/power/level only supports 'on' and auto', not 'suspend' parameter.

  • Bin,

    thanks for your reply,

    when I don't use usb device,  I want to suspend the usb device to save power.

    resume the usb device on demand.

    Any idea for it ?  thanks!

    root@am335x-evm:~# ls /sys/bus/usb/devices/usb1/power/     
    active_duration         runtime_active_kids     wakeup_active
    async                   runtime_active_time     wakeup_active_count
    autosuspend             runtime_enabled         wakeup_count
    autosuspend_delay_ms    runtime_status          wakeup_hit_count
    connected_duration      runtime_suspended_time  wakeup_last_time_ms
    control                 runtime_usage           wakeup_max_time_ms
    level                   wakeup                  wakeup_total_time_ms 

     

  • https://lesswatts.org/projects/devices-power-management/usb.php

    The webpage above is old but still helpful.

    .../power/level will be replaced by .../power/control in new kernels, and this entry only supports 'on' and 'auto' parameters, no 'suspend' any more.

    What device do you use? The tricky part of the Selective Suspend is that the device has to be in IDLE state to be able to suspend. You can start validating the procedure by using a usb optical mouse, If you see the laser light is turned off, it is suspended.

  • My USB device is USB disk or USB HDD.

  • For  MSC devices the 2 extra things you need to take care are

    1)      Make sure the device is not mounted (The device never suspends until it is umount ‘ed). Most of the MSC’s with proper filesystem gets automounted in /media/<disk name>

    2)      Also write auto to /sys/block/<disk name>/device/power/control

    If you connect the usb device to a hub, then you need to do the following additional step:

    echo auto > /sys/bus/usb/devices/<hub id>/power/control

    Like I mentioned before, start with a usb mouse to ensure your steps are correct.

  • thanks!

    I tested  it with usb disk with LED indicator. but failed.

    root@am335x-evm:~# lsusb
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    root@am335x-evm:~# ls /sys/bus/usb/devices/
    1-0:1.0  usb1
    root@am335x-evm:~# [   59.232147] usb 1-1: new high-speed USB device number 2 using musb-hdrc
    [   59.469512] usb 1-1: New USB device found, idVendor=058f, idProduct=6387
    [   59.476531] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
    [   59.483978] usb 1-1: Product: Mass Storage
    [   59.488250] usb 1-1: Manufacturer: Generic
    [   59.492523] usb 1-1: SerialNumber: FEC0FDEB
    [   59.506225] scsi0 : usb-storage 1-1:1.0
    [   60.514404] scsi 0:0:0:0: Direct-Access     Generic  Flash Disk       8.07 PQ: 0 ANSI: 2
    [   60.527770] sd 0:0:0:0: [sda] 966656 512-byte logical blocks: (494 MB/472 MiB)
    [   60.541046] sd 0:0:0:0: [sda] Write Protect is off
    [   60.557464] sd 0:0:0:0: [sda] No Caching mode page present
    [   60.563293] sd 0:0:0:0: [sda] Assuming drive cache: write through
    [   60.580993] sd 0:0:0:0: [sda] No Caching mode page present
    [   60.586761] sd 0:0:0:0: [sda] Assuming drive cache: write through
    [   60.648681]  sda: sda1
    [   60.654571] sd 0:0:0:0: [sda] No Caching mode page present
    [   60.660308] sd 0:0:0:0: [sda] Assuming drive cache: write through
    [   60.666717] sd 0:0:0:0: [sda] Attached SCSI removable disk
    [   61.054077] FAT-fs (sda): invalid media value (0x00)
    [   61.059265] FAT-fs (sda): Can't find a valid FAT filesystem

    root@am335x-evm:~# lsusb
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 001 Device 002: ID 058f:6387 Alcor Micro Corp. Transcend JetFlash Flash Drive
    root@am335x-evm:~# ls /sys/bus/usb/devices/
    1-0:1.0  1-1      1-1:1.0  usb1
    root@am335x-evm:~# umount /media/sda1
    root@am335x-evm:~# echo /sys/block/sda/device/power/control
    /sys/block/sda/device/power/control
    root@am335x-evm:~# echo auto > /sys/block/sda/device/power/control
    root@am335x-evm:~# echo autosuspend > /sys/bus/usb/devices/1-1\:1.0/power/
    /sys/bus/usb/devices/1-1:1.0/power/async
    /sys/bus/usb/devices/1-1:1.0/power/runtime_active_kids
    /sys/bus/usb/devices/1-1:1.0/power/runtime_enabled
    /sys/bus/usb/devices/1-1:1.0/power/runtime_status
    /sys/bus/usb/devices/1-1:1.0/power/runtime_usage
    root@am335x-evm:~# echo autosuspend > /sys/bus/usb/devices/1-1\:1.0/power/
    /sys/bus/usb/devices/1-1:1.0/power/async
    /sys/bus/usb/devices/1-1:1.0/power/runtime_active_kids
    /sys/bus/usb/devices/1-1:1.0/power/runtime_enabled
    /sys/bus/usb/devices/1-1:1.0/power/runtime_status
    /sys/bus/usb/devices/1-1:1.0/power/runtime_usage
    root@am335x-evm:~# echo autosuspend > /sys/bus/usb/devices/1-1/power/con
    /sys/bus/usb/devices/1-1/power/connected_duration
    /sys/bus/usb/devices/1-1/power/control
    root@am335x-evm:~# echo autosuspend > /sys/bus/usb/devices/1-1/power/control
    root@am335x-evm:~# echo 10 > /sys/bus/usb/devices/1-1/power/autosuspend
    root@am335x-evm:~#

  • jacky xiao said:

    ......

    root@am335x-evm:~# echo autosuspend > /sys/bus/usb/devices/1-1/power/control
    root@am335x-evm:~# echo 10 > /sys/bus/usb/devices/1-1/power/autosuspend
    root@am335x-evm:~#

    It is "auto", not "autosuspend".

  • When the USB flash disk  is  on suspend,  it has no current consumtion.

    But when the USB HDD is  on suspend ( LED on the USB HDD is off),  Its current consumtion is only reduced  50 mA.

    How to put USB HDD is sleep  without  current consumpiont.?

    thanks again!

  • Has the USB HDD you are using been certified to comply with the USB specification?

    A certified product should have an official USB logo and be listed on the USB-IF integrators list.  This indicates the product was tested for compliance to the USB specification. 

    Have you measured the suspend current of this USB HDD when connected to another USB host?

    Regards,
    Paul