[PATCH V3 0/4] usb: expose DeviceRemovable to user space via sysfs attribute

2012-11-04 Thread Lan Tianyu
Change since v1: [PATCH 3] Rename link file's name child to device, add check of return value of sysfs_create_link() and handle error return value properly. Change since v2: [PATCH 1] fix a logic backward problem. Add changelog about change ehci root hub descriptors based on ACPI

[PATCH V3 2/4] usb/xhci: set root hub's DeviceRemovable according to usb port connect type

2012-11-04 Thread Lan Tianyu
-by: Lan Tianyu tianyu@intel.com --- drivers/usb/host/xhci-hub.c | 19 +-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c index a686cf4..50a3c39 100644 --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb

[PATCH V3 4/4] usb: Add portX/connect_type attribute to expose usb port's connect type

2012-11-04 Thread Lan Tianyu
Some platforms provide usb port connect types through ACPI. This patch is to add this new attribute to expose these information to user space. Signed-off-by: Lan Tianyu tianyu@intel.com --- Documentation/ABI/testing/sysfs-bus-usb |9 +++ drivers/usb/core/hub.c | 43

Re: [PATCH V2 1/4] USB: Set usb port's DeviceRemovable according acpi information in EHCI

2012-11-01 Thread Lan Tianyu
On 2012年11月01日 23:54, Sarah Sharp wrote: On Mon, Oct 29, 2012 at 04:28:38PM +0800, Lan Tianyu wrote: ACPI provide _PLD and _UPC aml methods to describe usb port visibility and connectability. This patch is to use those information to set usb port's DeviceRemovable. You should probably

[PATCH V2 0/4] usb: expose DeviceRemovable to user space via sysfs attribute

2012-10-29 Thread Lan Tianyu
Change since v1: [PATCH 3/4]: Rename link file's name child to device, add check of return value of sysfs_create_link() and handle error properly. This patchset is to set DeviceRemovable according ACPI information and create a new attribute connect_type under port device to expose port

[PATCH V2 1/4] USB: Set usb port's DeviceRemovable according acpi information in EHCI

2012-10-29 Thread Lan Tianyu
ACPI provide _PLD and _UPC aml methods to describe usb port visibility and connectability. This patch is to use those information to set usb port's DeviceRemovable. Signed-off-by: Lan Tianyu tianyu@intel.com --- drivers/usb/core/hub.c | 23 +++ drivers/usb/core

[PATCH V2 3/4] usb: Create link files between child device and usb port device.

2012-10-29 Thread Lan Tianyu
To show the relationship between usb port and child device, add link file port under usb device's sysfs directoy and device under usb port device's sysfs directory. They are linked to each other. Signed-off-by: Lan Tianyu tianyu@intel.com --- drivers/usb/core/hub.c | 22

[PATCH V2 4/4] usb: Add portX/connect_type attribute to expose usb port's connect type

2012-10-29 Thread Lan Tianyu
Some platforms provide usb port connect types through ACPI. This patch is to add this new attribute to expose these information to user space. Signed-off-by: Lan Tianyu tianyu@intel.com --- Documentation/ABI/testing/sysfs-bus-usb |9 +++ drivers/usb/core/hub.c | 43

[PATCH V2 2/4] usb/xhci: set root hub's DeviceRemovable according to usb port connect type

2012-10-29 Thread Lan Tianyu
This patch is to set xhci root hub's DeviceRemovable according to usb port's connect type which currently comes from ACPI information. If ACPI information was different with PORTSC, there would be a warning. Signed-off-by: Lan Tianyu tianyu@intel.com --- drivers/usb/host/xhci-hub.c | 19

[PATCH 1/4] USB: Set usb port's DeviceRemovable according acpi information in EHCI

2012-10-23 Thread Lan Tianyu
ACPI provide _PLD and _UPC aml methods to describe usb port visibility and connectability. This patch is to use those information to set usb port's DeviceRemovable. Signed-off-by: Lan Tianyu tianyu@intel.com --- drivers/usb/core/hub.c | 23 +++ drivers/usb/core

[PATCH 3/4] usb: Create link files between child device and usb port device.

2012-10-23 Thread Lan Tianyu
To show the relationship between usb port and child device, add link file port under usb device's sysfs directoy and child under usb port device's sysfs directory. They are linked to each other. Signed-off-by: Lan Tianyu tianyu@intel.com --- drivers/usb/core/hub.c | 17 + 1

[PATCH V2 1/2] usb/xhci: release xhci-lock during turning on/off usb port's acpi power resource and checking the existence of port's power resource

2012-10-15 Thread Lan Tianyu
invoking it. Signed-off-by: Lan Tianyu tianyu@intel.com --- Change since v1: release xhci-lock before invoking usb_acpi_power_manageable(). drivers/usb/host/xhci-hub.c |4 1 file changed, 4 insertions(+) diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c

[PATCH V2 2/2] usb/xhci: Remove (__force__ __u16) before assigning DeviceRemovable and assign directly.

