mbox series

[v2,0/9] Add XU support to UVC Gadget

Message ID 20221121092517.225242-1-dan.scally@ideasonboard.com (mailing list archive)
Headers show
Series Add XU support to UVC Gadget | expand

Message

Dan Scally Nov. 21, 2022, 9:25 a.m. UTC
Hello all

This series adds support for the definition of extension units in configfs for
the UVC Gadget. The XUs are modelled as config_items within a new "extensions"
group under control, which seemed like an appropriate place to put them.

To allow the XU's to be inserted in the function graph, the bSourceID attribute
for the default output terminal is made writeable - users will need to configure
it with the bUnitID of the XU that they want to use as the OT's source. This does
mean that the XUs can _only_ be placed immediately preceding the OT, but I think
that that's fine for now.

Series level changes:

  - Added patches 5-9 which additionally add the ability to create string
  descriptors through configfs and link them to the extension units as well as
  to override the default descriptors for the IAD and VC/VS interfaces

The XUs configured through this series have been tested via uvc-gadget, uvcvideo
and uvcdynctrl.

Thanks
Dan


Daniel Scally (9):
  usb: gadget: uvc: Make bSourceID read/write
  usb: gadget: uvc: Generalise helper functions for reuse
  usb: gadget: uvc: Allow definition of XUs in configfs
  usb: gadget: uvc: Copy XU descriptors during .bind()
  usb: gadget: uvc: Support arbitrary string descriptors
  usb: gadget: uvc: Allow linking XUs to string descriptors
  usb: gadget: uvc: Attach custom string descriptors
  usb: gadget: uvc: Allow linking function to string descs
  usb: gadget: uvc: Use custom strings if available

 .../ABI/testing/configfs-usb-gadget-uvc       |   50 +-
 drivers/usb/gadget/function/f_uvc.c           |  134 +-
 drivers/usb/gadget/function/u_uvc.h           |   22 +
 drivers/usb/gadget/function/uvc.h             |    1 +
 drivers/usb/gadget/function/uvc_configfs.c    | 1087 ++++++++++++++++-
 drivers/usb/gadget/function/uvc_configfs.h    |   60 +
 6 files changed, 1283 insertions(+), 71 deletions(-)

Comments

Dan Scally Dec. 12, 2022, 9:57 a.m. UTC | #1
Hello all


A gentle ping for any comments on this series :)


Thanks

Dan

On 21/11/2022 09:25, Daniel Scally wrote:
> Hello all
>
> This series adds support for the definition of extension units in configfs for
> the UVC Gadget. The XUs are modelled as config_items within a new "extensions"
> group under control, which seemed like an appropriate place to put them.
>
> To allow the XU's to be inserted in the function graph, the bSourceID attribute
> for the default output terminal is made writeable - users will need to configure
> it with the bUnitID of the XU that they want to use as the OT's source. This does
> mean that the XUs can _only_ be placed immediately preceding the OT, but I think
> that that's fine for now.
>
> Series level changes:
>
>    - Added patches 5-9 which additionally add the ability to create string
>    descriptors through configfs and link them to the extension units as well as
>    to override the default descriptors for the IAD and VC/VS interfaces
>
> The XUs configured through this series have been tested via uvc-gadget, uvcvideo
> and uvcdynctrl.
>
> Thanks
> Dan
>
>
> Daniel Scally (9):
>    usb: gadget: uvc: Make bSourceID read/write
>    usb: gadget: uvc: Generalise helper functions for reuse
>    usb: gadget: uvc: Allow definition of XUs in configfs
>    usb: gadget: uvc: Copy XU descriptors during .bind()
>    usb: gadget: uvc: Support arbitrary string descriptors
>    usb: gadget: uvc: Allow linking XUs to string descriptors
>    usb: gadget: uvc: Attach custom string descriptors
>    usb: gadget: uvc: Allow linking function to string descs
>    usb: gadget: uvc: Use custom strings if available
>
>   .../ABI/testing/configfs-usb-gadget-uvc       |   50 +-
>   drivers/usb/gadget/function/f_uvc.c           |  134 +-
>   drivers/usb/gadget/function/u_uvc.h           |   22 +
>   drivers/usb/gadget/function/uvc.h             |    1 +
>   drivers/usb/gadget/function/uvc_configfs.c    | 1087 ++++++++++++++++-
>   drivers/usb/gadget/function/uvc_configfs.h    |   60 +
>   6 files changed, 1283 insertions(+), 71 deletions(-)
>
Laurent Pinchart Dec. 29, 2022, 12:18 a.m. UTC | #2
Hi Dan,

On Mon, Nov 21, 2022 at 09:25:08AM +0000, Daniel Scally wrote:
> Hello all
> 
> This series adds support for the definition of extension units in configfs for
> the UVC Gadget. The XUs are modelled as config_items within a new "extensions"
> group under control, which seemed like an appropriate place to put them.
> 
> To allow the XU's to be inserted in the function graph, the bSourceID attribute
> for the default output terminal is made writeable - users will need to configure
> it with the bUnitID of the XU that they want to use as the OT's source. This does
> mean that the XUs can _only_ be placed immediately preceding the OT, but I think
> that that's fine for now.

