Skip to contentSkip to conversation

G450 support

PATCH New Petr Vandrovec 1 participant 1 message Dec 14, 2000

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

PATCH 1/1 G450 support

Hi Linus,
this 20KB patch adds support for Matrox G450. It is very important
to apply this, as G450 uses same PCI ID as G400, but if it is programmed as G400, PLL never syncs, causing printk() from driver causing deadlock on console_lock causing ...

Driver was tested on all G450 I have around (ie. 2), as no-one else
replied to my call-for-testing two weeks ago. It may be caused by total lack of G450 pieces from Matrox...

Driver currently supports second head only in monitor mode. I'm not
able to get TV mode to work without datasheet before Christmas, and as 2.4.0 is approaching...

Patch touches only matroxfb, and all new code is either guarded by
if (g450dac), or by some ifdef, so it should not cause any problem. Patch is for test13-pre1.
Thanks,
Petr Vandrovec [email protected]

Documentation/Configure.help +35 -9
diff -urdN linux/Documentation/Configure.help linux/Documentation/Configure.help
@@ -3210,9 +3210,9 @@
 CONFIG_FB_MATROX
   Say Y here if you have a Matrox Millennium, Matrox Millennium II,
   Matrox Mystique, Matrox Mystique 220, Matrox Productiva G100, Matrox
-  Mystique G200, Matrox Millennium G200, Matrox Marvel G200 video or
-  Matrox G400 card in your box. At this time, support for the G100,
-  Mystique G200 and Marvel G200 is untested.
+  Mystique G200, Matrox Millennium G200, Matrox Marvel G200 video,
+  Matrox G400 or G450 card in your box. At this time, support for the G100
+  is untested and support for G450 is highly experimental.
 
   This driver is also available as a module ( = code which can be
   inserted and removed from the running kernel whenever you want).
@@ -3241,13 +3241,13 @@
   packed pixel and 32 bpp packed pixel. You can also use font widths
   different from 8.
 
-Matrox G100/G200/G400 support
+Matrox G100/G200/G400/G450 support
 CONFIG_FB_MATROX_G100
-  Say Y here if you have a Matrox Productiva G100, Matrox Mystique
-  G200, Matrox Marvel G200 or Matrox Millennium G200 video card. If
-  you select "Advanced lowlevel driver options", you should check 8
-  bpp packed pixel, 16 bpp packed pixel, 24 bpp packed pixel and 32
-  bpp packed pixel. You can also use font widths different from 8.
+  Say Y here if you have a Matrox G100, G200, G400 or G450 based
+  video card. If you select "Advanced lowlevel driver options", you 
+  should check 8 bpp packed pixel, 16 bpp packed pixel, 24 bpp packed 
+  pixel and 32 bpp packed pixel. You can also use font widths 
+  different from 8.
 
   If you need support for G400 secondary head, you must first say Y to
   "I2C support" and "I2C bit-banging support" in the character devices
@@ -3270,6 +3270,8 @@
   
 Matrox G400 second head support
 CONFIG_FB_MATROX_MAVEN
+  WARNING !!! This support does not work with G450 !!!
+
   Say Y or M here if you want to use a secondary head (meaning two
   monitors in parallel) on G400 or MGA-TVO add-on on G200. Secondary
   head is not compatible with accelerated XFree 3.3.x SVGA servers -
@@ -3294,6 +3296,30 @@
   painting procedures (the secondary head does not use acceleration
   engine).
   