2012-10-15 Thread Lan Tianyu
Struct usb_hub_descriptor.ss.DeviceRemovable has been defined as __le16 and (__force__ __u16) doesn't need. Signed-off-by: Lan Tianyu tianyu@intel.com --- drivers/usb/host/xhci-hub.c |5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/usb/host/xhci-hub.c b

[PATCH 1/2] usb/xhci: release xhci-lock during turning on/off usb port's acpi power resource

2012-09-25 Thread Lan Tianyu
When setting usb port's acpi power resource, there will be some xhci hub requests. This will cause dead lock since xhci-lock has been held before setting acpi power resource in the xhci_hub_control(). Signed-off-by: Lan Tianyu tianyu@intel.com --- drivers/usb/host/xhci-hub.c | 10

[PATCH 2/2] usb/xhci: Remove (__force__ __u16) before assigning DeviceRemovable and assign directly.

2012-09-25 Thread Lan Tianyu
Struct usb_hub_descriptor.ss.DeviceRemovable has been defined as __le16 and (__force__ __u16) doesn't need. Signed-off-by: Lan Tianyu tianyu@intel.com --- drivers/usb/host/xhci-hub.c |5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/usb/host/xhci-hub.c b

Re: USB port power off discussion

2012-09-25 Thread Lan Tianyu
On 2012年09月25日 05:17, Alan Stern wrote: On Mon, 24 Sep 2012, Rafael J. Wysocki wrote: Well, precisely. Which means that the user would have to apply trial-and-error to figure out which sysfs file corresponds to which physical port on his/her machine. That doesn't sound really user

Re: [PATCH 10/29] PCI, USB: remove find_bridge in acpi_bus_type

2012-09-25 Thread Lan Tianyu
2012/9/25 Yinghai Lu ying...@kernel.org: The struct member is not used anymore, remove it. Signed-off-by: Yinghai Lu ying...@kernel.org Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: linux-usb@vger.kernel.org --- drivers/usb/core/usb-acpi.c |1 - 1 files changed, 0

Re: USB port power off discussion

2012-09-24 Thread Lan Tianyu
On 2012/9/24 21:18, Rafael J. Wysocki wrote: On Saturday, September 22, 2012, Rafael J. Wysocki wrote: On Friday, September 21, 2012, Sarah Sharp wrote: Two weeks ago at Linux Plumbers Conference, I presented about the Intel Lynx Point USB port power off mechanism. This email is a report out

Re: USB port power off discussion

2012-09-23 Thread Lan Tianyu
于 2012/9/22 20:08, Rafael J. Wysocki 写道: So, my current idea is why don't we handle that through PM QoS? I mean we have a means to specify per-device PM QoS wakeup latency constraits and expose it to user space on a per-device basis. I suppose we can we can handle the don't remove power from

Re: USB port power off discussion

2012-09-23 Thread Lan Tianyu
于 2012/9/23 3:54, Rafael J. Wysocki 写道: On Friday, September 21, 2012, Peter Stuge wrote: Sarah Sharp wrote: If userspace really wants the port off (e.g. to disconnect and reconnect a misbehaving device), then it can set the sysfs file to off. And unless all ganged ports are also off it will

Re: [PATCH V2] ACPI: Allow acpi binding with usb3.0 hub

2012-09-20 Thread Lan Tianyu
On 2012年09月21日 08:25, Sarah Sharp wrote: Hi Tianyu, You're correct that the USB core and the xHCI driver has a slightly different architecture than the ACPI representation. We have one PCI device that has two USB buses/roothubs underneath it. That's because external USB 3.0 hubs show up

Re: USB port power off discussion

2012-09-20 Thread Lan Tianyu
On 2012年09月21日 09:52, Peter Chen wrote: Where I would like to see this work go is to have a certain set of safe internal USB devices be powered off by default when they are suspended. I think fingerprint readers and webcams would be a good start, but we probably can't do bluetooth, 3G

[PATCH 1/2] usb: redefine DeviceRemovable and wHubDelay as _le16

2012-09-10 Thread Lan Tianyu
DeviceRemovalbe and wHubDelay for usb3.0 hub are little-endian and so define them as _le16. Signed-off-by: Lan Tianyu tianyu@intel.com --- include/linux/usb/ch11.h |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/usb/ch11.h b/include/linux/usb/ch11.h

[PATCH 2/2] usb: add little-endian transform for DeviceRemovable of usb3.0 hub

2012-09-10 Thread Lan Tianyu
Signed-by-off: Lan Tianyutianyu@intel.com Signed-off-by: Lan Tianyu tianyu@intel.com --- drivers/usb/core/hub.c |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 3def91e..aa45e43 100644 --- a/drivers/usb/core

Re: [RFC PATCH V2 2/2] USB: Set usb port's DevicerRemovable according acpi information in EHCI

2012-09-05 Thread Lan Tianyu
On 2012/9/5 0:15, Alan Stern wrote: On Mon, 3 Sep 2012, Lan Tianyu wrote: ACPI provide _PLD and _UPC aml methods to describe usb port visibility and connectability. This patch is to use those information to set usb port's DeviceRemovable. Signed-off-by: Lan Tianyu tianyu@intel.com --- v2

