From aa999abb071e2f4bf5b034854a5fae1ed3e97453 Mon Sep 17 00:00:00 2001 From: Dongjin Kim Date: Wed, 20 Feb 2019 15:15:42 +0900 Subject: [PATCH] ODROID-COMMON: media/vout: no use of 'vout=' for display resolution This patch is to disable kernel param 'vout=' completely and the set display resolution with the given by 'hdmimode=' or 'cvbsmode' according to the cable status. Since we are assuming that HDMI display is priority display device, no matter CVBS cable is attached or HDMI cable is attached we select HDMI. Change-Id: I76b611a4f97e4eda488232d46bbb97c9a990aa6c Signed-off-by: Dongjin Kim --- .../media/vout/vout_serve/vout_serve.c | 35 ++++++++++++------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/drivers/amlogic/media/vout/vout_serve/vout_serve.c b/drivers/amlogic/media/vout/vout_serve/vout_serve.c index 8ff517cefd07..588ff79de237 100644 --- a/drivers/amlogic/media/vout/vout_serve/vout_serve.c +++ b/drivers/amlogic/media/vout/vout_serve/vout_serve.c @@ -62,7 +62,9 @@ static char vout_mode_uboot[VMODE_NAME_LEN_MAX] __nosavedata; static char vout_mode[VMODE_NAME_LEN_MAX] __nosavedata; static char local_name[VMODE_NAME_LEN_MAX] = {0}; static u32 vout_init_vmode = VMODE_INIT_NULL; +#if !defined(CONFIG_ARCH_MESON64_ODROID_COMMON) static int uboot_display; +#endif static unsigned int bist_mode; static char vout_axis[64] __nosavedata; @@ -267,6 +269,13 @@ static int set_vout_init_mode(void) char init_mode_str[VMODE_NAME_LEN_MAX]; int ret = 0; +#if defined(CONFIG_ARCH_MESON64_ODROID_COMMON) + strncpy(vout_mode_uboot, + (vout_get_hpd_state() || !cvbs_cable_connected()) ? + hdmimode : cvbsmode, + sizeof(vout_mode_uboot)); +#endif + snprintf(init_mode_str, VMODE_NAME_LEN_MAX, "%s", vout_mode_uboot); vout_init_vmode = validate_vmode(vout_mode_uboot); if (vout_init_vmode >= VMODE_MAX) { @@ -286,10 +295,10 @@ static int set_vout_init_mode(void) } last_vmode = vout_init_vmode; - if (uboot_display) - vmode = vout_init_vmode | VMODE_INIT_BIT_MASK; - else - vmode = vout_init_vmode; + vmode = vout_init_vmode; +#if !defined(CONFIG_ARCH_MESON64_ODROID_COMMON) + vmode |= VMODE_INIT_BIT_MASK; +#endif memset(local_name, 0, sizeof(local_name)); snprintf(local_name, VMODE_NAME_LEN_MAX, "%s", init_mode_str); @@ -856,21 +865,19 @@ static int refresh_tvout_mode(void) { enum vmode_e cur_vmode = VMODE_MAX; char cur_mode_str[VMODE_NAME_LEN_MAX]; - int hpd_state = 0; + int hpd_state; if (tvout_monitor_flag == 0) return 0; -#if defined(CONFIG_ARCH_MESON64_ODROID_COMMON) - /* - * vout mode is treated as HDMI always initialized - * even though HDMI cable is detached. - * TODO : except cvbs cable is plugged in. - */ - hpd_state = 1; -#else hpd_state = vout_get_hpd_state(); + +#if defined(CONFIG_ARCH_MESON64_ODROID_COMMON) + /* Unless CVBS cable is not attached, we assumed that HDMI cable is attached */ + if (!cvbs_cable_connected()) + hpd_state = 1; #endif + if (hpd_state) { cur_vmode = validate_vmode(hdmimode); snprintf(cur_mode_str, VMODE_NAME_LEN_MAX, "%s", hdmimode); @@ -1086,6 +1093,7 @@ static __exit void vout_exit_module(void) subsys_initcall(vout_init_module); module_exit(vout_exit_module); +#if !defined(CONFIG_ARCH_MESON64_ODROID_COMMON) static int str2lower(char *str) { while (*str != '\0') { @@ -1162,6 +1170,7 @@ static int __init get_vout_init_mode(char *str) return 0; } __setup("vout=", get_vout_init_mode); +#endif static int __init get_hdmi_mode(char *str) {