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

2013-04-08 Thread Sarah Sharp
On Mon, Apr 08, 2013 at 09:39:07PM +0200, Rafael J. Wysocki wrote: > On Monday, April 08, 2013 10:55:19 AM Sarah Sharp wrote: > > Cc-ing the linux-pm list and some Intel power devs, as I think this > > specific discussion could benefit from a broader audience. > > > > On Mon, Apr 08, 2013 at 12:33

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

2013-04-08 Thread Rafael J. Wysocki
On Monday, April 08, 2013 10:55:19 AM Sarah Sharp wrote: > Cc-ing the linux-pm list and some Intel power devs, as I think this > specific discussion could benefit from a broader audience. > > On Mon, Apr 08, 2013 at 12:33:00PM -0400, Alan Stern wrote: > > On Mon, 8 Apr 2013, Greg KH wrote: > > >

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

2013-04-08 Thread Alan Stern
On Mon, 8 Apr 2013, Sarah Sharp wrote: > That could work. However, we have to think about future platform power > changes as well. Coming up with a USB specific way to work around the > runtime PM core will hurt us in the long run, if we end up having to > change the runtime PM core for another

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

2013-04-08 Thread Rafael J. Wysocki
On Monday, April 08, 2013 10:33:54 AM Sarah Sharp wrote: > On Mon, Apr 08, 2013 at 09:01:44AM -0700, Greg KH wrote: > > On Mon, Apr 08, 2013 at 08:57:43AM -0700, Sarah Sharp wrote: > > > On Mon, Apr 08, 2013 at 06:29:36AM -0700, Greg KH wrote: > > > > On Mon, Apr 08, 2013 at 08:58:09PM +0800, Lan T

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

2013-04-08 Thread Sarah Sharp
Cc-ing the linux-pm list and some Intel power devs, as I think this specific discussion could benefit from a broader audience. On Mon, Apr 08, 2013 at 12:33:00PM -0400, Alan Stern wrote: > On Mon, 8 Apr 2013, Greg KH wrote: > > > On Mon, Apr 08, 2013 at 08:57:43AM -0700, Sarah Sharp wrote: > > >

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

2013-04-08 Thread Sarah Sharp
On Mon, Apr 08, 2013 at 09:01:44AM -0700, Greg KH wrote: > On Mon, Apr 08, 2013 at 08:57:43AM -0700, Sarah Sharp wrote: > > On Mon, Apr 08, 2013 at 06:29:36AM -0700, Greg KH wrote: > > > On Mon, Apr 08, 2013 at 08:58:09PM +0800, Lan Tianyu wrote: > > > > Hi Alan & Sarah: > > > > I just reca

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

2013-04-08 Thread Alan Stern
On Mon, 8 Apr 2013, Lan Tianyu wrote: > Hi Alan: > I think current code can't achieve that power off port(whose > child device was already suspended but it was not powered off due to > NO_POWER_OFF flag setting.) via clearing NO_POWER_OFF flag. Because > at that moment, its usage count can't

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

2013-04-08 Thread Alan Stern
On Mon, 8 Apr 2013, Greg KH wrote: > On Mon, Apr 08, 2013 at 08:57:43AM -0700, Sarah Sharp wrote: > > On Mon, Apr 08, 2013 at 06:29:36AM -0700, Greg KH wrote: > > > On Mon, Apr 08, 2013 at 08:58:09PM +0800, Lan Tianyu wrote: > > > > On 2013/3/30 4:24, Alan Stern wrote: > > > > >On Fri, 29 Mar 2013

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

2013-04-08 Thread Greg KH
On Mon, Apr 08, 2013 at 08:57:43AM -0700, Sarah Sharp wrote: > On Mon, Apr 08, 2013 at 06:29:36AM -0700, Greg KH wrote: > > On Mon, Apr 08, 2013 at 08:58:09PM +0800, Lan Tianyu wrote: > > > On 2013/3/30 4:24, Alan Stern wrote: > > > >On Fri, 29 Mar 2013, Sarah Sharp wrote: > > > > > > > >>>Also, be

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

2013-04-08 Thread Sarah Sharp
On Mon, Apr 08, 2013 at 06:29:36AM -0700, Greg KH wrote: > On Mon, Apr 08, 2013 at 08:58:09PM +0800, Lan Tianyu wrote: > > On 2013/3/30 4:24, Alan Stern wrote: > > >On Fri, 29 Mar 2013, Sarah Sharp wrote: > > > > > >>>Also, bear in mind that the proposed patch does not give userspace a > > >>>way t

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

2013-04-08 Thread Lan Tianyu
On 2013/4/1 23:12, Alan Stern wrote: 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

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

