Re: Fwd: USB gadget driver issue

2016-02-29 Thread Robert Baldyga
Hi Oliver, On 02/29/2016 08:34 AM, Felipe Balbi wrote: > > Hi, > > Olivier Schonken writes: >> Hope I'm not raising an issue which actually is my own stupidity. >> >> I recently upstreamed my embedded Linux kernel to version 4.4, after which >> I started

[PATCH v2 2/5] usb: dwc2: gadget: fix TX FIFO size and address initialization

2016-02-03 Thread Robert Baldyga
PTH_n), as specified during coreConsultant configuration." That means, that we have to setup only FIFO start addresses (DPTxFStAddr), taking into account reset values of DPTxFSize. Initialize FIFO start addresses properly and remove unneeded core related to incorrect FIFO size initialization. Signed-off-

[PATCH v2 1/5] usb: dwc2: gadget: use ep->fifo_index in context of FIFO registers

2016-02-03 Thread Robert Baldyga
In context of FIFO registers we use ep->fifo_index instead of ep->index. Signed-off-by: Robert Baldyga <r.bald...@samsung.com> --- drivers/usb/dwc2/gadget.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/ga

[PATCH v2 0/5] usb: dwc2: gadget: Fix TX FIFO handling

2016-02-03 Thread Robert Baldyga
Hello, This patch series fixes TX FIFO handling in UDC part of DWC2 driver. It gets rid of few bugs, improves compliance with DWC2 documentation and cleanes up driver code. More detailed description is provided in commit messages. Best regards, Robert Baldyga Changelog: v2: - Addressed

[PATCH v2 5/5] usb: dwc2: gadget: free TX FIFO after killing requests

2016-02-03 Thread Robert Baldyga
As kill_all_requests() potentially flushes TX FIFO, we should should free FIFO after calling it. Otherwise FIFO could stay unflushed properly. Signed-off-by: Robert Baldyga <r.bald...@samsung.com> --- drivers/usb/dwc2/gadget.c | 8 1 file changed, 4 insertions(+), 4 deletions(-)

[PATCH v4 37/43] usb: gadget: f_mass_storage: conversion to new API

2016-02-03 Thread Robert Baldyga
Generate descriptors in new format and attach them to USB function in prep_descs(). Change set_alt() implementation and implement clear_alt() operation. Remove boilerplate code. Signed-off-by: Robert Baldyga <r.bald...@samsung.com> --- drivers/usb/gadget/function/f_mass_storage.

[PATCH v4 38/43] usb: gadget: u_serial: remove usb_ep_enable()/usb_ep_disable()

2016-02-03 Thread Robert Baldyga
As we have automatic endpoint state handling it's no longer needed. Signed-off-by: Robert Baldyga <r.bald...@samsung.com> --- drivers/usb/gadget/function/u_serial.c | 16 1 file changed, 16 deletions(-) diff --git a/drivers/usb/gadget/function/u_serial.c b/drivers/usb/

[PATCH v4 43/43] usb: gadget: f_uvc: conversion to new API

2016-02-03 Thread Robert Baldyga
automatically by composite framwework. Remove boilerplate code. Signed-off-by: Robert Baldyga <r.bald...@samsung.com> --- drivers/usb/gadget/function/f_uvc.c | 478 drivers/usb/gadget/function/uvc.h | 3 - 2 files changed, 160 insertions(+), 321 del

[PATCH v4 40/43] usb: gadget: uvc: fix typo in UVCG_OPTS_ATTR() macro

2016-02-03 Thread Robert Baldyga
Fixes: 76e0da34c7cec5a7dc94667326a948de2e9c8c8d ("usb-gadget/uvc: use per-attribute show and store methods") s/aname/cname - 'cname' was originally used as an attribute name, because UVCG_OPTS_ATTR() macro doesn't have 'aname' parameter. Signed-off-by: Robert Baldy

[PATCH v4 42/43] Documentation: update uvc configfs interface description

2016-02-03 Thread Robert Baldyga
Update documentation to reflect changes in UVC configfs interface. Signed-off-by: Robert Baldyga <r.bald...@samsung.com> --- Documentation/ABI/testing/configfs-usb-gadget-uvc | 39 --- Documentation/usb/gadget-testing.txt | 18 +++ 2 files chang

[PATCH v4 39/43] usb: gadget: u_ether: remove usb_ep_enable()/usb_ep_disable()

2016-02-03 Thread Robert Baldyga
As we have automatic endpoint state handling it's no longer needed. Signed-off-by: Robert Baldyga <r.bald...@samsung.com> --- drivers/usb/gadget/function/u_ether.c | 28 ++-- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/drivers/usb/gadget/fu

[PATCH v4 28/43] usb: gadget: f_eem: conversion to new API

2016-02-03 Thread Robert Baldyga
Generate descriptors in new format and attach them to USB function in prep_descs(). Implement prep_vendor_descs() to supply class specific descriptors. Change set_alt() implementation and implement clear_alt() operation. Remove boilerplate code. Signed-off-by: Robert Baldyga <r.b

