Re: [PATCH 04/13] USB/IP: kernel module for userspace URBs transmission
On Fri, Apr 03, 2015 at 09:33:32AM +0900, Nobuo Iwata wrote: > Originally, USB/IP transmits requests and response PDUs for preparation to > transfer URBs in user space, after the preparation, URBs are transmitted in > kernel space. > > To make easy to introduce application network protocols like SSL, WebSocket > and so on, the driver, usbip_ux.ko, forwards URBs to USB/IP user space > utilities. It's just like fuse driver for user space file system. You do this on all of your patches, please wrap your changelog lines at 72 columns so they show up correctly in the log. > Then, utilities transfer URBs in user space. > > To do so, usbip_trx_ops makes send/receive functions pluggable. > kernel_sendmsg() and kernel_recvmsg() for kernel mode transfer can be > substituted by read/write methods to user space utilities. > > In the absence of usbip_ux.ko, original kernel space transferring is valid. > usbip_ux.ko replaces usbip_trx_ops in its init routine. > > A) Original - kernel space URBs transfer > > User+---+ 1) import/export+---+ > space |uspipd,|<->|usbip, | > |usbip | |usbipa | > +---+---+ +---+---+ > | | > 2)Set sockfd| |2)Set sockfd > thru sysfs| | thru sysfs > V V > Kernel +---+4)URBs +---+ > space |usbip |<->|vhci | > |host.ko| |hcd.ko | > +---+ +---+ > 3)link to kernel trx_ops3)link to kernel trx_ops > > B) New - user space URBs transfer > > User+---+1)import/export+---+ > space |uspipd,|<->|usbip, | > +---|usbip |<->|usbipa |---+ > 2)Set sockfd|+--+---+6)URBs +---+--+|2)Set sockfd > thru ioctl|| ^ ^ || thru ioctl > (right) || |5)read/write 5)read/write| || (left) > 3)Set sockfd|| +---+ +--+ ||3)Set Sockfd > thru sysfs|+---+ | /dev/usbip-ux | +---+| thru sysfs > (left)VV V V VV (right) > Kernel +---+ +---+ +---+ +---+ > space |usbip |<->|usbip | |usbip |<->|vhci | > |host.ko|5)send |ux.ko | |ux.ko |5)send |hcd.ko | > +---+ recv +---+ +---+ recv +---+ > 4)link to user trx_ops 4)link to user trx_ops This is really interesting, but how does this tie into usbfs where you can send and receive USB urbs today from userspace to USB devices? Why do you need another user/kernel interface here? And there have been previous patches to add openssl support for usbip, but do so in a much different way from this patch set. Is that the primary reason you did this work, or do you have some other goal / requirement with usbip that caused you to create this design? thanks, greg k-h -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[GIT PULL] USB-serial updates for v4.1-rc1
Hi Greg, I now it's getting late, but please consider pulling the following updates for 4.1. All have been in linux-next for a while just fine. Thanks, Johan The following changes since commit c517d838eb7d07bbe9507871fab3931deccff539: Linux 4.0-rc1 (2015-02-22 18:21:14 -0800) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial.git tags/usb-serial-4.1-rc1 for you to fetch changes up to 65dd82ae453f5290be0ea83ed0f23163ea49c0eb: USB: f81232: fix some minor style issues (2015-03-27 17:36:29 +0100) USB-serial updates for v4.1-rc1 Fix up the f81232 driver, which up to this point has mostly been a placeholder without a proper implementation. Included is also a minor clean up of ch341. Signed-off-by: Johan Hovold Johan Hovold (2): USB: ch341: remove redundant close from open error path USB: f81232: fix some minor style issues Peter Hung (10): USB: f81232: rename private struct member name USB: f81232: implement RX bulk-in EP USB: f81232: change lock mechanism USB: f81232: implement read IIR/MSR with endpoint USB: f81232: implement MCR/MSR function USB: f81232: implement port enable/disable method USB: f81232: implement set_termios() USB: f81232: clarify f81232_ioctl() and fix USB: f81232: cleanup non-used define USB: f81232: modify/add author drivers/usb/serial/ch341.c | 1 - drivers/usb/serial/f81232.c | 558 2 files changed, 459 insertions(+), 100 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Unable to access USB mass storage device with xhci. okay with ehci
Alan or Mathias, Machine is a 64 bit Dell Inspiron with Intel chips running Fedora 3.19.3 kernel Disabling the uas driver is no help. Any help is appreciated. Steve lspci -v 00:14.0 USB controller: Intel Corporation 8 Series/C220 Series Chipset Family USB xHCI (rev 05) (prog-if 30 [XHCI]) Subsystem: Dell Device 0622 Flags: bus master, medium devsel, latency 0, IRQ 30 Memory at f7e0 (64-bit, non-prefetchable) [size=64K] Capabilities: [70] Power Management version 2 Capabilities: [80] MSI: Enable+ Count=1/8 Maskable- 64bit+ Kernel driver in use: xhci_hcd lsusb -v Bus 002 Device 002: ID 174c:55aa ASMedia Technology Inc. ASM1051 SATA 3Gb/s bridge Device Descriptor: bLength18 bDescriptorType 1 bcdUSB 3.00 bDeviceClass0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 9 idVendor 0x174c ASMedia Technology Inc. idProduct 0x55aa ASM1051 SATA 3Gb/s bridge bcdDevice1.00 iManufacturer 2 Plugable iProduct3 USB3-SATA-UASP1 iSerial 1 123456789014 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 121 bNumInterfaces 1 bConfigurationValue 1 iConfiguration 0 bmAttributes 0xc0 Self Powered MaxPower 36mA Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber0 bAlternateSetting 0 bNumEndpoints 2 bInterfaceClass 8 Mass Storage bInterfaceSubClass 6 SCSI bInterfaceProtocol 80 Bulk-Only iInterface 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes2 Transfer TypeBulk Synch Type None Usage Type Data wMaxPacketSize 0x0400 1x 1024 bytes bInterval 0 bMaxBurst 15 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x02 EP 2 OUT bmAttributes2 Transfer TypeBulk Synch Type None Usage Type Data wMaxPacketSize 0x0400 1x 1024 bytes bInterval 0 bMaxBurst 15 Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber0 bAlternateSetting 1 bNumEndpoints 4 bInterfaceClass 8 Mass Storage bInterfaceSubClass 6 SCSI bInterfaceProtocol 98 iInterface 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes2 Transfer TypeBulk Synch Type None Usage Type Data wMaxPacketSize 0x0400 1x 1024 bytes bInterval 0 bMaxBurst 15 MaxStreams 16 Data-in pipe (0x03) Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x02 EP 2 OUT bmAttributes2 Transfer TypeBulk Synch Type None Usage Type Data wMaxPacketSize 0x0400 1x 1024 bytes bInterval 0 bMaxBurst 15 MaxStreams 16 Data-out pipe (0x04) Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x83 EP 3 IN bmAttributes2 Transfer TypeBulk Synch Type None Usage Type Data wMaxPacketSize 0x0400 1x 1024 bytes bInterval 0 bMaxBurst 15 MaxStreams 16 Status pipe (0x02) Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x04 EP 4 OUT bmAttributes2 Transfer TypeBulk Synch Type None Usage Type Data wMaxPacketSize 0x0400 1x 1024 bytes bInterval 0 bMaxBurst 0 Command pipe (0x01) Binary Object Store Descriptor: bLength 5 bDescriptorType15 wTotalLength 22
[PATCH v2 7/7] USB / PM: Allow USB devices to remain runtime-suspended when sleeping
Have dev_pm_ops.prepare return 1 for USB devices, interfaces, endpoints and ports so that USB devices can remain runtime-suspended when the system goes to a sleep state, if their wakeup state is correct. Also enable runtime PM for endpoints, which is another requirement for the above to work. Signed-off-by: Tomeu Vizoso --- drivers/usb/core/endpoint.c | 17 + drivers/usb/core/message.c | 16 drivers/usb/core/port.c | 6 ++ drivers/usb/core/usb.c | 8 +++- 4 files changed, 46 insertions(+), 1 deletion(-) diff --git a/drivers/usb/core/endpoint.c b/drivers/usb/core/endpoint.c index 39a2402..7c82bb7 100644 --- a/drivers/usb/core/endpoint.c +++ b/drivers/usb/core/endpoint.c @@ -160,6 +160,19 @@ static const struct attribute_group *ep_dev_groups[] = { NULL }; +#ifdef CONFIG_PM + +static int usb_ep_device_prepare(struct device *dev) +{ + return 1; +} + +static const struct dev_pm_ops usb_ep_device_pm_ops = { + .prepare = usb_ep_device_prepare, +}; + +#endif /* CONFIG_PM */ + static void ep_device_release(struct device *dev) { struct ep_device *ep_dev = to_ep_device(dev); @@ -170,6 +183,9 @@ static void ep_device_release(struct device *dev) struct device_type usb_ep_device_type = { .name = "usb_endpoint", .release = ep_device_release, +#ifdef CONFIG_PM + .pm = &usb_ep_device_pm_ops, +#endif }; int usb_create_ep_devs(struct device *parent, @@ -197,6 +213,7 @@ int usb_create_ep_devs(struct device *parent, goto error_register; device_enable_async_suspend(&ep_dev->dev); + pm_runtime_enable(&ep_dev->dev); endpoint->ep_dev = ep_dev; return retval; diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index f368d20..9041aee 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c @@ -1589,10 +1589,26 @@ static int usb_if_uevent(struct device *dev, struct kobj_uevent_env *env) return 0; } +#ifdef CONFIG_PM + +static int usb_if_prepare(struct device *dev) +{ + return 1; +} + +static const struct dev_pm_ops usb_if_pm_ops = { + .prepare = usb_if_prepare, +}; + +#endif /* CONFIG_PM */ + struct device_type usb_if_device_type = { .name = "usb_interface", .release = usb_release_interface, .uevent = usb_if_uevent, +#ifdef CONFIG_PM + .pm = &usb_if_pm_ops, +#endif }; static struct usb_interface_assoc_descriptor *find_iad(struct usb_device *dev, diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c index 2106183..f49707d 100644 --- a/drivers/usb/core/port.c +++ b/drivers/usb/core/port.c @@ -168,12 +168,18 @@ static int usb_port_runtime_suspend(struct device *dev) return retval; } + +static int usb_port_prepare(struct device *dev) +{ + return 1; +} #endif static const struct dev_pm_ops usb_port_pm_ops = { #ifdef CONFIG_PM .runtime_suspend = usb_port_runtime_suspend, .runtime_resume = usb_port_runtime_resume, + .prepare = usb_port_prepare, #endif }; diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index 8d5b2f4..3a55c91 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c @@ -316,7 +316,13 @@ static int usb_dev_uevent(struct device *dev, struct kobj_uevent_env *env) static int usb_dev_prepare(struct device *dev) { - return 0; /* Implement eventually? */ + struct usb_device *udev = to_usb_device(dev); + + /* Return 0 if the current wakeup setting is wrong, otherwise 1 */ + if (udev->do_remote_wakeup != device_may_wakeup(dev)) + return 0; + + return 1; } static void usb_dev_complete(struct device *dev) -- 2.3.4 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 0/7] Allow UVC devices to remain runtime-suspended when sleeping
v2: * Let creators of the input device to decide whether it should remain runtime suspended when the system goes into a sleep state * Don't enable PM runtime on all evdev handlers * Cope with another wrong wakeup setting in usb_dev_prepare Hi, this series contain what I needed to do in order to have my USB webcam to not be resumed when the system resumes, reducing considerably the total time that resuming takes. It makes use of the facility that Rafael Wysocki added in aae4518b3 ("PM / sleep: Mechanism to avoid resuming runtime-suspended devices unnecessarily"), which requires that a device and all its descendants opt-in by having their dev_pm_ops.prepare callback return 1, to have runtime PM enabled, and to be runtime suspended when the system goes to a sleep state. Thanks, Tomeu Tomeu Vizoso (7): Input: Implement dev_pm_ops.prepare in input_class Input: Add input_dev.stay_runtime_suspended flag [media] uvcvideo: Set input_dev.stay_runtime_suspended flag [media] uvcvideo: Enable runtime PM of descendant devices [media] v4l2-core: Implement dev_pm_ops.prepare() [media] media-devnode: Implement dev_pm_ops.prepare callback USB / PM: Allow USB devices to remain runtime-suspended when sleeping drivers/input/input.c | 20 drivers/media/media-devnode.c | 10 ++ drivers/media/usb/uvc/uvc_driver.c | 11 +++ drivers/media/usb/uvc/uvc_status.c | 1 + drivers/media/v4l2-core/v4l2-dev.c | 10 ++ drivers/usb/core/endpoint.c| 17 + drivers/usb/core/message.c | 16 drivers/usb/core/port.c| 6 ++ drivers/usb/core/usb.c | 8 +++- include/linux/input.h | 4 10 files changed, 102 insertions(+), 1 deletion(-) -- 2.3.4 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 6/6] USB / PM: Allow USB devices to remain runtime-suspended when sleeping
On 31 March 2015 at 19:09, Alan Stern wrote: > On Tue, 31 Mar 2015, Tomeu Vizoso wrote: > >> Have dev_pm_ops.prepare return 1 for USB devices, interfaces, endpoints >> and ports so that USB devices can remain runtime-suspended when the >> system goes to a sleep state. >> >> Also enable runtime PM for endpoints, which is another requirement for >> the above to work. >> >> Signed-off-by: Tomeu Vizoso > > ... > >> diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c >> index b1fb9ae..1498faa 100644 >> --- a/drivers/usb/core/usb.c >> +++ b/drivers/usb/core/usb.c >> @@ -300,7 +300,7 @@ static int usb_dev_uevent(struct device *dev, struct >> kobj_uevent_env *env) >> >> static int usb_dev_prepare(struct device *dev) >> { >> - return 0; /* Implement eventually? */ >> + return 1; /* Implement eventually? */ >> } > > The rest of the patch is okay, but this part is wrong. The documented > requirement is that the prepare callback should return 1 if the device > is already in the appropriate state. This means it has to have the > right wakeup setting. > > In other words, if the device is currently in runtime suspend with > remote wakeup enabled, but device_may_wakeup() returns 0 (so that the > device should be disabled for wakeup when the system goes into > suspend), then the prepare callback has to return 0. > > Therefore what you need to do here is something like this: > > struct usb_device *udev = to_usb_device(dev); > > /* Return 0 if the current wakeup setting is wrong, otherwise 1 */ > if (udev->do_remote_wakeup && !device_may_wakeup(dev)) > return 0; > return 1; Thanks, in v2 I have also covered the other case, as suggested by Oliver. > Aside from this issue, I like the patch set. Do you think you can do > something similar for drivers/scsi/scsi_pm.c? I'm not aware of any > wakeup-capable SCSI devices -- not disk or CD/DVD drives, anyway. I think I will be able to allocate some time on monday to look at this. Thanks, Tomeu > Alan Stern > > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] uwb: Remove umc bus legacy suspend/resume support
On Sun, Mar 15, 2015 at 06:03:00PM +0100, Lars-Peter Clausen wrote: > There are currently no umc drivers implementing suspend/resume, so remove > the legacy suspend/resume support from the framework. If a umc driver ever > wants to implement suspend/resume they can use dev_pm_ops, which works out > of the box without any additional support necessary from the bus itself. > > Signed-off-by: Lars-Peter Clausen > --- > drivers/uwb/umc-bus.c | 34 -- > include/linux/uwb/umc.h | 2 -- > 2 files changed, 36 deletions(-) This patch is already in my tree :( -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] Revert "usb: host/sl811-hcd: fix sparse warning"
On Thu, Apr 02, 2015 at 04:45:40PM +0530, Sudip Mukherjee wrote: > This reverts commit <1dc6120ef7f003305d99ef12f598a6b05eacc38c>. > > if we are doing allyesconfig on x86_64, build fails with error: > drivers/built-in.o: In function `sl811_cs_probe': > sl811_cs.c:(.text+0x1d4612e): undefined reference to `sl811h_driver' > > this commit has declared sl811h_driver as static but it was being > accessed from sl811_cs.c. > > Signed-off-by: Sudip Mukherjee > --- > drivers/usb/host/sl811-hcd.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Someone else sent this patch in a few days before you did, sorry. greg k-h -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] uwb: Remove umc bus legacy suspend/resume support
On 04/03/2015 03:44 PM, Greg Kroah-Hartman wrote: On Sun, Mar 15, 2015 at 06:03:00PM +0100, Lars-Peter Clausen wrote: There are currently no umc drivers implementing suspend/resume, so remove the legacy suspend/resume support from the framework. If a umc driver ever wants to implement suspend/resume they can use dev_pm_ops, which works out of the box without any additional support necessary from the bus itself. Signed-off-by: Lars-Peter Clausen --- drivers/uwb/umc-bus.c | 34 -- include/linux/uwb/umc.h | 2 -- 2 files changed, 36 deletions(-) This patch is already in my tree :( Yea, you applied it two weeks ago :) -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Unable to access USB mass storage device with xhci. okay with ehci
On Fri, 3 Apr 2015, Steve Bangert wrote: > Alan or Mathias, > > Machine is a 64 bit Dell Inspiron with Intel chips running Fedora 3.19.3 > kernel > > Disabling the uas driver is no help. Any help is appreciated. Can you post a usbmon trace with uas disabled? And a similar usbmon trace using EHCI? Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/1] usb: musb: dsps: fix build on i386 when COMPILE_TEST is set
Hi Greg, On Wed, Mar 25, 2015 at 02:18:37PM -0700, Tony Lindgren wrote: > Commit 3e457371f436 ("usb: musb: Fix fifo reads for dm816x with musb_dsps") > fixed a USB error on dm816x, but introduced a new build error on i386 > when COMPILE_TEST is set: > > drivers/usb/musb/musb_dsps.c: In function ‘dsps_read_fifo32’: > drivers/usb/musb/musb_dsps.c:624:3: error: implicit declaration of function > ‘readsl’ [-Werror=implicit-function-declaration] > readsl(fifo, dst, len >> 2); > > Let's fix this by using ioread32_rep() instead of readsl() as that's > more portable. > > Fixes: 3e457371f436 ("usb: musb: Fix fifo reads for dm816x with musb_dsps") > Reported-by: Fengguang Wu > Cc: Bin Liu > Cc: Brian Hutchinson > Cc: Sergei Shtylyov > Signed-off-by: Tony Lindgren Can you apply this one directly ? It fixes a build error on i386. Signed-off-by: Felipe Balbi > --- > drivers/usb/musb/musb_dsps.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c > index 2c0750e..8e089c1 100644 > --- a/drivers/usb/musb/musb_dsps.c > +++ b/drivers/usb/musb/musb_dsps.c > @@ -661,7 +661,7 @@ static void dsps_read_fifo32(struct musb_hw_ep *hw_ep, > u16 len, u8 *dst) > void __iomem *fifo = hw_ep->fifo; > > if (len >= 4) { > - readsl(fifo, dst, len >> 2); > + ioread32_rep(fifo, dst, len >> 2); > dst += len & ~0x03; > len &= 0x03; > } > -- > 2.1.4 > -- balbi signature.asc Description: Digital signature
Re: [GIT PULL] USB-serial updates for v4.1-rc1
On Fri, Apr 03, 2015 at 10:56:08AM +0200, Johan Hovold wrote: > Hi Greg, > > I now it's getting late, but please consider pulling the following > updates for 4.1. > > All have been in linux-next for a while just fine. > > Thanks, > Johan > > > The following changes since commit c517d838eb7d07bbe9507871fab3931deccff539: > > Linux 4.0-rc1 (2015-02-22 18:21:14 -0800) > > are available in the git repository at: > > git://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial.git > tags/usb-serial-4.1-rc1 Pulled and pushed out, thanks. greg k-h -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/1] usb: musb: dsps: fix build on i386 when COMPILE_TEST is set
On Fri, Apr 03, 2015 at 10:14:14AM -0500, Felipe Balbi wrote: > Hi Greg, > > On Wed, Mar 25, 2015 at 02:18:37PM -0700, Tony Lindgren wrote: > > Commit 3e457371f436 ("usb: musb: Fix fifo reads for dm816x with musb_dsps") > > fixed a USB error on dm816x, but introduced a new build error on i386 > > when COMPILE_TEST is set: > > > > drivers/usb/musb/musb_dsps.c: In function ‘dsps_read_fifo32’: > > drivers/usb/musb/musb_dsps.c:624:3: error: implicit declaration of function > > ‘readsl’ [-Werror=implicit-function-declaration] > > readsl(fifo, dst, len >> 2); > > > > Let's fix this by using ioread32_rep() instead of readsl() as that's > > more portable. > > > > Fixes: 3e457371f436 ("usb: musb: Fix fifo reads for dm816x with musb_dsps") > > Reported-by: Fengguang Wu > > Cc: Bin Liu > > Cc: Brian Hutchinson > > Cc: Sergei Shtylyov > > Signed-off-by: Tony Lindgren > > Can you apply this one directly ? It fixes a build error on i386. > > Signed-off-by: Felipe Balbi Now queued up, thanks. greg k-h -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 7/7] USB / PM: Allow USB devices to remain runtime-suspended when sleeping
Hi Tomeu, On Fri, Apr 03, 2015 at 02:57:56PM +0200, Tomeu Vizoso wrote: > Have dev_pm_ops.prepare return 1 for USB devices, interfaces, endpoints > and ports so that USB devices can remain runtime-suspended when the > system goes to a sleep state, if their wakeup state is correct. > > Also enable runtime PM for endpoints, which is another requirement for > the above to work. After patching I think the 4th unrelated subsystem with stubs for prepare() I think it is pretty clear that this approach is not the right one. If your driver does not care about any children hanging off it there is dev->ignore_children flag that either already does what you want, or maybe needs adjusted to support your use case. Thanks. > > Signed-off-by: Tomeu Vizoso > --- > drivers/usb/core/endpoint.c | 17 + > drivers/usb/core/message.c | 16 > drivers/usb/core/port.c | 6 ++ > drivers/usb/core/usb.c | 8 +++- > 4 files changed, 46 insertions(+), 1 deletion(-) > > diff --git a/drivers/usb/core/endpoint.c b/drivers/usb/core/endpoint.c > index 39a2402..7c82bb7 100644 > --- a/drivers/usb/core/endpoint.c > +++ b/drivers/usb/core/endpoint.c > @@ -160,6 +160,19 @@ static const struct attribute_group *ep_dev_groups[] = { > NULL > }; > > +#ifdef CONFIG_PM > + > +static int usb_ep_device_prepare(struct device *dev) > +{ > + return 1; > +} > + > +static const struct dev_pm_ops usb_ep_device_pm_ops = { > + .prepare = usb_ep_device_prepare, > +}; > + > +#endif /* CONFIG_PM */ > + > static void ep_device_release(struct device *dev) > { > struct ep_device *ep_dev = to_ep_device(dev); > @@ -170,6 +183,9 @@ static void ep_device_release(struct device *dev) > struct device_type usb_ep_device_type = { > .name = "usb_endpoint", > .release = ep_device_release, > +#ifdef CONFIG_PM > + .pm = &usb_ep_device_pm_ops, > +#endif > }; > > int usb_create_ep_devs(struct device *parent, > @@ -197,6 +213,7 @@ int usb_create_ep_devs(struct device *parent, > goto error_register; > > device_enable_async_suspend(&ep_dev->dev); > + pm_runtime_enable(&ep_dev->dev); > endpoint->ep_dev = ep_dev; > return retval; > > diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c > index f368d20..9041aee 100644 > --- a/drivers/usb/core/message.c > +++ b/drivers/usb/core/message.c > @@ -1589,10 +1589,26 @@ static int usb_if_uevent(struct device *dev, struct > kobj_uevent_env *env) > return 0; > } > > +#ifdef CONFIG_PM > + > +static int usb_if_prepare(struct device *dev) > +{ > + return 1; > +} > + > +static const struct dev_pm_ops usb_if_pm_ops = { > + .prepare = usb_if_prepare, > +}; > + > +#endif /* CONFIG_PM */ > + > struct device_type usb_if_device_type = { > .name = "usb_interface", > .release = usb_release_interface, > .uevent = usb_if_uevent, > +#ifdef CONFIG_PM > + .pm = &usb_if_pm_ops, > +#endif > }; > > static struct usb_interface_assoc_descriptor *find_iad(struct usb_device > *dev, > diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c > index 2106183..f49707d 100644 > --- a/drivers/usb/core/port.c > +++ b/drivers/usb/core/port.c > @@ -168,12 +168,18 @@ static int usb_port_runtime_suspend(struct device *dev) > > return retval; > } > + > +static int usb_port_prepare(struct device *dev) > +{ > + return 1; > +} > #endif > > static const struct dev_pm_ops usb_port_pm_ops = { > #ifdef CONFIG_PM > .runtime_suspend = usb_port_runtime_suspend, > .runtime_resume = usb_port_runtime_resume, > + .prepare = usb_port_prepare, > #endif > }; > > diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c > index 8d5b2f4..3a55c91 100644 > --- a/drivers/usb/core/usb.c > +++ b/drivers/usb/core/usb.c > @@ -316,7 +316,13 @@ static int usb_dev_uevent(struct device *dev, struct > kobj_uevent_env *env) > > static int usb_dev_prepare(struct device *dev) > { > - return 0; /* Implement eventually? */ > + struct usb_device *udev = to_usb_device(dev); > + > + /* Return 0 if the current wakeup setting is wrong, otherwise 1 */ > + if (udev->do_remote_wakeup != device_may_wakeup(dev)) > + return 0; > + > + return 1; > } > > static void usb_dev_complete(struct device *dev) > -- > 2.3.4 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-usb" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- Dmitry -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 7/7] USB / PM: Allow USB devices to remain runtime-suspended when sleeping
On Friday, April 03, 2015 01:44:36 PM Dmitry Torokhov wrote: > Hi Tomeu, > > On Fri, Apr 03, 2015 at 02:57:56PM +0200, Tomeu Vizoso wrote: > > Have dev_pm_ops.prepare return 1 for USB devices, interfaces, endpoints > > and ports so that USB devices can remain runtime-suspended when the > > system goes to a sleep state, if their wakeup state is correct. > > > > Also enable runtime PM for endpoints, which is another requirement for > > the above to work. > > After patching I think the 4th unrelated subsystem with stubs for > prepare() I think it is pretty clear that this approach is not the right > one. > > If your driver does not care about any children hanging off it there is > dev->ignore_children flag that either already does what you want, or > maybe needs adjusted to support your use case. I wouldn't overload ignore_children with that meaning. That said adding a "return 1 from device_prepare() if this is set" flag might be a good idea. -- I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center. -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] usb: musb: Kconfig: Depend on some machines under blackfin
Under blackfin, only bf527, bf548 and bf609 may use musb. The related error with allmodconfig: CC [M] drivers/usb/misc/trancevibrator.o In file included from drivers/usb/musb/musb_core.h:70:0, from drivers/usb/musb/musb_core.c:103: drivers/usb/musb/musb_core.c: In function 'musb_indexed_ep_select': drivers/usb/musb/musb_regs.h:458:32: error: 'USB_INDEX' undeclared (first use in this function) #define MUSB_INDEX USB_OFFSET(USB_INDEX) /* 8 bit */ ^ Signed-off-by: Chen Gang --- drivers/usb/musb/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig index 39db8b6..5fca898 100644 --- a/drivers/usb/musb/Kconfig +++ b/drivers/usb/musb/Kconfig @@ -6,7 +6,7 @@ # (M)HDRC = (Multipoint) Highspeed Dual-Role Controller config USB_MUSB_HDRC tristate 'Inventra Highspeed Dual Role Controller (TI, ADI, ...)' - depends on (USB || USB_GADGET) + depends on (USB || USB_GADGET) && (!BLACKFIN || (BLACKFIN && (BF527 || BF548 || BF609))) help Say Y here if your system has a dual role high speed USB controller based on the Mentor Graphics silicon IP. Then -- 1.9.3 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] usb: musb: Kconfig: Depend on some machines under blackfin
On Fri, Apr 3, 2015 at 11:51 PM, Chen Gang wrote: > Under blackfin, only bf527, bf548 and bf609 may use musb. The related > error with allmodconfig: > > CC [M] drivers/usb/misc/trancevibrator.o > In file included from drivers/usb/musb/musb_core.h:70:0, >from drivers/usb/musb/musb_core.c:103: > drivers/usb/musb/musb_core.c: In function 'musb_indexed_ep_select': > drivers/usb/musb/musb_regs.h:458:32: error: 'USB_INDEX' undeclared (first > use in this function) >#define MUSB_INDEX USB_OFFSET(USB_INDEX) /* 8 bit */ > ^ > > Signed-off-by: Chen Gang > --- > drivers/usb/musb/Kconfig | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig > index 39db8b6..5fca898 100644 > --- a/drivers/usb/musb/Kconfig > +++ b/drivers/usb/musb/Kconfig > @@ -6,7 +6,7 @@ > # (M)HDRC = (Multipoint) Highspeed Dual-Role Controller > config USB_MUSB_HDRC > tristate 'Inventra Highspeed Dual Role Controller (TI, ADI, ...)' > - depends on (USB || USB_GADGET) > + depends on (USB || USB_GADGET) && (!BLACKFIN || (BLACKFIN && (BF527 > || BF548 || BF609))) This is ugly. Can't you add a new Kconfig symbol in arch/blackfin and change the #ifndef CONFIG_BLACKFIN in drivers/usb/musb/musb_regs.h to it? -- Thanks, //richard -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] usb: musb: Kconfig: Depend on some machines under blackfin
On 4/4/15 06:03, Richard Weinberger wrote: > On Fri, Apr 3, 2015 at 11:51 PM, Chen Gang > wrote: >> Under blackfin, only bf527, bf548 and bf609 may use musb. The related >> error with allmodconfig: >> >> CC [M] drivers/usb/misc/trancevibrator.o >> In file included from drivers/usb/musb/musb_core.h:70:0, >>from drivers/usb/musb/musb_core.c:103: >> drivers/usb/musb/musb_core.c: In function 'musb_indexed_ep_select': >> drivers/usb/musb/musb_regs.h:458:32: error: 'USB_INDEX' undeclared (first >> use in this function) >>#define MUSB_INDEX USB_OFFSET(USB_INDEX) /* 8 bit */ >> ^ >> >> Signed-off-by: Chen Gang >> --- >> drivers/usb/musb/Kconfig | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig >> index 39db8b6..5fca898 100644 >> --- a/drivers/usb/musb/Kconfig >> +++ b/drivers/usb/musb/Kconfig >> @@ -6,7 +6,7 @@ >> # (M)HDRC = (Multipoint) Highspeed Dual-Role Controller >> config USB_MUSB_HDRC >> tristate 'Inventra Highspeed Dual Role Controller (TI, ADI, ...)' >> - depends on (USB || USB_GADGET) >> + depends on (USB || USB_GADGET) && (!BLACKFIN || (BLACKFIN && (BF527 >> || BF548 || BF609))) > > This is ugly. > Can't you add a new Kconfig symbol in arch/blackfin and change the > #ifndef CONFIG_BLACKFIN > in drivers/usb/musb/musb_regs.h to it? > For me, for configuration, we need to try to finish them in Kconfig and keep the .c or .h source code no touch. But it is really not quite well to let machine details (e.g. BF527, BF548, BF609) in the outside of "arch/blackfin". So, I guess, we need to add new config value HAVE_MUSB for it in patch v2. Thanks. -- Chen Gang Open, share, and attitude like air, water, and life which God blessed -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html