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

Configure Feed

Select the types of activity you want to include in your feed.

drm/amd/display: Add read backlight interface

[Why & How]
Add read backlight interface to get ABM data.

Signed-off-by: Yongqiang Sun <yongqiang.sun@amd.com>
Reviewed-by: Anthony Koo <Anthony.Koo@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Yongqiang Sun and committed by
Alex Deucher
ccc87505 6ee90e88

+18 -4
+1
drivers/gpu/drm/amd/display/dc/core/dc_stream.c
··· 708 708 "\tlink: %d\n", 709 709 stream->link->link_index); 710 710 } 711 +
+11 -1
drivers/gpu/drm/amd/display/dc/dce/dce_abm.h
··· 46 46 SR(BL1_PWM_USER_LEVEL), \ 47 47 SR(DC_ABM1_LS_MIN_MAX_PIXEL_VALUE_THRES), \ 48 48 SR(DC_ABM1_HGLS_REG_READ_PROGRESS), \ 49 + SR(DC_ABM1_ACE_OFFSET_SLOPE_0), \ 50 + SR(DC_ABM1_ACE_THRES_12), \ 49 51 SR(BIOS_SCRATCH_2) 50 52 51 53 #define ABM_DCN10_REG_LIST(id)\ ··· 62 60 SRI(BL1_PWM_USER_LEVEL, ABM, id), \ 63 61 SRI(DC_ABM1_LS_MIN_MAX_PIXEL_VALUE_THRES, ABM, id), \ 64 62 SRI(DC_ABM1_HGLS_REG_READ_PROGRESS, ABM, id), \ 63 + SRI(DC_ABM1_ACE_OFFSET_SLOPE_0, ABM, id), \ 64 + SRI(DC_ABM1_ACE_THRES_12, ABM, id), \ 65 65 NBIO_SR(BIOS_SCRATCH_2) 66 66 67 67 #define ABM_DCN20_REG_LIST() \ ··· 78 74 SR(BL1_PWM_USER_LEVEL), \ 79 75 SR(DC_ABM1_LS_MIN_MAX_PIXEL_VALUE_THRES), \ 80 76 SR(DC_ABM1_HGLS_REG_READ_PROGRESS), \ 77 + SR(DC_ABM1_ACE_OFFSET_SLOPE_0), \ 78 + SR(DC_ABM1_ACE_THRES_12), \ 81 79 NBIO_SR(BIOS_SCRATCH_2) 82 80 83 81 #if defined(CONFIG_DRM_AMD_DC_DCN3_0) 84 - #define ABM_DCN301_REG_LIST(id)\ 82 + #define ABM_DCN30_REG_LIST(id)\ 85 83 ABM_COMMON_REG_LIST_DCE_BASE(), \ 86 84 SRI(DC_ABM1_HG_SAMPLE_RATE, ABM, id), \ 87 85 SRI(DC_ABM1_LS_SAMPLE_RATE, ABM, id), \ ··· 95 89 SRI(BL1_PWM_USER_LEVEL, ABM, id), \ 96 90 SRI(DC_ABM1_LS_MIN_MAX_PIXEL_VALUE_THRES, ABM, id), \ 97 91 SRI(DC_ABM1_HGLS_REG_READ_PROGRESS, ABM, id), \ 92 + SRI(DC_ABM1_ACE_OFFSET_SLOPE_0, ABM, id), \ 93 + SRI(DC_ABM1_ACE_THRES_12, ABM, id), \ 98 94 NBIO_SR(BIOS_SCRATCH_2) 99 95 #endif 100 96 ··· 216 208 uint32_t BL1_PWM_USER_LEVEL; 217 209 uint32_t DC_ABM1_LS_MIN_MAX_PIXEL_VALUE_THRES; 218 210 uint32_t DC_ABM1_HGLS_REG_READ_PROGRESS; 211 + uint32_t DC_ABM1_ACE_OFFSET_SLOPE_0; 212 + uint32_t DC_ABM1_ACE_THRES_12; 219 213 uint32_t MASTER_COMM_CNTL_REG; 220 214 uint32_t MASTER_COMM_CMD_REG; 221 215 uint32_t MASTER_COMM_DATA_REG1;
+4 -2
drivers/gpu/drm/amd/display/dc/dce/dce_panel_cntl.c
··· 46 46 #define FN(reg_name, field_name) \ 47 47 dce_panel_cntl->shift->field_name, dce_panel_cntl->mask->field_name 48 48 49 - static unsigned int calculate_16_bit_backlight_from_pwm(struct dce_panel_cntl *dce_panel_cntl) 49 + static unsigned int dce_get_16_bit_backlight_from_pwm(struct panel_cntl *panel_cntl) 50 50 { 51 51 uint64_t current_backlight; 52 52 uint32_t round_result; 53 53 uint32_t pwm_period_cntl, bl_period, bl_int_count; 54 54 uint32_t bl_pwm_cntl, bl_pwm, fractional_duty_cycle_en; 55 55 uint32_t bl_period_mask, bl_pwm_mask; 56 + struct dce_panel_cntl *dce_panel_cntl = TO_DCE_PANEL_CNTL(panel_cntl); 56 57 57 58 pwm_period_cntl = REG_READ(BL_PWM_PERIOD_CNTL); 58 59 REG_GET(BL_PWM_PERIOD_CNTL, BL_PWM_PERIOD, &bl_period); ··· 151 150 REG_UPDATE(BL_PWM_GRP1_REG_LOCK, 152 151 BL_PWM_GRP1_REG_LOCK, 0); 153 152 154 - current_backlight = calculate_16_bit_backlight_from_pwm(dce_panel_cntl); 153 + current_backlight = dce_get_16_bit_backlight_from_pwm(panel_cntl); 155 154 156 155 return current_backlight; 157 156 } ··· 274 273 .is_panel_powered_on = dce_is_panel_powered_on, 275 274 .store_backlight_level = dce_store_backlight_level, 276 275 .driver_set_backlight = dce_driver_set_backlight, 276 + .get_current_backlight = dce_get_16_bit_backlight_from_pwm, 277 277 }; 278 278 279 279 void dce_panel_cntl_construct(
+1 -1
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_resource.c
··· 340 340 341 341 #define abm_regs(id)\ 342 342 [id] = {\ 343 - ABM_DCN301_REG_LIST(id)\ 343 + ABM_DCN30_REG_LIST(id)\ 344 344 } 345 345 346 346 static const struct dce_abm_registers abm_regs[] = {
+1
drivers/gpu/drm/amd/display/dc/inc/hw/panel_cntl.h
··· 49 49 void (*store_backlight_level)(struct panel_cntl *panel_cntl); 50 50 void (*driver_set_backlight)(struct panel_cntl *panel_cntl, 51 51 uint32_t backlight_pwm_u16_16); 52 + uint32_t (*get_current_backlight)(struct panel_cntl *panel_cntl); 52 53 }; 53 54 54 55 struct panel_cntl_init_data {