[PATCH v4 25/43] usb: gadget: f_hid: handle requests lifetime properly

2016-02-03 Thread Robert Baldyga
So far USB requests allocated in hidg_set_alt() were not freed. Now we free them in case of hidg_set_alt() failure (when we are not able to allocate and enqueue all the requests) or in hidg_disable() function. Signed-off-by: Robert Baldyga <r.bald...@samsung.com> --- drivers/usb/gadget/fu

[PATCH v4 09/43] usb: gadget: composite: handle function bind

2016-02-03 Thread Robert Baldyga
. Signed-off-by: Robert Baldyga <r.bald...@samsung.com> --- drivers/usb/gadget/composite.c | 162 + include/linux/usb/composite.h | 3 + 2 files changed, 165 insertions(+) diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index 3

[PATCH v4 17/43] usb: gadget: composite: add usb_get_interface_id() function

2016-02-03 Thread Robert Baldyga
some class or vendor specific setup requests. Signed-off-by: Robert Baldyga <r.bald...@samsung.com> --- drivers/usb/gadget/composite.c | 19 +++ include/linux/usb/composite.h | 2 ++ 2 files changed, 21 insertions(+) diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/

[PATCH v4 02/43] usb: gadget: f_sourcesink: free requests in sourcesink_disable()

2016-02-03 Thread Robert Baldyga
-off-by: Robert Baldyga <r.bald...@samsung.com> --- drivers/usb/gadget/function/f_sourcesink.c | 63 -- 1 file changed, 51 insertions(+), 12 deletions(-) diff --git a/drivers/usb/gadget/function/f_sourcesink.c b/drivers/usb/gadget/function/f_sourcesink.c index e

[PATCH v4 33/43] usb: gadget: f_phonet: conversion to new API

2016-02-03 Thread Robert Baldyga
Generate descriptors in new format and attach them to USB function in prep_descs(). Implement prep_vendor_descs() to supply class specific descriptors. Change set_alt() implementation and implement clear_alt() operation. Remove boilerplate code. Signed-off-by: Robert Baldyga <r.b

[PATCH v4 29/43] usb: gadget: f_ncm: conversion to new API

2016-02-03 Thread Robert Baldyga
Generate descriptors in new format and attach them to USB function in prep_descs(). Implement prep_vendor_descs() to supply class specific descriptors. Change set_alt() implementation and implement clear_alt() operation. Remove boilerplate code. Signed-off-by: Robert Baldyga <r.b

[PATCH v4 31/43] usb: gadget: f_serial: conversion to new API

2016-02-03 Thread Robert Baldyga
Generate descriptors in new format and attach them to USB function in prep_descs(). Change set_alt() implementation and implement clear_alt() operation. Remove boilerplate code. Signed-off-by: Robert Baldyga <r.bald...@samsung.com> --- drivers/usb/gadget/function/f_serial.c

[PATCH v4 30/43] usb: gadget: f_printer: conversion to new API

2016-02-03 Thread Robert Baldyga
Generate descriptors in new format and attach them to USB function in prep_descs(). Implement prep_vendor_descs() to supply class specific descriptors. Change set_alt() implementation and implement clear_alt() operation. Remove boilerplate code. Signed-off-by: Robert Baldyga <r.b

[PATCH v4 01/43] usb: gadget: f_sourcesink: make ISO altset user-selectable

