All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: No backlight since linux-4.2.4 - drivers/gpu/drm/radeon/atombios_encoders.c
       [not found] <562BDB47.5000301@sbg.at>
@ 2015-10-26  9:32 ` Michel Dänzer
  2015-10-26 21:21   ` Alex Deucher
       [not found]   ` <562E0473.5060404@sbg.at>
  0 siblings, 2 replies; 14+ messages in thread
From: Michel Dänzer @ 2015-10-26  9:32 UTC (permalink / raw)
  To: Michael Burian, Alex Deucher; +Cc: dri-devel@lists.freedesktop.org

[-- Attachment #1: Type: text/plain, Size: 2219 bytes --]

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?


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: radeon-bl-debug.diff --]
[-- Type: text/x-patch; name="radeon-bl-debug.diff", Size: 2476 bytes --]

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);

[-- Attachment #3: Type: text/plain, Size: 159 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: No backlight since linux-4.2.4 - drivers/gpu/drm/radeon/atombios_encoders.c
  2015-10-26  9:32 ` No backlight since linux-4.2.4 - drivers/gpu/drm/radeon/atombios_encoders.c Michel Dänzer
@ 2015-10-26 21:21   ` Alex Deucher
       [not found]   ` <562E0473.5060404@sbg.at>
  1 sibling, 0 replies; 14+ messages in thread
From: Alex Deucher @ 2015-10-26 21:21 UTC (permalink / raw)
  To: Michel Dänzer; +Cc: Michael Burian, dri-devel@lists.freedesktop.org

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
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: No backlight since linux-4.2.4 - drivers/gpu/drm/radeon/atombios_encoders.c
       [not found]   ` <562E0473.5060404@sbg.at>
@ 2015-10-27  2:36     ` Michel Dänzer
  2015-10-27  8:44       ` Michael Burian
  0 siblings, 1 reply; 14+ messages in thread
From: Michel Dänzer @ 2015-10-27  2:36 UTC (permalink / raw)
  To: Michael Burian; +Cc: dri-devel@lists.freedesktop.org


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
> 
> 




-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: No backlight since linux-4.2.4 - drivers/gpu/drm/radeon/atombios_encoders.c
  2015-10-27  2:36     ` Michel Dänzer
@ 2015-10-27  8:44       ` Michael Burian
  2015-10-27  9:17         ` Michel Dänzer
  0 siblings, 1 reply; 14+ messages in thread
From: Michael Burian @ 2015-10-27  8:44 UTC (permalink / raw)
  To: Michel Dänzer; +Cc: dri-devel@lists.freedesktop.org