+  There is no need for enabling 'Matrox multihead support' if you have
+  only one Matrox card in the box.
+
+Matrox G450 second head support
+CONFIG_FB_MATROX_G450
+  Say Y or M here if you want to use a secondary head (meaning two
+  monitors in parallel) on G450.
+
+  If you compile it as module, two modules are created,
+  matroxfb_crtc2.o and matroxfb_g450.o. Both modules are needed if you
+  want two independent display devices.
+
+  The driver starts in monitor mode and currently does not support
+  output in TV modes. You must use the matroxset tool (available
+  at ftp://platan.vc.cvut.cz/pub/linux/matrox-latest) to swap primary
+  and secondary head outputs. Secondary head driver always start in
+  640x480 resolution and you must use fbset to change it.
+
+  Also do not forget that second head supports only 16 and 32 bpp
+  packed pixels, so it is a good idea to compile them into the kernel
+  too. You can use only some font widths, as the driver uses generic
+  painting procedures (the secondary head does not use acceleration
+  engine).
+
   There is no need for enabling 'Matrox multihead support' if you have
   only one Matrox card in the box.
 
drivers/video/Config.in +2 -1
diff -urdN linux/drivers/video/Config.in linux/drivers/video/Config.in
@@ -104,13 +104,14 @@
 	 if [ "$CONFIG_FB_MATROX" != "n" ]; then
 	    bool '    Millennium I/II support' CONFIG_FB_MATROX_MILLENIUM
 	    bool '    Mystique support' CONFIG_FB_MATROX_MYSTIQUE
-	    bool '    G100/G200/G400 support' CONFIG_FB_MATROX_G100
+	    bool '    G100/G200/G400/G450 support' CONFIG_FB_MATROX_G100
             if [ "$CONFIG_I2C" != "n" ]; then
 	       dep_tristate '      Matrox I2C support' CONFIG_FB_MATROX_I2C $CONFIG_FB_MATROX $CONFIG_I2C_ALGOBIT
 	       if [ "$CONFIG_FB_MATROX_G100" = "y" ]; then
 	          dep_tristate '      G400 second head support' CONFIG_FB_MATROX_MAVEN $CONFIG_FB_MATROX_I2C
 	       fi
             fi
+            dep_tristate '      G450 second head support' CONFIG_FB_MATROX_G450 $CONFIG_FB_MATROX_G100
 	    bool '    Multihead support' CONFIG_FB_MATROX_MULTIHEAD
 	 fi
 	 tristate '  ATI Mach64 display support (EXPERIMENTAL)' CONFIG_FB_ATY
drivers/video/matrox/Makefile +1 -0
diff -urdN linux/drivers/video/matrox/Makefile linux/drivers/video/matrox/Makefile
@@ -14,6 +14,7 @@
 obj-$(CONFIG_FB_MATROX)           += matroxfb_base.o matroxfb_accel.o matroxfb_DAC1064.o matroxfb_Ti3026.o matroxfb_misc.o
 obj-$(CONFIG_FB_MATROX_I2C)       += i2c-matroxfb.o
 obj-$(CONFIG_FB_MATROX_MAVEN)     += matroxfb_maven.o matroxfb_crtc2.o
+obj-$(CONFIG_FB_MATROX_G450)	  += matroxfb_g450.o matroxfb_crtc2.o
 
 include $(TOPDIR)/Rules.make
 
drivers/video/matrox/matroxfb_DAC1064.c +48 -16

91 lines not on this page · raw message

drivers/video/matrox/matroxfb_DAC1064.h +14 -1
diff -urdN linux/drivers/video/matrox/matroxfb_DAC1064.h linux/drivers/video/matrox/matroxfb_DAC1064.h
@@ -63,6 +63,8 @@
 #define      M1064_XPIXCLKCTRL_SRC_PCI		0x00
 #define      M1064_XPIXCLKCTRL_SRC_PLL		0x01
 #define      M1064_XPIXCLKCTRL_SRC_EXT		0x02
+#define	     M1064_XPIXCLKCTRL_SRC_SYS		0x03	/* G200/G400 */
+#define      M1064_XPIXCLKCTRL_SRC_PLL2		0x03	/* G450 */
 #define      M1064_XPIXCLKCTRL_SRC_MASK		0x03
 #define      M1064_XPIXCLKCTRL_EN		0x00
 #define      M1064_XPIXCLKCTRL_DIS		0x04
@@ -132,6 +134,16 @@
 #define M1064_XPIXPLLCP		0x4E
 #define M1064_XPIXPLLSTAT	0x4F
 
+#define M1064_XTVO_IDX		0x87
+#define M1064_XTVO_DATA		0x88
+
+#define M1064_XOUTPUTCONN	0x8A
+#define M1064_X8B		0x8B
+#define M1064_XPIXPLL2STAT	0x8C
+#define M1064_XPIXPLL2P		0x8D
+#define M1064_XPIXPLL2N		0x8E
+#define M1064_XPIXPLL2M		0x8F
+
 enum POS1064 {
 	POS1064_XCURADDL=0, POS1064_XCURADDH, POS1064_XCURCTRL,
 	POS1064_XCURCOL0RED, POS1064_XCURCOL0GREEN, POS1064_XCURCOL0BLUE,
@@ -141,7 +153,8 @@
 	POS1064_XMISCCTRL,
 	POS1064_XGENIOCTRL, POS1064_XGENIODATA, POS1064_XZOOMCTRL, POS1064_XSENSETEST,
 	POS1064_XCRCBITSEL,
-	POS1064_XCOLKEYMASKL, POS1064_XCOLKEYMASKH, POS1064_XCOLKEYL, POS1064_XCOLKEYH };
+	POS1064_XCOLKEYMASKL, POS1064_XCOLKEYMASKH, POS1064_XCOLKEYL, POS1064_XCOLKEYH,
+	POS1064_XOUTPUTCONN };
 
 
 #endif	/* __MATROXFB_DAC1064_H__ */
