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

Message ID 562DF333.3070708@daenzer.net
State New
Headers show

Commit Message

Michel Dänzer Oct. 26, 2015, 9:32 a.m. UTC
On 25.10.2015 04:25, Michael Burian wrote:
> hi,
> 
> after updating the kernel from linux-stable[0] v4.2.3 to v4.2.4 on my
> hp compaq nx9420 laptop (Debian Jessie, amd64), the backlight is turned off
> within the first couple of seconds during boot.
> 
> The situation persists (Xorg seems to be running fine, icons can be recognized
> by illuminating the screen with a flashlight) until reboot using an earlier
> kernel.
> 
> current mainline[1] as of now (4.3.0-rc6-00277-g01815536) is also affected
> 
> Workaround: use earlier kernel (v4.2.3) or (see below)
> 
> Hardware:
> 
> lspci | grep adeo
> 01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] RV530/M56-P [Mobility Radeon X1600]
> 
> git bisect log
> # bad: [190bd21bba09ed476d9359d3e8be20e8d9dcd8a4] Linux 4.2.4
> # good: [fcba09f2b0bf27eeaa1d4d439edb649585f35040] Linux 4.2.3
> git bisect start 'v4.2.4' 'v4.2.3' 'drivers/gpu/'
> # good: [885838eef785ff810dac945be8132856f2113cf1] drm/amdgpu: make UVD handle checking more strict
> git bisect good 885838eef785ff810dac945be8132856f2113cf1
> # good: [230f6fd628c83fcb44ea364d69a9ad88826ef8c4] drm/i915/bios: handle MIPI Sequence Block v3+ gracefully
> git bisect good 230f6fd628c83fcb44ea364d69a9ad88826ef8c4
> # bad: [5a633828b4b2bef343826afcb0a70770c4911c55] drm/radeon: Restore LCD backlight level on resume (>= R5xx)
> git bisect bad 5a633828b4b2bef343826afcb0a70770c4911c55
> # good: [60a09aef456ef590762d47da9c25650e230e2f85] drm: Reject DRI1 hw lock ioctl functions for kms drivers
> git bisect good 60a09aef456ef590762d47da9c25650e230e2f85
> # first bad commit: [5a633828b4b2bef343826afcb0a70770c4911c55] drm/radeon: Restore LCD backlight level on resume (>= R5xx)
> 
> Workaround 2:
> 
> reverting this single commit 5a633828b4b2bef343826afcb0a70770c4911c55 fixes the problem in linux-stable[0]
> as well as mainline[1] 4.3.0-rc6-00277-g01815536

Please provide the dmesg output from running with the attached debugging
patch.


Alex, any other ideas what might go wrong?

Comments

Alex Deucher Oct. 26, 2015, 9:21 p.m. UTC | #1
On Mon, Oct 26, 2015 at 5:32 AM, Michel Dänzer <michel@daenzer.net> wrote:
> On 25.10.2015 04:25, Michael Burian wrote:
>> hi,
>>
>> after updating the kernel from linux-stable[0] v4.2.3 to v4.2.4 on my
>> hp compaq nx9420 laptop (Debian Jessie, amd64), the backlight is turned off
>> within the first couple of seconds during boot.
>>
>> The situation persists (Xorg seems to be running fine, icons can be recognized
>> by illuminating the screen with a flashlight) until reboot using an earlier
>> kernel.
>>
>> current mainline[1] as of now (4.3.0-rc6-00277-g01815536) is also affected
>>
>> Workaround: use earlier kernel (v4.2.3) or (see below)
>>
>> Hardware:
>>
>> lspci | grep adeo
>> 01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] RV530/M56-P [Mobility Radeon X1600]
>>
>> git bisect log
>> # bad: [190bd21bba09ed476d9359d3e8be20e8d9dcd8a4] Linux 4.2.4
>> # good: [fcba09f2b0bf27eeaa1d4d439edb649585f35040] Linux 4.2.3
>> git bisect start 'v4.2.4' 'v4.2.3' 'drivers/gpu/'
>> # good: [885838eef785ff810dac945be8132856f2113cf1] drm/amdgpu: make UVD handle checking more strict
>> git bisect good 885838eef785ff810dac945be8132856f2113cf1
>> # good: [230f6fd628c83fcb44ea364d69a9ad88826ef8c4] drm/i915/bios: handle MIPI Sequence Block v3+ gracefully
>> git bisect good 230f6fd628c83fcb44ea364d69a9ad88826ef8c4
>> # bad: [5a633828b4b2bef343826afcb0a70770c4911c55] drm/radeon: Restore LCD backlight level on resume (>= R5xx)
>> git bisect bad 5a633828b4b2bef343826afcb0a70770c4911c55
>> # good: [60a09aef456ef590762d47da9c25650e230e2f85] drm: Reject DRI1 hw lock ioctl functions for kms drivers
>> git bisect good 60a09aef456ef590762d47da9c25650e230e2f85
>> # first bad commit: [5a633828b4b2bef343826afcb0a70770c4911c55] drm/radeon: Restore LCD backlight level on resume (>= R5xx)
>>
>> Workaround 2:
>>
>> reverting this single commit 5a633828b4b2bef343826afcb0a70770c4911c55 fixes the problem in linux-stable[0]
>> as well as mainline[1] 4.3.0-rc6-00277-g01815536
>
> Please provide the dmesg output from running with the attached debugging
> patch.
>
>
> Alex, any other ideas what might go wrong?

