vivid: add INTEGER and INTEGER64 test control arrays
authorHans Verkuil <hverkuil-cisco@xs4all.nl>
Thu, 29 Sep 2022 09:15:20 +0000 (11:15 +0200)
committerHans Verkuil <hverkuil-cisco@xs4all.nl>
Mon, 24 Oct 2022 17:03:53 +0000 (19:03 +0200)
Add INTEGER and INTEGER64 control arrays to test support for such controls.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
drivers/media/test-drivers/vivid/vivid-ctrls.c

index 92b1a75..f2b20e2 100644 (file)
@@ -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 */