diff mbox

[v2] tuner-simple, tveeprom: Add support for the FQ1216LME MK3

Message ID 1244253581.3140.28.camel@palomino.walls.org (mailing list archive)
State RFC
Headers show

Commit Message

Andy Walls June 6, 2009, 1:59 a.m. UTC
Hi,

This is version 2 of the patch that:

1. adds explicit support for the FQ1216LME MK3

2. points the tveeprom module to the FQ1216LME MK3 entry for EEPROMs
claiming FQ1216LME MK3 and MK5.

3. refactors some code in simple_post_tune() because
I needed to set the Auxillary Byte, as did TUNER_LG_TDVS_H06XF, so I
could set the TUA6030 TOP to external AGC per the datasheet.


The patch no longer twiddles the CP bit nor polls the FL bit for the
FQ1216LME.  That will be something for another patch.


Any other comments?

Regards,
Andy

Signed-off-by: Andy Walls <awalls@radix.net>



--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Martin Dauskardt June 6, 2009, 7:13 p.m. UTC | #1
Am Samstag, 6. Juni 2009 03:59:41 schrieb Andy Walls:
> Hi,
> 
> This is version 2 of the patch that:
> 
> 1. adds explicit support for the FQ1216LME MK3
> 
> 2. points the tveeprom module to the FQ1216LME MK3 entry for EEPROMs
> claiming FQ1216LME MK3 and MK5.
> 
> 3. refactors some code in simple_post_tune() because
> I needed to set the Auxillary Byte, as did TUNER_LG_TDVS_H06XF, so I
> could set the TUA6030 TOP to external AGC per the datasheet.
> 
> 
> The patch no longer twiddles the CP bit nor polls the FL bit for the
> FQ1216LME.  That will be something for another patch.
> 
> 
> Any other comments?
> 
Hi Andy,

I have tested this with a current v4l-dvb hg and kernel 2.6.29 with my PVR 150 
(FQ1216LME MK5). 
It works like using tuner type 38, but unfortunately it does not solve the 
problem of ocassionally loosing audio. This happens even on the video inputs!

I need to do further testings with older drivers/kernels to verify if this may 
be an issue of the new i2c stuff. Testing is very difficult, because 
sometimes it works for an hour and more, maybe depending on the temperature 
or the moon phase.

The problem reminds me a little bit on this:
http://www.gossamer-threads.com/lists/ivtv/users/39029

This is what dmesg says:

