diff options
author | Alex Deucher <alexander.deucher@amd.com> | 2012-09-14 09:45:50 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2012-09-27 10:22:42 -0400 |
commit | bced76f27165ca7733437715185c3a1aa526f7a1 (patch) | |
tree | b7c782d651723e49f19819a2beeccc827a0fcad5 | |
parent | 6d92f81dcf2d40b8ebb947bba5435642b830f649 (diff) | |
download | lwn-bced76f27165ca7733437715185c3a1aa526f7a1.tar.gz lwn-bced76f27165ca7733437715185c3a1aa526f7a1.zip |
drm/radeon: restore backlight level on resume
Restore the backlight level on resume. Some systems
need to explicitly restore the backlight level on
resume.
Fixes panel resume on my Trinity laptop and may fix the
following bugs:
https://bugs.freedesktop.org/show_bug.cgi?id=43829
https://bugzilla.kernel.org/show_bug.cgi?id=46241
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | drivers/gpu/drm/radeon/atombios_encoders.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_device.c | 7 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_encoders.c | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_mode.h | 6 |
4 files changed, 14 insertions, 4 deletions
diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c b/drivers/gpu/drm/radeon/atombios_encoders.c index 5ce13b8fbe6c..806cbcc94fdd 100644 --- a/drivers/gpu/drm/radeon/atombios_encoders.c +++ b/drivers/gpu/drm/radeon/atombios_encoders.c @@ -32,8 +32,6 @@ extern int atom_debug; -#if defined(CONFIG_BACKLIGHT_CLASS_DEVICE) || defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE) - static u8 radeon_atom_get_backlight_level_from_reg(struct radeon_device *rdev) { @@ -134,6 +132,8 @@ atombios_set_backlight_level(struct radeon_encoder *radeon_encoder, u8 level) } } +#if defined(CONFIG_BACKLIGHT_CLASS_DEVICE) || defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE) + static u8 radeon_atom_bl_level(struct backlight_device *bd) { u8 level; diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index 6fca11c64dcd..64a42647f08a 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c @@ -1282,6 +1282,13 @@ int radeon_resume_kms(struct drm_device *dev) if (rdev->is_atom_bios) { radeon_atom_encoder_init(rdev); radeon_atom_disp_eng_pll_init(rdev); + /* turn on the BL */ + if (rdev->mode_info.bl_encoder) { + u8 bl_level = radeon_get_backlight_level(rdev, + rdev->mode_info.bl_encoder); + radeon_set_backlight_level(rdev, rdev->mode_info.bl_encoder, + bl_level); + } } /* reset hpd state */ radeon_hpd_init(rdev); diff --git a/drivers/gpu/drm/radeon/radeon_encoders.c b/drivers/gpu/drm/radeon/radeon_encoders.c index 93b0d64b3f6d..e66c807df9e6 100644 --- a/drivers/gpu/drm/radeon/radeon_encoders.c +++ b/drivers/gpu/drm/radeon/radeon_encoders.c @@ -179,6 +179,7 @@ radeon_link_encoder_connector(struct drm_device *dev) radeon_atom_backlight_init(radeon_encoder, connector); else radeon_legacy_backlight_init(radeon_encoder, connector); + rdev->mode_info.bl_encoder = radeon_encoder; } } } diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h index 917d02750cf7..527761801590 100644 --- a/drivers/gpu/drm/radeon/radeon_mode.h +++ b/drivers/gpu/drm/radeon/radeon_mode.h @@ -254,12 +254,14 @@ struct radeon_mode_info { struct radeon_fbdev *rfbdev; /* firmware flags */ u16 firmware_flags; + /* pointer to backlight encoder */ + struct radeon_encoder *bl_encoder; }; -#if defined(CONFIG_BACKLIGHT_CLASS_DEVICE) || defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE) - #define RADEON_MAX_BL_LEVEL 0xFF +#if defined(CONFIG_BACKLIGHT_CLASS_DEVICE) || defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE) + struct radeon_backlight_privdata { struct radeon_encoder *encoder; uint8_t negative; |