mirror of https://gitee.com/openkylin/linux.git
drm/amdgpu: save/restore backlight level in legacy dce code
Save/restore the backlight level scratch register in S3/S4 so the
backlight level comes back at the previously requested level.
Bug: https://bugzilla.kernel.org/show_bug.cgi?id=199047
Fixes: 4ec6ecf48c
(drm/amdgpu: drop scratch regs save and restore from S3/S4 handling)
Acked-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
0660b58c90
commit
a59b3c80fd
|
@ -350,6 +350,7 @@ struct amdgpu_mode_info {
|
||||||
u16 firmware_flags;
|
u16 firmware_flags;
|
||||||
/* pointer to backlight encoder */
|
/* pointer to backlight encoder */
|
||||||
struct amdgpu_encoder *bl_encoder;
|
struct amdgpu_encoder *bl_encoder;
|
||||||
|
u8 bl_level; /* saved backlight level */
|
||||||
struct amdgpu_audio audio; /* audio stuff */
|
struct amdgpu_audio audio; /* audio stuff */
|
||||||
int num_crtc; /* number of crtcs */
|
int num_crtc; /* number of crtcs */
|
||||||
int num_hpd; /* number of hpd pins */
|
int num_hpd; /* number of hpd pins */
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
#include <linux/backlight.h>
|
#include <linux/backlight.h>
|
||||||
#include "bif/bif_4_1_d.h"
|
#include "bif/bif_4_1_d.h"
|
||||||
|
|
||||||
static u8
|
u8
|
||||||
amdgpu_atombios_encoder_get_backlight_level_from_reg(struct amdgpu_device *adev)
|
amdgpu_atombios_encoder_get_backlight_level_from_reg(struct amdgpu_device *adev)
|
||||||
{
|
{
|
||||||
u8 backlight_level;
|
u8 backlight_level;
|
||||||
|
@ -48,7 +48,7 @@ amdgpu_atombios_encoder_get_backlight_level_from_reg(struct amdgpu_device *adev)
|
||||||
return backlight_level;
|
return backlight_level;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
amdgpu_atombios_encoder_set_backlight_level_to_reg(struct amdgpu_device *adev,
|
amdgpu_atombios_encoder_set_backlight_level_to_reg(struct amdgpu_device *adev,
|
||||||
u8 backlight_level)
|
u8 backlight_level)
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,6 +24,11 @@
|
||||||
#ifndef __ATOMBIOS_ENCODER_H__
|
#ifndef __ATOMBIOS_ENCODER_H__
|
||||||
#define __ATOMBIOS_ENCODER_H__
|
#define __ATOMBIOS_ENCODER_H__
|
||||||
|
|
||||||
|
u8
|
||||||
|
amdgpu_atombios_encoder_get_backlight_level_from_reg(struct amdgpu_device *adev);
|
||||||
|
void
|
||||||
|
amdgpu_atombios_encoder_set_backlight_level_to_reg(struct amdgpu_device *adev,
|
||||||
|
u8 backlight_level);
|
||||||
u8
|
u8
|
||||||
amdgpu_atombios_encoder_get_backlight_level(struct amdgpu_encoder *amdgpu_encoder);
|
amdgpu_atombios_encoder_get_backlight_level(struct amdgpu_encoder *amdgpu_encoder);
|
||||||
void
|
void
|
||||||
|
|
|
@ -2862,6 +2862,11 @@ static int dce_v10_0_hw_fini(void *handle)
|
||||||
|
|
||||||
static int dce_v10_0_suspend(void *handle)
|
static int dce_v10_0_suspend(void *handle)
|
||||||
{
|
{
|
||||||
|
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||||
|
|
||||||
|
adev->mode_info.bl_level =
|
||||||
|
amdgpu_atombios_encoder_get_backlight_level_from_reg(adev);
|
||||||
|
|
||||||
return dce_v10_0_hw_fini(handle);
|
return dce_v10_0_hw_fini(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2870,6 +2875,9 @@ static int dce_v10_0_resume(void *handle)
|
||||||
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
amdgpu_atombios_encoder_set_backlight_level_to_reg(adev,
|
||||||
|
adev->mode_info.bl_level);
|
||||||
|
|
||||||
ret = dce_v10_0_hw_init(handle);
|
ret = dce_v10_0_hw_init(handle);
|
||||||
|
|
||||||
/* turn on the BL */
|
/* turn on the BL */
|
||||||
|
|
|
@ -2988,6 +2988,11 @@ static int dce_v11_0_hw_fini(void *handle)
|
||||||
|
|
||||||
static int dce_v11_0_suspend(void *handle)
|
static int dce_v11_0_suspend(void *handle)
|
||||||
{
|
{
|
||||||
|
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||||
|
|
||||||
|
adev->mode_info.bl_level =
|
||||||
|
amdgpu_atombios_encoder_get_backlight_level_from_reg(adev);
|
||||||
|
|
||||||
return dce_v11_0_hw_fini(handle);
|
return dce_v11_0_hw_fini(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2996,6 +3001,9 @@ static int dce_v11_0_resume(void *handle)
|
||||||
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
amdgpu_atombios_encoder_set_backlight_level_to_reg(adev,
|
||||||
|
adev->mode_info.bl_level);
|
||||||
|
|
||||||
ret = dce_v11_0_hw_init(handle);
|
ret = dce_v11_0_hw_init(handle);
|
||||||
|
|
||||||
/* turn on the BL */
|
/* turn on the BL */
|
||||||
|
|
|
@ -2730,6 +2730,11 @@ static int dce_v6_0_hw_fini(void *handle)
|
||||||
|
|
||||||
static int dce_v6_0_suspend(void *handle)
|
static int dce_v6_0_suspend(void *handle)
|
||||||
{
|
{
|
||||||
|
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||||
|
|
||||||
|
adev->mode_info.bl_level =
|
||||||
|
amdgpu_atombios_encoder_get_backlight_level_from_reg(adev);
|
||||||
|
|
||||||
return dce_v6_0_hw_fini(handle);
|
return dce_v6_0_hw_fini(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2738,6 +2743,9 @@ static int dce_v6_0_resume(void *handle)
|
||||||
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
amdgpu_atombios_encoder_set_backlight_level_to_reg(adev,
|
||||||
|
adev->mode_info.bl_level);
|
||||||
|
|
||||||
ret = dce_v6_0_hw_init(handle);
|
ret = dce_v6_0_hw_init(handle);
|
||||||
|
|
||||||
/* turn on the BL */
|
/* turn on the BL */
|
||||||
|
|
|
@ -2760,6 +2760,11 @@ static int dce_v8_0_hw_fini(void *handle)
|
||||||
|
|
||||||
static int dce_v8_0_suspend(void *handle)
|
static int dce_v8_0_suspend(void *handle)
|
||||||
{
|
{
|
||||||
|
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||||
|
|
||||||
|
adev->mode_info.bl_level =
|
||||||
|
amdgpu_atombios_encoder_get_backlight_level_from_reg(adev);
|
||||||
|
|
||||||
return dce_v8_0_hw_fini(handle);
|
return dce_v8_0_hw_fini(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2768,6 +2773,9 @@ static int dce_v8_0_resume(void *handle)
|
||||||
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
amdgpu_atombios_encoder_set_backlight_level_to_reg(adev,
|
||||||
|
adev->mode_info.bl_level);
|
||||||
|
|
||||||
ret = dce_v8_0_hw_init(handle);
|
ret = dce_v8_0_hw_init(handle);
|
||||||
|
|
||||||
/* turn on the BL */
|
/* turn on the BL */
|
||||||
|
|
Loading…
Reference in New Issue