Commit 395ed025 authored by Hans Verkuil's avatar Hans Verkuil
Browse files

vivid: add INTEGER and INTEGER64 test control arrays



Add INTEGER and INTEGER64 control arrays to test support for such controls.

Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
parent e77eb663
Loading
Loading
Loading
Loading
+28 −0
Original line number Diff line number Diff line
@@ -36,6 +36,8 @@
#define VIVID_CID_RO_INTEGER		(VIVID_CID_CUSTOM_BASE + 12)
#define VIVID_CID_U32_DYN_ARRAY		(VIVID_CID_CUSTOM_BASE + 13)
#define VIVID_CID_U8_PIXEL_ARRAY	(VIVID_CID_CUSTOM_BASE + 14)
#define VIVID_CID_S32_ARRAY		(VIVID_CID_CUSTOM_BASE + 15)
#define VIVID_CID_S64_ARRAY		(VIVID_CID_CUSTOM_BASE + 16)

#define VIVID_CID_VIVID_BASE		(0x00f00000 | 0xf000)
#define VIVID_CID_VIVID_CLASS		(0x00f00000 | 1)
@@ -241,6 +243,30 @@ static const struct v4l2_ctrl_config vivid_ctrl_u8_pixel_array = {
	.dims = { 640 / PIXEL_ARRAY_DIV, 360 / PIXEL_ARRAY_DIV },
};

static const struct v4l2_ctrl_config vivid_ctrl_s32_array = {
	.ops = &vivid_user_gen_ctrl_ops,
	.id = VIVID_CID_S32_ARRAY,
	.name = "S32 2 Element Array",
	.type = V4L2_CTRL_TYPE_INTEGER,
	.def = 2,
	.min = -10,
	.max = 10,
	.step = 1,
	.dims = { 2 },
};

static const struct v4l2_ctrl_config vivid_ctrl_s64_array = {
	.ops = &vivid_user_gen_ctrl_ops,
	.id = VIVID_CID_S64_ARRAY,
	.name = "S64 5 Element Array",
	.type = V4L2_CTRL_TYPE_INTEGER64,
	.def = 4,
	.min = -10,
	.max = 10,
	.step = 1,
	.dims = { 5 },
};

static const char * const vivid_ctrl_menu_strings[] = {
	"Menu Item 0 (Skipped)",
	"Menu Item 1",
@@ -1656,6 +1682,8 @@ int vivid_create_controls(struct vivid_dev *dev, bool show_ccs_cap,
	v4l2_ctrl_new_custom(hdl_user_gen, &vivid_ctrl_u16_matrix, NULL);
	v4l2_ctrl_new_custom(hdl_user_gen, &vivid_ctrl_u8_4d_array, NULL);
	dev->pixel_array = v4l2_ctrl_new_custom(hdl_user_gen, &vivid_ctrl_u8_pixel_array, NULL);
	v4l2_ctrl_new_custom(hdl_user_gen, &vivid_ctrl_s32_array, NULL);
	v4l2_ctrl_new_custom(hdl_user_gen, &vivid_ctrl_s64_array, NULL);

	if (dev->has_vid_cap) {
		/* Image Processing Controls */