2016-02-03 Thread Robert Baldyga
function bound. Signed-off-by: Robert Baldyga <r.bald...@samsung.com> --- drivers/usb/gadget/function/f_sourcesink.c | 98 -- drivers/usb/gadget/function/g_zero.h | 3 + drivers/usb/gadget/legacy/zero.c | 6 ++ 3 files changed, 76 insertions(

[PATCH v4 00/43] usb: gadget: composite: introduce new function API

2016-02-03 Thread Robert Baldyga
. I can send them as RFC to show what is final result which I want to achieve. Best regards, Robert Baldyga Changelog: v4: - Added 7 new patches - Few minor fixes v3: https://lkml.org/lkml/2015/12/11/311 - Fixed handling of vendor specific descriptor attached to endpoint - Added 6 new patches convert

[PATCH v4 06/43] usb: gadget: composite: introduce new descriptors format

2016-02-03 Thread Robert Baldyga
, because we now store information about endpoints, allows us to handle endpoint state inside composite framework, and in result remove lots of boilerplate code from USB functions. Signed-off-by: Robert Baldyga <r.bald...@samsung.com> --- include/linux/usb/composite.h

[PATCH v4 03/43] usb: gadget: f_loopback: free requests in loopback_disable()

2016-02-03 Thread Robert Baldyga
-by: Robert Baldyga <r.bald...@samsung.com> --- drivers/usb/gadget/function/f_loopback.c | 58 +--- 1 file changed, 23 insertions(+), 35 deletions(-) diff --git a/drivers/usb/gadget/function/f_loopback.c b/drivers/usb/gadget/function/f_loopback.c index ddc3aad..f

[PATCH v4 04/43] usb: gadget: configfs: fix error path

2016-02-03 Thread Robert Baldyga
As usb_gstrings_attach() failure can happen when some USB functions are are already added to some configurations (in previous loop iterations), we should always call purge_configs_funcs() to be sure that failure is be handled properly. Signed-off-by: Robert Baldyga <r.bald...@samsung.

[PATCH v4 05/43] usb: gadget: composite: fix recursive spinlock locking

2016-02-03 Thread Robert Baldyga
nal spinlock protecting deactivation counter. Signed-off-by: Robert Baldyga <r.bald...@samsung.com> --- drivers/usb/gadget/composite.c | 9 + include/linux/usb/composite.h | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/usb/gadget/composite.c b/dr

[PATCH v2 4/5] usb: dwc2: gadget: remove dead code from dwc2_hsotg_ep_enable()

2016-02-03 Thread Robert Baldyga
Since FIFO is always freed in dwc2_hsotg_ep_disable(), ep->fifo_index is always 0 in dwc2_hsotg_ep_enable(), hence code inside if() block is never executed. Signed-off-by: Robert Baldyga <r.bald...@samsung.com> --- drivers/usb/dwc2/gadget.c | 13 + 1 file changed, 1 inserti

[PATCH v2 3/5] usb: dwc2: gadget: change variable name to more meaningful

2016-02-03 Thread Robert Baldyga
Since we handle FIFOs and endpoint separately, using variable named 'ep' in context of FIFO is misleading, hence we rename it to 'fifo'. Signed-off-by: Robert Baldyga <r.bald...@samsung.com> --- drivers/usb/dwc2/gadget.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff

[PATCH v4 32/43] usb: gadget: f_obex: conversion to new API

2016-02-03 Thread Robert Baldyga
Generate descriptors in new format and attach them to USB function in prep_descs(). Implement prep_vendor_descs() to supply class specific descriptors. Change set_alt() implementation and implement clear_alt() operation. Remove boilerplate code. Signed-off-by: Robert Baldyga <r.b

[PATCH v4 34/43] usb: gadget: f_subset: conversion to new API

2016-02-03 Thread Robert Baldyga
Generate descriptors in new format and attach them to USB function in prep_descs(). Implement prep_vendor_descs() to supply class specific descriptors. Change set_alt() implementation and implement clear_alt() operation. Remove boilerplate code. Signed-off-by: Robert Baldyga <r.b

[PATCH v4 36/43] usb: gadget: f_uac2: conversion to new API

2016-02-03 Thread Robert Baldyga
Generate descriptors in new format and attach them to USB function in prep_descs(). Implement prep_vendor_descs() to supply class specific descriptors. Change set_alt() implementation and implement clear_alt() operation. Remove boilerplate code. Signed-off-by: Robert Baldyga <r.b

[PATCH v4 23/43] usb: gadget: f_ecm: conversion to new API

2016-02-03 Thread Robert Baldyga
code. Change USB request lifetime management - now it's allocated in set_alt() and freed in clear_alt(). Signed-off-by: Robert Baldyga <r.bald...@samsung.com> --- drivers/usb/gadget/function/f_ecm.c | 321 +++- 1 file changed, 92 insertions(+), 229 deletions(-)

[PATCH v4 22/43] usb: gadget: f_sourcesink: convert to new API

2016-02-03 Thread Robert Baldyga
. Call usb_config_do_bind() in legacy gadget zero, because it uses usb_add_config_only() instead of usb_add_config() and prepares configuration manually. Signed-off-by: Robert Baldyga <r.bald...@samsung.com> --- drivers/usb/gadget/function/f_sourcesink.c

[PATCH v4 20/43] usb: gadget: configfs: add new composite API support

2016-02-03 Thread Robert Baldyga
Handle functions using new API properly. Signed-off-by: Robert Baldyga <r.bald...@samsung.com> --- drivers/usb/gadget/configfs.c | 22 ++ 1 file changed, 22 insertions(+) diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c index fb3c9ba..60c6898

[PATCH v4 21/43] usb: gadget: f_loopback: convert to new API

2016-02-03 Thread Robert Baldyga
of usb_add_config() and prepares configuration manually. Signed-off-by: Robert Baldyga <r.bald...@samsung.com> --- drivers/usb/gadget/function/f_loopback.c | 162 ++- drivers/usb/gadget/legacy/zero.c | 3 + 2 files changed, 33 insertions(+), 132 deletions(-) diff

[PATCH v4 16/43] usb: gadget: composite: add usb_function_get_ep() function

2016-02-03 Thread Robert Baldyga
Introduce function returning endpoint of given index in active altsetting of specified interface. It's intended to be used in set_alt() callback to obtain endpoints of currently selected altsetting. Signed-off-by: Robert Baldyga <r.bald...@samsung.com> --- drivers/usb/gadget/composite.

[PATCH v4 15/43] usb: gadget: composite: handle get_alt() automatically

2016-02-03 Thread Robert Baldyga
As now we store current altsetting number for each interface, we can handle USB_REQ_GET_INTERFACE automatically. Signed-off-by: Robert Baldyga <r.bald...@samsung.com> --- drivers/usb/gadget/composite.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/usb/

[PATCH v4 13/43] usb: gadget: composite: enable eps before calling set_alt() callback

2016-02-03 Thread Robert Baldyga
in function and pass it to set_alt() callback instead of passing index of interface in configuration which has to be obtained from interface descriptor. This simplifies altsetting changes handling in code of USB functions. Signed-off-by: Robert Baldyga <r.bald...@samsung.com> --- drive

[PATCH v4 18/43] usb: gadget: composite: usb_get_endpoint_address() function

2016-02-03 Thread Robert Baldyga
Introduce function returning address of given endpoint within the function. This value can be useful during preparation of class or vendor specific descriptors in prep_vendor_descs() callback. It can be also necessary to handle some class or vendor specific setup requests. Signed-off-by: Robert

[PATCH v4 41/43] usb: gadget: uvc: simplify descriptors generation

2016-02-03 Thread Robert Baldyga
As we don't need distinction between interface descriptors for different speeds, we can remove some amount of unnecessary code. Additionally we simplify configfs interface of UVC function. Signed-off-by: Robert Baldyga <r.bald...@samsung.com> --- drivers/usb/gadget/function/f_uvc.c

[PATCH v4 35/43] usb: gadget: f_uac1: conversion to new API

2016-02-03 Thread Robert Baldyga
Generate descriptors in new format and attach them to USB function in prep_descs(). Implement prep_vendor_descs() to supply class specific descriptors. Change set_alt() implementation and implement clear_alt() operation. Remove boilerplate code. Signed-off-by: Robert Baldyga <r.b

[PATCH v4 24/43] usb: gadget: f_rndis: conversion to new API

2016-02-03 Thread Robert Baldyga
allocated in set_alt() and freed in clear_alt(). Signed-off-by: Robert Baldyga <r.bald...@samsung.com> --- drivers/usb/gadget/function/f_rndis.c | 321 -- 1 file changed, 112 insertions(+), 209 deletions(-) diff --git a/drivers/usb/gadget/function/f_rndi

[PATCH v4 27/43] usb: gadget: f_acm: conversion to new API

2016-02-03 Thread Robert Baldyga
Generate descriptors in new format and attach them to USB function in prep_descs(). Implement prep_vendor_descs() to supply class specific descriptors. Change set_alt() implementation and implement clear_alt() operation. Remove boilerplate code. Signed-off-by: Robert Baldyga <r.b

[PATCH v4 12/43] usb: gadget: composite: disable eps before calling disable() callback

2016-02-03 Thread Robert Baldyga
Changes meaning of disable() operation for functions using new API. Before calling disable() callback composite automatically disables endpoints of active altsettings of given USB function. This reduces amount of boilerplate code in USB functions. Signed-off-by: Robert Baldyga <r.b

[PATCH v4 10/43] usb: gadget: composite: handle vendor descs

2016-02-03 Thread Robert Baldyga
After binding all configurations in gadget, call prep_vendor_descs() for each function which uses new API and implements this callback. Signed-off-by: Robert Baldyga <r.bald...@samsung.com> --- drivers/usb/gadget/composite.c | 31 +++ include/linux/usb/compo

[PATCH v4 08/43] usb: gadget: composite: introduce new USB function ops

2016-02-03 Thread Robert Baldyga
, which means that interface numbers and endpoint addresses are already assigned so that function can use these values to prepare class or vendor specific descriptors and attach them to function. Signed-off-by: Robert Baldyga <r.bald...@samsung.com> --- include/linux/usb/composite.h | 8 +

[PATCH v4 14/43] usb: gadget: composite: introduce clear_alt() operation

2016-02-03 Thread Robert Baldyga
(). It also takes over the function of disable() opetarion, so it can be removed after converting all USB functions to new API. Signed-off-by: Robert Baldyga <r.bald...@samsung.com> --- drivers/usb/gadget/composite.c | 12 include/linux/usb/composite.h | 4 2 files chang

[PATCH v4 11/43] usb: gadget: composite: generate old descs for compatibility

2016-02-03 Thread Robert Baldyga
For now we generate descriptor arrays for each speed as it is done by old API functions, to allow use mixed new and old API based functions in single configurations. This will be removed after complete switch to new API. Signed-off-by: Robert Baldyga <r.bald...@samsung.com> --- drive

[PATCH v4 07/43] usb: gadget: composite: add functions for descriptors handling

2016-02-03 Thread Robert Baldyga
descriptors format. Signed-off-by: Robert Baldyga <r.bald...@samsung.com> --- drivers/usb/gadget/composite.c | 343 + include/linux/usb/composite.h | 52 +++ 2 files changed, 395 insertions(+) diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/

Re: [PATCH v2] usb: gadget: fix double mem free for usb_request caused by wild pointers

2015-12-28 Thread Robert Baldyga
gt; EIP is at kfree+0x172/0x180 > Call Trace: > [<80c0e3b6>] ? usb_ep_autoconfig_ss+0x86/0x170 > [<80c13345>] gs_free_req+0x15/0x30 > [<80c12df1>] acm_bind+0x1c1/0x2d0 > [<80c0e9be>] usb_add_function+0x6e/0x120 > [<80c213cb>] acm_function_bind_con

[PATCH 2/5] usb: dwc2: gadget: fix TX FIFO size and address initialization

2015-12-28 Thread Robert Baldyga
PTH_n), as specified during coreConsultant configuration." That means, that we have to setup only FIFO start addresses (DPTxFStAddr), taking into account reset values of DPTxFSize. Initialize FIFO start addresses properly and remove unneeded core related to incorrect FIFO size initialization. Signed-off-

