From a3eb0a4ad60e2c7ef5481b7d31e202588fcbc35f Mon Sep 17 00:00:00 2001 From: Hang Cheng Date: Fri, 14 Jun 2019 13:59:32 +0800 Subject: [PATCH] vout: add adjustment for hpd event monitor [1/1] PD#OTT-4604 Problem: 1.Before systemcontrol starts up, vout monitor takes place to monitor hpd event of hdmi, but vout server module is indepent with hdmi module, so the hpd status that vout server got may out of sync with hdmi. If the monitor interval is larger than hpd reset duration, for example, the vout server monitor frequency for hpd event is 500ms once, but hpd reset duration of TV is smaller, 20ms~200ms..., vout server may miss some hpd events, thus there will be no notifications from vout server to set new output mode. 2.If vout monitor timeout before systemcontrol starts up, hpd events happen during the interval will not be handled. Solution: add adjustment of hpd monitor time and interval Verify: A311D Change-Id: Ic6c371362c63baf50de3c5849fdbcdc5ec22ef61 Signed-off-by: Hang Cheng --- drivers/amlogic/media/vout/vout_serve/vout_serve.c | 28 +++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/drivers/amlogic/media/vout/vout_serve/vout_serve.c b/drivers/amlogic/media/vout/vout_serve/vout_serve.c index 31b33c5..8df90f9 100644 --- a/drivers/amlogic/media/vout/vout_serve/vout_serve.c +++ b/drivers/amlogic/media/vout/vout_serve/vout_serve.c @@ -78,6 +78,8 @@ static char cvbsmode[VMODE_NAME_LEN_MAX] = { static enum vmode_e last_vmode = VMODE_MAX; static int tvout_monitor_flag = 1; static unsigned int tvout_monitor_timeout_cnt = 20; +/* 500ms: 1*HZ/2 */ +static unsigned int tvout_monitor_interval = 500; static struct delayed_work tvout_mode_work; @@ -938,7 +940,8 @@ static void aml_tvout_mode_work(struct work_struct *work) mutex_unlock(&vout_serve_mutex); if (tvout_monitor_flag) - schedule_delayed_work(&tvout_mode_work, 1*HZ/2); + schedule_delayed_work(&tvout_mode_work, + msecs_to_jiffies(tvout_monitor_interval)); else VOUTPR("%s: monitor stop\n", __func__); } @@ -960,7 +963,8 @@ static void aml_tvout_mode_monitor(void) refresh_tvout_mode(); mutex_unlock(&vout_serve_mutex); - schedule_delayed_work(&tvout_mode_work, 1*HZ/2); + schedule_delayed_work(&tvout_mode_work, + msecs_to_jiffies(tvout_monitor_interval)); } static void aml_vout_extcon_register(struct platform_device *pdev) @@ -992,6 +996,24 @@ static void aml_vout_extcon_free(void) vout_excton_setmode = NULL; } +static void aml_vout_get_dt_info(struct platform_device *pdev) +{ + int ret; + unsigned int para[2]; + + /* e.g. dts: tvout_monitor = <100 250> + * interval = 100(ms), timeout_cnt = 250 + */ + ret = of_property_read_u32_array(pdev->dev.of_node, + "tvout_monitor", para, 2); + if (!ret) { + tvout_monitor_interval = para[0]; + tvout_monitor_timeout_cnt = para[1]; + } + VOUTPR("tvout monitor interval:%d(ms), timeout cnt:%d\n", + tvout_monitor_interval, tvout_monitor_timeout_cnt); +} + /***************************************************************** ** ** vout driver interface @@ -1014,7 +1036,7 @@ static int aml_vout_probe(struct platform_device *pdev) vout_register_server(&nulldisp_vout_server); aml_vout_extcon_register(pdev); - + aml_vout_get_dt_info(pdev); set_vout_init_mode(); aml_tvout_mode_monitor(); -- 2.7.4