Commit ba45df4c authored by Anthony Koo's avatar Anthony Koo Committed by Alex Deucher

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: default avatarAnthony Koo <Anthony.Koo@amd.com>
Reviewed-by: default avatarKrunoslav Kovac <Krunoslav.Kovac@amd.com>
Acked-by: default avatarLeo Li <sunpeng.li@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent f41a8950
...@@ -276,6 +276,17 @@ static unsigned int dce_abm_get_current_backlight(struct abm *abm) ...@@ -276,6 +276,17 @@ static unsigned int dce_abm_get_current_backlight(struct abm *abm)
return backlight; return backlight;
} }
static unsigned int dce_abm_get_target_backlight(struct abm *abm)
{
struct dce_abm *abm_dce = TO_DCE_ABM(abm);
unsigned int backlight = REG_READ(BL1_PWM_TARGET_ABM_LEVEL);
/* return backlight in hardware format which is unsigned 17 bits, with
* 1 bit integer and 16 bit fractional
*/
return backlight;
}
static bool dce_abm_set_level(struct abm *abm, uint32_t level) static bool dce_abm_set_level(struct abm *abm, uint32_t level)
{ {
struct dce_abm *abm_dce = TO_DCE_ABM(abm); struct dce_abm *abm_dce = TO_DCE_ABM(abm);
...@@ -410,6 +421,7 @@ static const struct abm_funcs dce_funcs = { ...@@ -410,6 +421,7 @@ static const struct abm_funcs dce_funcs = {
.init_backlight = dce_abm_init_backlight, .init_backlight = dce_abm_init_backlight,
.set_backlight_level_pwm = dce_abm_set_backlight_level_pwm, .set_backlight_level_pwm = dce_abm_set_backlight_level_pwm,
.get_current_backlight = dce_abm_get_current_backlight, .get_current_backlight = dce_abm_get_current_backlight,
.get_target_backlight = dce_abm_get_target_backlight,
.set_abm_immediate_disable = dce_abm_immediate_disable .set_abm_immediate_disable = dce_abm_immediate_disable
}; };
......
...@@ -58,6 +58,7 @@ struct abm_funcs { ...@@ -58,6 +58,7 @@ struct abm_funcs {
bool use_smooth_brightness); bool use_smooth_brightness);
unsigned int (*get_current_backlight)(struct abm *abm); unsigned int (*get_current_backlight)(struct abm *abm);
unsigned int (*get_target_backlight)(struct abm *abm);
}; };
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment