Skip to contentSkip to conversation

drm/radeon/kms: fix up LVDS handling on macs

PATCH In review Alex Deucher 2 participants 3 messages Jan 11, 2010 – Jan 12, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/radeon/kms: fix up LVDS handling on macs

Quoted 1 line

From 16de3600adde106fbb6eb828a3fa1b935d938425 Mon Sep 17 00:00:00 2001

From: Alex Deucher <[email protected]>
Date: Mon, 11 Jan 2010 10:50:18 -0500
Subject: [PATCH] drm/radeon/kms: fix up LVDS handling on macs

Based on radeonfb code and recent ddx fix.

---
 drivers/gpu/drm/radeon/radeon_legacy_encoders.c |   24 +++++++++++++++++++++-
 1 files changed, 22 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
index 981508f..f746560 100644

drivers/gpu/drm/radeon/radeon_legacy_encoders.c +0 -0
@@ -46,6 +46,7 @@ static void radeon_legacy_lvds_dpms(struct

drm_encoder *encoder, int mode)
struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); uint32_t lvds_gen_cntl, lvds_pll_cntl, pixclks_cntl, disp_pwr_man; int panel_pwr_delay = 2000;
+ bool is_mac = false;
DRM_DEBUG("\n");

if (radeon_encoder->enc_priv) {
@@ -58,6 +59,15 @@ static void radeon_legacy_lvds_dpms(struct drm_encoder *encoder, int mode)
}
}

+ /* macs (and possibly some x86 oem systems?) wire up LVDS strangely
+ * Taken from radeonfb.
+ */
+ if ((rdev->mode_info.connector_table == CT_IBOOK) ||

+	    (rdev->mode_info.connector_table == CT_POWERBOOK_EXTERNAL) ||
+	    (rdev->mode_info.connector_table == CT_POWERBOOK_INTERNAL) ||
+	    (rdev->mode_info.connector_table == CT_POWERBOOK_VGA))

+ is_mac = true;
+
switch (mode) {
case DRM_MODE_DPMS_ON:
disp_pwr_man = RREG32(RADEON_DISP_PWR_MAN);
@@ -74,6 +84,8 @@ static void radeon_legacy_lvds_dpms(struct drm_encoder *encoder, int mode)

lvds_gen_cntl = RREG32(RADEON_LVDS_GEN_CNTL); lvds_gen_cntl |= (RADEON_LVDS_ON | RADEON_LVDS_EN |
RADEON_LVDS_DIGON | RADEON_LVDS_BLON);
+ if (is_mac)
+ lvds_gen_cntl |= RADEON_LVDS_BL_MOD_EN;
lvds_gen_cntl &= ~(RADEON_LVDS_DISPLAY_DIS); udelay(panel_pwr_delay * 1000); WREG32(RADEON_LVDS_GEN_CNTL, lvds_gen_cntl);
@@ -85,8 +97,16 @@ static void radeon_legacy_lvds_dpms(struct drm_encoder *encoder, int mode)
WREG32_PLL_P(RADEON_PIXCLKS_CNTL, 0, ~RADEON_PIXCLK_LVDS_ALWAYS_ONb); lvds_gen_cntl = RREG32(RADEON_LVDS_GEN_CNTL); lvds_gen_cntl |= RADEON_LVDS_DISPLAY_DIS;
- lvds_gen_cntl &= ~(RADEON_LVDS_ON | RADEON_LVDS_BLON |
RADEON_LVDS_EN | RADEON_LVDS_DIGON);
- udelay(panel_pwr_delay * 1000);
+ if (is_mac) {
+ lvds_gen_cntl &= ~RADEON_LVDS_BL_MOD_EN;
+ WREG32(RADEON_LVDS_GEN_CNTL, lvds_gen_cntl);
+ udelay(panel_pwr_delay * 1000);
+ lvds_gen_cntl &= ~(RADEON_LVDS_ON | RADEON_LVDS_EN);
+ } else {
+ WREG32(RADEON_LVDS_GEN_CNTL, lvds_gen_cntl);
+ lvds_gen_cntl &= ~(RADEON_LVDS_ON | RADEON_LVDS_BLON |
RADEON_LVDS_EN | RADEON_LVDS_DIGON);
+ udelay(panel_pwr_delay * 1000);
+ }
WREG32(RADEON_LVDS_GEN_CNTL, lvds_gen_cntl); WREG32_PLL(RADEON_PIXCLKS_CNTL, pixclks_cntl);
break;

Signature · 1 line
1.5.6.3

From 16de3600adde106fbb6eb828a3fa1b935d938425 Mon Sep 17 00:00:00 2001
From: Alex Deucher <[email protected]>
Date: Mon, 11 Jan 2010 10:50:18 -0500
Subject: [PATCH] drm/radeon/kms: fix up LVDS handling on macs

Based on radeonfb code and recent ddx fix.

---
 drivers/gpu/drm/radeon/radeon_legacy_encoders.c |   24 +++++++++++++++++++++-
 1 files changed, 22 insertions(+), 2 deletions(-)
drivers/gpu/drm/radeon/radeon_legacy_encoders.c +22 -2
index 981508f..f746560 100644
@@ -46,6 +46,7 @@ static void radeon_legacy_lvds_dpms(struct drm_encoder *encoder, int mode)
 	struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
 	uint32_t lvds_gen_cntl, lvds_pll_cntl, pixclks_cntl, disp_pwr_man;
 	int panel_pwr_delay = 2000;
+	bool is_mac = false;
 	DRM_DEBUG("\n");
 
 	if (radeon_encoder->enc_priv) {
@@ -58,6 +59,15 @@ static void radeon_legacy_lvds_dpms(struct drm_encoder *encoder, int mode)
 		}
 	}
 
