diff mbox

No backlight since linux-4.2.4 - drivers/gpu/drm/radeon/atombios_encoders.c

Message ID CADnq5_Nay7xTqr5XuEQ4yXDG+xq_E+R3oWp_TwedmuXs-e4-MQ@mail.gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Alex Deucher Oct. 27, 2015, 3:10 p.m. UTC
On Tue, Oct 27, 2015 at 6:06 AM, Michael Burian <michael.burian@sbg.at> wrote:
> On 10/27/15 10:17, Michel Dänzer wrote:
>>
>> I'm not familiar with the ATOM bytecode, but since the number of
>> bytecode instructions executed seems the same in both cases, I suspect
>> that dig->backlight_level == 0 => ATOM_LCD_BLOFF is executed. (The
>> debugging output in my patch would have provided all of this information
>> and more, but there wasn't any of it in the dmesg you provided)
>>
>> I guess the question then becomes how dig->backlight_level is (supposed
>> to be) initialized.
>>
>> What values do the following files contain in the broken and working cases?
>>
>> /sys/class/backlight/radeon_bl0/bl_power
>> /sys/class/backlight/radeon_bl0/brightness
>> /sys/class/backlight/radeon_bl0/actual_brightness
>> /sys/class/backlight/radeon_bl0/max_brightness
>>
>>
>
> These files do not exist on my system,
> I can offer /sys/class/backlight/acpi_video0/
>
> content is identical in both cases
>
> bl_power        0
> brightness      10
> actual_brightness       10
> max_brightness  10
>
>

It would appear that your system does not use the gpu backlight
controller.  Either it's lying or messing with the GPU backlight
controller causes some bad interaction with whatever does control it.
Does the attached radeon patch help?  I'm also attaching an amdgpu
patch for reference in case the same problem appears on amdgpu.

Alex

Comments

Michael Burian Oct. 27, 2015, 4:23 p.m. UTC | #1
On 10/27/15 16:10, Alex Deucher wrote:

> 
> It would appear that your system does not use the gpu backlight
> controller.  Either it's lying or messing with the GPU backlight
> controller causes some bad interaction with whatever does control it.
> Does the attached radeon patch help?  I'm also attaching an amdgpu
> patch for reference in case the same problem appears on amdgpu.
> 

no, still no backlight when applied against current current mainline

858e904bd71dd0057a548d6785d94ce5ec4aeabd (Merge tag 'iommu-fixes-v4.3-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu)
diff mbox

Patch

From e464cc8304fae331537b86f53f49c26854cdff59 Mon Sep 17 00:00:00 2001
From: Alex Deucher <alexander.deucher@amd.com>
Date: Tue, 27 Oct 2015 10:56:44 -0400
Subject: [PATCH 1/2] drm/radeon: fix backlight handling when not controlled by
 GPU

Some systems claim the backlight is not controlled by the GPU
but it seems to either actually be controlled by the GPU, or
messing with the GPU backlight controls causes some other
problem.  If the system indicates the GPU does not control the
backlight, revert back to the old behavior.

Fixes a regression in commit:
4281f46ef839050d2ef60348f661eb463c21cc2e

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
---
 drivers/gpu/drm/radeon/atombios_encoders.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c b/drivers/gpu/drm/radeon/atombios_encoders.c
index 65adb9c..8ce32f9 100644
--- a/drivers/gpu/drm/radeon/atombios_encoders.c
+++ b/drivers/gpu/drm/radeon/atombios_encoders.c
@@ -1624,9 +1624,14 @@  radeon_atom_encoder_dpms_avivo(struct drm_encoder *encoder, int mode)
 		} else
 			atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args);
 		if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) {
-			struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;
+			if (rdev->mode_info.firmware_flags & ATOM_BIOS_INFO_BL_CONTROLLED_BY_GPU) {
+				struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;
 
-			atombios_set_backlight_level(radeon_encoder, dig->backlight_level);
+				atombios_set_backlight_level(radeon_encoder, dig->backlight_level);
+			} else {
+				args.ucAction = ATOM_LCD_BLON;
+				atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args);
+			}
 		}
 		break;
 	case DRM_MODE_DPMS_STANDBY:
@@ -1706,8 +1711,13 @@  radeon_atom_encoder_dpms_dig(struct drm_encoder *encoder, int mode)
 			if (ASIC_IS_DCE4(rdev))
 				atombios_dig_encoder_setup(encoder, ATOM_ENCODER_CMD_DP_VIDEO_ON, 0);
 		}
-		if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT))
-			atombios_set_backlight_level(radeon_encoder, dig->backlight_level);
+		if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) {
+			if (rdev->mode_info.firmware_flags & ATOM_BIOS_INFO_BL_CONTROLLED_BY_GPU)
+				atombios_set_backlight_level(radeon_encoder, dig->backlight_level);
+			else
+				atombios_dig_transmitter_setup(encoder,
+							       ATOM_TRANSMITTER_ACTION_LCD_BLON, 0, 0);
+		}
 		if (ext_encoder)
 			atombios_external_encoder_setup(encoder, ext_encoder, ATOM_ENABLE);
 		break;
-- 
1.8.3.1