hdmitx: update vmode_is_supported function to avoid invalid mode setting

PD#138714: update vmode_is_supported function to avoid invalid mode setting,
adjust hdmitx probe before vout serve.
also add NULL pointer protection in vout serve API.

Change-Id: I0815dfe35fa00ae8805d0ab6a9ae7b189a1b2af5
Signed-off-by: Evoke Zhang <evoke.zhang@amlogic.com>
This commit is contained in:
Evoke Zhang
2017-04-20 17:22:28 +08:00
committed by Jianxin Pan
parent 7fca780826
commit 73f330b0b8
7 changed files with 34 additions and 16 deletions

View File

@@ -207,11 +207,11 @@ CONFIG_AMLOGIC_MEDIA_VFM=y
CONFIG_AMLOGIC_VPU=y
CONFIG_AMLOGIC_VIDEOBUF_RESOURCE=y
CONFIG_AMLOGIC_VOUT=y
CONFIG_AMLOGIC_VOUT_SERVE=y
CONFIG_AMLOGIC_CVBS_OUTPUT=y
CONFIG_AMLOGIC_WSS=y
CONFIG_AMLOGIC_VDAC=y
CONFIG_AMLOGIC_HDMITX=y
CONFIG_AMLOGIC_VOUT_SERVE=y
CONFIG_AMLOGIC_MEDIA_FB=y
CONFIG_AMLOGIC_MEDIA_FB_OSD_VSYNC_RDMA=y
CONFIG_AMLOGIC_MEDIA_FB_OSD2_ENABLE=y

View File

@@ -14,10 +14,10 @@ config AMLOGIC_VOUT
if AMLOGIC_VOUT
source "drivers/amlogic/media/vout/vout_serve/Kconfig"
source "drivers/amlogic/media/vout/cvbs/Kconfig"
source "drivers/amlogic/media/vout/vdac/Kconfig"
source "drivers/amlogic/media/vout/hdmitx/Kconfig"
source "drivers/amlogic/media/vout/vout_serve/Kconfig"
endif

View File

@@ -1,4 +1,4 @@
obj-$(CONFIG_AMLOGIC_VOUT_SERVE) += vout_serve/
obj-$(CONFIG_AMLOGIC_CVBS_OUTPUT) += cvbs/
obj-$(CONFIG_AMLOGIC_VDAC) += vdac/
obj-$(CONFIG_AMLOGIC_HDMITX) += hdmitx/
obj-$(CONFIG_AMLOGIC_VOUT_SERVE) += vout_serve/

View File

@@ -458,7 +458,7 @@ static const struct vinfo_s *get_valid_vinfo(char *mode)
int i, count = ARRAY_SIZE(cvbs_info);
int mode_name_len = 0;
cvbs_log_info("get_valid_vinfo..out.mode:%s\n", mode);
/*cvbs_log_info("get_valid_vinfo..out.mode:%s\n", mode);*/
for (i = 0; i < count; i++) {
if (strncmp(cvbs_info[i].name, mode,
strlen(cvbs_info[i].name)) == 0) {

View File

@@ -2098,8 +2098,11 @@ static struct vinfo_s *hdmitx_get_current_info(void)
static int hdmitx_set_current_vmode(enum vmode_e mode)
{
pr_info("%s[%d]\n", __func__, __LINE__);
set_disp_mode_auto();
pr_info("%s[%d]\n", __func__, __LINE__);
if (!(mode & VMODE_INIT_BIT_MASK))
set_disp_mode_auto();
else
pr_info("hdmitx: alread display in uboot\n");
return 0;
}
@@ -2108,24 +2111,23 @@ static enum vmode_e hdmitx_validate_vmode(char *mode)
{
struct vinfo_s *info = hdmi_get_valid_vinfo(mode);
pr_info("%s[%d]\n", __func__, __LINE__);
if (info) {
hdmi_info = info;
return VMODE_HDMI;
}
pr_info("%s[%d]\n", __func__, __LINE__);
return VMODE_MAX;
}
static int hdmitx_vmode_is_supported(enum vmode_e mode)
{ /* TODO */
pr_info("%s[%d]\n", __func__, __LINE__);
return true;
{
if ((mode & VMODE_MODE_BIT_MASK) == VMODE_HDMI)
return true;
else
return false;
}
static int hdmitx_module_disable(enum vmode_e cur_vmod)
{ /* TODO */
pr_info("%s[%d]\n", __func__, __LINE__);
return 0;
}

View File

@@ -368,6 +368,7 @@ int set_current_vmode(enum vmode_e mode)
{
int ret = -1;
struct vout_server_s *p_server;
struct vinfo_s *vinfo;
char *str;
mutex_lock(&vout_mutex);
@@ -380,9 +381,15 @@ int set_current_vmode(enum vmode_e mode)
if (p_server->op.vmode_is_supported(mode) == true) {
vout_module.curr_vout_server = p_server;
ret = p_server->op.set_vmode(mode);
str = p_server->op.get_vinfo()->name;
if (vout_module.curr_vout_server)
update_vout_mode(str);
vinfo = p_server->op.get_vinfo();
if (vinfo) {
str = vinfo->name;
if (vout_module.curr_vout_server)
update_vout_mode(str);
} else {
VOUTERR("%s: p_server->op.get_vinfo is NULL\n",
__func__);
}
/* break; do not exit , should disable other modules */
} else
p_server->op.disable(mode);

View File

@@ -69,13 +69,17 @@ static char hdmimode[64];
static char cvbsmode[64];
static enum vmode_e last_vmode = VMODE_MAX;
static int tvout_monitor_flag = 1;
static unsigned int tvout_monitor_timeout_cnt = 20;
static struct delayed_work tvout_mode_work;
static DEFINE_MUTEX(tvout_mode_lock);
void update_vout_mode(char *name)
{
snprintf(vout_mode, 60, "%s", name);
if (name)
snprintf(vout_mode, 60, "%s", name);
else
VOUTERR("%s: vout mode is null\n", __func__);
}
EXPORT_SYMBOL(update_vout_mode);
@@ -571,6 +575,11 @@ static void aml_tvout_mode_work(struct work_struct *work)
refresh_tvout_mode();
mutex_unlock(&tvout_mode_lock);
if (tvout_monitor_timeout_cnt-- == 0) {
tvout_monitor_flag = 0;
VOUTPR("%s: monitor_timeout\n", __func__);
}
if (tvout_monitor_flag)
schedule_delayed_work(&tvout_mode_work, 1*HZ/2);
}