Talk:Matrox Meteor II cards

From LinuxTVWiki
Jump to: navigation, search

User experience

I have what I think is a Matrox Meteor II Multichannel card. I have had no luck getting it to work with v4l2, but here's how far I have gotten, in case it helps anyone out.

lspci gives:

...
0000:03:01.0 ff00: Matrox Graphics, Inc. VIA Framegrabber
...

lspci -n gives:

...
0000:03:01.0 ff00: 102b:4536
...


The best I was able to do (as of Apr 26 2006) was:

(1) Download the latest version from Marcus Furlong's Meteor-II Multi-Channel Linux Driver from the Sourceforge project CVS:

cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/meteor2mc login
cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/meteor2mc co meteor2mc 

(2) Made some changes. My changes are contained in the following patch, produced by diff -u:

diff -u meteor2mc/Makefile meteor2mcMe/Makefile
--- meteor2mc/Makefile	2005-03-10 19:16:31.000000000 -0800
+++ meteor2mcMe/Makefile	2006-04-26 01:29:29.000000000 -0700
@@ -20,7 +20,7 @@
 ##############################################################################
 
 obj-y		:=
-obj-m		:= $(MOD_NAME).o
+obj-m		:= via-init.o via-io.o $(MOD_NAME).o
 
 export-objs	:= 
 list-multi	:= $(MOD_NAME).o
Common subdirectories: meteor2mc/utils and meteor2mcMe/utils
diff -u meteor2mc/via-io.c meteor2mcMe/via-io.c
--- meteor2mc/via-io.c	2004-04-18 04:13:11.000000000 -0700
+++ meteor2mcMe/via-io.c	2006-04-26 01:30:27.000000000 -0700
@@ -117,7 +117,7 @@
 
 
 /* merge bits from insert into master (according to bitmask) */