[Resend PATCH V2 1/8] usb: make usb port a real device

2012-09-04 Thread Lan Tianyu
the port_owner variable out of usb_hub and into this new structure. A new file will be created in the hub interface sysfs directory, so add documentation. Acked-by: Alan Stern st...@rowland.harvard.edu Signed-off-by: Lan Tianyu tianyu@intel.com Signed-off-by: Sarah Sharp sarah.a.sh

[Resend PATCH V2 2/8] usb: move children to struct usb_port

2012-09-04 Thread Lan Tianyu
...@rowland.harvard.edu Signed-off-by: Lan Tianyu tianyu@intel.com Signed-off-by: Sarah Sharp sarah.a.sh...@linux.intel.com --- drivers/staging/usbip/usbip_common.c |3 +- drivers/usb/core/devices.c |7 ++-- drivers/usb/core/hub.c | 73

[Resend PATCH V2 4/8] usb/acpi: Store info on device removability.

2012-09-04 Thread Lan Tianyu
-by: Lan Tianyu tianyu@intel.com Signed-off-by: Sarah Sharp sarah.a.sh...@linux.intel.com --- drivers/usb/core/hub.c | 31 + drivers/usb/core/usb-acpi.c | 80 --- drivers/usb/core/usb.h |4 +++ include/linux/usb.h

[Resend PATCH V2 5/8] xhci: Handle clear PORT_POWER feature.

2012-09-04 Thread Lan Tianyu
This patch makes the xHCI roothub code handle the clear PORT_POWER feature request. Setting port power is already handled. Signed-off-by: Lan Tianyu tianyu@intel.com Signed-off-by: Sarah Sharp sarah.a.sh...@linux.intel.com --- drivers/usb/host/xhci-hub.c |4 1 file changed, 4

[Resend PATCH V2 6/8] usb/acpi: Use ACPI methods to power off ports.

2012-09-04 Thread Lan Tianyu
into the xHCI hub driver to power off a port, check whether the port can be completely powered off via this new ACPI mechanism. If so, call into these new ACPI methods. Also use the ACPI methods when the USB core asks to power on a port. Signed-off-by: Lan Tianyu tianyu@intel.com Signed-off

[Resend PATCH V2 7/8] usb: Fail a get config when the port is powered off.

2012-09-04 Thread Lan Tianyu
to usb_get_descriptor() fails for a reason other than a Stall, return an error. That should handle the case where the port is powered off. Acked-by: Alan Stern st...@rowland.harvard.edu Signed-off-by: Lan Tianyu tianyu@intel.com Signed-off-by: Sarah Sharp sarah.a.sh...@linux.intel.com --- drivers/usb

[Resend PATCH V2 3/8] usb/acpi: Bind ACPI node to USB port, not usb_device.

2012-09-04 Thread Lan Tianyu
. Now that the usb port is a real device, we can bind the port's ACPI node to struct usb_port instead. Signed-off-by: Lan Tianyu tianyu@intel.com Signed-off-by: Sarah Sharp sarah.a.sh...@linux.intel.com --- -v2: remove #ifdef CONFIG_ACPI around #include linux/acpi.h in the drivers /usb/core/usb.h

[Resend PATCH V2 8/8] usb : Add sysfs files to control port power.

2012-09-04 Thread Lan Tianyu
port's power state: on - powered on off - powered off error - can't get power state For now, let userspace dictate the port power off policy. Future patches may add an in-kernel policy. Acked-by: Alan Stern st...@rowland.harvard.edu Signed-off-by: Lan Tianyu tianyu@intel.com Signed-off

[RFC PATCH V2 1/2] usb: usb port power off mechanism add auto option

2012-09-03 Thread Lan Tianyu
This patch is to add auto option to attribute portX/control. When echo auto, the port's feature PORT_POWER would be clear if the port's connect type was mark not-used(connectability and visibility are both cleared) and with no device attached. Signed-off-by: Lan Tianyu tianyu@intel.com

[RFC PATCH V2 2/2] USB: Set usb port's DevicerRemovable according acpi information in EHCI

2012-09-03 Thread Lan Tianyu
ACPI provide _PLD and _UPC aml methods to describe usb port visibility and connectability. This patch is to use those information to set usb port's DeviceRemovable. Signed-off-by: Lan Tianyu tianyu@intel.com --- v2: Set DeviceRemovable according acpi infomation in the hub_configure() instead

Re: [RFC PATCH 2/2] USB: Set usb port's DevicerRemovable according acpi information in EHCI

2012-08-30 Thread Lan Tianyu
On 2012年8月30日 22:21:15, Alan Stern wrote: Yes. Here you probably want the ACPI information to override the information provided by the integrated hub's hub descriptor. You can do this from within hub_configure(), at the point where you were going to add the second call to get_hub_descriptor().

Re: [RFC PATCH 2/2] USB: Set usb port's DevicerRemovable according acpi information in EHCI

