mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-01 02:36:02 +00:00
media: uvcvideo: Refactor Power Line Frequency limit selection
Move the PLF mapping logic to its own mapping filter function. This commit does not introduce any new functionality to the logic, it is just a preparation patch. 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
8f4362a8d4
commit
a8505ad3be
@ -459,6 +459,51 @@ static void uvc_ctrl_set_rel_speed(struct uvc_control_mapping *mapping,
|
||||
data[first+1] = min_t(int, abs(value), 0xff);
|
||||
}
|
||||
|
||||
const struct uvc_control_mapping uvc_ctrl_power_line_mapping_limited = {
|
||||
.id = V4L2_CID_POWER_LINE_FREQUENCY,
|
||||
.entity = UVC_GUID_UVC_PROCESSING,
|
||||
.selector = UVC_PU_POWER_LINE_FREQUENCY_CONTROL,
|
||||
.size = 2,
|
||||
.offset = 0,
|
||||
.v4l2_type = V4L2_CTRL_TYPE_MENU,
|
||||
.data_type = UVC_CTRL_DATA_TYPE_ENUM,
|
||||
.menu_mask = GENMASK(V4L2_CID_POWER_LINE_FREQUENCY_60HZ,
|
||||
V4L2_CID_POWER_LINE_FREQUENCY_50HZ),
|
||||
};
|
||||
|
||||
const struct uvc_control_mapping uvc_ctrl_power_line_mapping_uvc11 = {
|
||||
.id = V4L2_CID_POWER_LINE_FREQUENCY,
|
||||
.entity = UVC_GUID_UVC_PROCESSING,
|
||||
.selector = UVC_PU_POWER_LINE_FREQUENCY_CONTROL,
|
||||
.size = 2,
|
||||
.offset = 0,
|
||||
.v4l2_type = V4L2_CTRL_TYPE_MENU,
|
||||
.data_type = UVC_CTRL_DATA_TYPE_ENUM,
|
||||
.menu_mask = GENMASK(V4L2_CID_POWER_LINE_FREQUENCY_60HZ,
|
||||
V4L2_CID_POWER_LINE_FREQUENCY_DISABLED),
|
||||
};
|
||||
|
||||
static const struct uvc_control_mapping uvc_ctrl_power_line_mapping_uvc15 = {
|
||||
.id = V4L2_CID_POWER_LINE_FREQUENCY,
|
||||
.entity = UVC_GUID_UVC_PROCESSING,
|
||||
.selector = UVC_PU_POWER_LINE_FREQUENCY_CONTROL,
|
||||
.size = 2,
|
||||
.offset = 0,
|
||||
.v4l2_type = V4L2_CTRL_TYPE_MENU,
|
||||
.data_type = UVC_CTRL_DATA_TYPE_ENUM,
|
||||
.menu_mask = GENMASK(V4L2_CID_POWER_LINE_FREQUENCY_AUTO,
|
||||
V4L2_CID_POWER_LINE_FREQUENCY_DISABLED),
|
||||
};
|
||||
|
||||
static const struct uvc_control_mapping *uvc_ctrl_filter_plf_mapping(
|
||||
struct uvc_video_chain *chain, struct uvc_control *ctrl)
|
||||
{
|
||||
if (chain->dev->uvc_version < 0x150)
|
||||
return &uvc_ctrl_power_line_mapping_uvc11;
|
||||
else
|
||||
return &uvc_ctrl_power_line_mapping_uvc15;
|
||||
}
|
||||
|
||||
static const struct uvc_control_mapping uvc_ctrl_mappings[] = {
|
||||
{
|
||||
.id = V4L2_CID_BRIGHTNESS,
|
||||
@ -748,51 +793,18 @@ static const struct uvc_control_mapping uvc_ctrl_mappings[] = {
|
||||
.v4l2_type = V4L2_CTRL_TYPE_BOOLEAN,
|
||||
.data_type = UVC_CTRL_DATA_TYPE_BOOLEAN,
|
||||
},
|
||||
};
|
||||
|
||||
const struct uvc_control_mapping uvc_ctrl_power_line_mapping_limited = {
|
||||
.id = V4L2_CID_POWER_LINE_FREQUENCY,
|
||||
.entity = UVC_GUID_UVC_PROCESSING,
|
||||
.selector = UVC_PU_POWER_LINE_FREQUENCY_CONTROL,
|
||||
.size = 2,
|
||||
.offset = 0,
|
||||
.v4l2_type = V4L2_CTRL_TYPE_MENU,
|
||||
.data_type = UVC_CTRL_DATA_TYPE_ENUM,
|
||||
.menu_mask = GENMASK(V4L2_CID_POWER_LINE_FREQUENCY_60HZ,
|
||||
V4L2_CID_POWER_LINE_FREQUENCY_50HZ),
|
||||
};
|
||||
|
||||
const struct uvc_control_mapping uvc_ctrl_power_line_mapping_uvc11 = {
|
||||
.id = V4L2_CID_POWER_LINE_FREQUENCY,
|
||||
.entity = UVC_GUID_UVC_PROCESSING,
|
||||
.selector = UVC_PU_POWER_LINE_FREQUENCY_CONTROL,
|
||||
.size = 2,
|
||||
.offset = 0,
|
||||
.v4l2_type = V4L2_CTRL_TYPE_MENU,
|
||||
.data_type = UVC_CTRL_DATA_TYPE_ENUM,
|
||||
.menu_mask = GENMASK(V4L2_CID_POWER_LINE_FREQUENCY_60HZ,
|
||||
V4L2_CID_POWER_LINE_FREQUENCY_DISABLED),
|
||||
{
|
||||
.entity = UVC_GUID_UVC_PROCESSING,
|
||||
.selector = UVC_PU_POWER_LINE_FREQUENCY_CONTROL,
|
||||
.filter_mapping = uvc_ctrl_filter_plf_mapping,
|
||||
},
|
||||
};
|
||||
|
||||
static const struct uvc_control_mapping *uvc_ctrl_mappings_uvc11[] = {
|
||||
&uvc_ctrl_power_line_mapping_uvc11,
|
||||
NULL, /* Sentinel */
|
||||
};
|
||||
|
||||
static const struct uvc_control_mapping uvc_ctrl_power_line_mapping_uvc15 = {
|
||||
.id = V4L2_CID_POWER_LINE_FREQUENCY,
|
||||
.entity = UVC_GUID_UVC_PROCESSING,
|
||||
.selector = UVC_PU_POWER_LINE_FREQUENCY_CONTROL,
|
||||
.size = 2,
|
||||
.offset = 0,
|
||||
.v4l2_type = V4L2_CTRL_TYPE_MENU,
|
||||
.data_type = UVC_CTRL_DATA_TYPE_ENUM,
|
||||
.menu_mask = GENMASK(V4L2_CID_POWER_LINE_FREQUENCY_AUTO,
|
||||
V4L2_CID_POWER_LINE_FREQUENCY_DISABLED),
|
||||
};
|
||||
|
||||
static const struct uvc_control_mapping *uvc_ctrl_mappings_uvc15[] = {
|
||||
&uvc_ctrl_power_line_mapping_uvc15,
|
||||
NULL, /* Sentinel */
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user