[PATCH 4/5] usb: dwc2: gadget: remove dead code from dwc2_hsotg_ep_enable()

2015-12-28 Thread Robert Baldyga
Since FIFO is always freed in dwc2_hsotg_ep_disable(), ep->fifo_index is always 0 in dwc2_hsotg_ep_enable(), hence code inside if() block is never executed. Signed-off-by: Robert Baldyga <r.bald...@samsung.com> --- drivers/usb/dwc2/gadget.c | 13 + 1 file changed, 1 inserti

[PATCH 3/5] usb: dwc2: gadget: change variable name to more meaningful

2015-12-28 Thread Robert Baldyga
Since we handle FIFOs and endpoint separately, using variable named 'ep' in context of FIFO is misleading, hence we rename it to 'fifo'. Signed-off-by: Robert Baldyga <r.bald...@samsung.com> --- drivers/usb/dwc2/gadget.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff

[PATCH 5/5] usb: dwc2: gadget: free TX FIFO after killing requests

2015-12-28 Thread Robert Baldyga
As kill_all_requests() potentially flushes TX FIFO, we should should free FIFO after calling it. Otherwise FIFO could stay unflushed properly. Signed-off-by: Robert Baldyga <r.bald...@samsung.com> --- drivers/usb/dwc2/gadget.c | 8 1 file changed, 4 insertions(+), 4 deletions(-)