-static inline u32
+static  u32
 merge_data (u32 master, u32 insert, u32 bitmask)
 {
 #if 0
@@ -133,7 +133,7 @@
 
 
 /* returns index of reg in list ([0,...]) or REG_NOT_FOUND */
-static inline int
+static  int
 get_list_index (const struct io_reg_list *list, u32 reg)
 {
 	int i = 0;
@@ -154,7 +154,7 @@
 
 
 /* returns index of reg in list ([0,...]) or REG_NOT_FOUND */
-static inline int
+static  int
 get_bitmask (const struct io_reg_list *list, u32 reg, u32 *bitmask)
 {
 	int idx;
@@ -191,7 +191,7 @@
 
 #ifdef NEW_REG_HANDLING
 
-inline void
+ void
 via_write (struct via_card *card, unsigned reg, u32 val)
 {
 	int idx;
@@ -202,7 +202,7 @@
 	writel (val, card->via_regs + reg);
 }
 
-inline u32
+ u32
 via_read (const struct via_card *card, unsigned reg)
 {
 	u32 val, bitmask;
@@ -218,13 +218,13 @@
 
 #else
 
-inline void
+ void
 via_write (const struct via_card *card, unsigned reg, u32 val)
 {
 	writel (val, card->via_regs + reg);
 }
 
-inline u32
+ u32
 via_read (const struct via_card *card, unsigned reg)
 {
 	return readl (card->via_regs + reg);
@@ -239,13 +239,13 @@
 /* -------------------------------------------------------------------
  * external registers (8 bit, mapped as 64 bit resources)
  * ------------------------------------------------------------------- */
-inline void
+ void
 ext_write (const struct via_card *card, unsigned reg, u32 val)
 {
 	writel ((val & VIA_BYTE), card->ext_regs + reg);
 }
 
-inline u32
+ u32
 ext_read (const struct via_card *card, unsigned reg)
 {
 	return (readl (card->ext_regs + reg) & VIA_BYTE);
@@ -258,7 +258,7 @@
 /* -------------------------------------------------------------------
  * threshold registers (mapped as 32 bit resources)
  * ------------------------------------------------------------------- */
-inline void
+ void
 thr_write (const struct via_card *card, unsigned reg, u32 val)
 {
 	writel (val, card->thr_regs + reg);
@@ -281,7 +281,7 @@
 
 #ifdef NEW_REG_HANDLING
 
-inline void
+ void
 psg_write (struct via_card *card, unsigned reg, u32 val)
 {
 	if (CHECK_PSG_REG (reg)) {
@@ -299,7 +299,7 @@
 	return;
 }
 
-inline u32
+ u32
 psg_read (struct via_card *card, unsigned reg)
 {
 	u32 val, bitmask;
@@ -326,7 +326,7 @@
 
 #else /* NEW_REG_HANDLING */
 
-inline void
+ void
 psg_write (struct via_card *card, unsigned reg, u32 val)
 {
 	if (CHECK_PSG_REG (reg)) {
@@ -349,7 +349,7 @@
 	return;
 }
 
-inline u32
+ u32
 psg_read (struct via_card *card, unsigned reg)
 {
 	u32 tmp;
@@ -380,7 +380,7 @@
  * LUT registers (8 bit, mapped as 64 bit resources)
  * ------------------------------------------------------------------- */
 
-inline void
+ void
 lut_write (struct via_card *card, unsigned reg, u32 val)
 {
 	if (CHECK_LUT_REG (reg)) {
@@ -399,7 +399,7 @@
 	writel (val, card->lut_regs + reg);
 }
 
-inline u32
+ u32
 lut_read (const struct via_card *card, unsigned reg)
 {
 	if (CHECK_LUT_REG (reg)) {
@@ -419,7 +419,7 @@
  * ICS1522 registers
  * ------------------------------------------------------------------- */
 
-static inline void
+static  void
 ics1522_write_bit (struct via_card *card, unsigned select, u8 bit)
 {
 	CLEAR_BIT (TMP_SERINT, (PSG_SERINT_SERSDATA |
@@ -440,7 +440,7 @@
 	return;
 }
 
-inline void
+ void
 ics1522_write (struct via_card *card, unsigned reg, u32 val)
 {
 	int i;
@@ -489,7 +489,7 @@
 
 #ifdef TRY_TO_READ_FROM_ICS1522
 
-static inline u32
+static  u32
 ics1522_read_bit (struct via_card *card, unsigned state)
 {
 	u32 tmp;
@@ -515,7 +515,7 @@
 	return tmp & PSG_SERINT_SERSDATA;
 }
 
-inline u32
+ u32
 ics1522_read (const struct via_card *card, unsigned reg)
 {
 	u32 tmp, r, d;
@@ -578,7 +578,7 @@
 
 #else /* TRY_TO_READ_FROM_ICS1522 */
 
-inline u32
+ u32
 ics1522_read (const struct via_card *card, unsigned reg)
 {
 	reg &= ICS1522_REG_MASK;
@@ -604,13 +604,13 @@
 /*
  * I2C bus between VIA and KS0127
  */
-static inline void
+static  void
 via_i2c_write (struct via_card *card, unsigned reg, u32 val)
 {
 	/* FIXME */
 }
 
-inline void
+void
 ks0127_write (struct via_card *card, unsigned reg, u32 val)
 {
 	via_i2c_write (card, reg, val);
@@ -624,7 +624,7 @@
 		ks0127_write (card, KS0127_CMDD, card->regs.ks0127_cmdd);
 }
 
-inline u32
+ u32
 ks0127_read (const struct via_card *card, unsigned reg)
 {
 	/* FIXME */
@@ -640,7 +640,7 @@
  * DAC8800 registers
  * ------------------------------------------------------------------- */
 
-static inline void
+static  void
 dac8800_write_bit (struct via_card *card, u8 set)
 {
 	CLEAR_BIT (TMP_SERINT, (PSG_SERINT_SERSDATA | PSG_SERINT_SERSCLK));
@@ -658,7 +658,7 @@
 	BIT_DEBUG;
 }
 
-inline void
+ void
 dac8800_write (struct via_card *card, unsigned reg, u32 val)
 {
 	int i;
@@ -781,7 +781,7 @@
 }
 
 
-inline u32
+ u32
 dac8800_read (struct via_card *card, unsigned reg)
 {
 	if (CHECK_DAC8800_REG (reg))  {
@@ -801,7 +801,7 @@
  * DS1020 Delay line
  * ------------------------------------------------------------------- */
 
-static inline void
+static  void
 ds1020_write_bit (struct via_card *card, u8 set)
 {
 	if (set)
@@ -821,7 +821,7 @@
 	BIT_DEBUG;
 }
 
-inline void
+ void
 ds1020_write (struct via_card *card, u32 val)
 {
 	int i;
@@ -853,7 +853,7 @@
 }
 
 
-inline u32
+ u32
 ds1020_read (struct via_card *card)
 {
 	/* we can't read from hw, always use the shadow value */
diff -u meteor2mc/via-stream.c meteor2mcMe/via-stream.c
--- meteor2mc/via-stream.c	2005-03-10 19:16:31.000000000 -0800
+++ meteor2mcMe/via-stream.c	2006-04-26 01:35:56.000000000 -0700
@@ -347,7 +347,9 @@
 	phys = card->himem_base + sbuf->vbuf.m.offset;
 	via_debug(VIA_DBG_MMAP,
 		  "remapping 0x%lx bytes @ 0x%lx (phys)\n", size, phys);
-	if (io_remap_page_range(vma,vma->vm_start, phys, size, PAGE_SHARED /* vma->vm_page_prot */)) {
+	// BAYLE: changed based on http://www.4front-tech.com/forum/viewtopic.php?p=2225&sid=0ba0ebb50ad4bdfa68a3ef8d94ef40fa
+	//	if (io_remap_page_range(vma,vma->vm_start, phys, size, PAGE_SHARED /* vma->vm_page_prot */)) {
+	if (remap_pfn_range(vma,vma->vm_start, (phys) >> PAGE_SHIFT, size, PAGE_SHARED /* vma->vm_page_prot */)) {
 		via_error("io_remap_page_range() failed\n");
 		ret = -EAGAIN;
 		goto err_out;
diff -u meteor2mc/via.c meteor2mcMe/via.c
--- meteor2mc/via.c	2005-03-10 19:16:31.000000000 -0800
+++ meteor2mcMe/via.c	2006-04-26 01:06:51.000000000 -0700
@@ -3272,7 +3272,7 @@
 		
 		strcpy(cap->driver,card->vdev.name);
 		strncpy(cap->card,card->vdev.name,sizeof(cap->card));
-		sprintf(cap->bus_info,"PCI:%s",card->pdev->slot_name);
+		sprintf(cap->bus_info,"PCI:%s",card->pdev->dev.bus_id);
 		cap->version = KERNEL_VERSION(1,1,10);
 		cap->capabilities =V4L2_CAP_VIDEO_CAPTURE;
 		return 0;
diff -u meteor2mc/via.h meteor2mcMe/via.h
--- meteor2mc/via.h	2005-03-10 18:29:07.000000000 -0800
+++ meteor2mcMe/via.h	2006-04-26 01:30:13.000000000 -0700
@@ -960,43 +960,43 @@
 
 
 /* VIA registers (mapped as 64 bit resources) */
-extern inline void via_write (struct via_card *card, unsigned reg, u32 val);
-extern inline u32 via_read (const struct via_card *card, unsigned reg);
+extern  void via_write (struct via_card *card, unsigned reg, u32 val);
+extern  u32 via_read (const struct via_card *card, unsigned reg);
 
 /* external registers (mapped as 64 bit resources) */
-extern inline void ext_write (const struct via_card *card, unsigned reg,
+extern  void ext_write (const struct via_card *card, unsigned reg,
 			      u32 val);
-extern inline u32 ext_read (const struct via_card *card, unsigned reg);
+extern  u32 ext_read (const struct via_card *card, unsigned reg);
 
 /* threshold registers (mapped as 32 bit resources) */
-extern inline void thr_write (const struct via_card *card, unsigned reg,
+extern  void thr_write (const struct via_card *card, unsigned reg,
 			      u32 val);
 
 /* PSG registers (mapped as 64 bit resources) */
-extern inline void psg_write (struct via_card *card, unsigned reg, u32 val);
-extern inline u32 psg_read (struct via_card *card, unsigned reg);
+extern  void psg_write (struct via_card *card, unsigned reg, u32 val);
+extern  u32 psg_read (struct via_card *card, unsigned reg);
 
 /* LUT registers (mapped as 64 bit resources) */
-extern inline void lut_write (struct via_card *card, unsigned reg, u32 val);
-extern inline u32 lut_read (const struct via_card *card, unsigned reg);
+extern  void lut_write (struct via_card *card, unsigned reg, u32 val);
+extern  u32 lut_read (const struct via_card *card, unsigned reg);
 
 /* ICS1522 registers */
-extern inline void ics1522_write (struct via_card *card, unsigned reg,
+extern  void ics1522_write (struct via_card *card, unsigned reg,
 				  u32 val);
-extern inline u32 ics1522_read (const struct via_card *card, unsigned reg);
+extern  u32 ics1522_read (const struct via_card *card, unsigned reg);
 
 /* KS0127 registers */
-extern inline void ks0127_write (struct via_card *card, unsigned reg, u32 val);
-extern inline u32 ks0127_read (const struct via_card *card, unsigned reg);
+extern void ks0127_write (struct via_card *card, unsigned reg, u32 val);
+extern  u32 ks0127_read (const struct via_card *card, unsigned reg);
 
-extern inline void via_i2c_init (struct via_card *card);
+extern  void via_i2c_init (struct via_card *card);
 
-extern inline u32 dac8800_read (struct via_card *card, unsigned reg);
-extern inline void dac8800_write (struct via_card *card, unsigned reg,
+extern  u32 dac8800_read (struct via_card *card, unsigned reg);
+extern  void dac8800_write (struct via_card *card, unsigned reg,
 				  u32 val);
 
-extern inline u32 ds1020_read (struct via_card *card);
-extern inline void ds1020_write (struct via_card *card, u32 val);
+extern  u32 ds1020_read (struct via_card *card);
+extern  void ds1020_write (struct via_card *card, u32 val);
 
 /* via-init.c */
 extern int via_init_all (struct via_card *card);

Basically, I made everything non-inline (there were recursive inline problems), changed io_remap_page_range to remap_pfn_range, changed card->pdev->slot_name to card->pdev->dev.bus_id, and modified the Makefile. Maybe I did something else too, I don't remember.


(3) Compiled on Debian with kernel linux-image-2.6.16-1-686 (and the matching kernel-headers package installed), and gcc-4.0.

(4) Tried "modprobe meteor2mc" which succeeded and left the following messages in dmsg:

meteor2mc: Unknown symbol io_remap_page_range
meteor2mc [via_module_init]: loading driver (dmask: 0x0, himem_offset 0, max_himem_mb: 16)
videodev: "meteor2mc (#0)" has no release callback. Please fix your driver for proper sysfs support, see http://lwn.net/Articles/36850/
meteor2mc [via_v4l2_initialize]: initialize called
meteor2mc [via_irq_init]: requested irq 5 and request_irq returned 0
meteor2mc [via_set_format]: unsupported color mode: 0
meteor2mc [via_set_channel]: FIXME: pcf_write (card, PCF8574_VIDSEL, 1)
meteor2mc [via_v4l2_initialize]: initialize succeeded
meteor2mc [via_module_init]: 1 Matrox VIA card(s) found.
meteor2mc [via_module_init]: card 0: Meteor-II/Std, IRQ 5, minor 0, 480 kB himem @ 0x3f688000 (phys)

(5) So far so good. But v4l2ucp fails with "/dev/video0 is not a V4L2 device". So it's not quite working yet.

xawtv fails with

/dev/video0 [v4l]: ioctl VIDIOCGCAP: Invalid argument
no video grabber device available


Please be aware that I am not a kernel guy and just hacked my way through this; I had no idea what I was doing, so it's possible that some of my patches weren't right. --BayleShanks 11:24, 26 April 2006 (CEST)