Re: Working LIRC for Cinergy 400 card using SAA7134 driver and patch from David Atkins with two small modifications

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Ole,

Which version of SAA7134 did you do this on??

Regards/Casper

Ole Andre Schistad wrote:

I am now in posession of a working lirc configuration, and it turned out to be quite easy too. Attached to this mail is a patch to saa7134-cards.c which copies the flyvideo 3000 card config for cinergy 400, which worked on my computer. I think the assumption that it uses GPIO16 was the problem, and by copying the relevant portions for the FV3K card in the SAA7134 driver and using the suggested value of 3F for GPIO mask, everything seems to work.

Since I haven't really done anything except copy some of your code around I don't feel that it's my place to release this, and anyway I'm not even a programmer so I couldn't answer any questions, so I hope you'll take a look at my patch and do whatever you feel is necessary to tidy up. Since this is actually the _only_ working lirc setup that I am aware of for this board, I suspect that there are quite a few people out there who'll appreciate this, even if it is experimental. A short notice on the V4L list might perhaps be in order?

Anyway, thanks for your work, I am now finally able to use _all_ the features I had planned for my freevo/mythtv box ;)

Regards,

Ole Andre Schistad

------------------------------------------------------------------------

--- saa7134-cards.c.orig	2003-03-26 14:54:24.000000000 +0100
+++ saa7134-cards.c	2003-06-29 18:58:57.000000000 +0200
@@ -29,6 +29,7 @@
static char name_mute[]    = "mute";
static char name_radio[]   = "Radio";
static char name_tv[]      = "Television";
+static char name_tv_mono[] = "TV (mono only)";
static char name_comp1[]   = "Composite1";
static char name_comp2[]   = "Composite2";
static char name_svideo[]  = "S-Video";
@@ -61,6 +62,11 @@
			.vmux = 1,
			.amux = TV,
			.tv   = 1,
+		},{
+			.name = name_tv_mono,
+			.vmux = 1,
+			.amux = LINE2,
+			.tv   = 1,
		}},
	},
	[SAA7134_BOARD_FLYVIDEO3000] = {
@@ -68,7 +74,7 @@
		.name		= "LifeView FlyVIDEO3000",
		.audio_clock	= 0x00200000,
		.tuner_type	= TUNER_PHILIPS_PAL,
-		.gpiomask       = 0xE000,
+		.gpiomask       = 0xe000,
		.inputs         = {{
			.name = name_tv,
			.vmux = 1,
@@ -102,7 +108,7 @@
		.name           = "LifeView FlyVIDEO2000",
		.audio_clock    = 0x00200000,
		.tuner_type     = TUNER_LG_PAL_NEW_TAPC,
-		.gpiomask       = 0x6000,
+		.gpiomask       = 0xe000,
		.inputs         = {{
			.name = name_tv,
			.vmux = 1,
@@ -196,7 +202,7 @@
			.tv   = 1,
		},{
			/* workaround for problems with normal TV sound */
-			.name = "TV (mono only)",
+			.name = name_tv_mono,
			.vmux = 1,
			.amux = LINE2,
			.tv   = 1,
@@ -277,7 +283,7 @@
			.tv   = 1,
		},{
			/* workaround for problems with normal TV sound */
-			.name = "TV (mono only)",
+			.name = name_tv_mono,
			.vmux = 1,
			.amux = LINE2,
			.tv   = 1,
@@ -314,7 +320,7 @@
                },{
                        .name = name_tv,
                        .vmux = 1,
-                        .amux = TV,
+                        .amux = LINE2,
                        .tv   = 1,
                }},
        },
@@ -415,6 +421,21 @@
			.tv   = 1,
		}},
        },
