mbox series

[v3,0/5] usb: gadget: uvc: improve uvc gadget performance

Message ID 20210628155311.16762-1-m.grzeschik@pengutronix.de
Headers show
Series usb: gadget: uvc: improve uvc gadget performance | expand

Message

Michael Grzeschik June 28, 2021, 3:53 p.m. UTC
This series improves the performance of the uvc video gadget by adding a
zero copy routine using the scatter list interface of the gadget. The
series also increases the amount of allocated requests depending of the
speed and it also reduces the interrupt load by only trigger on every
16th request in case of super-speed.

Michael Grzeschik (5):
  usb: dwc3: gadget: set gadgets parent to the right controller
  usb: gadget: uvc: make uvc_num_requests depend on gadget speed
  usb: gadget: uvc: set v4l2_dev->dev in f_uvc
  usb: gadget: uvc: add scatter gather support
  usb: gadget: uvc: decrease the interrupt load to a quarter

 drivers/usb/dwc3/gadget.c               |   2 +-
 drivers/usb/gadget/Kconfig              |   1 +
 drivers/usb/gadget/function/f_uvc.c     |   1 +
 drivers/usb/gadget/function/uvc.h       |  15 ++-
 drivers/usb/gadget/function/uvc_queue.c |  28 ++++-
 drivers/usb/gadget/function/uvc_queue.h |   7 +-
 drivers/usb/gadget/function/uvc_video.c | 155 +++++++++++++++++++-----
 drivers/usb/gadget/function/uvc_video.h |   2 +
 drivers/usb/gadget/legacy/Kconfig       |   1 +
 9 files changed, 176 insertions(+), 36 deletions(-)

Comments

Greg KH July 21, 2021, 8:01 a.m. UTC | #1
On Mon, Jun 28, 2021 at 05:53:07PM +0200, Michael Grzeschik wrote:
> In case of dwc3 it is possible that the sysdev is the parent of the

> controller. To ensure the right dev is set to the gadget's dev parent we

> will hand over sysdev instead of dev, which will always point to the

> controller.

> 

> Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>

> 

> ---

>    -> v2: first version of patch

>    -> v3: -

> ---

>  drivers/usb/dwc3/gadget.c | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

> 

> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c

> index af6d7f157989d..8a1b1daff2e97 100644

> --- a/drivers/usb/dwc3/gadget.c

> +++ b/drivers/usb/dwc3/gadget.c

> @@ -3990,7 +3990,7 @@ int dwc3_gadget_init(struct dwc3 *dwc)

>  	}

>  

>  

> -	usb_initialize_gadget(dwc->dev, dwc->gadget, dwc_gadget_release);

> +	usb_initialize_gadget(dwc->sysdev, dwc->gadget, dwc_gadget_release);


Does this change how the device shows up in sysfs?  Why does the parent
not always work properly here?

thanks,

greg k-h
Felipe Balbi July 21, 2021, 8:11 a.m. UTC | #2
Hi,

Greg KH <greg@kroah.com> writes:
> On Mon, Jun 28, 2021 at 05:53:07PM +0200, Michael Grzeschik wrote:

>> In case of dwc3 it is possible that the sysdev is the parent of the

>> controller. To ensure the right dev is set to the gadget's dev parent we

>> will hand over sysdev instead of dev, which will always point to the

>> controller.

>> 

>> Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>

>> 

>> ---

>>    -> v2: first version of patch

>>    -> v3: -

>> ---

>>  drivers/usb/dwc3/gadget.c | 2 +-

>>  1 file changed, 1 insertion(+), 1 deletion(-)

>> 

>> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c

>> index af6d7f157989d..8a1b1daff2e97 100644

>> --- a/drivers/usb/dwc3/gadget.c

>> +++ b/drivers/usb/dwc3/gadget.c

>> @@ -3990,7 +3990,7 @@ int dwc3_gadget_init(struct dwc3 *dwc)

>>  	}

>>  

>>  

>> -	usb_initialize_gadget(dwc->dev, dwc->gadget, dwc_gadget_release);

>> +	usb_initialize_gadget(dwc->sysdev, dwc->gadget, dwc_gadget_release);

>

> Does this change how the device shows up in sysfs?


it might, but not in all instances of dwc3

> Why does the parent not always work properly here?


This is a really old commit by Arnd from back in 2016 (d64ff406e51e)
where it was noticed that dwc3's dma ops weren't properly setup. Arnd
decided to pass a property to tell dwc3 core to use the parent device
for dma operations.

This is not required in all instances of dwc3, though.

-- 
balbi