2012-08-29 Thread Lan Tianyu
于 2012/8/27 23:00, Lan Tianyu 写道: 于 2012/8/27 22:20, Alan Stern 写道: On Mon, 27 Aug 2012, Lan Tianyu wrote: Now I see the problem. The code you're adding to ehci-hub.c relies on the hub driver knowing about the root hub's ports beforehand. So you've got a circular dependency: ehci-hub.c

Re: [RFC PATCH 2/2] USB: Set usb port's DevicerRemovable according acpi information in EHCI

2012-08-29 Thread Lan Tianyu
On 2012年08月29日 23:36, Alan Stern wrote: On Wed, 29 Aug 2012, Lan Tianyu wrote: Hi Alan: Do you have some advices on this patch? I current have two proposals. 1) Add a new routine to get port connection before port's device being created and being bound with ACPI. The routine first

Re: [RFC PATCH 2/2] USB: Set usb port's DevicerRemovable according acpi information in EHCI

2012-08-27 Thread Lan Tianyu
On 2012年08月27日 03:18, Alan Stern wrote: On Sun, 26 Aug 2012, Lan Tianyu wrote: �� 2012/8/24 22:45, Alan Stern д��: On Fri, 24 Aug 2012, Lan Tianyu wrote: But if other places got hub descriptor, they can't get DeviceRemovable value since we only set DeviceRemovable in the hub_configure

Re: [RFC PATCH 2/2] USB: Set usb port's DevicerRemovable according acpi information in EHCI

2012-08-27 Thread Lan Tianyu
On 2012年08月27日 14:57, Lan Tianyu wrote: On 2012年08月27日 03:18, Alan Stern wrote: On Sun, 26 Aug 2012, Lan Tianyu wrote: �� 2012/8/24 22:45, Alan Stern д��: On Fri, 24 Aug 2012, Lan Tianyu wrote: But if other places got hub descriptor, they can't get DeviceRemovable value since we only set

Re: [RFC PATCH 2/2] USB: Set usb port's DevicerRemovable according acpi information in EHCI

2012-08-27 Thread Lan Tianyu
于 2012/8/27 22:20, Alan Stern 写道: On Mon, 27 Aug 2012, Lan Tianyu wrote: Now I see the problem. The code you're adding to ehci-hub.c relies on the hub driver knowing about the root hub's ports beforehand. So you've got a circular dependency: ehci-hub.c depends on the hub driver

Re: [RFC PATCH 2/2] USB: Set usb port's DevicerRemovable according acpi information in EHCI

2012-08-26 Thread Lan Tianyu
于 2012/8/24 22:45, Alan Stern 写道: On Fri, 24 Aug 2012, Lan Tianyu wrote: But if other places got hub descriptor, they can't get DeviceRemovable value since we only set DeviceRemovable in the hub_configure().(e.g lsusb). Note: This isn't true. You now set desc-u.hs.DeviceRemovable

Re: [RFC PATCH 2/2] USB: Set usb port's DevicerRemovable according acpi information in EHCI

2012-08-23 Thread Lan Tianyu
On 2012年08月23日 22:10, Alan Stern wrote: On Thu, 23 Aug 2012, Lan Tianyu wrote: Why not just update the ACPI information using the current hub descriptor? You don't need to fetch the hub descriptor again. You mean to set DeviceRemovable directly rather than via hub descriptor request

Re: [RFC PATCH 2/2] USB: Set usb port's DevicerRemovable according acpi information in EHCI

