Re: NXP 18211HDC1 tuner

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

 



forgot attach patch...

Antti Palosaari wrote:
Michael Krufky wrote:
4.3 is not close enough to 3.8.  If you don't know how to set the demod
to 3.8, then we can do some hacks to make it work, but signal reception
is likely to be very poor -- better off looking in his snoop log to see
how the windows driver sets the demod to 3.8

OI have looked sniffs and tested linux driver and found that it is set to 3800. There is 4300 kHz set in eeprom, it is ok for 8 MHz but not for 6 or 7. Looks like driver needs to do some quirks when this tuner is used. Anyhow, patch attached is hardcoded to use 3.8 now.

Jarryd, please test. Also some changes to stick plug done, if it does not work for you can fix it as earlier.

regards
Antti


--
http://palosaari.fi/
diff -r 67b68ae8e249 linux/drivers/media/dvb/dvb-usb/af9015.c
--- a/linux/drivers/media/dvb/dvb-usb/af9015.c	Thu Mar 13 00:58:29 2008 +0200
+++ b/linux/drivers/media/dvb/dvb-usb/af9015.c	Fri Mar 14 20:19:28 2008 +0200
@@ -18,6 +18,7 @@
 
 /* debug */
 int dvb_usb_af9015_debug = 0x3d;
+//int dvb_usb_af9015_debug = -1;
 
 module_param_named(debug, dvb_usb_af9015_debug, int, 0644);
 MODULE_PARM_DESC(
@@ -27,7 +28,10 @@ MODULE_PARM_DESC(
 
 static struct af9013_config af9015_af9013_config = {
 	.demod_address = AF9015_I2C_DEMOD,
-	.tuner_if = 36125,
+//	.tuner_if = 36125,
+//	.tuner_if = 4300,
+	.tuner_if = 3800, //7MHz
+//	.tuner_if = 3300,
 	.ts_mode = AF9013_USB,
 };
 
@@ -413,8 +417,9 @@ static int af9015_download_firmware(stru
 		err("%s: boot failed: %d", __FUNCTION__, ret);
 		goto exit;
 	}
-	msleep(20);
+	msleep(1);
 
+#if 1
 	/* boot done, ensure that firmware is running */
 	req.cmd = GET_CONFIG;
 	req.len = 1;
@@ -429,8 +434,8 @@ static int af9015_download_firmware(stru
 		err("%s: firmware did not run (%02x)", __FUNCTION__, tmp);
 		return -EIO;
 	}
-
-#if 0
+#endif
+#if 1
 	/* firmware is running, reconnect device in the usb bus */
 	req.cmd = RECONNECT_USB;
 	ret = af9015_rw_udev(udev, &req);
@@ -495,6 +500,7 @@ static int af9015_read_config(struct dvb
 	case AF9013_TUNER_TDA18271:
 		af9015_af9013_config.tuner = AF9013_TUNER_TDA18271;
 		af9015_af9013_config.rf_spec_inv = 1;
+//		af9015_af9013_config.rf_spec_inv = 0;
 		state->gpio3 = 0x3; /* connect tuner on GPIO3 */
 		break;
 	default:
@@ -738,18 +744,22 @@ static struct dvb_usb_device_properties 
 			},
 		}
 	},
-	.num_device_descs = 3,
+	.num_device_descs = 2,
 	.devices = {
 		{
 			.name = "Afatech AF9015 DVB-T USB2.0 stick",
-			.cold_ids = {&af9015_usb_table[0], NULL},
+			.cold_ids = {&af9015_usb_table[0], &af9015_usb_table[1], NULL},
 			.warm_ids = {NULL},
 		},
+#if 0
 		{
 			.name = "Afatech AF9015 DVB-T USB2.0 stick",
-			.cold_ids = {&af9015_usb_table[1], NULL},
-			.warm_ids = {NULL},
+			.cold_ids = {NULL},
+//			.cold_ids = {&af9015_usb_table[1], NULL},
+			.warm_ids = {&af9015_usb_table[1], NULL},
+//			.warm_ids = {NULL},
 		},
+#endif
 		{
 			/* Leadtek Winfast DTV Dongle Gold */
 			.name = "Afatech AF9015 DVB-T USB2.0 stick",
diff -r 67b68ae8e249 linux/drivers/media/dvb/frontends/af9013.c
--- a/linux/drivers/media/dvb/frontends/af9013.c	Thu Mar 13 00:58:29 2008 +0200
+++ b/linux/drivers/media/dvb/frontends/af9013.c	Fri Mar 14 20:19:28 2008 +0200
@@ -22,7 +22,7 @@
 #include "af9013_priv.h"
 #include "af9013.h"
 
-int debug;
+int debug = 1;
 
 struct af9013_state {
 	struct i2c_adapter *i2c;
@@ -347,6 +347,9 @@ static int af9013_set_adc_ctrl(struct af
 	buf[1] = (u8) ((adc_cw & 0x0000ff00) >> 8);
 	buf[2] = (u8) ((adc_cw & 0x00ff0000) >> 16);
 
+	deb_info("adc_cw:");
+	debug_dump(buf, sizeof(buf), deb_info);
+
 	/* program */
 	for (i = 0; i < sizeof(buf); i++) {
 		ret = af9013_write_reg(state, addr++, buf[i]);
@@ -402,9 +405,31 @@ static int af9013_set_freq_ctrl(struct a
 	for (i = 0; i < sizeof(buf); i++) {
 		ret = af9013_write_reg(state, addr++, buf[i]);
 		if (ret)
+			goto exit;
+	}
+
+	/* program to dummy ram also */
+	addr = 0x9be7;
+	for (i = 0; i < sizeof(buf); i++) {
+		ret = af9013_write_reg(state, addr++, buf[i]);
+		if (ret)
+			goto exit;
+//			break;
+	}
+
+#if 1
+	/* program other fcw FIXME */
+	addr = 0x9bea;
+	buf[0] = 0xec;
+	buf[1] = 0xa0;
+	buf[2] = 0x6e;
+	for (i = 0; i < sizeof(buf); i++) {
+		ret = af9013_write_reg(state, addr++, buf[i]);
+		if (ret)
 			break;
 	}
-
+#endif
+exit:
 	return ret;
 }
 
_______________________________________________
linux-dvb mailing list
linux-dvb@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux