Skip to content

Commit

Permalink
expose ITC type to v4l2
Browse files Browse the repository at this point in the history
  • Loading branch information
benhoff committed Sep 13, 2024
1 parent ee0702f commit 419d135
Showing 1 changed file with 72 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3768,3 +3768,75 @@ index 111111111111..222222222222 100644
--
Armbian

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ben Hoff <[email protected]>
Date: Fri, 13 Sep 2024 06:28:06 -0400
Subject: [PATCH 3/3] expose ITC type to v4l2

---
.../media/platform/synopsys/hdmirx/snps_hdmirx.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c b/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c
index 205553b92c22..397281804fc4 100644
--- a/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c
+++ b/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c
@@ -151,6 +151,7 @@ struct snps_hdmirx_dev {
struct v4l2_ctrl_handler hdl;
struct v4l2_ctrl *detect_tx_5v_ctrl;
struct v4l2_ctrl *rgb_range;
+ struct v4l2_ctrl *content_type;
struct v4l2_dv_timings timings;
struct gpio_desc *detect_5v_gpio;
struct work_struct work_wdt_config;
@@ -512,6 +513,11 @@ static void hdmirx_get_avi_infoframe(struct snps_hdmirx_dev *hdmirx_dev)
}

v4l2_ctrl_s_ctrl(hdmirx_dev->rgb_range, frame.avi.quantization_range);
+ if (frame.avi.itc) {
+ v4l2_ctrl_s_ctrl(hdmirx_dev->content_type, frame.avi.content_type);
+ } else {
+ v4l2_ctrl_s_ctrl(hdmirx_dev->content_type, V4L2_DV_IT_CONTENT_TYPE_NO_ITC);
+ }
}

/*
@@ -1180,6 +1186,7 @@ static int hdmirx_wait_lock_and_get_timing(struct snps_hdmirx_dev *hdmirx_dev)
break;

if (!tx_5v_power_present(hdmirx_dev)) {
+ v4l2_ctrl_s_ctrl(hdmirx_dev->content_type, V4L2_DV_IT_CONTENT_TYPE_NO_ITC);
//v4l2_err(v4l2_dev, "%s: HDMI pull out, return\n", __func__);
return -1;
}
@@ -1192,6 +1199,7 @@ static int hdmirx_wait_lock_and_get_timing(struct snps_hdmirx_dev *hdmirx_dev)
__func__, hdmirx_dev->tmds_clk_ratio);
v4l2_err(v4l2_dev, "%s: mu_st:%#x, scdc_st:%#x, dma_st10:%#x\n",
__func__, mu_status, scdc_status, dma_st10);
+ v4l2_ctrl_s_ctrl(hdmirx_dev->content_type, V4L2_DV_IT_CONTENT_TYPE_NO_ITC);
return -1;
}

@@ -2663,7 +2671,7 @@ static int hdmirx_probe(struct platform_device *pdev)
strscpy(v4l2_dev->name, dev_name(dev), sizeof(v4l2_dev->name));

hdl = &hdmirx_dev->hdl;
- v4l2_ctrl_handler_init(hdl, 1);
+ v4l2_ctrl_handler_init(hdl, 3);

hdmirx_dev->detect_tx_5v_ctrl = v4l2_ctrl_new_std(hdl, NULL,
V4L2_CID_DV_RX_POWER_PRESENT,
@@ -2675,6 +2683,11 @@ static int hdmirx_probe(struct platform_device *pdev)
V4L2_DV_RGB_RANGE_AUTO);

hdmirx_dev->rgb_range->flags |= V4L2_CTRL_FLAG_READ_ONLY;
+ hdmirx_dev->content_type = v4l2_ctrl_new_std_menu(hdl, NULL,
+ V4L2_CID_DV_RX_IT_CONTENT_TYPE,
+ V4L2_DV_IT_CONTENT_TYPE_NO_ITC,
+ 0,
+ V4L2_DV_IT_CONTENT_TYPE_NO_ITC);

if (hdl->error) {
dev_err(dev, "v4l2 ctrl handler init failed\n");
--
Armbian

0 comments on commit 419d135

Please sign in to comment.