From b9f386fada58e2a6c0193c5fd4ecdc49cb0c4ac9 Mon Sep 17 00:00:00 2001 From: Brian Zhu Date: Thu, 12 Dec 2019 14:46:40 +0800 Subject: [PATCH] dv: do not use internal chip_id function by other modules [1/1] PD#SWPL-18367 Problem: amcsc used the wrong chip_id function from dolby vision driver, but at the time, the dv driver maybe did not probe. So got the wrong chip id state. Solution: Using the common chip id function. Verify: Verifed by u212 Change-Id: If27e861a2c8d8a586448f33cbaa70a81cbe2370f Signed-off-by: Brian Zhu (cherry picked from commit e58914e153138fc9655961a6ec67680e12699710) --- .../amdolby_vision/amdolby_vision.c | 61 +++++++++++-------- .../media/enhancement/amvecm/set_hdr2_v0.c | 10 ++- drivers/amlogic/media/video_sink/video_hw.c | 7 +-- .../media/amdolbyvision/dolby_vision.h | 10 --- 4 files changed, 44 insertions(+), 44 deletions(-) diff --git a/drivers/amlogic/media/enhancement/amdolby_vision/amdolby_vision.c b/drivers/amlogic/media/enhancement/amdolby_vision/amdolby_vision.c index 97915a74cde1..1e690cd602aa 100644 --- a/drivers/amlogic/media/enhancement/amdolby_vision/amdolby_vision.c +++ b/drivers/amlogic/media/enhancement/amdolby_vision/amdolby_vision.c @@ -1052,14 +1052,7 @@ MODULE_PARM_DESC(debug_dolby_frame, "\n debug_dolby_frame\n"); #define dump_enable \ ((debug_dolby_frame >= 0xffff) || \ (debug_dolby_frame + 1 == frame_count)) -static int is_graphics_output_off(void) -{ - if (is_meson_g12() || is_meson_tm2_stbmode()) - return !(READ_VPP_REG(OSD1_BLEND_SRC_CTRL) & (0xf<<8)) - && !(READ_VPP_REG(OSD2_BLEND_SRC_CTRL) & (0xf<<8)); - else - return (!(READ_VPP_REG(VPP_MISC) & (1<<12))); -} + #define single_step_enable \ (((debug_dolby_frame >= 0xffff) || \ ((debug_dolby_frame + 1) == frame_count)) && \ @@ -1130,14 +1123,15 @@ static bool tv_mode; static bool mel_mode; #define MAX_PARAM 8 -bool is_meson_gxm(void) +static bool is_meson_gxm(void) { if (dv_meson_dev.cpu_id == _CPU_MAJOR_ID_GXM) return true; else return false; } -bool is_meson_g12(void) + +static bool is_meson_g12(void) { if (dv_meson_dev.cpu_id == _CPU_MAJOR_ID_G12) return true; @@ -1145,7 +1139,7 @@ bool is_meson_g12(void) return false; } -bool is_meson_box(void) +static bool is_meson_box(void) { if (is_meson_gxm() || is_meson_g12()) return true; @@ -1153,7 +1147,7 @@ bool is_meson_box(void) return false; } -bool is_meson_txlx(void) +static bool is_meson_txlx(void) { if (dv_meson_dev.cpu_id == _CPU_MAJOR_ID_TXLX) return true; @@ -1161,21 +1155,23 @@ bool is_meson_txlx(void) return false; } -bool is_meson_txlx_tvmode(void) +static bool is_meson_txlx_tvmode(void) { if ((is_meson_txlx()) && (tv_mode == 1)) return true; else return false; } -bool is_meson_txlx_stbmode(void) + +static bool is_meson_txlx_stbmode(void) { if ((is_meson_txlx()) && (tv_mode == 0)) return true; else return false; } -bool is_meson_tm2(void) + +static bool is_meson_tm2(void) { if (dv_meson_dev.cpu_id == _CPU_MAJOR_ID_TM2) return true; @@ -1183,7 +1179,7 @@ bool is_meson_tm2(void) return false; } -bool is_meson_tm2_tvmode(void) +static bool is_meson_tm2_tvmode(void) { if ((is_meson_tm2()) && (tv_mode == 1)) return true; @@ -1191,7 +1187,7 @@ bool is_meson_tm2_tvmode(void) return false; } -bool is_meson_tm2_stbmode(void) +static bool is_meson_tm2_stbmode(void) { if ((is_meson_tm2()) && (tv_mode == 0)) return true; @@ -1199,7 +1195,7 @@ bool is_meson_tm2_stbmode(void) return false; } -bool is_meson_tvmode(void) +static bool is_meson_tvmode(void) { if (is_meson_tm2_tvmode() || is_meson_txlx_tvmode()) @@ -1208,6 +1204,15 @@ bool is_meson_tvmode(void) return false; } +static int is_graphics_output_off(void) +{ + if (is_meson_g12() || is_meson_tm2_stbmode()) + return !(READ_VPP_REG(OSD1_BLEND_SRC_CTRL) & (0xf << 8)) && + !(READ_VPP_REG(OSD2_BLEND_SRC_CTRL) & (0xf << 8)); + else + return (!(READ_VPP_REG(VPP_MISC) & (1 << 12))); +} + static u32 CORE1_BASE; static u32 CORE1_1_BASE; static u32 CORE2A_BASE; @@ -1881,7 +1886,7 @@ int dolby_vision_update_setting(void) size = 8 * STB_DMA_TBL_SIZE; memcpy(dma_vaddr, dma_data, size); } - if (size && (debug_dolby & 0x8)) { + if (size && (debug_dolby & 0x800)) { p = (uint64_t *)dma_vaddr; pr_info("dma size = %d\n", STB_DMA_TBL_SIZE); for (i = 0; i < size / 8; i += 2) @@ -5932,8 +5937,9 @@ static void calculate_panel_max_pq( max_lin = (max_lin / 100) * 100 + 500; max_pq = L2PQ_500_4000[(max_lin - 500) / 100]; } - pr_dolby_dbg("panel max lumin changed from %d(%d) to %d(%d)\n", - tv_max_lin, tv_max_pq, max_lin, max_pq); + if (debug_dolby & 2) + pr_dolby_dbg("panel max lumin changed from %d(%d) to %d(%d)\n", + tv_max_lin, tv_max_pq, max_lin, max_pq); tv_max_lin = max_lin; tv_max_pq = max_pq; config->max_lin = @@ -7268,12 +7274,13 @@ int dolby_vision_process( if (sink_changed || policy_changed || format_changed || (video_status == 1) || (graphic_status & 2) || (dolby_vision_flags & FLAG_FORCE_HDMI_PKT)) { - pr_dolby_dbg("sink %s, cap 0x%x, video %s, osd %s, vf %p, toggle mode %d\n", - current_sink_available ? "on" : "off", - current_hdr_cap, - video_turn_off ? "off" : "on", - is_graphics_output_off() ? "off" : "on", - vf, toggle_mode); + if (debug_dolby & 1) + pr_dolby_dbg("sink %s,cap 0x%x,video %s,osd %s,vf %p,toggle %d\n", + current_sink_available ? "on" : "off", + current_hdr_cap, + video_turn_off ? "off" : "on", + is_graphics_output_off() ? "off" : "on", + vf, toggle_mode); if (vf && !dolby_vision_parse_metadata( vf, toggle_mode, false, false)) { diff --git a/drivers/amlogic/media/enhancement/amvecm/set_hdr2_v0.c b/drivers/amlogic/media/enhancement/amvecm/set_hdr2_v0.c index 4c33306429b7..907e0244f7bb 100644 --- a/drivers/amlogic/media/enhancement/amvecm/set_hdr2_v0.c +++ b/drivers/amlogic/media/enhancement/amvecm/set_hdr2_v0.c @@ -2303,8 +2303,11 @@ enum hdr_process_sel hdr_func(enum hdr_module_sel module_sel, memset(&hdr_mtx_param, 0, sizeof(struct hdr_proc_mtx_param_s)); memset(&hdr_lut_param, 0, sizeof(struct hdr_proc_lut_param_s)); - if ((module_sel == OSD1_HDR) - && (is_meson_g12() || is_meson_sm1_cpu() || is_meson_tl1_cpu())) { + if ((module_sel == OSD1_HDR) && + (is_meson_g12a_cpu() || + is_meson_g12b_cpu() || + is_meson_sm1_cpu() || + is_meson_tl1_cpu())) { /* turn off OSD mtx and use HDR for g12, sm1, tl1 */ VSYNC_WR_MPEG_REG( VPP_WRAP_OSD1_MATRIX_EN_CTRL, 0); @@ -2934,7 +2937,8 @@ enum hdr_process_sel hdr10p_func( memset(&hdr_lut_param, 0, sizeof(struct hdr_proc_lut_param_s)); if ((module_sel == OSD1_HDR) && - (is_meson_g12() || + (is_meson_g12a_cpu() || + is_meson_g12b_cpu() || is_meson_sm1_cpu() || is_meson_tl1_cpu())) { /* turn off OSD mtx and use HDR for g12, sm1, tl1 */ diff --git a/drivers/amlogic/media/video_sink/video_hw.c b/drivers/amlogic/media/video_sink/video_hw.c index 4c7a38ba49a8..3ec1cc734eae 100644 --- a/drivers/amlogic/media/video_sink/video_hw.c +++ b/drivers/amlogic/media/video_sink/video_hw.c @@ -2566,10 +2566,9 @@ static void disable_vd1_blend(struct video_layer_s *layer) VSYNC_WR_MPEG_REG( VD1_BLEND_SRC_CTRL + misc_off, 0); -#ifdef DV_FUNCTION if (is_dolby_vision_enable()) { - if (is_meson_txlx_stbmode() || - is_meson_gxm()) + if (is_meson_txlx_cpu() || + is_meson_gxm_cpu()) VSYNC_WR_MPEG_REG_BITS( VIU_MISC_CTRL1 + misc_off, 3, 16, 2); /* bypass core1 */ @@ -2578,7 +2577,7 @@ static void disable_vd1_blend(struct video_layer_s *layer) DOLBY_PATH_CTRL + misc_off, 3, 0, 2); } -#endif + /*auto disable sr when video off*/ if (!is_meson_txl_cpu() && !is_meson_txlx_cpu()) { diff --git a/include/linux/amlogic/media/amdolbyvision/dolby_vision.h b/include/linux/amlogic/media/amdolbyvision/dolby_vision.h index b061d10afd9e..9717ad1cecec 100644 --- a/include/linux/amlogic/media/amdolbyvision/dolby_vision.h +++ b/include/linux/amlogic/media/amdolbyvision/dolby_vision.h @@ -79,16 +79,6 @@ void dolby_vision_update_pq_config( char *pq_config_buf); int dolby_vision_update_setting(void); bool is_dolby_vision_stb_mode(void); -bool is_meson_g12(void); -bool is_meson_gxm(void); -bool is_meson_box(void); -bool is_meson_txlx(void); -bool is_meson_txlx_tvmode(void); -bool is_meson_txlx_stbmode(void); -bool is_meson_tm2(void); -bool is_meson_tm2_tvmode(void); -bool is_meson_tm2_stbmode(void); -bool is_meson_tvmode(void); void tv_dolby_vision_crc_clear(int flag); char *tv_dolby_vision_get_crc(u32 *len); void tv_dolby_vision_insert_crc(bool print); -- 2.20.1