Skip to contentSkip to conversation

ITE IT913X silicon tuner driver

PATCH In review Antti Palosaari 2 participants 45 messages Mar 10, 2013 – Mar 22, 2013

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/41 ITE IT913X silicon tuner driver

It is tuner driver for tuner integrated to the ITE IT9135 and IT9137 chips. I split it out from the current it913x-fe driver.

Cc Malcolm Priestley <[email protected]>
---
 drivers/media/tuners/Kconfig       |   7 +
 drivers/media/tuners/Makefile      |   1 +
 drivers/media/tuners/it913x.c      | 584 +++++++++++++++++++++++++
 drivers/media/tuners/it913x.h      |  55 +++
 drivers/media/tuners/it913x_priv.h | 867 +++++++++++++++++++++++++++++++++++++
 5 files changed, 1514 insertions(+)
 create mode 100644 drivers/media/tuners/it913x.c
 create mode 100644 drivers/media/tuners/it913x.h
 create mode 100644 drivers/media/tuners/it913x_priv.h
drivers/media/tuners/Kconfig +7 -0
index e8fdf71..ffabd66 100644
@@ -241,4 +241,11 @@ config MEDIA_TUNER_TUA9001
 	default m if !MEDIA_SUBDRV_AUTOSELECT
 	help
 	  Infineon TUA 9001 silicon tuner driver.
+
+config MEDIA_TUNER_IT913X
+	tristate "ITE Tech IT913x silicon tuner"
+	depends on MEDIA_SUPPORT && I2C
+	default m if !MEDIA_SUBDRV_AUTOSELECT
+	help
+	  ITE Tech IT913x silicon tuner driver.
 endmenu
drivers/media/tuners/Makefile +1 -0
index 5e569b1..f136a6d 100644
@@ -34,6 +34,7 @@ obj-$(CONFIG_MEDIA_TUNER_TUA9001) += tua9001.o
 obj-$(CONFIG_MEDIA_TUNER_FC0011) += fc0011.o
 obj-$(CONFIG_MEDIA_TUNER_FC0012) += fc0012.o
 obj-$(CONFIG_MEDIA_TUNER_FC0013) += fc0013.o
+obj-$(CONFIG_MEDIA_TUNER_IT913X) += it913x.o
 
 ccflags-y += -I$(srctree)/drivers/media/dvb-core
 ccflags-y += -I$(srctree)/drivers/media/dvb-frontends
drivers/media/tuners/it913x.c new file +584 -0

584 lines not on this page · raw message

drivers/media/tuners/it913x.h new file +55 -0

55 lines not on this page · raw message

drivers/media/tuners/it913x_priv.h new file +867 -0

867 lines not on this page · raw message

Signature · 1 line
1.7.11.7
#1 lore raw

PATCH 2/41 af9033: support for it913x tuners

Add support for tuners integrated to the IT9135 and IT9137.

Cc Malcolm Priestley <[email protected]>
---
 drivers/media/dvb-frontends/af9033.c | 34 +++++++++++++++++++++-------------
 drivers/media/dvb-frontends/af9033.h | 15 +++++++++++++++
 2 files changed, 36 insertions(+), 13 deletions(-)
drivers/media/dvb-frontends/af9033.c +21 -13
index c9cad98..dece775 100644
@@ -223,6 +223,7 @@ static int af9033_init(struct dvb_frontend *fe)
 		{ 0x80f986, state->ts_mode_parallel, 0x01 },
 		{ 0x00d827, 0x00, 0xff },
 		{ 0x00d829, 0x00, 0xff },
+		{ 0x800045, state->cfg.adc_multiplier, 0xff },
 	};
 
 	/* program clock control */
@@ -322,6 +323,14 @@ static int af9033_init(struct dvb_frontend *fe)
 		len = ARRAY_SIZE(tuner_init_fc0012);
 		init = tuner_init_fc0012;
 		break;
+	case AF9033_TUNER_IT9135_38:
+	case AF9033_TUNER_IT9135_51:
+	case AF9033_TUNER_IT9135_52:
+	case AF9033_TUNER_IT9135_60:
+	case AF9033_TUNER_IT9135_61:
+	case AF9033_TUNER_IT9135_62:
+		len = 0;
+		break;
 	default:
 		dev_dbg(&state->i2c->dev, "%s: unsupported tuner ID=%d\n",
 				__func__, state->cfg.tuner);
@@ -498,12 +507,7 @@ static int af9033_set_frontend(struct dvb_frontend *fe)
 		if (spec_inv == -1)
 			freq_cw = 0x800000 - freq_cw;
 
-		/* get adc multiplies */
-		ret = af9033_rd_reg(state, 0x800045, &tmp);
-		if (ret < 0)
-			goto err;
-
-		if (tmp == 1)
+		if (state->cfg.adc_multiplier == AF9033_ADC_MULTIPLIER_2X)
 			freq_cw /= 2;
 
 		buf[0] = (freq_cw >>  0) & 0xff;
@@ -933,14 +937,18 @@ struct dvb_frontend *af9033_attach(const struct af9033_config *config,
 			"OFDM=%d.%d.%d.%d\n", KBUILD_MODNAME, buf[0], buf[1],
 			buf[2], buf[3], buf[4], buf[5], buf[6], buf[7]);
 
-	/* sleep */
-	ret = af9033_wr_reg(state, 0x80004c, 1);
-	if (ret < 0)
-		goto err;
 
