Re: [PATCH 08/10] usb: add usb port auto power off mechanism

2012-12-20 Thread Lan Tianyu
On 2012年12月19日 23:39, Alan Stern wrote: > On Wed, 19 Dec 2012, lantianyu wrote: > I just find busy_bits is set or clear in the usb_port_resume() and usb_reset_and_verify_device(). So currently we should keep my changes mutually exclusive with them, right? >>> >>> Don't forget about

Re: [PATCH 08/10] usb: add usb port auto power off mechanism

2012-12-19 Thread Alan Stern
On Wed, 19 Dec 2012, lantianyu wrote: > >> I just find busy_bits is set or clear in the usb_port_resume() and > >> usb_reset_and_verify_device(). So currently we should keep my changes > >> mutually exclusive with them, right? > > > > Don't forget about what happens when a device is removed. > I a

Re: [PATCH 08/10] usb: add usb port auto power off mechanism

2012-12-19 Thread lantianyu
于 2012/12/18 23:58, Alan Stern 写道: On Tue, 18 Dec 2012, lantianyu wrote: What you want here is sort of an alternate debounce routine. The normal routine waits until the connect status has been stable for 100 ms. But you want to wait until the status has stable in the "connected" state for 100

Re: [PATCH 08/10] usb: add usb port auto power off mechanism

2012-12-18 Thread Alan Stern
On Tue, 18 Dec 2012, lantianyu wrote: > > What you want here is sort of an alternate debounce routine. The > > normal routine waits until the connect status has been stable for 100 > > ms. But you want to wait until the status has stable in the > > "connected" state for 100 ms. > Yesh. > > Maybe

Re: [PATCH 08/10] usb: add usb port auto power off mechanism

2012-12-18 Thread lantianyu
于 2012/12/17 0:25, Alan Stern 写道: On Sun, 16 Dec 2012, Lan Tianyu wrote: On 2012/12/14 23:44, Alan Stern wrote: On Fri, 14 Dec 2012, Lan Tianyu wrote: Hi Alan: debounce is still needed. If connect status was not stable, resume operation will fail. So how about following? Actually, I

Re: [PATCH 08/10] usb: add usb port auto power off mechanism

2012-12-16 Thread Alan Stern
On Sun, 16 Dec 2012, Lan Tianyu wrote: > On 2012/12/14 23:44, Alan Stern wrote: > > On Fri, 14 Dec 2012, Lan Tianyu wrote: > > > >> Hi Alan: > >>debounce is still needed. If connect status was not stable, resume > >> operation will fail. So how about following? > > > > Actually, I'm not sure t

Re: [PATCH 08/10] usb: add usb port auto power off mechanism

2012-12-16 Thread Lan Tianyu
On 2012/12/14 23:44, Alan Stern wrote: On Fri, 14 Dec 2012, Lan Tianyu wrote: Hi Alan: debounce is still needed. If connect status was not stable, resume operation will fail. So how about following? Actually, I'm not sure that a debounce is needed. Debouncing is used when a plug is p

Re: [PATCH 08/10] usb: add usb port auto power off mechanism

2012-12-14 Thread Alan Stern
On Fri, 14 Dec 2012, Lan Tianyu wrote: > Hi Alan: > debounce is still needed. If connect status was not stable, resume > operation will fail. So how about following? Actually, I'm not sure that a debounce is needed. Debouncing is used when a plug is physically inserted or removed, because

Re: [PATCH 08/10] usb: add usb port auto power off mechanism

2012-12-14 Thread Lan Tianyu
On 2012年12月12日 23:56, Alan Stern wrote: > On Wed, 12 Dec 2012, Lan Tianyu wrote: > I tested a usb ssd which consumes about 1s to makes usb port status enter into connect status after powering off and powering on the port. So I set the tries 20 and the longest latency is larger than

Re: [PATCH 08/10] usb: add usb port auto power off mechanism

2012-12-12 Thread Alan Stern
On Wed, 12 Dec 2012, Alan Stern wrote: > You should test the connect status in a loop. Each time through the > loop, if it's not connected wait another 20 or so. Typo; I meant wait another 20 ms or so. Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the b

Re: [PATCH 08/10] usb: add usb port auto power off mechanism

2012-12-12 Thread Alan Stern
On Wed, 12 Dec 2012, Lan Tianyu wrote: > >> I tested a usb ssd which consumes about 1s to makes usb port status > >> enter into connect status after powering off and powering on the port. > >> So I set the tries 20 and the longest latency is larger than 2s. > >> The debounce routine only guarantee

Re: [PATCH 08/10] usb: add usb port auto power off mechanism

