From 7fe80f4d5efbb018f0004cbc27fa36f92b245680 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 --- drivers/amlogic/media/vout/cvbs/cvbs_out.c | 6 ++-- .../media/vout/vout_serve/vout_serve.c | 35 ++++++++++++------- 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/drivers/amlogic/media/vout/cvbs/cvbs_out.c b/drivers/amlogic/media/vout/cvbs/cvbs_out.c index 2d022fc82678..cf611fe41040 100644 --- a/drivers/amlogic/media/vout/cvbs/cvbs_out.c +++ b/drivers/amlogic/media/vout/cvbs/cvbs_out.c @@ -1596,17 +1596,17 @@ static int __init cvbs_performance_setup(char *line) __setup("cvbsdrv=", cvbs_performance_setup); #if defined(CONFIG_ARCH_MESON64_ODROID_COMMON) -static unsigned long cvbs_cable = 0; +static int cvbs_cable = 0; int cvbs_cable_connected(void) { - return (int)cvbs_cable; + return cvbs_cable; } EXPORT_SYMBOL(cvbs_cable_connected); static int __init get_cvbs_cable(char *str) { - (void)kstrtoul(str, 10, (unsigned long *)&cvbs_cable); + cvbs_cable = (str[0] == '0') ? 0 : 1; return 0; } diff --git a/drivers/amlogic/media/vout/vout_serve/vout_serve.c b/drivers/amlogic/media/vout/vout_serve/vout_serve.c index b6a3792adb15..dc897893337e 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') { @@ -1158,6 +1166,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) {