Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amd/display: Bug in dce_is_panel_backlight_on()

[Why]
dce_is_panel_backlight_on() will return wrong value if
LVTMA_BLON_OVRD is 0

[How]
When LVTMA_BLON_OVRD is 0, read
LVTMA_PWRSEQ_TARGET_STATE instead

Signed-off-by: Peikang Zhang <peikang.zhang@amd.com>
Reviewed-by: Anthony Koo <Anthony.Koo@amd.com>
Acked-by: Qingqing Zhuo <qingqing.zhuo@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Peikang Zhang and committed by
Alex Deucher
cbf229bb c15bc8d2

+11 -3
+7 -3
drivers/gpu/drm/amd/display/dc/dce/dce_panel_cntl.c
··· 159 159 static bool dce_is_panel_backlight_on(struct panel_cntl *panel_cntl) 160 160 { 161 161 struct dce_panel_cntl *dce_panel_cntl = TO_DCE_PANEL_CNTL(panel_cntl); 162 - uint32_t value; 162 + uint32_t blon, blon_ovrd, pwrseq_target_state; 163 163 164 - REG_GET(PWRSEQ_CNTL, LVTMA_BLON, &value); 164 + REG_GET_2(PWRSEQ_CNTL, LVTMA_BLON, &blon, LVTMA_BLON_OVRD, &blon_ovrd); 165 + REG_GET(PWRSEQ_CNTL, LVTMA_PWRSEQ_TARGET_STATE, &pwrseq_target_state); 165 166 166 - return value; 167 + if (blon_ovrd) 168 + return blon; 169 + else 170 + return pwrseq_target_state; 167 171 } 168 172 169 173 static bool dce_is_panel_powered_on(struct panel_cntl *panel_cntl)
+4
drivers/gpu/drm/amd/display/dc/dce/dce_panel_cntl.h
··· 61 61 62 62 #define DCE_PANEL_CNTL_MASK_SH_LIST(mask_sh) \ 63 63 DCE_PANEL_CNTL_SF(LVTMA_PWRSEQ_CNTL, LVTMA_BLON, mask_sh),\ 64 + DCE_PANEL_CNTL_SF(LVTMA_PWRSEQ_CNTL, LVTMA_BLON_OVRD, mask_sh),\ 64 65 DCE_PANEL_CNTL_SF(LVTMA_PWRSEQ_CNTL, LVTMA_DIGON, mask_sh),\ 65 66 DCE_PANEL_CNTL_SF(LVTMA_PWRSEQ_CNTL, LVTMA_DIGON_OVRD, mask_sh),\ 67 + DCE_PANEL_CNTL_SF(LVTMA_PWRSEQ_CNTL, LVTMA_PWRSEQ_TARGET_STATE, mask_sh), \ 66 68 DCE_PANEL_CNTL_SF(LVTMA_PWRSEQ_STATE, LVTMA_PWRSEQ_TARGET_STATE_R, mask_sh), \ 67 69 DCE_PANEL_CNTL_SF(LVTMA_PWRSEQ_REF_DIV, BL_PWM_REF_DIV, mask_sh), \ 68 70 DCE_PANEL_CNTL_SF(BL_PWM_PERIOD_CNTL, BL_PWM_PERIOD, mask_sh), \ ··· 78 76 79 77 #define DCE_PANEL_CNTL_REG_FIELD_LIST(type) \ 80 78 type LVTMA_BLON;\ 79 + type LVTMA_BLON_OVRD;\ 81 80 type LVTMA_DIGON;\ 82 81 type LVTMA_DIGON_OVRD;\ 82 + type LVTMA_PWRSEQ_TARGET_STATE; \ 83 83 type LVTMA_PWRSEQ_TARGET_STATE_R; \ 84 84 type BL_PWM_REF_DIV; \ 85 85 type BL_PWM_EN; \