Skip to contentSkip to conversation

radeonfb: add support for newer cards

PATCH In review Luca Tettamanti 4 participants 9 messages Jan 1, 2007 – Jan 3, 2007 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 radeonfb: add support for newer cards

Hi Ben, Andrew,
I've rebased 'ATOM BIOS patch' from Solomon Peachy to apply to 2.6.20. The patch adds support for newer Radeon cards and is mainly based on X.Org code.

I've fixed a few things:
- Port sharing in radeon_get_conn_info_atom; old code didn't actually deal with it leading to wrong monitor detection
- Don't try to use I2C bus if BIOS says that there's no DDC channel, otherwise bad things happen:
http://marc.theaimsgroup.com/?l=linux-fbdev-devel&m=116455601620186&w=2
- Make it compile on PPC (hopefully...)
- Cleanup whitespaces and coding style (only in the code alreay affected by the patch, I didn't touched all the driver...)

---
Diffstat is pretty big, but a lot of changes are due to refactoring to make legacy and ATOM BIOS stuff coexist.

 drivers/video/aty/ati_ids.h          |   32 
 drivers/video/aty/radeon_accel.c     |   19 
 drivers/video/aty/radeon_backlight.c |    4 
 drivers/video/aty/radeon_base.c      |  497 ++++++++----
 drivers/video/aty/radeon_i2c.c       |   66 +
 drivers/video/aty/radeon_monitor.c   | 1339 +++++++++++++++++++++++----------
 drivers/video/aty/radeonfb.h         |  163 +++-
 7 files changed, 1518 insertions(+), 602 deletions(-)
drivers/video/aty/ati_ids.h +32 -0
index 39ab483..b81c977 100644
@@ -31,6 +31,7 @@
 #define PCI_CHIP_RV360_AR               0x4152
 #define PCI_CHIP_RV350_AS               0x4153
 #define PCI_CHIP_RV350_AT               0x4154
+#define PCI_CHIP_RV350_AU 		0x4155
 #define PCI_CHIP_RV350_AV               0x4156
 #define PCI_CHIP_MACH32			0x4158
 #define PCI_CHIP_RS250_4237		0x4237
@@ -71,7 +72,13 @@
 #define PCI_CHIP_R420_JL                0x4A4C
 #define PCI_CHIP_R420_JM                0x4A4D
 #define PCI_CHIP_R420_JN                0x4A4E
+#define PCI_CHIP_R420_JO 		0x4A4F
 #define PCI_CHIP_R420_JP                0x4A50
+#define PCI_CHIP_R420_JT 		0x4A54
+#define PCI_CHIP_R480_KI 		0x4B49
+#define PCI_CHIP_R480_KJ 		0x4B4A
+#define PCI_CHIP_R480_KK                0x4B4B
+#define PCI_CHIP_R480_KL 		0x4B4C
 #define PCI_CHIP_MACH64LB		0x4C42
 #define PCI_CHIP_MACH64LD		0x4C44
 #define PCI_CHIP_RAGE128LE		0x4C45
@@ -182,9 +189,19 @@
 #define PCI_CHIP_R423_UI                0x5549
 #define PCI_CHIP_R423_UJ                0x554A
 #define PCI_CHIP_R423_UK                0x554B
+#define PCI_CHIP_R423_UL 		0x554C
+#define PCI_CHIP_R423_UM 		0x554D
+#define PCI_CHIP_R423_UN 		0x554E
+#define PCI_CHIP_R423_UO 		0x554F
+#define PCI_CHIP_R423_UP 	       	0x5550
 #define PCI_CHIP_R423_UQ                0x5551
 #define PCI_CHIP_R423_UR                0x5552
 #define PCI_CHIP_R423_UT                0x5554
+#define PCI_CHIP_RV410_VJ 		0x564A
+#define PCI_CHIP_RV410_VK 		0x564B
+#define PCI_CHIP_RV410_VO 		0x564F
+#define PCI_CHIP_RV410_VR 		0x5652
+#define PCI_CHIP_RV410_VS 		0x5653
 #define PCI_CHIP_MACH64VT		0x5654
 #define PCI_CHIP_MACH64VU		0x5655
 #define PCI_CHIP_MACH64VV		0x5656
@@ -206,7 +223,22 @@
 #define PCI_CHIP_RV280_5964		0x5964
 #define PCI_CHIP_RV280_5C61		0x5C61
 #define PCI_CHIP_RV280_5C63		0x5C63
+#define PCI_CHIP_R423_5D48		0x5D48
+#define PCI_CHIP_R423_5D49		0x5D49
+#define PCI_CHIP_R423_5D4A		0x5D4A
+#define PCI_CHIP_R480_5D4C		0x5D4C
+#define PCI_CHIP_R480_5D4D		0x5D4D
+#define PCI_CHIP_R480_5D4E		0x5D4E
+#define PCI_CHIP_R480_5D4F		0x5D4F
+#define PCI_CHIP_R480_5D50		0x5D50
+#define PCI_CHIP_R480_5D52		0x5D52
 #define PCI_CHIP_R423_5D57              0x5D57
+#define PCI_CHIP_RV410_5E48		0x5E48
+#define PCI_CHIP_RV410_5E4A		0x5E4A
+#define PCI_CHIP_RV410_5E4B		0x5E4B
+#define PCI_CHIP_RV410_5E4C		0x5E4C
+#define PCI_CHIP_RV410_5E4D		0x5E4D
+#define PCI_CHIP_RV410_5E4F		0x5E4F
 #define PCI_CHIP_RS350_7834             0x7834
 #define PCI_CHIP_RS350_7835             0x7835
 
drivers/video/aty/radeon_accel.c +7 -12
index 3ca27cb..529f158 100644
@@ -203,9 +203,7 @@ void radeonfb_engine_reset(struct radeonfb_info *rinfo)
 	host_path_cntl = INREG(HOST_PATH_CNTL);
 	rbbm_soft_reset = INREG(RBBM_SOFT_RESET);
 
-	if (rinfo->family == CHIP_FAMILY_R300 ||
-	    rinfo->family == CHIP_FAMILY_R350 ||
-	    rinfo->family == CHIP_FAMILY_RV350) {
+	if (IS_R300_VARIANT(rinfo)) {
 		u32 tmp;
 
 		OUTREG(RBBM_SOFT_RESET, (rbbm_soft_reset |
@@ -241,9 +239,7 @@ void radeonfb_engine_reset(struct radeonfb_info *rinfo)
 	INREG(HOST_PATH_CNTL);
 	OUTREG(HOST_PATH_CNTL, host_path_cntl);
 
-	if (rinfo->family != CHIP_FAMILY_R300 ||
-	    rinfo->family != CHIP_FAMILY_R350 ||
-	    rinfo->family != CHIP_FAMILY_RV350)
+	if (IS_R300_VARIANT(rinfo))
 		OUTREG(RBBM_SOFT_RESET, rbbm_soft_reset);
 
 	OUTREG(CLOCK_CNTL_INDEX, clock_cntl_index);
@@ -254,16 +250,15 @@ void radeonfb_engine_init (struct radeonfb_info *rinfo)
 {
 	unsigned long temp;
 
-	/* disable 3D engine */
-	OUTREG(RB3D_CNTL, 0);
-
 	radeonfb_engine_reset(rinfo);
 
 	radeon_fifo_wait (1);
-	if ((rinfo->family != CHIP_FAMILY_R300) &&
-	    (rinfo->family != CHIP_FAMILY_R350) &&
-	    (rinfo->family != CHIP_FAMILY_RV350))
+	if (IS_R300_VARIANT(rinfo)) {
+		temp = INREG(RB2D_DSTCACHE_MODE);
+		OUTREG(RB2D_DSTCACHE_MODE, temp | (1<<17)); /* FIXME */
+	} else {
 		OUTREG(RB2D_DSTCACHE_MODE, 0);
+	}
 
 	radeon_fifo_wait (3);
 	/* We re-read MC_FB_LOCATION from card as it can have been
drivers/video/aty/radeon_backlight.c +2 -2
index 3abfd4a..04e3963 100644
@@ -58,7 +58,7 @@ static int radeon_bl_update_status(struct backlight_device *bd)
 	u32 lvds_gen_cntl, tmpPixclksCntl;
 	int level;
 
-	if (rinfo->mon1_type != MT_LCD)
+	if (PRIMARY_MONITOR(rinfo) != MT_LCD)
 		return 0;
 
 	/* We turn off the LCD completely instead of just dimming the
@@ -146,7 +146,7 @@ void radeonfb_bl_init(struct radeonfb_info *rinfo)
 	struct radeon_bl_privdata *pdata;
 	char name[12];
 
-	if (rinfo->mon1_type != MT_LCD)
+	if (PRIMARY_MONITOR(rinfo) == MT_LCD) {
 		return;
 
 #ifdef CONFIG_PMAC_BACKLIGHT
drivers/video/aty/radeon_base.c +347 -150

833 lines not on this page · raw message

drivers/video/aty/radeon_i2c.c +44 -22

79 lines not on this page · raw message

drivers/video/aty/radeon_monitor.c +962 -377

1,624 lines not on this page · raw message

drivers/video/aty/radeonfb.h +124 -39

248 lines not on this page · raw message

Happy new year!
Luca

Signature · 2 lines
"La donna � coinvolta sessualmente in tutti gli affari della vita. A
 volte perfino nell'amore." -- K. Kraus

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________
Linux-fbdev-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-fbdev-devel

#1 lore raw

Il Mon, Jan 01, 2007 at 10:25:51PM +0100, Luca Tettamanti ha scritto:

Quoted 4 lines

Hi Ben, Andrew,
I've rebased 'ATOM BIOS patch' from Solomon Peachy to apply to 2.6.20. The patch adds support for newer Radeon cards and is mainly based on X.Org code.

And - for an easier review - this is the diff between radeonfb-atom-2.6.19-v6a.diff from Solomon and my patch (whitespace-only changes not included).

---
 drivers/video/aty/radeon_base.c    |   26 +-
 drivers/video/aty/radeon_i2c.c     |    8 
 drivers/video/aty/radeon_monitor.c |  347 ++++++++++++++++++-----------------
 3 files changed, 198 insertions(+), 183 deletions(-)
drivers/video/aty/radeon_base.c +12 -14
diff -wu linux-2.6/drivers/video/aty/radeon_base.c linux-2.6.git/drivers/video/aty/radeon_base.c
@@ -287,7 +287,6 @@
 /*
  * globals
  */
-        
 static char *mode_option;
 static char *monitor_layout;
 static int noaccel = 0;
@@ -663,21 +662,20 @@
 {
 #ifdef CONFIG_PPC_OF
 	  rinfo->is_atom_bios = 0;
-	  rinfo->get_pll_info = radeon_get_pll_info_openfirmware;
-	  rinfo->get_lvds_info = radeon_get_lvds_info_openfirmware;
+	rinfo->radeon_get_pll_info = radeon_get_pll_info_openfirmware;
+	rinfo->radeon_get_lvds_info = radeon_get_lvds_info_openfirmware;
 	  rinfo->radeon_get_tmds_info = NULL;
-	  rinfo->get_conn_info = radeon_get_conn_info_openfirmware;
+	rinfo->radeon_get_conn_info = radeon_get_conn_info_openfirmware;
 #else
 	  int tmp = rinfo->fp_bios_start + 4;
+	unsigned char sign[4];
+
+	sign[0] = BIOS_IN8(tmp);
+	sign[1] = BIOS_IN8(tmp + 1);
+	sign[2] = BIOS_IN8(tmp + 2);
+	sign[3] = BIOS_IN8(tmp + 3);
 
-	  if ((BIOS_IN8(tmp) == 'A' &&
-	       BIOS_IN8(tmp+1) == 'T' &&
-	       BIOS_IN8(tmp+2) == 'O' &&
-	       BIOS_IN8(tmp+3) == 'M') ||
-	      (BIOS_IN8(tmp) == 'M' &&
-	       BIOS_IN8(tmp+1) == 'O' &&
-	       BIOS_IN8(tmp+2) == 'T' &&
-	       BIOS_IN8(tmp+3) == 'A')) {
+	if (!memcmp(sign, "ATOM", 4) || !memcmp(sign, "MOTA", 4)) {
 		  rinfo->is_atom_bios = 1;
 
 		  rinfo->atom_data_start = BIOS_IN16(rinfo->fp_bios_start + 32);
@@ -1075,7 +1073,8 @@
 	OUTREG(CRTC_EXT_CNTL, val);
 
 	for (i = 0 ; i < RADEON_MAX_CONNECTORS ; i++) {
-		if (i == -1) continue;
+		if (rinfo->heads[i] == -1)
+			continue;
 
 		switch (rinfo->connectors[rinfo->heads[i]].mon_type) {
 		case MT_DFP:
@@ -2571,7 +2570,6 @@
 {
         struct fb_info *info = pci_get_drvdata(pdev);
         struct radeonfb_info *rinfo = info->par;
-
 	int i;
 
         if (!rinfo)
drivers/video/aty/radeon_i2c.c +6 -2
diff -wu linux-2.6/drivers/video/aty/radeon_i2c.c linux-2.6.git/drivers/video/aty/radeon_i2c.c
@@ -149,14 +149,18 @@
 	    (INREG(LVDS_GEN_CNTL) & (LVDS_ON|LVDS_EN))) {
 			RTRACE("radeonfb: I2C (port %d) ... found LVDS panel\n", conn->ddc_type);
 			mon_type = MT_LCD;
+			edid = NULL;
 			goto done;
 	}
 
+	if (conn->ddc_type == ddc_none)
+		return 1;
 	edid = fb_ddc_read(&rinfo->i2c[conn->ddc_type].adapter);
 
 	if (!edid) {
-	  // what about the special case where we are a DFP/LVDS, but have a DDC connection..
-	  // but no EDID? We should fall back to MT_LCD...?  XXXX
+		/* what about the special case where we are a DFP/LVDS, but have a DDC connection
+		 * but no EDID? We should fall back to MT_LCD...?  XXXX
+		 */
 		RTRACE("radeonfb: I2C (port %d) ... not found\n", conn->ddc_type);
 		mon_type = MT_NONE;
 		goto done;
drivers/video/aty/radeon_monitor.c +180 -167

538 lines not on this page · raw message

Luca

Signature · 2 lines
"L'ottimista pensa che questo sia il migliore dei mondi possibili. 
 Il pessimista sa che e` vero" -- J. Robert Oppenheimer
#2 lore raw
Quoted 9 lines · Luca Tettamanti

Il Mon, Jan 01, 2007 at 10:25:51PM +0100, Luca Tettamanti ha scritto:

Quoted 4 lines

Hi Ben, Andrew,
I've rebased 'ATOM BIOS patch' from Solomon Peachy to apply to 2.6.20. The patch adds support for newer Radeon cards and is mainly based on X.Org code.

And - for an easier review - this is the diff between radeonfb-atom-2.6.19-v6a.diff from Solomon and my patch (whitespace-only changes not included).

Ah good, what I was asking for :-) I'll try to get a new patch combining everything out asap.

Ben.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

author
#3 lore raw
Quoted 7 lines · Benjamin Herrenschmidt
Quoted 6 lines · Luca Tettamanti

Il Mon, Jan 01, 2007 at 10:25:51PM +0100, Luca Tettamanti ha scritto:

Quoted 4 lines

Hi Ben, Andrew,
I've rebased 'ATOM BIOS patch' from Solomon Peachy to apply to 2.6.20. The patch adds support for newer Radeon cards and is mainly based on X.Org code.

Quoted 6 lines
Quoted 3 lines

And - for an easier review - this is the diff between radeonfb-atom-2.6.19-v6a.diff from Solomon and my patch (whitespace-only changes not included).

Ah good, what I was asking for :-) I'll try to get a new patch combining everything out asap.

Great, I didn't know you were working on this, I feared that the patch had been forgotten.
I've a X850 (R480) here, feel free to send me any patch for testing.

Luca

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

#4 lore raw
Quoted 19 lines · Luca

Date: Tue, 2 Jan 2007 01:38:17 +0100
From: Luca <[email protected]>
To: Benjamin Herrenschmidt <[email protected]>
Cc: Andrew Morton <[email protected]>, Solomon Peachy <[email protected]>,
[email protected], [email protected]
Subject: Re: [PATCH] radeonfb: add support for newer cards

Quoted 11 lines · Benjamin Herrenschmidt
Quoted 9 lines · Luca Tettamanti

Il Mon, Jan 01, 2007 at 10:25:51PM +0100, Luca Tettamanti ha scritto:

Quoted 4 lines

Hi Ben, Andrew,
I've rebased 'ATOM BIOS patch' from Solomon Peachy to apply to 2.6.20. The patch adds support for newer Radeon cards and is mainly based on X.Org code.

And - for an easier review - this is the diff between radeonfb-atom-2.6.19-v6a.diff from Solomon and my patch (whitespace-only changes not included).

Quoted 8 lines
Quoted 2 lines

Ah good, what I was asking for :-) I'll try to get a new patch combining everything out asap.

Great, I didn't know you were working on this, I feared that the patch had been forgotten.
I've a X850 (R480) here, feel free to send me any patch for testing.

Luca

Is there a list of cards this adds support for? I'm waiting on support for the X1600

Gerhard

--
Gerhard Mack

[email protected]

<>< As a computer I find your faith in technology amusing.

author
#5 lore raw
Quoted 24 lines · Gerhard Mack
Quoted 22 lines · Luca

Date: Tue, 2 Jan 2007 01:38:17 +0100
From: Luca <[email protected]>
To: Benjamin Herrenschmidt <[email protected]>
Cc: Andrew Morton <[email protected]>, Solomon Peachy <[email protected]>,
[email protected], [email protected]
Subject: Re: [PATCH] radeonfb: add support for newer cards

Quoted 13 lines · Benjamin Herrenschmidt
Quoted 9 lines · Luca Tettamanti

Il Mon, Jan 01, 2007 at 10:25:51PM +0100, Luca Tettamanti ha scritto:

Quoted 4 lines

Hi Ben, Andrew,
I've rebased 'ATOM BIOS patch' from Solomon Peachy to apply to 2.6.20. The patch adds support for newer Radeon cards and is mainly based on X.Org code.

And - for an easier review - this is the diff between radeonfb-atom-2.6.19-v6a.diff from Solomon and my patch (whitespace-only changes not included).

Ah good, what I was asking for :-) I'll try to get a new patch combining everything out asap.

Quoted 6 lines
Quoted 3 lines

Great, I didn't know you were working on this, I feared that the patch had been forgotten.
I've a X850 (R480) here, feel free to send me any patch for testing.

Is there a list of cards this adds support for? I'm waiting on support for the X1600

The patch is for the "old" generation, R400, R480 and their mobile versions. Unfortunately the new engine used in X1xxx cards is very different and no docs are available from ATI.

Luca

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

#6 lore raw
In reply to Gerhard Mack
Quoted 3 lines

Is there a list of cards this adds support for? I'm waiting on support for the X1600

This is not supported, neither by radeonfb (patches or not) nor by X.org. X1xxx cards have a new display engine and ATI refuses to provide any specs for it.

Note: I wonder how much of that is related to M$ new Vista DRM that basically forbids video or sound card vendors from providing specs or doing open source or they get "revoked" and never get to see "HD" content...

Ben.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

Acked-by
#7 lore raw
In reply to Luca Tettamanti
Quoted 3 lines · Luca Tettamanti

And - for an easier review - this is the diff between radeonfb-atom-2.6.19-v6a.diff from Solomon and my patch (whitespace-only changes not included).

It looks good in this quick once-over..

Thanks for the rebase!

- Solomon

Signature · 3 lines
Solomon Peachy        		       pizza at shaftnet dot org	 
Melbourne, FL                          ^^ (mail/jabber/gtalk) ^^
Quidquid latine dictum sit, altum viditur.          ICQ: 1318344
#8 lore raw
In reply to Luca Tettamanti
Quoted 15 lines · Luca Tettamanti

Hi Ben, Andrew,
I've rebased 'ATOM BIOS patch' from Solomon Peachy to apply to 2.6.20. The patch adds support for newer Radeon cards and is mainly based on X.Org code.

I've fixed a few things:
- Port sharing in radeon_get_conn_info_atom; old code didn't actually deal with it leading to wrong monitor detection
- Don't try to use I2C bus if BIOS says that there's no DDC channel, otherwise bad things happen:
http://marc.theaimsgroup.com/?l=linux-fbdev-devel&m=116455601620186&w=2
- Make it compile on PPC (hopefully...)
- Cleanup whitespaces and coding style (only in the code alreay affected by the patch, I didn't touched all the driver...)

Quoted 2 lines

I've done my own changes here. Can you send me a patch against Solomon's version of the driver instead of a combined patch ?

Ben.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV