Skip to contentSkip to conversation

af9035: support for tda18218 tuner, new USB IDs and more

PATCH Applied Gianluca Gennari 4 participants 19 messages Apr 2, 2012 – Apr 6, 2012 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

cover af9035: support for tda18218 tuner, new USB IDs and more

Hi all,
this is a series of small patches for the new af9035 driver.
It adds basic support for the tda18218 tuner (and the related devices of the Avermedia A835 serie), including a small patch to tune VHF channels. Also, there is new USB ID for the 07ca:a867 device (Avermedia A867). Finally, there are a couple of clean-ups.

My A867 and A835 sticks works pretty well with this new driver. The driver is fast and responsive and there is no problem tuning all the channels available in my area: a full scan finds all of them.

The only minor issue is that the signal strength is stuck to 100% with all channels, with both sticks and with all the 3 firmwares.
SNR works properly.

After a quick test I couldn't find any difference between the 3 firmwares. Anyway, the A867 seems a bit faster than the A835, and also it locked a very weak mux that previously I was able to lock only with the PCTV 290e.

Best regards,
Gianluca Gennari

Gianluca Gennari (5):
af9035: add USB id for 07ca:a867
af9035: add support for the tda18218 tuner
tda18218: fix IF frequency for 7MHz bandwidth channels
af9035: fix warning
af9035: use module_usb_driver macro

 drivers/media/common/tuners/tda18218.c    |    2 +-
 drivers/media/dvb/dvb-usb/Kconfig         |    1 +
 drivers/media/dvb/dvb-usb/af9035.c        |   60 +++++++++++++++-------------
 drivers/media/dvb/dvb-usb/dvb-usb-ids.h   |    3 +
 drivers/media/dvb/frontends/af9033.c      |    4 ++
 drivers/media/dvb/frontends/af9033.h      |    1 +
 drivers/media/dvb/frontends/af9033_priv.h |   34 ++++++++++++++++
 7 files changed, 76 insertions(+), 29 deletions(-)
Signature · 1 line
1.7.5.4
#1 lore raw

PATCH 1/5 af9035: add USB id for 07ca:a867

New USB id for the Avermedia A867 stick (Sky Digital Key with blue led).

---
 drivers/media/dvb/dvb-usb/af9035.c      |    6 +++++-
 drivers/media/dvb/dvb-usb/dvb-usb-ids.h |    1 +
 2 files changed, 6 insertions(+), 1 deletions(-)
drivers/media/dvb/dvb-usb/af9035.c +5 -1
index 8060e78..6f73cdf 100644
@@ -794,6 +794,7 @@ enum af9035_id_entry {
 	AF9035_15A4_9035,
 	AF9035_15A4_1001,
 	AF9035_07CA_1867,
+	AF9035_07CA_A867,
 };
 
 static struct usb_device_id af9035_id[] = {
@@ -805,6 +806,8 @@ static struct usb_device_id af9035_id[] = {
 		USB_DEVICE(USB_VID_AFATECH, USB_PID_AFATECH_AF9035_2)},
 	[AF9035_07CA_1867] = {
 		USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_1867)},
+	[AF9035_07CA_A867] = {
+		USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_A867)},
 	{},
 };
 
@@ -861,9 +864,10 @@ static struct dvb_usb_device_properties af9035_properties[] = {
 					&af9035_id[AF9035_15A4_1001],
 				},
 			}, {
-				.name = "AVerMedia HD Volar",
+				.name = "AVerMedia HD Volar (A867)",
 				.cold_ids = {
 					&af9035_id[AF9035_07CA_1867],
+					&af9035_id[AF9035_07CA_A867],
 				},
 			},
 		}
drivers/media/dvb/dvb-usb/dvb-usb-ids.h +1 -0
index 8f77a6c..3cf002b 100644
@@ -225,6 +225,7 @@
 #define USB_PID_AVERMEDIA_A805				0xa805
 #define USB_PID_AVERMEDIA_A815M				0x815a
 #define USB_PID_AVERMEDIA_1867				0x1867
+#define USB_PID_AVERMEDIA_A867				0xa867
 #define USB_PID_TECHNOTREND_CONNECT_S2400               0x3006
 #define USB_PID_TECHNOTREND_CONNECT_CT3650		0x300d
 #define USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY	0x005a
Signature · 1 line
1.7.5.4
#3 lore raw

PATCH 2/5 af9035: add support for the tda18218 tuner

In reply to Gianluca Gennari

Add basic support for the tda18218 tuner and the AVerMedia A835 devices.

---
 drivers/media/dvb/dvb-usb/Kconfig         |    1 +
 drivers/media/dvb/dvb-usb/af9035.c        |   26 +++++++++++++++++++++-
 drivers/media/dvb/dvb-usb/dvb-usb-ids.h   |    2 +
 drivers/media/dvb/frontends/af9033.c      |    4 +++
 drivers/media/dvb/frontends/af9033.h      |    1 +
 drivers/media/dvb/frontends/af9033_priv.h |   34 +++++++++++++++++++++++++++++
 6 files changed, 67 insertions(+), 1 deletions(-)
drivers/media/dvb/dvb-usb/Kconfig +1 -0
index f53fb3c..be1db75 100644
@@ -430,6 +430,7 @@ config DVB_USB_AF9035
 	select MEDIA_TUNER_TUA9001 if !MEDIA_TUNER_CUSTOMISE
 	select MEDIA_TUNER_FC0011 if !MEDIA_TUNER_CUSTOMISE
 	select MEDIA_TUNER_MXL5007T if !MEDIA_TUNER_CUSTOMISE
+	select MEDIA_TUNER_TDA18218 if !MEDIA_TUNER_CUSTOMISE
 	help
 	  Say Y here to support the Afatech AF9035 based DVB USB receiver.
 
drivers/media/dvb/dvb-usb/af9035.c +25 -1
index 6f73cdf..f943c57 100644
@@ -24,6 +24,7 @@
 #include "tua9001.h"
 #include "fc0011.h"
 #include "mxl5007t.h"
+#include "tda18218.h"
 
 DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
 static DEFINE_MUTEX(af9035_usb_mutex);
@@ -502,6 +503,7 @@ static int af9035_read_mac_address(struct dvb_usb_device *d, u8 mac[6])
 		case AF9033_TUNER_TUA9001:
 		case AF9033_TUNER_FC0011:
 		case AF9033_TUNER_MXL5007T:
+		case AF9033_TUNER_TDA18218:
 			af9035_af9033_config[i].spec_inv = 1;
 			break;
 		default:
@@ -678,6 +680,11 @@ static struct mxl5007t_config af9035_mxl5007t_config = {
 	.clk_out_amp = MxL_CLKOUT_AMP_0_94V,
 };
 
+static struct tda18218_config af9035_tda18218_config = {
+	.i2c_address = 0x60,
+	.i2c_wr_max = 21,
+};
+
 static int af9035_tuner_attach(struct dvb_usb_adapter *adap)
 {
 	int ret;
@@ -772,6 +779,11 @@ static int af9035_tuner_attach(struct dvb_usb_adapter *adap)
 		fe = dvb_attach(mxl5007t_attach, adap->fe_adap[0].fe,
 				&adap->dev->i2c_adap, 0x60, &af9035_mxl5007t_config);
 		break;
+	case AF9033_TUNER_TDA18218:
+		/* attach tuner */
+		fe = dvb_attach(tda18218_attach, adap->fe_adap[0].fe,
+				&adap->dev->i2c_adap, &af9035_tda18218_config);
+		break;
 	default:
 		fe = NULL;
 	}
@@ -793,6 +805,8 @@ enum af9035_id_entry {
 	AF9035_0CCD_0093,
 	AF9035_15A4_9035,
 	AF9035_15A4_1001,
+	AF9035_07CA_A835,
+	AF9035_07CA_B835,
 	AF9035_07CA_1867,
 	AF9035_07CA_A867,
 };
@@ -804,6 +818,10 @@ static struct usb_device_id af9035_id[] = {
 		USB_DEVICE(USB_VID_AFATECH, USB_PID_AFATECH_AF9035)},
 	[AF9035_15A4_1001] = {
 		USB_DEVICE(USB_VID_AFATECH, USB_PID_AFATECH_AF9035_2)},
