summaryrefslogtreecommitdiff
authorLuan Yuan <luan.yuan@amlogic.com>2018-02-05 02:59:50 (GMT)
committer Xindong Xu <xindong.xu@amlogic.com>2018-02-09 09:52:02 (GMT)
commitfd5a4b154cfea929059d3dbcccb3aaca050bda07 (patch)
tree7de2293af3d107805fdd86241eca4a49912a4634
parentf2dd7614bfc4ff3a34d6acd40e0a69aad1b5b845 (diff)
downloadcommon-fd5a4b154cfea929059d3dbcccb3aaca050bda07.zip
common-fd5a4b154cfea929059d3dbcccb3aaca050bda07.tar.gz
common-fd5a4b154cfea929059d3dbcccb3aaca050bda07.tar.bz2
hdmitx: 2160p50zh contains 2160p50hz420 etc.[1/2]
PD#158454: hdmitx: uniform the sysfs node 'disp_cap' Previous handling of node 'disp_cap' may contains both '2160p50hz' and '2160p50hz420', which may confuse the application. Now start to uniform the 'disp_cap', which will only contains valid mode, without colorspace information. Not each combination of 'disp_cap' and 'dc_cap' is valid, please use 'valid_mode' to test combination. Change-Id: I2d1c97b33272ddd439acf8cadef9e35dfc2dbe82 Signed-off-by: Luan Yuan <luan.yuan@amlogic.com>
Diffstat
-rw-r--r--drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_main.c46
1 files changed, 40 insertions, 6 deletions
diff --git a/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_main.c b/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_main.c
index 904974a..ebf95ab 100644
--- a/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_main.c
+++ b/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_main.c
@@ -1442,15 +1442,29 @@ const char *disp_mode_t[] = {
"smpte30hz",
"smpte50hz",
"smpte60hz",
- "smpte50hz420",
- "smpte60hz420",
"2160p50hz",
"2160p60hz",
- "2160p50hz420",
- "2160p60hz420",
NULL
};
+static int is_4k50_fmt(char *mode)
+{
+ int i;
+ static char const *hdmi4k50[] = {
+ "2160p50hz",
+ "2160p60hz",
+ "smpte50hz",
+ "smpte50hz",
+ NULL
+ };
+
+ for (i = 0; hdmi4k50[i]; i++) {
+ if (strcmp(hdmi4k50[i], mode) == 0)
+ return 1;
+ }
+ return 0;
+}
+
/**/
static ssize_t show_disp_cap(struct device *dev,
struct device_attribute *attr, char *buf)
@@ -1459,13 +1473,23 @@ static ssize_t show_disp_cap(struct device *dev,
const char *native_disp_mode =
hdmitx_edid_get_native_VIC(&hdmitx_device);
enum hdmi_vic vic;
+ char mode_tmp[32];
if (hdmitx_device.tv_no_edid) {
pos += snprintf(buf+pos, PAGE_SIZE, "null edid\n");
} else {
for (i = 0; disp_mode_t[i]; i++) {
- vic = hdmitx_edid_get_VIC(&hdmitx_device,
- disp_mode_t[i], 0);
+ memset(mode_tmp, 0, sizeof(mode_tmp));
+ strncpy(mode_tmp, disp_mode_t[i], sizeof(mode_tmp));
+ vic = hdmitx_edid_get_VIC(&hdmitx_device, mode_tmp, 0);
+ /* Handling only 4k420 mode */
+ if (vic == HDMI_Unknown) {
+ if (is_4k50_fmt(mode_tmp)) {
+ strcat(mode_tmp, "420");
+ vic = hdmitx_edid_get_VIC(&hdmitx_device,
+ mode_tmp, 0);
+ }
+ }
if (vic != HDMI_Unknown) {
pos += snprintf(buf+pos, PAGE_SIZE, "%s",
disp_mode_t[i]);
@@ -1623,6 +1647,16 @@ static ssize_t show_dc_cap(struct device *dev,
pos += snprintf(buf + pos, PAGE_SIZE, "420,8bit\n");
goto next444;
}
+ vic = hdmitx_edid_get_VIC(&hdmitx_device, "smpte60hz420", 0);
+ if (vic != HDMI_Unknown) {
+ pos += snprintf(buf + pos, PAGE_SIZE, "420,8bit\n");
+ goto next444;
+ }
+ vic = hdmitx_edid_get_VIC(&hdmitx_device, "smpte50hz420", 0);
+ if (vic != HDMI_Unknown) {
+ pos += snprintf(buf + pos, PAGE_SIZE, "420,8bit\n");
+ goto next444;
+ }
}
next444:
if (pRXCap->dc_y444) {