[-- Attachment #1: Type: text/plain, Size: 1240 bytes --]

On 10/27/15 03:36, Michel Dänzer wrote:
>>
>> [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?
> 

the build was done using "make -j4 deb-pkg" on a better equipped machine,
.deb packages were copied over and installed - maybe something interesting
happened

AFAICT the patch should have been applied, at least it was shown with
git diff and the -dirty suffix was added by the build system, not me.
All graphics related drivers are compiled in (=y) rather than as
modules (=m) in .config.

Another thing I tried yesterday was to add the old way right below the new one
(this fixes the backlight issue) enclosed by some debug statements that indicate
start / stop of the old / new method. (see atomdebug.diff - should be applied against
mainline)


[-- Attachment #2: new.nots --]
[-- Type: text/plain, Size: 1312 bytes --]

radeon_start_backlight_new_way
>> execute D2AA (len 348, WS 4, PS 4)
   SET_ATI_PORT @ 0xD2B0
      port: 0 (MM)
   COMPARE_PS @ 0xD2B3
      src1: 
PS[0x00,0xFFFF8802]
.[7:0] -> 0x02
      src2: 
IMM 0x04
      result: NE LE
   JUMP_EQUAL @ 0xD2B7
      taken: no
      target: 0x0128
   COMPARE_PS @ 0xD2BA
      src1: 
PS[0x00,0xFFFF8802]
.[7:0] -> 0x02
      src2: 
IMM 0x05
      result: NE LE
   JUMP_EQUAL @ 0xD2BE
      taken: no
      target: 0x0113
   COMPARE_PS @ 0xD2C1
      src1: 
PS[0x00,0xFFFF8802]
.[7:0] -> 0x02
      src2: 
IMM 0x00
      result: NE GT
   JUMP_EQUAL @ 0xD2C5
      taken: no
      target: 0x00D8
   COMPARE_PS @ 0xD2C8
      src1: 
PS[0x00,0xFFFF8802]
.[7:0] -> 0x02
      src2: 
IMM 0x01
      result: NE GT
   JUMP_NOT_EQUAL @ 0xD2CC
      taken: yes
      target: 0x013D
   COMPARE_PS @ 0xD3E7
      src1: 
PS[0x00,0xFFFF8802]
.[7:0] -> 0x02
      src2: 
IMM 0x03
      result: NE LE
   JUMP_NOT_EQUAL @ 0xD3EB
      taken: yes
      target: 0x0151
   OR_REG @ 0xD3FB
      dst: 
REG[0x1EBC]
.[31:24] -> 0x00
      src: 
IMM 0x02
      dst: 
REG[0x1EBC]
.[31:24] <- 0x02
   AND_REG @ 0xD400
      dst: 
REG[0x1EBC]
.[31:24] -> 0x02
      src: 
IMM 0xFE
      dst: 
REG[0x1EBC]
.[31:24] <- 0x02
   EOT @ 0xD405
<<
radeon_stop_backlight_new_wayradeon_start_backlight_old_way

[-- Attachment #3: old.nots --]
[-- Type: text/plain, Size: 1327 bytes --]

radeon_stop_backlight_new_wayradeon_start_backlight_old_way
>> execute D2AA (len 348, WS 4, PS 4)
   SET_ATI_PORT @ 0xD2B0
      port: 0 (MM)
   COMPARE_PS @ 0xD2B3
      src1: 
PS[0x00,0x0003]
.[7:0] -> 0x03
      src2: 
IMM 0x04
      result: NE LE
   JUMP_EQUAL @ 0xD2B7
      taken: no
      target: 0x0128
   COMPARE_PS @ 0xD2BA
      src1: 
PS[0x00,0x0003]
.[7:0] -> 0x03
      src2: 
IMM 0x05
      result: NE LE
   JUMP_EQUAL @ 0xD2BE
      taken: no
      target: 0x0113
   COMPARE_PS @ 0xD2C1
      src1: 
PS[0x00,0x0003]
.[7:0] -> 0x03
      src2: 
IMM 0x00
      result: NE GT
   JUMP_EQUAL @ 0xD2C5
      taken: no
      target: 0x00D8
   COMPARE_PS @ 0xD2C8
      src1: 
PS[0x00,0x0003]
.[7:0] -> 0x03
      src2: 
IMM 0x01
      result: NE GT
   JUMP_NOT_EQUAL @ 0xD2CC
      taken: yes
      target: 0x013D
   COMPARE_PS @ 0xD3E7
      src1: 
PS[0x00,0x0003]
.[7:0] -> 0x03
      src2: 
IMM 0x03
      result: EQ LE
   JUMP_NOT_EQUAL @ 0xD3EB
      taken: no
      target: 0x0151
   OR_REG @ 0xD3EE
      dst: 
REG[0x1EBC]
.[31:24] -> 0x02
      src: 
IMM 0x02
      dst: 
REG[0x1EBC]
.[31:24] <- 0x02
   OR_REG @ 0xD3F3
      dst: 
REG[0x1EBC]
.[31:24] -> 0x02
      src: 
IMM 0x01
      dst: 
REG[0x1EBC]
.[31:24] <- 0x03
   JUMP @ 0xD3F8
      target: 0x015B
   EOT @ 0xD405
<<
radeon_stop_backlight_old_way

[-- Attachment #4: atomdebug.diff --]
[-- Type: text/x-patch, Size: 1430 bytes --]

diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c
index ec1593a..a626bd6 100644
--- a/drivers/gpu/drm/radeon/atom.c
+++ b/drivers/gpu/drm/radeon/atom.c
@@ -62,7 +62,7 @@ typedef struct {
 	bool abort;
 } atom_exec_context;
 
-int atom_debug = 0;
+int atom_debug = 1;
 static int atom_execute_table_locked(struct atom_context *ctx, int index, uint32_t * params);
 int atom_execute_table(struct atom_context *ctx, int index, uint32_t * params);
 
diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c b/drivers/gpu/drm/radeon/atombios_encoders.c
index 65adb9c..c0d874f 100644
--- a/drivers/gpu/drm/radeon/atombios_encoders.c
+++ b/drivers/gpu/drm/radeon/atombios_encoders.c
@@ -1624,9 +1624,15 @@ 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)) {
+			printk("radeon_start_backlight_new_way");
 			struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;
-
 			atombios_set_backlight_level(radeon_encoder, dig->backlight_level);
+			printk("radeon_stop_backlight_new_way");
+
+			printk("radeon_start_backlight_old_way");
+			args.ucAction = ATOM_LCD_BLON;
+			atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args);
+			printk("radeon_stop_backlight_old_way");
 		}
 		break;
 	case DRM_MODE_DPMS_STANDBY:

[-- Attachment #5: Type: text/plain, Size: 159 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: No backlight since linux-4.2.4 - drivers/gpu/drm/radeon/atombios_encoders.c
  2015-10-27  8:44       ` Michael Burian
@ 2015-10-27  9:17         ` Michel Dänzer
  2015-10-27 10:06           ` Michael Burian
  0 siblings, 1 reply; 14+ messages in thread
From: Michel Dänzer @ 2015-10-27  9:17 UTC (permalink / raw)
  To: Michael Burian; +Cc: dri-devel@lists.freedesktop.org

On 27.10.2015 17:44, Michael Burian wrote:
> On 10/27/15 03:36, Michel Dänzer wrote:
>>>
>>> [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?
>>
> 
> the build was done using "make -j4 deb-pkg" on a better equipped machine,
> .deb packages were copied over and installed - maybe something interesting
> happened
> 
> AFAICT the patch should have been applied, at least it was shown with
> git diff and the -dirty suffix was added by the build system, not me.
> All graphics related drivers are compiled in (=y) rather than as
> modules (=m) in .config.
> 
> Another thing I tried yesterday was to add the old way right below the new one
> (this fixes the backlight issue) enclosed by some debug statements that indicate
> start / stop of the old / new method. (see atomdebug.diff - should be applied against
> mainline)

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


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: No backlight since linux-4.2.4 - drivers/gpu/drm/radeon/atombios_encoders.c
  2015-10-27  9:17         ` Michel Dänzer
@ 2015-10-27 10:06           ` Michael Burian
  2015-10-27 15:10             ` Alex Deucher
  0 siblings, 1 reply; 14+ messages in thread
From: Michael Burian @ 2015-10-27 10:06 UTC (permalink / raw)
  To: Michel Dänzer; +Cc: dri-devel@lists.freedesktop.org

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


_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: No backlight since linux-4.2.4 - drivers/gpu/drm/radeon/atombios_encoders.c
  2015-10-27 10:06           ` Michael Burian
@ 2015-10-27 15:10             ` Alex Deucher
  2015-10-27 16:23               ` Michael Burian
  0 siblings, 1 reply; 14+ messages in thread
From: Alex Deucher @ 2015-10-27 15:10 UTC (permalink / raw)
  To: Michael Burian; +Cc: Michel Dänzer, dri-devel@lists.freedesktop.org

[-- Attachment #1: Type: text/plain, Size: 1469 bytes --]

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

[-- Attachment #2: 0002-drm-amdgpu-fix-backlight-handling-when-not-controlle.patch --]
[-- Type: text/x-patch, Size: 2441 bytes --]

From 0b04a9688f83505a6dedea9266b7e9d173ff8306 Mon Sep 17 00:00:00 2001
From: Alex Deucher <alexander.deucher@amd.com>
Date: Tue, 27 Oct 2015 11:04:39 -0400
Subject: [PATCH 2/2] drm/amdgpu: 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 possible regression in:
74b3112e95073b351e3b0b9799795bc76f8415fa

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

diff --git a/drivers/gpu/drm/amd/amdgpu/atombios_encoders.c b/drivers/gpu/drm/amd/amdgpu/atombios_encoders.c
index 1e0bba2..a7cfe75 100644
--- a/drivers/gpu/drm/amd/amdgpu/atombios_encoders.c
+++ b/drivers/gpu/drm/amd/amdgpu/atombios_encoders.c
@@ -1234,6 +1234,8 @@ amdgpu_atombios_encoder_setup_external_encoder(struct drm_encoder *encoder,
 static void
 amdgpu_atombios_encoder_setup_dig(struct drm_encoder *encoder, int action)
 {
+	struct drm_device *dev = encoder->dev;
+	struct amdgpu_device *adev = dev->dev_private;
 	struct amdgpu_encoder *amdgpu_encoder = to_amdgpu_encoder(encoder);
 	struct drm_encoder *ext_encoder = amdgpu_get_external_encoder(encoder);
 	struct amdgpu_encoder_atom_dig *dig = amdgpu_encoder->enc_priv;
@@ -1278,8 +1280,14 @@ amdgpu_atombios_encoder_setup_dig(struct drm_encoder *encoder, int action)
 			amdgpu_atombios_dp_link_train(encoder, connector);
 			amdgpu_atombios_encoder_setup_dig_encoder(encoder, ATOM_ENCODER_CMD_DP_VIDEO_ON, 0);
 		}
-		if (amdgpu_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT))
-			amdgpu_atombios_encoder_set_backlight_level(amdgpu_encoder, dig->backlight_level);
+		if (amdgpu_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) {
+			if (adev->mode_info.firmware_flags & ATOM_BIOS_INFO_BL_CONTROLLED_BY_GPU)
+				amdgpu_atombios_encoder_set_backlight_level(amdgpu_encoder,
+									    dig->backlight_level);
+			else
+				amdgpu_atombios_encoder_setup_dig_transmitter(encoder,
+									      ATOM_TRANSMITTER_ACTION_LCD_BLON, 0, 0);
+		}
 		if (ext_encoder)
 			amdgpu_atombios_encoder_setup_external_encoder(encoder, ext_encoder, ATOM_ENABLE);
 	} else {
-- 
1.8.3.1


[-- Attachment #3: 0001-drm-radeon-fix-backlight-handling-when-not-controlle.patch --]
[-- Type: text/x-patch, Size: 2601 bytes --]

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


[-- Attachment #4: Type: text/plain, Size: 159 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: No backlight since linux-4.2.4 - drivers/gpu/drm/radeon/atombios_encoders.c
  2015-10-27 15:10             ` Alex Deucher
@ 2015-10-27 16:23               ` Michael Burian
  2015-10-27 16:43                 ` Alex Deucher
  0 siblings, 1 reply; 14+ messages in thread
From: Michael Burian @ 2015-10-27 16:23 UTC (permalink / raw)
  To: Alex Deucher; +Cc: Michel Dänzer, dri-devel@lists.freedesktop.org

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)





_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: No backlight since linux-4.2.4 - drivers/gpu/drm/radeon/atombios_encoders.c
  2015-10-27 16:23               ` Michael Burian
@ 2015-10-27 16:43                 ` Alex Deucher
  2015-10-27 17:02                   ` Michael Burian
  2015-10-28  7:11                   ` Michel Dänzer
  0 siblings, 2 replies; 14+ messages in thread
From: Alex Deucher @ 2015-10-27 16:43 UTC (permalink / raw)
  To: Michael Burian; +Cc: Michel Dänzer, dri-devel@lists.freedesktop.org

[-- Attachment #1: Type: text/plain, Size: 826 bytes --]

On Tue, Oct 27, 2015 at 12:23 PM, Michael Burian <michael.burian@sbg.at> wrote:
> 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)
>

I see the problem.  We don't enable native backlight control on older
asics like yours by default.  Does the attached patch help?

Alex

[-- Attachment #2: 0001-drm-radeon-fix-dpms-when-driver-backlight-control-is.patch --]
[-- Type: text/x-patch, Size: 2351 bytes --]

From 8940e9553ae9097a22c2c46a0d33a6ce7fd6d9b2 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] drm/radeon: fix dpms when driver backlight control is
 disabled

If driver backlight control is disabled, either by driver
parameter or default per-asic setting, revert 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..ec0f5f6 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.bl_encoder) {
+				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.bl_encoder)
+				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


[-- Attachment #3: Type: text/plain, Size: 159 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: No backlight since linux-4.2.4 - drivers/gpu/drm/radeon/atombios_encoders.c
  2015-10-27 16:43                 ` Alex Deucher
@ 2015-10-27 17:02                   ` Michael Burian
  2015-10-28  7:11                   ` Michel Dänzer
  1 sibling, 0 replies; 14+ messages in thread
From: Michael Burian @ 2015-10-27 17:02 UTC (permalink / raw)
  To: Alex Deucher; +Cc: Michel Dänzer, dri-devel@lists.freedesktop.org

On 10/27/15 17:43, Alex Deucher wrote:
> 
> I see the problem.  We don't enable native backlight control on older
> asics like yours by default.  Does the attached patch help?
> 

Yes, backlight is on again. (tested against mainline: 858e904bd71dd0057a548d6785d94ce5ec4aeabd)

thanks


_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: No backlight since linux-4.2.4 - drivers/gpu/drm/radeon/atombios_encoders.c
  2015-10-27 16:43                 ` Alex Deucher
  2015-10-27 17:02                   ` Michael Burian
@ 2015-10-28  7:11                   ` Michel Dänzer
  2015-10-28 19:03                     ` Alex Deucher
  1 sibling, 1 reply; 14+ messages in thread
From: Michel Dänzer @ 2015-10-28  7:11 UTC (permalink / raw)
  To: Alex Deucher, Michael Burian; +Cc: dri-devel@lists.freedesktop.org

On 28.10.2015 01:43, Alex Deucher wrote:
> On Tue, Oct 27, 2015 at 12:23 PM, Michael Burian <michael.burian@sbg.at> wrote:
>> 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)
>>
> 
> I see the problem.  We don't enable native backlight control on older
> asics like yours by default.  Does the attached patch help?

My only doubt about this patch is: Should we also fall back to the old
beahviour in the !(rdev->mode_info.firmware_flags &
ATOM_BIOS_INFO_BL_CONTROLLED_BY_GPU) case?


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: No backlight since linux-4.2.4 - drivers/gpu/drm/radeon/atombios_encoders.c
  2015-10-28  7:11                   ` Michel Dänzer
@ 2015-10-28 19:03                     ` Alex Deucher
  2015-10-28 20:46                       ` Michael Burian
  2015-10-29  3:18                       ` Michel Dänzer
  0 siblings, 2 replies; 14+ messages in thread
From: Alex Deucher @ 2015-10-28 19:03 UTC (permalink / raw)
  To: Michel Dänzer; +Cc: Michael Burian, dri-devel@lists.freedesktop.org

[-- Attachment #1: Type: text/plain, Size: 1285 bytes --]

On Wed, Oct 28, 2015 at 3:11 AM, Michel Dänzer <michel@daenzer.net> wrote:
> On 28.10.2015 01:43, Alex Deucher wrote:
>> On Tue, Oct 27, 2015 at 12:23 PM, Michael Burian <michael.burian@sbg.at> wrote:
>>> 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)
>>>
>>
>> I see the problem.  We don't enable native backlight control on older
>> asics like yours by default.  Does the attached patch help?
>
> My only doubt about this patch is: Should we also fall back to the old
> beahviour in the !(rdev->mode_info.firmware_flags &
> ATOM_BIOS_INFO_BL_CONTROLLED_BY_GPU) case?

Theoretically, it's not necessary, but I guess better safe than sorry.
Updated patches attached.

Alex

[-- Attachment #2: 0001-drm-radeon-move-bl-encoder-assignment-into-bl-init.patch --]
[-- Type: text/x-patch, Size: 2094 bytes --]

From 7e2650330f9bc5e2b5304b563d4136fd99efaf2e Mon Sep 17 00:00:00 2001
From: Alex Deucher <alexander.deucher@amd.com>
Date: Wed, 28 Oct 2015 14:26:32 -0400
Subject: [PATCH 1/2] drm/radeon: move bl encoder assignment into bl init

So that the bl encoder will be null if the GPU does not
control the backlight.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
---
 drivers/gpu/drm/radeon/atombios_encoders.c      | 1 +
 drivers/gpu/drm/radeon/radeon_encoders.c        | 1 -
 drivers/gpu/drm/radeon/radeon_legacy_encoders.c | 1 +
 3 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c b/drivers/gpu/drm/radeon/atombios_encoders.c
index 65adb9c..933fd1b 100644
--- a/drivers/gpu/drm/radeon/atombios_encoders.c
+++ b/drivers/gpu/drm/radeon/atombios_encoders.c
@@ -237,6 +237,7 @@ void radeon_atom_backlight_init(struct radeon_encoder *radeon_encoder,
 	backlight_update_status(bd);
 
 	DRM_INFO("radeon atom DIG backlight initialized\n");
+	rdev->mode_info.bl_encoder = radeon_encoder;
 
 	return;
 
diff --git a/drivers/gpu/drm/radeon/radeon_encoders.c b/drivers/gpu/drm/radeon/radeon_encoders.c
index ef99917..c6ee802 100644
--- a/drivers/gpu/drm/radeon/radeon_encoders.c
+++ b/drivers/gpu/drm/radeon/radeon_encoders.c
@@ -194,7 +194,6 @@ static void radeon_encoder_add_backlight(struct radeon_encoder *radeon_encoder,
 			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_legacy_encoders.c b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
index 4571530..30de433 100644
--- a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
+++ b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
@@ -441,6 +441,7 @@ void radeon_legacy_backlight_init(struct radeon_encoder *radeon_encoder,
 	backlight_update_status(bd);
 
 	DRM_INFO("radeon legacy LVDS backlight initialized\n");
+	rdev->mode_info.bl_encoder = radeon_encoder;
 
 	return;
 
-- 
1.8.3.1


[-- Attachment #3: 0002-drm-radeon-fix-dpms-when-driver-backlight-control-is.patch --]
[-- Type: text/x-patch, Size: 2355 bytes --]

From 618bc51b0931376786d5da8a0c600b4c73416b1c 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 2/2] drm/radeon: fix dpms when driver backlight control is
 disabled

If driver backlight control is disabled, either by driver
parameter or default per-asic setting, revert 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 933fd1b..bb29214 100644
--- a/drivers/gpu/drm/radeon/atombios_encoders.c
+++ b/drivers/gpu/drm/radeon/atombios_encoders.c
@@ -1625,9 +1625,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.bl_encoder) {
+				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:
@@ -1707,8 +1712,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.bl_encoder)
+				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


[-- Attachment #4: Type: text/plain, Size: 159 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: No backlight since linux-4.2.4 - drivers/gpu/drm/radeon/atombios_encoders.c
  2015-10-28 19:03                     ` Alex Deucher
@ 2015-10-28 20:46                       ` Michael Burian
  2015-10-29  3:18                       ` Michel Dänzer
  1 sibling, 0 replies; 14+ messages in thread
From: Michael Burian @ 2015-10-28 20:46 UTC (permalink / raw)
  To: Alex Deucher, Michel Dänzer; +Cc: dri-devel@lists.freedesktop.org

On 10/28/15 20:03, Alex Deucher wrote:
>>
>> My only doubt about this patch is: Should we also fall back to the old
>> beahviour in the !(rdev->mode_info.firmware_flags &
>> ATOM_BIOS_INFO_BL_CONTROLLED_BY_GPU) case?
> 
> Theoretically, it's not necessary, but I guess better safe than sorry.
> Updated patches attached.
> 

applied both patches on top of mainline[1], backlight works fine

[1]
8a28d67457b613258aa0578ccece206d166f2b9f "Merge tag 'powerpc-4.3-6' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux"



_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: No backlight since linux-4.2.4 - drivers/gpu/drm/radeon/atombios_encoders.c
  2015-10-28 19:03                     ` Alex Deucher
  2015-10-28 20:46                       ` Michael Burian
@ 2015-10-29  3:18                       ` Michel Dänzer
  1 sibling, 0 replies; 14+ messages in thread
From: Michel Dänzer @ 2015-10-29  3:18 UTC (permalink / raw)
  To: Alex Deucher; +Cc: Michael Burian, dri-devel@lists.freedesktop.org

On 29.10.2015 04:03, Alex Deucher wrote:
> On Wed, Oct 28, 2015 at 3:11 AM, Michel Dänzer <michel@daenzer.net> wrote:
>> On 28.10.2015 01:43, Alex Deucher wrote:
>>> On Tue, Oct 27, 2015 at 12:23 PM, Michael Burian <michael.burian@sbg.at> wrote:
>>>> 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)
>>>>
>>>
>>> I see the problem.  We don't enable native backlight control on older
>>> asics like yours by default.  Does the attached patch help?
>>
>> My only doubt about this patch is: Should we also fall back to the old
>> beahviour in the !(rdev->mode_info.firmware_flags &
>> ATOM_BIOS_INFO_BL_CONTROLLED_BY_GPU) case?
> 
> Theoretically, it's not necessary, but I guess better safe than sorry.
> Updated patches attached.

Both patches are

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>


Apologies for the regression, and thanks for the fixes Alex!


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2015-10-29  3:18 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <562BDB47.5000301@sbg.at>
2015-10-26  9:32 ` No backlight since linux-4.2.4 - drivers/gpu/drm/radeon/atombios_encoders.c Michel Dänzer
2015-10-26 21:21   ` Alex Deucher
     [not found]   ` <562E0473.5060404@sbg.at>
2015-10-27  2:36     ` Michel Dänzer
2015-10-27  8:44       ` Michael Burian
2015-10-27  9:17         ` Michel Dänzer
2015-10-27 10:06           ` Michael Burian
2015-10-27 15:10             ` Alex Deucher
2015-10-27 16:23               ` Michael Burian
2015-10-27 16:43                 ` Alex Deucher
2015-10-27 17:02                   ` Michael Burian
2015-10-28  7:11                   ` Michel Dänzer
2015-10-28 19:03                     ` Alex Deucher
2015-10-28 20:46                       ` Michael Burian
2015-10-29  3:18                       ` Michel Dänzer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.