-	ret = af9033_wr_reg(state, 0x800000, 0);
-	if (ret < 0)
-		goto err;
+	/* FIXME: Do not abuse adc_multiplier for detecting IT9135 */
+	if (state->cfg.adc_multiplier != AF9033_ADC_MULTIPLIER_2X) {
+		/* sleep */
+		ret = af9033_wr_reg(state, 0x80004c, 1);
+		if (ret < 0)
+			goto err;
+
+		ret = af9033_wr_reg(state, 0x800000, 0);
+		if (ret < 0)
+			goto err;
+	}
 
 	/* configure internal TS mode */
 	switch (state->cfg.ts_mode) {
drivers/media/dvb-frontends/af9033.h +15 -0
index 82bd8c1..53fd304 100644
@@ -36,6 +36,13 @@ struct af9033_config {
 	u32 clock;
 
 	/*
+	 * ADC multiplier
+	 */
+#define AF9033_ADC_MULTIPLIER_1X   0
+#define AF9033_ADC_MULTIPLIER_2X   1
+	u8 adc_multiplier;
+
+	/*
 	 * tuner
 	 */
 #define AF9033_TUNER_TUA9001     0x27 /* Infineon TUA 9001 */
@@ -44,6 +51,14 @@ struct af9033_config {
 #define AF9033_TUNER_MXL5007T    0xa0 /* MaxLinear MxL5007T */
 #define AF9033_TUNER_TDA18218    0xa1 /* NXP TDA 18218HN */
 #define AF9033_TUNER_FC2580      0x32 /* FCI FC2580 */
+/* 50-5f Omega */
+#define AF9033_TUNER_IT9135_38   0x38 /* Omega */
+#define AF9033_TUNER_IT9135_51   0x51 /* Omega LNA config 1 */
+#define AF9033_TUNER_IT9135_52   0x52 /* Omega LNA config 2 */
+/* 60-6f Omega v2 */
+#define AF9033_TUNER_IT9135_60   0x60 /* Omega v2 */
+#define AF9033_TUNER_IT9135_61   0x61 /* Omega v2 LNA config 1 */
+#define AF9033_TUNER_IT9135_62   0x62 /* Omega v2 LNA config 2 */
 	u8 tuner;
 
 	/*
Signature · 1 line
1.7.11.7
#2 lore raw

PATCH 3/41 af9035: add support for 1st gen it9135

In reply to Antti Palosaari
Cc Malcolm Priestley <[email protected]>
---
 drivers/media/usb/dvb-usb-v2/Kconfig  |  1 +
 drivers/media/usb/dvb-usb-v2/af9035.c | 24 +++++++++++++++++++++++-
 drivers/media/usb/dvb-usb-v2/af9035.h |  1 +
 3 files changed, 25 insertions(+), 1 deletion(-)
drivers/media/usb/dvb-usb-v2/Kconfig +1 -0
index 692224d..2d4abfa 100644
@@ -41,6 +41,7 @@ config DVB_USB_AF9035
 	select MEDIA_TUNER_MXL5007T if MEDIA_SUBDRV_AUTOSELECT
 	select MEDIA_TUNER_TDA18218 if MEDIA_SUBDRV_AUTOSELECT
 	select MEDIA_TUNER_FC2580 if MEDIA_SUBDRV_AUTOSELECT
+	select MEDIA_TUNER_IT913X if MEDIA_SUBDRV_AUTOSELECT
 	help
 	  Say Y here to support the Afatech AF9035 based DVB USB receiver.
 
drivers/media/usb/dvb-usb-v2/af9035.c +23 -1
index f11cc42..d57fbb1 100644
@@ -652,6 +652,10 @@ static int af9035_read_config_it9135(struct dvb_usb_device *d)
 	int ret, i;
 	u8 tmp;
 
+	/* demod I2C "address" */
+	state->af9033_config[0].i2c_addr = 0x38;
+	state->af9033_config[0].tuner = AF9033_TUNER_IT9135_38;
+	state->af9033_config[0].adc_multiplier = AF9033_ADC_MULTIPLIER_2X;
 	state->dual_mode = false;
 
 	/* get demod clock */
@@ -920,6 +924,20 @@ static const struct fc0012_config af9035_fc0012_config[] = {
 	}
 };
 
+static struct ite_config af9035_it913x_config = {
+	.chip_ver = 0x01,
+	.chip_type = 0x9135,
+	.firmware = 0x00000000,
+	.firmware_ver = 1,
+	.adc_x2 = 1,
+	.tuner_id_0 = AF9033_TUNER_IT9135_38,
+	.tuner_id_1 = 0x00,
+	.dual_mode = 0x00,
+	.adf = 0x00,
+	/* option to read SIGNAL_LEVEL */
+	.read_slevel = 0,
+};
+
 static int af9035_tuner_attach(struct dvb_usb_adapter *adap)
 {
 	struct state *state = adap_to_priv(adap);
@@ -1082,6 +1100,11 @@ static int af9035_tuner_attach(struct dvb_usb_adapter *adap)
 		fe = dvb_attach(fc0012_attach, adap->fe[0], &d->i2c_adap,
 				&af9035_fc0012_config[adap->id]);
 		break;
+	case AF9033_TUNER_IT9135_38:
+		/* attach tuner */
+		fe = dvb_attach(it913x_attach, adap->fe[0],
+				&d->i2c_adap, 0x38, &af9035_it913x_config);
+		break;
 	default:
 		fe = NULL;
 	}
@@ -1275,7 +1298,6 @@ static const struct dvb_usb_device_properties it9135_props = {
 	.frontend_attach = af9035_frontend_attach,
 	.tuner_attach = af9035_tuner_attach,
 	.init = af9035_init,
-	.get_rc_config = af9035_get_rc_config,
 
 	.num_adapters = 1,
 	.adapter = {
drivers/media/usb/dvb-usb-v2/af9035.h +1 -0
index 29f3eec..9556bab 100644
@@ -30,6 +30,7 @@
 #include "mxl5007t.h"
 #include "tda18218.h"
 #include "fc2580.h"
+#include "it913x.h"
 
 struct reg_val {
 	u32 reg;
Signature · 1 line
1.7.11.7
#3 lore raw

PATCH 4/41 af9035: add auto configuration heuristic for it9135

In reply to Antti Palosaari

Detect automatically multiple chip versions and select configuration according to that.

---
 drivers/media/usb/dvb-usb-v2/af9035.c | 116 ++++++++++++++++++++++++----------
 drivers/media/usb/dvb-usb-v2/af9035.h |   6 +-
 2 files changed, 88 insertions(+), 34 deletions(-)
drivers/media/usb/dvb-usb-v2/af9035.c +83 -33
index d57fbb1..7fdc9ed 100644
@@ -292,12 +292,38 @@ static struct i2c_algorithm af9035_i2c_algo = {
 
 static int af9035_identify_state(struct dvb_usb_device *d, const char **name)
 {
+	struct state *state = d_to_priv(d);
 	int ret;
 	u8 wbuf[1] = { 1 };
 	u8 rbuf[4];
 	struct usb_req req = { CMD_FW_QUERYINFO, 0, sizeof(wbuf), wbuf,
 			sizeof(rbuf), rbuf };
 
+	ret = af9035_rd_regs(d, 0x1222, rbuf, 3);
+	if (ret < 0)
+		goto err;
+
+	state->chip_version = rbuf[0];
+	state->chip_type = rbuf[2] << 8 | rbuf[1] << 0;
+
+	ret = af9035_rd_reg(d, 0x384f, &state->prechip_version);
+	if (ret < 0)
+		goto err;
+
+	dev_info(&d->udev->dev,
+			"%s: prechip_version=%02x chip_version=%02x chip_type=%04x\n",
+			__func__, state->prechip_version, state->chip_version,
+			state->chip_type);
+
+	if (state->chip_type == 0x9135) {
+		if (state->chip_version == 2)
+			*name = AF9035_FIRMWARE_IT9135_V2;
+		else
+			*name = AF9035_FIRMWARE_IT9135_V1;
+	} else {
+		*name = AF9035_FIRMWARE_AF9035;
+	}
+
 	ret = af9035_ctrl_msg(d, &req);
 	if (ret < 0)
 		goto err;
@@ -316,7 +342,7 @@ err:
 	return ret;
 }
 
-static int af9035_download_firmware(struct dvb_usb_device *d,
+static int af9035_download_firmware_af9035(struct dvb_usb_device *d,
 		const struct firmware *fw)
 {
 	int ret, i, j, len;
@@ -543,7 +569,18 @@ err:
 	return ret;
 }
 
-static int af9035_read_config(struct dvb_usb_device *d)
+static int af9035_download_firmware(struct dvb_usb_device *d,
+		const struct firmware *fw)
+{
+	struct state *state = d_to_priv(d);
+
+	if (state->chip_type == 0x9135)
+		return af9035_download_firmware_it9135(d, fw);
+	else
+		return af9035_download_firmware_af9035(d, fw);
+}
+
+static int af9035_read_config_af9035(struct dvb_usb_device *d)
 {
 	struct state *state = d_to_priv(d);
 	int ret, i, eeprom_shift = 0;
@@ -658,6 +695,27 @@ static int af9035_read_config_it9135(struct dvb_usb_device *d)
 	state->af9033_config[0].adc_multiplier = AF9033_ADC_MULTIPLIER_2X;
 	state->dual_mode = false;
 
+	/* check if eeprom exists */
+	if (state->chip_version == 2)
+		ret = af9035_rd_reg(d, 0x00461d, &tmp);
+	else
+		ret = af9035_rd_reg(d, 0x00461b, &tmp);
+	if (ret < 0)
+		goto err;
+
+	if (tmp) {
+		/* tuner */
+		ret = af9035_rd_reg(d, 0x0049d0, &tmp);
+		if (ret < 0)
+			goto err;
+
+		dev_dbg(&d->udev->dev, "%s: [%d]tuner=%02x\n",
+				__func__, 0, tmp);
+
+		if (tmp)
+			state->af9033_config[0].tuner = tmp;
+	}
+
 	/* get demod clock */
 	ret = af9035_rd_reg(d, 0x00d800, &tmp);
 	if (ret < 0)
@@ -676,6 +734,16 @@ err:
 	return ret;
 }
 
+static int af9035_read_config(struct dvb_usb_device *d)
+{
+	struct state *state = d_to_priv(d);
+
+	if (state->chip_type == 0x9135)
+		return af9035_read_config_it9135(d);
+	else
+		return af9035_read_config_af9035(d);
+}
+
 static int af9035_tua9001_tuner_callback(struct dvb_usb_device *d,
 		int cmd, int arg)
 {
@@ -1101,7 +1169,13 @@ static int af9035_tuner_attach(struct dvb_usb_adapter *adap)
 				&af9035_fc0012_config[adap->id]);
 		break;
 	case AF9033_TUNER_IT9135_38:
+	case AF9033_TUNER_IT9135_51:
+	case AF9033_TUNER_IT9135_52:
+	case AF9033_TUNER_IT9135_60:
+	case AF9033_TUNER_IT9135_61:
+	case AF9033_TUNER_IT9135_62:
 		/* attach tuner */
+		af9035_it913x_config.tuner_id_0 = state->af9033_config[0].tuner;
 		fe = dvb_attach(it913x_attach, adap->fe[0],
 				&d->i2c_adap, 0x38, &af9035_it913x_config);
 		break;
@@ -1202,9 +1276,14 @@ err:
 
 static int af9035_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc)
 {
+	struct state *state = d_to_priv(d);
 	int ret;
 	u8 tmp;
 
+	/* TODO: IT9135 remote control support */
+	if (state->chip_type == 0x9135)
+		return 0;
+
 	ret = af9035_rd_reg(d, EEPROM_IR_MODE, &tmp);
 	if (ret < 0)
 		goto err;
@@ -1260,7 +1339,6 @@ static const struct dvb_usb_device_properties af9035_props = {
 	.generic_bulk_ctrl_endpoint_response = 0x81,
 
 	.identify_state = af9035_identify_state,
-	.firmware = AF9035_FIRMWARE_AF9035,
 	.download_firmware = af9035_download_firmware,
 
 	.i2c_algo = &af9035_i2c_algo,
@@ -1280,35 +1358,6 @@ static const struct dvb_usb_device_properties af9035_props = {
 	},
 };
 
-static const struct dvb_usb_device_properties it9135_props = {
-	.driver_name = KBUILD_MODNAME,
-	.owner = THIS_MODULE,
-	.adapter_nr = adapter_nr,
-	.size_of_priv = sizeof(struct state),
-
-	.generic_bulk_ctrl_endpoint = 0x02,
-	.generic_bulk_ctrl_endpoint_response = 0x81,
-
-	.identify_state = af9035_identify_state,
-	.firmware = AF9035_FIRMWARE_IT9135,
-	.download_firmware = af9035_download_firmware_it9135,
-
-	.i2c_algo = &af9035_i2c_algo,
-	.read_config = af9035_read_config_it9135,
-	.frontend_attach = af9035_frontend_attach,
-	.tuner_attach = af9035_tuner_attach,
-	.init = af9035_init,
-
-	.num_adapters = 1,
-	.adapter = {
-		{
-			.stream = DVB_USB_STREAM_BULK(0x84, 6, 87 * 188),
-		}, {
-			.stream = DVB_USB_STREAM_BULK(0x85, 6, 87 * 188),
-		},
-	},
-};
-
 static const struct usb_device_id af9035_id_table[] = {
 	{ DVB_USB_DEVICE(USB_VID_AFATECH, USB_PID_AFATECH_AF9035_9035,
 		&af9035_props, "Afatech AF9035 reference design", NULL) },
@@ -1356,4 +1405,5 @@ MODULE_AUTHOR("Antti Palosaari <[email protected]>");
 MODULE_DESCRIPTION("Afatech AF9035 driver");
 MODULE_LICENSE("GPL");
 MODULE_FIRMWARE(AF9035_FIRMWARE_AF9035);
-MODULE_FIRMWARE(AF9035_FIRMWARE_IT9135);
+MODULE_FIRMWARE(AF9035_FIRMWARE_IT9135_V1);
+MODULE_FIRMWARE(AF9035_FIRMWARE_IT9135_V2);
drivers/media/usb/dvb-usb-v2/af9035.h +5 -1
index 9556bab..f995339 100644
@@ -55,6 +55,9 @@ struct usb_req {
 struct state {
 	u8 seq; /* packet sequence number */
 	bool dual_mode;
+	u8 prechip_version;
+	u8 chip_version;
+	u16 chip_type;
 	struct af9033_config af9033_config[2];
 };
 
@@ -87,7 +90,8 @@ u32 clock_lut_it9135[] = {
 };
 
 #define AF9035_FIRMWARE_AF9035 "dvb-usb-af9035-02.fw"
-#define AF9035_FIRMWARE_IT9135 "dvb-usb-it9135-01.fw"
+#define AF9035_FIRMWARE_IT9135_V1 "dvb-usb-it9135-01.fw"
+#define AF9035_FIRMWARE_IT9135_V2 "dvb-usb-it9135-02.fw"
 
 /* EEPROM locations */
 #define EEPROM_IR_MODE            0x430d
Signature · 1 line
1.7.11.7
#4 lore raw

PATCH 5/41 af9035: fix af9033 demod sampling frequency

In reply to Antti Palosaari

ADC needs to be also multiplied to 2 as it9135.
Fixes bug I introduced few commits ago.

---
 drivers/media/usb/dvb-usb-v2/af9035.c | 1 +
 1 file changed, 1 insertion(+)
drivers/media/usb/dvb-usb-v2/af9035.c +1 -0
index 7fdc9ed..cc05f59 100644
@@ -589,6 +589,7 @@ static int af9035_read_config_af9035(struct dvb_usb_device *d)
 
 	/* demod I2C "address" */
 	state->af9033_config[0].i2c_addr = 0x38;
+	state->af9033_config[0].adc_multiplier = AF9033_ADC_MULTIPLIER_2X;
 
 	/* check if there is dual tuners */
 	ret = af9035_rd_reg(d, EEPROM_DUAL_MODE, &tmp);
Signature · 1 line
1.7.11.7
#5 lore raw

PATCH 6/41 af9015: reject device TerraTec Cinergy T Stick Dual RC (rev. 2)

In reply to Antti Palosaari

That same USB ID is used both AF9015 and AF9035 driver. iManufacturer is only thing we can select correct driver without a I/O.

---
 drivers/media/usb/dvb-usb-v2/af9015.c | 40 ++++++++++++++++++++++++++++++++++-
 1 file changed, 39 insertions(+), 1 deletion(-)
drivers/media/usb/dvb-usb-v2/af9015.c +39 -1
index b86d0f2..2cf7ad2 100644
@@ -1317,6 +1317,43 @@ static int af9015_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc)
 	#define af9015_get_rc_config NULL
 #endif
 
+static int af9015_probe(struct usb_interface *intf,
+		const struct usb_device_id *id)
+{
+	struct usb_device *udev = interface_to_usbdev(intf);
+	char manufacturer[sizeof("ITE Technologies, Inc.")];
+
+	memset(manufacturer, 0, sizeof(manufacturer));
+	usb_string(udev, udev->descriptor.iManufacturer,
+			manufacturer, sizeof(manufacturer));
+	/*
+	 * There is two devices having same ID but different chipset. One uses
+	 * AF9015 and the other IT9135 chipset. Only difference seen on lsusb
+	 * is iManufacturer string.
+	 *
+	 * idVendor           0x0ccd TerraTec Electronic GmbH
+	 * idProduct          0x0099
+	 * bcdDevice            2.00
+	 * iManufacturer           1 Afatech
+	 * iProduct                2 DVB-T 2
+	 *
+	 * idVendor           0x0ccd TerraTec Electronic GmbH
+	 * idProduct          0x0099
+	 * bcdDevice            2.00
+	 * iManufacturer           1 ITE Technologies, Inc.
+	 * iProduct                2 DVB-T TV Stick
+	 */
+	if ((le16_to_cpu(udev->descriptor.idVendor) == USB_VID_TERRATEC) &&
+			(le16_to_cpu(udev->descriptor.idProduct) == 0x0099)) {
+		if (!strcmp("ITE Technologies, Inc.", manufacturer)) {
+			dev_dbg(&udev->dev, "%s: rejecting device\n", __func__);
+			return -ENODEV;
+		}
+	}
+
+	return dvb_usbv2_probe(intf, id);
+}
+
 /* interface 0 is used by DVB-T receiver and
    interface 1 is for remote controller (HID) */
 static struct dvb_usb_device_properties af9015_props = {
@@ -1425,6 +1462,7 @@ static const struct usb_device_id af9015_id_table[] = {
 		&af9015_props, "AverMedia AVerTV Volar M (A815Mac)", NULL) },
 	{ DVB_USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_STICK_RC,
 		&af9015_props, "TerraTec Cinergy T Stick RC", RC_MAP_TERRATEC_SLIM_2) },
+	/* XXX: that same ID [0ccd:0099] is used by af9035 driver too */
 	{ DVB_USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_STICK_DUAL_RC,
 		&af9015_props, "TerraTec Cinergy T Stick Dual RC", RC_MAP_TERRATEC_SLIM) },
 	{ DVB_USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_A850T,
@@ -1441,7 +1479,7 @@ MODULE_DEVICE_TABLE(usb, af9015_id_table);
 static struct usb_driver af9015_usb_driver = {
 	.name = KBUILD_MODNAME,
 	.id_table = af9015_id_table,
-	.probe = dvb_usbv2_probe,
+	.probe = af9015_probe,
 	.disconnect = dvb_usbv2_disconnect,
 	.suspend = dvb_usbv2_suspend,
 	.resume = dvb_usbv2_resume,
Signature · 1 line
1.7.11.7
#6 lore raw

PATCH 7/41 af9035: [0ccd:0099] TerraTec Cinergy T Stick Dual RC (rev. 2)

In reply to Antti Palosaari

That same USB ID is used both AF9015 and AF9035 driver. iManufacturer is only thing we can select correct driver without a I/O.

---
 drivers/media/usb/dvb-usb-v2/af9035.c | 42 ++++++++++++++++++++++++++++++++++-
 1 file changed, 41 insertions(+), 1 deletion(-)
drivers/media/usb/dvb-usb-v2/af9035.c +41 -1
index cc05f59..1e1cee6 100644
@@ -1328,6 +1328,43 @@ err:
 	#define af9035_get_rc_config NULL
 #endif
 
+static int af9035_probe(struct usb_interface *intf,
+		const struct usb_device_id *id)
+{
+	struct usb_device *udev = interface_to_usbdev(intf);
+	char manufacturer[sizeof("Afatech")];
+
+	memset(manufacturer, 0, sizeof(manufacturer));
+	usb_string(udev, udev->descriptor.iManufacturer,
+			manufacturer, sizeof(manufacturer));
+	/*
+	 * There is two devices having same ID but different chipset. One uses
+	 * AF9015 and the other IT9135 chipset. Only difference seen on lsusb
+	 * is iManufacturer string.
+	 *
+	 * idVendor           0x0ccd TerraTec Electronic GmbH
+	 * idProduct          0x0099
+	 * bcdDevice            2.00
+	 * iManufacturer           1 Afatech
+	 * iProduct                2 DVB-T 2
+	 *
+	 * idVendor           0x0ccd TerraTec Electronic GmbH
+	 * idProduct          0x0099
+	 * bcdDevice            2.00
+	 * iManufacturer           1 ITE Technologies, Inc.
+	 * iProduct                2 DVB-T TV Stick
+	 */
+	if ((le16_to_cpu(udev->descriptor.idVendor) == USB_VID_TERRATEC) &&
+			(le16_to_cpu(udev->descriptor.idProduct) == 0x0099)) {
+		if (!strcmp("Afatech", manufacturer)) {
+			dev_dbg(&udev->dev, "%s: rejecting device\n", __func__);
+			return -ENODEV;
+		}
+	}
+
+	return dvb_usbv2_probe(intf, id);
+}
+
 /* interface 0 is used by DVB-T receiver and
    interface 1 is for remote controller (HID) */
 static const struct dvb_usb_device_properties af9035_props = {
@@ -1384,6 +1421,9 @@ static const struct usb_device_id af9035_id_table[] = {
 		&af9035_props, "AVerMedia Twinstar (A825)", NULL) },
 	{ DVB_USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3100MINI_PLUS,
 		&af9035_props, "Asus U3100Mini Plus", NULL) },
+	/* XXX: that same ID [0ccd:0099] is used by af9015 driver too */
+	{ DVB_USB_DEVICE(USB_VID_TERRATEC, 0x0099,
+		&af9035_props, "TerraTec Cinergy T Stick Dual RC (rev. 2)", NULL) },
 	{ }
 };
 MODULE_DEVICE_TABLE(usb, af9035_id_table);
@@ -1391,7 +1431,7 @@ MODULE_DEVICE_TABLE(usb, af9035_id_table);
 static struct usb_driver af9035_usb_driver = {
 	.name = KBUILD_MODNAME,
 	.id_table = af9035_id_table,
-	.probe = dvb_usbv2_probe,
+	.probe = af9035_probe,
 	.disconnect = dvb_usbv2_disconnect,
 	.suspend = dvb_usbv2_suspend,
 	.resume = dvb_usbv2_resume,
Signature · 1 line
1.7.11.7
#7 lore raw

PATCH 8/41 af9035: constify clock tables

In reply to Antti Palosaari
---
 drivers/media/usb/dvb-usb-v2/af9035.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/usb/dvb-usb-v2/af9035.h +2 -2
index f995339..7086ff2 100644
@@ -61,7 +61,7 @@ struct state {
 	struct af9033_config af9033_config[2];
 };
 
-u32 clock_lut[] = {
+static const u32 clock_lut[] = {
 	20480000, /*      FPGA */
 	16384000, /* 16.38 MHz */
 	20480000, /* 20.48 MHz */
@@ -76,7 +76,7 @@ u32 clock_lut[] = {
 	12000000, /* 12.00 MHz */
 };
 
-u32 clock_lut_it9135[] = {
+static const u32 clock_lut_it9135[] = {
 	12000000, /* 12.00 MHz */
 	20480000, /* 20.48 MHz */
 	36000000, /* 36.00 MHz */
Signature · 1 line
1.7.11.7
#8 lore raw

PATCH 9/41 af9035: USB1.1 support (== PID filters)

In reply to Antti Palosaari
---
 drivers/media/usb/dvb-usb-v2/af9035.c | 85 +++++++++++++++++++++++++++++++++--
 1 file changed, 82 insertions(+), 3 deletions(-)
drivers/media/usb/dvb-usb-v2/af9035.c +82 -3
index 1e1cee6..42ed0f7 100644
@@ -894,7 +894,12 @@ static int af9035_frontend_callback(void *adapter_priv, int component,
 static int af9035_get_adapter_count(struct dvb_usb_device *d)
 {
 	struct state *state = d_to_priv(d);
-	return state->dual_mode + 1;
+
+	/* disable 2nd adapter as we don't have PID filters implemented */
+	if (d->udev->speed == USB_SPEED_FULL)
+		return 1;
+	else
+		return state->dual_mode + 1;
 }
 
 static int af9035_frontend_attach(struct dvb_usb_adapter *adap)
@@ -1201,8 +1206,8 @@ static int af9035_init(struct dvb_usb_device *d)
 {
 	struct state *state = d_to_priv(d);
 	int ret, i;
-	u16 frame_size = 87 * 188 / 4;
-	u8  packet_size = 512 / 4;
+	u16 frame_size = (d->udev->speed == USB_SPEED_FULL ? 5 : 87) * 188 / 4;
+	u8 packet_size = (d->udev->speed == USB_SPEED_FULL ? 64 : 512) / 4;
 	struct reg_val_mask tab[] = {
 		{ 0x80f99d, 0x01, 0x01 },
 		{ 0x80f9a4, 0x01, 0x01 },
@@ -1328,6 +1333,72 @@ err:
 	#define af9035_get_rc_config NULL
 #endif
 
+static int af9035_get_stream_config(struct dvb_frontend *fe, u8 *ts_type,
+		struct usb_data_stream_properties *stream)
+{
+	struct dvb_usb_device *d = fe_to_d(fe);
+	dev_dbg(&d->udev->dev, "%s: adap=%d\n", __func__, fe_to_adap(fe)->id);
+
+	if (d->udev->speed == USB_SPEED_FULL)
+		stream->u.bulk.buffersize = 5 * 188;
+
+	return 0;
+}
+
+/*
+ * FIXME: PID filter is property of demodulator and should be moved to the
+ * correct driver. Also we support only adapter #0 PID filter and will
+ * disable adapter #1 if USB1.1 is used.
+ */
+static int af9035_pid_filter_ctrl(struct dvb_usb_adapter *adap, int onoff)
+{
+	struct dvb_usb_device *d = adap_to_d(adap);
+	int ret;
+
+	dev_dbg(&d->udev->dev, "%s: onoff=%d\n", __func__, onoff);
+
+	ret = af9035_wr_reg_mask(d, 0x80f993, onoff, 0x01);
+	if (ret < 0)
+		goto err;
+
+	return 0;
+
+err:
+	dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
+
+	return ret;
+}
+
+static int af9035_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid,
+		int onoff)
+{
+	struct dvb_usb_device *d = adap_to_d(adap);
+	int ret;
+	u8 wbuf[2] = {(pid >> 0) & 0xff, (pid >> 8) & 0xff};
+
+	dev_dbg(&d->udev->dev, "%s: index=%d pid=%04x onoff=%d\n",
+			__func__, index, pid, onoff);
+
+	ret = af9035_wr_regs(d, 0x80f996, wbuf, 2);
+	if (ret < 0)
+		goto err;
+
+	ret = af9035_wr_reg(d, 0x80f994, onoff);
+	if (ret < 0)
+		goto err;
+
+	ret = af9035_wr_reg(d, 0x80f995, index);
+	if (ret < 0)
+		goto err;
+
+	return 0;
+
+err:
+	dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
+
+	return ret;
+}
+
 static int af9035_probe(struct usb_interface *intf,
 		const struct usb_device_id *id)
 {
@@ -1385,10 +1456,18 @@ static const struct dvb_usb_device_properties af9035_props = {
 	.tuner_attach = af9035_tuner_attach,
 	.init = af9035_init,
 	.get_rc_config = af9035_get_rc_config,
+	.get_stream_config = af9035_get_stream_config,
 
 	.get_adapter_count = af9035_get_adapter_count,
 	.adapter = {
 		{
+			.caps = DVB_USB_ADAP_HAS_PID_FILTER |
+				DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
+
+			.pid_filter_count = 32,
+			.pid_filter_ctrl = af9035_pid_filter_ctrl,
+			.pid_filter = af9035_pid_filter,
+
 			.stream = DVB_USB_STREAM_BULK(0x84, 6, 87 * 188),
 		}, {
 			.stream = DVB_USB_STREAM_BULK(0x85, 6, 87 * 188),
Signature · 1 line
1.7.11.7
#9 lore raw

PATCH 10/41 af9035: merge af9035 and it9135 eeprom read routines

In reply to Antti Palosaari
---
 drivers/media/usb/dvb-usb-v2/af9035.c | 139 ++++++++++++++--------------------
 drivers/media/usb/dvb-usb-v2/af9035.h |  27 ++++---
 2 files changed, 73 insertions(+), 93 deletions(-)
drivers/media/usb/dvb-usb-v2/af9035.c +58 -81
index 42ed0f7..a1e953a 100644
@@ -362,7 +362,7 @@ static int af9035_download_firmware_af9035(struct dvb_usb_device *d,
 	 * which is done by master demod.
 	 * Master feeds also clock and controls power via GPIO.
 	 */
-	ret = af9035_rd_reg(d, EEPROM_DUAL_MODE, &tmp);
+	ret = af9035_rd_reg(d, EEPROM_BASE_AF9035 + EEPROM_DUAL_MODE, &tmp);
 	if (ret < 0)
 		goto err;
 
@@ -387,7 +387,9 @@ static int af9035_download_firmware_af9035(struct dvb_usb_device *d,
 			goto err;
 
 		/* tell the slave I2C address */
-		ret = af9035_rd_reg(d, EEPROM_2ND_DEMOD_ADDR, &tmp);
+		ret = af9035_rd_reg(d,
+				EEPROM_BASE_AF9035 + EEPROM_2ND_DEMOD_ADDR,
+				&tmp);
 		if (ret < 0)
 			goto err;
 
@@ -580,19 +582,39 @@ static int af9035_download_firmware(struct dvb_usb_device *d,
 		return af9035_download_firmware_af9035(d, fw);
 }
 
-static int af9035_read_config_af9035(struct dvb_usb_device *d)
+static int af9035_read_config(struct dvb_usb_device *d)
 {
 	struct state *state = d_to_priv(d);
-	int ret, i, eeprom_shift = 0;
+	int ret, i;
 	u8 tmp;
-	u16 tmp16;
+	u16 tmp16, addr;
 
 	/* demod I2C "address" */
 	state->af9033_config[0].i2c_addr = 0x38;
 	state->af9033_config[0].adc_multiplier = AF9033_ADC_MULTIPLIER_2X;
 
+	/* eeprom memory mapped location */
+	if (state->chip_type == 0x9135) {
+		/* check if eeprom exists */
+		if (state->chip_version == 2)
+			ret = af9035_rd_reg(d, 0x00461d, &tmp);
+		else
+			ret = af9035_rd_reg(d, 0x00461b, &tmp);
+		if (ret < 0)
+			goto err;
+
+		if (tmp) {
+			addr = EEPROM_BASE_IT9135;
+		} else {
+			state->af9033_config[0].tuner = AF9033_TUNER_IT9135_38;
+			goto skip_eeprom;
+		}
+	} else {
+		addr = EEPROM_BASE_AF9035;
+	}
+
 	/* check if there is dual tuners */
-	ret = af9035_rd_reg(d, EEPROM_DUAL_MODE, &tmp);
+	ret = af9035_rd_reg(d, addr + EEPROM_DUAL_MODE, &tmp);
 	if (ret < 0)
 		goto err;
 
@@ -602,7 +624,7 @@ static int af9035_read_config_af9035(struct dvb_usb_device *d)
 
 	if (state->dual_mode) {
 		/* read 2nd demodulator I2C address */
-		ret = af9035_rd_reg(d, EEPROM_2ND_DEMOD_ADDR, &tmp);
+		ret = af9035_rd_reg(d, addr + EEPROM_2ND_DEMOD_ADDR, &tmp);
 		if (ret < 0)
 			goto err;
 
@@ -613,7 +635,7 @@ static int af9035_read_config_af9035(struct dvb_usb_device *d)
 
 	for (i = 0; i < state->dual_mode + 1; i++) {
 		/* tuner */
-		ret = af9035_rd_reg(d, EEPROM_1_TUNER_ID + eeprom_shift, &tmp);
+		ret = af9035_rd_reg(d, addr + EEPROM_1_TUNER_ID, &tmp);
 		if (ret < 0)
 			goto err;
 
@@ -621,7 +643,10 @@ static int af9035_read_config_af9035(struct dvb_usb_device *d)
 		dev_dbg(&d->udev->dev, "%s: [%d]tuner=%02x\n",
 				__func__, i, tmp);
 
-		switch (tmp) {
+		if (state->chip_type == 0x9135 && tmp == 0x00)
+			state->af9033_config[i].tuner = AF9033_TUNER_IT9135_38;
+
+		switch (state->af9033_config[i].tuner) {
 		case AF9033_TUNER_TUA9001:
 		case AF9033_TUNER_FC0011:
 		case AF9033_TUNER_MXL5007T:
@@ -630,9 +655,16 @@ static int af9035_read_config_af9035(struct dvb_usb_device *d)
 		case AF9033_TUNER_FC0012:
 			state->af9033_config[i].spec_inv = 1;
 			break;
+		case AF9033_TUNER_IT9135_38:
+		case AF9033_TUNER_IT9135_51:
+		case AF9033_TUNER_IT9135_52:
+		case AF9033_TUNER_IT9135_60:
+		case AF9033_TUNER_IT9135_61:
+		case AF9033_TUNER_IT9135_62:
+			break;
 		default:
-			dev_warn(&d->udev->dev, "%s: tuner id=%02x not " \
-					"supported, please report!",
+			dev_warn(&d->udev->dev,
+					"%s: tuner id=%02x not supported, please report!",
 					KBUILD_MODNAME, tmp);
 		}
 
@@ -643,19 +675,19 @@ static int af9035_read_config_af9035(struct dvb_usb_device *d)
 				break;
 			default:
 				state->dual_mode = false;
-				dev_info(&d->udev->dev, "%s: driver does not " \
-						"support 2nd tuner and will " \
-						"disable it", KBUILD_MODNAME);
+				dev_info(&d->udev->dev,
+						"%s: driver does not support 2nd tuner and will disable it",
+						KBUILD_MODNAME);
 		}
 
 		/* tuner IF frequency */
-		ret = af9035_rd_reg(d, EEPROM_1_IFFREQ_L + eeprom_shift, &tmp);
+		ret = af9035_rd_reg(d, addr + EEPROM_1_IF_L, &tmp);
 		if (ret < 0)
 			goto err;
 
 		tmp16 = tmp;
 
-		ret = af9035_rd_reg(d, EEPROM_1_IFFREQ_H + eeprom_shift, &tmp);
+		ret = af9035_rd_reg(d, addr + EEPROM_1_IF_H, &tmp);
 		if (ret < 0)
 			goto err;
 
@@ -663,9 +695,10 @@ static int af9035_read_config_af9035(struct dvb_usb_device *d)
 
 		dev_dbg(&d->udev->dev, "%s: [%d]IF=%d\n", __func__, i, tmp16);
 
-		eeprom_shift = 0x10; /* shift for the 2nd tuner params */
+		addr += 0x10; /* shift for the 2nd tuner params */
 	}
 
+skip_eeprom:
 	/* get demod clock */
 	ret = af9035_rd_reg(d, 0x00d800, &tmp);
 	if (ret < 0)
@@ -673,60 +706,13 @@ static int af9035_read_config_af9035(struct dvb_usb_device *d)
 
 	tmp = (tmp >> 0) & 0x0f;
 
-	for (i = 0; i < ARRAY_SIZE(state->af9033_config); i++)
-		state->af9033_config[i].clock = clock_lut[tmp];
-
-	return 0;
-
-err:
-	dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
-
-	return ret;
-}
-
-static int af9035_read_config_it9135(struct dvb_usb_device *d)
-{
-	struct state *state = d_to_priv(d);
-	int ret, i;
-	u8 tmp;
-
-	/* demod I2C "address" */
-	state->af9033_config[0].i2c_addr = 0x38;
-	state->af9033_config[0].tuner = AF9033_TUNER_IT9135_38;
-	state->af9033_config[0].adc_multiplier = AF9033_ADC_MULTIPLIER_2X;
-	state->dual_mode = false;
-
-	/* check if eeprom exists */
-	if (state->chip_version == 2)
-		ret = af9035_rd_reg(d, 0x00461d, &tmp);
-	else
-		ret = af9035_rd_reg(d, 0x00461b, &tmp);
-	if (ret < 0)
-		goto err;
-
-	if (tmp) {
-		/* tuner */
-		ret = af9035_rd_reg(d, 0x0049d0, &tmp);
-		if (ret < 0)
-			goto err;
-
-		dev_dbg(&d->udev->dev, "%s: [%d]tuner=%02x\n",
-				__func__, 0, tmp);
-
-		if (tmp)
-			state->af9033_config[0].tuner = tmp;
+	for (i = 0; i < ARRAY_SIZE(state->af9033_config); i++) {
+		if (state->chip_type == 0x9135)
+			state->af9033_config[i].clock = clock_lut_it9135[tmp];
+		else
+			state->af9033_config[i].clock = clock_lut_af9035[tmp];
 	}
 
-	/* get demod clock */
-	ret = af9035_rd_reg(d, 0x00d800, &tmp);
-	if (ret < 0)
-		goto err;
-
-	tmp = (tmp >> 0) & 0x0f;
-
-	for (i = 0; i < ARRAY_SIZE(state->af9033_config); i++)
-		state->af9033_config[i].clock = clock_lut_it9135[tmp];
-
 	return 0;
 
 err:
@@ -735,16 +721,6 @@ err:
 	return ret;
 }
 
-static int af9035_read_config(struct dvb_usb_device *d)
-{
-	struct state *state = d_to_priv(d);
-
-	if (state->chip_type == 0x9135)
-		return af9035_read_config_it9135(d);
-	else
-		return af9035_read_config_af9035(d);
-}
-
 static int af9035_tua9001_tuner_callback(struct dvb_usb_device *d,
 		int cmd, int arg)
 {
@@ -1290,7 +1266,7 @@ static int af9035_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc)
 	if (state->chip_type == 0x9135)
 		return 0;
 
-	ret = af9035_rd_reg(d, EEPROM_IR_MODE, &tmp);
+	ret = af9035_rd_reg(d, EEPROM_BASE_AF9035 + EEPROM_IR_MODE, &tmp);
 	if (ret < 0)
 		goto err;
 
@@ -1298,7 +1274,8 @@ static int af9035_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc)
 
 	/* don't activate rc if in HID mode or if not available */
 	if (tmp == 5) {
-		ret = af9035_rd_reg(d, EEPROM_IR_TYPE, &tmp);
+		ret = af9035_rd_reg(d, EEPROM_BASE_AF9035 + EEPROM_IR_TYPE,
+				&tmp);
 		if (ret < 0)
 			goto err;
 
drivers/media/usb/dvb-usb-v2/af9035.h +15 -12
index 7086ff2..4d918ee 100644
@@ -61,7 +61,7 @@ struct state {
 	struct af9033_config af9033_config[2];
 };
 
-static const u32 clock_lut[] = {
+static const u32 clock_lut_af9035[] = {
 	20480000, /*      FPGA */
 	16384000, /* 16.38 MHz */
 	20480000, /* 20.48 MHz */
@@ -93,17 +93,20 @@ static const u32 clock_lut_it9135[] = {
 #define AF9035_FIRMWARE_IT9135_V1 "dvb-usb-it9135-01.fw"
 #define AF9035_FIRMWARE_IT9135_V2 "dvb-usb-it9135-02.fw"
 
-/* EEPROM locations */
-#define EEPROM_IR_MODE            0x430d
-#define EEPROM_DUAL_MODE          0x4326
-#define EEPROM_2ND_DEMOD_ADDR     0x4327
-#define EEPROM_IR_TYPE            0x4329
-#define EEPROM_1_IFFREQ_L         0x432d
-#define EEPROM_1_IFFREQ_H         0x432e
-#define EEPROM_1_TUNER_ID         0x4331
-#define EEPROM_2_IFFREQ_L         0x433d
-#define EEPROM_2_IFFREQ_H         0x433e
-#define EEPROM_2_TUNER_ID         0x4341
+#define EEPROM_BASE_AF9035        0x42fd
+#define EEPROM_BASE_IT9135        0x499c
+#define EEPROM_SHIFT                0x10
+
+#define EEPROM_IR_MODE              0x10
+#define EEPROM_DUAL_MODE            0x29
+#define EEPROM_2ND_DEMOD_ADDR       0x2a
+#define EEPROM_IR_TYPE              0x2c
+#define EEPROM_1_IF_L               0x30
+#define EEPROM_1_IF_H               0x31
+#define EEPROM_1_TUNER_ID           0x34
+#define EEPROM_2_IF_L               0x40
+#define EEPROM_2_IF_H               0x41
+#define EEPROM_2_TUNER_ID           0x44
 
 /* USB commands */
 #define CMD_MEM_RD                  0x00
Signature · 1 line
1.7.11.7
#10 lore raw

PATCH 11/41 af9035: basic support for IT9135 v2 chips

In reply to Antti Palosaari
---
 drivers/media/usb/dvb-usb-v2/af9035.c | 44 ++++++++++++++++++++++++-----------
 1 file changed, 31 insertions(+), 13 deletions(-)
drivers/media/usb/dvb-usb-v2/af9035.c +31 -13
index a1e953a..0b92277 100644
@@ -316,7 +316,7 @@ static int af9035_identify_state(struct dvb_usb_device *d, const char **name)
 			state->chip_type);
 
 	if (state->chip_type == 0x9135) {
-		if (state->chip_version == 2)
+		if (state->chip_version == 0x02)
 			*name = AF9035_FIRMWARE_IT9135_V2;
 		else
 			*name = AF9035_FIRMWARE_IT9135_V1;
@@ -595,18 +595,23 @@ static int af9035_read_config(struct dvb_usb_device *d)
 
 	/* eeprom memory mapped location */
 	if (state->chip_type == 0x9135) {
+		if (state->chip_version == 0x02) {
+			state->af9033_config[0].tuner = AF9033_TUNER_IT9135_60;
+			tmp16 = 0x00461d;
+		} else {
+			state->af9033_config[0].tuner = AF9033_TUNER_IT9135_38;
+			tmp16 = 0x00461b;
+		}
+
 		/* check if eeprom exists */
-		if (state->chip_version == 2)
-			ret = af9035_rd_reg(d, 0x00461d, &tmp);
-		else
-			ret = af9035_rd_reg(d, 0x00461b, &tmp);
+		ret = af9035_rd_reg(d, tmp16, &tmp);
 		if (ret < 0)
 			goto err;
 
 		if (tmp) {
 			addr = EEPROM_BASE_IT9135;
 		} else {
-			state->af9033_config[0].tuner = AF9033_TUNER_IT9135_38;
+			dev_dbg(&d->udev->dev, "%s: no eeprom\n", __func__);
 			goto skip_eeprom;
 		}
 	} else {
@@ -639,12 +644,15 @@ static int af9035_read_config(struct dvb_usb_device *d)
 		if (ret < 0)
 			goto err;
 
-		state->af9033_config[i].tuner = tmp;
-		dev_dbg(&d->udev->dev, "%s: [%d]tuner=%02x\n",
-				__func__, i, tmp);
+		if (tmp == 0x00)
+			dev_dbg(&d->udev->dev,
+					"%s: [%d]tuner not set, using default\n",
+					__func__, i);
+		else
+			state->af9033_config[i].tuner = tmp;
 
-		if (state->chip_type == 0x9135 && tmp == 0x00)
-			state->af9033_config[i].tuner = AF9033_TUNER_IT9135_38;
+		dev_dbg(&d->udev->dev, "%s: [%d]tuner=%02x\n",
+				__func__, i, state->af9033_config[i].tuner);
 
 		switch (state->af9033_config[i].tuner) {
 		case AF9033_TUNER_TUA9001:
@@ -975,12 +983,12 @@ static const struct fc0012_config af9035_fc0012_config[] = {
 };
 
 static struct ite_config af9035_it913x_config = {
-	.chip_ver = 0x01,
+	.chip_ver = 0x02,
 	.chip_type = 0x9135,
 	.firmware = 0x00000000,
 	.firmware_ver = 1,
 	.adc_x2 = 1,
-	.tuner_id_0 = AF9033_TUNER_IT9135_38,
+	.tuner_id_0 = 0x00,
 	.tuner_id_1 = 0x00,
 	.dual_mode = 0x00,
 	.adf = 0x00,
@@ -1153,6 +1161,7 @@ static int af9035_tuner_attach(struct dvb_usb_adapter *adap)
 	case AF9033_TUNER_IT9135_38:
 	case AF9033_TUNER_IT9135_51:
 	case AF9033_TUNER_IT9135_52:
+		af9035_it913x_config.chip_ver = 0x01;
 	case AF9033_TUNER_IT9135_60:
 	case AF9033_TUNER_IT9135_61:
 	case AF9033_TUNER_IT9135_62:
@@ -1453,6 +1462,7 @@ static const struct dvb_usb_device_properties af9035_props = {
 };
 
 static const struct usb_device_id af9035_id_table[] = {
+	/* AF9035 devices */
 	{ DVB_USB_DEVICE(USB_VID_AFATECH, USB_PID_AFATECH_AF9035_9035,
 		&af9035_props, "Afatech AF9035 reference design", NULL) },
 	{ DVB_USB_DEVICE(USB_VID_AFATECH, USB_PID_AFATECH_AF9035_1000,
@@ -1477,6 +1487,14 @@ static const struct usb_device_id af9035_id_table[] = {
 		&af9035_props, "AVerMedia Twinstar (A825)", NULL) },
 	{ DVB_USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3100MINI_PLUS,
 		&af9035_props, "Asus U3100Mini Plus", NULL) },
+
+	/* IT9135 devices */
+#if 0
+	{ DVB_USB_DEVICE(0x048d, 0x9135,
+		&af9035_props, "IT9135 reference design", NULL) },
+	{ DVB_USB_DEVICE(0x048d, 0x9006,
+		&af9035_props, "IT9135 reference design", NULL) },
+#endif
 	/* XXX: that same ID [0ccd:0099] is used by af9015 driver too */
 	{ DVB_USB_DEVICE(USB_VID_TERRATEC, 0x0099,
 		&af9035_props, "TerraTec Cinergy T Stick Dual RC (rev. 2)", NULL) },
Signature · 1 line
1.7.11.7
#11 lore raw

Re: [REVIEW PATCH 11/41] af9035: basic support for IT9135 v2 chips

Em Sun, 10 Mar 2013 04:03:03 +0200
Antti Palosaari <[email protected]> escreveu:

Quoted 84 lines
---
 drivers/media/usb/dvb-usb-v2/af9035.c | 44 ++++++++++++++++++++++++-----------
 1 file changed, 31 insertions(+), 13 deletions(-)
drivers/media/usb/dvb-usb-v2/af9035.c +21 -13
index a1e953a..0b92277 100644
@@ -316,7 +316,7 @@ static int af9035_identify_state(struct dvb_usb_device *d, const char **name)
 			state->chip_type);
 
 	if (state->chip_type == 0x9135) {
-		if (state->chip_version == 2)
+		if (state->chip_version == 0x02)
 			*name = AF9035_FIRMWARE_IT9135_V2;
 		else
 			*name = AF9035_FIRMWARE_IT9135_V1;
@@ -595,18 +595,23 @@ static int af9035_read_config(struct dvb_usb_device *d)
 
 	/* eeprom memory mapped location */
 	if (state->chip_type == 0x9135) {
+		if (state->chip_version == 0x02) {
+			state->af9033_config[0].tuner = AF9033_TUNER_IT9135_60;
+			tmp16 = 0x00461d;
+		} else {
+			state->af9033_config[0].tuner = AF9033_TUNER_IT9135_38;
+			tmp16 = 0x00461b;
+		}
+
 		/* check if eeprom exists */
-		if (state->chip_version == 2)
-			ret = af9035_rd_reg(d, 0x00461d, &tmp);
-		else
-			ret = af9035_rd_reg(d, 0x00461b, &tmp);
+		ret = af9035_rd_reg(d, tmp16, &tmp);
 		if (ret < 0)
 			goto err;
 
 		if (tmp) {
 			addr = EEPROM_BASE_IT9135;
 		} else {
-			state->af9033_config[0].tuner = AF9033_TUNER_IT9135_38;
+			dev_dbg(&d->udev->dev, "%s: no eeprom\n", __func__);
 			goto skip_eeprom;
 		}
 	} else {
@@ -639,12 +644,15 @@ static int af9035_read_config(struct dvb_usb_device *d)
 		if (ret < 0)
 			goto err;
 
-		state->af9033_config[i].tuner = tmp;
-		dev_dbg(&d->udev->dev, "%s: [%d]tuner=%02x\n",
-				__func__, i, tmp);
+		if (tmp == 0x00)
+			dev_dbg(&d->udev->dev,
+					"%s: [%d]tuner not set, using default\n",
+					__func__, i);
+		else
+			state->af9033_config[i].tuner = tmp;
 
-		if (state->chip_type == 0x9135 && tmp == 0x00)
-			state->af9033_config[i].tuner = AF9033_TUNER_IT9135_38;
+		dev_dbg(&d->udev->dev, "%s: [%d]tuner=%02x\n",
+				__func__, i, state->af9033_config[i].tuner);
 
 		switch (state->af9033_config[i].tuner) {
 		case AF9033_TUNER_TUA9001:
@@ -975,12 +983,12 @@ static const struct fc0012_config af9035_fc0012_config[] = {
 };
 
 static struct ite_config af9035_it913x_config = {
-	.chip_ver = 0x01,
+	.chip_ver = 0x02,
 	.chip_type = 0x9135,
 	.firmware = 0x00000000,
 	.firmware_ver = 1,
 	.adc_x2 = 1,
-	.tuner_id_0 = AF9033_TUNER_IT9135_38,
+	.tuner_id_0 = 0x00,
 	.tuner_id_1 = 0x00,
 	.dual_mode = 0x00,
 	.adf = 0x00,

drivers/media/usb/dvb-usb-v2/af9035.c static int af9035_tuner_attach(struct dvb_usb_adapter *adap) · line 1164

Quoted 4 lines
drivers/media/usb/dvb-usb-v2/af9035.c +1 -0
@@ -1153,6 +1161,7 @@ static int af9035_tuner_attach(struct dvb_usb_adapter *adap)
 	case AF9033_TUNER_IT9135_38:
 	case AF9033_TUNER_IT9135_51:
 	case AF9033_TUNER_IT9135_52:
+		af9035_it913x_config.chip_ver = 0x01;

Hmmm... aren't you missing a break here? If not, please add a comment, as otherwise reviewers think that this is a bug.

Quoted 26 lines
drivers/media/usb/dvb-usb-v2/af9035.c +9 -0
 	case AF9033_TUNER_IT9135_60:
 	case AF9033_TUNER_IT9135_61:
 	case AF9033_TUNER_IT9135_62:
@@ -1453,6 +1462,7 @@ static const struct dvb_usb_device_properties af9035_props = {
 };
 
 static const struct usb_device_id af9035_id_table[] = {
+	/* AF9035 devices */
 	{ DVB_USB_DEVICE(USB_VID_AFATECH, USB_PID_AFATECH_AF9035_9035,
 		&af9035_props, "Afatech AF9035 reference design", NULL) },
 	{ DVB_USB_DEVICE(USB_VID_AFATECH, USB_PID_AFATECH_AF9035_1000,
@@ -1477,6 +1487,14 @@ static const struct usb_device_id af9035_id_table[] = {
 		&af9035_props, "AVerMedia Twinstar (A825)", NULL) },
 	{ DVB_USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3100MINI_PLUS,
 		&af9035_props, "Asus U3100Mini Plus", NULL) },
+
+	/* IT9135 devices */
+#if 0
+	{ DVB_USB_DEVICE(0x048d, 0x9135,
+		&af9035_props, "IT9135 reference design", NULL) },
+	{ DVB_USB_DEVICE(0x048d, 0x9006,
+		&af9035_props, "IT9135 reference design", NULL) },
+#endif
 	/* XXX: that same ID [0ccd:0099] is used by af9015 driver too */
 	{ DVB_USB_DEVICE(USB_VID_TERRATEC, 0x0099,
 		&af9035_props, "TerraTec Cinergy T Stick Dual RC (rev. 2)", NULL) },
Signature · 2 lines
Cheers,
Mauro
#12 lore raw

Re: [REVIEW PATCH 11/41] af9035: basic support for IT9135 v2 chips

Quoted 6 lines · Mauro Carvalho Chehab

Em Sun, 10 Mar 2013 04:03:03 +0200
Antti Palosaari <[email protected]> escreveu:

Quoted 3 lines
  static struct ite_config af9035_it913x_config = {
drivers/media/usb/dvb-usb-v2/af9035.c +1 -1
-	.chip_ver = 0x01,
+	.chip_ver = 0x02,
Quoted 8 lines

drivers/media/usb/dvb-usb-v2/af9035.c static int af9035_tuner_attach(struct dvb_usb_adapter *adap) · line 1164

Quoted 5 lines
drivers/media/usb/dvb-usb-v2/af9035.c +1 -0
@@ -1153,6 +1161,7 @@ static int af9035_tuner_attach(struct dvb_usb_adapter *adap)
  	case AF9033_TUNER_IT9135_38:
  	case AF9033_TUNER_IT9135_51:
  	case AF9033_TUNER_IT9135_52:
+		af9035_it913x_config.chip_ver = 0x01;

Hmmm... aren't you missing a break here? If not, please add a comment, as otherwise reviewers think that this is a bug.

It is correct as it was set 0x02 by init. And variable was removed totally few patches later.

regards
Antti

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

Re: [REVIEW PATCH 11/41] af9035: basic support for IT9135 v2 chips

Em Fri, 22 Mar 2013 01:45:30 +0200
Antti Palosaari <[email protected]> escreveu:

Quoted 16 lines · Mauro Carvalho Chehab
Quoted 6 lines

Em Sun, 10 Mar 2013 04:03:03 +0200
Antti Palosaari <[email protected]> escreveu:

Quoted 3 lines
  static struct ite_config af9035_it913x_config = {
drivers/media/usb/dvb-usb-v2/af9035.c +1 -1
-	.chip_ver = 0x01,
+	.chip_ver = 0x02,
Quoted 8 lines

drivers/media/usb/dvb-usb-v2/af9035.c static int af9035_tuner_attach(struct dvb_usb_adapter *adap) · line 1164

Quoted 5 lines
drivers/media/usb/dvb-usb-v2/af9035.c +1 -0
@@ -1153,6 +1161,7 @@ static int af9035_tuner_attach(struct dvb_usb_adapter *adap)
  	case AF9033_TUNER_IT9135_38:
  	case AF9033_TUNER_IT9135_51:
  	case AF9033_TUNER_IT9135_52:
+		af9035_it913x_config.chip_ver = 0x01;

Hmmm... aren't you missing a break here? If not, please add a comment, as otherwise reviewers think that this is a bug.

Quoted 2 lines

It is correct as it was set 0x02 by init. And variable was removed totally few patches later.

Ok, so please send a patch latter adding a notice about that, like:
case AF9033_TUNER_IT9135_52:

		af9035_it913x_config.chip_ver = 0x01;
		/* fall trough */
	case ...

This is a very common practice at the Kernel, as it helps to better document it.

Also I'm pretty sure some janitor would otherwise send us sooner or later a patch adding a break there.

Regards,
Mauro

#14 lore raw

Re: [REVIEW PATCH 11/41] af9035: basic support for IT9135 v2 chips

Quoted 28 lines · Mauro Carvalho Chehab

Em Fri, 22 Mar 2013 01:45:30 +0200
Antti Palosaari <[email protected]> escreveu:

Quoted 16 lines · Mauro Carvalho Chehab
Quoted 6 lines

Em Sun, 10 Mar 2013 04:03:03 +0200
Antti Palosaari <[email protected]> escreveu:

Quoted 3 lines
   static struct ite_config af9035_it913x_config = {
drivers/media/usb/dvb-usb-v2/af9035.c +1 -1
-	.chip_ver = 0x01,
+	.chip_ver = 0x02,
Quoted 8 lines

drivers/media/usb/dvb-usb-v2/af9035.c static int af9035_tuner_attach(struct dvb_usb_adapter *adap) · line 1164

Quoted 5 lines
drivers/media/usb/dvb-usb-v2/af9035.c +1 -0
@@ -1153,6 +1161,7 @@ static int af9035_tuner_attach(struct dvb_usb_adapter *adap)
   	case AF9033_TUNER_IT9135_38:
   	case AF9033_TUNER_IT9135_51:
   	case AF9033_TUNER_IT9135_52:
+		af9035_it913x_config.chip_ver = 0x01;

Hmmm... aren't you missing a break here? If not, please add a comment, as otherwise reviewers think that this is a bug.

Quoted 2 lines

It is correct as it was set 0x02 by init. And variable was removed totally few patches later.

Ok, so please send a patch latter adding a notice about that, like:

   	case AF9033_TUNER_IT9135_52:
		af9035_it913x_config.chip_ver = 0x01;
		/* fall trough */
	case ...
Quoted 5 lines

This is a very common practice at the Kernel, as it helps to better document it.

Also I'm pretty sure some janitor would otherwise send us sooner or later a patch adding a break there.

I totally agree the issue, but it is totally irrelevant currently as the whole piece of code does not exists anymore.

regards
Antti

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

=?y?q?=5BREVIEW=20PATCH=2013/41=5D=20af9035=3A=20IT9135=20dual=20tuner=20related=20changes?=

In reply to Antti Palosaari

Now it supports IT9135 based dual tuner devices.

---
 drivers/media/usb/dvb-usb-v2/af9035.c | 201 +++++++++++++++++-----------------
 drivers/media/usb/dvb-usb-v2/af9035.h |   3 +-
 2 files changed, 102 insertions(+), 102 deletions(-)
drivers/media/usb/dvb-usb-v2/af9035.c +100 -101
index 0b92277..1db9c76 100644
@@ -320,8 +320,10 @@ static int af9035_identify_state(struct dvb_usb_device *d, const char **name)
 			*name = AF9035_FIRMWARE_IT9135_V2;
 		else
 			*name = AF9035_FIRMWARE_IT9135_V1;
+		state->eeprom_addr = EEPROM_BASE_IT9135;
 	} else {
 		*name = AF9035_FIRMWARE_AF9035;
+		state->eeprom_addr = EEPROM_BASE_AF9035;
 	}
 
 	ret = af9035_ctrl_msg(d, &req);
@@ -347,63 +349,14 @@ static int af9035_download_firmware_af9035(struct dvb_usb_device *d,
 {
 	int ret, i, j, len;
 	u8 wbuf[1];
-	u8 rbuf[4];
 	struct usb_req req = { 0, 0, 0, NULL, 0, NULL };
 	struct usb_req req_fw_dl = { CMD_FW_DL, 0, 0, wbuf, 0, NULL };
-	struct usb_req req_fw_ver = { CMD_FW_QUERYINFO, 0, 1, wbuf, 4, rbuf } ;
-	u8 hdr_core, tmp;
+	u8 hdr_core;
 	u16 hdr_addr, hdr_data_len, hdr_checksum;
 	#define MAX_DATA 58
 	#define HDR_SIZE 7
 
 	/*
-	 * In case of dual tuner configuration we need to do some extra
-	 * initialization in order to download firmware to slave demod too,
-	 * which is done by master demod.
-	 * Master feeds also clock and controls power via GPIO.
-	 */
-	ret = af9035_rd_reg(d, EEPROM_BASE_AF9035 + EEPROM_DUAL_MODE, &tmp);
-	if (ret < 0)
-		goto err;
-
-	if (tmp) {
-		/* configure gpioh1, reset & power slave demod */
-		ret = af9035_wr_reg_mask(d, 0x00d8b0, 0x01, 0x01);
-		if (ret < 0)
-			goto err;
-
-		ret = af9035_wr_reg_mask(d, 0x00d8b1, 0x01, 0x01);
-		if (ret < 0)
-			goto err;
-
-		ret = af9035_wr_reg_mask(d, 0x00d8af, 0x00, 0x01);
-		if (ret < 0)
-			goto err;
-
-		usleep_range(10000, 50000);
-
-		ret = af9035_wr_reg_mask(d, 0x00d8af, 0x01, 0x01);
-		if (ret < 0)
-			goto err;
-
-		/* tell the slave I2C address */
-		ret = af9035_rd_reg(d,
-				EEPROM_BASE_AF9035 + EEPROM_2ND_DEMOD_ADDR,
-				&tmp);
-		if (ret < 0)
-			goto err;
-
-		ret = af9035_wr_reg(d, 0x00417f, tmp);
-		if (ret < 0)
-			goto err;
-
-		/* enable clock out */
-		ret = af9035_wr_reg_mask(d, 0x00d81a, 0x01, 0x01);
-		if (ret < 0)
-			goto err;
-	}
-
-	/*
 	 * Thanks to Daniel Glöckner <[email protected]> about that info!
 	 *
 	 * byte 0: MCS 51 core
@@ -469,28 +422,6 @@ static int af9035_download_firmware_af9035(struct dvb_usb_device *d,
 	if (i)
 		dev_warn(&d->udev->dev, "%s: bad firmware\n", KBUILD_MODNAME);
 
-	/* firmware loaded, request boot */
-	req.cmd = CMD_FW_BOOT;
-	ret = af9035_ctrl_msg(d, &req);
-	if (ret < 0)
-		goto err;
-
-	/* ensure firmware starts */
-	wbuf[0] = 1;
-	ret = af9035_ctrl_msg(d, &req_fw_ver);
-	if (ret < 0)
-		goto err;
-
-	if (!(rbuf[0] || rbuf[1] || rbuf[2] || rbuf[3])) {
-		dev_err(&d->udev->dev, "%s: firmware did not run\n",
-				KBUILD_MODNAME);
-		ret = -ENODEV;
-		goto err;
-	}
-
-	dev_info(&d->udev->dev, "%s: firmware version=%d.%d.%d.%d",
-			KBUILD_MODNAME, rbuf[0], rbuf[1], rbuf[2], rbuf[3]);
-
 	return 0;
 
 err:
@@ -503,11 +434,7 @@ static int af9035_download_firmware_it9135(struct dvb_usb_device *d,
 		const struct firmware *fw)
 {
 	int ret, i, i_prev;
-	u8 wbuf[1];
-	u8 rbuf[4];
-	struct usb_req req = { 0, 0, 0, NULL, 0, NULL };
 	struct usb_req req_fw_dl = { CMD_FW_SCATTER_WR, 0, 0, NULL, 0, NULL };
-	struct usb_req req_fw_ver = { CMD_FW_QUERYINFO, 0, 1, wbuf, 4, rbuf } ;
 	#define HDR_SIZE 7
 
 	/*
@@ -522,7 +449,6 @@ static int af9035_download_firmware_it9135(struct dvb_usb_device *d,
 	 * 5: addr LSB
 	 * 6: count of data bytes ?
 	 */
-
 	for (i = HDR_SIZE, i_prev = 0; i <= fw->size; i++) {
 		if (i == fw->size ||
 				(fw->data[i + 0] == 0x03 &&
@@ -541,6 +467,86 @@ static int af9035_download_firmware_it9135(struct dvb_usb_device *d,
 		}
 	}
 
+	return 0;
+
+err:
+	dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
+
+	return ret;
+}
+
+static int af9035_download_firmware(struct dvb_usb_device *d,
+		const struct firmware *fw)
+{
+	struct state *state = d_to_priv(d);
+	int ret;
+	u8 wbuf[1];
+	u8 rbuf[4];
+	u8 tmp;
+	struct usb_req req = { 0, 0, 0, NULL, 0, NULL };
+	struct usb_req req_fw_ver = { CMD_FW_QUERYINFO, 0, 1, wbuf, 4, rbuf } ;
+	dev_dbg(&d->udev->dev, "%s:\n", __func__);
+
+	/*
+	 * In case of dual tuner configuration we need to do some extra
+	 * initialization in order to download firmware to slave demod too,
+	 * which is done by master demod.
+	 * Master feeds also clock and controls power via GPIO.
+	 */
+	ret = af9035_rd_reg(d, state->eeprom_addr + EEPROM_DUAL_MODE, &tmp);
+	if (ret < 0)
+		goto err;
+
+	if (tmp) {
+		/* configure gpioh1, reset & power slave demod */
+		ret = af9035_wr_reg_mask(d, 0x00d8b0, 0x01, 0x01);
+		if (ret < 0)
+			goto err;
+
+		ret = af9035_wr_reg_mask(d, 0x00d8b1, 0x01, 0x01);
+		if (ret < 0)
+			goto err;
+
+		ret = af9035_wr_reg_mask(d, 0x00d8af, 0x00, 0x01);
+		if (ret < 0)
+			goto err;
+
+		usleep_range(10000, 50000);
+
+		ret = af9035_wr_reg_mask(d, 0x00d8af, 0x01, 0x01);
+		if (ret < 0)
+			goto err;
+
+		/* tell the slave I2C address */
+		ret = af9035_rd_reg(d,
+				state->eeprom_addr + EEPROM_2ND_DEMOD_ADDR,
+				&tmp);
+		if (ret < 0)
+			goto err;
+
+		if (state->chip_type == 0x9135) {
+			ret = af9035_wr_reg(d, 0x004bfb, tmp);
+			if (ret < 0)
+				goto err;
+		} else {
+			ret = af9035_wr_reg(d, 0x00417f, tmp);
+			if (ret < 0)
+				goto err;
+
+			/* enable clock out */
+			ret = af9035_wr_reg_mask(d, 0x00d81a, 0x01, 0x01);
+			if (ret < 0)
+				goto err;
+		}
+	}
+
+	if (state->chip_type == 0x9135)
+		ret = af9035_download_firmware_it9135(d, fw);
+	else
+		ret = af9035_download_firmware_af9035(d, fw);
+	if (ret < 0)
+		goto err;
+
 	/* firmware loaded, request boot */
 	req.cmd = CMD_FW_BOOT;
 	ret = af9035_ctrl_msg(d, &req);
@@ -571,17 +577,6 @@ err:
 	return ret;
 }
 
-static int af9035_download_firmware(struct dvb_usb_device *d,
-		const struct firmware *fw)
-{
-	struct state *state = d_to_priv(d);
-
-	if (state->chip_type == 0x9135)
-		return af9035_download_firmware_it9135(d, fw);
-	else
-		return af9035_download_firmware_af9035(d, fw);
-}
-
 static int af9035_read_config(struct dvb_usb_device *d)
 {
 	struct state *state = d_to_priv(d);
@@ -592,14 +587,17 @@ static int af9035_read_config(struct dvb_usb_device *d)
 	/* demod I2C "address" */
 	state->af9033_config[0].i2c_addr = 0x38;
 	state->af9033_config[0].adc_multiplier = AF9033_ADC_MULTIPLIER_2X;
+	state->af9033_config[1].adc_multiplier = AF9033_ADC_MULTIPLIER_2X;
 
 	/* eeprom memory mapped location */
 	if (state->chip_type == 0x9135) {
 		if (state->chip_version == 0x02) {
 			state->af9033_config[0].tuner = AF9033_TUNER_IT9135_60;
+			state->af9033_config[1].tuner = AF9033_TUNER_IT9135_60;
 			tmp16 = 0x00461d;
 		} else {
 			state->af9033_config[0].tuner = AF9033_TUNER_IT9135_38;
+			state->af9033_config[1].tuner = AF9033_TUNER_IT9135_38;
 			tmp16 = 0x00461b;
 		}
 
@@ -678,8 +676,14 @@ static int af9035_read_config(struct dvb_usb_device *d)
 
 		/* disable dual mode if driver does not support it */
 		if (i == 1)
-			switch (tmp) {
+			switch (state->af9033_config[i].tuner) {
 			case AF9033_TUNER_FC0012:
+			case AF9033_TUNER_IT9135_38:
+			case AF9033_TUNER_IT9135_51:
+			case AF9033_TUNER_IT9135_52:
+			case AF9033_TUNER_IT9135_60:
+			case AF9033_TUNER_IT9135_61:
+			case AF9033_TUNER_IT9135_62:
 				break;
 			default:
 				state->dual_mode = false;
@@ -891,6 +895,7 @@ static int af9035_frontend_attach(struct dvb_usb_adapter *adap)
 	struct state *state = adap_to_priv(adap);
 	struct dvb_usb_device *d = adap_to_d(adap);
 	int ret;
+	dev_dbg(&d->udev->dev, "%s:\n", __func__);
 
 	if (!state->af9033_config[adap->id].tuner) {
 		/* unsupported tuner */
@@ -901,15 +906,6 @@ static int af9035_frontend_attach(struct dvb_usb_adapter *adap)
 	if (adap->id == 0) {
 		state->af9033_config[0].ts_mode = AF9033_TS_MODE_USB;
 		state->af9033_config[1].ts_mode = AF9033_TS_MODE_SERIAL;
-
-		ret = af9035_wr_reg(d, 0x00417f,
-				state->af9033_config[1].i2c_addr);
-		if (ret < 0)
-			goto err;
-
-		ret = af9035_wr_reg(d, 0x00d81a, state->dual_mode);
-		if (ret < 0)
-			goto err;
 	}
 
 	/* attach demodulator */
@@ -1004,6 +1000,8 @@ static int af9035_tuner_attach(struct dvb_usb_adapter *adap)
 	struct dvb_frontend *fe;
 	struct i2c_msg msg[1];
 	u8 tuner_addr;
+	dev_dbg(&d->udev->dev, "%s:\n", __func__);
+
 	/*
 	 * XXX: Hack used in that function: we abuse unused I2C address bit [7]
 	 * to carry info about used I2C bus for dual tuner configuration.
@@ -1165,10 +1163,11 @@ static int af9035_tuner_attach(struct dvb_usb_adapter *adap)
 	case AF9033_TUNER_IT9135_60:
 	case AF9033_TUNER_IT9135_61:
 	case AF9033_TUNER_IT9135_62:
-		/* attach tuner */
 		af9035_it913x_config.tuner_id_0 = state->af9033_config[0].tuner;
-		fe = dvb_attach(it913x_attach, adap->fe[0],
-				&d->i2c_adap, 0x38, &af9035_it913x_config);
+		/* attach tuner */
+		fe = dvb_attach(it913x_attach, adap->fe[0], &d->i2c_adap,
+				state->af9033_config[adap->id].i2c_addr,
+				&af9035_it913x_config);
 		break;
 	default:
 		fe = NULL;
drivers/media/usb/dvb-usb-v2/af9035.h +2 -1
index 4d918ee..59843c7 100644
@@ -54,10 +54,11 @@ struct usb_req {
 
 struct state {
 	u8 seq; /* packet sequence number */
-	bool dual_mode;
 	u8 prechip_version;
 	u8 chip_version;
 	u16 chip_type;
+	bool dual_mode;
+	u16 eeprom_addr;
 	struct af9033_config af9033_config[2];
 };
 
Signature · 1 line
1.7.11.7
#16 lore raw

PATCH 12/41 af9033: IT9135 v2 supported related changes

In reply to Antti Palosaari
---
 drivers/media/dvb-frontends/af9033.c | 31 ++++++++++++++++++++++++++++---
 1 file changed, 28 insertions(+), 3 deletions(-)
drivers/media/dvb-frontends/af9033.c +28 -3
index dece775..f510228 100644
@@ -285,10 +285,29 @@ static int af9033_init(struct dvb_frontend *fe)
 			goto err;
 	}
 
+	/*
+	 * FIXME: These inits are logically property of demodulator driver
+	 * (that driver), but currently in case of IT9135 those are done by
+	 * tuner driver.
+	 */
+
 	/* load OFSM settings */
 	dev_dbg(&state->i2c->dev, "%s: load ofsm settings\n", __func__);
-	len = ARRAY_SIZE(ofsm_init);
-	init = ofsm_init;
+	switch (state->cfg.tuner) {
+	case AF9033_TUNER_IT9135_38:
+	case AF9033_TUNER_IT9135_51:
+	case AF9033_TUNER_IT9135_52:
+	case AF9033_TUNER_IT9135_60:
+	case AF9033_TUNER_IT9135_61:
+	case AF9033_TUNER_IT9135_62:
+		len = 0;
+		break;
+	default:
+		len = ARRAY_SIZE(ofsm_init);
+		init = ofsm_init;
+		break;
+	}
+
 	for (i = 0; i < len; i++) {
 		ret = af9033_wr_reg(state, init[i].reg, init[i].val);
 		if (ret < 0)
@@ -424,7 +443,8 @@ err:
 static int af9033_get_tune_settings(struct dvb_frontend *fe,
 		struct dvb_frontend_tune_settings *fesettings)
 {
-	fesettings->min_delay_ms = 800;
+	/* 800 => 2000 because IT9135 v2 is slow to gain lock */
+	fesettings->min_delay_ms = 2000;
 	fesettings->step_size = 0;
 	fesettings->max_drift = 0;
 
@@ -513,6 +533,11 @@ static int af9033_set_frontend(struct dvb_frontend *fe)
 		buf[0] = (freq_cw >>  0) & 0xff;
 		buf[1] = (freq_cw >>  8) & 0xff;
 		buf[2] = (freq_cw >> 16) & 0x7f;
+
+		/* FIXME: there seems to be calculation error here... */
+		if (if_frequency == 0)
+			buf[2] = 0;
+
 		ret = af9033_wr_regs(state, 0x800029, buf, 3);
 		if (ret < 0)
 			goto err;
Signature · 1 line
1.7.11.7
#17 lore raw

PATCH 14/41 it913x: merge it913x_fe_start() to it913x_init_tuner()

In reply to Antti Palosaari

Merge those functions to one and disable sleep.

---
 drivers/media/tuners/it913x.c | 165 ++++++++++++------------------------------
 1 file changed, 45 insertions(+), 120 deletions(-)
drivers/media/tuners/it913x.c +45 -120
index 6ee4f97..f1938a1 100644
@@ -43,7 +43,6 @@ struct it913x_fe_state {
 	u32 ucblocks;
 };
 
-
 static int it913x_read_reg(struct it913x_fe_state *state,
 		u32 reg, u8 *data, u8 count)
 {
@@ -147,10 +146,54 @@ static int it913x_init_tuner(struct dvb_frontend *fe)
 {
 	struct it913x_fe_state *state = fe->tuner_priv;
 	int ret, i, reg;
+	struct it913xset *set_lna;
 	u8 val, nv_val;
 	u8 nv[] = {48, 32, 24, 16, 12, 8, 6, 4, 2};
 	u8 b[2];
 
+	/* v1 or v2 tuner script */
+	if (state->config->chip_ver > 1)
+		ret = it913x_fe_script_loader(state, it9135_v2);
+	else
+		ret = it913x_fe_script_loader(state, it9135_v1);
+	if (ret < 0)
+		return ret;
+
+	/* LNA Scripts */
+	switch (state->tuner_type) {
+	case IT9135_51:
+		set_lna = it9135_51;
+		break;
+	case IT9135_52:
+		set_lna = it9135_52;
+		break;
+	case IT9135_60:
+		set_lna = it9135_60;
+		break;
+	case IT9135_61:
+		set_lna = it9135_61;
+		break;
+	case IT9135_62:
+		set_lna = it9135_62;
+		break;
+	case IT9135_38:
+	default:
+		set_lna = it9135_38;
+	}
+	pr_info("Tuner LNA type :%02x\n", state->tuner_type);
+
+	ret = it913x_fe_script_loader(state, set_lna);
+	if (ret < 0)
+		return ret;
+
+	if (state->config->chip_ver == 2) {
+		ret = it913x_write_reg(state, PRO_DMOD, TRIGGER_OFSM, 0x1);
+		ret |= it913x_write_reg(state, PRO_LINK, PADODPU, 0x0);
+		ret |= it913x_write_reg(state, PRO_LINK, AGC_O_D, 0x0);
+	}
+	if (ret < 0)
+		return -ENODEV;
+
 	reg = it913x_read_reg_u8(state, 0xec86);
 	switch (reg) {
 	case 0:
@@ -361,6 +404,7 @@ static int it9137_set_tuner(struct dvb_frontend *fe)
 static int it913x_fe_suspend(struct it913x_fe_state *state)
 {
 	int ret = 0;
+	return 0;
 #if 0
 	int ret, i;
 	u8 b;
@@ -397,121 +441,6 @@ static int it913x_fe_sleep(struct dvb_frontend *fe)
 	return it913x_fe_suspend(state);
 }
 
-static int it913x_fe_start(struct dvb_frontend *fe)
-{
-	struct it913x_fe_state *state = fe->tuner_priv;
-	struct it913xset *set_lna;
-//	struct it913xset *set_mode;
-	int ret;
-//	u8 adf = (state->config->adf & 0xf);
-//	u32 adc, xtal;
-//	u8 b[4];
-
-	if (state->config->chip_ver == 1)
-		ret = it913x_init_tuner(fe);
-
-#if 0
-	pr_info("ADF table value	:%02x\n", adf);
-
-	if (adf < 10) {
-		state->crystalFrequency = fe_clockTable[adf].xtal ;
-		state->table = fe_clockTable[adf].table;
-		state->adcFrequency = state->table->adcFrequency;
-
-		adc = compute_div(state->adcFrequency, 1000000ul, 19ul);
-		xtal = compute_div(state->crystalFrequency, 1000000ul, 19ul);
-
-	} else
-		return -EINVAL;
-
-	/* Set LED indicator on GPIOH3 */
-	ret = it913x_write_reg(state, PRO_LINK, GPIOH3_EN, 0x1);
-	ret |= it913x_write_reg(state, PRO_LINK, GPIOH3_ON, 0x1);
-	ret |= it913x_write_reg(state, PRO_LINK, GPIOH3_O, 0x1);
-
-	ret |= it913x_write_reg(state, PRO_LINK, 0xf641, state->tuner_type);
-	ret |= it913x_write_reg(state, PRO_DMOD, 0xf5ca, 0x01);
-	ret |= it913x_write_reg(state, PRO_DMOD, 0xf715, 0x01);
-
-	b[0] = xtal & 0xff;
-	b[1] = (xtal >> 8) & 0xff;
-	b[2] = (xtal >> 16) & 0xff;
-	b[3] = (xtal >> 24);
-	ret |= it913x_write(state, PRO_DMOD, XTAL_CLK, b , 4);
-
-	b[0] = adc & 0xff;
-	b[1] = (adc >> 8) & 0xff;
-	b[2] = (adc >> 16) & 0xff;
-	ret |= it913x_write(state, PRO_DMOD, ADC_FREQ, b, 3);
-
-	if (state->config->adc_x2)
-		ret |= it913x_write_reg(state, PRO_DMOD, ADC_X_2, 0x01);
-	b[0] = 0;
-	b[1] = 0;
-	b[2] = 0;
-	ret |= it913x_write(state, PRO_DMOD, 0x0029, b, 3);
-
-	pr_info("Crystal Frequency :%d Adc Frequency :%d ADC X2: %02x\n",
-		state->crystalFrequency, state->adcFrequency,
-			state->config->adc_x2);
-	pr_debug("Xtal value :%04x Adc value :%04x\n", xtal, adc);
-
-	if (ret < 0)
-		return -ENODEV;
-#endif
-
-	/* v1 or v2 tuner script */
-	if (state->config->chip_ver > 1)
-		ret = it913x_fe_script_loader(state, it9135_v2);
-	else
-		ret = it913x_fe_script_loader(state, it9135_v1);
-	if (ret < 0)
-		return ret;
-
-	/* LNA Scripts */
-	switch (state->tuner_type) {
-	case IT9135_51:
-		set_lna = it9135_51;
-		break;
-	case IT9135_52:
-		set_lna = it9135_52;
-		break;
-	case IT9135_60:
-		set_lna = it9135_60;
-		break;
-	case IT9135_61:
-		set_lna = it9135_61;
-		break;
-	case IT9135_62:
-		set_lna = it9135_62;
-		break;
-	case IT9135_38:
-	default:
-		set_lna = it9135_38;
-	}
-	pr_info("Tuner LNA type :%02x\n", state->tuner_type);
-
-	ret = it913x_fe_script_loader(state, set_lna);
-	if (ret < 0)
-		return ret;
-
-	if (state->config->chip_ver == 2) {
-		ret = it913x_write_reg(state, PRO_DMOD, TRIGGER_OFSM, 0x1);
-		ret |= it913x_write_reg(state, PRO_LINK, PADODPU, 0x0);
-		ret |= it913x_write_reg(state, PRO_LINK, AGC_O_D, 0x0);
-		ret |= it913x_init_tuner(fe);
-	}
-	if (ret < 0)
-		return -ENODEV;
-
-	/* Always solo frontend */
-//	set_mode = set_solo_fe;
-//	ret |= it913x_fe_script_loader(state, set_mode);
-
-	ret |= it913x_fe_suspend(state);
-	return (ret < 0) ? -ENODEV : 0;
-}
-
 static int it913x_release(struct dvb_frontend *fe)
 {
 	kfree(fe->tuner_priv);
@@ -566,10 +495,6 @@ struct dvb_frontend *it913x_attach(struct dvb_frontend *fe,
 	memcpy(&fe->ops.tuner_ops, &it913x_tuner_ops,
 			sizeof(struct dvb_tuner_ops));
 
-	ret = it913x_fe_start(fe);
-	if (ret < 0)
-		goto error;
-
 	pr_info("%s: ITE Tech IT913X attached\n", KBUILD_MODNAME);
 
 	return fe;
Signature · 1 line
1.7.11.7
#18 lore raw

PATCH 15/41 it913x: merge it913x_fe_suspend() to it913x_fe_sleep()

In reply to Antti Palosaari
---
 drivers/media/tuners/it913x.c | 32 +-------------------------------
 1 file changed, 1 insertion(+), 31 deletions(-)
drivers/media/tuners/it913x.c +1 -31
index f1938a1..6eb3afa 100644
@@ -401,36 +401,6 @@ static int it9137_set_tuner(struct dvb_frontend *fe)
 	return (ret < 0) ? -ENODEV : 0;
 }
 
-static int it913x_fe_suspend(struct it913x_fe_state *state)
-{
-	int ret = 0;
-	return 0;
-#if 0
-	int ret, i;
-	u8 b;
-
-	ret = it913x_write_reg(state, PRO_DMOD, SUSPEND_FLAG, 0x1);
-
-	ret |= it913x_write_reg(state, PRO_DMOD, TRIGGER_OFSM, 0x0);
-
-	for (i = 0; i < 128; i++) {
-		ret = it913x_read_reg(state, SUSPEND_FLAG, &b, 1);
-		if (ret < 0)
-			return -ENODEV;
-		if (b == 0)
-			break;
-
-	}
-
-	ret |= it913x_write_reg(state, PRO_DMOD, AFE_MEM0, 0x8);
-	/* Turn LED off */
-	ret |= it913x_write_reg(state, PRO_LINK, GPIOH3_O, 0x0);
-#endif
-	ret |= it913x_fe_script_loader(state, it9137_tuner_off);
-
-	return (ret < 0) ? -ENODEV : 0;
-}
-
 /* Power sequence */
 /* Power Up	Tuner on -> Frontend suspend off -> Tuner clk on */
 /* Power Down	Frontend suspend on -> Tuner clk off -> Tuner off */
@@ -438,7 +408,7 @@ static int it913x_fe_suspend(struct it913x_fe_state *state)
 static int it913x_fe_sleep(struct dvb_frontend *fe)
 {
 	struct it913x_fe_state *state = fe->tuner_priv;
-	return it913x_fe_suspend(state);
+	return it913x_fe_script_loader(state, it9137_tuner_off);
 }
 
 static int it913x_release(struct dvb_frontend *fe)
Signature · 1 line
1.7.11.7
#19 lore raw

PATCH 16/41 it913x: rename functions and variables

In reply to Antti Palosaari
---
 drivers/media/tuners/it913x.c | 72 +++++++++++++++++++++++--------------------
 1 file changed, 38 insertions(+), 34 deletions(-)
drivers/media/tuners/it913x.c +38 -34
index 6eb3afa..82cc053 100644
@@ -22,7 +22,7 @@
 
 #include "it913x_priv.h"
 
-struct it913x_fe_state {
+struct it913x_state {
 	struct dvb_frontend frontend;
 	struct i2c_adapter *i2c_adap;
 	struct ite_config *config;
@@ -43,7 +43,8 @@ struct it913x_fe_state {
 	u32 ucblocks;
 };
 
-static int it913x_read_reg(struct it913x_fe_state *state,
+/* read multiple registers */
+static int it913x_rd_regs(struct it913x_state *state,
 		u32 reg, u8 *data, u8 count)
 {
 	int ret;
@@ -64,15 +65,17 @@ static int it913x_read_reg(struct it913x_fe_state *state,
 	return ret;
 }
 
-static int it913x_read_reg_u8(struct it913x_fe_state *state, u32 reg)
+/* read single register */
+static int it913x_rd_reg(struct it913x_state *state, u32 reg)
 {
 	int ret;
 	u8 b[1];
-	ret = it913x_read_reg(state, reg, &b[0], sizeof(b));
+	ret = it913x_rd_regs(state, reg, &b[0], sizeof(b));
 	return (ret < 0) ? -ENODEV : b[0];
 }
 
-static int it913x_write(struct it913x_fe_state *state,
+/* write multiple registers */
+static int it913x_wr_regs(struct it913x_state *state,
 		u8 pro, u32 reg, u8 buf[], u8 count)
 {
 	u8 b[256];
@@ -97,7 +100,8 @@ static int it913x_write(struct it913x_fe_state *state,
 	return 0;
 }
 
-static int it913x_write_reg(struct it913x_fe_state *state,
+/* write single register */
+static int it913x_wr_reg(struct it913x_state *state,
 		u8 pro, u32 reg, u32 data)
 {
 	int ret;
@@ -118,12 +122,12 @@ static int it913x_write_reg(struct it913x_fe_state *state,
 	else
 		s = 0;
 
-	ret = it913x_write(state, pro, reg, &b[s], sizeof(b) - s);
+	ret = it913x_wr_regs(state, pro, reg, &b[s], sizeof(b) - s);
 
 	return ret;
 }
 
-static int it913x_fe_script_loader(struct it913x_fe_state *state,
+static int it913x_script_loader(struct it913x_state *state,
 		struct it913xset *loadscript)
 {
 	int ret, i;
@@ -133,7 +137,7 @@ static int it913x_fe_script_loader(struct it913x_fe_state *state,
 	for (i = 0; i < 1000; ++i) {
 		if (loadscript[i].pro == 0xff)
 			break;
-		ret = it913x_write(state, loadscript[i].pro,
+		ret = it913x_wr_regs(state, loadscript[i].pro,
 			loadscript[i].address,
 			loadscript[i].reg, loadscript[i].count);
 		if (ret < 0)
@@ -142,9 +146,9 @@ static int it913x_fe_script_loader(struct it913x_fe_state *state,
 	return 0;
 }
 
-static int it913x_init_tuner(struct dvb_frontend *fe)
+static int it913x_init(struct dvb_frontend *fe)
 {
-	struct it913x_fe_state *state = fe->tuner_priv;
+	struct it913x_state *state = fe->tuner_priv;
 	int ret, i, reg;
 	struct it913xset *set_lna;
 	u8 val, nv_val;
@@ -153,9 +157,9 @@ static int it913x_init_tuner(struct dvb_frontend *fe)
 
 	/* v1 or v2 tuner script */
 	if (state->config->chip_ver > 1)
-		ret = it913x_fe_script_loader(state, it9135_v2);
+		ret = it913x_script_loader(state, it9135_v2);
 	else
-		ret = it913x_fe_script_loader(state, it9135_v1);
+		ret = it913x_script_loader(state, it9135_v1);
 	if (ret < 0)
 		return ret;
 
@@ -182,19 +186,19 @@ static int it913x_init_tuner(struct dvb_frontend *fe)
 	}
 	pr_info("Tuner LNA type :%02x\n", state->tuner_type);
 
-	ret = it913x_fe_script_loader(state, set_lna);
+	ret = it913x_script_loader(state, set_lna);
 	if (ret < 0)
 		return ret;
 
 	if (state->config->chip_ver == 2) {
-		ret = it913x_write_reg(state, PRO_DMOD, TRIGGER_OFSM, 0x1);
-		ret |= it913x_write_reg(state, PRO_LINK, PADODPU, 0x0);
-		ret |= it913x_write_reg(state, PRO_LINK, AGC_O_D, 0x0);
+		ret = it913x_wr_reg(state, PRO_DMOD, TRIGGER_OFSM, 0x1);
+		ret |= it913x_wr_reg(state, PRO_LINK, PADODPU, 0x0);
+		ret |= it913x_wr_reg(state, PRO_LINK, AGC_O_D, 0x0);
 	}
 	if (ret < 0)
 		return -ENODEV;
 
-	reg = it913x_read_reg_u8(state, 0xec86);
+	reg = it913x_rd_reg(state, 0xec86);
 	switch (reg) {
 	case 0:
 		state->tun_clk_mode = reg;
@@ -213,7 +217,7 @@ static int it913x_init_tuner(struct dvb_frontend *fe)
 		break;
 	}
 
-	reg = it913x_read_reg_u8(state, 0xed03);
+	reg = it913x_rd_reg(state, 0xed03);
 
 	if (reg < 0)
 		return -ENODEV;
@@ -223,7 +227,7 @@ static int it913x_init_tuner(struct dvb_frontend *fe)
 		nv_val = 2;
 
 	for (i = 0; i < 50; i++) {
-		ret = it913x_read_reg(state, 0xed23, &b[0], sizeof(b));
+		ret = it913x_rd_regs(state, 0xed23, &b[0], sizeof(b));
 		reg = (b[1] << 8) + b[0];
 		if (reg > 0)
 			break;
@@ -239,7 +243,7 @@ static int it913x_init_tuner(struct dvb_frontend *fe)
 		msleep(50);
 	else {
 		for (i = 0; i < 50; i++) {
-			reg = it913x_read_reg_u8(state, 0xec82);
+			reg = it913x_rd_reg(state, 0xec82);
 			if (reg > 0)
 				break;
 			if (reg < 0)
@@ -248,12 +252,12 @@ static int it913x_init_tuner(struct dvb_frontend *fe)
 		}
 	}
 
-	return it913x_write_reg(state, PRO_DMOD, 0xed81, val);
+	return it913x_wr_reg(state, PRO_DMOD, 0xed81, val);
 }
 
-static int it9137_set_tuner(struct dvb_frontend *fe)
+static int it9137_set_params(struct dvb_frontend *fe)
 {
-	struct it913x_fe_state *state = fe->tuner_priv;
+	struct it913x_state *state = fe->tuner_priv;
 	struct it913xset *set_tuner = set_it9137_template;
 	struct dtv_frontend_properties *p = &fe->dtv_property_cache;
 	u32 bandwidth = p->bandwidth_hz;
@@ -358,7 +362,7 @@ static int it9137_set_tuner(struct dvb_frontend *fe)
 	} else
 		return -EINVAL;
 
-	reg = it913x_read_reg_u8(state, 0xed81);
+	reg = it913x_rd_reg(state, 0xed81);
 	iqik_m_cal = (u16)reg * n_div;
 
 	if (reg < 0x20) {
@@ -396,7 +400,7 @@ static int it9137_set_tuner(struct dvb_frontend *fe)
 
 	pr_debug("low Frequency = %04x\n", freq);
 
-	ret = it913x_fe_script_loader(state, set_tuner);
+	ret = it913x_script_loader(state, set_tuner);
 
 	return (ret < 0) ? -ENODEV : 0;
 }
@@ -405,10 +409,10 @@ static int it9137_set_tuner(struct dvb_frontend *fe)
 /* Power Up	Tuner on -> Frontend suspend off -> Tuner clk on */
 /* Power Down	Frontend suspend on -> Tuner clk off -> Tuner off */
 
-static int it913x_fe_sleep(struct dvb_frontend *fe)
+static int it913x_sleep(struct dvb_frontend *fe)
 {
-	struct it913x_fe_state *state = fe->tuner_priv;
-	return it913x_fe_script_loader(state, it9137_tuner_off);
+	struct it913x_state *state = fe->tuner_priv;
+	return it913x_script_loader(state, it9137_tuner_off);
 }
 
 static int it913x_release(struct dvb_frontend *fe)
@@ -426,19 +430,19 @@ static const struct dvb_tuner_ops it913x_tuner_ops = {
 
 	.release = it913x_release,
 
-	.init = it913x_init_tuner,
-	.sleep = it913x_fe_sleep,
-	.set_params = it9137_set_tuner,
+	.init = it913x_init,
+	.sleep = it913x_sleep,
+	.set_params = it9137_set_params,
 };
 
 struct dvb_frontend *it913x_attach(struct dvb_frontend *fe,
 	struct i2c_adapter *i2c_adap, u8 i2c_addr, struct ite_config *config)
 {
-	struct it913x_fe_state *state = NULL;
+	struct it913x_state *state = NULL;
 	int ret;
 
 	/* allocate memory for the internal state */
-	state = kzalloc(sizeof(struct it913x_fe_state), GFP_KERNEL);
+	state = kzalloc(sizeof(struct it913x_state), GFP_KERNEL);
 	if (state == NULL)
 		return NULL;
 	if (config == NULL)
Signature · 1 line
1.7.11.7
#20 lore raw

PATCH 17/41 it913x: tuner power up routines

In reply to Antti Palosaari

Copy forgotten power up registers from it913x-fe driver. Remove two demod registers as those are already written by af9033 driver.

---
 drivers/media/tuners/it913x.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/media/tuners/it913x.c +8 -4
index 82cc053..de20da1 100644
@@ -192,11 +192,9 @@ static int it913x_init(struct dvb_frontend *fe)
 
 	if (state->config->chip_ver == 2) {
 		ret = it913x_wr_reg(state, PRO_DMOD, TRIGGER_OFSM, 0x1);
-		ret |= it913x_wr_reg(state, PRO_LINK, PADODPU, 0x0);
-		ret |= it913x_wr_reg(state, PRO_LINK, AGC_O_D, 0x0);
+		if (ret < 0)
+			return -ENODEV;
 	}
-	if (ret < 0)
-		return -ENODEV;
 
 	reg = it913x_rd_reg(state, 0xec86);
 	switch (reg) {
@@ -252,6 +250,12 @@ static int it913x_init(struct dvb_frontend *fe)
 		}
 	}
 
+	/* Power Up Tuner - common all versions */
+	ret = it913x_wr_reg(state, PRO_DMOD, 0xec40, 0x1);
+	ret |= it913x_wr_reg(state, PRO_DMOD, 0xfba8, 0x0);
+	ret |= it913x_wr_reg(state, PRO_DMOD, 0xec57, 0x0);
+	ret |= it913x_wr_reg(state, PRO_DMOD, 0xec58, 0x0);
+
 	return it913x_wr_reg(state, PRO_DMOD, 0xed81, val);
 }
 
Signature · 1 line
1.7.11.7
#21 lore raw

PATCH 18/41 it913x: get rid of it913x config struct

In reply to Antti Palosaari

We don't need it. Tuner ID and device address are enough.

---
 drivers/media/tuners/it913x.c         | 38 +++++++++++++++++++++--------------
 drivers/media/tuners/it913x.h         | 22 ++++++--------------
 drivers/media/usb/dvb-usb-v2/af9035.c | 18 +----------------
 3 files changed, 30 insertions(+), 48 deletions(-)
drivers/media/tuners/it913x.c +23 -15
index de20da1..66d4b72 100644
@@ -25,7 +25,8 @@
 struct it913x_state {
 	struct dvb_frontend frontend;
 	struct i2c_adapter *i2c_adap;
-	struct ite_config *config;
+	u8 chip_ver;
+	u8 firmware_ver;
 	u8 i2c_addr;
 	u32 frequency;
 	fe_modulation_t constellation;
@@ -156,7 +157,7 @@ static int it913x_init(struct dvb_frontend *fe)
 	u8 b[2];
 
 	/* v1 or v2 tuner script */
-	if (state->config->chip_ver > 1)
+	if (state->chip_ver > 1)
 		ret = it913x_script_loader(state, it9135_v2);
 	else
 		ret = it913x_script_loader(state, it9135_v1);
@@ -190,7 +191,7 @@ static int it913x_init(struct dvb_frontend *fe)
 	if (ret < 0)
 		return ret;
 
-	if (state->config->chip_ver == 2) {
+	if (state->chip_ver == 2) {
 		ret = it913x_wr_reg(state, PRO_DMOD, TRIGGER_OFSM, 0x1);
 		if (ret < 0)
 			return -ENODEV;
@@ -237,7 +238,7 @@ static int it913x_init(struct dvb_frontend *fe)
 	state->tun_fn_min /= (state->tun_fdiv * nv_val);
 	pr_debug("Tuner fn_min %d\n", state->tun_fn_min);
 
-	if (state->config->chip_ver > 1)
+	if (state->chip_ver > 1)
 		msleep(50);
 	else {
 		for (i = 0; i < 50; i++) {
@@ -276,7 +277,7 @@ static int it9137_set_params(struct dvb_frontend *fe)
 	u8 lna_band;
 	u8 bw;
 
-	if (state->config->firmware_ver == 1)
+	if (state->firmware_ver == 1)
 		set_tuner = set_it9135_template;
 	else
 		set_tuner = set_it9137_template;
@@ -440,40 +441,47 @@ static const struct dvb_tuner_ops it913x_tuner_ops = {
 };
 
 struct dvb_frontend *it913x_attach(struct dvb_frontend *fe,
-	struct i2c_adapter *i2c_adap, u8 i2c_addr, struct ite_config *config)
+		struct i2c_adapter *i2c_adap, u8 i2c_addr, u8 config)
 {
 	struct it913x_state *state = NULL;
-	int ret;
 
 	/* allocate memory for the internal state */
 	state = kzalloc(sizeof(struct it913x_state), GFP_KERNEL);
 	if (state == NULL)
 		return NULL;
-	if (config == NULL)
-		goto error;
 
 	state->i2c_adap = i2c_adap;
 	state->i2c_addr = i2c_addr;
-	state->config = config;
 
-	switch (state->config->tuner_id_0) {
+	switch (config) {
+	case IT9135_38:
 	case IT9135_51:
 	case IT9135_52:
+		state->chip_ver = 0x01;
+		break;
 	case IT9135_60:
 	case IT9135_61:
 	case IT9135_62:
-		state->tuner_type = state->config->tuner_id_0;
+		state->chip_ver = 0x02;
 		break;
 	default:
-	case IT9135_38:
-		state->tuner_type = IT9135_38;
+		dev_dbg(&i2c_adap->dev,
+				"%s: invalid config=%02x\n", __func__, config);
+		goto error;
 	}
 
+	state->tuner_type = config;
+	state->firmware_ver = 1;
+
 	fe->tuner_priv = state;
 	memcpy(&fe->ops.tuner_ops, &it913x_tuner_ops,
 			sizeof(struct dvb_tuner_ops));
 
-	pr_info("%s: ITE Tech IT913X attached\n", KBUILD_MODNAME);
+	dev_info(&i2c_adap->dev,
+			"%s: ITE Tech IT913X successfully attached\n",
+			KBUILD_MODNAME);
+	dev_dbg(&i2c_adap->dev, "%s: config=%02x chip_ver=%02x\n",
+			__func__, config, state->chip_ver);
 
 	return fe;
 error:
drivers/media/tuners/it913x.h +6 -16
index 3583e56..12dd36b 100644
@@ -25,27 +25,17 @@
 
 #include "dvb_frontend.h"
 
-struct ite_config {
-	u8 chip_ver;
-	u16 chip_type;
-	u32 firmware;
-	u8 firmware_ver;
-	u8 adc_x2;
-	u8 tuner_id_0;
-	u8 tuner_id_1;
-	u8 dual_mode;
-	u8 adf;
-	/* option to read SIGNAL_LEVEL */
-	u8 read_slevel;
-};
-
 #if defined(CONFIG_MEDIA_TUNER_IT913X) || \
 	(defined(CONFIG_MEDIA_TUNER_IT913X_MODULE) && defined(MODULE))
 extern struct dvb_frontend *it913x_attach(struct dvb_frontend *fe,
-	struct i2c_adapter *i2c_adap, u8 i2c_addr, struct ite_config *config);
+	struct i2c_adapter *i2c_adap,
+	u8 i2c_addr,
+	u8 config);
 #else
 static inline struct dvb_frontend *it913x_attach(struct dvb_frontend *fe,
-	struct i2c_adapter *i2c_adap, u8 i2c_addr, struct ite_config *config)
+	struct i2c_adapter *i2c_adap,
+	u8 i2c_addr,
+	u8 config)
 {
 	pr_warn("%s: driver disabled by Kconfig\n", __func__);
 	return NULL;
drivers/media/usb/dvb-usb-v2/af9035.c +1 -17
index 1db9c76..a220a12 100644
@@ -978,20 +978,6 @@ static const struct fc0012_config af9035_fc0012_config[] = {
 	}
 };
 
-static struct ite_config af9035_it913x_config = {
-	.chip_ver = 0x02,
-	.chip_type = 0x9135,
-	.firmware = 0x00000000,
-	.firmware_ver = 1,
-	.adc_x2 = 1,
-	.tuner_id_0 = 0x00,
-	.tuner_id_1 = 0x00,
-	.dual_mode = 0x00,
-	.adf = 0x00,
-	/* option to read SIGNAL_LEVEL */
-	.read_slevel = 0,
-};
-
 static int af9035_tuner_attach(struct dvb_usb_adapter *adap)
 {
 	struct state *state = adap_to_priv(adap);
@@ -1159,15 +1145,13 @@ static int af9035_tuner_attach(struct dvb_usb_adapter *adap)
 	case AF9033_TUNER_IT9135_38:
 	case AF9033_TUNER_IT9135_51:
 	case AF9033_TUNER_IT9135_52:
-		af9035_it913x_config.chip_ver = 0x01;
 	case AF9033_TUNER_IT9135_60:
 	case AF9033_TUNER_IT9135_61:
 	case AF9033_TUNER_IT9135_62:
-		af9035_it913x_config.tuner_id_0 = state->af9033_config[0].tuner;
 		/* attach tuner */
 		fe = dvb_attach(it913x_attach, adap->fe[0], &d->i2c_adap,
 				state->af9033_config[adap->id].i2c_addr,
-				&af9035_it913x_config);
+				state->af9033_config[0].tuner);
 		break;
 	default:
 		fe = NULL;
Signature · 1 line
1.7.11.7
#22 lore raw

PATCH 19/41 it913x: remove unused variables

In reply to Antti Palosaari
---
 drivers/media/tuners/it913x.c      | 14 ++------------
 drivers/media/tuners/it913x_priv.h | 12 ------------
 2 files changed, 2 insertions(+), 24 deletions(-)
drivers/media/tuners/it913x.c +2 -12
index 66d4b72..6ae9d5a 100644
@@ -23,25 +23,15 @@
 #include "it913x_priv.h"
 
 struct it913x_state {
-	struct dvb_frontend frontend;
 	struct i2c_adapter *i2c_adap;
-	u8 chip_ver;
-	u8 firmware_ver;
 	u8 i2c_addr;
-	u32 frequency;
-	fe_modulation_t constellation;
-	fe_transmit_mode_t transmission_mode;
-	u8 priority;
-	u32 crystalFrequency;
-	u32 adcFrequency;
+	u8 chip_ver;
 	u8 tuner_type;
-	struct adctable *table;
-	fe_status_t it913x_status;
+	u8 firmware_ver;
 	u16 tun_xtal;
 	u8 tun_fdiv;
 	u8 tun_clk_mode;
 	u32 tun_fn_min;
-	u32 ucblocks;
 };
 
 /* read multiple registers */
drivers/media/tuners/it913x_priv.h +0 -12
index e4a0136..315ff6c 100644
@@ -34,22 +34,10 @@
 #define IT9135_61 0x61
 #define IT9135_62 0x62
 
-#define I2C_BASE_ADDR		0x10
-#define DEV_0			0x0
-#define DEV_1			0x10
 #define PRO_LINK		0x0
 #define PRO_DMOD		0x1
-#define DEV_0_DMOD		(PRO_DMOD << 0x7)
-#define DEV_1_DMOD		(DEV_0_DMOD | DEV_1)
-#define CHIP2_I2C_ADDR		0x3a
-
-#define	PADODPU			0xd827
-#define THIRDODPU		0xd828
-#define AGC_O_D			0xd829
-
 #define TRIGGER_OFSM		0x0000
 
-
 struct it913xset {	u32 pro;
 			u32 address;
 			u8 reg[15];
Signature · 1 line
1.7.11.7
#23 lore raw

PATCH 20/41 it913x: include tuner IDs from af9033.h

In reply to Antti Palosaari
---
 drivers/media/tuners/it913x.c      | 24 ++++++++++++------------
 drivers/media/tuners/it913x_priv.h | 10 +---------
 2 files changed, 13 insertions(+), 21 deletions(-)
drivers/media/tuners/it913x.c +12 -12
index 6ae9d5a..1cb9709 100644
@@ -156,22 +156,22 @@ static int it913x_init(struct dvb_frontend *fe)
 
 	/* LNA Scripts */
 	switch (state->tuner_type) {
-	case IT9135_51:
+	case AF9033_TUNER_IT9135_51:
 		set_lna = it9135_51;
 		break;
-	case IT9135_52:
+	case AF9033_TUNER_IT9135_52:
 		set_lna = it9135_52;
 		break;
-	case IT9135_60:
+	case AF9033_TUNER_IT9135_60:
 		set_lna = it9135_60;
 		break;
-	case IT9135_61:
+	case AF9033_TUNER_IT9135_61:
 		set_lna = it9135_61;
 		break;
-	case IT9135_62:
+	case AF9033_TUNER_IT9135_62:
 		set_lna = it9135_62;
 		break;
-	case IT9135_38:
+	case AF9033_TUNER_IT9135_38:
 	default:
 		set_lna = it9135_38;
 	}
@@ -444,14 +444,14 @@ struct dvb_frontend *it913x_attach(struct dvb_frontend *fe,
 	state->i2c_addr = i2c_addr;
 
 	switch (config) {
-	case IT9135_38:
-	case IT9135_51:
-	case IT9135_52:
+	case AF9033_TUNER_IT9135_38:
+	case AF9033_TUNER_IT9135_51:
+	case AF9033_TUNER_IT9135_52:
 		state->chip_ver = 0x01;
 		break;
-	case IT9135_60:
-	case IT9135_61:
-	case IT9135_62:
+	case AF9033_TUNER_IT9135_60:
+	case AF9033_TUNER_IT9135_61:
+	case AF9033_TUNER_IT9135_62:
 		state->chip_ver = 0x02;
 		break;
 	default:
drivers/media/tuners/it913x_priv.h +1 -9
index 315ff6c..1491bf8 100644
@@ -24,15 +24,7 @@
 #define IT913X_PRIV_H
 
 #include "it913x.h"
-
-/* Build in tuner types */
-#define IT9137 0x38
-#define IT9135_38 0x38
-#define IT9135_51 0x51
-#define IT9135_52 0x52
-#define IT9135_60 0x60
-#define IT9135_61 0x61
-#define IT9135_62 0x62
+#include "af9033.h"
 
 #define PRO_LINK		0x0
 #define PRO_DMOD		0x1
Signature · 1 line
1.7.11.7
#24 lore raw

PATCH 21/41 it913x: use dev_foo() logging

In reply to Antti Palosaari
---
 drivers/media/tuners/it913x.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
drivers/media/tuners/it913x.c +11 -5
index 1cb9709..66e003f 100644
@@ -175,7 +175,9 @@ static int it913x_init(struct dvb_frontend *fe)
 	default:
 		set_lna = it9135_38;
 	}
-	pr_info("Tuner LNA type :%02x\n", state->tuner_type);
+
+	dev_dbg(&state->i2c_adap->dev, "%s: Tuner LNA type :%02x\n",
+			KBUILD_MODNAME, state->tuner_type);
 
 	ret = it913x_script_loader(state, set_lna);
 	if (ret < 0)
@@ -226,7 +228,8 @@ static int it913x_init(struct dvb_frontend *fe)
 	}
 	state->tun_fn_min = state->tun_xtal * reg;
 	state->tun_fn_min /= (state->tun_fdiv * nv_val);
-	pr_debug("Tuner fn_min %d\n", state->tun_fn_min);
+	dev_dbg(&state->i2c_adap->dev, "%s: Tuner fn_min %d\n", __func__,
+			state->tun_fn_min);
 
 	if (state->chip_ver > 1)
 		msleep(50);
@@ -272,7 +275,8 @@ static int it9137_set_params(struct dvb_frontend *fe)
 	else
 		set_tuner = set_it9137_template;
 
-	pr_debug("Tuner Frequency %d Bandwidth %d\n", frequency, bandwidth);
+	dev_dbg(&state->i2c_adap->dev, "%s: Tuner Frequency %d Bandwidth %d\n",
+			__func__, frequency, bandwidth);
 
 	if (frequency >= 51000 && frequency <= 440000) {
 		l_band = 0;
@@ -387,13 +391,15 @@ static int it9137_set_params(struct dvb_frontend *fe)
 	set_tuner[3].reg[0] =  temp_f & 0xff;
 	set_tuner[4].reg[0] =  (temp_f >> 8) & 0xff;
 
-	pr_debug("High Frequency = %04x\n", temp_f);
+	dev_dbg(&state->i2c_adap->dev, "%s: High Frequency = %04x\n",
+			__func__, temp_f);
 
 	/* Lower frequency */
 	set_tuner[5].reg[0] =  freq & 0xff;
 	set_tuner[6].reg[0] =  (freq >> 8) & 0xff;
 
-	pr_debug("low Frequency = %04x\n", freq);
+	dev_dbg(&state->i2c_adap->dev, "%s: low Frequency = %04x\n",
+			__func__, freq);
 
 	ret = it913x_script_loader(state, set_tuner);
 
Signature · 1 line
1.7.11.7
#25 lore raw

PATCH 22/41 af9033: add IT9135 demod reg init tables

In reply to Antti Palosaari

Dumped out from Windows driver version 12.07.06.1, 07/06/2012.

---
 drivers/media/dvb-frontends/af9033.c      |   6 +-
 drivers/media/dvb-frontends/af9033_priv.h | 209 ++++++++++++++++++++++++++++++
 2 files changed, 214 insertions(+), 1 deletion(-)
drivers/media/dvb-frontends/af9033.c +5 -1
index f510228..23690aa 100644
@@ -297,10 +297,14 @@ static int af9033_init(struct dvb_frontend *fe)
 	case AF9033_TUNER_IT9135_38:
 	case AF9033_TUNER_IT9135_51:
 	case AF9033_TUNER_IT9135_52:
+		len = ARRAY_SIZE(ofsm_init_it9135_v1);
+		init = ofsm_init_it9135_v1;
+		break;
 	case AF9033_TUNER_IT9135_60:
 	case AF9033_TUNER_IT9135_61:
 	case AF9033_TUNER_IT9135_62:
-		len = 0;
+		len = ARRAY_SIZE(ofsm_init_it9135_v2);
+		init = ofsm_init_it9135_v2;
 		break;
 	default:
 		len = ARRAY_SIZE(ofsm_init);
drivers/media/dvb-frontends/af9033_priv.h +209 -0

214 lines not on this page · raw message

Signature · 1 line
1.7.11.7
#26 lore raw

PATCH 23/41 it913x: remove demod init reg tables

In reply to Antti Palosaari

These are demod inits and are already done by af9033 demod driver.

---
 drivers/media/tuners/it913x.c      |   8 --
 drivers/media/tuners/it913x_priv.h | 211 -------------------------------------
 2 files changed, 219 deletions(-)
drivers/media/tuners/it913x.c +0 -8
index 66e003f..ec4964c 100644
@@ -146,14 +146,6 @@ static int it913x_init(struct dvb_frontend *fe)
 	u8 nv[] = {48, 32, 24, 16, 12, 8, 6, 4, 2};
 	u8 b[2];
 
-	/* v1 or v2 tuner script */
-	if (state->chip_ver > 1)
-		ret = it913x_script_loader(state, it9135_v2);
-	else
-		ret = it913x_script_loader(state, it9135_v1);
-	if (ret < 0)
-		return ret;
-
 	/* LNA Scripts */
 	switch (state->tuner_type) {
 	case AF9033_TUNER_IT9135_51:
drivers/media/tuners/it913x_priv.h +0 -211

223 lines not on this page · raw message

Signature · 1 line
1.7.11.7
#27 lore raw

PATCH 24/41 af9035: select firmware loader according to firmware

In reply to Antti Palosaari

AF9035 and IT9135 supports two different firmware format. Select correct loader according to first byte of firmware file.

---
 drivers/media/usb/dvb-usb-v2/af9035.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/media/usb/dvb-usb-v2/af9035.c +5 -5
index a220a12..0399062 100644
@@ -344,7 +344,7 @@ err:
 	return ret;
 }
 
-static int af9035_download_firmware_af9035(struct dvb_usb_device *d,
+static int af9035_download_firmware_old(struct dvb_usb_device *d,
 		const struct firmware *fw)
 {
 	int ret, i, j, len;
@@ -430,7 +430,7 @@ err:
 	return ret;
 }
 
-static int af9035_download_firmware_it9135(struct dvb_usb_device *d,
+static int af9035_download_firmware_new(struct dvb_usb_device *d,
 		const struct firmware *fw)
 {
 	int ret, i, i_prev;
@@ -540,10 +540,10 @@ static int af9035_download_firmware(struct dvb_usb_device *d,
 		}
 	}
 
-	if (state->chip_type == 0x9135)
-		ret = af9035_download_firmware_it9135(d, fw);
+	if (fw->data[0] == 0x01)
+		ret = af9035_download_firmware_old(d, fw);
 	else
-		ret = af9035_download_firmware_af9035(d, fw);
+		ret = af9035_download_firmware_new(d, fw);
 	if (ret < 0)
 		goto err;
 
Signature · 1 line
1.7.11.7
#28 lore raw

PATCH 25/41 af9035: use already detected eeprom base addr

In reply to Antti Palosaari

eeprom memory mapped base address is detected at the very first. Use it everywhere.

---
 drivers/media/usb/dvb-usb-v2/af9035.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/media/usb/dvb-usb-v2/af9035.c +9 -9
index 0399062..a29169f 100644
@@ -606,18 +606,14 @@ static int af9035_read_config(struct dvb_usb_device *d)
 		if (ret < 0)
 			goto err;
 
-		if (tmp) {
-			addr = EEPROM_BASE_IT9135;
-		} else {
+		if (tmp == 0x00) {
 			dev_dbg(&d->udev->dev, "%s: no eeprom\n", __func__);
 			goto skip_eeprom;
 		}
-	} else {
-		addr = EEPROM_BASE_AF9035;
 	}
 
 	/* check if there is dual tuners */
-	ret = af9035_rd_reg(d, addr + EEPROM_DUAL_MODE, &tmp);
+	ret = af9035_rd_reg(d, state->eeprom_addr + EEPROM_DUAL_MODE, &tmp);
 	if (ret < 0)
 		goto err;
 
@@ -627,7 +623,9 @@ static int af9035_read_config(struct dvb_usb_device *d)
 
 	if (state->dual_mode) {
 		/* read 2nd demodulator I2C address */
-		ret = af9035_rd_reg(d, addr + EEPROM_2ND_DEMOD_ADDR, &tmp);
+		ret = af9035_rd_reg(d,
+				state->eeprom_addr + EEPROM_2ND_DEMOD_ADDR,
+				&tmp);
 		if (ret < 0)
 			goto err;
 
@@ -636,6 +634,8 @@ static int af9035_read_config(struct dvb_usb_device *d)
 				__func__, tmp);
 	}
 
+	addr = state->eeprom_addr;
+
 	for (i = 0; i < state->dual_mode + 1; i++) {
 		/* tuner */
 		ret = af9035_rd_reg(d, addr + EEPROM_1_TUNER_ID, &tmp);
@@ -1258,7 +1258,7 @@ static int af9035_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc)
 	if (state->chip_type == 0x9135)
 		return 0;
 
-	ret = af9035_rd_reg(d, EEPROM_BASE_AF9035 + EEPROM_IR_MODE, &tmp);
+	ret = af9035_rd_reg(d, state->eeprom_addr + EEPROM_IR_MODE, &tmp);
 	if (ret < 0)
 		goto err;
 
@@ -1266,7 +1266,7 @@ static int af9035_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc)
 
 	/* don't activate rc if in HID mode or if not available */
 	if (tmp == 5) {
-		ret = af9035_rd_reg(d, EEPROM_BASE_AF9035 + EEPROM_IR_TYPE,
+		ret = af9035_rd_reg(d, state->eeprom_addr + EEPROM_IR_TYPE,
 				&tmp);
 		if (ret < 0)
 			goto err;
Signature · 1 line
1.7.11.7
#29 lore raw

PATCH 26/41 af9035: set demod TS mode config in read_config()

In reply to Antti Palosaari
---
 drivers/media/usb/dvb-usb-v2/af9035.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/media/usb/dvb-usb-v2/af9035.c +2 -5
index a29169f..7f87b01 100644
@@ -588,6 +588,8 @@ static int af9035_read_config(struct dvb_usb_device *d)
 	state->af9033_config[0].i2c_addr = 0x38;
 	state->af9033_config[0].adc_multiplier = AF9033_ADC_MULTIPLIER_2X;
 	state->af9033_config[1].adc_multiplier = AF9033_ADC_MULTIPLIER_2X;
+	state->af9033_config[0].ts_mode = AF9033_TS_MODE_USB;
+	state->af9033_config[1].ts_mode = AF9033_TS_MODE_SERIAL;
 
 	/* eeprom memory mapped location */
 	if (state->chip_type == 0x9135) {
@@ -903,11 +905,6 @@ static int af9035_frontend_attach(struct dvb_usb_adapter *adap)
 		goto err;
 	}
 
-	if (adap->id == 0) {
-		state->af9033_config[0].ts_mode = AF9033_TS_MODE_USB;
-		state->af9033_config[1].ts_mode = AF9033_TS_MODE_SERIAL;
-	}
-
 	/* attach demodulator */
 	adap->fe[0] = dvb_attach(af9033_attach, &state->af9033_config[adap->id],
 			&d->i2c_adap);
Signature · 1 line
1.7.11.7
#30 lore raw

PATCH 27/41 af9035: enable remote controller for IT9135 too

In reply to Antti Palosaari

There is no difference towards AF9035 remote controller, so enable it.

---
 drivers/media/usb/dvb-usb-v2/af9035.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/media/usb/dvb-usb-v2/af9035.c +0 -4
index 7f87b01..ecec69d 100644
@@ -1251,10 +1251,6 @@ static int af9035_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc)
 	int ret;
 	u8 tmp;
 
-	/* TODO: IT9135 remote control support */
-	if (state->chip_type == 0x9135)
-		return 0;
-
 	ret = af9035_rd_reg(d, state->eeprom_addr + EEPROM_IR_MODE, &tmp);
 	if (ret < 0)
 		goto err;
Signature · 1 line
1.7.11.7
#31 lore raw

PATCH 28/41 af9035: change dual mode boolean to bit field

In reply to Antti Palosaari

For some reason there seems to be value 0x03 in eeprom for dual mode
(and 0x00 for single mode). Boolean is not always 1 bit wide - it could be 8 bit wide too. Storing number 0x03 to boolean causes driver to thing there is 4 tuners in some cases :o

Add also some comments regarding to eeprom.

---
 drivers/media/usb/dvb-usb-v2/af9035.h | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/media/usb/dvb-usb-v2/af9035.h +9 -1
index 59843c7..d934a18 100644
@@ -57,7 +57,7 @@ struct state {
 	u8 prechip_version;
 	u8 chip_version;
 	u16 chip_type;
-	bool dual_mode;
+	u8 dual_mode:1;
 	u16 eeprom_addr;
 	struct af9033_config af9033_config[2];
 };
@@ -94,6 +94,14 @@ static const u32 clock_lut_it9135[] = {
 #define AF9035_FIRMWARE_IT9135_V1 "dvb-usb-it9135-01.fw"
 #define AF9035_FIRMWARE_IT9135_V2 "dvb-usb-it9135-02.fw"
 
+/*
+ * eeprom is memory mapped as read only. Writing that memory mapped address
+ * will not corrupt eeprom.
+ *
+ * eeprom has value 0x00 single mode and 0x03 for dual mode as far as I have
+ * seen to this day.
+ */
+
 #define EEPROM_BASE_AF9035        0x42fd
 #define EEPROM_BASE_IT9135        0x499c
 #define EEPROM_SHIFT                0x10
Signature · 1 line
1.7.11.7
#32 lore raw

PATCH 29/41 af9033: add IT9135 tuner config "38" init table

In reply to Antti Palosaari

Dumped out from the Windows driver version 12.07.06.1

---
 drivers/media/dvb-frontends/af9033.c      |   3 +
 drivers/media/dvb-frontends/af9033_priv.h | 217 ++++++++++++++++++++++++++++++
 2 files changed, 220 insertions(+)
drivers/media/dvb-frontends/af9033.c +3 -0
index 23690aa..1386d29 100644
@@ -347,6 +347,9 @@ static int af9033_init(struct dvb_frontend *fe)
 		init = tuner_init_fc0012;
 		break;
 	case AF9033_TUNER_IT9135_38:
+		len = ARRAY_SIZE(tuner_init_it9135_38);
+		init = tuner_init_it9135_38;
+		break;
 	case AF9033_TUNER_IT9135_51:
 	case AF9033_TUNER_IT9135_52:
 	case AF9033_TUNER_IT9135_60:
drivers/media/dvb-frontends/af9033_priv.h +217 -0

223 lines not on this page · raw message

Signature · 1 line
1.7.11.7
#33 lore raw

PATCH 30/41 af9033: add IT9135 tuner config "51" init table

In reply to Antti Palosaari

Dumped out from the Windows driver version 12.07.06.1

---
 drivers/media/dvb-frontends/af9033.c      |   3 +
 drivers/media/dvb-frontends/af9033_priv.h | 217 ++++++++++++++++++++++++++++++
 2 files changed, 220 insertions(+)
drivers/media/dvb-frontends/af9033.c +3 -0
index 1386d29..d6fc566 100644
@@ -351,6 +351,9 @@ static int af9033_init(struct dvb_frontend *fe)
 		init = tuner_init_it9135_38;
 		break;
 	case AF9033_TUNER_IT9135_51:
+		len = ARRAY_SIZE(tuner_init_it9135_51);
+		init = tuner_init_it9135_51;
+		break;
 	case AF9033_TUNER_IT9135_52:
 	case AF9033_TUNER_IT9135_60:
 	case AF9033_TUNER_IT9135_61:
drivers/media/dvb-frontends/af9033_priv.h +217 -0

223 lines not on this page · raw message

Signature · 1 line
1.7.11.7
#34 lore raw

PATCH 31/41 af9033: add IT9135 tuner config "52" init table

In reply to Antti Palosaari

Dumped out from the Windows driver version 12.07.06.1

---
 drivers/media/dvb-frontends/af9033.c      |   3 +
 drivers/media/dvb-frontends/af9033_priv.h | 217 ++++++++++++++++++++++++++++++
 2 files changed, 220 insertions(+)
drivers/media/dvb-frontends/af9033.c +3 -0
index d6fc566..920c875 100644
@@ -355,6 +355,9 @@ static int af9033_init(struct dvb_frontend *fe)
 		init = tuner_init_it9135_51;
 		break;
 	case AF9033_TUNER_IT9135_52:
+		len = ARRAY_SIZE(tuner_init_it9135_52);
+		init = tuner_init_it9135_52;
+		break;
 	case AF9033_TUNER_IT9135_60:
 	case AF9033_TUNER_IT9135_61:
 	case AF9033_TUNER_IT9135_62:
drivers/media/dvb-frontends/af9033_priv.h +217 -0

223 lines not on this page · raw message

Signature · 1 line
1.7.11.7
#35 lore raw

PATCH 32/41 af9033: add IT9135 tuner config "60" init table

In reply to Antti Palosaari

Dumped out from the Windows driver version 12.07.06.1

---
 drivers/media/dvb-frontends/af9033.c      |   3 +
 drivers/media/dvb-frontends/af9033_priv.h | 215 ++++++++++++++++++++++++++++++
 2 files changed, 218 insertions(+)
drivers/media/dvb-frontends/af9033.c +3 -0
index 920c875..9359dbd 100644
@@ -359,6 +359,9 @@ static int af9033_init(struct dvb_frontend *fe)
 		init = tuner_init_it9135_52;
 		break;
 	case AF9033_TUNER_IT9135_60:
+		len = ARRAY_SIZE(tuner_init_it9135_60);
+		init = tuner_init_it9135_60;
+		break;
 	case AF9033_TUNER_IT9135_61:
 	case AF9033_TUNER_IT9135_62:
 		len = 0;
drivers/media/dvb-frontends/af9033_priv.h +215 -0

220 lines not on this page · raw message

Signature · 1 line
1.7.11.7
#36 lore raw

PATCH 33/41 af9033: add IT9135 tuner config "61" init table

In reply to Antti Palosaari

Dumped out from the Windows driver version 12.07.06.1

---
 drivers/media/dvb-frontends/af9033.c      |   3 +
 drivers/media/dvb-frontends/af9033_priv.h | 216 +++++++++++++++++++++++++++++-
 2 files changed, 218 insertions(+), 1 deletion(-)
drivers/media/dvb-frontends/af9033.c +3 -0
index 9359dbd..c3c3a6d 100644
@@ -363,6 +363,9 @@ static int af9033_init(struct dvb_frontend *fe)
 		init = tuner_init_it9135_60;
 		break;
 	case AF9033_TUNER_IT9135_61:
+		len = ARRAY_SIZE(tuner_init_it9135_61);
+		init = tuner_init_it9135_61;
+		break;
 	case AF9033_TUNER_IT9135_62:
 		len = 0;
 		break;
drivers/media/dvb-frontends/af9033_priv.h +215 -1

220 lines not on this page · raw message

Signature · 1 line
1.7.11.7
#37 lore raw

PATCH 34/41 af9033: add IT9135 tuner config "62" init table

In reply to Antti Palosaari

Dumped out from the Windows driver version 12.07.06.1

---
 drivers/media/dvb-frontends/af9033.c      |   3 +-
 drivers/media/dvb-frontends/af9033_priv.h | 215 ++++++++++++++++++++++++++++++
 2 files changed, 217 insertions(+), 1 deletion(-)
drivers/media/dvb-frontends/af9033.c +2 -1
index c3c3a6d..847a9b6 100644
@@ -367,7 +367,8 @@ static int af9033_init(struct dvb_frontend *fe)
 		init = tuner_init_it9135_61;
 		break;
 	case AF9033_TUNER_IT9135_62:
-		len = 0;
+		len = ARRAY_SIZE(tuner_init_it9135_62);
+		init = tuner_init_it9135_62;
 		break;
 	default:
 		dev_dbg(&state->i2c->dev, "%s: unsupported tuner ID=%d\n",
drivers/media/dvb-frontends/af9033_priv.h +215 -0

219 lines not on this page · raw message

Signature · 1 line
1.7.11.7
#38 lore raw

PATCH 35/41 it913x: remove unused af9033 demod tuner config inits

In reply to Antti Palosaari

Those are demodulator init tables according to used tuner tuner config. af9033 demod driver does those inits currently and due to that these duplicate inits could be removed.

---
 drivers/media/dvb-frontends/af9033.c |   6 -
 drivers/media/tuners/it913x.c        |  30 --
 drivers/media/tuners/it913x_priv.h   | 558 -----------------------------------
 3 files changed, 594 deletions(-)
drivers/media/dvb-frontends/af9033.c +0 -6
index 847a9b6..0320747 100644
@@ -285,12 +285,6 @@ static int af9033_init(struct dvb_frontend *fe)
 			goto err;
 	}
 
-	/*
-	 * FIXME: These inits are logically property of demodulator driver
-	 * (that driver), but currently in case of IT9135 those are done by
-	 * tuner driver.
-	 */
-
 	/* load OFSM settings */
 	dev_dbg(&state->i2c->dev, "%s: load ofsm settings\n", __func__);
 	switch (state->cfg.tuner) {
drivers/media/tuners/it913x.c +0 -30
index ec4964c..2c60bf7 100644
@@ -141,40 +141,10 @@ static int it913x_init(struct dvb_frontend *fe)
 {
 	struct it913x_state *state = fe->tuner_priv;
 	int ret, i, reg;
-	struct it913xset *set_lna;
 	u8 val, nv_val;
 	u8 nv[] = {48, 32, 24, 16, 12, 8, 6, 4, 2};
 	u8 b[2];
 
-	/* LNA Scripts */
-	switch (state->tuner_type) {
-	case AF9033_TUNER_IT9135_51:
-		set_lna = it9135_51;
-		break;
-	case AF9033_TUNER_IT9135_52:
-		set_lna = it9135_52;
-		break;
-	case AF9033_TUNER_IT9135_60:
-		set_lna = it9135_60;
-		break;
-	case AF9033_TUNER_IT9135_61:
-		set_lna = it9135_61;
-		break;
-	case AF9033_TUNER_IT9135_62:
-		set_lna = it9135_62;
-		break;
-	case AF9033_TUNER_IT9135_38:
-	default:
-		set_lna = it9135_38;
-	}
-
-	dev_dbg(&state->i2c_adap->dev, "%s: Tuner LNA type :%02x\n",
-			KBUILD_MODNAME, state->tuner_type);
-
-	ret = it913x_script_loader(state, set_lna);
-	if (ret < 0)
-		return ret;
-
 	if (state->chip_ver == 2) {
 		ret = it913x_wr_reg(state, PRO_DMOD, TRIGGER_OFSM, 0x1);
 		if (ret < 0)
drivers/media/tuners/it913x_priv.h +0 -558

564 lines not on this page · raw message

Signature · 1 line
1.7.11.7
#39 lore raw

PATCH 36/41 af9033: move code from it913x to af9033

In reply to Antti Palosaari

That register is property of demodulator so move it correct place.

---
 drivers/media/dvb-frontends/af9033.c | 9 +++++++++
 drivers/media/tuners/it913x.c        | 6 ------
 2 files changed, 9 insertions(+), 6 deletions(-)
drivers/media/dvb-frontends/af9033.c +9 -0
index 0320747..8e3a99d 100644
@@ -391,6 +391,15 @@ static int af9033_init(struct dvb_frontend *fe)
 			goto err;
 	}
 
+	switch (state->cfg.tuner) {
+	case AF9033_TUNER_IT9135_60:
+	case AF9033_TUNER_IT9135_61:
+	case AF9033_TUNER_IT9135_62:
+		ret = af9033_wr_reg(state, 0x800000, 0x01);
+		if (ret < 0)
+			goto err;
+	}
+
 	state->bandwidth_hz = 0; /* force to program all parameters */
 
 	return 0;
drivers/media/tuners/it913x.c +0 -6
index 2c60bf7..4d7a247 100644
@@ -145,12 +145,6 @@ static int it913x_init(struct dvb_frontend *fe)
 	u8 nv[] = {48, 32, 24, 16, 12, 8, 6, 4, 2};
 	u8 b[2];
 
-	if (state->chip_ver == 2) {
-		ret = it913x_wr_reg(state, PRO_DMOD, TRIGGER_OFSM, 0x1);
-		if (ret < 0)
-			return -ENODEV;
-	}
-
 	reg = it913x_rd_reg(state, 0xec86);
 	switch (reg) {
 	case 0:
Signature · 1 line
1.7.11.7
#40 lore raw

PATCH 37/41 af9033: sleep on attach()

In reply to Antti Palosaari
---
 drivers/media/dvb-frontends/af9033.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/media/dvb-frontends/af9033.c +11 -4
index 8e3a99d..2dba516 100644
@@ -985,10 +985,17 @@ struct dvb_frontend *af9033_attach(const struct af9033_config *config,
 			"OFDM=%d.%d.%d.%d\n", KBUILD_MODNAME, buf[0], buf[1],
 			buf[2], buf[3], buf[4], buf[5], buf[6], buf[7]);
 
-
-	/* FIXME: Do not abuse adc_multiplier for detecting IT9135 */
-	if (state->cfg.adc_multiplier != AF9033_ADC_MULTIPLIER_2X) {
-		/* sleep */
+	/* sleep */
+	switch (state->cfg.tuner) {
+	case AF9033_TUNER_IT9135_38:
+	case AF9033_TUNER_IT9135_51:
+	case AF9033_TUNER_IT9135_52:
+	case AF9033_TUNER_IT9135_60:
+	case AF9033_TUNER_IT9135_61:
+	case AF9033_TUNER_IT9135_62:
+		/* IT9135 did not like to sleep at that early */
+		break;
+	default:
 		ret = af9033_wr_reg(state, 0x80004c, 1);
 		if (ret < 0)
 			goto err;
Signature · 1 line
1.7.11.7
#41 lore raw

PATCH 38/41 af9033: implement i/o optimized reg table writer

In reply to Antti Palosaari

Use register address auto increment to reduce I/O when large register / values tables are written.

---
 drivers/media/dvb-frontends/af9033.c | 47 ++++++++++++++++++++++++++++--------
 1 file changed, 37 insertions(+), 10 deletions(-)
drivers/media/dvb-frontends/af9033.c +37 -10
index 2dba516..a777b4b 100644
@@ -156,6 +156,37 @@ static int af9033_rd_reg_mask(struct af9033_state *state, u32 reg, u8 *val,
 	return 0;
 }
 
+/* write reg val table using reg addr auto increment */
+static int af9033_wr_reg_val_tab(struct af9033_state *state,
+		const struct reg_val *tab, int tab_len)
+{
+	int ret, i, j;
+	u8 buf[tab_len];
+
+	dev_dbg(&state->i2c->dev, "%s: tab_len=%d\n", __func__, tab_len);
+
+	for (i = 0, j = 0; i < tab_len; i++) {
+		buf[j] = tab[i].val;
+
+		if (i == tab_len - 1 || tab[i].reg != tab[i + 1].reg - 1) {
+			ret = af9033_wr_regs(state, tab[i].reg - j, buf, j + 1);
+			if (ret < 0)
+				goto err;
+
+			j = 0;
+		} else {
+			j++;
+		}
+	}
+
+	return 0;
+
+err:
+	dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret);
+
+	return ret;
+}
+
 static u32 af9033_div(struct af9033_state *state, u32 a, u32 b, u32 x)
 {
 	u32 r = 0, c = 0, i;
@@ -306,11 +337,9 @@ static int af9033_init(struct dvb_frontend *fe)
 		break;
 	}
 
-	for (i = 0; i < len; i++) {
-		ret = af9033_wr_reg(state, init[i].reg, init[i].val);
-		if (ret < 0)
-			goto err;
-	}
+	ret = af9033_wr_reg_val_tab(state, init, len);
+	if (ret < 0)
+		goto err;
 
 	/* load tuner specific settings */
 	dev_dbg(&state->i2c->dev, "%s: load tuner specific settings\n",
@@ -371,11 +400,9 @@ static int af9033_init(struct dvb_frontend *fe)
 		goto err;
 	}
 
-	for (i = 0; i < len; i++) {
-		ret = af9033_wr_reg(state, init[i].reg, init[i].val);
-		if (ret < 0)
-			goto err;
-	}
+	ret = af9033_wr_reg_val_tab(state, init, len);
+	if (ret < 0)
+		goto err;
 
 	if (state->cfg.ts_mode == AF9033_TS_MODE_SERIAL) {
 		ret = af9033_wr_reg_mask(state, 0x00d91c, 0x01, 0x01);
Signature · 1 line
1.7.11.7
#42 lore raw

PATCH 39/41 af9035: check I/O errors on IR polling

In reply to Antti Palosaari

Use more careful error checks.

---
 drivers/media/usb/dvb-usb-v2/af9035.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
drivers/media/usb/dvb-usb-v2/af9035.c +12 -3
index ecec69d..a1ae5c5 100644
@@ -98,6 +98,10 @@ static int af9035_ctrl_msg(struct dvb_usb_device *d, struct usb_req *req)
 
 	/* check status */
 	if (buf[2]) {
+		/* fw returns status 1 when IR code was not received */
+		if (req->cmd == CMD_IR_GET || buf[2] == 1)
+			return 1;
+
 		dev_dbg(&d->udev->dev, "%s: command=%02x failed fw error=%d\n",
 				__func__, req->cmd, buf[2]);
 		ret = -EIO;
@@ -1223,7 +1227,9 @@ static int af9035_rc_query(struct dvb_usb_device *d)
 	struct usb_req req = { CMD_IR_GET, 0, 0, NULL, 4, b };
 
 	ret = af9035_ctrl_msg(d, &req);
-	if (ret < 0)
+	if (ret == 1)
+		return 0;
+	else if (ret < 0)
 		goto err;
 
 	if ((b[2] + b[3]) == 0xff) {
@@ -1240,9 +1246,12 @@ static int af9035_rc_query(struct dvb_usb_device *d)
 
 	rc_keydown(d->rc_dev, key, 0);
 
-err:
-	/* ignore errors */
 	return 0;
+
+err:
+	dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
+
+	return ret;
 }
 
 static int af9035_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc)
Signature · 1 line
1.7.11.7
#43 lore raw

PATCH 40/41 af9035: style changes for remote controller polling

In reply to Antti Palosaari
---
 drivers/media/usb/dvb-usb-v2/af9035.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)
drivers/media/usb/dvb-usb-v2/af9035.c +13 -10
index a1ae5c5..c35fab8 100644
@@ -1221,10 +1221,10 @@ err:
 #if IS_ENABLED(CONFIG_RC_CORE)
 static int af9035_rc_query(struct dvb_usb_device *d)
 {
-	unsigned int key;
-	unsigned char b[4];
 	int ret;
-	struct usb_req req = { CMD_IR_GET, 0, 0, NULL, 4, b };
+	u32 key;
+	u8 buf[4];
+	struct usb_req req = { CMD_IR_GET, 0, 0, NULL, 4, buf };
 
 	ret = af9035_ctrl_msg(d, &req);
 	if (ret == 1)
@@ -1232,18 +1232,21 @@ static int af9035_rc_query(struct dvb_usb_device *d)
 	else if (ret < 0)
 		goto err;
 
-	if ((b[2] + b[3]) == 0xff) {
-		if ((b[0] + b[1]) == 0xff) {
-			/* NEC */
-			key = b[0] << 8 | b[2];
+	if ((buf[2] + buf[3]) == 0xff) {
+		if ((buf[0] + buf[1]) == 0xff) {
+			/* NEC standard 16bit */
+			key = buf[0] << 8 | buf[2];
 		} else {
-			/* ext. NEC */
-			key = b[0] << 16 | b[1] << 8 | b[2];
+			/* NEC extended 24bit */
+			key = buf[0] << 16 | buf[1] << 8 | buf[2];
 		}
 	} else {
-		key = b[0] << 24 | b[1] << 16 | b[2] << 8 | b[3];
+		/* NEC full code 32bit */
+		key = buf[0] << 24 | buf[1] << 16 | buf[2] << 8 | buf[3];
 	}
 
+	dev_dbg(&d->udev->dev, "%s: %*ph\n", __func__, 4, buf);
+
 	rc_keydown(d->rc_dev, key, 0);
 
 	return 0;
Signature · 1 line
1.7.11.7
#44 lore raw

PATCH 41/41 MAINTAINERS: add drivers/media/tuners/it913x*

In reply to Antti Palosaari
---
 MAINTAINERS | 10 ++++++++++
 1 file changed, 10 insertions(+)
MAINTAINERS +10 -0
index ff2fcc9..ded88d3 100644
@@ -4418,6 +4418,16 @@ Q:	http://patchwork.linuxtv.org/project/linux-media/list/
 S:	Maintained
 F:	drivers/media/dvb-frontends/it913x-fe*
 
+IT913X MEDIA DRIVER
+M:	Antti Palosaari <[email protected]>
+L:	[email protected]
+W:	http://linuxtv.org/
+W:	http://palosaari.fi/linux/
+Q:	http://patchwork.linuxtv.org/project/linux-media/list/
+T:	git git://linuxtv.org/anttip/media_tree.git
+S:	Maintained
+F:	drivers/media/tuners/it913x*
+
 IVTV VIDEO4LINUX DRIVER
 M:	Andy Walls <[email protected]>
 L:	[email protected] (moderated for non-subscribers)
Signature · 1 line
1.7.11.7