mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-04 11:43:54 +08:00
drm/amd/display: Implement backlight_ops.get_brightness
[Why] This hook that is supposed to read the actual backlight value is used in a few places throughout the kernel to setup or force update on backlight [How] Create a dc function that calls the existing abm function, and call that function from amdgpu Signed-off-by: David Francis <David.Francis@amd.com> Reviewed-by: Harry Wentland <Harry.Wentland@amd.com> Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
0301ccbaf6
commit
620a0d27b2
@ -1320,7 +1320,12 @@ static int amdgpu_dm_backlight_update_status(struct backlight_device *bd)
|
||||
|
||||
static int amdgpu_dm_backlight_get_brightness(struct backlight_device *bd)
|
||||
{
|
||||
return bd->props.brightness;
|
||||
struct amdgpu_display_manager *dm = bl_get_data(bd);
|
||||
int ret = dc_link_get_backlight_level(dm->backlight_link);
|
||||
|
||||
if (ret == DC_ERROR_UNEXPECTED)
|
||||
return bd->props.brightness;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const struct backlight_ops amdgpu_dm_backlight_ops = {
|
||||
|
@ -2026,6 +2026,15 @@ enum dc_status dc_link_validate_mode_timing(
|
||||
return DC_OK;
|
||||
}
|
||||
|
||||
int dc_link_get_backlight_level(const struct dc_link *link)
|
||||
{
|
||||
struct abm *abm = link->ctx->dc->res_pool->abm;
|
||||
|
||||
if (abm == NULL || abm->funcs->get_current_backlight_8_bit == NULL)
|
||||
return DC_ERROR_UNEXPECTED;
|
||||
|
||||
return (int) abm->funcs->get_current_backlight_8_bit(abm);
|
||||
}
|
||||
|
||||
bool dc_link_set_backlight_level(const struct dc_link *link, uint32_t level,
|
||||
uint32_t frame_ramp, const struct dc_stream_state *stream)
|
||||
|
@ -141,6 +141,8 @@ static inline struct dc_link *dc_get_link_at_index(struct dc *dc, uint32_t link_
|
||||
bool dc_link_set_backlight_level(const struct dc_link *dc_link, uint32_t level,
|
||||
uint32_t frame_ramp, const struct dc_stream_state *stream);
|
||||
|
||||
int dc_link_get_backlight_level(const struct dc_link *dc_link);
|
||||
|
||||
bool dc_link_set_abm_disable(const struct dc_link *dc_link);
|
||||
|
||||
bool dc_link_set_psr_enable(const struct dc_link *dc_link, bool enable, bool wait);
|
||||
|
Loading…
Reference in New Issue
Block a user