Not off hand.  Does the driver exposed backlight control work on your
system?  Backlight control in the r5xx days was mostly handled by
platform specific ACPI methods or the standard ACPI backlight method
under other OSes (depending on the OSI string).

Alex
Michel Dänzer Oct. 27, 2015, 2:36 a.m. UTC | #2
Michael, please keep the Cc: list intact.


On 26.10.2015 19:46, Michael Burian wrote:
> On 10/26/15 10:32, Michel Dänzer wrote:
>> On 25.10.2015 04:25, Michael Burian wrote:
>>>
>>> # first bad commit: [5a633828b4b2bef343826afcb0a70770c4911c55] drm/radeon: Restore LCD backlight level on resume (>= R5xx)
>>>
>>> Workaround 2:
>>>
>>> reverting this single commit 5a633828b4b2bef343826afcb0a70770c4911c55 fixes the problem in linux-stable[0]
>>> as well as mainline[1] 4.3.0-rc6-00277-g01815536
>>
>> Please provide the dmesg output from running with the attached debugging
>> patch.
>>
> 
> [0] contains dmesg output with your patch applied (which fixes the backlight issue)

This is very surprising: The patch just adds some debugging output, it's
not supposed to have any functional effect. Also, I don't see any of the
debugging output added by the patch in
dmesg-4.3.0-rc7-00003-g85051e2-dirty-2015-10-26-11-00-41-radeon-bl-debug.

Are you sure that my patch was actually applied to the radeon driver
when generating that file? Did you update the initrd with the patched
radeon.ko?


> [1] contains dmesg output without your patch for comparison (resulting in a permanent black screen as before in rc6)
> 
> 
> [0]
> dmesg-4.3.0-rc7-00003-g85051e2-dirty-2015-10-26-11-00-41-radeon-bl-debug
> 
> [1]
> dmesg-4.3.0-rc7-00003-g85051e2-2015-10-26-11-22-09
> 
>

Patch
diff mbox

diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c b/drivers/gpu/drm/radeon/atombios_encoders.c
index 65adb9c..31be81e 100644
--- a/drivers/gpu/drm/radeon/atombios_encoders.c
+++ b/drivers/gpu/drm/radeon/atombios_encoders.c
@@ -77,9 +77,12 @@  atombios_get_backlight_level(struct radeon_encoder *radeon_encoder)
 	struct drm_device *dev = radeon_encoder->base.dev;
 	struct radeon_device *rdev = dev->dev_private;
 
-	if (!(rdev->mode_info.firmware_flags & ATOM_BIOS_INFO_BL_CONTROLLED_BY_GPU))
+	if (WARN_ON(!(rdev->mode_info.firmware_flags & ATOM_BIOS_INFO_BL_CONTROLLED_BY_GPU)))
 		return 0;
 
+	DRM_INFO("Backlight controlled by GPU, current level %u\n",
+		 radeon_atom_get_backlight_level_from_reg(rdev));
+
 	return radeon_atom_get_backlight_level_from_reg(rdev);
 }
 
@@ -93,7 +96,7 @@  atombios_set_backlight_level(struct radeon_encoder *radeon_encoder, u8 level)
 	DISPLAY_DEVICE_OUTPUT_CONTROL_PS_ALLOCATION args;
 	int index;
 
-	if (!(rdev->mode_info.firmware_flags & ATOM_BIOS_INFO_BL_CONTROLLED_BY_GPU))
+	if (WARN_ON(!(rdev->mode_info.firmware_flags & ATOM_BIOS_INFO_BL_CONTROLLED_BY_GPU)))
 		return;
 
 	if ((radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) &&
@@ -105,6 +108,7 @@  atombios_set_backlight_level(struct radeon_encoder *radeon_encoder, u8 level)
 		switch (radeon_encoder->encoder_id) {
 		case ENCODER_OBJECT_ID_INTERNAL_LVDS:
 		case ENCODER_OBJECT_ID_INTERNAL_LVTM1:
+			DRM_INFO("Setting LVDS backlight level to %u\n", level);
 			index = GetIndexIntoMasterTable(COMMAND, LCD1OutputControl);
 			if (dig->backlight_level == 0) {
 				args.ucAction = ATOM_LCD_BLOFF;
@@ -120,6 +124,7 @@  atombios_set_backlight_level(struct radeon_encoder *radeon_encoder, u8 level)
 		case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA:
 		case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1:
 		case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2:
+			DRM_INFO("Setting UNIPHY backlight level to %u\n", level);
 			if (dig->backlight_level == 0)
 				atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_LCD_BLOFF, 0, 0);
 			else {
@@ -199,7 +204,7 @@  void radeon_atom_backlight_init(struct radeon_encoder *radeon_encoder,
 	if (!rdev->is_atom_bios)
 		return;
 
-	if (!(rdev->mode_info.firmware_flags & ATOM_BIOS_INFO_BL_CONTROLLED_BY_GPU))
+	if (WARN_ON(!(rdev->mode_info.firmware_flags & ATOM_BIOS_INFO_BL_CONTROLLED_BY_GPU)))
 		return;
 
 	pdata = kmalloc(sizeof(struct radeon_backlight_privdata), GFP_KERNEL);