2012-12-12 Thread Lan Tianyu
On 2012年12月12日 00:35, Alan Stern wrote: > On Tue, 11 Dec 2012, Lan Tianyu wrote: > @@ -108,11 +109,14 @@ MODULE_PARM_DESC(use_both_schemes, DECLARE_RWSEM(ehci_cf_port_reset_rwsem); EXPORT_SYMBOL_GPL(ehci_cf_port_reset_rwsem); +#define HUB_PORT_RECONNECT_TRIES 20 >>> >>>

Re: [PATCH 08/10] usb: add usb port auto power off mechanism

2012-12-11 Thread Alan Stern
On Tue, 11 Dec 2012, Lan Tianyu wrote: > >> @@ -108,11 +109,14 @@ MODULE_PARM_DESC(use_both_schemes, > >> DECLARE_RWSEM(ehci_cf_port_reset_rwsem); > >> EXPORT_SYMBOL_GPL(ehci_cf_port_reset_rwsem); > >> > >> +#define HUB_PORT_RECONNECT_TRIES 20 > > > > 20 is an awful lot. Do you really need an

Re: [PATCH 08/10] usb: add usb port auto power off mechanism

2012-12-10 Thread Lan Tianyu
On 2012年12月11日 00:53, Alan Stern wrote: > On Mon, 10 Dec 2012, Lan Tianyu wrote: > >> Hi Alan: >> I write a patch based on the needs_debounce flag. The flag will be set >> when port has child device and power on successfully. Otherwise, I >> separate resume port and wait for connect in the us

Re: [PATCH 08/10] usb: add usb port auto power off mechanism

2012-12-10 Thread Alan Stern
On Mon, 10 Dec 2012, Lan Tianyu wrote: > Hi Alan: > I write a patch based on the needs_debounce flag. The flag will be set > when port has child device and power on successfully. Otherwise, I > separate resume port and wait for connect in the usb_port_resume(). > Device will not be disconnec

Re: [PATCH 08/10] usb: add usb port auto power off mechanism

2012-12-09 Thread Lan Tianyu
On 2012年12月07日 23:22, Alan Stern wrote: > On Fri, 7 Dec 2012, Lan Tianyu wrote: > >>> Maybe you really need two flags. Do whatever is best; I'm sure you can >>> figure out a good scheme. >> Yeah. Two flags maybe good. In this situation, it should be call >> "power_is_on", right? power_is_on can b

Re: [PATCH 08/10] usb: add usb port auto power off mechanism

2012-12-07 Thread Alan Stern
On Fri, 7 Dec 2012, Lan Tianyu wrote: > > Maybe you really need two flags. Do whatever is best; I'm sure you can > > figure out a good scheme. > Yeah. Two flags maybe good. In this situation, it should be call > "power_is_on", right? power_is_on can be used to avoid to sending > redundant PORT_PO

Re: [PATCH 08/10] usb: add usb port auto power off mechanism

2012-12-07 Thread Lan Tianyu
On 2012年12月06日 23:43, Alan Stern wrote: > On Thu, 6 Dec 2012, Lan Tianyu wrote: > >> Hi Alan: >> Doing port_dev->power_on = true in usb_hub_set_port_power() just after >> set PORT_POWER feature will cause device to be disconnected. If user set >> PM Qos NO_POWER_OFF flag after the device was

Re: [PATCH 08/10] usb: add usb port auto power off mechanism

2012-12-06 Thread Alan Stern
On Thu, 6 Dec 2012, Lan Tianyu wrote: > Hi Alan: > Doing port_dev->power_on = true in usb_hub_set_port_power() just after > set PORT_POWER feature will cause device to be disconnected. If user set > PM Qos NO_POWER_OFF flag after the device was power off, the port would > be power on and do

Re: [PATCH 08/10] usb: add usb port auto power off mechanism

2012-12-05 Thread Lan Tianyu
On 2012年11月29日 03:37, Alan Stern wrote: > On Sat, 17 Nov 2012, Lan Tianyu wrote: > >> This patch is to add usb port auto power off mechanism. >> When usb device is suspending, usb core will suspend usb port and >> usb port runtime pm callback will clear PORT_POWER feature to >> power off port if a

Re: [PATCH 08/10] usb: add usb port auto power off mechanism

2012-11-28 Thread Alan Stern
On Sat, 17 Nov 2012, Lan Tianyu wrote: > This patch is to add usb port auto power off mechanism. > When usb device is suspending, usb core will suspend usb port and > usb port runtime pm callback will clear PORT_POWER feature to > power off port if all conditions were met. These conditions are > r

[PATCH 08/10] usb: add usb port auto power off mechanism

2012-11-17 Thread Lan Tianyu
This patch is to add usb port auto power off mechanism. When usb device is suspending, usb core will suspend usb port and usb port runtime pm callback will clear PORT_POWER feature to power off port if all conditions were met. These conditions are remote wakeup disable, pm qos NO_POWER_OFF flag cle