+	/* macs (and possibly some x86 oem systems?) wire up LVDS strangely
+	 * Taken from radeonfb.
+	 */
+	if ((rdev->mode_info.connector_table == CT_IBOOK) ||
+	    (rdev->mode_info.connector_table == CT_POWERBOOK_EXTERNAL) ||
+	    (rdev->mode_info.connector_table == CT_POWERBOOK_INTERNAL) ||
+	    (rdev->mode_info.connector_table == CT_POWERBOOK_VGA))
+		is_mac = true;
+
 	switch (mode) {
 	case DRM_MODE_DPMS_ON:
 		disp_pwr_man = RREG32(RADEON_DISP_PWR_MAN);
@@ -74,6 +84,8 @@ static void radeon_legacy_lvds_dpms(struct drm_encoder *encoder, int mode)
 
 		lvds_gen_cntl = RREG32(RADEON_LVDS_GEN_CNTL);
 		lvds_gen_cntl |= (RADEON_LVDS_ON | RADEON_LVDS_EN | RADEON_LVDS_DIGON | RADEON_LVDS_BLON);
+		if (is_mac)
+			lvds_gen_cntl |= RADEON_LVDS_BL_MOD_EN;
 		lvds_gen_cntl &= ~(RADEON_LVDS_DISPLAY_DIS);
 		udelay(panel_pwr_delay * 1000);
 		WREG32(RADEON_LVDS_GEN_CNTL, lvds_gen_cntl);
@@ -85,8 +97,16 @@ static void radeon_legacy_lvds_dpms(struct drm_encoder *encoder, int mode)
 		WREG32_PLL_P(RADEON_PIXCLKS_CNTL, 0, ~RADEON_PIXCLK_LVDS_ALWAYS_ONb);
 		lvds_gen_cntl = RREG32(RADEON_LVDS_GEN_CNTL);
 		lvds_gen_cntl |= RADEON_LVDS_DISPLAY_DIS;
-		lvds_gen_cntl &= ~(RADEON_LVDS_ON | RADEON_LVDS_BLON | RADEON_LVDS_EN | RADEON_LVDS_DIGON);
-		udelay(panel_pwr_delay * 1000);
+		if (is_mac) {
+			lvds_gen_cntl &= ~RADEON_LVDS_BL_MOD_EN;
+			WREG32(RADEON_LVDS_GEN_CNTL, lvds_gen_cntl);
+			udelay(panel_pwr_delay * 1000);
+			lvds_gen_cntl &= ~(RADEON_LVDS_ON | RADEON_LVDS_EN);
+		} else {
+			WREG32(RADEON_LVDS_GEN_CNTL, lvds_gen_cntl);
+			lvds_gen_cntl &= ~(RADEON_LVDS_ON | RADEON_LVDS_BLON | RADEON_LVDS_EN | RADEON_LVDS_DIGON);
+			udelay(panel_pwr_delay * 1000);
+		}
 		WREG32(RADEON_LVDS_GEN_CNTL, lvds_gen_cntl);
 		WREG32_PLL(RADEON_PIXCLKS_CNTL, pixclks_cntl);
 		break;
Signature · 1 line
1.5.6.3

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev

--
_______________________________________________
Dri-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reviewed-by Tested-by on v1 1/1
#1 lore raw
Quoted 36 lines · Alex Deucher
Quoted 1 line

From 16de3600adde106fbb6eb828a3fa1b935d938425 Mon Sep 17 00:00:00 2001

From: Alex Deucher <[email protected]>
Date: Mon, 11 Jan 2010 10:50:18 -0500
Subject: [PATCH] drm/radeon/kms: fix up LVDS handling on macs

Based on radeonfb code and recent ddx fix.

---
 drivers/gpu/drm/radeon/radeon_legacy_encoders.c |   24 +++++++++++++++++++++-
 1 files changed, 22 insertions(+), 2 deletions(-)
drivers/gpu/drm/radeon/radeon_legacy_encoders.c +10 -2
index 981508f..f746560 100644
@@ -85,8 +97,16 @@ static void radeon_legacy_lvds_dpms(struct
 drm_encoder *encoder, int mode)
 		WREG32_PLL_P(RADEON_PIXCLKS_CNTL, 0, ~RADEON_PIXCLK_LVDS_ALWAYS_ONb);
 		lvds_gen_cntl = RREG32(RADEON_LVDS_GEN_CNTL);
 		lvds_gen_cntl |= RADEON_LVDS_DISPLAY_DIS;
-		lvds_gen_cntl &= ~(RADEON_LVDS_ON | RADEON_LVDS_BLON |
 RADEON_LVDS_EN | RADEON_LVDS_DIGON);
-		udelay(panel_pwr_delay * 1000);
+		if (is_mac) {
+			lvds_gen_cntl &= ~RADEON_LVDS_BL_MOD_EN;
+			WREG32(RADEON_LVDS_GEN_CNTL, lvds_gen_cntl);
+			udelay(panel_pwr_delay * 1000);
+			lvds_gen_cntl &= ~(RADEON_LVDS_ON | RADEON_LVDS_EN);
+		} else {
+			WREG32(RADEON_LVDS_GEN_CNTL, lvds_gen_cntl);
+			lvds_gen_cntl &= ~(RADEON_LVDS_ON | RADEON_LVDS_BLON |
 RADEON_LVDS_EN | RADEON_LVDS_DIGON);
+			udelay(panel_pwr_delay * 1000);
+		}

drivers/gpu/drm/radeon/radeon_legacy_encoders.c static void radeon_legacy_lvds_dpms(struct drm_encoder *encoder, int mode) · line 112

Quoted 3 lines
drivers/gpu/drm/radeon/radeon_legacy_encoders.c +0 -0
 		WREG32(RADEON_LVDS_GEN_CNTL, lvds_gen_cntl);
 		WREG32_PLL(RADEON_PIXCLKS_CNTL, pixclks_cntl);
 		break;

Minor niggle here: You could leave a single udelay() after the if (is_mac) blocks.

Other than that,

Signature · 14 lines
Earthling Michel Dänzer           |                http://www.vmware.com
Libre software enthusiast         |          Debian, X and DRI developer

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
--
_______________________________________________
Dri-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dri-devel
author Reviewed-by Michel Dänzer Tested-by Michel Dänzer
#2 lore raw

2010/1/12 Michel Dänzer <[email protected]>:

Quoted 44 lines · Alex Deucher
Quoted 36 lines
Quoted 1 line

From 16de3600adde106fbb6eb828a3fa1b935d938425 Mon Sep 17 00:00:00 2001

From: Alex Deucher <[email protected]>
Date: Mon, 11 Jan 2010 10:50:18 -0500
Subject: [PATCH] drm/radeon/kms: fix up LVDS handling on macs

Based on radeonfb code and recent ddx fix.

---
 drivers/gpu/drm/radeon/radeon_legacy_encoders.c |   24 +++++++++++++++++++++-

 1 files changed, 22 insertions(+), 2 deletions(-)
drivers/gpu/drm/radeon/radeon_legacy_encoders.c +10 -2
index 981508f..f746560 100644
@@ -85,8 +97,16 @@ static void radeon_legacy_lvds_dpms(struct
 drm_encoder *encoder, int mode)
               WREG32_PLL_P(RADEON_PIXCLKS_CNTL, 0, ~RADEON_PIXCLK_LVDS_ALWAYS_ONb);
               lvds_gen_cntl = RREG32(RADEON_LVDS_GEN_CNTL);
               lvds_gen_cntl |= RADEON_LVDS_DISPLAY_DIS;
-             lvds_gen_cntl &= ~(RADEON_LVDS_ON | RADEON_LVDS_BLON |
 RADEON_LVDS_EN | RADEON_LVDS_DIGON);
-             udelay(panel_pwr_delay * 1000);
+             if (is_mac) {
+                     lvds_gen_cntl &= ~RADEON_LVDS_BL_MOD_EN;
+                     WREG32(RADEON_LVDS_GEN_CNTL, lvds_gen_cntl);
+                     udelay(panel_pwr_delay * 1000);
+                     lvds_gen_cntl &= ~(RADEON_LVDS_ON | RADEON_LVDS_EN);
+             } else {
+                     WREG32(RADEON_LVDS_GEN_CNTL, lvds_gen_cntl);
+                     lvds_gen_cntl &= ~(RADEON_LVDS_ON | RADEON_LVDS_BLON |
 RADEON_LVDS_EN | RADEON_LVDS_DIGON);
+                     udelay(panel_pwr_delay * 1000);
+             }
Quoted 3 lines

              WREG32(RADEON_LVDS_GEN_CNTL, lvds_gen_cntl); WREG32_PLL(RADEON_PIXCLKS_CNTL, pixclks_cntl); break;

Minor niggle here: You could leave a single udelay() after the if (is_mac) blocks.

Quoted 1 line

Other than that,

Fixed up in attached patch. thanks!

Alex

Quoted 9 lines

--
Earthling Michel Dänzer           |                http://www.vmware.com
Libre software enthusiast         |          Debian, X and DRI developer

From 8297a12bbc388042663fe1361e1663864e662cb7 Mon Sep 17 00:00:00 2001
From: Alex Deucher <[email protected]>
Date: Tue, 12 Jan 2010 11:16:57 -0500
Subject: [PATCH] drm/radeon/kms: fix up LVDS handling on macs (v2)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

Based on radeonfb code and recent ddx fix.

v2: minor formatting fix from Michel Dänzer

---
 drivers/gpu/drm/radeon/radeon_legacy_encoders.c |   21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletions(-)
drivers/gpu/drm/radeon/radeon_legacy_encoders.c +20 -1
index 981508f..38e45e2 100644
@@ -46,6 +46,7 @@ static void radeon_legacy_lvds_dpms(struct drm_encoder *encoder, int mode)
 	struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
 	uint32_t lvds_gen_cntl, lvds_pll_cntl, pixclks_cntl, disp_pwr_man;
 	int panel_pwr_delay = 2000;
+	bool is_mac = false;
 	DRM_DEBUG("\n");
 
 	if (radeon_encoder->enc_priv) {
@@ -58,6 +59,15 @@ static void radeon_legacy_lvds_dpms(struct drm_encoder *encoder, int mode)
 		}
 	}
 
