Commit 8a99e9fa authored by Johan Korsnes's avatar Johan Korsnes Committed by Mauro Carvalho Chehab

media: vivid: add HDMI (dis)connect RX emulation

Adds the following bitmask control:
-V4L2_CID_DV_RX_POWER_PRESENT

The RX_POWER_PRESENT bitmask is set based on the digital video timings
signal mode. This also removes 1/1 warnings for v4l2-compliance test on
vivid instance with HDMI input.
Signed-off-by: default avatarJohan Korsnes <johan.korsnes@gmail.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent 79a792da
......@@ -240,6 +240,8 @@ struct vivid_dev {
struct v4l2_ctrl *ctrl_tx_hotplug;
struct v4l2_ctrl *ctrl_tx_rxsense;
struct v4l2_ctrl *ctrl_rx_power_present;
struct v4l2_ctrl *radio_tx_rds_pi;
struct v4l2_ctrl *radio_tx_rds_pty;
struct v4l2_ctrl *radio_tx_rds_mono_stereo;
......@@ -323,6 +325,8 @@ struct vivid_dev {
unsigned tv_field_cap;
unsigned tv_audio_input;
u32 power_present;
/* Capture Overlay */
struct v4l2_framebuffer fb_cap;
struct v4l2_fh *overlay_cap_owner;
......
......@@ -358,7 +358,7 @@ static int vivid_vid_cap_s_ctrl(struct v4l2_ctrl *ctrl)
V4L2_COLORSPACE_470_SYSTEM_BG,
};
struct vivid_dev *dev = container_of(ctrl->handler, struct vivid_dev, ctrl_hdl_vid_cap);
unsigned i;
unsigned int i, j;
switch (ctrl->id) {
case VIVID_CID_TEST_PATTERN:
......@@ -472,6 +472,18 @@ static int vivid_vid_cap_s_ctrl(struct v4l2_ctrl *ctrl)
dev->ctrl_dv_timings_signal_mode->val;
dev->query_dv_timings[dev->input] = dev->ctrl_dv_timings->val;
dev->power_present = 0;
for (i = 0, j = 0;
i < ARRAY_SIZE(dev->dv_timings_signal_mode);
i++)
if (dev->input_type[i] == HDMI) {
if (dev->dv_timings_signal_mode[i] != NO_SIGNAL)
dev->power_present |= (1 << j);
j++;
}
__v4l2_ctrl_s_ctrl(dev->ctrl_rx_power_present,
dev->power_present);
v4l2_ctrl_activate(dev->ctrl_dv_timings,
dev->dv_timings_signal_mode[dev->input] ==
SELECTED_DV_TIMINGS);
......@@ -1583,7 +1595,7 @@ int vivid_create_controls(struct vivid_dev *dev, bool show_ccs_cap,
v4l2_ctrl_new_custom(hdl_vbi_cap, &vivid_ctrl_vbi_cap_interlaced, NULL);
}
if (has_hdmi && dev->has_vid_cap) {
if (dev->num_hdmi_inputs) {
dev->ctrl_dv_timings_signal_mode = v4l2_ctrl_new_custom(hdl_vid_cap,
&vivid_ctrl_dv_timings_signal_mode, NULL);
......@@ -1603,6 +1615,11 @@ int vivid_create_controls(struct vivid_dev *dev, bool show_ccs_cap,
&vivid_vid_cap_ctrl_ops,
V4L2_CID_DV_RX_RGB_RANGE, V4L2_DV_RGB_RANGE_FULL,
0, V4L2_DV_RGB_RANGE_AUTO);
dev->ctrl_rx_power_present = v4l2_ctrl_new_std(hdl_vid_cap,
NULL, V4L2_CID_DV_RX_POWER_PRESENT, 0,
(2 << (dev->num_hdmi_inputs - 1)) - 1, 0,
(2 << (dev->num_hdmi_inputs - 1)) - 1);
}
if (dev->num_hdmi_outputs) {
/*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment