From aae122db6f7bf8b1fe4dfb0806b45e6d587e4d25 Mon Sep 17 00:00:00 2001 From: "can.zhang" Date: Fri, 26 Jan 2024 18:53:02 +0800 Subject: [PATCH] amdv: fix tv/stb mute function [1/1] PD#SWPL-155885 Problem: vpp mute control may conflict Solution: add code fix function Verify: t963d4 Change-Id: Ie43bb64c55b10fe203f134e8fae9d6022e9ee4cf Signed-off-by: can.zhang --- .../enhancement/amdolby_vision/amdv_hw.c | 94 +++++-------------- 1 file changed, 26 insertions(+), 68 deletions(-) diff --git a/drivers/media/enhancement/amdolby_vision/amdv_hw.c b/drivers/media/enhancement/amdolby_vision/amdv_hw.c index 198a8a6d8..d96dd9b0c 100644 --- a/drivers/media/enhancement/amdolby_vision/amdv_hw.c +++ b/drivers/media/enhancement/amdolby_vision/amdv_hw.c @@ -853,21 +853,15 @@ static int stb_dv_core1_set(dma_addr_t dma_paddr, bypass_flag; if (amdv_on_count < amdv_run_mode_delay) { run_mode |= 1; - VSYNC_WR_DV_REG(VPP_VD1_CLIP_MISC0, - (0x200 << 10) | 0x200); - VSYNC_WR_DV_REG(VPP_VD1_CLIP_MISC1, - (0x200 << 10) | 0x200); + set_video_mute(AML_DOLBY_MUTE_SET, 1); + is_muted = 1; } else if (amdv_on_count == amdv_run_mode_delay) { - VSYNC_WR_DV_REG(VPP_VD1_CLIP_MISC0, - (0x200 << 10) | 0x200); - VSYNC_WR_DV_REG(VPP_VD1_CLIP_MISC1, - (0x200 << 10) | 0x200); + set_video_mute(AML_DOLBY_MUTE_SET, 1); + is_muted = 1; } else { - VSYNC_WR_DV_REG(VPP_VD1_CLIP_MISC0, - (0x3ff << 20) | (0x3ff << 10) | 0x3ff); - VSYNC_WR_DV_REG(VPP_VD1_CLIP_MISC1, - 0); + set_video_mute(AML_DOLBY_MUTE_SET, 0); + is_muted = 0; } } if (reset) @@ -1276,12 +1270,8 @@ static int dv_core1_set(u32 dm_count, if (amdv_on_count < amdv_run_mode_delay) { - VSYNC_WR_DV_REG - (VPP_VD1_CLIP_MISC0, - (0x200 << 10) | 0x200); - VSYNC_WR_DV_REG - (VPP_VD1_CLIP_MISC1, - (0x200 << 10) | 0x200); + set_video_mute(AML_DOLBY_MUTE_SET, 1); + is_muted = 1; if (is_aml_g12()) VSYNC_WR_DV_REG_BITS (AMDV_PATH_CTRL, @@ -1294,14 +1284,8 @@ static int dv_core1_set(u32 dm_count, } else { if (amdv_on_count > amdv_run_mode_delay) { - VSYNC_WR_DV_REG - (VPP_VD1_CLIP_MISC0, - (0x3ff << 20) | - (0x3ff << 10) | - 0x3ff); - VSYNC_WR_DV_REG - (VPP_VD1_CLIP_MISC1, - 0); + set_video_mute(AML_DOLBY_MUTE_SET, 0); + is_muted = 0; } if (amdv_core1_on && !bypass_core1) { if (is_aml_g12()) { @@ -1846,12 +1830,8 @@ static int dv_core1a_set(u32 dm_count, if (dv_core1[0].run_mode_count < amdv_run_mode_delay) { - VSYNC_WR_DV_REG - (VPP_VD1_CLIP_MISC0, - (0x200 << 10) | 0x200); - VSYNC_WR_DV_REG - (VPP_VD1_CLIP_MISC1, - (0x200 << 10) | 0x200); + set_video_mute(AML_DOLBY_MUTE_SET, 1); + is_muted = 1; if (is_aml_g12() || is_aml_sc2() || is_aml_s4d() || is_aml_tm2_stbmode()) VSYNC_WR_DV_REG_BITS (AMDV_PATH_CTRL, @@ -1870,14 +1850,8 @@ static int dv_core1a_set(u32 dm_count, if (dv_core1[0].run_mode_count > amdv_run_mode_delay) { if (start_render == 0) { - VSYNC_WR_DV_REG - (VPP_VD1_CLIP_MISC0, - (0x3ff << 20) | - (0x3ff << 10) | - 0x3ff); - VSYNC_WR_DV_REG - (VPP_VD1_CLIP_MISC1, - 0); + set_video_mute(AML_DOLBY_MUTE_SET, 0); + is_muted = 0; } start_render = 1; } @@ -2325,12 +2299,8 @@ static int dv_core1b_set(u32 dm_count, } if (dv_core1[1].run_mode_count < amdv_run_mode_delay) { - VSYNC_WR_DV_REG - (VPP_VD1_CLIP_MISC0, - (0x200 << 10) | 0x200); - VSYNC_WR_DV_REG - (VPP_VD1_CLIP_MISC1, - (0x200 << 10) | 0x200); + set_video_mute(AML_DOLBY_MUTE_SET, 1); + is_muted = 1; if (is_aml_tm2_stbmode()) VSYNC_WR_DV_REG_BITS (AMDV_PATH_CTRL, @@ -2346,14 +2316,8 @@ static int dv_core1b_set(u32 dm_count, } else { if (dv_core1[1].run_mode_count > amdv_run_mode_delay) { - VSYNC_WR_DV_REG - (VPP_VD1_CLIP_MISC0, - (0x3ff << 20) | - (0x3ff << 10) | - 0x3ff); - VSYNC_WR_DV_REG - (VPP_VD1_CLIP_MISC1, - 0); + set_video_mute(AML_DOLBY_MUTE_SET, 0); + is_muted = 0; } if (dv_core1[1].core1_on && !bypass_core1) { if (is_aml_tm2_stbmode()) { @@ -5239,10 +5203,6 @@ void enable_amdv_v1(int enable) if (tv_dovi_setting) tv_dovi_setting->src_format = FORMAT_SDR; - if (is_muted) { - set_video_mute(AML_DOLBY_MUTE_SET, 0); /* ensure unmute */ - is_muted = 0; - } } else if (is_aml_txlx_stbmode()) { VSYNC_WR_DV_REG_BITS (VIU_MISC_CTRL1, @@ -5461,9 +5421,10 @@ void enable_amdv_v1(int enable) } if (is_aml_s5()) VSYNC_WR_DV_REG_BITS(VPU_DOLBY_GATE_CTRL, 0, 0, 10); - VSYNC_WR_DV_REG(VPP_VD1_CLIP_MISC0, - (0x3ff << 20) | (0x3ff << 10) | 0x3ff); - VSYNC_WR_DV_REG(VPP_VD1_CLIP_MISC1, 0); + if (is_muted) { + set_video_mute(AML_DOLBY_MUTE_SET, 0); /* ensure unmute */ + is_muted = 0; + } video_effect_bypass(0); #ifndef CONFIG_AMLOGIC_REMOVE_OLD if (is_aml_gxm()) @@ -6324,13 +6285,10 @@ void enable_amdv_v2_stb(int enable) if (is_aml_s5()) VSYNC_WR_DV_REG_BITS(VPU_DOLBY_GATE_CTRL, 0, 0, 10); - VSYNC_WR_DV_REG - (VPP_VD1_CLIP_MISC0, - (0x3ff << 20) - | (0x3ff << 10) | 0x3ff); - VSYNC_WR_DV_REG - (VPP_VD1_CLIP_MISC1, - 0); + if (is_muted) { + set_video_mute(AML_DOLBY_MUTE_SET, 0); /* ensure unmute */ + is_muted = 0; + } video_effect_bypass(0); reset_dovi_setting(); }