mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
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>
This commit is contained in:
parent
9e3d55fbd1
commit
8f4362a8d4
2 changed files with 12 additions and 0 deletions
|
@ -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) {
|
for (i = 0; i < ARRAY_SIZE(uvc_ctrl_mappings); ++i) {
|
||||||
const struct uvc_control_mapping *mapping = &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) &&
|
if (uvc_entity_match_guid(ctrl->entity, mapping->entity) &&
|
||||||
ctrl->info.selector == mapping->selector)
|
ctrl->info.selector == mapping->selector)
|
||||||
__uvc_ctrl_add_mapping(chain, ctrl, mapping);
|
__uvc_ctrl_add_mapping(chain, ctrl, mapping);
|
||||||
|
|
|
@ -87,7 +87,9 @@
|
||||||
|
|
||||||
struct gpio_desc;
|
struct gpio_desc;
|
||||||
struct sg_table;
|
struct sg_table;
|
||||||
|
struct uvc_control;
|
||||||
struct uvc_device;
|
struct uvc_device;
|
||||||
|
struct uvc_video_chain;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TODO: Put the most frequently accessed fields at the beginning of
|
* TODO: Put the most frequently accessed fields at the beginning of
|
||||||
|
@ -126,6 +128,9 @@ struct uvc_control_mapping {
|
||||||
s32 master_manual;
|
s32 master_manual;
|
||||||
u32 slave_ids[2];
|
u32 slave_ids[2];
|
||||||
|
|
||||||
|
const struct uvc_control_mapping *(*filter_mapping)
|
||||||
|
(struct uvc_video_chain *chain,
|
||||||
|
struct uvc_control *ctrl);
|
||||||
s32 (*get)(struct uvc_control_mapping *mapping, u8 query,
|
s32 (*get)(struct uvc_control_mapping *mapping, u8 query,
|
||||||
const u8 *data);
|
const u8 *data);
|
||||||
void (*set)(struct uvc_control_mapping *mapping, s32 value,
|
void (*set)(struct uvc_control_mapping *mapping, s32 value,
|
||||||
|
|
Loading…
Add table
Reference in a new issue