[PATCH 0/5] usb: dwc2: gadget: Fix TX FIFO handling

2015-12-28 Thread Robert Baldyga
Hello, This patch series fixes TX FIFO handling in UDC part of DWC2 driver. It gets rid of few bugs, improves compliance with DWC2 documentation and cleanes up driver code. More detailed description is provided in commit messages. Best regards, Robert Baldyga Robert Baldyga (5): usb: dwc2

[PATCH 1/5] usb: dwc2: gadget: use ep->fifo_index in context of FIFO registers

2015-12-28 Thread Robert Baldyga
In context of FIFO registers we use ep->fifo_index instead of ep->index. Signed-off-by: Robert Baldyga <r.bald...@samsung.com> --- drivers/usb/dwc2/gadget.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/ga

Re: [PATCH] usb: gadget: acm: set notify_req to NULL after freed to avoid double free

2015-12-27 Thread Robert Baldyga
l Trace: > [<80c0e3b6>] ? usb_ep_autoconfig_ss+0x86/0x170 > [<80c13345>] gs_free_req+0x15/0x30 > [<80c12df1>] acm_bind+0x1c1/0x2d0 > [<80c0e9be>] usb_add_function+0x6e/0x120 > [<80c213cb>] acm_function_bind_config+0x2b/0x90 > Reviewed-by:

Re: [PATCH v3 00/36] usb: gadget: composite: introduce new function API

2015-12-17 Thread Robert Baldyga
Hi Felipe, I can see that you have applied the documentation fix patch to your tree. Have also you looked at the remaining patches of this series? What do you think about this concept? Any comments? Best regards, Robert On 12/11/2015 12:24 PM, Robert Baldyga wrote: > Hi Felipe, > > H

[PATCH v3 35/36] usb: gadget: f_uac2: conversion to new API

2015-12-11 Thread Robert Baldyga
Generate descriptors in new format and attach them to USB function in prep_descs(). Implement prep_vendor_descs() to supply class specific descriptors. Change set_alt() implementation and implement clear_alt() operation. Remove boilerplate code. Signed-off-by: Robert Baldyga <r.b

[PATCH v3 34/36] usb: gadget: f_uac1: conversion to new API

2015-12-11 Thread Robert Baldyga
Generate descriptors in new format and attach them to USB function in prep_descs(). Implement prep_vendor_descs() to supply class specific descriptors. Change set_alt() implementation and implement clear_alt() operation. Remove boilerplate code. Signed-off-by: Robert Baldyga <r.b

[PATCH v3 33/36] usb: gadget: f_subset: conversion to new API

2015-12-11 Thread Robert Baldyga
Generate descriptors in new format and attach them to USB function in prep_descs(). Implement prep_vendor_descs() to supply class specific descriptors. Change set_alt() implementation and implement clear_alt() operation. Remove boilerplate code. Signed-off-by: Robert Baldyga <r.b

[PATCH v3 28/36] usb: gadget: f_ncm: conversion to new API

2015-12-11 Thread Robert Baldyga
Generate descriptors in new format and attach them to USB function in prep_descs(). Implement prep_vendor_descs() to supply class specific descriptors. Change set_alt() implementation and implement clear_alt() operation. Remove boilerplate code. Signed-off-by: Robert Baldyga <r.b