[ 1864.639391] ivtv: Start initialization, version 1.4.1
[ 1864.639484] ivtv0: Initializing card 0
[ 1864.639489] ivtv0: Autodetected Hauppauge card (cx23416 based)
[ 1864.641281] ivtv 0000:01:09.0: PCI INT A -> Link[APC4] -> GSI 19 (level, 
low) -> IRQ 19
[ 1864.694693] tveeprom 0-0050: Hauppauge model 26709, rev F0C1, serial# 
9585403
[ 1864.694697] tveeprom 0-0050: tuner model is Philips FQ1216LME MK5 (idx 121, 
type 80)
[ 1864.694700] tveeprom 0-0050: TV standards PAL(B/G) PAL(I) SECAM(L/L') 
PAL(D/D1/K) (eeprom 0x74)
[ 1864.694703] tveeprom 0-0050: audio processor is CX25843 (idx 37)
[ 1864.694705] tveeprom 0-0050: decoder processor is CX25843 (idx 30)
[ 1864.694707] tveeprom 0-0050: has no radio
[ 1864.694709] ivtv0: Autodetected Hauppauge WinTV PVR-150
[ 1864.704531] cx25840 0-0044: cx25843-24 found @ 0x88 (ivtv i2c driver #0)
[ 1864.723533] tuner 0-0043: chip found @ 0x86 (ivtv i2c driver #0)
[ 1864.723613] tda9887 0-0043: creating new instance
[ 1864.723615] tda9887 0-0043: tda988[5/6/7] found
[ 1864.730824] tuner 0-0061: chip found @ 0xc2 (ivtv i2c driver #0)
[ 1864.741408] wm8775 0-001b: chip found @ 0x36 (ivtv i2c driver #0)
[ 1864.749596] tuner-simple 0-0061: creating new instance
[ 1864.749599] tuner-simple 0-0061: type set to 80 (Philips FQ1216LME MK3 
PAL/SECAM w/active loopthrough)
[ 1864.752114] IRQ 19/ivtv0: IRQF_DISABLED is not guaranteed on shared IRQs
[ 1864.753099] ivtv0: Registered device video0 for encoder MPG (4096 kB)
[ 1864.756347] ivtv0: Registered device video32 for encoder YUV (2048 kB)
[ 1864.760023] ivtv0: Registered device vbi1 for encoder VBI (1024 kB)
[ 1864.764195] ivtv0: Registered device video24 for encoder PCM (320 kB)
[ 1864.764199] ivtv0: Initialized card: Hauppauge WinTV PVR-150
[ 1864.770863] ivtv: End initialization
[ 1864.797718] usbcore: registered new interface driver pvrusb2
[ 1864.797727] pvrusb2: V4L in-tree version:Hauppauge WinTV-PVR-USB2 MPEG2 
Encoder/Tuner
[ 1864.797729] pvrusb2: Debug mask is 31 (0x1f)
[ 1864.843601] saa7146: register extension 'budget_ci dvb'.
[ 1864.862564] saa7146: register extension 'budget dvb'.
[ 1864.891936] b2c2-flexcop: B2C2 FlexcopII/II(b)/III digital TV receiver chip 
loaded successfully
[ 1865.423084] lirc_serial: auto-detected active low receiver
[ 1865.423089] lirc_dev: lirc_register_driver: sample_rate: 0
[ 1865.424882] lirc_serial $Revision: 5.100 $ registered
[ 1871.259020] ivtv 0000:01:09.0: firmware: requesting v4l-cx2341x-enc.fw
[ 1871.298034] ivtv0: Loaded v4l-cx2341x-enc.fw firmware (376836 bytes)
[ 1871.498142] ivtv0: Encoder revision: 0x02060039
[ 1871.514028] cx25840 0-0044: firmware: requesting v4l-cx25840.fw
[ 1874.755988] cx25840 0-0044: loaded v4l-cx25840.fw firmware (16382 bytes)
[ 4426.500017] Clocksource tsc unstable (delta = -62502716 ns)

Greets,
Martin
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff -r e4b4291847b8 linux/drivers/media/common/tuners/tuner-simple.c
--- a/linux/drivers/media/common/tuners/tuner-simple.c	Tue Jun 02 19:40:03 2009 -0400
+++ b/linux/drivers/media/common/tuners/tuner-simple.c	Fri Jun 05 21:46:13 2009 -0400
@@ -423,6 +423,24 @@ 
 	return 0;
 }
 
+static int simple_set_aux_byte(struct dvb_frontend *fe, u8 config, u8 aux)
+{
+	struct tuner_simple_priv *priv = fe->tuner_priv;
+	int rc;
+	u8 buffer[2];
+
+	buffer[0] = (config & ~0x38) | 0x18;
+	buffer[1] = aux;
+
+	tuner_dbg("setting aux byte: 0x%02x 0x%02x\n", buffer[0], buffer[1]);
+
+	rc = tuner_i2c_xfer_send(&priv->i2c_props, buffer, 2);
+	if (2 != rc)
+		tuner_warn("i2c i/o error: rc == %d (should be 2)\n", rc);
+
+	return rc == 2 ? 0 : rc;
+}
+
 static int simple_post_tune(struct dvb_frontend *fe, u8 *buffer,
 			    u16 div, u8 config, u8 cb)
 {
@@ -431,30 +449,10 @@ 
 
 	switch (priv->type) {
 	case TUNER_LG_TDVS_H06XF:
-		/* Set the Auxiliary Byte. */
-#if 0
-		buffer[2] &= ~0x20;
-		buffer[2] |= 0x18;
-		buffer[3] = 0x20;
-		tuner_dbg("tv 0x%02x 0x%02x 0x%02x 0x%02x\n",
-			  buffer[0], buffer[1], buffer[2], buffer[3]);
-
-		rc = tuner_i2c_xfer_send(&priv->i2c_props, buffer, 4);
-		if (4 != rc)
-			tuner_warn("i2c i/o error: rc == %d "
-				   "(should be 4)\n", rc);
-#else
-		buffer[0] = buffer[2];
-		buffer[0] &= ~0x20;
-		buffer[0] |= 0x18;
-		buffer[1] = 0x20;
-		tuner_dbg("tv 0x%02x 0x%02x\n", buffer[0], buffer[1]);
-
-		rc = tuner_i2c_xfer_send(&priv->i2c_props, buffer, 2);
-		if (2 != rc)
-			tuner_warn("i2c i/o error: rc == %d "
-				   "(should be 2)\n", rc);
-#endif
+		simple_set_aux_byte(fe, config, 0x20);
+		break;
+	case TUNER_PHILIPS_FQ1216LME_MK3:
+		simple_set_aux_byte(fe, config, 0x60); /* External AGC */
 		break;
 	case TUNER_MICROTUNE_4042FI5:
 	{
@@ -526,6 +524,11 @@ 
 	case TUNER_THOMSON_DTT761X:
 		buffer[3] = 0x39;
 		break;
+	case TUNER_PHILIPS_FQ1216LME_MK3:
+		tuner_err("This tuner doesn't have FM\n");
+		/* Set the low band for sanity, since it covers 88-108 MHz */
+		buffer[3] = 0x01;
+		break;
 	case TUNER_MICROTUNE_4049FM5:
 	default:
 		buffer[3] = 0xa4;
diff -r e4b4291847b8 linux/drivers/media/common/tuners/tuner-types.c
--- a/linux/drivers/media/common/tuners/tuner-types.c	Tue Jun 02 19:40:03 2009 -0400
+++ b/linux/drivers/media/common/tuners/tuner-types.c	Fri Jun 05 21:46:13 2009 -0400
@@ -1280,6 +1280,28 @@ 
 	},
 };
 
+/* 80-89 */
+/* --------- TUNER_PHILIPS_FQ1216LME_MK3 -- active loopthrough, no FM ------- */
+
+static struct tuner_params tuner_fq1216lme_mk3_params[] = {
+	{
+		.type   = TUNER_PARAM_TYPE_PAL,
+		.ranges = tuner_fm1216me_mk3_pal_ranges,
+		.count  = ARRAY_SIZE(tuner_fm1216me_mk3_pal_ranges),
+		.cb_first_if_lower_freq = 1, /* not specified, but safe to do */
+		.has_tda9887 = 1, /* TDA9886 */
+		.port1_active = 1,
+		.port2_active = 1,
+		.port2_invert_for_secam_lc = 1,
+		.default_top_low = 4,
+		.default_top_mid = 4,
+		.default_top_high = 4,
+		.default_top_secam_low = 4,
+		.default_top_secam_mid = 4,
+		.default_top_secam_high = 4,
+	},
+};
+
 /* --------------------------------------------------------------------- */
 
 struct tunertype tuners[] = {
@@ -1725,6 +1747,13 @@ 
 		.params = tuner_fm1216mk5_params,
 		.count  = ARRAY_SIZE(tuner_fm1216mk5_params),
 	},
+
+	/* 80-89 */
+	[TUNER_PHILIPS_FQ1216LME_MK3] = { /* PAL/SECAM, Loop-thru, no FM */
+		.name = "Philips FQ1216LME MK3 PAL/SECAM w/active loopthrough",
+		.params = tuner_fq1216lme_mk3_params,
+		.count  = ARRAY_SIZE(tuner_fq1216lme_mk3_params),
+	},
 };
 EXPORT_SYMBOL(tuners);
 
diff -r e4b4291847b8 linux/drivers/media/video/tveeprom.c
--- a/linux/drivers/media/video/tveeprom.c	Tue Jun 02 19:40:03 2009 -0400
+++ b/linux/drivers/media/video/tveeprom.c	Fri Jun 05 21:46:13 2009 -0400
@@ -185,7 +185,7 @@ 
 	{ TUNER_ABSENT,        		"Silicon TDA8275C1 8290 FM"},
 	{ TUNER_ABSENT,        		"Thompson DTT757"},
 	/* 80-89 */
-	{ TUNER_PHILIPS_FM1216ME_MK3, 	"Philips FQ1216LME MK3"},
+	{ TUNER_PHILIPS_FQ1216LME_MK3, 	"Philips FQ1216LME MK3"},
 	{ TUNER_LG_PAL_NEW_TAPC, 	"LG TAPC G701D"},
 	{ TUNER_LG_NTSC_NEW_TAPC, 	"LG TAPC H791F"},
 	{ TUNER_LG_PAL_NEW_TAPC, 	"TCL 2002MB 3"},
@@ -230,7 +230,7 @@ 
 	{ TUNER_ABSENT,        		"Samsung THPD5222FG30A"},
 	/* 120-129 */
 	{ TUNER_XC2028,        		"Xceive XC3028"},
-	{ TUNER_ABSENT,        		"Philips FQ1216LME MK5"},
+	{ TUNER_PHILIPS_FQ1216LME_MK3,	"Philips FQ1216LME MK5"},
 	{ TUNER_ABSENT,        		"Philips FQD1216LME"},
 	{ TUNER_ABSENT,        		"Conexant CX24118A"},
 	{ TUNER_ABSENT,        		"TCL DMF11WIP"},
diff -r e4b4291847b8 linux/include/media/tuner.h
--- a/linux/include/media/tuner.h	Tue Jun 02 19:40:03 2009 -0400
+++ b/linux/include/media/tuner.h	Fri Jun 05 21:46:13 2009 -0400
@@ -125,6 +125,7 @@ 
 #define TUNER_TCL_MF02GIP_5N		77	/* TCL MF02GIP_5N */
 #define TUNER_PHILIPS_FMD1216MEX_MK3	78
 #define TUNER_PHILIPS_FM1216MK5		79
+#define TUNER_PHILIPS_FQ1216LME_MK3	80	/* Active loopthrough, no FM */
 
 /* tv card specific */
 #define TDA9887_PRESENT 		(1<<0)