+	/* macs (and possibly some x86 oem systems?) wire up LVDS strangely
+	 * Taken from radeonfb.
+	 */
+	if ((rdev->mode_info.connector_table == CT_IBOOK) ||
+	    (rdev->mode_info.connector_table == CT_POWERBOOK_EXTERNAL) ||
+	    (rdev->mode_info.connector_table == CT_POWERBOOK_INTERNAL) ||
+	    (rdev->mode_info.connector_table == CT_POWERBOOK_VGA))
+		is_mac = true;
+
 	switch (mode) {
 	case DRM_MODE_DPMS_ON:
 		disp_pwr_man = RREG32(RADEON_DISP_PWR_MAN);
@@ -74,6 +84,8 @@ static void radeon_legacy_lvds_dpms(struct drm_encoder *encoder, int mode)
 
 		lvds_gen_cntl = RREG32(RADEON_LVDS_GEN_CNTL);
 		lvds_gen_cntl |= (RADEON_LVDS_ON | RADEON_LVDS_EN | RADEON_LVDS_DIGON | RADEON_LVDS_BLON);
+		if (is_mac)
+			lvds_gen_cntl |= RADEON_LVDS_BL_MOD_EN;
 		lvds_gen_cntl &= ~(RADEON_LVDS_DISPLAY_DIS);
 		udelay(panel_pwr_delay * 1000);
 		WREG32(RADEON_LVDS_GEN_CNTL, lvds_gen_cntl);
@@ -85,7 +97,14 @@ static void radeon_legacy_lvds_dpms(struct drm_encoder *encoder, int mode)
 		WREG32_PLL_P(RADEON_PIXCLKS_CNTL, 0, ~RADEON_PIXCLK_LVDS_ALWAYS_ONb);
 		lvds_gen_cntl = RREG32(RADEON_LVDS_GEN_CNTL);
 		lvds_gen_cntl |= RADEON_LVDS_DISPLAY_DIS;
-		lvds_gen_cntl &= ~(RADEON_LVDS_ON | RADEON_LVDS_BLON | RADEON_LVDS_EN | RADEON_LVDS_DIGON);
+		if (is_mac) {
+			lvds_gen_cntl &= ~RADEON_LVDS_BL_MOD_EN;
+			WREG32(RADEON_LVDS_GEN_CNTL, lvds_gen_cntl);
+			lvds_gen_cntl &= ~(RADEON_LVDS_ON | RADEON_LVDS_EN);
+		} else {
+			WREG32(RADEON_LVDS_GEN_CNTL, lvds_gen_cntl);
+			lvds_gen_cntl &= ~(RADEON_LVDS_ON | RADEON_LVDS_BLON | RADEON_LVDS_EN | RADEON_LVDS_DIGON);
+		}
 		udelay(panel_pwr_delay * 1000);
 		WREG32(RADEON_LVDS_GEN_CNTL, lvds_gen_cntl);
 		WREG32_PLL(RADEON_PIXCLKS_CNTL, pixclks_cntl);
Signature · 1 line
1.5.6.3

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev

--
_______________________________________________
Dri-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dri-devel