[PATCH v3 36/36] usb: gadget: f_mass_storage: conversion to new API

2015-12-11 Thread Robert Baldyga
Generate descriptors in new format and attach them to USB function in prep_descs(). Change set_alt() implementation and implement clear_alt() operation. Remove boilerplate code. Signed-off-by: Robert Baldyga <r.bald...@samsung.com> --- drivers/usb/gadget/function/f_mass_storage.

[PATCH v3 32/36] usb: gadget: f_phonet: conversion to new API

2015-12-11 Thread Robert Baldyga
Generate descriptors in new format and attach them to USB function in prep_descs(). Implement prep_vendor_descs() to supply class specific descriptors. Change set_alt() implementation and implement clear_alt() operation. Remove boilerplate code. Signed-off-by: Robert Baldyga <r.b

[PATCH v3 01/36] Documentation: usb: update usb-tools repository address

2015-12-11 Thread Robert Baldyga
It seems that gitotious repository is no longer accessible, so we replace it with address to active repository. Signed-off-by: Robert Baldyga <r.bald...@samsung.com> --- Documentation/usb/gadget-testing.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentati

[PATCH v3 00/36] usb: gadget: composite: introduce new function API

2015-12-11 Thread Robert Baldyga
as RFC to show what is final result which I want to achieve. Best regards, Robert Baldyga Changelog: v3: - Fixed handling of vendor specific descriptor attached to endpoint - Added 6 new patches converting Functions to new API v2: https://lkml.org/lkml/2015/11/27/180 - Addressed comments fro

[PATCH v3 03/36] usb: gadget: f_sourcesink: free requests in sourcesink_disable()

2015-12-11 Thread Robert Baldyga
-off-by: Robert Baldyga <r.bald...@samsung.com> --- drivers/usb/gadget/function/f_sourcesink.c | 63 -- 1 file changed, 51 insertions(+), 12 deletions(-) diff --git a/drivers/usb/gadget/function/f_sourcesink.c b/drivers/usb/gadget/function/f_sourcesink.c index e

[PATCH v3 29/36] usb: gadget: f_printer: conversion to new API

2015-12-11 Thread Robert Baldyga
Generate descriptors in new format and attach them to USB function in prep_descs(). Implement prep_vendor_descs() to supply class specific descriptors. Change set_alt() implementation and implement clear_alt() operation. Remove boilerplate code. Signed-off-by: Robert Baldyga <r.b

[PATCH v3 25/36] usb: gadget: f_hid: conversion to new API

2015-12-11 Thread Robert Baldyga
-off-by: Robert Baldyga <r.bald...@samsung.com> --- drivers/usb/gadget/function/f_hid.c | 305 ++-- 1 file changed, 119 insertions(+), 186 deletions(-) diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb/gadget/function/f_hid.c index 0456a53..8770289

[PATCH v3 24/36] usb: gadget: f_hid: handle requests lifetime properly

2015-12-11 Thread Robert Baldyga
So far USB requests allocated in hidg_set_alt() were not freed. Now we free them in case of hidg_set_alt() failure (when we are not able to allocate and enqueue all the requests) or in hidg_disable() function. Signed-off-by: Robert Baldyga <r.bald...@samsung.com> --- drivers/usb/gadget/fu

[PATCH v3 31/36] usb: gadget: f_obex: conversion to new API

2015-12-11 Thread Robert Baldyga
Generate descriptors in new format and attach them to USB function in prep_descs(). Implement prep_vendor_descs() to supply class specific descriptors. Change set_alt() implementation and implement clear_alt() operation. Remove boilerplate code. Signed-off-by: Robert Baldyga <r.b

[PATCH v3 22/36] usb: gadget: f_ecm: conversion to new API

2015-12-11 Thread Robert Baldyga
code. Change USB request lifetime management - now it's allocated in set_alt() and freed in clear_alt(). Signed-off-by: Robert Baldyga <r.bald...@samsung.com> --- drivers/usb/gadget/function/f_ecm.c | 321 +++- 1 file changed, 92 insertions(+), 229 deletions(-)

[PATCH v3 23/36] usb: gadget: f_rndis: conversion to new API

2015-12-11 Thread Robert Baldyga
allocated in set_alt() and freed in clear_alt(). Signed-off-by: Robert Baldyga <r.bald...@samsung.com> --- drivers/usb/gadget/function/f_rndis.c | 321 -- 1 file changed, 112 insertions(+), 209 deletions(-) diff --git a/drivers/usb/gadget/function/f_rndi

[PATCH v3 26/36] usb: gadget: f_acm: conversion to new API

2015-12-11 Thread Robert Baldyga
Generate descriptors in new format and attach them to USB function in prep_descs(). Implement prep_vendor_descs() to supply class specific descriptors. Change set_alt() implementation and implement clear_alt() operation. Remove boilerplate code. Signed-off-by: Robert Baldyga <r.b

[PATCH v3 30/36] usb: gadget: f_serial: conversion to new API

