Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: vivid: add read-only int32 control

This read-only int32 control is used to test read-only controls in
combination with requests. It is set by the driver to the buffer sequence
counter module 256.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>

authored by

Hans Verkuil and committed by
Mauro Carvalho Chehab
bb65e3d9 83af5738

+20 -4
+1
drivers/media/test-drivers/vivid/vivid-core.h
··· 230 230 struct v4l2_ctrl *string; 231 231 struct v4l2_ctrl *bitmask; 232 232 struct v4l2_ctrl *int_menu; 233 + struct v4l2_ctrl *ro_int32; 233 234 struct v4l2_ctrl *test_pattern; 234 235 struct v4l2_ctrl *colorspace; 235 236 struct v4l2_ctrl *rgb_range_cap;
+13
drivers/media/test-drivers/vivid/vivid-ctrls.c
··· 33 33 #define VIVID_CID_U16_MATRIX (VIVID_CID_CUSTOM_BASE + 9) 34 34 #define VIVID_CID_U8_4D_ARRAY (VIVID_CID_CUSTOM_BASE + 10) 35 35 #define VIVID_CID_AREA (VIVID_CID_CUSTOM_BASE + 11) 36 + #define VIVID_CID_RO_INTEGER (VIVID_CID_CUSTOM_BASE + 12) 36 37 37 38 #define VIVID_CID_VIVID_BASE (0x00f00000 | 0xf000) 38 39 #define VIVID_CID_VIVID_CLASS (0x00f00000 | 1) ··· 290 289 .name = "Area", 291 290 .type = V4L2_CTRL_TYPE_AREA, 292 291 .p_def.p_const = &area, 292 + }; 293 + 294 + static const struct v4l2_ctrl_config vivid_ctrl_ro_int32 = { 295 + .ops = &vivid_user_gen_ctrl_ops, 296 + .id = VIVID_CID_RO_INTEGER, 297 + .name = "Read-Only Integer 32 Bits", 298 + .type = V4L2_CTRL_TYPE_INTEGER, 299 + .flags = V4L2_CTRL_FLAG_READ_ONLY, 300 + .min = 0, 301 + .max = 255, 302 + .step = 1, 293 303 }; 294 304 295 305 /* Framebuffer Controls */ ··· 1613 1601 dev->string = v4l2_ctrl_new_custom(hdl_user_gen, &vivid_ctrl_string, NULL); 1614 1602 dev->bitmask = v4l2_ctrl_new_custom(hdl_user_gen, &vivid_ctrl_bitmask, NULL); 1615 1603 dev->int_menu = v4l2_ctrl_new_custom(hdl_user_gen, &vivid_ctrl_int_menu, NULL); 1604 + dev->ro_int32 = v4l2_ctrl_new_custom(hdl_user_gen, &vivid_ctrl_ro_int32, NULL); 1616 1605 v4l2_ctrl_new_custom(hdl_user_gen, &vivid_ctrl_area, NULL); 1617 1606 v4l2_ctrl_new_custom(hdl_user_gen, &vivid_ctrl_u32_array, NULL); 1618 1607 v4l2_ctrl_new_custom(hdl_user_gen, &vivid_ctrl_u16_matrix, NULL);
+6 -4
drivers/media/test-drivers/vivid/vivid-kthread-cap.c
··· 426 426 is_loop = true; 427 427 428 428 buf->vb.sequence = dev->vid_cap_seq_count; 429 + v4l2_ctrl_s_ctrl(dev->ro_int32, buf->vb.sequence & 0xff); 429 430 if (dev->field_cap == V4L2_FIELD_ALTERNATE) { 430 431 /* 431 432 * 60 Hz standards start with the bottom field, 50 Hz standards ··· 516 515 mutex_unlock(dev->ctrl_hdl_user_aud.lock); 517 516 tpg_gen_text(tpg, basep, line++ * line_height, 16, str); 518 517 mutex_lock(dev->ctrl_hdl_user_gen.lock); 519 - snprintf(str, sizeof(str), " int32 %d, int64 %lld, bitmask %08x ", 520 - dev->int32->cur.val, 521 - *dev->int64->p_cur.p_s64, 522 - dev->bitmask->cur.val); 518 + snprintf(str, sizeof(str), " int32 %d, ro_int32 %d, int64 %lld, bitmask %08x ", 519 + dev->int32->cur.val, 520 + dev->ro_int32->cur.val, 521 + *dev->int64->p_cur.p_s64, 522 + dev->bitmask->cur.val); 523 523 tpg_gen_text(tpg, basep, line++ * line_height, 16, str); 524 524 snprintf(str, sizeof(str), " boolean %d, menu %s, string \"%s\" ", 525 525 dev->boolean->cur.val,