Re: [PATCH 2/4] usb: introduce usb force power off mechanism

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 1 Apr 2013, Lan Tianyu wrote:

> On 2013年03月30日 01:23, Alan Stern wrote:
> > On Fri, 29 Mar 2013, Sarah Sharp wrote:
> >> However, what happens if you echo 0 to pm_qos_no_power_off, the
> >> power/control is set to auto, and there's a suspended USB device
> >> attached to the port with remote wakeup enabled?  Will the port be
> >> powered off?  I don't think it will with the current patchset, but I
> >> will have to double check.
> > 
> > It shouldn't be, because remote wakeup is enabled.  But what about the
> > case where remote wakeup is disabled?  Will writing a 0 to
> > pm_qos_no_power_off cause the power to be turned off?
> > 
> > Or what about the case where there's no device attached to the port?  I 
> > guess both questions amount to the same thing: When the user writes to 
> > a pm_qos_* file, does the code call pm_runtime_idle?
> > 
> 
> Usb port's initial usage count is 0. For port attached with usb port,
> when usb device is connected, the usb port's usage count is increased by
> one. During device's suspend, its usage count would be decreased to 0
> and powered of only when remote wakeup disable, persist enable and PM
> Qos NO_POWER_OFF unsetting.

I already know all this.

> During pm_qos_* file changing, pm_runtime_get_sync/put(port_dev) will be
> done in the dev_pm_qos_update_flags(). The port's  usage count would be
> increased and decreased by 1. Whether the port's pm_runtime_idle would
> be called depends on port's usage count to be set to 0.

That answers my question.

> If the usb port has already been powered off(port usage count is already
> set to 0), it would be powered on first and powered off depending the PM
> Qos NO_POWER_OFF flag value.

Obviously.

> If the usb port wasn't powered off, this mean the usb port didn't meet
> power off condition() and  its usage count was still greater than 0 So
> during changing flag, only usage count was changed and no actual operation.

No, because one of the power off conditions is that the NO_POWER_OFF
flag must be clear.  If that flag was set, the port won't be powered
off even though the usage count is equal to 0.  If the write to the
pm_qos_* file then clears the flag, the port _will_ get powered off.

> For empty port, Only when PM Qos NO_POWER_OFF flag value is set to 0,
> the port will be power off.

Alan Stern


--
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




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux