mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-03-09 06:08:35 -04:00
drm/amd/display: make all backlight calls link based
[Why] Backlight adjustment is tied to a specific display. So make the calls target a link rather than making it a global state. [How] make all backlight calls link based Signed-off-by: Anthony Koo <Anthony.Koo@amd.com> Reviewed-by: Tony Cheng <Tony.Cheng@amd.com> Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
committed by
Alex Deucher
parent
06535a48e2
commit
fefe92fe74
@@ -1228,8 +1228,9 @@ static int current_backlight_read(struct seq_file *m, void *data)
|
||||
struct drm_info_node *node = (struct drm_info_node *)m->private;
|
||||
struct drm_device *dev = node->minor->dev;
|
||||
struct amdgpu_device *adev = dev->dev_private;
|
||||
struct dc *dc = adev->dm.dc;
|
||||
unsigned int backlight = dc_get_current_backlight_pwm(dc);
|
||||
struct amdgpu_display_manager *dm = &adev->dm;
|
||||
|
||||
unsigned int backlight = dc_link_get_backlight_level(dm->backlight_link);
|
||||
|
||||
seq_printf(m, "0x%x\n", backlight);
|
||||
return 0;
|
||||
@@ -1245,8 +1246,9 @@ static int target_backlight_read(struct seq_file *m, void *data)
|
||||
struct drm_info_node *node = (struct drm_info_node *)m->private;
|
||||
struct drm_device *dev = node->minor->dev;
|
||||
struct amdgpu_device *adev = dev->dev_private;
|
||||
struct dc *dc = adev->dm.dc;
|
||||
unsigned int backlight = dc_get_target_backlight_pwm(dc);
|
||||
struct amdgpu_display_manager *dm = &adev->dm;
|
||||
|
||||
unsigned int backlight = dc_link_get_target_backlight_pwm(dm->backlight_link);
|
||||
|
||||
seq_printf(m, "0x%x\n", backlight);
|
||||
return 0;
|
||||
|
||||
@@ -2646,33 +2646,12 @@ void dc_set_power_state(
|
||||
|
||||
void dc_resume(struct dc *dc)
|
||||
{
|
||||
|
||||
uint32_t i;
|
||||
|
||||
for (i = 0; i < dc->link_count; i++)
|
||||
core_link_resume(dc->links[i]);
|
||||
}
|
||||
|
||||
unsigned int dc_get_current_backlight_pwm(struct dc *dc)
|
||||
{
|
||||
struct abm *abm = dc->res_pool->abm;
|
||||
|
||||
if (abm)
|
||||
return abm->funcs->get_current_backlight(abm);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned int dc_get_target_backlight_pwm(struct dc *dc)
|
||||
{
|
||||
struct abm *abm = dc->res_pool->abm;
|
||||
|
||||
if (abm)
|
||||
return abm->funcs->get_target_backlight(abm);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool dc_is_dmcu_initialized(struct dc *dc)
|
||||
{
|
||||
struct dmcu *dmcu = dc->res_pool->dmcu;
|
||||
|
||||
@@ -2450,6 +2450,16 @@ int dc_link_get_backlight_level(const struct dc_link *link)
|
||||
return (int) abm->funcs->get_current_backlight(abm);
|
||||
}
|
||||
|
||||
int dc_link_get_target_backlight_pwm(const struct dc_link *link)
|
||||
{
|
||||
struct abm *abm = link->ctx->dc->res_pool->abm;
|
||||
|
||||
if (abm == NULL || abm->funcs->get_target_backlight == NULL)
|
||||
return DC_ERROR_UNEXPECTED;
|
||||
|
||||
return (int) abm->funcs->get_target_backlight(abm);
|
||||
}
|
||||
|
||||
bool dc_link_set_backlight_level(const struct dc_link *link,
|
||||
uint32_t backlight_pwm_u16_16,
|
||||
uint32_t frame_ramp)
|
||||
@@ -2507,14 +2517,24 @@ bool dc_link_set_backlight_level(const struct dc_link *link,
|
||||
bool dc_link_set_abm_disable(const struct dc_link *link)
|
||||
{
|
||||
struct dc *dc = link->ctx->dc;
|
||||
struct abm *abm = dc->res_pool->abm;
|
||||
struct abm *abm = NULL;
|
||||
bool success = false;
|
||||
int i;
|
||||
|
||||
if ((abm == NULL) || (abm->funcs->set_backlight_level_pwm == NULL))
|
||||
return false;
|
||||
for (i = 0; i < MAX_PIPES; i++) {
|
||||
struct pipe_ctx pipe_ctx = dc->current_state->res_ctx.pipe_ctx[i];
|
||||
struct dc_stream_state *stream = pipe_ctx.stream;
|
||||
|
||||
abm->funcs->set_abm_immediate_disable(abm);
|
||||
if (stream && stream->link == link) {
|
||||
abm = pipe_ctx.stream_res.abm;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
if (abm)
|
||||
success = abm->funcs->set_abm_immediate_disable(abm);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
bool dc_link_set_psr_allow_active(struct dc_link *link, bool allow_active, bool wait)
|
||||
|
||||
@@ -1139,8 +1139,6 @@ void dc_set_power_state(
|
||||
struct dc *dc,
|
||||
enum dc_acpi_cm_power_state power_state);
|
||||
void dc_resume(struct dc *dc);
|
||||
unsigned int dc_get_current_backlight_pwm(struct dc *dc);
|
||||
unsigned int dc_get_target_backlight_pwm(struct dc *dc);
|
||||
|
||||
#if defined(CONFIG_DRM_AMD_DC_HDCP)
|
||||
/*
|
||||
|
||||
@@ -217,6 +217,8 @@ bool dc_link_set_default_brightness_aux(struct dc_link *link);
|
||||
|
||||
int dc_link_get_backlight_level(const struct dc_link *dc_link);
|
||||
|
||||
int dc_link_get_target_backlight_pwm(const struct dc_link *link);
|
||||
|
||||
bool dc_link_set_abm_disable(const struct dc_link *dc_link);
|
||||
|
||||
bool dc_link_set_psr_allow_active(struct dc_link *dc_link, bool enable, bool wait);
|
||||
|
||||
Reference in New Issue
Block a user