Lines Matching +full:sdtv +full:- +full:standards

1 // SPDX-License-Identifier: GPL-2.0-only
3 * vivid-ctrls.c - control support functions.
11 #include <media/v4l2-event.h>
12 #include <media/v4l2-common.h>
14 #include "vivid-core.h"
15 #include "vivid-vid-cap.h"
16 #include "vivid-vid-out.h"
17 #include "vivid-vid-common.h"
18 #include "vivid-radio-common.h"
19 #include "vivid-osd.h"
20 #include "vivid-ctrls.h"
104 /* HDMI inputs are in the range 0-14. The next available CID is VIVID_CID_VIVID_BASE + 128 */
107 /* S-Video inputs are in the range 0-15. The next available CID is VIVID_CID_VIVID_BASE + 144 */
116 clear_bit(V4L2_FL_REGISTERED, &vdev->flags); in vivid_unregister_dev()
122 struct vivid_dev *dev = container_of(ctrl->handler, struct vivid_dev, ctrl_hdl_user_gen); in vivid_user_gen_s_ctrl()
124 switch (ctrl->id) { in vivid_user_gen_s_ctrl()
126 v4l2_info(&dev->v4l2_dev, "disconnect\n"); in vivid_user_gen_s_ctrl()
127 dev->disconnect_error = true; in vivid_user_gen_s_ctrl()
128 vivid_unregister_dev(dev->has_vid_cap, &dev->vid_cap_dev); in vivid_user_gen_s_ctrl()
129 vivid_unregister_dev(dev->has_vid_out, &dev->vid_out_dev); in vivid_user_gen_s_ctrl()
130 vivid_unregister_dev(dev->has_vbi_cap, &dev->vbi_cap_dev); in vivid_user_gen_s_ctrl()
131 vivid_unregister_dev(dev->has_vbi_out, &dev->vbi_out_dev); in vivid_user_gen_s_ctrl()
132 vivid_unregister_dev(dev->has_radio_rx, &dev->radio_rx_dev); in vivid_user_gen_s_ctrl()
133 vivid_unregister_dev(dev->has_radio_tx, &dev->radio_tx_dev); in vivid_user_gen_s_ctrl()
134 vivid_unregister_dev(dev->has_sdr_cap, &dev->sdr_cap_dev); in vivid_user_gen_s_ctrl()
135 vivid_unregister_dev(dev->has_meta_cap, &dev->meta_cap_dev); in vivid_user_gen_s_ctrl()
136 vivid_unregister_dev(dev->has_meta_out, &dev->meta_out_dev); in vivid_user_gen_s_ctrl()
137 vivid_unregister_dev(dev->has_touch_cap, &dev->touch_cap_dev); in vivid_user_gen_s_ctrl()
140 dev->button_pressed = 30; in vivid_user_gen_s_ctrl()
255 .min = -10,
267 .min = -10,
355 .name = "Read-Only Integer 32 Bits",
367 struct vivid_dev *dev = container_of(ctrl->handler, in vivid_fb_s_ctrl()
370 switch (ctrl->id) { in vivid_fb_s_ctrl()
394 struct vivid_dev *dev = container_of(ctrl->handler, struct vivid_dev, ctrl_hdl_user_vid); in vivid_user_vid_g_volatile_ctrl()
396 switch (ctrl->id) { in vivid_user_vid_g_volatile_ctrl()
398 dev->gain->val = (jiffies_to_msecs(jiffies) / 1000) & 0xff; in vivid_user_vid_g_volatile_ctrl()
406 struct vivid_dev *dev = container_of(ctrl->handler, struct vivid_dev, ctrl_hdl_user_vid); in vivid_user_vid_s_ctrl()
408 switch (ctrl->id) { in vivid_user_vid_s_ctrl()
410 dev->input_brightness[dev->input] = ctrl->val - dev->input * 128; in vivid_user_vid_s_ctrl()
411 tpg_s_brightness(&dev->tpg, dev->input_brightness[dev->input]); in vivid_user_vid_s_ctrl()
414 tpg_s_contrast(&dev->tpg, ctrl->val); in vivid_user_vid_s_ctrl()
417 tpg_s_saturation(&dev->tpg, ctrl->val); in vivid_user_vid_s_ctrl()
420 tpg_s_hue(&dev->tpg, ctrl->val); in vivid_user_vid_s_ctrl()
423 dev->hflip = ctrl->val; in vivid_user_vid_s_ctrl()
424 tpg_s_hflip(&dev->tpg, dev->sensor_hflip ^ dev->hflip); in vivid_user_vid_s_ctrl()
427 dev->vflip = ctrl->val; in vivid_user_vid_s_ctrl()
428 tpg_s_vflip(&dev->tpg, dev->sensor_vflip ^ dev->vflip); in vivid_user_vid_s_ctrl()
431 tpg_s_alpha_component(&dev->tpg, ctrl->val); in vivid_user_vid_s_ctrl()
449 dev->power_present = 0; in vivid_update_power_present()
451 i < ARRAY_SIZE(dev->dv_timings_signal_mode); i++) { in vivid_update_power_present()
452 if (dev->input_type[i] != HDMI) in vivid_update_power_present()
458 if (dev->input_is_connected_to_output[i] != 1 && in vivid_update_power_present()
459 dev->dv_timings_signal_mode[i] != NO_SIGNAL) in vivid_update_power_present()
460 dev->power_present |= (1 << j); in vivid_update_power_present()
464 __v4l2_ctrl_s_ctrl(dev->ctrl_rx_power_present, in vivid_update_power_present()
465 dev->power_present); in vivid_update_power_present()
467 v4l2_ctrl_activate(dev->ctrl_dv_timings, in vivid_update_power_present()
468 dev->dv_timings_signal_mode[dev->input] == in vivid_update_power_present()
485 struct vivid_dev *dev = container_of(ctrl->handler, struct vivid_dev, ctrl_hdl_vid_cap); in vivid_vid_cap_s_ctrl()
492 switch (ctrl->id) { in vivid_vid_cap_s_ctrl()
495 tpg_s_pattern(&dev->tpg, ctrl->val); in vivid_vid_cap_s_ctrl()
498 tpg_s_colorspace(&dev->tpg, colorspaces[ctrl->val]); in vivid_vid_cap_s_ctrl()
505 tpg_s_xfer_func(&dev->tpg, ctrl->val); in vivid_vid_cap_s_ctrl()
512 tpg_s_ycbcr_enc(&dev->tpg, ctrl->val); in vivid_vid_cap_s_ctrl()
519 tpg_s_hsv_enc(&dev->tpg, ctrl->val ? V4L2_HSV_ENC_256 : in vivid_vid_cap_s_ctrl()
527 tpg_s_quantization(&dev->tpg, ctrl->val); in vivid_vid_cap_s_ctrl()
536 tpg_s_rgb_range(&dev->tpg, ctrl->val); in vivid_vid_cap_s_ctrl()
539 tpg_s_real_rgb_range(&dev->tpg, ctrl->val ? in vivid_vid_cap_s_ctrl()
543 tpg_s_alpha_mode(&dev->tpg, ctrl->val); in vivid_vid_cap_s_ctrl()
546 tpg_s_mv_hor_mode(&dev->tpg, ctrl->val); in vivid_vid_cap_s_ctrl()
549 tpg_s_mv_vert_mode(&dev->tpg, ctrl->val); in vivid_vid_cap_s_ctrl()
552 dev->osd_mode = ctrl->val; in vivid_vid_cap_s_ctrl()
555 tpg_s_perc_fill(&dev->tpg, ctrl->val); in vivid_vid_cap_s_ctrl()
557 dev->must_blank[i] = ctrl->val < 100; in vivid_vid_cap_s_ctrl()
560 tpg_s_insert_sav(&dev->tpg, ctrl->val); in vivid_vid_cap_s_ctrl()
563 tpg_s_insert_eav(&dev->tpg, ctrl->val); in vivid_vid_cap_s_ctrl()
566 tpg_s_insert_hdmi_video_guard_band(&dev->tpg, ctrl->val); in vivid_vid_cap_s_ctrl()
569 dev->sensor_hflip = ctrl->val; in vivid_vid_cap_s_ctrl()
570 tpg_s_hflip(&dev->tpg, dev->sensor_hflip ^ dev->hflip); in vivid_vid_cap_s_ctrl()
573 dev->sensor_vflip = ctrl->val; in vivid_vid_cap_s_ctrl()
574 tpg_s_vflip(&dev->tpg, dev->sensor_vflip ^ dev->vflip); in vivid_vid_cap_s_ctrl()
577 dev->reduced_fps = ctrl->val; in vivid_vid_cap_s_ctrl()
581 dev->has_crop_cap = ctrl->val; in vivid_vid_cap_s_ctrl()
585 dev->has_compose_cap = ctrl->val; in vivid_vid_cap_s_ctrl()
589 dev->has_scaler_cap = ctrl->val; in vivid_vid_cap_s_ctrl()
593 tpg_s_show_border(&dev->tpg, ctrl->val); in vivid_vid_cap_s_ctrl()
596 tpg_s_show_square(&dev->tpg, ctrl->val); in vivid_vid_cap_s_ctrl()
599 dev->std_aspect_ratio[dev->input] = ctrl->val; in vivid_vid_cap_s_ctrl()
600 tpg_s_video_aspect(&dev->tpg, vivid_get_video_aspect(dev)); in vivid_vid_cap_s_ctrl()
603 dev->dv_timings_signal_mode[dev->input] = in vivid_vid_cap_s_ctrl()
604 dev->ctrl_dv_timings_signal_mode->val; in vivid_vid_cap_s_ctrl()
605 dev->query_dv_timings[dev->input] = dev->ctrl_dv_timings->val; in vivid_vid_cap_s_ctrl()
608 vivid_send_input_source_change(dev, dev->input); in vivid_vid_cap_s_ctrl()
611 dev->dv_timings_aspect_ratio[dev->input] = ctrl->val; in vivid_vid_cap_s_ctrl()
612 tpg_s_video_aspect(&dev->tpg, vivid_get_video_aspect(dev)); in vivid_vid_cap_s_ctrl()
615 dev->tstamp_src_is_soe = ctrl->val; in vivid_vid_cap_s_ctrl()
616 dev->vb_vid_cap_q.timestamp_flags &= ~V4L2_BUF_FLAG_TSTAMP_SRC_MASK; in vivid_vid_cap_s_ctrl()
617 if (dev->tstamp_src_is_soe) in vivid_vid_cap_s_ctrl()
618 dev->vb_vid_cap_q.timestamp_flags |= V4L2_BUF_FLAG_TSTAMP_SRC_SOE; in vivid_vid_cap_s_ctrl()
621 dev->edid_max_blocks = ctrl->val; in vivid_vid_cap_s_ctrl()
622 if (dev->edid_blocks > dev->edid_max_blocks) in vivid_vid_cap_s_ctrl()
623 dev->edid_blocks = dev->edid_max_blocks; in vivid_vid_cap_s_ctrl()
626 hdmi_index = ctrl->id - VIVID_CID_HDMI_IS_CONNECTED_TO_OUTPUT(0); in vivid_vid_cap_s_ctrl()
627 output_inst = vivid_ctrl_hdmi_to_output_instance[ctrl->cur.val]; in vivid_vid_cap_s_ctrl()
628 index = vivid_ctrl_hdmi_to_output_index[ctrl->cur.val]; in vivid_vid_cap_s_ctrl()
629 input_index = dev->hdmi_index_to_input_index[hdmi_index]; in vivid_vid_cap_s_ctrl()
630 dev->input_is_connected_to_output[input_index] = ctrl->val; in vivid_vid_cap_s_ctrl()
633 output_inst->output_to_input_instance[index] = NULL; in vivid_vid_cap_s_ctrl()
635 cec_phys_addr_invalidate(output_inst->cec_tx_adap[index]); in vivid_vid_cap_s_ctrl()
637 if (ctrl->val >= FIXED_MENU_ITEMS) { in vivid_vid_cap_s_ctrl()
638 output_inst = vivid_ctrl_hdmi_to_output_instance[ctrl->val]; in vivid_vid_cap_s_ctrl()
639 index = vivid_ctrl_hdmi_to_output_index[ctrl->val]; in vivid_vid_cap_s_ctrl()
640 output_inst->output_to_input_instance[index] = dev; in vivid_vid_cap_s_ctrl()
641 output_inst->output_to_input_index[index] = in vivid_vid_cap_s_ctrl()
642 dev->hdmi_index_to_input_index[hdmi_index]; in vivid_vid_cap_s_ctrl()
645 hdmi_to_output_menu_skip_mask &= ~(1ULL << ctrl->cur.val); in vivid_vid_cap_s_ctrl()
646 if (ctrl->val >= FIXED_MENU_ITEMS) in vivid_vid_cap_s_ctrl()
647 hdmi_to_output_menu_skip_mask |= 1ULL << ctrl->val; in vivid_vid_cap_s_ctrl()
651 vivid_send_input_source_change(dev, dev->hdmi_index_to_input_index[hdmi_index]); in vivid_vid_cap_s_ctrl()
652 if (ctrl->val < FIXED_MENU_ITEMS && ctrl->cur.val < FIXED_MENU_ITEMS) in vivid_vid_cap_s_ctrl()
655 hdmi_input_update_outputs_mask |= 1 << dev->inst; in vivid_vid_cap_s_ctrl()
657 queue_work(update_hdmi_ctrls_workqueue, &dev->update_hdmi_ctrl_work); in vivid_vid_cap_s_ctrl()
660 svid_index = ctrl->id - VIVID_CID_SVID_IS_CONNECTED_TO_OUTPUT(0); in vivid_vid_cap_s_ctrl()
661 output_inst = vivid_ctrl_svid_to_output_instance[ctrl->cur.val]; in vivid_vid_cap_s_ctrl()
662 index = vivid_ctrl_svid_to_output_index[ctrl->cur.val]; in vivid_vid_cap_s_ctrl()
663 input_index = dev->svid_index_to_input_index[svid_index]; in vivid_vid_cap_s_ctrl()
664 dev->input_is_connected_to_output[input_index] = ctrl->val; in vivid_vid_cap_s_ctrl()
667 output_inst->output_to_input_instance[index] = NULL; in vivid_vid_cap_s_ctrl()
668 if (ctrl->val >= FIXED_MENU_ITEMS) { in vivid_vid_cap_s_ctrl()
669 output_inst = vivid_ctrl_svid_to_output_instance[ctrl->val]; in vivid_vid_cap_s_ctrl()
670 index = vivid_ctrl_svid_to_output_index[ctrl->val]; in vivid_vid_cap_s_ctrl()
671 output_inst->output_to_input_instance[index] = dev; in vivid_vid_cap_s_ctrl()
672 output_inst->output_to_input_index[index] = in vivid_vid_cap_s_ctrl()
673 dev->svid_index_to_input_index[svid_index]; in vivid_vid_cap_s_ctrl()
676 svid_to_output_menu_skip_mask &= ~(1ULL << ctrl->cur.val); in vivid_vid_cap_s_ctrl()
677 if (ctrl->val >= FIXED_MENU_ITEMS) in vivid_vid_cap_s_ctrl()
678 svid_to_output_menu_skip_mask |= 1ULL << ctrl->val; in vivid_vid_cap_s_ctrl()
681 vivid_send_input_source_change(dev, dev->svid_index_to_input_index[svid_index]); in vivid_vid_cap_s_ctrl()
682 if (ctrl->val < FIXED_MENU_ITEMS && ctrl->cur.val < FIXED_MENU_ITEMS) in vivid_vid_cap_s_ctrl()
684 queue_work(update_svid_ctrls_workqueue, &dev->update_svid_ctrl_work); in vivid_vid_cap_s_ctrl()
766 .max = ARRAY_SIZE(vivid_ctrl_osd_mode_strings) - 2,
876 .max = ARRAY_SIZE(vivid_ctrl_tstamp_src_strings) - 2,
937 "DCI-P3",
949 .max = ARRAY_SIZE(vivid_ctrl_colorspace_strings) - 2,
961 "DCI-P3",
971 .max = ARRAY_SIZE(vivid_ctrl_xfer_func_strings) - 2,
977 "ITU-R 601",
994 .max = ARRAY_SIZE(vivid_ctrl_ycbcr_enc_strings) - 2,
999 "Hue 0-179",
1000 "Hue 0-256",
1009 .max = ARRAY_SIZE(vivid_ctrl_hsv_enc_strings) - 2,
1025 .max = ARRAY_SIZE(vivid_ctrl_quantization_strings) - 2,
1041 .name = "Limited RGB Range (16-235)",
1052 struct vivid_dev *dev = container_of(ctrl->handler, struct vivid_dev, ctrl_hdl_vbi_cap); in vivid_vbi_cap_s_ctrl()
1054 switch (ctrl->id) { in vivid_vbi_cap_s_ctrl()
1056 dev->vbi_cap_interlaced = ctrl->val; in vivid_vbi_cap_s_ctrl()
1080 struct vivid_dev *dev = container_of(ctrl->handler, struct vivid_dev, ctrl_hdl_vid_out); in vivid_vid_out_s_ctrl()
1081 struct v4l2_bt_timings *bt = &dev->dv_timings_out.bt; in vivid_vid_out_s_ctrl()
1083 switch (ctrl->id) { in vivid_vid_out_s_ctrl()
1085 dev->has_crop_out = ctrl->val; in vivid_vid_out_s_ctrl()
1089 dev->has_compose_out = ctrl->val; in vivid_vid_out_s_ctrl()
1093 dev->has_scaler_out = ctrl->val; in vivid_vid_out_s_ctrl()
1097 dev->dvi_d_out = ctrl->val == V4L2_DV_TX_MODE_DVI_D; in vivid_vid_out_s_ctrl()
1100 if (!dev->dvi_d_out && (bt->flags & V4L2_DV_FL_IS_CE_VIDEO)) { in vivid_vid_out_s_ctrl()
1101 if (bt->width == 720 && bt->height <= 576) in vivid_vid_out_s_ctrl()
1102 dev->colorspace_out = V4L2_COLORSPACE_SMPTE170M; in vivid_vid_out_s_ctrl()
1104 dev->colorspace_out = V4L2_COLORSPACE_REC709; in vivid_vid_out_s_ctrl()
1105 dev->quantization_out = V4L2_QUANTIZATION_DEFAULT; in vivid_vid_out_s_ctrl()
1107 dev->colorspace_out = V4L2_COLORSPACE_SRGB; in vivid_vid_out_s_ctrl()
1108 dev->quantization_out = dev->dvi_d_out ? in vivid_vid_out_s_ctrl()
1160 struct vivid_dev *dev = container_of(ctrl->handler, struct vivid_dev, ctrl_hdl_streaming); in vivid_streaming_s_ctrl()
1162 switch (ctrl->id) { in vivid_streaming_s_ctrl()
1164 dev->dqbuf_error = true; in vivid_streaming_s_ctrl()
1167 dev->perc_dropped_buffers = ctrl->val; in vivid_streaming_s_ctrl()
1170 dev->queue_setup_error = true; in vivid_streaming_s_ctrl()
1173 dev->buf_prepare_error = true; in vivid_streaming_s_ctrl()
1176 dev->start_streaming_error = true; in vivid_streaming_s_ctrl()
1179 dev->req_validate_error = true; in vivid_streaming_s_ctrl()
1182 if (vb2_start_streaming_called(&dev->vb_vid_cap_q)) in vivid_streaming_s_ctrl()
1183 vb2_queue_error(&dev->vb_vid_cap_q); in vivid_streaming_s_ctrl()
1184 if (vb2_start_streaming_called(&dev->vb_vbi_cap_q)) in vivid_streaming_s_ctrl()
1185 vb2_queue_error(&dev->vb_vbi_cap_q); in vivid_streaming_s_ctrl()
1186 if (vb2_start_streaming_called(&dev->vb_vid_out_q)) in vivid_streaming_s_ctrl()
1187 vb2_queue_error(&dev->vb_vid_out_q); in vivid_streaming_s_ctrl()
1188 if (vb2_start_streaming_called(&dev->vb_vbi_out_q)) in vivid_streaming_s_ctrl()
1189 vb2_queue_error(&dev->vb_vbi_out_q); in vivid_streaming_s_ctrl()
1190 if (vb2_start_streaming_called(&dev->vb_sdr_cap_q)) in vivid_streaming_s_ctrl()
1191 vb2_queue_error(&dev->vb_sdr_cap_q); in vivid_streaming_s_ctrl()
1194 dev->seq_wrap = ctrl->val; in vivid_streaming_s_ctrl()
1197 dev->time_wrap = ctrl->val; in vivid_streaming_s_ctrl()
1198 if (dev->time_wrap == 1) in vivid_streaming_s_ctrl()
1199 dev->time_wrap = (1ULL << 63) - NSEC_PER_SEC * 16ULL; in vivid_streaming_s_ctrl()
1200 else if (dev->time_wrap == 2) in vivid_streaming_s_ctrl()
1201 dev->time_wrap = ((1ULL << 31) - 16) * NSEC_PER_SEC; in vivid_streaming_s_ctrl()
1286 .max = ARRAY_SIZE(vivid_ctrl_time_wrap_strings) - 2,
1291 /* SDTV Capture Controls */
1295 struct vivid_dev *dev = container_of(ctrl->handler, struct vivid_dev, ctrl_hdl_sdtv_cap); in vivid_sdtv_cap_s_ctrl()
1297 switch (ctrl->id) { in vivid_sdtv_cap_s_ctrl()
1299 dev->std_signal_mode[dev->input] = in vivid_sdtv_cap_s_ctrl()
1300 dev->ctrl_std_signal_mode->val; in vivid_sdtv_cap_s_ctrl()
1301 if (dev->std_signal_mode[dev->input] == SELECTED_STD) in vivid_sdtv_cap_s_ctrl()
1302 dev->query_std[dev->input] = in vivid_sdtv_cap_s_ctrl()
1303 vivid_standard[dev->ctrl_standard->val]; in vivid_sdtv_cap_s_ctrl()
1304 v4l2_ctrl_activate(dev->ctrl_standard, in vivid_sdtv_cap_s_ctrl()
1305 dev->std_signal_mode[dev->input] == in vivid_sdtv_cap_s_ctrl()
1325 "Cycle Through All Standards",
1334 .max = ARRAY_SIZE(vivid_ctrl_std_signal_mode_strings) - 2,
1354 struct vivid_dev *dev = container_of(ctrl->handler, struct vivid_dev, ctrl_hdl_radio_rx); in vivid_radio_rx_s_ctrl()
1356 switch (ctrl->id) { in vivid_radio_rx_s_ctrl()
1358 dev->radio_rx_hw_seek_mode = ctrl->val; in vivid_radio_rx_s_ctrl()
1361 dev->radio_rx_hw_seek_prog_lim = ctrl->val; in vivid_radio_rx_s_ctrl()
1364 dev->rds_gen.use_rbds = ctrl->val; in vivid_radio_rx_s_ctrl()
1367 dev->radio_rx_rds_controls = ctrl->val; in vivid_radio_rx_s_ctrl()
1368 dev->radio_rx_caps &= ~V4L2_CAP_READWRITE; in vivid_radio_rx_s_ctrl()
1369 dev->radio_rx_rds_use_alternates = false; in vivid_radio_rx_s_ctrl()
1370 if (!dev->radio_rx_rds_controls) { in vivid_radio_rx_s_ctrl()
1371 dev->radio_rx_caps |= V4L2_CAP_READWRITE; in vivid_radio_rx_s_ctrl()
1372 __v4l2_ctrl_s_ctrl(dev->radio_rx_rds_pty, 0); in vivid_radio_rx_s_ctrl()
1373 __v4l2_ctrl_s_ctrl(dev->radio_rx_rds_ta, 0); in vivid_radio_rx_s_ctrl()
1374 __v4l2_ctrl_s_ctrl(dev->radio_rx_rds_tp, 0); in vivid_radio_rx_s_ctrl()
1375 __v4l2_ctrl_s_ctrl(dev->radio_rx_rds_ms, 0); in vivid_radio_rx_s_ctrl()
1376 __v4l2_ctrl_s_ctrl_string(dev->radio_rx_rds_psname, ""); in vivid_radio_rx_s_ctrl()
1377 __v4l2_ctrl_s_ctrl_string(dev->radio_rx_rds_radiotext, ""); in vivid_radio_rx_s_ctrl()
1379 v4l2_ctrl_activate(dev->radio_rx_rds_pty, dev->radio_rx_rds_controls); in vivid_radio_rx_s_ctrl()
1380 v4l2_ctrl_activate(dev->radio_rx_rds_psname, dev->radio_rx_rds_controls); in vivid_radio_rx_s_ctrl()
1381 v4l2_ctrl_activate(dev->radio_rx_rds_radiotext, dev->radio_rx_rds_controls); in vivid_radio_rx_s_ctrl()
1382 v4l2_ctrl_activate(dev->radio_rx_rds_ta, dev->radio_rx_rds_controls); in vivid_radio_rx_s_ctrl()
1383 v4l2_ctrl_activate(dev->radio_rx_rds_tp, dev->radio_rx_rds_controls); in vivid_radio_rx_s_ctrl()
1384 v4l2_ctrl_activate(dev->radio_rx_rds_ms, dev->radio_rx_rds_controls); in vivid_radio_rx_s_ctrl()
1385 dev->radio_rx_dev.device_caps = dev->radio_rx_caps; in vivid_radio_rx_s_ctrl()
1388 dev->radio_rx_rds_enabled = ctrl->val; in vivid_radio_rx_s_ctrl()
1452 struct vivid_dev *dev = container_of(ctrl->handler, struct vivid_dev, ctrl_hdl_radio_tx); in vivid_radio_tx_s_ctrl()
1454 switch (ctrl->id) { in vivid_radio_tx_s_ctrl()
1456 dev->radio_tx_rds_controls = ctrl->val; in vivid_radio_tx_s_ctrl()
1457 dev->radio_tx_caps &= ~V4L2_CAP_READWRITE; in vivid_radio_tx_s_ctrl()
1458 if (!dev->radio_tx_rds_controls) in vivid_radio_tx_s_ctrl()
1459 dev->radio_tx_caps |= V4L2_CAP_READWRITE; in vivid_radio_tx_s_ctrl()
1460 dev->radio_tx_dev.device_caps = dev->radio_tx_caps; in vivid_radio_tx_s_ctrl()
1463 if (dev->radio_rx_rds_controls) in vivid_radio_tx_s_ctrl()
1464 v4l2_ctrl_s_ctrl(dev->radio_rx_rds_pty, ctrl->val); in vivid_radio_tx_s_ctrl()
1467 if (dev->radio_rx_rds_controls) in vivid_radio_tx_s_ctrl()
1468 v4l2_ctrl_s_ctrl_string(dev->radio_rx_rds_psname, ctrl->p_new.p_char); in vivid_radio_tx_s_ctrl()
1471 if (dev->radio_rx_rds_controls) in vivid_radio_tx_s_ctrl()
1472 v4l2_ctrl_s_ctrl_string(dev->radio_rx_rds_radiotext, ctrl->p_new.p_char); in vivid_radio_tx_s_ctrl()
1475 if (dev->radio_rx_rds_controls) in vivid_radio_tx_s_ctrl()
1476 v4l2_ctrl_s_ctrl(dev->radio_rx_rds_ta, ctrl->val); in vivid_radio_tx_s_ctrl()
1479 if (dev->radio_rx_rds_controls) in vivid_radio_tx_s_ctrl()
1480 v4l2_ctrl_s_ctrl(dev->radio_rx_rds_tp, ctrl->val); in vivid_radio_tx_s_ctrl()
1483 if (dev->radio_rx_rds_controls) in vivid_radio_tx_s_ctrl()
1484 v4l2_ctrl_s_ctrl(dev->radio_rx_rds_ms, ctrl->val); in vivid_radio_tx_s_ctrl()
1509 struct vivid_dev *dev = container_of(ctrl->handler, struct vivid_dev, ctrl_hdl_sdr_cap); in vivid_sdr_cap_s_ctrl()
1511 switch (ctrl->id) { in vivid_sdr_cap_s_ctrl()
1513 dev->sdr_fm_deviation = ctrl->val; in vivid_sdr_cap_s_ctrl()
1538 struct vivid_dev *dev = container_of(ctrl->handler, struct vivid_dev, in vivid_meta_cap_s_ctrl()
1541 switch (ctrl->id) { in vivid_meta_cap_s_ctrl()
1543 dev->meta_pts = ctrl->val; in vivid_meta_cap_s_ctrl()
1546 dev->meta_scr = ctrl->val; in vivid_meta_cap_s_ctrl()
1588 struct v4l2_ctrl_handler *hdl_user_gen = &dev->ctrl_hdl_user_gen; in vivid_create_controls()
1589 struct v4l2_ctrl_handler *hdl_user_vid = &dev->ctrl_hdl_user_vid; in vivid_create_controls()
1590 struct v4l2_ctrl_handler *hdl_user_aud = &dev->ctrl_hdl_user_aud; in vivid_create_controls()
1591 struct v4l2_ctrl_handler *hdl_streaming = &dev->ctrl_hdl_streaming; in vivid_create_controls()
1592 struct v4l2_ctrl_handler *hdl_sdtv_cap = &dev->ctrl_hdl_sdtv_cap; in vivid_create_controls()
1593 struct v4l2_ctrl_handler *hdl_loop_cap = &dev->ctrl_hdl_loop_cap; in vivid_create_controls()
1594 struct v4l2_ctrl_handler *hdl_fb = &dev->ctrl_hdl_fb; in vivid_create_controls()
1595 struct v4l2_ctrl_handler *hdl_vid_cap = &dev->ctrl_hdl_vid_cap; in vivid_create_controls()
1596 struct v4l2_ctrl_handler *hdl_vid_out = &dev->ctrl_hdl_vid_out; in vivid_create_controls()
1597 struct v4l2_ctrl_handler *hdl_vbi_cap = &dev->ctrl_hdl_vbi_cap; in vivid_create_controls()
1598 struct v4l2_ctrl_handler *hdl_vbi_out = &dev->ctrl_hdl_vbi_out; in vivid_create_controls()
1599 struct v4l2_ctrl_handler *hdl_radio_rx = &dev->ctrl_hdl_radio_rx; in vivid_create_controls()
1600 struct v4l2_ctrl_handler *hdl_radio_tx = &dev->ctrl_hdl_radio_tx; in vivid_create_controls()
1601 struct v4l2_ctrl_handler *hdl_sdr_cap = &dev->ctrl_hdl_sdr_cap; in vivid_create_controls()
1602 struct v4l2_ctrl_handler *hdl_meta_cap = &dev->ctrl_hdl_meta_cap; in vivid_create_controls()
1603 struct v4l2_ctrl_handler *hdl_meta_out = &dev->ctrl_hdl_meta_out; in vivid_create_controls()
1604 struct v4l2_ctrl_handler *hdl_tch_cap = &dev->ctrl_hdl_touch_cap; in vivid_create_controls()
1631 if (!no_error_inj || dev->has_fb || dev->num_hdmi_outputs) in vivid_create_controls()
1652 dev->volume = v4l2_ctrl_new_std(hdl_user_aud, NULL, in vivid_create_controls()
1654 dev->mute = v4l2_ctrl_new_std(hdl_user_aud, NULL, in vivid_create_controls()
1656 if (dev->has_vid_cap) { in vivid_create_controls()
1657 dev->brightness = v4l2_ctrl_new_std(hdl_user_vid, &vivid_user_vid_ctrl_ops, in vivid_create_controls()
1660 dev->input_brightness[i] = 128; in vivid_create_controls()
1661 dev->contrast = v4l2_ctrl_new_std(hdl_user_vid, &vivid_user_vid_ctrl_ops, in vivid_create_controls()
1663 dev->saturation = v4l2_ctrl_new_std(hdl_user_vid, &vivid_user_vid_ctrl_ops, in vivid_create_controls()
1665 dev->hue = v4l2_ctrl_new_std(hdl_user_vid, &vivid_user_vid_ctrl_ops, in vivid_create_controls()
1666 V4L2_CID_HUE, -128, 128, 1, 0); in vivid_create_controls()
1671 dev->autogain = v4l2_ctrl_new_std(hdl_user_vid, &vivid_user_vid_ctrl_ops, in vivid_create_controls()
1673 dev->gain = v4l2_ctrl_new_std(hdl_user_vid, &vivid_user_vid_ctrl_ops, in vivid_create_controls()
1675 dev->alpha = v4l2_ctrl_new_std(hdl_user_vid, &vivid_user_vid_ctrl_ops, in vivid_create_controls()
1678 dev->button = v4l2_ctrl_new_custom(hdl_user_gen, &vivid_ctrl_button, NULL); in vivid_create_controls()
1679 dev->int32 = v4l2_ctrl_new_custom(hdl_user_gen, &vivid_ctrl_int32, NULL); in vivid_create_controls()
1680 dev->int64 = v4l2_ctrl_new_custom(hdl_user_gen, &vivid_ctrl_int64, NULL); in vivid_create_controls()
1681 dev->boolean = v4l2_ctrl_new_custom(hdl_user_gen, &vivid_ctrl_boolean, NULL); in vivid_create_controls()
1682 dev->menu = v4l2_ctrl_new_custom(hdl_user_gen, &vivid_ctrl_menu, NULL); in vivid_create_controls()
1683 dev->string = v4l2_ctrl_new_custom(hdl_user_gen, &vivid_ctrl_string, NULL); in vivid_create_controls()
1684 dev->bitmask = v4l2_ctrl_new_custom(hdl_user_gen, &vivid_ctrl_bitmask, NULL); in vivid_create_controls()
1685 dev->int_menu = v4l2_ctrl_new_custom(hdl_user_gen, &vivid_ctrl_int_menu, NULL); in vivid_create_controls()
1686 dev->ro_int32 = v4l2_ctrl_new_custom(hdl_user_gen, &vivid_ctrl_ro_int32, NULL); in vivid_create_controls()
1692 dev->pixel_array = v4l2_ctrl_new_custom(hdl_user_gen, &vivid_ctrl_u8_pixel_array, NULL); in vivid_create_controls()
1696 if (dev->has_vid_cap) { in vivid_create_controls()
1707 dev->test_pattern = v4l2_ctrl_new_custom(hdl_vid_cap, in vivid_create_controls()
1722 WARN_ON(dev->num_hdmi_inputs > MAX_HDMI_INPUTS); in vivid_create_controls()
1723 WARN_ON(dev->num_svid_inputs > MAX_SVID_INPUTS); in vivid_create_controls()
1725 for (u8 i = 0; i < dev->num_hdmi_inputs; i++) { in vivid_create_controls()
1726 snprintf(dev->ctrl_hdmi_to_output_names[i], in vivid_create_controls()
1727 sizeof(dev->ctrl_hdmi_to_output_names[i]), in vivid_create_controls()
1728 "HDMI %03u-%u Is Connected To", dev->inst, i); in vivid_create_controls()
1731 for (u8 i = 0; i < dev->num_hdmi_inputs; i++) { in vivid_create_controls()
1735 .name = dev->ctrl_hdmi_to_output_names[i], in vivid_create_controls()
1740 dev->ctrl_hdmi_to_output[i] = v4l2_ctrl_new_custom(hdl_vid_cap, in vivid_create_controls()
1744 for (u8 i = 0; i < dev->num_svid_inputs; i++) { in vivid_create_controls()
1745 snprintf(dev->ctrl_svid_to_output_names[i], in vivid_create_controls()
1746 sizeof(dev->ctrl_svid_to_output_names[i]), in vivid_create_controls()
1747 "S-Video %03u-%u Is Connected To", dev->inst, i); in vivid_create_controls()
1750 for (u8 i = 0; i < dev->num_svid_inputs; i++) { in vivid_create_controls()
1754 .name = dev->ctrl_svid_to_output_names[i], in vivid_create_controls()
1759 dev->ctrl_svid_to_output[i] = v4l2_ctrl_new_custom(hdl_vid_cap, in vivid_create_controls()
1764 dev->ctrl_has_crop_cap = v4l2_ctrl_new_custom(hdl_vid_cap, in vivid_create_controls()
1766 dev->ctrl_has_compose_cap = v4l2_ctrl_new_custom(hdl_vid_cap, in vivid_create_controls()
1768 dev->ctrl_has_scaler_cap = v4l2_ctrl_new_custom(hdl_vid_cap, in vivid_create_controls()
1773 dev->colorspace = v4l2_ctrl_new_custom(hdl_vid_cap, in vivid_create_controls()
1782 if (dev->has_vid_out && show_ccs_out) { in vivid_create_controls()
1783 dev->ctrl_has_crop_out = v4l2_ctrl_new_custom(hdl_vid_out, in vivid_create_controls()
1785 dev->ctrl_has_compose_out = v4l2_ctrl_new_custom(hdl_vid_out, in vivid_create_controls()
1787 dev->ctrl_has_scaler_out = v4l2_ctrl_new_custom(hdl_vid_out, in vivid_create_controls()
1792 * Testing this driver with v4l2-compliance will trigger the error in vivid_create_controls()
1812 if (has_sdtv && (dev->has_vid_cap || dev->has_vbi_cap)) { in vivid_create_controls()
1813 if (dev->has_vid_cap) in vivid_create_controls()
1815 dev->ctrl_std_signal_mode = v4l2_ctrl_new_custom(hdl_sdtv_cap, in vivid_create_controls()
1817 dev->ctrl_standard = v4l2_ctrl_new_custom(hdl_sdtv_cap, in vivid_create_controls()
1819 if (dev->ctrl_std_signal_mode) in vivid_create_controls()
1820 v4l2_ctrl_cluster(2, &dev->ctrl_std_signal_mode); in vivid_create_controls()
1821 if (dev->has_raw_vbi_cap) in vivid_create_controls()
1825 if (dev->num_hdmi_inputs) { in vivid_create_controls()
1826 s64 hdmi_input_mask = GENMASK(dev->num_hdmi_inputs - 1, 0); in vivid_create_controls()
1828 dev->ctrl_dv_timings_signal_mode = v4l2_ctrl_new_custom(hdl_vid_cap, in vivid_create_controls()
1831 vivid_ctrl_dv_timings.max = dev->query_dv_timings_size - 1; in vivid_create_controls()
1833 (const char * const *)dev->query_dv_timings_qmenu; in vivid_create_controls()
1834 dev->ctrl_dv_timings = v4l2_ctrl_new_custom(hdl_vid_cap, in vivid_create_controls()
1836 if (dev->ctrl_dv_timings_signal_mode) in vivid_create_controls()
1837 v4l2_ctrl_cluster(2, &dev->ctrl_dv_timings_signal_mode); in vivid_create_controls()
1841 dev->real_rgb_range_cap = v4l2_ctrl_new_custom(hdl_vid_cap, in vivid_create_controls()
1843 dev->rgb_range_cap = v4l2_ctrl_new_std_menu(hdl_vid_cap, in vivid_create_controls()
1847 dev->ctrl_rx_power_present = v4l2_ctrl_new_std(hdl_vid_cap, in vivid_create_controls()
1852 if (dev->num_hdmi_outputs) { in vivid_create_controls()
1853 s64 hdmi_output_mask = GENMASK(dev->num_hdmi_outputs - 1, 0); in vivid_create_controls()
1859 dev->ctrl_tx_rgb_range = v4l2_ctrl_new_std_menu(hdl_vid_out, NULL, in vivid_create_controls()
1862 dev->ctrl_tx_mode = v4l2_ctrl_new_std_menu(hdl_vid_out, NULL, in vivid_create_controls()
1865 dev->ctrl_tx_hotplug = v4l2_ctrl_new_std(hdl_vid_out, NULL, in vivid_create_controls()
1867 dev->ctrl_tx_rxsense = v4l2_ctrl_new_std(hdl_vid_out, NULL, in vivid_create_controls()
1869 dev->ctrl_tx_edid_present = v4l2_ctrl_new_std(hdl_vid_out, NULL, in vivid_create_controls()
1873 if (dev->has_fb) in vivid_create_controls()
1876 if (dev->has_radio_rx) { in vivid_create_controls()
1883 dev->radio_rx_rds_pty = v4l2_ctrl_new_std(hdl_radio_rx, in vivid_create_controls()
1886 dev->radio_rx_rds_psname = v4l2_ctrl_new_std(hdl_radio_rx, in vivid_create_controls()
1889 dev->radio_rx_rds_radiotext = v4l2_ctrl_new_std(hdl_radio_rx, in vivid_create_controls()
1892 dev->radio_rx_rds_ta = v4l2_ctrl_new_std(hdl_radio_rx, in vivid_create_controls()
1895 dev->radio_rx_rds_tp = v4l2_ctrl_new_std(hdl_radio_rx, in vivid_create_controls()
1898 dev->radio_rx_rds_ms = v4l2_ctrl_new_std(hdl_radio_rx, in vivid_create_controls()
1902 if (dev->has_radio_tx) { in vivid_create_controls()
1905 dev->radio_tx_rds_pi = v4l2_ctrl_new_std(hdl_radio_tx, in vivid_create_controls()
1908 dev->radio_tx_rds_pty = v4l2_ctrl_new_std(hdl_radio_tx, in vivid_create_controls()
1911 dev->radio_tx_rds_psname = v4l2_ctrl_new_std(hdl_radio_tx, in vivid_create_controls()
1914 if (dev->radio_tx_rds_psname) in vivid_create_controls()
1915 v4l2_ctrl_s_ctrl_string(dev->radio_tx_rds_psname, "VIVID-TX"); in vivid_create_controls()
1916 dev->radio_tx_rds_radiotext = v4l2_ctrl_new_std(hdl_radio_tx, in vivid_create_controls()
1919 if (dev->radio_tx_rds_radiotext) in vivid_create_controls()
1920 v4l2_ctrl_s_ctrl_string(dev->radio_tx_rds_radiotext, in vivid_create_controls()
1922 dev->radio_tx_rds_mono_stereo = v4l2_ctrl_new_std(hdl_radio_tx, in vivid_create_controls()
1925 dev->radio_tx_rds_art_head = v4l2_ctrl_new_std(hdl_radio_tx, in vivid_create_controls()
1928 dev->radio_tx_rds_compressed = v4l2_ctrl_new_std(hdl_radio_tx, in vivid_create_controls()
1931 dev->radio_tx_rds_dyn_pty = v4l2_ctrl_new_std(hdl_radio_tx, in vivid_create_controls()
1934 dev->radio_tx_rds_ta = v4l2_ctrl_new_std(hdl_radio_tx, in vivid_create_controls()
1937 dev->radio_tx_rds_tp = v4l2_ctrl_new_std(hdl_radio_tx, in vivid_create_controls()
1940 dev->radio_tx_rds_ms = v4l2_ctrl_new_std(hdl_radio_tx, in vivid_create_controls()
1944 if (dev->has_sdr_cap) { in vivid_create_controls()
1948 if (dev->has_meta_cap) { in vivid_create_controls()
1955 if (hdl_user_gen->error) in vivid_create_controls()
1956 return hdl_user_gen->error; in vivid_create_controls()
1957 if (hdl_user_vid->error) in vivid_create_controls()
1958 return hdl_user_vid->error; in vivid_create_controls()
1959 if (hdl_user_aud->error) in vivid_create_controls()
1960 return hdl_user_aud->error; in vivid_create_controls()
1961 if (hdl_streaming->error) in vivid_create_controls()
1962 return hdl_streaming->error; in vivid_create_controls()
1963 if (hdl_sdr_cap->error) in vivid_create_controls()
1964 return hdl_sdr_cap->error; in vivid_create_controls()
1965 if (hdl_loop_cap->error) in vivid_create_controls()
1966 return hdl_loop_cap->error; in vivid_create_controls()
1968 if (dev->autogain) in vivid_create_controls()
1969 v4l2_ctrl_auto_cluster(2, &dev->autogain, 0, true); in vivid_create_controls()
1971 if (dev->has_vid_cap) { in vivid_create_controls()
1979 if (hdl_vid_cap->error) in vivid_create_controls()
1980 return hdl_vid_cap->error; in vivid_create_controls()
1981 dev->vid_cap_dev.ctrl_handler = hdl_vid_cap; in vivid_create_controls()
1983 if (dev->has_vid_out) { in vivid_create_controls()
1988 if (hdl_vid_out->error) in vivid_create_controls()
1989 return hdl_vid_out->error; in vivid_create_controls()
1990 dev->vid_out_dev.ctrl_handler = hdl_vid_out; in vivid_create_controls()
1992 if (dev->has_vbi_cap) { in vivid_create_controls()
1997 if (hdl_vbi_cap->error) in vivid_create_controls()
1998 return hdl_vbi_cap->error; in vivid_create_controls()
1999 dev->vbi_cap_dev.ctrl_handler = hdl_vbi_cap; in vivid_create_controls()
2001 if (dev->has_vbi_out) { in vivid_create_controls()
2004 if (hdl_vbi_out->error) in vivid_create_controls()
2005 return hdl_vbi_out->error; in vivid_create_controls()
2006 dev->vbi_out_dev.ctrl_handler = hdl_vbi_out; in vivid_create_controls()
2008 if (dev->has_radio_rx) { in vivid_create_controls()
2011 if (hdl_radio_rx->error) in vivid_create_controls()
2012 return hdl_radio_rx->error; in vivid_create_controls()
2013 dev->radio_rx_dev.ctrl_handler = hdl_radio_rx; in vivid_create_controls()
2015 if (dev->has_radio_tx) { in vivid_create_controls()
2018 if (hdl_radio_tx->error) in vivid_create_controls()
2019 return hdl_radio_tx->error; in vivid_create_controls()
2020 dev->radio_tx_dev.ctrl_handler = hdl_radio_tx; in vivid_create_controls()
2022 if (dev->has_sdr_cap) { in vivid_create_controls()
2025 if (hdl_sdr_cap->error) in vivid_create_controls()
2026 return hdl_sdr_cap->error; in vivid_create_controls()
2027 dev->sdr_cap_dev.ctrl_handler = hdl_sdr_cap; in vivid_create_controls()
2029 if (dev->has_meta_cap) { in vivid_create_controls()
2032 if (hdl_meta_cap->error) in vivid_create_controls()
2033 return hdl_meta_cap->error; in vivid_create_controls()
2034 dev->meta_cap_dev.ctrl_handler = hdl_meta_cap; in vivid_create_controls()
2036 if (dev->has_meta_out) { in vivid_create_controls()
2039 if (hdl_meta_out->error) in vivid_create_controls()
2040 return hdl_meta_out->error; in vivid_create_controls()
2041 dev->meta_out_dev.ctrl_handler = hdl_meta_out; in vivid_create_controls()
2043 if (dev->has_touch_cap) { in vivid_create_controls()
2046 if (hdl_tch_cap->error) in vivid_create_controls()
2047 return hdl_tch_cap->error; in vivid_create_controls()
2048 dev->touch_cap_dev.ctrl_handler = hdl_tch_cap; in vivid_create_controls()
2055 v4l2_ctrl_handler_free(&dev->ctrl_hdl_vid_cap); in vivid_free_controls()
2056 v4l2_ctrl_handler_free(&dev->ctrl_hdl_vid_out); in vivid_free_controls()
2057 v4l2_ctrl_handler_free(&dev->ctrl_hdl_vbi_cap); in vivid_free_controls()
2058 v4l2_ctrl_handler_free(&dev->ctrl_hdl_vbi_out); in vivid_free_controls()
2059 v4l2_ctrl_handler_free(&dev->ctrl_hdl_radio_rx); in vivid_free_controls()
2060 v4l2_ctrl_handler_free(&dev->ctrl_hdl_radio_tx); in vivid_free_controls()
2061 v4l2_ctrl_handler_free(&dev->ctrl_hdl_sdr_cap); in vivid_free_controls()
2062 v4l2_ctrl_handler_free(&dev->ctrl_hdl_user_gen); in vivid_free_controls()
2063 v4l2_ctrl_handler_free(&dev->ctrl_hdl_user_vid); in vivid_free_controls()
2064 v4l2_ctrl_handler_free(&dev->ctrl_hdl_user_aud); in vivid_free_controls()
2065 v4l2_ctrl_handler_free(&dev->ctrl_hdl_streaming); in vivid_free_controls()
2066 v4l2_ctrl_handler_free(&dev->ctrl_hdl_sdtv_cap); in vivid_free_controls()
2067 v4l2_ctrl_handler_free(&dev->ctrl_hdl_loop_cap); in vivid_free_controls()
2068 v4l2_ctrl_handler_free(&dev->ctrl_hdl_fb); in vivid_free_controls()
2069 v4l2_ctrl_handler_free(&dev->ctrl_hdl_meta_cap); in vivid_free_controls()
2070 v4l2_ctrl_handler_free(&dev->ctrl_hdl_meta_out); in vivid_free_controls()
2071 v4l2_ctrl_handler_free(&dev->ctrl_hdl_touch_cap); in vivid_free_controls()