diff options
author | Anthony Koo <Anthony.Koo@amd.com> | 2018-10-18 15:03:56 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2018-11-05 14:21:43 -0500 |
commit | ba45df4cb7193570e9fa4979b198ec313899417c (patch) | |
tree | 638df0381cdd3dc7d835443959772017736572bd /drivers/gpu/drm/amd | |
parent | f41a895026b8cb6f765190de7d2e7bc3ccbbd183 (diff) |
drm/amd/display: Expose target backlight level
[Why]
DM may want to understand any backlight optimizations
applied, so DM needs a way to query from the HW both
the real current backlight, which may be value during
transition.
And also target backlight, which may be after some
backlight optimizations applied.
[How]
Add interface to query current and target backlight levels
Target level may indicate backlight level after backlight
optimization and reductions are applied.
Signed-off-by: Anthony Koo <Anthony.Koo@amd.com>
Reviewed-by: Krunoslav Kovac <Krunoslav.Kovac@amd.com>
Acked-by: Leo Li <sunpeng.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd')
-rw-r--r-- | drivers/gpu/drm/amd/display/dc/dce/dce_abm.c | 12 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/display/dc/inc/hw/abm.h | 1 |
2 files changed, 13 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c b/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c index e9765bb38a8b..2a342eae80fd 100644 --- a/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c +++ b/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c | |||
@@ -276,6 +276,17 @@ static unsigned int dce_abm_get_current_backlight(struct abm *abm) | |||
276 | return backlight; | 276 | return backlight; |
277 | } | 277 | } |
278 | 278 | ||
279 | static unsigned int dce_abm_get_target_backlight(struct abm *abm) | ||
280 | { | ||
281 | struct dce_abm *abm_dce = TO_DCE_ABM(abm); | ||
282 | unsigned int backlight = REG_READ(BL1_PWM_TARGET_ABM_LEVEL); | ||
283 | |||
284 | /* return backlight in hardware format which is unsigned 17 bits, with | ||
285 | * 1 bit integer and 16 bit fractional | ||
286 | */ | ||
287 | return backlight; | ||
288 | } | ||
289 | |||
279 | static bool dce_abm_set_level(struct abm *abm, uint32_t level) | 290 | static bool dce_abm_set_level(struct abm *abm, uint32_t level) |
280 | { | 291 | { |
281 | struct dce_abm *abm_dce = TO_DCE_ABM(abm); | 292 | struct dce_abm *abm_dce = TO_DCE_ABM(abm); |
@@ -410,6 +421,7 @@ static const struct abm_funcs dce_funcs = { | |||
410 | .init_backlight = dce_abm_init_backlight, | 421 | .init_backlight = dce_abm_init_backlight, |
411 | .set_backlight_level_pwm = dce_abm_set_backlight_level_pwm, | 422 | .set_backlight_level_pwm = dce_abm_set_backlight_level_pwm, |
412 | .get_current_backlight = dce_abm_get_current_backlight, | 423 | .get_current_backlight = dce_abm_get_current_backlight, |
424 | .get_target_backlight = dce_abm_get_target_backlight, | ||
413 | .set_abm_immediate_disable = dce_abm_immediate_disable | 425 | .set_abm_immediate_disable = dce_abm_immediate_disable |
414 | }; | 426 | }; |
415 | 427 | ||
diff --git a/drivers/gpu/drm/amd/display/dc/inc/hw/abm.h b/drivers/gpu/drm/amd/display/dc/inc/hw/abm.h index 458a641dc796..abc961c0906e 100644 --- a/drivers/gpu/drm/amd/display/dc/inc/hw/abm.h +++ b/drivers/gpu/drm/amd/display/dc/inc/hw/abm.h | |||
@@ -58,6 +58,7 @@ struct abm_funcs { | |||
58 | bool use_smooth_brightness); | 58 | bool use_smooth_brightness); |
59 | 59 | ||
60 | unsigned int (*get_current_backlight)(struct abm *abm); | 60 | unsigned int (*get_current_backlight)(struct abm *abm); |
61 | unsigned int (*get_target_backlight)(struct abm *abm); | ||
61 | }; | 62 | }; |
62 | 63 | ||
63 | #endif | 64 | #endif |