diff options
| author | Ricardo Ribalda <ribalda@chromium.org> | 2024-06-10 23:09:52 +0000 |
|---|---|---|
| committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2024-06-17 23:21:10 +0300 |
| commit | 8f4362a8d42b918e4832037ab3cc6f25de61a080 (patch) | |
| tree | 0666414a249108fc8736bd21772d4657c8f1fad0 /drivers/media/usb/uvc/uvc_ctrl.c | |
| parent | 9e3d55fbd160b3ca376599a68b4cddfdc67d4153 (diff) | |
| download | linux-8f4362a8d42b918e4832037ab3cc6f25de61a080.tar.gz linux-8f4362a8d42b918e4832037ab3cc6f25de61a080.tar.bz2 linux-8f4362a8d42b918e4832037ab3cc6f25de61a080.zip | |
media: uvcvideo: Allow custom control mapping
Some advanced controls might not be completely implemented by vendors.
If the controls are a enumeration, UVC does not gives a way to probe
what is implemented and what is not.
Let's create a new callback function where heuristics can be implemented
to detect what is implemented and what not and update the control
mapping accordingly.
Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Ricardo Ribalda <ribalda@chromium.org>
Diffstat (limited to 'drivers/media/usb/uvc/uvc_ctrl.c')
| -rw-r--r-- | drivers/media/usb/uvc/uvc_ctrl.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c index a7d0ec22d95c..c619370f9afd 100644 --- a/drivers/media/usb/uvc/uvc_ctrl.c +++ b/drivers/media/usb/uvc/uvc_ctrl.c @@ -2659,6 +2659,13 @@ static void uvc_ctrl_init_ctrl(struct uvc_video_chain *chain, for (i = 0; i < ARRAY_SIZE(uvc_ctrl_mappings); ++i) { const struct uvc_control_mapping *mapping = &uvc_ctrl_mappings[i]; + /* Let the device provide a custom mapping. */ + if (mapping->filter_mapping) { + mapping = mapping->filter_mapping(chain, ctrl); + if (!mapping) + continue; + } + if (uvc_entity_match_guid(ctrl->entity, mapping->entity) && ctrl->info.selector == mapping->selector) __uvc_ctrl_add_mapping(chain, ctrl, mapping); |