+	[SAA7134_BOARD_ELSA_500TV] = {
+		.name           = "ELSA EX-VISION 500TV",
+		.audio_clock    = 0x00187de7,
+		.tuner_type     = TUNER_HITACHI_NTSC,
+		.inputs         = {{
+			.name = name_svideo,
+			.vmux = 7,
+			.amux = LINE1,
+		},{
+			.name = name_tv,
+			.vmux = 8,
+			.amux = TV,
+			.tv   = 1,
+		}},
+        },
	
};
const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards);
@@ -484,6 +505,12 @@
		.subdevice    = 0x226b,
		.driver_data  = SAA7134_BOARD_ELSA,
	},{
+		.vendor       = PCI_VENDOR_ID_PHILIPS,
+		.device       = PCI_DEVICE_ID_PHILIPS_SAA7130,
+		.subvendor    = 0x1048,
+		.subdevice    = 0x226b,
+		.driver_data  = SAA7134_BOARD_ELSA_500TV,
+	},{
		
		/* --- boards without eeprom + subsystem ID --- */
                .vendor       = PCI_VENDOR_ID_PHILIPS,
@@ -530,6 +557,84 @@
MODULE_DEVICE_TABLE(pci, saa7134_pci_tbl);

/* ----------------------------------------------------------- */
+/* flyvideo tweaks                                             */
+
+static struct {
+	char  *model;
+	int   tuner_type;
+} fly_list[0x20] = {
+	/* default catch ... */
+	[ 0 ... 0x1f ] = {
+		.model      = "UNKNOWN",
+		.tuner_type = TUNER_ABSENT,
+	},
+	/* ... the ones known so far */
+	[ 0x05 ] = {
+		.model      = "PAL-BG",
+		.tuner_type = TUNER_LG_PAL_NEW_TAPC,
+	},
+	[ 0x10 ] = {
+		.model      = "PAL-BG / PAL-DK",
+		.tuner_type = TUNER_PHILIPS_PAL,
+	},
+	[ 0x15 ] = {
+		.model      = "NTSC",
+		.tuner_type = TUNER_ABSENT /* FIXME */,
+	},
+};
+
+static void board_flyvideo(struct saa7134_dev *dev)
+{
+	u32 value;
+	int index;
+
+	saa_writel(SAA7134_GPIO_GPMODE0 >> 2,   0);
+	value = saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2);
+#if 0
+	index = (value & 0x1f00) >> 8;
+	printk(KERN_INFO "%s: flyvideo: gpio is 0x%x [model=%s,tuner=%d]\n",
+	       dev->name, value, fly_list[index].model,
+	       fly_list[index].tuner_type);
+	dev->tuner_type = fly_list[index].tuner_type;
+#else
+	printk(KERN_INFO "%s: flyvideo: gpio is 0x%x\n",
+	       dev->name, value);
+#endif
+}
+
+/* ----------------------------------------------------------- */
+
+static void board_cinergy(struct saa7134_dev *dev)
+{
+	u32 value;
+
+	saa_writel(SAA7134_GPIO_GPMODE0 >> 2,   0);
+	value = saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2);
+	printk(KERN_INFO "%s: cinergy: gpio is 0x%x\n",
+	       dev->name, value);
+}
+
+/* ----------------------------------------------------------- */
+int saa7134_board_init(struct saa7134_dev *dev)
+{
+	switch (dev->board) {
+	case SAA7134_BOARD_FLYVIDEO2000:
+	case SAA7134_BOARD_FLYVIDEO3000:
+		board_flyvideo(dev);
+		saa_andorl(SAA7134_IRQ2, SAA7134_IRQ2_INTE_GPIO18,
+			SAA7134_IRQ2_INTE_GPIO18); /* For IR */
+		break;
+	/* Seems to  use GPIO18. */
+	case SAA7134_BOARD_CINERGY400:
+		board_cinergy(dev);
+		saa_andorl(SAA7134_IRQ2, SAA7134_IRQ2_INTE_GPIO18,
+			SAA7134_IRQ2_INTE_GPIO18); /* For IR */
+		break;
+	}
+	return 0;
+}
+
+/* ----------------------------------------------------------- */
/*
 * Local variables:
 * c-basic-offset: 8





[Index of Archives]     [Linux DVB]     [Video Disk Recorder]     [Asterisk]     [Photo]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Free Photo Albums]     [Fedora Users]     [Fedora Women]     [ALSA Users]     [ALSA Devel]     [Linux USB]

Powered by Linux