Bug 4180

Summary: usb devices unpower when inactive
Product: [Build System, Metadata & Runtime] BSPs Reporter: Stoicescu Cornel <corneliux.stoicescu>
Component: bsps-runtimeAssignee: Nitin Kamble <nitin.a.kamble>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: Low CC: dvhart, tom.zanussi, yp.kernel.watcher, yp.watcher
Version: 1.4   
Target Milestone: 1.5   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Stoicescu Cornel 2013-04-03 14:45:59 UTC
poky 
master:bdca49274173153b1b0a72887de6321b4756b684
meta-intel:2e8760d272aa2c62b41cbf768445c99569604c5e

1) install and boot core-image-sato-sdk-sugarbay on hardware
2) notice that USB devices (mouse, keyboard) become inactive after a few (2-3) seconds of inactivity. User must click once or tap key in order to use the USB device.
Comment 1 Darren Hart 2013-04-04 14:38:53 UTC
There is an auto off kernel parameter which may help here:

usbcore.autosuspend=-1

Can you try that?
Comment 2 Nitin Kamble 2013-04-05 00:02:48 UTC
Stoicescu Cornel,

I am not seeing this issue with latest branches. Can you try with the latest branches and see if you see the issue?
Comment 3 Stoicescu Cornel 2013-04-18 11:35:12 UTC
I am still seeing this issue in:
dylan:
meta-intel:

Here is some useful output: 

root@sugarbay:/# tail /sys/bus/usb/devices/usb2/power/autosuspend
0
root@sugarbay:/# tail /sys/bus/usb/devices/usb2/power/autosuspend_delay_ms
0
root@sugarbay:/# tail /sys/bus/usb/devices/usb1/power/autosuspend_delay_ms
0
root@sugarbay:/# tail /sys/bus/usb/devices/usb1/power/autosuspend
0
root@sugarbay:/# tail /sys/module/usbcore/parameters/autosuspend
2

As per documentation: 
"
Each USB device directory will contain a file named power/autosuspend.  This file holds the time (in seconds) the device must be idle before it will be autosuspended. 0 means the device will be autosuspended as soon as possible.  Negative values will prevent the device from being autosuspended at all, and writing a negative value will resume the device if it is already suspended.
"

Doing this solves the problem: 
echo "-1" > /sys/module/usbcore/parameters/autosuspend
Comment 4 Stoicescu Cornel 2013-04-18 11:36:26 UTC
I forgot to add the commits:

dylan:87eb70243749e0e2431f98770746fa42002f4441
meta-intel:76f70c337e5daa9593153dfdf5107aec08610a44
Comment 5 Tom Zanussi 2013-04-18 23:30:33 UTC
So it sounds like the autosuspend is working as advertised.

The question then is what changed the settings and is it the same on other BSPs including core BSPs.
Comment 6 Stoicescu Cornel 2013-04-19 07:31:14 UTC
I will get this information during the current full pass.
Comment 7 Stoicescu Cornel 2013-04-19 12:52:33 UTC
This issue is present on sato-sdk-FRI2, lsb-sdk-jasperforest, sato-sdk-sugarbay

Also I noticed /sys/module/usbcore/parameters/autosuspend is set to 2 in both Ubuntu and Fedora and the issue is not present there; therefore that might not be the source of the problem.
Comment 8 Stoicescu Cornel 2013-04-19 12:54:18 UTC
The real issue here might be that way autosuspend is done. I think it should not miss inputs on behalf of autosuspend, thus not making it a problem.
Comment 9 Tom Zanussi 2013-04-19 14:27:52 UTC
All the images you mention have -sdk in common.  Is that a requirement, or just what you tested i.e. does it happen with just -sato?
Comment 10 Tom Zanussi 2013-04-19 19:00:56 UTC
With core-image-sato on crownbay, I don't see this problem, and the settings there are the same as in comment 3.
Comment 11 Tom Zanussi 2013-04-19 19:28:59 UTC
The target milestone says 1.5, but this was mentioned in yesterday's staff meeting as something that should be fixed for 1.4?
Comment 12 Darren Hart 2013-04-19 21:49:54 UTC
Has anyone tried the kernel parameter from comment 1? If that works, this can be easily documented for the release.

This appears to be a behavior preference as opposed to a bug, I don't see this as critical for 1.4. So unless RP or Saul would like to override that, I'd like to see us test the kernel param and document for 1.4.
Comment 13 Tom Zanussi 2013-04-19 22:12:00 UTC
I'm having USB problems with my sugarbay, so can't even reproduce the problem at this point.
Comment 14 Nitin Kamble 2013-04-19 22:13:33 UTC
I will test this on my sugarbay here with the kernel parameter: 

usbcore.autosuspend=-1
Comment 15 Nitin Kamble 2013-04-19 22:30:55 UTC
The USb device inactive issue does go away with the kernel parameter usbcore.autosuspend=-1 on sugarbay hardware
Comment 16 Nitin Kamble 2013-08-13 03:22:42 UTC
Fixed in linux-yocto-3.8 kernel repository:

commit 5995fa5838b843b5393e3a6cfdee8b508cb95ba8
Author: Nitin A Kamble <nitin.a.kamble@intel.com>
Date:   Fri Aug 9 00:57:33 2013 +0000

    meta: features/power/intel.cfg
    
    Disable USB autosuspend configuration. This is causing unusable
    keyboards & mice issues for many Intel BSPs.
    Also by default this config is disabled in the kernel.
    
    Fixes bug:
    [YOCTO #4992]
    
    Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
    Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
Comment 17 Stoicescu Cornel 2013-10-03 14:24:39 UTC
VERIFIED in:
poky master:a02280f99f05b1c21de2a78de9222a2f62a0dabc