2013-04-08 Thread Greg KH
On Mon, Apr 08, 2013 at 08:58:09PM +0800, Lan Tianyu wrote: > On 2013/3/30 4:24, Alan Stern wrote: > >On Fri, 29 Mar 2013, Sarah Sharp wrote: > > > >>>Also, bear in mind that the proposed patch does not give userspace a > >>>way to power off ports via usbfs. What the new code does is a > >>>power-

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

2013-04-08 Thread Lan Tianyu
On 2013/3/30 4:24, Alan Stern wrote: On Fri, 29 Mar 2013, Sarah Sharp wrote: Also, bear in mind that the proposed patch does not give userspace a way to power off ports via usbfs. What the new code does is a power-off reset -- it turns off power to the port, waits a short time, and then turns

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

2013-04-01 Thread Alan Stern
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 remo

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

2013-04-01 Thread Lan Tianyu
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 o

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

2013-03-31 Thread Lan Tianyu
On 2013年03月29日 22:11, Alan Stern wrote: > On Fri, 29 Mar 2013, Lan Tianyu wrote: > >> Actually, I exposed pm qos flags for usb port via dev_pm_qos_expose_flags(). >> It creates power/pm_qos_no_power_off under usb port sysfs directory. >> User can echo 0 > pm_qos_no_power_off to power off the empty

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

2013-03-29 Thread Alan Stern
On Fri, 29 Mar 2013, Sarah Sharp wrote: > > Also, bear in mind that the proposed patch does not give userspace a > > way to power off ports via usbfs. What the new code does is a > > power-off reset -- it turns off power to the port, waits a short time, > > and then turns power back on. > > I

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

2013-03-29 Thread Sarah Sharp
On Fri, Mar 29, 2013 at 01:23:14PM -0400, 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? Wil

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

2013-03-29 Thread Alan Stern
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 p

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

2013-03-29 Thread Sarah Sharp
On Fri, Mar 29, 2013 at 02:37:24PM +0800, Lan Tianyu wrote: > On 2013/3/29 6:43, Sarah Sharp wrote: > >On Thu, Mar 28, 2013 at 05:00:23PM -0400, Alan Stern wrote: > >>On Thu, 28 Mar 2013, Sarah Sharp wrote: > >>>On Thu, Mar 28, 2013 at 01:11:02AM +0800, Lan Tianyu wrote: > >Now I'm a bit confused a

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

2013-03-29 Thread Alan Stern
On Fri, 29 Mar 2013, Lan Tianyu wrote: > Actually, I exposed pm qos flags for usb port via dev_pm_qos_expose_flags(). > It creates power/pm_qos_no_power_off under usb port sysfs directory. > User can echo 0 > pm_qos_no_power_off to power off the empty port. Before it's too late, we should conside

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

2013-03-28 Thread Lan Tianyu
On 2013/3/29 6:43, Sarah Sharp wrote: On Thu, Mar 28, 2013 at 05:00:23PM -0400, Alan Stern wrote: On Thu, 28 Mar 2013, Sarah Sharp wrote: On Thu, Mar 28, 2013 at 01:11:02AM +0800, Lan Tianyu wrote: Some devices' firmware will be broken at some points. Power down and power on device can help d

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

2013-03-28 Thread Sarah Sharp
On Thu, Mar 28, 2013 at 05:00:23PM -0400, Alan Stern wrote: > On Thu, 28 Mar 2013, Sarah Sharp wrote: > > > On Thu, Mar 28, 2013 at 01:11:02AM +0800, Lan Tianyu wrote: > > > Some devices' firmware will be broken at some points. Power down > > > and power on device can help device to rework in this

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

2013-03-28 Thread Alan Stern
On Thu, 28 Mar 2013, Sarah Sharp wrote: > On Thu, Mar 28, 2013 at 01:11:02AM +0800, Lan Tianyu wrote: > > Some devices' firmware will be broken at some points. Power down > > and power on device can help device to rework in this case. > > > > This patch is to add ioctl cmd USBDEVFS_POWER_RESET fo

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

2013-03-28 Thread Sarah Sharp
On Fri, Mar 29, 2013 at 03:51:50AM +0800, Lan Tianyu wrote: > On 2013/3/29 3:38, Alan Stern wrote: > >On Fri, 29 Mar 2013, Lan Tianyu wrote: > >It looks okay. When you test it, does the attached device get detected > >and initialized properly? > I test usb2.0 key on my machine. It works. Did you

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

2013-03-28 Thread Sarah Sharp
On Thu, Mar 28, 2013 at 01:11:02AM +0800, Lan Tianyu wrote: > Some devices' firmware will be broken at some points. Power down > and power on device can help device to rework in this case. > > This patch is to add ioctl cmd USBDEVFS_POWER_RESET for usbfs node > to repower usb device. First, call h

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

