PVR-150 improvements

Stefan Ehmann shoesoft at gmx.net
Wed Sep 3 09:15:49 UTC 2008


I recently acquired a PVR-150 card and had some issues with the pvrxxx port. I 
could solve them based on the linux ivtv and lirc sources. Thanks to them and 
to usleepless for providing the port.

Maybe someone will find my changes useful:
- added correct detection of my tuner in tveeprom.c
- stereo is now working (only mono previously)
- added support for external remote
- don't stop encoder on channel change

The last one was very annoying when playing "live TV" via mplayer. Because 
the encoder was stopped mplayer doesn't have enough data. So I got video 
stutters and audio sync problems. I had to restart mplayer after a few channel 
changes. To avoid clicks, audio is muted during channel change.

Here are my patches against pvrxxx-09042008 from 
http://usleepless.110mb.com/pvrxxx_port.tgz
In the current state the patches will break other cards because I haven't 
included checks which card is attached. But I hope they will make it in some 
way into the next pvrxxx version.

--- pvrxxx.orig/work/dev/cxm/cxm.c	2008-09-02 21:32:53.000000000 +0200
+++ pvrxxx/work/dev/cxm/cxm.c	2008-09-02 22:08:12.000000000 +0200
@@ -1999,6 +1999,9 @@
 
 	tda9887_command(sc->iicbus, VIDIOC_S_STD, &sc->tuner_std);
         cx25840_command(sc->iicbus, VIDIOC_S_STD, &sc->tuner_std);
+		if (cxm_ir_init(sc) < 0) {
+			device_printf(dev, "could not initialize IR remote\n");
+		}
 	} /* sc->cardtype == CXM_PVR250 */
 
 	if(sc->cardtype == CXM_PVR500)
--- pvrxxx.orig/work/dev/cxm/cxm.h	2008-09-02 21:32:53.000000000 +0200
+++ pvrxxx/work/dev/cxm/cxm.h	2008-09-02 22:07:46.000000000 +0200
@@ -476,7 +476,7 @@
  * I2C addresses
  */
 #define CXM_I2C_EEPROM   0xa0
-#define CXM_I2C_IR       0x30
+#define CXM_I2C_IR       0xe2
 #define CXM_I2C_MSP3400  0x80
 #define CXM_I2C_SAA7115  0x42
 #define CXM_I2C_TUNER    0xc2
--- pvrxxx.orig/work/dev/cxm/cxm_ir.c	2008-09-02 21:32:53.000000000 +0200
+++ pvrxxx/work/dev/cxm/cxm_ir.c	2008-09-03 09:27:31.000000000 +0200
@@ -108,17 +108,11 @@
 {
 	int result;
 
-	result = cxm_ir_read(sc->iicbus, CXM_I2C_IR, buf, len);
+	char tmp[6];
+	result = cxm_ir_read(sc->iicbus, CXM_I2C_IR, tmp, sizeof(tmp));
+	buf[0] = tmp[3];
+	buf[1] = tmp[4];
+	buf[2] = tmp[5];
 
-	if (result >= 0)
-		return result;
-
-	/*
-	 * If the IR receiver didn't respond,
-	 * then wait 50 ms and try again.
-	 */
-
-	tsleep(&sc->iicbus, PZERO, "IR", hz / 20 );
-
-	return cxm_ir_read(sc->iicbus, CXM_I2C_IR, buf, len);
+	return result;
 }
--- ./pvrxxx.orig/work/modules/cxm/cxm/cx25840-core.c	2007-02-16 
21:07:28.000000000 +0100
+++ ./pvrxxx/work/modules/cxm/cxm/cx25840-core.c	2008-08-28 19:57:34.000000000 
+0200
@@ -252,7 +252,7 @@
 	   instead of V4L2_STD_PAL. Someone needs to test this. */
 	if (std & V4L2_STD_PAL ) {
 		/* Follow tuner change procedure for PAL */
-		cx25840_write(client, 0x808, 0x4f); /* 0x4f */
+		cx25840_write(client, 0x808, 0xff);
 		cx25840_write(client, 0x80b, 0x10); 
 	} else if (std & V4L2_STD_SECAM) {
 		/* Select autodetect for SECAM */
--- ./pvrxxx.orig/work/modules/cxm/cxm/tveeprom.c	2008-08-28 
20:02:16.000000000 +0200
+++ ./pvrxxx/work/modules/cxm/cxm/tveeprom.c	2008-08-28 19:58:35.000000000 
+0200
@@ -275,7 +275,7 @@
 	{ TUNER_ABSENT,        "Thompson DTT75105"},
 	{ TUNER_ABSENT,        "Conexant_CX24109"},
 	{ TUNER_TCL_2002N,     "TCL M2523_5N_E"},
-	{ TUNER_ABSENT,        "TCL M2523_3DB_E"},
+	{ TUNER_TCL_2002MB,    "TCL M2523_3DB_E"},
 	{ TUNER_ABSENT,        "Philips 8275A"},
 	{ TUNER_ABSENT,        "Microtune MT2060"},
 	{ TUNER_ABSENT,        "Philips FM1236 MK5"},
--- pvrxxx.orig/work/modules/cxm/cxm/v4l2_ioctl_hook.c	2007-04-11 
20:47:19.000000000 +0200
+++ pvrxxx/work/modules/cxm/cxm/v4l2_ioctl_hook.c	2008-09-03 
10:39:14.000000000 +0200
@@ -54,9 +54,7 @@
     vf.frequency = (freq * 16) / 1000; 
     vf.type = V4L2_TUNER_ANALOG_TV ;
 
-    if (sc->source == cxm_tuner_source)
-        if (cxm_pause_encoder(sc) < 0)
-            return ENXIO;
+    set_mute(sc->iicbus, 1);
 
     /* if (sc->cardtype == CXM_PVR500) */
         tda9887_command(sc->iicbus, VIDIOC_S_FREQUENCY, &vf);
@@ -112,9 +110,7 @@
     if (sc->cardtype == CXM_PVR500)
         cxm_cx25840_lock(sc,&vf);
 
-    if (sc->source == cxm_tuner_source)
-        if (cxm_unpause_encoder(sc) < 0)
-            return ENXIO;
+    set_mute(sc->iicbus, 0);
 
     return 0;
 }



More information about the freebsd-multimedia mailing list