All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v6 0/7] usb: gadget: uvc: use configfs entries for negotiation and v4l2 VIDIOCS
@ 2022-01-05 11:55 Michael Grzeschik
  2022-01-05 11:55 ` [PATCH v6 1/7] media: v4l: move helper functions for fractions from uvc to v4l2-common Michael Grzeschik
                   ` (7 more replies)
  0 siblings, 8 replies; 20+ messages in thread
From: Michael Grzeschik @ 2022-01-05 11:55 UTC (permalink / raw)
  To: linux-usb; +Cc: balbi, laurent.pinchart, paul.elder, kernel

This series improves the uvc video gadget by parsing the configfs
entries. With the configfs data, the driver now is able to negotiate the
format with the usb host in the kernel and also exports the supported
frames/formats/intervals via the v4l2 VIDIOC interface.

The uvc userspace stack is also under development. One example is an generic
v4l2uvcsink gstreamer elemnt, which is currently under duiscussion. [1]

[1] https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1304

With the libusbgx library [1] used by the gadget-tool [2] it is now also
possible to fully describe the configfs layout of the uvc gadget with scheme
files.

[2] https://github.com/linux-usb-gadgets/libusbgx/pull/61/commits/53231c76f9d512f59fdc23b65cd5c46b7fb09eb4

[3] https://github.com/linux-usb-gadgets/gt/tree/master/examples/systemd

The bigger picture of these patches is to provide a more versatile interface to
the uvc gadget. The goal is to simply start a uvc-gadget with the following
commands:

$ gt load uvc.scheme
$ gst-launch v4l2src ! v4l2uvcsink

--

v1: https://lore.kernel.org/linux-usb/20210530222239.8793-1-m.grzeschik@pengutronix.de/
v2: https://lore.kernel.org/linux-usb/20211117004432.3763306-1-m.grzeschik@pengutronix.de/
v3: https://lore.kernel.org/linux-usb/20211117122435.2409362-1-m.grzeschik@pengutronix.de/
v4: https://lore.kernel.org/linux-usb/20211205225803.268492-1-m.grzeschik@pengutronix.de/
v5: https://lore.kernel.org/linux-usb/20211209084322.2662616-1-m.grzeschik@pengutronix.de/

Regards,
Michael

Michael Grzeschik (7):
  media: v4l: move helper functions for fractions from uvc to
    v4l2-common
  media: uvcvideo: move uvc_format_desc to common header
  usb: gadget: uvc: prevent index variables to start from 0
  usb: gadget: uvc: move structs to common header
  usb: gadget: uvc: track frames in format entries
  usb: gadget: uvc: add VIDIOC function
  usb: gadget: uvc: add format/frame handling code

 drivers/media/usb/uvc/uvc_ctrl.c           |   1 +
 drivers/media/usb/uvc/uvc_driver.c         | 281 +-------------
 drivers/media/usb/uvc/uvc_v4l2.c           |  14 +-
 drivers/media/usb/uvc/uvcvideo.h           | 144 --------
 drivers/media/v4l2-core/v4l2-common.c      |  82 +++++
 drivers/usb/gadget/function/f_uvc.c        | 263 +++++++++++++-
 drivers/usb/gadget/function/uvc.h          |  38 +-
 drivers/usb/gadget/function/uvc_configfs.c | 148 ++------
 drivers/usb/gadget/function/uvc_configfs.h | 120 +++++-
 drivers/usb/gadget/function/uvc_queue.c    |   3 +-
 drivers/usb/gadget/function/uvc_v4l2.c     | 404 ++++++++++++++++++---
 drivers/usb/gadget/function/uvc_video.c    |  71 +++-
 include/media/v4l2-common.h                |   4 +
 include/media/v4l2-uvc.h                   | 351 ++++++++++++++++++
 14 files changed, 1319 insertions(+), 605 deletions(-)
 create mode 100644 include/media/v4l2-uvc.h

-- 
2.30.2


^ permalink raw reply	[flat|nested] 20+ messages in thread
* Re: [PATCH v6 6/7] usb: gadget: uvc: add VIDIOC function
  2022-01-05 11:55 ` [PATCH v6 6/7] usb: gadget: uvc: add VIDIOC function Michael Grzeschik
@ 2022-01-10  7:04 ` Dan Carpenter
  -1 siblings, 0 replies; 20+ messages in thread
From: kernel test robot @ 2022-01-08 18:23 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 7943 bytes --]

CC: kbuild-all(a)lists.01.org
In-Reply-To: <20220105115527.3592860-7-m.grzeschik@pengutronix.de>
References: <20220105115527.3592860-7-m.grzeschik@pengutronix.de>
TO: Michael Grzeschik <m.grzeschik@pengutronix.de>

Hi Michael,

I love your patch! Perhaps something to improve:

[auto build test WARNING on media-tree/master]
[also build test WARNING on usb/usb-testing peter-chen-usb/for-usb-next v5.16-rc8 next-20220107]
[cannot apply to balbi-usb/testing/next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Michael-Grzeschik/usb-gadget-uvc-use-configfs-entries-for-negotiation-and-v4l2-VIDIOCS/20220105-195807
base:   git://linuxtv.org/media_tree.git master
:::::: branch date: 3 days ago
:::::: commit date: 3 days ago
config: i386-randconfig-m021-20220107 (https://download.01.org/0day-ci/archive/20220109/202201090204.9HpxUP5B-lkp(a)intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
drivers/usb/gadget/function/f_uvc.c:983 uvc_alloc() warn: inconsistent returns '&opts->lock'.

vim +983 drivers/usb/gadget/function/f_uvc.c

6d11ed76c45dd7 Andrzej Pietrasiewicz 2014-09-09  909  
4a6698b80cfe36 Fengguang Wu          2014-09-16  910  static struct usb_function *uvc_alloc(struct usb_function_instance *fi)
6d11ed76c45dd7 Andrzej Pietrasiewicz 2014-09-09  911  {
6d11ed76c45dd7 Andrzej Pietrasiewicz 2014-09-09  912  	struct uvc_device *uvc;
6d11ed76c45dd7 Andrzej Pietrasiewicz 2014-09-09  913  	struct f_uvc_opts *opts;
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  914  	struct uvc_descriptor_header **strm_cls;
90866d89b13da2 Michael Grzeschik     2022-01-05  915  	struct config_item *streaming, *header, *h;
6d11ed76c45dd7 Andrzej Pietrasiewicz 2014-09-09  916  
6d11ed76c45dd7 Andrzej Pietrasiewicz 2014-09-09  917  	uvc = kzalloc(sizeof(*uvc), GFP_KERNEL);
6d11ed76c45dd7 Andrzej Pietrasiewicz 2014-09-09  918  	if (uvc == NULL)
6d11ed76c45dd7 Andrzej Pietrasiewicz 2014-09-09  919  		return ERR_PTR(-ENOMEM);
6d11ed76c45dd7 Andrzej Pietrasiewicz 2014-09-09  920  
d8e96c4bf6e3cd Hans Verkuil          2015-02-17  921  	mutex_init(&uvc->video.mutex);
6d11ed76c45dd7 Andrzej Pietrasiewicz 2014-09-09  922  	uvc->state = UVC_STATE_DISCONNECTED;
bbea6de1bd12dd Andrzej Pietrasiewicz 2014-12-10  923  	opts = fi_to_f_uvc_opts(fi);
6d11ed76c45dd7 Andrzej Pietrasiewicz 2014-09-09  924  
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  925  	mutex_lock(&opts->lock);
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  926  	if (opts->uvc_fs_streaming_cls) {
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  927  		strm_cls = opts->uvc_fs_streaming_cls;
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  928  		opts->fs_streaming =
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  929  			(const struct uvc_descriptor_header * const *)strm_cls;
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  930  	}
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  931  	if (opts->uvc_hs_streaming_cls) {
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  932  		strm_cls = opts->uvc_hs_streaming_cls;
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  933  		opts->hs_streaming =
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  934  			(const struct uvc_descriptor_header * const *)strm_cls;
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  935  	}
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  936  	if (opts->uvc_ss_streaming_cls) {
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  937  		strm_cls = opts->uvc_ss_streaming_cls;
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  938  		opts->ss_streaming =
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  939  			(const struct uvc_descriptor_header * const *)strm_cls;
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  940  	}
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  941  
6d11ed76c45dd7 Andrzej Pietrasiewicz 2014-09-09  942  	uvc->desc.fs_control = opts->fs_control;
6d11ed76c45dd7 Andrzej Pietrasiewicz 2014-09-09  943  	uvc->desc.ss_control = opts->ss_control;
6d11ed76c45dd7 Andrzej Pietrasiewicz 2014-09-09  944  	uvc->desc.fs_streaming = opts->fs_streaming;
6d11ed76c45dd7 Andrzej Pietrasiewicz 2014-09-09  945  	uvc->desc.hs_streaming = opts->hs_streaming;
6d11ed76c45dd7 Andrzej Pietrasiewicz 2014-09-09  946  	uvc->desc.ss_streaming = opts->ss_streaming;
90866d89b13da2 Michael Grzeschik     2022-01-05  947  
90866d89b13da2 Michael Grzeschik     2022-01-05  948  	streaming = config_group_find_item(&opts->func_inst.group, "streaming");
90866d89b13da2 Michael Grzeschik     2022-01-05  949  	if (!streaming) {
90866d89b13da2 Michael Grzeschik     2022-01-05  950  		config_item_put(streaming);
90866d89b13da2 Michael Grzeschik     2022-01-05  951  		return ERR_PTR(-ENOMEM);
90866d89b13da2 Michael Grzeschik     2022-01-05  952  	}
90866d89b13da2 Michael Grzeschik     2022-01-05  953  	header = config_group_find_item(to_config_group(streaming), "header");
90866d89b13da2 Michael Grzeschik     2022-01-05  954  	config_item_put(streaming);
90866d89b13da2 Michael Grzeschik     2022-01-05  955  	if (!header) {
90866d89b13da2 Michael Grzeschik     2022-01-05  956  		config_item_put(header);
90866d89b13da2 Michael Grzeschik     2022-01-05  957  		return ERR_PTR(-ENOMEM);
90866d89b13da2 Michael Grzeschik     2022-01-05  958  	}
90866d89b13da2 Michael Grzeschik     2022-01-05  959  	h = config_group_find_item(to_config_group(header), "h");
90866d89b13da2 Michael Grzeschik     2022-01-05  960  	config_item_put(header);
90866d89b13da2 Michael Grzeschik     2022-01-05  961  	if (!h) {
90866d89b13da2 Michael Grzeschik     2022-01-05  962  		config_item_put(h);
90866d89b13da2 Michael Grzeschik     2022-01-05  963  		return ERR_PTR(-ENOMEM);
90866d89b13da2 Michael Grzeschik     2022-01-05  964  	}
90866d89b13da2 Michael Grzeschik     2022-01-05  965  	uvc->header = to_uvcg_streaming_header(h);
90866d89b13da2 Michael Grzeschik     2022-01-05  966  	if (!uvc->header->linked)
90866d89b13da2 Michael Grzeschik     2022-01-05  967  		return ERR_PTR(-EBUSY);
90866d89b13da2 Michael Grzeschik     2022-01-05  968  
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  969  	++opts->refcnt;
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  970  	mutex_unlock(&opts->lock);
6d11ed76c45dd7 Andrzej Pietrasiewicz 2014-09-09  971  
6d11ed76c45dd7 Andrzej Pietrasiewicz 2014-09-09  972  	/* Register the function. */
6d11ed76c45dd7 Andrzej Pietrasiewicz 2014-09-09  973  	uvc->func.name = "uvc";
6d11ed76c45dd7 Andrzej Pietrasiewicz 2014-09-09  974  	uvc->func.bind = uvc_function_bind;
e6bab2b66329b4 Michael Tretter       2021-10-17  975  	uvc->func.unbind = uvc_function_unbind;
6d11ed76c45dd7 Andrzej Pietrasiewicz 2014-09-09  976  	uvc->func.get_alt = uvc_function_get_alt;
6d11ed76c45dd7 Andrzej Pietrasiewicz 2014-09-09  977  	uvc->func.set_alt = uvc_function_set_alt;
6d11ed76c45dd7 Andrzej Pietrasiewicz 2014-09-09  978  	uvc->func.disable = uvc_function_disable;
6d11ed76c45dd7 Andrzej Pietrasiewicz 2014-09-09  979  	uvc->func.setup = uvc_function_setup;
6d11ed76c45dd7 Andrzej Pietrasiewicz 2014-09-09  980  	uvc->func.free_func = uvc_free;
f277bf27cf5cd5 Robert Baldyga        2015-05-04  981  	uvc->func.bind_deactivated = true;
6d11ed76c45dd7 Andrzej Pietrasiewicz 2014-09-09  982  
6d11ed76c45dd7 Andrzej Pietrasiewicz 2014-09-09 @983  	return &uvc->func;
6d11ed76c45dd7 Andrzej Pietrasiewicz 2014-09-09  984  }
6d11ed76c45dd7 Andrzej Pietrasiewicz 2014-09-09  985  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2022-03-15 14:36 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-05 11:55 [PATCH v6 0/7] usb: gadget: uvc: use configfs entries for negotiation and v4l2 VIDIOCS Michael Grzeschik
2022-01-05 11:55 ` [PATCH v6 1/7] media: v4l: move helper functions for fractions from uvc to v4l2-common Michael Grzeschik
2022-03-15 14:25   ` Greg KH
2022-03-15 14:36     ` Michael Grzeschik
2022-01-05 11:55 ` [PATCH v6 2/7] media: uvcvideo: move uvc_format_desc to common header Michael Grzeschik
2022-01-05 11:55 ` [PATCH v6 3/7] usb: gadget: uvc: prevent index variables to start from 0 Michael Grzeschik
2022-01-05 11:55 ` [PATCH v6 4/7] usb: gadget: uvc: move structs to common header Michael Grzeschik
2022-01-05 11:55 ` [PATCH v6 5/7] usb: gadget: uvc: track frames in format entries Michael Grzeschik
2022-01-05 11:55 ` [PATCH v6 6/7] usb: gadget: uvc: add VIDIOC function Michael Grzeschik
2022-01-05 11:55 ` [PATCH v6 7/7] usb: gadget: uvc: add format/frame handling code Michael Grzeschik
2022-01-06 22:23 ` [PATCH v6 0/7] usb: gadget: uvc: use configfs entries for negotiation and v4l2 VIDIOCS Michael Grzeschik
2022-01-07  9:24   ` Kieran Bingham
2022-01-26 13:22     ` [PATCH] dummy_hcd: add isoc support Michael Grzeschik
2022-01-26 16:09       ` Alan Stern
2022-01-26 18:31         ` Michael Grzeschik
2022-01-31 12:08           ` Kieran Bingham
2022-01-31 12:43             ` Greg KH
2022-01-31 15:32             ` Alan Stern
2022-01-08 18:23 [PATCH v6 6/7] usb: gadget: uvc: add VIDIOC function kernel test robot
2022-01-10  7:04 ` Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.