+	[AF9035_07CA_A835] = {
+		USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_A835)},
+	[AF9035_07CA_B835] = {
+		USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_B835)},
 	[AF9035_07CA_1867] = {
 		USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_1867)},
 	[AF9035_07CA_A867] = {
@@ -850,7 +868,7 @@ static struct dvb_usb_device_properties af9035_properties[] = {
 
 		.i2c_algo = &af9035_i2c_algo,
 
-		.num_device_descs = 3,
+		.num_device_descs = 4,
 		.devices = {
 			{
 				.name = "TerraTec Cinergy T Stick",
@@ -864,6 +882,12 @@ static struct dvb_usb_device_properties af9035_properties[] = {
 					&af9035_id[AF9035_15A4_1001],
 				},
 			}, {
+				.name = "AVerMedia AVerTV Volar HD/PRO (A835)",
+				.cold_ids = {
+					&af9035_id[AF9035_07CA_A835],
+					&af9035_id[AF9035_07CA_B835],
+				},
+			}, {
 				.name = "AVerMedia HD Volar (A867)",
 				.cold_ids = {
 					&af9035_id[AF9035_07CA_1867],
drivers/media/dvb/dvb-usb/dvb-usb-ids.h +2 -0
index 3cf002b..6a761c5 100644
@@ -224,6 +224,8 @@
 #define USB_PID_AVERMEDIA_A850T				0x850b
 #define USB_PID_AVERMEDIA_A805				0xa805
 #define USB_PID_AVERMEDIA_A815M				0x815a
+#define USB_PID_AVERMEDIA_A835				0xa835
+#define USB_PID_AVERMEDIA_B835				0xb835
 #define USB_PID_AVERMEDIA_1867				0x1867
 #define USB_PID_AVERMEDIA_A867				0xa867
 #define USB_PID_TECHNOTREND_CONNECT_S2400               0x3006
drivers/media/dvb/frontends/af9033.c +4 -0
index 8c0f4a3..5fadee7 100644
@@ -305,6 +305,10 @@ static int af9033_init(struct dvb_frontend *fe)
 		len = ARRAY_SIZE(tuner_init_mxl5007t);
 		init = tuner_init_mxl5007t;
 		break;
+	case AF9033_TUNER_TDA18218:
+		len = ARRAY_SIZE(tuner_init_tda18218);
+		init = tuner_init_tda18218;
+		break;
 	default:
 		pr_debug("%s: unsupported tuner ID=%d\n", __func__,
 				state->cfg.tuner);
drivers/media/dvb/frontends/af9033.h +1 -0
index dcf7e29..9e302c3 100644
@@ -41,6 +41,7 @@ struct af9033_config {
 #define AF9033_TUNER_TUA9001     0x27 /* Infineon TUA 9001 */
 #define AF9033_TUNER_FC0011      0x28 /* Fitipower FC0011 */
 #define AF9033_TUNER_MXL5007T    0xa0 /* MaxLinear MxL5007T */
+#define AF9033_TUNER_TDA18218    0xa1 /* NXP TDA 18218HN */
 	u8 tuner;
 
 	/*
drivers/media/dvb/frontends/af9033_priv.h +34 -0
index e6041bc..0b783b9 100644
@@ -432,5 +432,39 @@ static const struct reg_val tuner_init_mxl5007t[] = {
 	{ 0x80f1e6, 0x00 },
 };
 
+/* NXP TDA 18218HN tuner init
+   AF9033_TUNER_TDA18218    = 0xa1 */
+static const struct reg_val tuner_init_tda18218[] = {
+	{0x800046, 0xa1},
+	{0x800057, 0x01},
+	{0x800058, 0x01},
+	{0x80005f, 0x00},
+	{0x800060, 0x00},
+	{0x800071, 0x05},
+	{0x800072, 0x02},
+	{0x800074, 0x01},
+	{0x800079, 0x01},
+	{0x800093, 0x00},
+	{0x800094, 0x00},
+	{0x800095, 0x00},
+	{0x800096, 0x00},
+	{0x8000b3, 0x01},
+	{0x8000c3, 0x01},
+	{0x8000c4, 0x00},
+	{0x80f007, 0x00},
+	{0x80f00c, 0x19},
+	{0x80f00d, 0x1a},
+	{0x80f012, 0xda},
+	{0x80f013, 0x00},
+	{0x80f014, 0x00},
+	{0x80f015, 0x02},
+	{0x80f01f, 0x82},
+	{0x80f020, 0x00},
+	{0x80f029, 0x82},
+	{0x80f02a, 0x00},
+	{0x80f077, 0x02},
+	{0x80f1e6, 0x00},
+};
+
 #endif /* AF9033_PRIV_H */
 
Signature · 1 line
1.7.5.4
#5 lore raw

PATCH 3/5 tda18218: fix IF frequency for 7MHz bandwidth channels

In reply to Gianluca Gennari

This is necessary to tune VHF channels with the AVerMedia A835 stick.

---
 drivers/media/common/tuners/tda18218.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/media/common/tuners/tda18218.c +1 -1
index dfb3a83..b079696 100644
@@ -144,7 +144,7 @@ static int tda18218_set_params(struct dvb_frontend *fe)
 		priv->if_frequency = 3000000;
 	} else if (bw <= 7000000) {
 		LP_Fc = 1;
-		priv->if_frequency = 3500000;
+		priv->if_frequency = 4000000;
 	} else {
 		LP_Fc = 2;
 		priv->if_frequency = 4000000;
Signature · 1 line
1.7.5.4
#6 lore raw

Re: [PATCH 3/5] tda18218: fix IF frequency for 7MHz bandwidth channels

Quoted 12 lines · Gianluca Gennari

This is necessary to tune VHF channels with the AVerMedia A835 stick.

---
  drivers/media/common/tuners/tda18218.c |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
drivers/media/common/tuners/tda18218.c +0 -0
index dfb3a83..b079696 100644

drivers/media/common/tuners/tda18218.c static int tda18218_set_params(struct dvb_frontend *fe) · line 150

Quoted 8 lines
drivers/media/common/tuners/tda18218.c +1 -1
@@ -144,7 +144,7 @@ static int tda18218_set_params(struct dvb_frontend *fe)
  		priv->if_frequency = 3000000;
  	} else if (bw<= 7000000) {
  		LP_Fc = 1;
-		priv->if_frequency = 3500000;
+		priv->if_frequency = 4000000;
  	} else {
  		LP_Fc = 2;
  		priv->if_frequency = 4000000;

Kwaak, I will not apply that until I have done background checking. That driver is used only by AF9015 currently. And I did that driver as reverse-engineering and thus there is some things guessed. I have only 8 MHz wide signal, thus I never tested 7 and 6 MHz. Have no DVB-T modulator either... Maybe some AF9015 user can confirm? Is there any AF9015 & TDA18218 bug reports seen in discussion forums...

regards
Antti

Signature · 1 line
http://palosaari.fi/
#7 lore raw

Re: [PATCH 3/5] tda18218: fix IF frequency for 7MHz bandwidth channels

Il 03/04/2012 00:40, Antti Palosaari ha scritto:

Quoted 22 lines · Gianluca Gennari
Quoted 21 lines

This is necessary to tune VHF channels with the AVerMedia A835 stick.

---
  drivers/media/common/tuners/tda18218.c |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
drivers/media/common/tuners/tda18218.c +1 -1
index dfb3a83..b079696 100644
@@ -144,7 +144,7 @@ static int tda18218_set_params(struct dvb_frontend
 *fe)
          priv->if_frequency = 3000000;
      } else if (bw<= 7000000) {
          LP_Fc = 1;
-        priv->if_frequency = 3500000;
+        priv->if_frequency = 4000000;
      } else {
          LP_Fc = 2;
Quoted 8 lines
Quoted 1 line
          priv->if_frequency = 4000000;

Kwaak, I will not apply that until I have done background checking. That driver is used only by AF9015 currently. And I did that driver as reverse-engineering and thus there is some things guessed. I have only 8 MHz wide signal, thus I never tested 7 and 6 MHz. Have no DVB-T modulator either... Maybe some AF9015 user can confirm? Is there any AF9015 & TDA18218 bug reports seen in discussion forums...

A friend has a AF9015+TDA18218 stick and told me that it works fine with the patch (including VHF), but to be safe I will ask him to double check with the current media_build tree, with and without the patch. In the worst case, we can add a new parameter (or an array of parameters) for the IF frequency to struct tda18218_config.

Regards,
Gianluca

#8 lore raw

Re: [PATCH 3/5] tda18218: fix IF frequency for 7MHz bandwidth channels

Quoted 32 lines · Gianluca Gennari

Il 03/04/2012 00:40, Antti Palosaari ha scritto:

Quoted 22 lines · Gianluca Gennari
Quoted 21 lines

This is necessary to tune VHF channels with the AVerMedia A835 stick.

---
  drivers/media/common/tuners/tda18218.c |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
drivers/media/common/tuners/tda18218.c +1 -1
index dfb3a83..b079696 100644
@@ -144,7 +144,7 @@ static int tda18218_set_params(struct dvb_frontend
 *fe)
          priv->if_frequency = 3000000;
      } else if (bw<= 7000000) {
          LP_Fc = 1;
-        priv->if_frequency = 3500000;
+        priv->if_frequency = 4000000;
      } else {
          LP_Fc = 2;
Quoted 8 lines
Quoted 1 line
          priv->if_frequency = 4000000;

Kwaak, I will not apply that until I have done background checking. That driver is used only by AF9015 currently. And I did that driver as reverse-engineering and thus there is some things guessed. I have only 8 MHz wide signal, thus I never tested 7 and 6 MHz. Have no DVB-T modulator either... Maybe some AF9015 user can confirm? Is there any AF9015 & TDA18218 bug reports seen in discussion forums...

Quoted 5 lines

A friend has a AF9015+TDA18218 stick and told me that it works fine with the patch (including VHF), but to be safe I will ask him to double check with the current media_build tree, with and without the patch. In the worst case, we can add a new parameter (or an array of parameters) for the IF frequency to struct tda18218_config.

PASSED on 7MHz bw MUX - 'TerraTec Cinergy T Stick RC'.

rgds,
poma

#9 lore raw

Re: [PATCH 3/5] tda18218: fix IF frequency for 7MHz bandwidth channels

In reply to Gianluca Gennari
Quoted 32 lines · Gianluca Gennari

Il 03/04/2012 00:40, Antti Palosaari ha scritto:

Quoted 22 lines · Gianluca Gennari
Quoted 21 lines

This is necessary to tune VHF channels with the AVerMedia A835 stick.

---
   drivers/media/common/tuners/tda18218.c |    2 +-
   1 files changed, 1 insertions(+), 1 deletions(-)
drivers/media/common/tuners/tda18218.c +1 -1
index dfb3a83..b079696 100644
@@ -144,7 +144,7 @@ static int tda18218_set_params(struct dvb_frontend
 *fe)
           priv->if_frequency = 3000000;
       } else if (bw<= 7000000) {
           LP_Fc = 1;
-        priv->if_frequency = 3500000;
+        priv->if_frequency = 4000000;
       } else {
           LP_Fc = 2;
Quoted 8 lines
Quoted 1 line
           priv->if_frequency = 4000000;

Kwaak, I will not apply that until I have done background checking. That driver is used only by AF9015 currently. And I did that driver as reverse-engineering and thus there is some things guessed. I have only 8 MHz wide signal, thus I never tested 7 and 6 MHz. Have no DVB-T modulator either... Maybe some AF9015 user can confirm? Is there any AF9015& TDA18218 bug reports seen in discussion forums...

Quoted 5 lines

A friend has a AF9015+TDA18218 stick and told me that it works fine with the patch (including VHF), but to be safe I will ask him to double check with the current media_build tree, with and without the patch. In the worst case, we can add a new parameter (or an array of parameters) for the IF frequency to struct tda18218_config.

Public short datasheet [1], page 16, says default IFs are BW=8 MHz IF=4 MHz, BW=7 MHz IF=3.5 MHz, BW=6 MHz IF=3 MHz. I suspect it still locks in some cases even IF is off-by 0.5 MHz for BW 7 and 8 but performance is reduced. So there is now something wrong, likely bug in the tda18218 driver.

Could someone send me Windows sniff from success tune to 7 MHz BW channel?

[1] http://www.nxp.com/documents/data_sheet/TDA18218HN.pdf

Signature · 1 line
http://palosaari.fi/
#10 lore raw

Re: [PATCH 3/5] tda18218: fix IF frequency for 7MHz bandwidth channels

Il 03/04/2012 12:19, Antti Palosaari ha scritto:

Quoted 45 lines · Gianluca Gennari
Quoted 32 lines

Il 03/04/2012 00:40, Antti Palosaari ha scritto:

Quoted 22 lines · Gianluca Gennari
Quoted 21 lines

This is necessary to tune VHF channels with the AVerMedia A835 stick.

---
   drivers/media/common/tuners/tda18218.c |    2 +-
   1 files changed, 1 insertions(+), 1 deletions(-)
drivers/media/common/tuners/tda18218.c +1 -1
index dfb3a83..b079696 100644
@@ -144,7 +144,7 @@ static int tda18218_set_params(struct dvb_frontend
 *fe)
           priv->if_frequency = 3000000;
       } else if (bw<= 7000000) {
           LP_Fc = 1;
-        priv->if_frequency = 3500000;
+        priv->if_frequency = 4000000;
       } else {
           LP_Fc = 2;
Quoted 8 lines
Quoted 1 line
           priv->if_frequency = 4000000;

Kwaak, I will not apply that until I have done background checking. That driver is used only by AF9015 currently. And I did that driver as reverse-engineering and thus there is some things guessed. I have only 8 MHz wide signal, thus I never tested 7 and 6 MHz. Have no DVB-T modulator either... Maybe some AF9015 user can confirm? Is there any AF9015& TDA18218 bug reports seen in discussion forums...

Quoted 5 lines

A friend has a AF9015+TDA18218 stick and told me that it works fine with the patch (including VHF), but to be safe I will ask him to double check with the current media_build tree, with and without the patch. In the worst case, we can add a new parameter (or an array of parameters) for the IF frequency to struct tda18218_config.

Public short datasheet [1], page 16, says default IFs are BW=8 MHz IF=4 MHz, BW=7 MHz IF=3.5 MHz, BW=6 MHz IF=3 MHz. I suspect it still locks in some cases even IF is off-by 0.5 MHz for BW 7 and 8 but performance is reduced. So there is now something wrong, likely bug in the tda18218 driver.

Quoted 3 lines

Could someone send me Windows sniff from success tune to 7 MHz BW channel?

[1] http://www.nxp.com/documents/data_sheet/TDA18218HN.pdf

Hi Antti,
the situation is a bit confusing.
The A835 always needed the IF frequency modification to tune VHF channels, even with the famous Xgazza patch based on your old af9035 driver. Instead, the af9015 was working fine in VHF band with the default 3.5MHz IF frequency, until the recent rewrite of the tda18218 driver (which I believe happened around kernel 3.0). After that, the af9015 started working also with the 4MHz IF frequency (it's not clear if it still works also with 3.5MHz, I will ask my friend to check this).
So probably you are right, there could be a bug in the tda18218 tuner that was introduced recently.

A discussion on the A835 and VHF can be found on the Italian Ubuntu forum (in Italian of course):
http://forum.ubuntu-it.org/index.php/topic,384436.msg3700932.html#msg3700932

Do you have any suggestion on the tool to sniff the windows driver? Some time ago I tried SnoopyPro 0.22 and I was able to capture the first ~6000 packets of the A835 initialization, then it stopped capturing before the first picture was displayed. Do you think it's enough? Do you know any better free tool?

Regards,
Gianluca

#11 lore raw

Re: [PATCH 3/5] tda18218: fix IF frequency for 7MHz bandwidth channels

In reply to Antti Palosaari

Il 03/04/2012 12:19, Antti Palosaari ha scritto:

Quoted 45 lines · Gianluca Gennari
Quoted 32 lines

Il 03/04/2012 00:40, Antti Palosaari ha scritto:

Quoted 22 lines · Gianluca Gennari
Quoted 21 lines

This is necessary to tune VHF channels with the AVerMedia A835 stick.

---
   drivers/media/common/tuners/tda18218.c |    2 +-
   1 files changed, 1 insertions(+), 1 deletions(-)
drivers/media/common/tuners/tda18218.c +1 -1
index dfb3a83..b079696 100644
@@ -144,7 +144,7 @@ static int tda18218_set_params(struct dvb_frontend
 *fe)
           priv->if_frequency = 3000000;
       } else if (bw<= 7000000) {
           LP_Fc = 1;
-        priv->if_frequency = 3500000;
+        priv->if_frequency = 4000000;
       } else {
           LP_Fc = 2;
Quoted 8 lines
Quoted 1 line
           priv->if_frequency = 4000000;

Kwaak, I will not apply that until I have done background checking. That driver is used only by AF9015 currently. And I did that driver as reverse-engineering and thus there is some things guessed. I have only 8 MHz wide signal, thus I never tested 7 and 6 MHz. Have no DVB-T modulator either... Maybe some AF9015 user can confirm? Is there any AF9015& TDA18218 bug reports seen in discussion forums...

Quoted 5 lines

A friend has a AF9015+TDA18218 stick and told me that it works fine with the patch (including VHF), but to be safe I will ask him to double check with the current media_build tree, with and without the patch. In the worst case, we can add a new parameter (or an array of parameters) for the IF frequency to struct tda18218_config.

Public short datasheet [1], page 16, says default IFs are BW=8 MHz IF=4 MHz, BW=7 MHz IF=3.5 MHz, BW=6 MHz IF=3 MHz. I suspect it still locks in some cases even IF is off-by 0.5 MHz for BW 7 and 8 but performance is reduced. So there is now something wrong, likely bug in the tda18218 driver.

Quoted 3 lines

Could someone send me Windows sniff from success tune to 7 MHz BW channel?

[1] http://www.nxp.com/documents/data_sheet/TDA18218HN.pdf

Hi Antti,
I did some testing with the A835 and the findings are interesting. With the old tda18218 driver the af9015 sticks required IF=3.5MHz to tune VHF channels, while the A835 required IF=4MHz.

With the current driver, both the af9015 and the A835 are much more tolerant to IF frequency variations.
In particular, the A835 is capable to successfully tune UHF channels with IF in the range [3.5,5.5] MHz, and VHF channels with IF in the range [3.0,6.5] MHz, inclusive.

I don't know if this may be considered the symptom of a bug, but for sure the patch I posted is useless with the current driver. If you are still interested in a USB sniff of the Windows driver, just let me know.

Best regards,
Gianluca

#12 lore raw

Re: [PATCH 3/5] tda18218: fix IF frequency for 7MHz bandwidth channels

Quoted 55 lines · Gianluca Gennari

Il 03/04/2012 12:19, Antti Palosaari ha scritto:

Quoted 45 lines · Gianluca Gennari
Quoted 32 lines

Il 03/04/2012 00:40, Antti Palosaari ha scritto:

Quoted 22 lines · Gianluca Gennari
Quoted 21 lines

This is necessary to tune VHF channels with the AVerMedia A835 stick.

---
    drivers/media/common/tuners/tda18218.c |    2 +-
    1 files changed, 1 insertions(+), 1 deletions(-)
drivers/media/common/tuners/tda18218.c +1 -1
index dfb3a83..b079696 100644
@@ -144,7 +144,7 @@ static int tda18218_set_params(struct dvb_frontend
 *fe)
            priv->if_frequency = 3000000;
        } else if (bw<= 7000000) {
            LP_Fc = 1;
-        priv->if_frequency = 3500000;
+        priv->if_frequency = 4000000;
        } else {
            LP_Fc = 2;
Quoted 8 lines
Quoted 1 line
            priv->if_frequency = 4000000;

Kwaak, I will not apply that until I have done background checking. That driver is used only by AF9015 currently. And I did that driver as reverse-engineering and thus there is some things guessed. I have only 8 MHz wide signal, thus I never tested 7 and 6 MHz. Have no DVB-T modulator either... Maybe some AF9015 user can confirm? Is there any
AF9015& TDA18218 bug reports seen in discussion forums...

Quoted 5 lines

A friend has a AF9015+TDA18218 stick and told me that it works fine with the patch (including VHF), but to be safe I will ask him to double check with the current media_build tree, with and without the patch. In the worst case, we can add a new parameter (or an array of parameters) for the IF frequency to struct tda18218_config.

Public short datasheet [1], page 16, says default IFs are BW=8 MHz IF=4 MHz, BW=7 MHz IF=3.5 MHz, BW=6 MHz IF=3 MHz. I suspect it still locks in some cases even IF is off-by 0.5 MHz for BW 7 and 8 but performance is reduced. So there is now something wrong, likely bug in the tda18218 driver.

Quoted 3 lines

Could someone send me Windows sniff from success tune to 7 MHz BW channel?

[1] http://www.nxp.com/documents/data_sheet/TDA18218HN.pdf

Hi Antti,
I did some testing with the A835 and the findings are interesting. With the old tda18218 driver the af9015 sticks required IF=3.5MHz to tune VHF channels, while the A835 required IF=4MHz.

Quoted 5 lines

With the current driver, both the af9015 and the A835 are much more tolerant to IF frequency variations.
In particular, the A835 is capable to successfully tune UHF channels with IF in the range [3.5,5.5] MHz, and VHF channels with IF in the range [3.0,6.5] MHz, inclusive.

IF frequency is frequency used between tuner and demodulator. Thus it should be same for the tuner, it is sender Tx, and for demodulator which receives it. As you can guess it is like radio channel, it will work if it is a little bit wrong but performance will be reduced.

IF frequency is generally more tuner characteristic than demodulator. I mean it is likely tuner decides which is optimal IF for signal tuner is transferring to demod. Earlier we used configuration option for both tuner and demod to set IF. But as the fact is tuner must know it always we added new tuner callback .get_if_frequency() demodulator can ask used IF from the tuner.

Recently I converted AF9013 driver to use that .get_if_frequency(). I think at that point I may have introduced some bug.

And one point to mention, it is sometimes used a little bit different IFs that are tuner defaults. It is somehow device design specific, for maximum performance device engineers will ran some test to find out optimal IF which gives best performance. One reason could be example there is RF noise peak (RF spurs) just in used IF which reduces performance => lets shift default IF a little bit for maximum performance.

Quoted 4 lines

I don't know if this may be considered the symptom of a bug, but for sure the patch I posted is useless with the current driver. If you are still interested in a USB sniff of the Windows driver, just let me know.

I have used old SniffUSB2.0
http://www.pcausa.com/Utilities/UsbSnoop/
Works fine with Windows XP. Sniff is welcome.

regards
Antti

Signature · 1 line
http://palosaari.fi/
#13 lore raw

Re: [PATCH 3/5] tda18218: fix IF frequency for 7MHz bandwidth channels

Il 04/04/2012 15:27, Antti Palosaari ha scritto:

Quoted 15 lines

IF frequency is frequency used between tuner and demodulator. Thus it should be same for the tuner, it is sender Tx, and for demodulator which receives it. As you can guess it is like radio channel, it will work if it is a little bit wrong but performance will be reduced.

IF frequency is generally more tuner characteristic than demodulator. I mean it is likely tuner decides which is optimal IF for signal tuner is transferring to demod. Earlier we used configuration option for both tuner and demod to set IF. But as the fact is tuner must know it always we added new tuner callback .get_if_frequency() demodulator can ask used IF from the tuner.

Recently I converted AF9013 driver to use that .get_if_frequency(). I think at that point I may have introduced some bug.

Quoted 6 lines

And one point to mention, it is sometimes used a little bit different IFs that are tuner defaults. It is somehow device design specific, for maximum performance device engineers will ran some test to find out optimal IF which gives best performance. One reason could be example there is RF noise peak (RF spurs) just in used IF which reduces performance => lets shift default IF a little bit for maximum performance.

I found out the origin of the problem: in the old "hacked" driver the demodulator IF frequency was erroneously hard-coded to 4.57 MHz (like with the mxl5007t tuner) so there was a mismatch between the tuner and the demodulator IF setting.

In UHF band, the difference was only 0.57 MHz, so it still worked (probably with reduced performance). Instead, in VHF band the difference was over 1 MHz so it was not working. Hacking the tuner IF frequency to 4 MHz in VHF band was enough to get it working, but of course it was not optimal.

In the end, there is no bug in the current code. Sorry for all the unnecessary noise about this issue.

Regards,
Gianluca

#14 lore raw

PATCH 4/5 af9035: fix warning

In reply to Gianluca Gennari

af9035.c: In function 'af9035_download_firmware':
af9035.c:446:3: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'unsigned int' [-Wformat]

---
 drivers/media/dvb/dvb-usb/af9035.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/media/dvb/dvb-usb/af9035.c +1 -1
index f943c57..8bf6367 100644
@@ -443,7 +443,7 @@ static int af9035_download_firmware(struct usb_device *udev,
 
 		i -= hdr_data_len + HDR_SIZE;
 
-		pr_debug("%s: data uploaded=%lu\n", __func__, fw->size - i);
+		pr_debug("%s: data uploaded=%u\n", __func__, fw->size - i);
 	}
 
 	/* firmware loaded, request boot */
Signature · 1 line
1.7.5.4
#15 lore raw

Re: [PATCH 4/5] af9035: fix warning

Quoted 14 lines · Gianluca Gennari

af9035.c: In function 'af9035_download_firmware':
af9035.c:446:3: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'unsigned int' [-Wformat]

---
  drivers/media/dvb/dvb-usb/af9035.c |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
drivers/media/dvb/dvb-usb/af9035.c +0 -0
index f943c57..8bf6367 100644

drivers/media/dvb/dvb-usb/af9035.c static int af9035_download_firmware(struct usb_device *udev, · line 449

Quoted 8 lines
drivers/media/dvb/dvb-usb/af9035.c +1 -1
@@ -443,7 +443,7 @@ static int af9035_download_firmware(struct usb_device *udev,
 
  		i -= hdr_data_len + HDR_SIZE;
 
-		pr_debug("%s: data uploaded=%lu\n", __func__, fw->size - i);
+		pr_debug("%s: data uploaded=%u\n", __func__, fw->size - i);
  	}
 
  	/* firmware loaded, request boot */

That gives similar error on 64bit. Maybe %zu works both 64 and 32 bit without warnings? Could you try and sent new patch if it works for you?

drivers/media/dvb/dvb-usb/af9035.c: In function ‘af9035_download_firmware’:
drivers/media/dvb/dvb-usb/af9035.c:446:3: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 4 has type ‘long unsigned int’ [-Wformat]

see here:
http://www.velocityreviews.com/forums/t593117-printf-specification-for-size_t.html

regards
Antti

Signature · 1 line
http://palosaari.fi/
#16 lore raw

PATCH 5/5 af9035: use module_usb_driver macro

In reply to Gianluca Gennari

Let's save a few lines of code using the module_usb_driver macro.

---
 drivers/media/dvb/dvb-usb/af9035.c |   26 +-------------------------
 1 files changed, 1 insertions(+), 25 deletions(-)
drivers/media/dvb/dvb-usb/af9035.c +1 -25
index 8bf6367..3242312 100644
@@ -973,31 +973,7 @@ static struct usb_driver af9035_usb_driver = {
 	.id_table = af9035_id,
 };
 
-/* module stuff */
-static int __init af9035_usb_module_init(void)
-{
-	int ret;
-
-	ret = usb_register(&af9035_usb_driver);
-	if (ret < 0)
-		goto err;
-
-	return 0;
-
-err:
-	pr_debug("%s: failed=%d\n", __func__, ret);
-
-	return ret;
-}
-
-static void __exit af9035_usb_module_exit(void)
-{
-	/* deregister this driver from the USB subsystem */
-	usb_deregister(&af9035_usb_driver);
-}
-
-module_init(af9035_usb_module_init);
-module_exit(af9035_usb_module_exit);
+module_usb_driver(af9035_usb_driver);
 
 MODULE_AUTHOR("Antti Palosaari <[email protected]>");
 MODULE_DESCRIPTION("Afatech AF9035 driver");
Signature · 1 line
1.7.5.4
#18 lore raw
In reply to Gianluca Gennari

Hi,

Card : A835 from AverTV Media Green HD.

Quoted 3 lines

My A867 and A835 sticks works pretty well with this new driver. The driver is fast and responsive and there is no problem tuning all the channels available in my area: a full scan finds all of them.

Confirmed : build on the top of 3.3.1 with all recently patch applied,
I found nearly 29 patches from last past few days to cover af9035 from linuxtv.org media_build tree, and 4 more at begining to satisfy (more or less) drivers/media/dvb/dvb-usb/Kconfig,

only end cflags file done by hand in drivers/media/dvb/dvb-usb/Makefile. And that is _not_ the first time I particularily see this : anyway.

!!!!! To all people woked on that driver : Thanks you !!!!!

Quoted 1 line

After a quick test I couldn't find any difference between the 3 firmwares.

I only test dvb-usb-af9035-02.fw so ... sorry.

Best regards.
See ya.

Quoted 28 lines

----- Mail original -----
De : Gianluca Gennari <[email protected]>
À : [email protected]; [email protected]
Cc : [email protected]; [email protected]; [email protected]; Gianluca Gennari <[email protected]> Envoyé le : Lundi 2 avril 2012 23h25
Objet : [PATCH 0/5] af9035: support for tda18218 tuner, new USB IDs and more

Hi all,
this is a series of small patches for the new af9035 driver.
It adds basic support for the tda18218 tuner (and the related devices of the Avermedia A835 serie), including a small patch to tune VHF channels. Also, there is new USB ID for the 07ca:a867 device (Avermedia A867). Finally, there are a couple of clean-ups.

My A867 and A835 sticks works pretty well with this new driver. The driver is fast and responsive and there is no problem tuning all the channels available in my area: a full scan finds all of them.

The only minor issue is that the signal strength is stuck to 100% with all channels, with both sticks and with all the 3 firmwares.
SNR works properly.

After a quick test I couldn't find any difference between the 3 firmwares. Anyway, the A867 seems a bit faster than the A835, and also it locked a very weak mux that previously I was able to lock only with the PCTV 290e.

Best regards,
Gianluca Gennari

[...]

Quoted 1 line