Skip to content

Commit 0f99b8b

Browse files
ribaldaHans Verkuil
authored andcommitted
media: uvcvideo: Support UVC_CROSXU_CONTROL_IQ_PROFILE
The ChromeOS XU provides a control to change the IQ profile for a camera. It can be switched from VIVID (a.k.a. standard) to NONE (a.k.a. natural). Wire it up to the standard v4l2 control. Signed-off-by: Ricardo Ribalda <ribalda@chromium.org> Reviewed-by: Hans de Goede <hansg@kernel.org> Signed-off-by: Hans de Goede <hansg@kernel.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
1 parent 04ddfcd commit 0f99b8b

2 files changed

Lines changed: 39 additions & 0 deletions

File tree

drivers/media/usb/uvc/uvc_ctrl.c

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,15 @@ static const struct uvc_control_info uvc_ctrls[] = {
376376
| UVC_CTRL_FLAG_GET_DEF
377377
| UVC_CTRL_FLAG_AUTO_UPDATE,
378378
},
379+
{
380+
.entity = UVC_GUID_CHROMEOS_XU,
381+
.selector = UVC_CROSXU_CONTROL_IQ_PROFILE,
382+
.index = 3,
383+
.size = 1,
384+
.flags = UVC_CTRL_FLAG_SET_CUR
385+
| UVC_CTRL_FLAG_GET_RANGE
386+
| UVC_CTRL_FLAG_RESTORE,
387+
},
379388
};
380389

381390
static const u32 uvc_control_classes[] = {
@@ -384,6 +393,19 @@ static const u32 uvc_control_classes[] = {
384393
};
385394

386395
static const int exposure_auto_mapping[] = { 2, 1, 4, 8 };
396+
static const int cros_colorfx_mapping[] = {
397+
1, /* V4L2_COLORFX_NONE */
398+
-1, /* V4L2_COLORFX_BW */
399+
-1, /* V4L2_COLORFX_SEPIA */
400+
-1, /* V4L2_COLORFX_NEGATIVE */
401+
-1, /* V4L2_COLORFX_EMBOSS */
402+
-1, /* V4L2_COLORFX_SKETCH */
403+
-1, /* V4L2_COLORFX_SKY_BLUE */
404+
-1, /* V4L2_COLORFX_GRASS_GREEN */
405+
-1, /* V4L2_COLORFX_SKIN_WHITEN */
406+
0, /* V4L2_COLORFX_VIVID */
407+
};
408+
387409

388410
static bool uvc_ctrl_mapping_is_compound(struct uvc_control_mapping *mapping)
389411
{
@@ -975,6 +997,18 @@ static const struct uvc_control_mapping uvc_ctrl_mappings[] = {
975997
.data_type = UVC_CTRL_DATA_TYPE_BITMASK,
976998
.name = "Region of Interest Auto Ctrls",
977999
},
1000+
{
1001+
.id = V4L2_CID_COLORFX,
1002+
.entity = UVC_GUID_CHROMEOS_XU,
1003+
.selector = UVC_CROSXU_CONTROL_IQ_PROFILE,
1004+
.size = 8,
1005+
.offset = 0,
1006+
.v4l2_type = V4L2_CTRL_TYPE_MENU,
1007+
.data_type = UVC_CTRL_DATA_TYPE_ENUM,
1008+
.menu_mapping = cros_colorfx_mapping,
1009+
.menu_mask = BIT(V4L2_COLORFX_VIVID) |
1010+
BIT(V4L2_COLORFX_NONE),
1011+
},
9781012
};
9791013

9801014
/* ------------------------------------------------------------------------

include/linux/usb/uvc.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
#define UVC_GUID_EXT_GPIO_CONTROLLER \
3030
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
3131
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03}
32+
#define UVC_GUID_CHROMEOS_XU \
33+
{0x24, 0xe9, 0xd7, 0x74, 0xc9, 0x49, 0x45, 0x4a, \
34+
0x98, 0xa3, 0xc8, 0x07, 0x7e, 0x05, 0x1c, 0xa3}
3235
#define UVC_GUID_MSXU_1_5 \
3336
{0xdc, 0x95, 0x3f, 0x0f, 0x32, 0x26, 0x4e, 0x4c, \
3437
0x92, 0xc9, 0xa0, 0x47, 0x82, 0xf4, 0x3b, 0xc8}
@@ -50,6 +53,8 @@
5053
#define UVC_MSXU_CONTROL_FIELDOFVIEW2_CONFIG 0x0f
5154
#define UVC_MSXU_CONTROL_FIELDOFVIEW2 0x10
5255

56+
#define UVC_CROSXU_CONTROL_IQ_PROFILE 0x04
57+
5358
#define UVC_GUID_FORMAT_MJPEG \
5459
{ 'M', 'J', 'P', 'G', 0x00, 0x00, 0x10, 0x00, \
5560
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}

0 commit comments

Comments
 (0)