Hi,

I think there is an issue with the reset-resume mechanism during USB runtime 
resume, leaving the interfaces suspended forever.

- Context:

Android platform, running a 3.13 + Google AOSP patches kernel.
I'm facing a USB issue with the bsusb driver. btusb driver has the USB runtime 
suspend enabled + remote wakeup.
However sometimes the USB runtime resume does not work as expected (we admit 
here that this can happen).

[ 3066.408413] usb 2-3: usb auto-resume
[ 3066.408433] hub 2-0:1.0: state 7 ports 9 chg 0000 evt 0008
[ 3066.445465] usb 2-3: finish resume
[ 3071.447591] usb 2-3: bt_hc_worker timed out on ep0in len=0/2
[ 3071.447598] usb 2-3: retry with reset-resume

Then the usbcore tries a reset-resume, but btusb driver does not implement this 
callback.

[ 3071.619408] btusb 2-3:1.0: no reset_resume for driver btusb?
[ 3071.619413] btusb 2-3:1.1: no reset_resume for driver btusb?

However for driver which doesn't implement 'reset_resume' callback, usbcore 
plans to unbind/rebind it.
Here is the problem, because this never happens.


- What happens (in core/driver.c):

0. Need to wake-up the usb device for data transfer
1. 'usb_runtime_resume' is called  and calls 'usb_resume_both'
2.' usb_resume_both' calls 'usb_resume_device' then calls 
'usb_resume_interface' for each interface with the 'reset_resume' flag set 
(since resume failed).
3. 'usb_resume_interface' enters in the 'reset_resume' condition and sets the 
'needs_binding' interface flag.
4. At the end of this runtime resume, the interfaces stay suspended FOREVER.


- Why:

+ function 'do_rebind_interface' is in charge of unbind and rebind the 
interfaces with the 'need_binfind' flag set.
+ However this method is only called in 'usb_resume_complete'.
+ Problem is that 'usb_resume_complete' is a dev_pm_ops callback (core/usb.h) 
used by the System PM core which is never called in a runtime PM scenario.
+ So interfaces remain suspended forever (or until the next PM system 
suspend/resume), device is unusable.
(unbinding/rebinding manually the interface via sysfs recovers the device)

Could you please let me know if it's the expected behavior or a real issue. 
Should we not call 'do_rebind_interface' in the runtime resume sequence?

Thanks & Regards,
Loic Poulain
---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to