diff mbox

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

Message ID CADnq5_OL4bumk0OgoqCJQ+LMfbrJt3hQD98r7qWz=cuSpz991g@mail.gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Alex Deucher Oct. 28, 2015, 7:03 p.m. UTC
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

Comments

Michael Burian Oct. 28, 2015, 8:46 p.m. UTC | #1
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"
Michel Dänzer Oct. 29, 2015, 3:18 a.m. UTC | #2
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!
diff mbox

Patch

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