drivers/video/matrox/matroxfb_base.c +12 -3
diff -urdN linux/drivers/video/matrox/matroxfb_base.c linux/drivers/video/matrox/matroxfb_base.c
@@ -1421,12 +1421,15 @@
 #define DEVF_CRTC2		0x0800
 #define DEVF_MAVEN_CAPABLE	0x1000
 #define DEVF_PANELLINK_CAPABLE	0x2000
+#define DEVF_G450DAC		0x4000
 
 #define DEVF_GCORE	(DEVF_VIDEO64BIT | DEVF_SWAPS | DEVF_CROSS4MB | DEVF_DDC_8_2)
 #define DEVF_G2CORE	(DEVF_GCORE | DEVF_ANY_VXRES | DEVF_MAVEN_CAPABLE | DEVF_PANELLINK_CAPABLE)
 #define DEVF_G100	(DEVF_GCORE) /* no doc, no vxres... */
 #define DEVF_G200	(DEVF_G2CORE)
 #define DEVF_G400	(DEVF_G2CORE | DEVF_SUPPORT32MB | DEVF_TEXT16B | DEVF_CRTC2)
+/* if you'll find how to drive DFP... */
+#define DEVF_G450	(DEVF_GCORE | DEVF_ANY_VXRES | DEVF_SUPPORT32MB | DEVF_TEXT16B | DEVF_CRTC2 | DEVF_G450DAC)
 
 static struct board {
 	unsigned short vendor, device, rev, svid, sid;
@@ -1554,18 +1557,24 @@
 		230000,
 		&vbG200,
 		"unknown G200 (AGP)"},