2015-12-11 Thread Robert Baldyga
Generate descriptors in new format and attach them to USB function in prep_descs(). Change set_alt() implementation and implement clear_alt() operation. Remove boilerplate code. Signed-off-by: Robert Baldyga <r.bald...@samsung.com> --- drivers/usb/gadget/function/f_serial.c

[PATCH v3 27/36] usb: gadget: f_eem: conversion to new API

2015-12-11 Thread Robert Baldyga
Generate descriptors in new format and attach them to USB function in prep_descs(). Implement prep_vendor_descs() to supply class specific descriptors. Change set_alt() implementation and implement clear_alt() operation. Remove boilerplate code. Signed-off-by: Robert Baldyga <r.b

[PATCH v3 17/36] usb: gadget: composite: add usb_get_interface_id() function

2015-12-11 Thread Robert Baldyga
some class or vendor specific setup requests. Signed-off-by: Robert Baldyga <r.bald...@samsung.com> --- drivers/usb/gadget/composite.c | 19 +++ include/linux/usb/composite.h | 2 ++ 2 files changed, 21 insertions(+) diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/

[PATCH v3 18/36] usb: gadget: composite: enable adding USB functions using new API

2015-12-11 Thread Robert Baldyga
in composite framework. Signed-off-by: Robert Baldyga <r.bald...@samsung.com> --- drivers/usb/gadget/composite.c | 40 +++- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index 261023b..b

[PATCH v3 16/36] usb: gadget: composite: add usb_function_get_ep() function

2015-12-11 Thread Robert Baldyga
Introduce function returning endpoint of given index in active altsetting of specified interface. It's intended to be used in set_alt() callback to obtain endpoints of currently selected altsetting. Signed-off-by: Robert Baldyga <r.bald...@samsung.com> --- drivers/usb/gadget/composite.

[PATCH v3 19/36] usb: gadget: configfs: add new composite API support

2015-12-11 Thread Robert Baldyga
Handle functions using new API properly. Signed-off-by: Robert Baldyga <r.bald...@samsung.com> --- drivers/usb/gadget/configfs.c | 22 ++ 1 file changed, 22 insertions(+) diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c index 0557f80..153adf7

[PATCH v3 15/36] usb: gadget: composite: handle get_alt() automatically

2015-12-11 Thread Robert Baldyga
As now we store current altsetting number for each interface, we can handle USB_REQ_GET_INTERFACE automatically. Signed-off-by: Robert Baldyga <r.bald...@samsung.com> --- drivers/usb/gadget/composite.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/usb/

[PATCH v3 21/36] usb: gadget: f_sourcesink: convert to new API

2015-12-11 Thread Robert Baldyga
. Call usb_config_do_bind() in legacy gadget zero, because it uses usb_add_config_only() instead of usb_add_config() and prepares configuration manually. Signed-off-by: Robert Baldyga <r.bald...@samsung.com> --- drivers/usb/gadget/function/f_sourcesink.c

[PATCH v3 20/36] usb: gadget: f_loopback: convert to new API

2015-12-11 Thread Robert Baldyga
of usb_add_config() and prepares configuration manually. Signed-off-by: Robert Baldyga <r.bald...@samsung.com> --- drivers/usb/gadget/function/f_loopback.c | 162 ++- drivers/usb/gadget/legacy/zero.c | 3 + 2 files changed, 33 insertions(+), 132 deletions(-) diff

[PATCH v3 14/36] usb: gadget: composite: introduce clear_alt() operation

2015-12-11 Thread Robert Baldyga
(). It also takes over the function of disable() opetarion, so it can be removed after converting all USB functions to new API. Signed-off-by: Robert Baldyga <r.bald...@samsung.com> --- drivers/usb/gadget/composite.c | 12 include/linux/usb/composite.h | 4 2 files chang

[PATCH v3 02/36] usb: gadget: f_sourcesink: make ISO altset user-selectable

