From 5023a9e33aae18648d5cef3492e9bd83d42d5ccf Mon Sep 17 00:00:00 2001 From: Hang Cheng Date: Tue, 16 Apr 2019 15:47:21 +0800 Subject: [PATCH] hdmirx: modify drop video frame interface [1/1] PD#SWPL-6785 Problem: there's garbage frame show when signal change Solution: enable forward video frame skip interface, and set vdin to skip one more frame to prevent garbage been shown Verify: X301 Change-Id: Id099558c733843f330b99246ea31fbbd0c18ed84 Signed-off-by: Hang Cheng --- drivers/amlogic/media/video_sink/video.c | 23 +++++++++++----------- .../amlogic/media/vin/tvin/hdmirx/hdmi_rx_drv.c | 2 +- .../amlogic/media/vin/tvin/hdmirx/hdmi_rx_drv.h | 2 +- drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_hw.c | 15 +++++++------- drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_hw.h | 1 + .../media/vin/tvin/hdmirx/hdmi_rx_wrapper.c | 7 ++++++- drivers/amlogic/media/vin/tvin/vdin/vdin_vf.c | 18 +++++++++-------- 7 files changed, 38 insertions(+), 30 deletions(-) diff --git a/drivers/amlogic/media/video_sink/video.c b/drivers/amlogic/media/video_sink/video.c index ceadb2b..e7fb113 100644 --- a/drivers/amlogic/media/video_sink/video.c +++ b/drivers/amlogic/media/video_sink/video.c @@ -249,8 +249,7 @@ static int video_onoff_state = VIDEO_ENABLE_STATE_IDLE; static u32 video_onoff_time; static DEFINE_SPINLOCK(video2_onoff_lock); static int video2_onoff_state = VIDEO_ENABLE_STATE_IDLE; -static u32 hdmiin_frame_check; -static u32 hdmiin_frame_check_cnt; +static u32 frame_skip_check_cnt; /*frame_detect_flag: 1 enable, 0 disable */ @@ -5654,7 +5653,8 @@ static inline bool video_vf_disp_mode_check(struct vframe_s *vf) } else vf_notify_provider_by_name("vdin0", VFRAME_EVENT_RECEIVER_DISP_MODE, (void *)&req); - if (req.disp_mode == VFRAME_DISP_MODE_OK) + if ((req.disp_mode == VFRAME_DISP_MODE_OK) || + (req.disp_mode == VFRAME_DISP_MODE_NULL)) return false; /*whether need to check pts??*/ video_vf_put(vf); @@ -6737,14 +6737,15 @@ static irqreturn_t vsync_isr_in(int irq, void *dev_id) * quickly for display *case2:input buffer all not OK */ - if (vf && hdmiin_frame_check && - (vf->source_type == VFRAME_SOURCE_TYPE_HDMI) && + if (vf && + ((vf->source_type == VFRAME_SOURCE_TYPE_HDMI) || + (vf->source_type == VFRAME_SOURCE_TYPE_CVBS)) && (video_vf_disp_mode_get(vf) == VFRAME_DISP_MODE_UNKNOWN) && - (hdmiin_frame_check_cnt++ < 10)) + (frame_skip_check_cnt++ < 10)) break; else - hdmiin_frame_check_cnt = 0; + frame_skip_check_cnt = 0; vf = video_vf_get(); if (!vf) { @@ -6762,8 +6763,9 @@ static irqreturn_t vsync_isr_in(int irq, void *dev_id) ATRACE_COUNTER(MODULE_NAME, __LINE__); break; } - if (vf && hdmiin_frame_check && (vf->source_type == - VFRAME_SOURCE_TYPE_HDMI) && + if (vf && + ((vf->source_type == VFRAME_SOURCE_TYPE_HDMI) || + (vf->source_type == VFRAME_SOURCE_TYPE_CVBS)) && video_vf_disp_mode_check(vf)) break; force_blackout = 0; @@ -13079,9 +13081,6 @@ MODULE_PARM_DESC(underflow, "\n Underflow count\n"); module_param(next_peek_underflow, uint, 0664); MODULE_PARM_DESC(skip, "\n Underflow count\n"); -module_param(hdmiin_frame_check, uint, 0664); -MODULE_PARM_DESC(hdmiin_frame_check, "\n hdmiin_frame_check\n"); - module_param(step_enable, uint, 0664); MODULE_PARM_DESC(step_enable, "\n step_enable\n"); diff --git a/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_drv.c b/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_drv.c index 8c33c8c..256024b 100644 --- a/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_drv.c +++ b/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_drv.c @@ -129,7 +129,7 @@ bool en_4096_2_3840; int en_4k_2_2k; int en_4k_timing = 1; bool hdmi_cec_en; -int vdin_drop_frame_cnt = 1; +int vdin_drop_frame_cnt = 2; /* suspend_pddq_sel: * 0: keep phy on when suspend(don't need phy init when * resume), it doesn't work now because phy VDDIO_3.3V diff --git a/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_drv.h b/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_drv.h index 6bf1d77..f135a55 100644 --- a/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_drv.h +++ b/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_drv.h @@ -34,7 +34,7 @@ #include "hdmi_rx_edid.h" -#define RX_VER0 "ver.2019-04-09" +#define RX_VER0 "ver.2019-04-16" /* * * diff --git a/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_hw.c b/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_hw.c index f011828..cd29bb6 100644 --- a/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_hw.c +++ b/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_hw.c @@ -67,7 +67,8 @@ static bool phy_fsm_enhancement = true; static uint32_t modet_clk = 24000; int hdcp_enc_mode; /* top_irq_en bit[16:13] hdcp_sts */ -int top_intr_maskn_value = 1; +int top_intr_maskn_value = 0x20000001; + bool hdcp_enable = 1; int acr_mode; int auto_aclk_mute = 2; @@ -3371,22 +3372,22 @@ uint32_t aml_phy_pll_band(uint32_t cableclk, static const uint32_t phy_misci[][4] = { /* 0xd7 0xd8 0xe0 0xe1 */ { /* 24~45M */ - 0x3003707f, 0x00000080, 0x02218000, 0x00000010, + 0x3007707f, 0x00000080, 0x02218000, 0x00000010, }, { /* 45~74.5M */ - 0x3003707f, 0x00000080, 0x02218000, 0x00000010, + 0x3007707f, 0x00000080, 0x02218000, 0x00000010, }, { /* 77~155M */ - 0x3003707f, 0x00000080, 0x02218000, 0x00000010, + 0x3007707f, 0x00000080, 0x02218000, 0x00000010, }, { /* 155~340M */ - 0x3003707f, 0x00000080, 0x02218000, 0x00000010, + 0x3007707f, 0x00000080, 0x02218000, 0x00000010, }, { /* 340~525M */ - 0x3003707f, 0x007f0080, 0x02218000, 0x00000010, + 0x3007707f, 0x007f0080, 0x02218000, 0x00000010, }, { /* 525~600M */ - 0x3003707f, 0x007f8080, 0x02218000, 0x00000010, + 0x3007707f, 0x007f8080, 0x02218000, 0x00000010, }, }; diff --git a/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_hw.h b/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_hw.h index 65a8c50..a46032b 100644 --- a/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_hw.h +++ b/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_hw.h @@ -1114,6 +1114,7 @@ extern int find_best_eq; extern int eq_try_cnt; extern int pll_rst_max; extern int cdr_lock_level; +extern int top_intr_maskn_value; extern void rx_get_best_eq_setting(void); extern int hbr_force_8ch; extern void wr_reg_hhi(unsigned int offset, unsigned int val); diff --git a/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_wrapper.c b/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_wrapper.c index 578577b..34fd790 100644 --- a/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_wrapper.c +++ b/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_wrapper.c @@ -523,9 +523,11 @@ reisr:hdmirx_top_intr_stat = hdmirx_rd_top(TOP_INTR_STAT); /* modify interrupt flow for isr loading */ /* top interrupt handler */ if (rx.chip_id >= CHIP_ID_TL1) { - if (hdmirx_top_intr_stat & (1 << 29)) + if (hdmirx_top_intr_stat & (1 << 29)) { + skip_frame(skip_frame_cnt); if (log_level & 0x100) rx_pr("[isr] sqofclk_fall\n"); + } if (hdmirx_top_intr_stat & (1 << 28)) if (log_level & 0x100) rx_pr("[isr] sqofclk_rise\n"); @@ -1718,6 +1720,8 @@ int rx_set_global_variable(const char *buf, int size) return pr_var(hbr_force_8ch, index); if (set_pr_var(tmpbuf, cdr_lock_level, value, &index, ret)) return pr_var(cdr_lock_level, index); + if (set_pr_var(tmpbuf, top_intr_maskn_value, value, &index, ret)) + return pr_var(top_intr_maskn_value, index); return 0; } @@ -1826,6 +1830,7 @@ void rx_get_global_variable(const char *buf) pr_var(hdcp_enc_mode, i++); pr_var(hbr_force_8ch, i++); pr_var(cdr_lock_level, i++); + pr_var(top_intr_maskn_value, i++); } void skip_frame(unsigned int cnt) diff --git a/drivers/amlogic/media/vin/tvin/vdin/vdin_vf.c b/drivers/amlogic/media/vin/tvin/vdin/vdin_vf.c index afd3446..012163e 100644 --- a/drivers/amlogic/media/vin/tvin/vdin/vdin_vf.c +++ b/drivers/amlogic/media/vin/tvin/vdin/vdin_vf.c @@ -1018,20 +1018,22 @@ void vdin_vf_disp_mode_update(struct vf_entry *vfe, struct vf_pool *p) p->disp_index[0] = 0; vfe->vf.index_disp = p->disp_index[0]; - p->disp_mode[p->disp_index[p->skip_vf_num]] = VFRAME_DISP_MODE_OK; + if (p->disp_mode[p->disp_index[p->skip_vf_num]] != + VFRAME_DISP_MODE_SKIP) + p->disp_mode[p->disp_index[p->skip_vf_num]] = + VFRAME_DISP_MODE_OK; for (i = p->skip_vf_num - 1; i < VFRAME_DISP_MAX_NUM; i--) p->disp_mode[p->disp_index[i]] = VFRAME_DISP_MODE_UNKNOWN; } -/*disp mode skip - *skip_vf_num - * 2:last last vframe, 1:last vframe - * 0:current vframe +/*skip all from current + *disp_index[i]: + *2:last last vframe, 1:last vframe + *0:current vframe */ void vdin_vf_disp_mode_skip(struct vf_pool *p) { unsigned int i; - - for (i = p->skip_vf_num - 1; i < VFRAME_DISP_MAX_NUM; i--) - p->disp_mode[i] = VFRAME_DISP_MODE_SKIP; + for (i = 0; i <= p->skip_vf_num; i++) + p->disp_mode[p->disp_index[i]] = VFRAME_DISP_MODE_SKIP; } -- 2.7.4