-	{PCI_VENDOR_ID_MATROX,	PCI_DEVICE_ID_MATROX_G400_AGP,	0xFF,
+	{PCI_VENDOR_ID_MATROX,	PCI_DEVICE_ID_MATROX_G400_AGP,	0x80,
 		PCI_SS_VENDOR_ID_MATROX,	PCI_SS_ID_MATROX_MILLENNIUM_G400_MAX_AGP,
 		DEVF_G400,
 		360000,
 		&vbG400,
 		"Millennium G400 MAX (AGP)"},
-	{PCI_VENDOR_ID_MATROX,	PCI_DEVICE_ID_MATROX_G400_AGP,	0xFF,
+	{PCI_VENDOR_ID_MATROX,	PCI_DEVICE_ID_MATROX_G400_AGP,	0x80,
 		0,			0,
 		DEVF_G400,
 		300000,
 		&vbG400,
 		"unknown G400 (AGP)"},
+	{PCI_VENDOR_ID_MATROX,	PCI_DEVICE_ID_MATROX_G400_AGP,	0xFF,
+		0,			0,
+		DEVF_G450,
+		500000,		/* ??? vco goes up to 900MHz... */
+		&vbG400,
+		"unknown G450 (AGP)"},
 #endif
 	{0,			0,				0xFF,
 		0,			0,
@@ -1627,7 +1636,7 @@
 		if (dfp)
 			ACCESS_FBINFO(output.ph) |= MATROXFB_OUTPUT_CONN_DFP;
 	}
-
+	ACCESS_FBINFO(devflags.g450dac) = b->flags & DEVF_G450DAC;
 	ACCESS_FBINFO(devflags.textstep) = ACCESS_FBINFO(devflags.vgastep) * ACCESS_FBINFO(devflags.textmode);
 	ACCESS_FBINFO(devflags.textvram) = 65536 / ACCESS_FBINFO(devflags.textmode);
 
drivers/video/matrox/matroxfb_base.h +2 -1
diff -urdN linux/drivers/video/matrox/matroxfb_base.h linux/drivers/video/matrox/matroxfb_base.h
@@ -374,7 +374,7 @@
 struct matrox_hw_state {
 	u_int32_t	MXoptionReg;
 	unsigned char	DACclk[6];
-	unsigned char	DACreg[64];
+	unsigned char	DACreg[80];
 	unsigned char	MiscOutReg;
 	unsigned char	DACpal[768];
 	unsigned char	CRTC[25];
@@ -531,6 +531,7 @@
 		unsigned int	ydstorg;	/* offset in bytes from video start to usable memory */
 						/* 0 except for 6MB Millenium */
 		int		memtype;
+		int		g450dac;
 			      } devflags;
 	struct display_switch	dispsw;
 	struct {
drivers/video/matrox/matroxfb_crtc2.c +8 -3
diff -urdN linux/drivers/video/matrox/matroxfb_crtc2.c linux/drivers/video/matrox/matroxfb_crtc2.c
@@ -104,9 +104,14 @@
 		tmp |= 0x00000001;	/* enable CRTC2 */
 
 		if (ACCESS_FBINFO(output.sh) & MATROXFB_OUTPUT_CONN_SECONDARY) {
-			tmp |= 0x00000002; /* source from VDOCLK */
-			tmp |= 0xC0000000; /* enable vvidrst & hvidrst */
-			/* MGA TVO is our clock source */
+			if (ACCESS_FBINFO(devflags.g450dac)) {
+				tmp |= 0x00000006; /* source from secondary pixel PLL */
+				/* no vidrst */
+			} else {
+				tmp |= 0x00000002; /* source from VDOCLK */
+				tmp |= 0xC0000000; /* enable vvidrst & hvidrst */
+				/* MGA TVO is our clock source */
+			}
 		} else if (ACCESS_FBINFO(output.sh) & MATROXFB_OUTPUT_CONN_PRIMARY) {
 			tmp |= 0x00000004; /* source from pixclock */
 			/* PIXPLL is our clock source */
drivers/video/matrox/matroxfb_g450.c +201 -0

201 lines not on this page · raw message

drivers/video/matrox/matroxfb_g450.h +11 -0
diff -urdN linux/drivers/video/matrox/matroxfb_g450.h linux/drivers/video/matrox/matroxfb_g450.h
@@ -0,0 +1,11 @@
+#ifndef __MATROXFB_G450_H__
+#define __MATROXFB_G450_H__
+
+#include <linux/ioctl.h>
+#include "matroxfb_base.h"
+
+struct matroxfb_g450_info {
+	struct matrox_fb_info*	primary_dev;
+};
+
+#endif /* __MATROXFB_MAVEN_H__ */

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/