2012-08-22 Thread Lan Tianyu
于 2012/8/22 22:32, Alan Stern 写道: On Wed, 22 Aug 2012, Lan Tianyu wrote: @@ -1560,6 +1560,10 @@ static int hub_configure(struct usb_hub *hub, dev_err(hub-intfdev, couldn't create port%d device.\n, i + 1); + /* Get hub descriptor

Re: [RFC PATCH 1/2] usb: usb port power off mechanism add auto option

2012-08-22 Thread Lan Tianyu
于 2012/8/22 22:39, Alan Stern 写道: On Wed, 22 Aug 2012, Lan Tianyu wrote: You forgot to change the logic in hub_power_on(). You have to handle the USB_PORT_POWER_AUTO case. Yeah. Thanks for reminder. How about following? @@ -858,7 +860,14 @@ static unsigned hub_power_on(struct usb_hub *hub

[RFC PATCH 1/2] usb: usb port power off mechanism add auto option

2012-08-21 Thread Lan Tianyu
This patch is to add auto option to attribute portX/control. When echo auto, the port's feature PORT_POWER would be clear if the port's connect type was mark not-used(connectability and visibility are both cleared) and with no device attached. Signed-off-by: Lan Tianyu tianyu@intel.com

[RFC PATCH 2/2] USB: Set usb port's DevicerRemovable according acpi information in EHCI

2012-08-21 Thread Lan Tianyu
From: Signed-off-by: Lan Tianyu tianyu@intel.com ACPI provide _PLD and _UPC aml methods to describe usb port visibility and connectability. This patch is to use those information to set usb port's DeviceRemovable. Signed-off-by: Lan Tianyu tianyu@intel.com --- drivers/usb/core/hub.c

Re: [RFC PATCH 2/2] USB: Set usb port's DevicerRemovable according acpi information in EHCI

2012-08-21 Thread Lan Tianyu
于 2012/8/21 17:07, Bjørn Mork 写道: Lan Tianyu tianyu@intel.com writes: @@ -648,7 +649,14 @@ ehci_hub_descriptor ( /* two bitmaps: ports removable, and usb 1.0 legacy PortPwrCtrlMask */ memset(desc-u.hs.DeviceRemovable[0], 0, temp); - memset(desc-u.hs.DeviceRemovable

[PATCH 1/2] usb/endpoint: Set release callback in the struct device_type instead of in the device itself directly

2012-08-17 Thread Lan Tianyu
For following the way the rest of the usb core does, this patch is to change the place of setting release callback. Signed-off-by: Lan Tianyu tianyu@intel.com --- drivers/usb/core/endpoint.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/usb/core

[PATCH 2/2] usb: convert USB_QUIRK_RESET_MORPHS to USB_QUIRK_RESET

2012-08-17 Thread Lan Tianyu
Since the attribute avoid_reset_quirk is work for all devices including those devices that can't morph, convert USB_QUIRK_RESET_MORPHS to USB_QUIRK_RESET. Signed-off-by: Lan Tianyu tianyu@intel.com --- drivers/usb/core/quirks.c |2 +- drivers/usb/core/sysfs.c|6

[PATCH v2 1/8] usb: make usb port a real device

2012-08-16 Thread Lan Tianyu
the port_owner variable out of usb_hub and into this new structure. A new file will be created in the hub interface sysfs directory, so add documentation. Acked-by: Alan Stern st...@rowland.harvard.edu Signed-off-by: Lan Tianyu tianyu@intel.com Signed-off-by: Sarah Sharp sarah.a.sh

[PATCH v2 2/8] usb: move children to struct usb_port

2012-08-16 Thread Lan Tianyu
...@rowland.harvard.edu Signed-off-by: Lan Tianyu tianyu@intel.com Signed-off-by: Sarah Sharp sarah.a.sh...@linux.intel.com --- drivers/staging/usbip/usbip_common.c |3 +- drivers/usb/core/devices.c |7 ++-- drivers/usb/core/hub.c | 73

[PATCH v2 3/8] usb/acpi: Bind ACPI node to USB port, not usb_device.

2012-08-16 Thread Lan Tianyu
. Now that the usb port is a real device, we can bind the port's ACPI node to struct usb_port instead. Signed-off-by: Lan Tianyu tianyu@intel.com Signed-off-by: Sarah Sharp sarah.a.sh...@linux.intel.com --- -v2: remove #ifdef CONFIG_ACPI around #include linux/acpi.h in the drivers /usb/core/usb.h

[PATCH v2 5/8] xhci: Handle clear PORT_POWER feature.

2012-08-16 Thread Lan Tianyu
This patch makes the xHCI roothub code handle the clear PORT_POWER feature request. Setting port power is already handled. Signed-off-by: Lan Tianyu tianyu@intel.com Signed-off-by: Sarah Sharp sarah.a.sh...@linux.intel.com --- drivers/usb/host/xhci-hub.c |4 1 file changed, 4

[PATCH v2 6/8] usb/acpi: Use ACPI methods to power off ports.

2012-08-16 Thread Lan Tianyu
into the xHCI hub driver to power off a port, check whether the port can be completely powered off via this new ACPI mechanism. If so, call into these new ACPI methods. Also use the ACPI methods when the USB core asks to power on a port. Signed-off-by: Lan Tianyu tianyu@intel.com Signed-off

[PATCH v2 7/8] usb: Fail a get config when the port is powered off.

2012-08-16 Thread Lan Tianyu
to usb_get_descriptor() fails for a reason other than a Stall, return an error. That should handle the case where the port is powered off. Acked-by: Alan Stern st...@rowland.harvard.edu Signed-off-by: Lan Tianyu tianyu@intel.com Signed-off-by: Sarah Sharp sarah.a.sh...@linux.intel.com --- drivers/usb

[PATCH v2 8/8] usb : Add sysfs files to control port power.

2012-08-16 Thread Lan Tianyu
port's power state: on - powered on off - powered off error - can't get power state For now, let userspace dictate the port power off policy. Future patches may add an in-kernel policy. Acked-by: Alan Stern st...@rowland.harvard.edu Signed-off-by: Lan Tianyu tianyu@intel.com Signed-off

Re: [PATCH 3/8] usb/acpi: Bind ACPI node to USB port, not usb_device.

2012-08-15 Thread Lan Tianyu
于 2012/8/15 21:32, Greg Kroah-Hartman 写道: On Wed, Aug 15, 2012 at 10:29:50AM +0800, Lan Tianyu wrote: On 2012年08月15日 08:28, Greg Kroah-Hartman wrote: On Tue, Jul 17, 2012 at 03:28:43PM -0700, Sarah Sharp wrote: --- a/drivers/usb/core/usb.h +++ b/drivers/usb/core/usb.h @@ -1,5 +1,9

Re: [PATCH 1/8] usb: make usb port a real device

2012-08-14 Thread Lan Tianyu
On 2012年08月15日 08:27, Greg Kroah-Hartman wrote: On Tue, Jul 17, 2012 at 03:28:42PM -0700, Sarah Sharp wrote: From: Lan Tianyu tianyu@intel.com This patch turns each USB port on a hub into a new struct device. This new device has the USB hub interface device as its parent. The port

Re: [PATCH 3/8] usb/acpi: Bind ACPI node to USB port, not usb_device.

2012-08-14 Thread Lan Tianyu
On 2012年08月15日 08:28, Greg Kroah-Hartman wrote: On Tue, Jul 17, 2012 at 03:28:43PM -0700, Sarah Sharp wrote: --- a/drivers/usb/core/usb.h +++ b/drivers/usb/core/usb.h @@ -1,5 +1,9 @@ #include linux/pm.h +#ifdef CONFIG_ACPI +#include linux/acpi.h +#endif Why is this #ifdef in here?

Prolem of setting DeviceRemovable according ACPI information

2012-08-13 Thread Lan, Tianyu
Hi all: I am trying to implement patch of setting DeviceRemovable according ACPI information. The DeviceRemovable is set in hcd driver *_hub_descriptor(e.g ehci_hub_descriptor()). But these functions just have struct usb_hcd or hcd specific struct(e.g struct xhci_hcd) and struct

Re: Port power off: ACPI _PLD and other ideas

2012-08-08 Thread Lan Tianyu
and Port is Connectable ACPI values in the new port directory. Yeah. I agree. Sarah Sharp On Fri, May 04, 2012 at 11:06:37AM +0800, Lan Tianyu wrote: From: Matthew Garrett m...@redhat.com Add a simple helper function to allow drivers to obtain the physical device location data. Signed-off

Re: Port power off: ACPI _PLD and other ideas

2012-08-08 Thread Lan Tianyu
On 2012/8/9 5:30, Moore, Robert wrote: I have a comment about the existing _PLD support in Linux. It uses bitfields, and these are known to not be reliable when using them to extract bits from a predefined bit-packed data structure. (different compilers implement bitfields differently, and

[PATCH V2 1/2] usb: Rename temp variable config to val in the set_avoid_reset_quirk()

2012-08-03 Thread Lan Tianyu
In USB, the word config already has aseparate meaning. So it will cause confusion if use config as variable's name for other purposes. This patch is to convert the config to val Acked-by: Alan Stern st...@rowland.harvard.edu Signed-off-by: Lan Tianyu tianyu@intel.com --- drivers/usb/core

[PATCH V2 2/2] usb: add decriptor of persist fail for some morph usb devices

2012-08-03 Thread Lan Tianyu
Some morph devices will morph after being reset and cause persist to fail. This patch is to add descriptor about this in the Document/usb/persist.txt Signed-off-by: Lan Tianyu tianyu@intel.com --- Documentation/usb/persist.txt |3 +++ 1 files changed, 3 insertions(+), 0 deletions

Re: [PATCH 2/3] usb: Take attribute avoid_reset_quirk out of usb device's attribute group

2012-08-02 Thread Lan Tianyu
A summary about what we should do now after such long discussion. If I lost something or miss something, please correct me. 1) Add auto option to each port's power policy sysfs attribute. When set to auto, those ports which have never been attached with devices will be power off immediately.

Re: [PATCH 2/3] usb: Take attribute avoid_reset_quirk out of usb device's attribute group

2012-08-01 Thread Lan Tianyu
On 2012/8/1 4:40, Bjørn Mork wrote: Sarah Sharp sarah.a.sh...@linux.intel.com writes: No. Some internal ports can be pluggable, like your card reader, or those ones behind an rfkill switch. But only internal ports can be unpluggable. I'm apparently not explaining the ACPI methods very well.

Re: [PATCH 3/3] usb: Change persist_enabled when attribute avoid_reset_quirk is modified

2012-08-01 Thread Lan Tianyu
On 2012/7/31 22:39, Alan Stern wrote: On Tue, 31 Jul 2012, Lan Tianyu wrote: How about checking RESET_MORPHS before doing reset_resume, set reset_resume to 0 and do resume when RESET_MORPHS is set. No, that won't work. When we do a reset-resume it is because we _know_ that a regular resume

Re: [PATCH 3/3] usb: Change persist_enabled when attribute avoid_reset_quirk is modified

2012-08-01 Thread Lan Tianyu
On 2012/8/1 22:48, Oliver Neukum wrote: On Wednesday 01 August 2012 22:46:51 Lan Tianyu wrote: No, that won't work. When we do a reset-resume it is because we know that a regular resume will fail. persist is default to be enabled. When user space set a device's avoid_reset_quirk, they also

Re: [PATCH 2/3] usb: Take attribute avoid_reset_quirk out of usb device's attribute group

2012-08-01 Thread Lan Tianyu
On 2012/8/1 1:02, Alan Stern wrote: On Tue, 31 Jul 2012, Oliver Neukum wrote: On Monday 30 July 2012 17:03:27 Alan Stern wrote: On Mon, 30 Jul 2012, Sarah Sharp wrote: I'm not even sure that RESET_MORPHS is the right thing to look at here. It's possible for a device to retain important

Re: [PATCH 2/3] usb: Take attribute avoid_reset_quirk out of usb device's attribute group

2012-07-31 Thread Lan Tianyu
On 2012年07月31日 04:00, Sarah Sharp wrote: On Mon, Jul 30, 2012 at 09:28:36AM +0200, Oliver Neukum wrote: On Monday 30 July 2012 11:34:10 Lan Tianyu wrote: The hub is always supposed to support reset and its persist is enabled. By default, not necessarily always. User space may disable

Re: [PATCH 3/3] usb: Change persist_enabled when attribute avoid_reset_quirk is modified

2012-07-30 Thread Lan Tianyu
On 2012年07月30日 15:24, Oliver Neukum wrote: On Monday 30 July 2012 11:34:11 Lan Tianyu wrote: --- a/drivers/usb/core/sysfs.c +++ b/drivers/usb/core/sysfs.c @@ -209,10 +209,13 @@ set_avoid_reset_quirk(struct device *dev, struct device_attribute *attr, if (sscanf(buf, %d,val) != 1 || val

Re: [PATCH 3/3] usb: Change persist_enabled when attribute avoid_reset_quirk is modified

2012-07-30 Thread Lan Tianyu
On 2012年07月30日 23:16, Alan Stern wrote: On Mon, 30 Jul 2012, Oliver Neukum wrote: On Monday 30 July 2012 10:39:50 Alan Stern wrote: this leads to behavior that is not easy to predict or understand. It would be cleaner to leave the flag alone and check for the quirk in addition for the flag

[PATCH 2/3] usb: Take attribute avoid_reset_quirk out of usb device's attribute group

2012-07-29 Thread Lan Tianyu
hub. Signed-off-by: Lan Tianyu tianyu@intel.com --- drivers/usb/core/sysfs.c | 30 +- 1 files changed, 29 insertions(+), 1 deletions(-) diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c index d6c49d9..20b0add 100644 --- a/drivers/usb/core/sysfs.c

Re: Discussion about implementation of usb port power off mechanism for port with device

2012-07-24 Thread Lan Tianyu
On 2012年07月23日 23:27, Alan Stern wrote: On Mon, 23 Jul 2012, Lan Tianyu wrote: @@ -3027,6 +3070,24 @@ int usb_port_resume(struct usb_device *u int status; u16 portchange, portstatus; + if (hub-ports[port1 - 1]-port_power_policy

[RFC PATCH] usb: Change persist_enabled when attribute avoid_reset_quirk is changed

2012-07-24 Thread Lan Tianyu
avoid_reset_quirk is changed. Signed-off-by: Lan Tianyu tianyu@intel.com --- drivers/usb/core/sysfs.c |7 +-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c index 682e825..12b4bf9 100644 --- a/drivers/usb/core/sysfs.c

Re: [RFC PATCH] usb: Change persist_enabled when attribute avoid_reset_quirk is changed

2012-07-24 Thread Lan Tianyu
于 2012/7/24 16:57, Oliver Neukum 写道: On Tuesday 24 July 2012 16:39:37 Lan Tianyu wrote: The quirk USB_QUIRK_RESET_MORPHS means the device can't be reset and reset-resume. So persist_enabled also should be set simultaneously Set? Why bother? If anything reset_resume() is hopeless, so why delay

Re: [RFC PATCH] usb: Change persist_enabled when attribute avoid_reset_quirk is changed

2012-07-24 Thread Lan Tianyu
于 2012/7/24 21:35, Oliver Neukum 写道: On Tuesday 24 July 2012 21:28:30 Lan Tianyu wrote: Current only in the usb_detect_quirks(), persist_enabled will be set to 0 depending on whether the dev's flag USB_QUIRK_RESET_MORPHS is set or not. And usb_detect_quirks() is only called

Re: [RFC PATCH] usb: Change persist_enabled when attribute avoid_reset_quirk is changed

2012-07-24 Thread Lan Tianyu
于 2012/7/24 22:59, Alan Stern 写道: Yes, good idea. When you do this, you should also add another little paragraph to Documentation/usb/persist.txt. At the end of the What is the solution? section, explain why the persist attribute cannot be set if the avoid_reset_quirk attribute is on. Hmmm,

Re: [RFC PATCH] USB: enable power/wakeup to control remote wakeup in the runtime suspend

2012-07-22 Thread Lan Tianyu
Sorry for later reply. :) On 2012年07月21日 01:08, Sarah Sharp wrote: On Thu, Jul 19, 2012 at 11:42:57AM +0200, Oliver Neukum wrote: On Thursday 19 July 2012 15:42:37 Lan Tianyu wrote: On 2012年07月19日 14:37, Oliver Neukum wrote: But this leaves me with a question. Has anybody ever measured

Re: [RFC PATCH] USB: enable power/wakeup to control remote wakeup in the runtime suspend

2012-07-19 Thread Lan Tianyu
On 2012年07月19日 14:37, Oliver Neukum wrote: On Wednesday 18 July 2012 15:07:14 Sarah Sharp wrote: On Wed, Jul 18, 2012 at 09:03:59PM +0200, Oliver Neukum wrote: No, now that I think about it an attribute for the drivers is necessary. Like drivers have supports_autosuspend they also should

Re: [RFC PATCH] USB: enable power/wakeup to control remote wakeup in the runtime suspend

2012-07-19 Thread Lan Tianyu
On 2012年07月19日 14:37, Oliver Neukum wrote: On Wednesday 18 July 2012 15:07:14 Sarah Sharp wrote: On Wed, Jul 18, 2012 at 09:03:59PM +0200, Oliver Neukum wrote: No, now that I think about it an attribute for the drivers is necessary. Like drivers have supports_autosuspend they also should

Re: [RFC PATCH] USB: enable power/wakeup to control remote wakeup in the runtime suspend

2012-07-19 Thread Lan Tianyu
Resend because sent to maillist failed. 2012/7/19 Oliver Neukum oneu...@suse.de On Thursday 19 July 2012 16:21:38 Lan Tianyu wrote: On 2012年07月19日 14:37, Oliver Neukum wrote: Unloading the driver is a user space issue. But you are right there is a missing case hi all: I have

Re: [RFC PATCH] USB: enable power/wakeup to control remote wakeup in the runtime suspend

2012-07-18 Thread Lan Tianyu
On 2012/7/18 12:43, Oliver Neukum wrote: On Tuesday 17 July 2012 14:52:51 Sarah Sharp wrote: 2. If an internal USB port is suspended with remote wakeup disabled, power off the port. Add code to the USB core to ignore the device disconnect in this special case, so the driver thinks the device

Re: [RFC PATCH] USB: enable power/wakeup to control remote wakeup in the runtime suspend

2012-07-18 Thread Lan Tianyu
On 2012/7/18 22:19, Alan Stern wrote: An alternative to her suggestion would be to disconnect the device when the port goes off. When the port is powered back on, the device will be rediscovered and probed again. hi alan: Reprobe may cause the devnum change. Userspace will treat it a

Re: [RFC PATCH] USB: enable power/wakeup to control remote wakeup in the runtime suspend

2012-07-17 Thread Lan Tianyu
On 2012/7/17 21:48, Oliver Neukum wrote: On Tuesday 17 July 2012 21:35:00 Lan Tianyu wrote: On 2012/7/16 22:13, Alan Stern wrote: On Mon, 16 Jul 2012, Lan Tianyu wrote: Currently, power/wakeup sysfs file can't control remote wakeup in the runtime suspend. It only depends on usb_interface

[RFC PATCH] USB: enable power/wakeup to control remote wakeup in the runtime suspend

2012-07-16 Thread Lan Tianyu
wakeup in the runtime suspend. Signed-off-by: Lan Tianyu tianyu@intel.com --- drivers/usb/core/driver.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index 6978101..e79b95e 100644 --- a/drivers/usb/core/driver.c

[PATCH V8 6/8] USB/ACPI: Add usb port's acpi power control in the xhci PORT_POWER feature request process.

2012-07-08 Thread Lan Tianyu
. Signed-off-by: Lan Tianyu tianyu@intel.com --- drivers/usb/core/usb-acpi.c | 62 +++ drivers/usb/host/xhci-hub.c | 12 include/linux/usb.h | 10 +++ 3 files changed, 84 insertions(+), 0 deletions(-) diff --git a/drivers/usb/core

[PATCH V8 7/8] usb: return error when fail to get usb device descriptor in the usb_get_configuration()

2012-07-08 Thread Lan Tianyu
Change since v6: Add judgement basis result != -EPIPE of return error. Since usb port may power off, usb device descriptor can't be get at that time and usb_get_configuration() should return error. Acked-by: Alan Stern st...@rowland.harvard.edu Signed-off-by: Lan Tianyu tianyu@intel.com

Re: [PATCH V7 2/9] usb: make usb port a real device

2012-07-07 Thread Lan Tianyu
On 2012/7/7 2:12, Greg KH wrote: On Fri, Jul 06, 2012 at 02:13:53PM +0800, Lan Tianyu wrote: Change since v4: remove struct usb_port-udev member since it is not used. This patch is to make usb port a real device under usb hub interface. Move port_owner to struct usb_port. As this adds sysfs

Re: [PATCH V7 9/9] usb : Add usb port's power control attributes

2012-07-07 Thread Lan Tianyu
On 2012/7/7 2:14, Greg KH wrote: On Fri, Jul 06, 2012 at 02:14:00PM +0800, Lan Tianyu wrote: Change since v5: Add usb_autopm_get/put_interface() around the port power operations in the control attribute's callback to deal with situation that control attribute is changed when the usb hub

<    1   2   3