2013-03-28 Thread Lan Tianyu
On 2013/3/29 3:38, Alan Stern wrote: On Fri, 29 Mar 2013, Lan Tianyu wrote: Ok. I just refresh patch "usb: introduce usb force power off mechanism" Please have a look. From 16f5c7c6dd00830530a9ac758af25b575e0b8731 Mon Sep 17 00:00:00 2001 From: Lan Tianyu Date: Tue, 26 Feb 2013 11:12:09 +08

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

2013-03-28 Thread Alan Stern
On Fri, 29 Mar 2013, Lan Tianyu wrote: > Ok. I just refresh patch "usb: introduce usb force power off mechanism" > Please have a look. > > From 16f5c7c6dd00830530a9ac758af25b575e0b8731 Mon Sep 17 00:00:00 2001 > From: Lan Tianyu > Date: Tue, 26 Feb 2013 11:12:09 +0800 > Subject: [PATCH] usb: in

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

2013-03-28 Thread Lan Tianyu
On 2013/3/29 1:49, Alan Stern wrote: On Fri, 29 Mar 2013, Lan Tianyu wrote: On 2013/3/29 0:50, Alan Stern wrote: On Fri, 29 Mar 2013, Lan Tianyu wrote: About the path "usb: Add usb port system pm support", do you think it's ok? Generally yes. But why doesn't usb_port_system_suspend check

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

2013-03-28 Thread Alan Stern
On Fri, 29 Mar 2013, Lan Tianyu wrote: > On 2013/3/29 0:50, Alan Stern wrote: > > On Fri, 29 Mar 2013, Lan Tianyu wrote: > > > >> About the path "usb: Add usb port system pm support", do you think it's > >> ok? > > > > Generally yes. But why doesn't usb_port_system_suspend check for any > > PM_QO

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

2013-03-28 Thread Lan Tianyu
On 2013/3/29 0:50, Alan Stern wrote: On Fri, 29 Mar 2013, Lan Tianyu wrote: About the path "usb: Add usb port system pm support", do you think it's ok? Generally yes. But why doesn't usb_port_system_suspend check for any PM_QOS constraints? Either on the port itself or on the child device.

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

2013-03-28 Thread Alan Stern
On Fri, 29 Mar 2013, Lan Tianyu wrote: > About the path "usb: Add usb port system pm support", do you think it's > ok? Generally yes. But why doesn't usb_port_system_suspend check for any PM_QOS constraints? Either on the port itself or on the child device. Alan Stern -- To unsubscribe from t

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

2013-03-28 Thread Lan Tianyu
On 2013/3/28 22:46, Alan Stern wrote: On Thu, 28 Mar 2013, Lan Tianyu wrote: How long do you think the power should remain turned off? This code will leave it off for only a few milliseconds at most. That may not even be long enough for the voltage to drop all the way to 0. The delay probabl

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

2013-03-28 Thread Alan Stern
On Thu, 28 Mar 2013, Lan Tianyu wrote: > > How long do you think the power should remain turned off? This code > > will leave it off for only a few milliseconds at most. That may not > > even be long enough for the voltage to drop all the way to 0. > > > > The delay probably should be at least 1

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

2013-03-28 Thread Lan Tianyu
On 2013/3/28 2:45, Alan Stern wrote: +int usb_hub_port_power_reset(struct usb_device *hdev, int port1) +{ + struct usb_hub *hub = usb_hub_to_struct_hub(hdev); + struct usb_interface *intf = to_usb_interface(hub->intfdev); + int ret; + + usb_autopm_get_interface(intf); Wh

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

2013-03-27 Thread Alan Stern
On Wed, 27 Mar 2013, Lan, Tianyu wrote: > A small tool to test this patch. > > #include > #include > #include > #include > #include > #include > > #define USBDEVFS_POWER_RESET _IO('U', 28) > > int main(int argc, char **argv) > { > const char *filename; > int fd; > in

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

2013-03-27 Thread Alan Stern
On Thu, 28 Mar 2013, Lan Tianyu wrote: > Some devices' firmware will be broken at some points. Power down > and power on device can help device to rework in this case. > > This patch is to add ioctl cmd USBDEVFS_POWER_RESET for usbfs node > to repower usb device. First, call hub_port_logical_disc

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

2013-03-27 Thread Lan, Tianyu
A small tool to test this patch. #include #include #include #include #include #include #define USBDEVFS_POWER_RESET _IO('U', 28) int main(int argc, char **argv) { const char *filename; int fd; int rc; if (argc != 2) { fprintf(stderr, "