Is this something that we'll be able to extend later in a
backward-compatible way ?

Please also note that, in general, nothing prevents a device from
exposing multiple XUs, as well as exposing XUs that are not linked in
the IT to OT pipeline. Is this also something we'll be able to support
if needed ?

> Series level changes:
> 
>   - Added patches 5-9 which additionally add the ability to create string
>   descriptors through configfs and link them to the extension units as well as
>   to override the default descriptors for the IAD and VC/VS interfaces
> 
> The XUs configured through this series have been tested via uvc-gadget, uvcvideo
> and uvcdynctrl.

Do you have an example script that shows how to create and link an XU
through configfs ? That would give an overview of the feature, useful
for review.

> Daniel Scally (9):
>   usb: gadget: uvc: Make bSourceID read/write
>   usb: gadget: uvc: Generalise helper functions for reuse
>   usb: gadget: uvc: Allow definition of XUs in configfs
>   usb: gadget: uvc: Copy XU descriptors during .bind()
>   usb: gadget: uvc: Support arbitrary string descriptors
>   usb: gadget: uvc: Allow linking XUs to string descriptors
>   usb: gadget: uvc: Attach custom string descriptors
>   usb: gadget: uvc: Allow linking function to string descs
>   usb: gadget: uvc: Use custom strings if available
> 
>  .../ABI/testing/configfs-usb-gadget-uvc       |   50 +-
>  drivers/usb/gadget/function/f_uvc.c           |  134 +-
>  drivers/usb/gadget/function/u_uvc.h           |   22 +
>  drivers/usb/gadget/function/uvc.h             |    1 +
>  drivers/usb/gadget/function/uvc_configfs.c    | 1087 ++++++++++++++++-
>  drivers/usb/gadget/function/uvc_configfs.h    |   60 +
>  6 files changed, 1283 insertions(+), 71 deletions(-)
Dan Scally Jan. 1, 2023, 8:34 p.m. UTC | #3
Hi Laurent

On 29/12/2022 00:18, Laurent Pinchart wrote:
> Hi Dan,
>
> On Mon, Nov 21, 2022 at 09:25:08AM +0000, Daniel Scally wrote:
>> Hello all
>>
>> This series adds support for the definition of extension units in configfs for
>> the UVC Gadget. The XUs are modelled as config_items within a new "extensions"
>> group under control, which seemed like an appropriate place to put them.
>>
>> To allow the XU's to be inserted in the function graph, the bSourceID attribute
>> for the default output terminal is made writeable - users will need to configure
>> it with the bUnitID of the XU that they want to use as the OT's source. This does
>> mean that the XUs can _only_ be placed immediately preceding the OT, but I think
>> that that's fine for now.
> Is this something that we'll be able to extend later in a
> backward-compatible way ?


Yes...placing the XUs requires users to set the source of the Output 
Terminal and the XU. If we later make them placeable anywhere in the 
chain they'd just have to be set differently, I think it's fine.

>
> Please also note that, in general, nothing prevents a device from
> exposing multiple XUs, as well as exposing XUs that are not linked in
> the IT to OT pipeline. Is this also something we'll be able to support
> if needed ?


I've tried both scenarios already and found no problems.

>> Series level changes:
>>
>>    - Added patches 5-9 which additionally add the ability to create string
>>    descriptors through configfs and link them to the extension units as well as
>>    to override the default descriptors for the IAD and VC/VS interfaces
>>
>> The XUs configured through this series have been tested via uvc-gadget, uvcvideo
>> and uvcdynctrl.
> Do you have an example script that shows how to create and link an XU
> through configfs ? That would give an overview of the feature, useful
> for review.


Yes, but it's not currently public. I can get it updated to the 
uvc-gadget master branch before I'll get round to a v3 of this series so 
I can link it on that submission.

>
>> Daniel Scally (9):
>>    usb: gadget: uvc: Make bSourceID read/write
>>    usb: gadget: uvc: Generalise helper functions for reuse
>>    usb: gadget: uvc: Allow definition of XUs in configfs
>>    usb: gadget: uvc: Copy XU descriptors during .bind()
>>    usb: gadget: uvc: Support arbitrary string descriptors
>>    usb: gadget: uvc: Allow linking XUs to string descriptors
>>    usb: gadget: uvc: Attach custom string descriptors
>>    usb: gadget: uvc: Allow linking function to string descs
>>    usb: gadget: uvc: Use custom strings if available
>>
>>   .../ABI/testing/configfs-usb-gadget-uvc       |   50 +-
>>   drivers/usb/gadget/function/f_uvc.c           |  134 +-
>>   drivers/usb/gadget/function/u_uvc.h           |   22 +
>>   drivers/usb/gadget/function/uvc.h             |    1 +
>>   drivers/usb/gadget/function/uvc_configfs.c    | 1087 ++++++++++++++++-
>>   drivers/usb/gadget/function/uvc_configfs.h    |   60 +
>>   6 files changed, 1283 insertions(+), 71 deletions(-)