On 2012/11/10 0:01, Alan Stern wrote:
On Fri, 9 Nov 2012, Lan Tianyu wrote:
This patch is to add usb port auto power off mechanism.
When usb device is suspending, usb core will send clear usb port's
POWER feature requst to power off port if all conditions were met.
Actually, this is the wrong approach.
What you should do, if all the conditions are met, is call
pm_runtime_put(&port_dev->dev). Then the port's runtime suspend
routine should be responsible for turning off the power.
You mean just send set/clear PORT_POWER request in the port's runtime pm
callback? Yeah, this has been suggested Rafael.
But my previous opinion, usb_port_suspend/resume() has done a lot port's
suspend/resume work.(e,g remote wakeup and link power management). If we
added port's runtime pm callback, I thought we should move the content
of usb_port_suspend/resume() to the callback. But
usb_port_suspend/resume() are also used by system pm. So this maybe be
difficult to move the code. From your response, this doesn't matter. But
I think we also should do a check of runtime pm or system pm before
calling pm_runtime_get_sync/put() in the usb_port_suspend/resume().
Since it's not reasonable to call runtime function during system pm, Right?
About port's runtime callback, I have saided my concern about the status
of device after port being resumed at my previous rely.
Similarly, whenever you want to make sure that a port is powered, you
should call pm_runtime_get_sync(&port_dev->dev).
Alan Stern
--
Best Regards
Tianyu Lan
linux kernel enabling team
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html