From dedaac4de48e42ed48b6e0b2148c795adc20f4f4 Mon Sep 17 00:00:00 2001 From: Conglin Guo Date: Tue, 9 Apr 2019 11:06:55 +0800 Subject: [PATCH] vmh264: fix channel switching system hangup issue in vmh264 remove [1/1] PD#SWPL-6729 Problem: hw bus dead lock in vmh264 remove. Solution: wait for decoder hw stopped completely before vmh264 remove Verify: X301 Change-Id: I1f41bf40630d7b56a6722cdb93d63df48dc29c63 Signed-off-by: Conglin Guo --- .../decoder/h264_multi/vmh264.c | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/drivers/amlogic/media_modules/frame_provider/decoder/h264_multi/vmh264.c b/drivers/amlogic/media_modules/frame_provider/decoder/h264_multi/vmh264.c index 701f24483adb..02c04896b3fd 100644 --- a/drivers/amlogic/media_modules/frame_provider/decoder/h264_multi/vmh264.c +++ b/drivers/amlogic/media_modules/frame_provider/decoder/h264_multi/vmh264.c @@ -6902,6 +6902,25 @@ static int vh264_stop(struct vdec_h264_hw_s *hw) return 0; } +static void wait_vmh264_search_done(struct vdec_h264_hw_s *hw) +{ + u32 vld_rp = READ_VREG(VLD_MEM_VIFIFO_RP); + int count = 0; + do { + usleep_range(100, 500); + if (vld_rp == READ_VREG(VLD_MEM_VIFIFO_RP)) + break; + if (count > 2000) { + dpb_print(DECODE_ID(hw), + PRINT_FLAG_ERROR, "%s timeout count %d vld_rp 0x%x VLD_MEM_VIFIFO_RP 0x%x\n", + __func__, count, vld_rp, READ_VREG(VLD_MEM_VIFIFO_RP)); + break; + } else + vld_rp = READ_VREG(VLD_MEM_VIFIFO_RP); + count++; + } while (1); +} + static void vh264_notify_work(struct work_struct *work) { struct vdec_h264_hw_s *hw = container_of(work, @@ -7705,7 +7724,6 @@ result_done: } decode_frame_count[DECODE_ID(hw)]++; amvdec_stop(); - if (!vdec_is_support_4k()) { if (clk_adj_frame_count < VDEC_CLOCK_ADJUST_FRAME) { clk_adj_frame_count++; @@ -7769,6 +7787,7 @@ result_done: del_timer_sync(&hw->check_timer); hw->stat &= ~STAT_TIMER_ARM; + wait_vmh264_search_done(hw); /* mark itself has all HW resource released and input released */ #ifdef CONFIG_AMLOGIC_MEDIA_ENHANCEMENT_DOLBYVISION