2015-12-11 Thread Robert Baldyga
function bound. Signed-off-by: Robert Baldyga <r.bald...@samsung.com> --- drivers/usb/gadget/function/f_sourcesink.c | 98 -- drivers/usb/gadget/function/g_zero.h | 3 + drivers/usb/gadget/legacy/zero.c | 6 ++ 3 files changed, 76 insertions(

[PATCH v3 05/36] usb: gadget: configfs: fix error path

2015-12-11 Thread Robert Baldyga
As usb_gstrings_attach() failure can happen when some USB functions are are already added to some configurations (in previous loop iterations), we should always call purge_configs_funcs() to be sure that failure is be handled properly. Signed-off-by: Robert Baldyga <r.bald...@samsung.

[PATCH v3 08/36] usb: gadget: composite: introduce new USB function ops

2015-12-11 Thread Robert Baldyga
, which means that interface numbers and endpoint addresses are already assigned so that function can use these values to prepare class or vendor specific descriptors and attach them to function. Signed-off-by: Robert Baldyga <r.bald...@samsung.com> --- include/linux/usb/composite.h | 8 +

[PATCH v3 10/36] usb: gadget: composite: handle vendor descs

2015-12-11 Thread Robert Baldyga
After binding all configurations in gadget, call prep_vendor_descs() for each function which uses new API and implements this callback. Signed-off-by: Robert Baldyga <r.bald...@samsung.com> --- drivers/usb/gadget/composite.c | 31 +++ include/linux/usb/compo

[PATCH v3 11/36] usb: gadget: composite: generate old descs for compatibility

2015-12-11 Thread Robert Baldyga
For now we generate descriptor arrays for each speed as it is done by old API functions, to allow use mixed new and old API based functions in single configurations. This will be removed after complete switch to new API. Signed-off-by: Robert Baldyga <r.bald...@samsung.com> --- drive

[PATCH v3 07/36] usb: gadget: composite: add functions for descriptors handling

2015-12-11 Thread Robert Baldyga
descriptors format. Signed-off-by: Robert Baldyga <r.bald...@samsung.com> --- drivers/usb/gadget/composite.c | 347 + include/linux/usb/composite.h | 52 ++ 2 files changed, 399 insertions(+) diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/

[PATCH v3 12/36] usb: gadget: composite: disable eps before calling disable() callback

2015-12-11 Thread Robert Baldyga
Changes meaning of disable() operation for functions using new API. Before calling disable() callback composite automatically disables endpoints of active altsettings of given USB function. This reduces amount of boilerplate code in USB functions. Signed-off-by: Robert Baldyga <r.b

[PATCH v3 06/36] usb: gadget: composite: introduce new descriptors format

2015-12-11 Thread Robert Baldyga
, because we now store information about endpoints, allows us to handle endpoint state inside composite framework, and in result remove lots of boilerplate code from USB functions. Signed-off-by: Robert Baldyga <r.bald...@samsung.com> --- include/linux/usb/composite.h

[PATCH v3 13/36] usb: gadget: composite: enable eps before calling set_alt() callback

2015-12-11 Thread Robert Baldyga
in function and pass it to set_alt() callback instead of passing index of interface in configuration which has to be obtained from interface descriptor. This simplifies altsetting changes handling in code of USB functions. Signed-off-by: Robert Baldyga <r.bald...@samsung.com> --- drive

[PATCH v3 09/36] usb: gadget: composite: handle function bind

2015-12-11 Thread Robert Baldyga
. Signed-off-by: Robert Baldyga <r.bald...@samsung.com> --- drivers/usb/gadget/composite.c | 162 + include/linux/usb/composite.h | 3 + 2 files changed, 165 insertions(+) diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index 3

[PATCH v3 04/36] usb: gadget: f_loopback: free requests in loopback_disable()

2015-12-11 Thread Robert Baldyga
-by: Robert Baldyga <r.bald...@samsung.com> --- drivers/usb/gadget/function/f_loopback.c | 58 +--- 1 file changed, 23 insertions(+), 35 deletions(-) diff --git a/drivers/usb/gadget/function/f_loopback.c b/drivers/usb/gadget/function/f_loopback.c index ddc3aad..f

Re: [PATCH v2] usb: dwc3: gadget: handle request->zero

2015-12-03 Thread Robert Baldyga
Hi Felipe, On 12/02/2015 07:55 PM, Felipe Balbi wrote: > So far, dwc3 has always missed request->zero > handling for every endpoint. Let's implement > that so we can handle cases where transfer must > be finished with a ZLP. > > Note that dwc3 is a little special. Even though > we're dealing

[PATCH v2 28/29] usb: gadget: f_printer: conversion to new API

2015-11-27 Thread Robert Baldyga
Generate descriptors in new format and attach them to USB function in prep_descs(). Implement prep_vendor_descs() to supply class specific descriptors. Change set_alt() implementation and implement clear_alt() operation. Remove boilerplate code. Signed-off-by: Robert Baldyga <r.b

[PATCH v2 25/29] usb: gadget: f_acm: conversion to new API

2015-11-27 Thread Robert Baldyga
Generate descriptors in new format and attach them to USB function in prep_descs(). Implement prep_vendor_descs() to supply class specific descriptors. Change set_alt() implementation and implement clear_alt() operation. Remove boilerplate code. Signed-off-by: Robert Baldyga <r.b

[PATCH v2 26/29] usb: gadget: f_eem: conversion to new API

2015-11-27 Thread Robert Baldyga
Generate descriptors in new format and attach them to USB function in prep_descs(). Implement prep_vendor_descs() to supply class specific descriptors. Change set_alt() implementation and implement clear_alt() operation. Remove boilerplate code. Signed-off-by: Robert Baldyga <r.b

[PATCH v2 03/29] usb: gadget: f_loopback: free requests in loopback_disable()

2015-11-27 Thread Robert Baldyga
-by: Robert Baldyga <r.bald...@samsung.com> --- drivers/usb/gadget/function/f_loopback.c | 58 +--- 1 file changed, 23 insertions(+), 35 deletions(-) diff --git a/drivers/usb/gadget/function/f_loopback.c b/drivers/usb/gadget/function/f_loopback.c index 23933bd..7

  1   2   3   4   5   6   7   8   9   >