* [PATCH 0/6] [0b48:3014] TechnoTrend TVStick CT2-4400
@ 2014-07-13 13:52 Olli Salonen
2014-07-13 13:52 ` [PATCH 1/6] si2168: Small typo fix (SI2157 -> SI2168) Olli Salonen
` (6 more replies)
0 siblings, 7 replies; 14+ messages in thread
From: Olli Salonen @ 2014-07-13 13:52 UTC (permalink / raw)
To: linux-media; +Cc: Olli Salonen
TechnoTrend TVStick CT2-4400 is a USB 2.0 DVB C/T/T2 tuner with the
following components.
USB bridge: Cypress FX2
Demodulator: Silicon Labs Si2168-A30
Tuner: Silicon Labs Si2158-A20
Both the demodulator and the tuner need a firmware. These can be
extracted from TT drivers.
Download: http://www.tt-downloads.de/bda-treiber_4.2.0.0.zip
Extract firmware from file ttTVStick4400_64.sys in the zip (MD5 sum below):
0276023ce027bab05c2e7053033e2182 ttTVStick4400_64.sys
dd if=ttTVStick4400_64.sys ibs=1 skip=211216 count=17576 of=dvb-demod-si2168-30-01.fw
dd if=ttTVStick4400_64.sys ibs=1 skip=200816 count=3944 of=dvb-tuner-si2158-20-01.fw
Olli Salonen (6):
si2168: Small typo fix (SI2157 -> SI2168)
si2168: Add handling for different chip revisions and firmwares
si2157: Move chip initialization to si2157_init
si2157: Add support for Si2158 chip
si2157: Set delivery system and bandwidth before tuning
cxusb: TechnoTrend CT2-4400 USB DVB-T2/C tuner support
drivers/media/dvb-core/dvb-usb-ids.h | 1 +
drivers/media/dvb-frontends/si2168.c | 34 +++++-
drivers/media/dvb-frontends/si2168_priv.h | 8 +-
drivers/media/tuners/si2157.c | 161 +++++++++++++++++++------
drivers/media/tuners/si2157.h | 2 +-
drivers/media/tuners/si2157_priv.h | 5 +-
drivers/media/usb/dvb-usb/Kconfig | 3 +
drivers/media/usb/dvb-usb/cxusb.c | 191 +++++++++++++++++++++++++++++-
drivers/media/usb/dvb-usb/cxusb.h | 2 +
9 files changed, 357 insertions(+), 50 deletions(-)
--
1.9.1
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 1/6] si2168: Small typo fix (SI2157 -> SI2168)
2014-07-13 13:52 [PATCH 0/6] [0b48:3014] TechnoTrend TVStick CT2-4400 Olli Salonen
@ 2014-07-13 13:52 ` Olli Salonen
2014-07-13 17:14 ` Antti Palosaari
2014-07-13 13:52 ` [PATCH 2/6] si2168: Add handling for different chip revisions and firmwares Olli Salonen
` (5 subsequent siblings)
6 siblings, 1 reply; 14+ messages in thread
From: Olli Salonen @ 2014-07-13 13:52 UTC (permalink / raw)
To: linux-media; +Cc: Olli Salonen
Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
---
drivers/media/dvb-frontends/si2168_priv.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/media/dvb-frontends/si2168_priv.h b/drivers/media/dvb-frontends/si2168_priv.h
index 53f7f06..97f9d87 100644
--- a/drivers/media/dvb-frontends/si2168_priv.h
+++ b/drivers/media/dvb-frontends/si2168_priv.h
@@ -36,9 +36,9 @@ struct si2168 {
};
/* firmare command struct */
-#define SI2157_ARGLEN 30
+#define SI2168_ARGLEN 30
struct si2168_cmd {
- u8 args[SI2157_ARGLEN];
+ u8 args[SI2168_ARGLEN];
unsigned wlen;
unsigned rlen;
};
--
1.9.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 2/6] si2168: Add handling for different chip revisions and firmwares
2014-07-13 13:52 [PATCH 0/6] [0b48:3014] TechnoTrend TVStick CT2-4400 Olli Salonen
2014-07-13 13:52 ` [PATCH 1/6] si2168: Small typo fix (SI2157 -> SI2168) Olli Salonen
@ 2014-07-13 13:52 ` Olli Salonen
2014-07-13 17:14 ` Antti Palosaari
2014-07-13 13:52 ` [PATCH 3/6] si2157: Move chip initialization to si2157_init Olli Salonen
` (4 subsequent siblings)
6 siblings, 1 reply; 14+ messages in thread
From: Olli Salonen @ 2014-07-13 13:52 UTC (permalink / raw)
To: linux-media; +Cc: Olli Salonen
Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
---
drivers/media/dvb-frontends/si2168.c | 34 ++++++++++++++++++++++++++-----
drivers/media/dvb-frontends/si2168_priv.h | 4 +++-
2 files changed, 32 insertions(+), 6 deletions(-)
diff --git a/drivers/media/dvb-frontends/si2168.c b/drivers/media/dvb-frontends/si2168.c
index bae7771..268fce3 100644
--- a/drivers/media/dvb-frontends/si2168.c
+++ b/drivers/media/dvb-frontends/si2168.c
@@ -333,7 +333,7 @@ static int si2168_init(struct dvb_frontend *fe)
struct si2168 *s = fe->demodulator_priv;
int ret, len, remaining;
const struct firmware *fw = NULL;
- u8 *fw_file = SI2168_FIRMWARE;
+ u8 *fw_file;
const unsigned int i2c_wr_max = 8;
struct si2168_cmd cmd;
@@ -353,6 +353,7 @@ static int si2168_init(struct dvb_frontend *fe)
if (ret)
goto err;
+ /* query chip revision */
memcpy(cmd.args, "\x02", 1);
cmd.wlen = 1;
cmd.rlen = 13;
@@ -360,6 +361,20 @@ static int si2168_init(struct dvb_frontend *fe)
if (ret)
goto err;
+ if (((cmd.args[1] & 0x0f) == 2) && (cmd.args[3] == '4') &&
+ (cmd.args[4] == '0'))
+ fw_file = SI2168_B40_FIRMWARE;
+ else if (((cmd.args[1] & 0x0f) == 1) && (cmd.args[3] == '3') &&
+ (cmd.args[4] == '0'))
+ fw_file = SI2168_A30_FIRMWARE;
+ else {
+ dev_err(&s->client->dev,
+ "%s: no firmware file for Si2168-%c%c defined\n",
+ KBUILD_MODNAME, cmd.args[3], cmd.args[4]);
+ ret = -EINVAL;
+ goto err;
+ }
+
/* cold state - try to download firmware */
dev_info(&s->client->dev, "%s: found a '%s' in cold state\n",
KBUILD_MODNAME, si2168_ops.info.name);
@@ -367,9 +382,18 @@ static int si2168_init(struct dvb_frontend *fe)
/* request the firmware, this will block and timeout */
ret = request_firmware(&fw, fw_file, &s->client->dev);
if (ret) {
- dev_err(&s->client->dev, "%s: firmare file '%s' not found\n",
- KBUILD_MODNAME, fw_file);
- goto err;
+ /* fallback mechanism to handle old name for
+ SI2168_B40_FIRMWARE */
+ if (((cmd.args[1] & 0x0f) == 2) && (cmd.args[3] == '4') &&
+ (cmd.args[4] == '0')) {
+ fw_file = SI2168_B40_FIRMWARE_FALLBACK;
+ ret = request_firmware(&fw, fw_file, &s->client->dev);
+ }
+ if (ret) {
+ dev_err(&s->client->dev, "%s: firmware file '%s' not found\n",
+ KBUILD_MODNAME, fw_file);
+ goto err;
+ }
}
dev_info(&s->client->dev, "%s: downloading firmware from file '%s'\n",
@@ -629,4 +653,4 @@ module_i2c_driver(si2168_driver);
MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>");
MODULE_DESCRIPTION("Silicon Labs Si2168 DVB-T/T2/C demodulator driver");
MODULE_LICENSE("GPL");
-MODULE_FIRMWARE(SI2168_FIRMWARE);
+MODULE_FIRMWARE(SI2168_B40_FIRMWARE);
diff --git a/drivers/media/dvb-frontends/si2168_priv.h b/drivers/media/dvb-frontends/si2168_priv.h
index 97f9d87..bebb68a 100644
--- a/drivers/media/dvb-frontends/si2168_priv.h
+++ b/drivers/media/dvb-frontends/si2168_priv.h
@@ -22,7 +22,9 @@
#include <linux/firmware.h>
#include <linux/i2c-mux.h>
-#define SI2168_FIRMWARE "dvb-demod-si2168-02.fw"
+#define SI2168_A30_FIRMWARE "dvb-demod-si2168-a30-01.fw"
+#define SI2168_B40_FIRMWARE "dvb-demod-si2168-b40-01.fw"
+#define SI2168_B40_FIRMWARE_FALLBACK "dvb-demod-si2168-02.fw"
/* state struct */
struct si2168 {
--
1.9.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 3/6] si2157: Move chip initialization to si2157_init
2014-07-13 13:52 [PATCH 0/6] [0b48:3014] TechnoTrend TVStick CT2-4400 Olli Salonen
2014-07-13 13:52 ` [PATCH 1/6] si2168: Small typo fix (SI2157 -> SI2168) Olli Salonen
2014-07-13 13:52 ` [PATCH 2/6] si2168: Add handling for different chip revisions and firmwares Olli Salonen
@ 2014-07-13 13:52 ` Olli Salonen
2014-07-13 17:14 ` Antti Palosaari
2014-07-13 13:52 ` [PATCH 4/6] si2157: Add support for Si2158 chip Olli Salonen
` (3 subsequent siblings)
6 siblings, 1 reply; 14+ messages in thread
From: Olli Salonen @ 2014-07-13 13:52 UTC (permalink / raw)
To: linux-media; +Cc: Olli Salonen
Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
---
drivers/media/tuners/si2157.c | 71 ++++++++++++++++++-------------------------
1 file changed, 30 insertions(+), 41 deletions(-)
diff --git a/drivers/media/tuners/si2157.c b/drivers/media/tuners/si2157.c
index a4908ee..a92570f9 100644
--- a/drivers/media/tuners/si2157.c
+++ b/drivers/media/tuners/si2157.c
@@ -80,12 +80,41 @@ err:
static int si2157_init(struct dvb_frontend *fe)
{
struct si2157 *s = fe->tuner_priv;
+ int ret;
+ struct si2157_cmd cmd;
dev_dbg(&s->client->dev, "%s:\n", __func__);
+ /* configure? */
+ memcpy(cmd.args, "\xc0\x00\x0c\x00\x00\x01\x01\x01\x01\x01\x01\x02\x00\x00\x01", 15);
+ cmd.wlen = 15;
+ cmd.rlen = 1;
+ ret = si2157_cmd_execute(s, &cmd);
+ if (ret)
+ goto err;
+
+ /* query chip revision */
+ memcpy(cmd.args, "\x02", 1);
+ cmd.wlen = 1;
+ cmd.rlen = 13;
+ ret = si2157_cmd_execute(s, &cmd);
+ if (ret)
+ goto err;
+
+ /* reboot the tuner with new firmware? */
+ memcpy(cmd.args, "\x01\x01", 2);
+ cmd.wlen = 2;
+ cmd.rlen = 1;
+ ret = si2157_cmd_execute(s, &cmd);
+ if (ret)
+ goto err;
+
s->active = true;
return 0;
+err:
+ dev_dbg(&s->client->dev, "%s: failed=%d\n", __func__, ret);
+ return ret;
}
static int si2157_sleep(struct dvb_frontend *fe)
@@ -128,48 +157,8 @@ static int si2157_set_params(struct dvb_frontend *fe)
goto err;
}
- /* configure? */
- cmd.args[0] = 0xc0;
- cmd.args[1] = 0x00;
- cmd.args[2] = 0x0c;
- cmd.args[3] = 0x00;
- cmd.args[4] = 0x00;
- cmd.args[5] = 0x01;
- cmd.args[6] = 0x01;
- cmd.args[7] = 0x01;
- cmd.args[8] = 0x01;
- cmd.args[9] = 0x01;
- cmd.args[10] = 0x01;
- cmd.args[11] = 0x02;
- cmd.args[12] = 0x00;
- cmd.args[13] = 0x00;
- cmd.args[14] = 0x01;
- cmd.wlen = 15;
- cmd.rlen = 1;
- ret = si2157_cmd_execute(s, &cmd);
- if (ret)
- goto err;
-
- cmd.args[0] = 0x02;
- cmd.wlen = 1;
- cmd.rlen = 13;
- ret = si2157_cmd_execute(s, &cmd);
- if (ret)
- goto err;
-
- cmd.args[0] = 0x01;
- cmd.args[1] = 0x01;
- cmd.wlen = 2;
- cmd.rlen = 1;
- ret = si2157_cmd_execute(s, &cmd);
- if (ret)
- goto err;
-
/* set frequency */
- cmd.args[0] = 0x41;
- cmd.args[1] = 0x00;
- cmd.args[2] = 0x00;
- cmd.args[3] = 0x00;
+ memcpy(cmd.args, "\x41\x00\x00\x00\x00\x00\x00\x00", 8);
cmd.args[4] = (c->frequency >> 0) & 0xff;
cmd.args[5] = (c->frequency >> 8) & 0xff;
cmd.args[6] = (c->frequency >> 16) & 0xff;
--
1.9.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 4/6] si2157: Add support for Si2158 chip
2014-07-13 13:52 [PATCH 0/6] [0b48:3014] TechnoTrend TVStick CT2-4400 Olli Salonen
` (2 preceding siblings ...)
2014-07-13 13:52 ` [PATCH 3/6] si2157: Move chip initialization to si2157_init Olli Salonen
@ 2014-07-13 13:52 ` Olli Salonen
2014-07-13 17:14 ` Antti Palosaari
2014-07-13 13:52 ` [PATCH 5/6] si2157: Set delivery system and bandwidth before tuning Olli Salonen
` (2 subsequent siblings)
6 siblings, 1 reply; 14+ messages in thread
From: Olli Salonen @ 2014-07-13 13:52 UTC (permalink / raw)
To: linux-media; +Cc: Olli Salonen
Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
---
drivers/media/tuners/si2157.c | 73 +++++++++++++++++++++++++++++++++++---
drivers/media/tuners/si2157.h | 2 +-
drivers/media/tuners/si2157_priv.h | 5 ++-
3 files changed, 73 insertions(+), 7 deletions(-)
diff --git a/drivers/media/tuners/si2157.c b/drivers/media/tuners/si2157.c
index a92570f9..58c5ef5 100644
--- a/drivers/media/tuners/si2157.c
+++ b/drivers/media/tuners/si2157.c
@@ -1,5 +1,5 @@
/*
- * Silicon Labs Si2157 silicon tuner driver
+ * Silicon Labs Si2157/2158 silicon tuner driver
*
* Copyright (C) 2014 Antti Palosaari <crope@iki.fi>
*
@@ -16,6 +16,8 @@
#include "si2157_priv.h"
+static const struct dvb_tuner_ops si2157_ops;
+
/* execute firmware command */
static int si2157_cmd_execute(struct si2157 *s, struct si2157_cmd *cmd)
{
@@ -80,8 +82,11 @@ err:
static int si2157_init(struct dvb_frontend *fe)
{
struct si2157 *s = fe->tuner_priv;
- int ret;
+ int ret, remaining;
struct si2157_cmd cmd;
+ u8 chip, len = 0;
+ const struct firmware *fw = NULL;
+ u8 *fw_file;
dev_dbg(&s->client->dev, "%s:\n", __func__);
@@ -101,6 +106,64 @@ static int si2157_init(struct dvb_frontend *fe)
if (ret)
goto err;
+ chip = cmd.args[2]; /* 57 for Si2157, 58 for Si2158 */
+
+ /* Si2158 requires firmware download */
+ if (chip == 58) {
+ if (((cmd.args[1] & 0x0f) == 1) && (cmd.args[3] == '2') &&
+ (cmd.args[4] == '0'))
+ fw_file = SI2158_A20_FIRMWARE;
+ else {
+ dev_err(&s->client->dev,
+ "%s: no firmware file for Si%d-%c%c defined\n",
+ KBUILD_MODNAME, chip, cmd.args[3], cmd.args[4]);
+ ret = -EINVAL;
+ goto err;
+ }
+
+ /* cold state - try to download firmware */
+ dev_info(&s->client->dev, "%s: found a '%s' in cold state\n",
+ KBUILD_MODNAME, si2157_ops.info.name);
+
+ /* request the firmware, this will block and timeout */
+ ret = request_firmware(&fw, fw_file, &s->client->dev);
+ if (ret) {
+ dev_err(&s->client->dev, "%s: firmware file '%s' not found\n",
+ KBUILD_MODNAME, fw_file);
+ goto err;
+ }
+
+ dev_info(&s->client->dev, "%s: downloading firmware from file '%s'\n",
+ KBUILD_MODNAME, fw_file);
+
+ /* firmware should be n chunks of 17 bytes */
+ if (fw->size % 17 != 0) {
+ dev_err(&s->client->dev, "%s: firmware file '%s' is invalid\n",
+ KBUILD_MODNAME, fw_file);
+ ret = -EINVAL;
+ goto err;
+ }
+
+ for (remaining = fw->size; remaining > 0; remaining -= 17) {
+ memcpy(&len, &fw->data[fw->size - remaining], 1);
+ memcpy(cmd.args, &fw->data[(fw->size - remaining) + 1],
+ len);
+ cmd.wlen = len;
+ cmd.rlen = 1;
+ ret = si2157_cmd_execute(s, &cmd);
+ if (ret) {
+ dev_err(&s->client->dev,
+ "%s: firmware download failed=%d\n",
+ KBUILD_MODNAME, ret);
+ goto err;
+ }
+ }
+
+ release_firmware(fw);
+ fw = NULL;
+
+ }
+
/* reboot the tuner with new firmware? */
memcpy(cmd.args, "\x01\x01", 2);
cmd.wlen = 2;
@@ -177,7 +240,7 @@ err:
static const struct dvb_tuner_ops si2157_tuner_ops = {
.info = {
- .name = "Silicon Labs Si2157",
+ .name = "Silicon Labs Si2157/Si2158",
.frequency_min = 110000000,
.frequency_max = 862000000,
},
@@ -221,7 +284,7 @@ static int si2157_probe(struct i2c_client *client,
i2c_set_clientdata(client, s);
dev_info(&s->client->dev,
- "%s: Silicon Labs Si2157 successfully attached\n",
+ "%s: Silicon Labs Si2157/Si2158 successfully attached\n",
KBUILD_MODNAME);
return 0;
err:
@@ -263,6 +326,6 @@ static struct i2c_driver si2157_driver = {
module_i2c_driver(si2157_driver);
-MODULE_DESCRIPTION("Silicon Labs Si2157 silicon tuner driver");
+MODULE_DESCRIPTION("Silicon Labs Si2157/Si2158 silicon tuner driver");
MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>");
MODULE_LICENSE("GPL");
diff --git a/drivers/media/tuners/si2157.h b/drivers/media/tuners/si2157.h
index f469a09..4465c46 100644
--- a/drivers/media/tuners/si2157.h
+++ b/drivers/media/tuners/si2157.h
@@ -1,5 +1,5 @@
/*
- * Silicon Labs Si2157 silicon tuner driver
+ * Silicon Labs Si2157/2158 silicon tuner driver
*
* Copyright (C) 2014 Antti Palosaari <crope@iki.fi>
*
diff --git a/drivers/media/tuners/si2157_priv.h b/drivers/media/tuners/si2157_priv.h
index 6db4c97..db79f3c 100644
--- a/drivers/media/tuners/si2157_priv.h
+++ b/drivers/media/tuners/si2157_priv.h
@@ -1,5 +1,5 @@
/*
- * Silicon Labs Si2157 silicon tuner driver
+ * Silicon Labs Si2157/2158 silicon tuner driver
*
* Copyright (C) 2014 Antti Palosaari <crope@iki.fi>
*
@@ -17,6 +17,7 @@
#ifndef SI2157_PRIV_H
#define SI2157_PRIV_H
+#include <linux/firmware.h>
#include "si2157.h"
/* state struct */
@@ -35,4 +36,6 @@ struct si2157_cmd {
unsigned rlen;
};
+#define SI2158_A20_FIRMWARE "dvb-tuner-si2158-a20-01.fw"
+
#endif
--
1.9.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 5/6] si2157: Set delivery system and bandwidth before tuning
2014-07-13 13:52 [PATCH 0/6] [0b48:3014] TechnoTrend TVStick CT2-4400 Olli Salonen
` (3 preceding siblings ...)
2014-07-13 13:52 ` [PATCH 4/6] si2157: Add support for Si2158 chip Olli Salonen
@ 2014-07-13 13:52 ` Olli Salonen
2014-07-13 17:15 ` Antti Palosaari
2014-07-13 13:52 ` [PATCH 6/6] cxusb: TechnoTrend CT2-4400 USB DVB-T2/C tuner support Olli Salonen
2014-07-13 17:14 ` [PATCH 0/6] [0b48:3014] TechnoTrend TVStick CT2-4400 Antti Palosaari
6 siblings, 1 reply; 14+ messages in thread
From: Olli Salonen @ 2014-07-13 13:52 UTC (permalink / raw)
To: linux-media; +Cc: Olli Salonen
Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
---
drivers/media/tuners/si2157.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/drivers/media/tuners/si2157.c b/drivers/media/tuners/si2157.c
index 58c5ef5..b656f9b 100644
--- a/drivers/media/tuners/si2157.c
+++ b/drivers/media/tuners/si2157.c
@@ -209,6 +209,7 @@ static int si2157_set_params(struct dvb_frontend *fe)
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
int ret;
struct si2157_cmd cmd;
+ u8 bandwidth, delivery_system;
dev_dbg(&s->client->dev,
"%s: delivery_system=%d frequency=%u bandwidth_hz=%u\n",
@@ -220,6 +221,36 @@ static int si2157_set_params(struct dvb_frontend *fe)
goto err;
}
+ if (c->bandwidth_hz <= 6000000)
+ bandwidth = 0x06;
+ else if (c->bandwidth_hz <= 7000000)
+ bandwidth = 0x07;
+ else if (c->bandwidth_hz <= 8000000)
+ bandwidth = 0x08;
+ else
+ bandwidth = 0x0f;
+
+ switch (c->delivery_system) {
+ case SYS_DVBT:
+ case SYS_DVBT2: /* it seems DVB-T and DVB-T2 both are 0x20 here */
+ delivery_system = 0x20;
+ break;
+ case SYS_DVBC_ANNEX_A:
+ delivery_system = 0x30;
+ break;
+ default:
+ ret = -EINVAL;
+ goto err;
+ }
+
+ memcpy(cmd.args, "\x14\x00\x03\x07\x00\x00", 6);
+ cmd.args[4] = delivery_system | bandwidth;
+ cmd.wlen = 6;
+ cmd.rlen = 1;
+ ret = si2157_cmd_execute(s, &cmd);
+ if (ret)
+ goto err;
+
/* set frequency */
memcpy(cmd.args, "\x41\x00\x00\x00\x00\x00\x00\x00", 8);
cmd.args[4] = (c->frequency >> 0) & 0xff;
--
1.9.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 6/6] cxusb: TechnoTrend CT2-4400 USB DVB-T2/C tuner support
2014-07-13 13:52 [PATCH 0/6] [0b48:3014] TechnoTrend TVStick CT2-4400 Olli Salonen
` (4 preceding siblings ...)
2014-07-13 13:52 ` [PATCH 5/6] si2157: Set delivery system and bandwidth before tuning Olli Salonen
@ 2014-07-13 13:52 ` Olli Salonen
2014-07-13 17:15 ` Antti Palosaari
2014-07-13 17:14 ` [PATCH 0/6] [0b48:3014] TechnoTrend TVStick CT2-4400 Antti Palosaari
6 siblings, 1 reply; 14+ messages in thread
From: Olli Salonen @ 2014-07-13 13:52 UTC (permalink / raw)
To: linux-media; +Cc: Olli Salonen
Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
---
drivers/media/dvb-core/dvb-usb-ids.h | 1 +
drivers/media/usb/dvb-usb/Kconfig | 3 +
drivers/media/usb/dvb-usb/cxusb.c | 191 ++++++++++++++++++++++++++++++++++-
drivers/media/usb/dvb-usb/cxusb.h | 2 +
4 files changed, 196 insertions(+), 1 deletion(-)
diff --git a/drivers/media/dvb-core/dvb-usb-ids.h b/drivers/media/dvb-core/dvb-usb-ids.h
index 11d2bea..f8e3150 100644
--- a/drivers/media/dvb-core/dvb-usb-ids.h
+++ b/drivers/media/dvb-core/dvb-usb-ids.h
@@ -244,6 +244,7 @@
#define USB_PID_TECHNOTREND_CONNECT_S2400 0x3006
#define USB_PID_TECHNOTREND_CONNECT_S2400_8KEEPROM 0x3009
#define USB_PID_TECHNOTREND_CONNECT_CT3650 0x300d
+#define USB_PID_TECHNOTREND_TVSTICK_CT2_4400 0x3014
#define USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY 0x005a
#define USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY_2 0x0081
#define USB_PID_TERRATEC_CINERGY_HT_USB_XE 0x0058
diff --git a/drivers/media/usb/dvb-usb/Kconfig b/drivers/media/usb/dvb-usb/Kconfig
index c5d9566..10aef21 100644
--- a/drivers/media/usb/dvb-usb/Kconfig
+++ b/drivers/media/usb/dvb-usb/Kconfig
@@ -117,10 +117,12 @@ config DVB_USB_CXUSB
select DVB_TUNER_DIB0070 if MEDIA_SUBDRV_AUTOSELECT
select DVB_ATBM8830 if MEDIA_SUBDRV_AUTOSELECT
select DVB_LGS8GXX if MEDIA_SUBDRV_AUTOSELECT
+ select DVB_SI2168 if MEDIA_SUBDRV_AUTOSELECT
select MEDIA_TUNER_SIMPLE if MEDIA_SUBDRV_AUTOSELECT
select MEDIA_TUNER_XC2028 if MEDIA_SUBDRV_AUTOSELECT
select MEDIA_TUNER_MXL5005S if MEDIA_SUBDRV_AUTOSELECT
select MEDIA_TUNER_MAX2165 if MEDIA_SUBDRV_AUTOSELECT
+ select MEDIA_TUNER_SI2157 if MEDIA_SUBDRV_AUTOSELECT
help
Say Y here to support the Conexant USB2.0 hybrid reference design.
Currently, only DVB and ATSC modes are supported, analog mode
@@ -128,6 +130,7 @@ config DVB_USB_CXUSB
Medion MD95700 hybrid USB2.0 device.
DViCO FusionHDTV (Bluebird) USB2.0 devices
+ TechnoTrend TVStick CT2-4400
config DVB_USB_M920X
tristate "Uli m920x DVB-T USB2.0 support"
diff --git a/drivers/media/usb/dvb-usb/cxusb.c b/drivers/media/usb/dvb-usb/cxusb.c
index a1c641e..ad20c39 100644
--- a/drivers/media/usb/dvb-usb/cxusb.c
+++ b/drivers/media/usb/dvb-usb/cxusb.c
@@ -42,6 +42,8 @@
#include "dib0070.h"
#include "lgs8gxx.h"
#include "atbm8830.h"
+#include "si2168.h"
+#include "si2157.h"
/* Max transfer size done by I2C transfer functions */
#define MAX_XFER_SIZE 64
@@ -144,6 +146,22 @@ static int cxusb_d680_dmb_gpio_tuner(struct dvb_usb_device *d,
}
}
+static int cxusb_tt_ct2_4400_gpio_tuner(struct dvb_usb_device *d, int onoff)
+{
+ u8 o[2], i;
+ int rc;
+
+ o[0] = 0x83;
+ o[1] = onoff;
+ rc = cxusb_ctrl_msg(d, CMD_GPIO_WRITE, o, 2, &i, 1);
+
+ if (rc) {
+ deb_info("gpio_write failed.\n");
+ return -EIO;
+ }
+ return 0;
+}
+
/* I2C */
static int cxusb_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],
int num)
@@ -505,6 +523,30 @@ static int cxusb_d680_dmb_rc_query(struct dvb_usb_device *d, u32 *event,
return 0;
}
+static int cxusb_tt_ct2_4400_rc_query(struct dvb_usb_device *d)
+{
+ u8 i[2];
+ int ret;
+ u32 cmd, keycode;
+ u8 rc5_cmd, rc5_addr, rc5_toggle;
+
+ ret = cxusb_ctrl_msg(d, 0x10, NULL, 0, i, 2);
+ if (ret)
+ return ret;
+
+ cmd = (i[0] << 8) | i[1];
+
+ if (cmd != 0xffff) {
+ rc5_cmd = cmd & 0x3F; /* bits 1-6 for command */
+ rc5_addr = (cmd & 0x07C0) >> 6; /* bits 7-11 for address */
+ rc5_toggle = (cmd & 0x0800) >> 11; /* bit 12 for toggle */
+ keycode = (rc5_addr << 8) | rc5_cmd;
+ rc_keydown(d->rc_dev, keycode, rc5_toggle);
+ }
+
+ return 0;
+}
+
static struct rc_map_table rc_map_dvico_mce_table[] = {
{ 0xfe02, KEY_TV },
{ 0xfe0e, KEY_MP3 },
@@ -1286,6 +1328,73 @@ static int cxusb_mygica_d689_frontend_attach(struct dvb_usb_adapter *adap)
return 0;
}
+static int cxusb_tt_ct2_4400_attach(struct dvb_usb_adapter *adap)
+{
+ struct dvb_usb_device *d = adap->dev;
+ struct cxusb_state *st = d->priv;
+ struct i2c_adapter *adapter;
+ struct i2c_client *client_demod;
+ struct i2c_client *client_tuner;
+ struct i2c_board_info info;
+ struct si2168_config si2168_config;
+ struct si2157_config si2157_config;
+
+ /* reset the tuner */
+ if (cxusb_tt_ct2_4400_gpio_tuner(d, 0) < 0) {
+ err("clear tuner gpio failed");
+ return -EIO;
+ }
+ msleep(100);
+ if (cxusb_tt_ct2_4400_gpio_tuner(d, 1) < 0) {
+ err("set tuner gpio failed");
+ return -EIO;
+ }
+ msleep(100);
+
+ /* attach frontend */
+ si2168_config.i2c_adapter = &adapter;
+ si2168_config.fe = &adap->fe_adap[0].fe;
+ memset(&info, 0, sizeof(struct i2c_board_info));
+ strlcpy(info.type, "si2168", I2C_NAME_SIZE);
+ info.addr = 0x64;
+ info.platform_data = &si2168_config;
+ request_module(info.type);
+ client_demod = i2c_new_device(&d->i2c_adap, &info);
+ if (client_demod == NULL || client_demod->dev.driver == NULL)
+ return -ENODEV;
+
+ if (!try_module_get(client_demod->dev.driver->owner)) {
+ i2c_unregister_device(client_demod);
+ return -ENODEV;
+ }
+
+ st->i2c_client_demod = client_demod;
+
+ /* attach tuner */
+ si2157_config.fe = adap->fe_adap[0].fe;
+ memset(&info, 0, sizeof(struct i2c_board_info));
+ strlcpy(info.type, "si2157", I2C_NAME_SIZE);
+ info.addr = 0x60;
+ info.platform_data = &si2157_config;
+ request_module(info.type);
+ client_tuner = i2c_new_device(adapter, &info);
+ if (client_tuner == NULL || client_tuner->dev.driver == NULL) {
+ module_put(client_demod->dev.driver->owner);
+ i2c_unregister_device(client_demod);
+ return -ENODEV;
+ }
+ if (!try_module_get(client_tuner->dev.driver->owner)) {
+ i2c_unregister_device(client_tuner);
+ module_put(client_demod->dev.driver->owner);
+ i2c_unregister_device(client_demod);
+ return -ENODEV;
+ }
+
+ st->i2c_client_tuner = client_tuner;
+
+ return 0;
+}
+
/*
* DViCO has shipped two devices with the same USB ID, but only one of them
* needs a firmware download. Check the device class details to see if they
@@ -1367,6 +1476,7 @@ static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_prope
static struct dvb_usb_device_properties cxusb_aver_a868r_properties;
static struct dvb_usb_device_properties cxusb_d680_dmb_properties;
static struct dvb_usb_device_properties cxusb_mygica_d689_properties;
+static struct dvb_usb_device_properties cxusb_tt_ct2_4400_properties;
static int cxusb_probe(struct usb_interface *intf,
const struct usb_device_id *id)
@@ -1397,12 +1507,37 @@ static int cxusb_probe(struct usb_interface *intf,
THIS_MODULE, NULL, adapter_nr) ||
0 == dvb_usb_device_init(intf, &cxusb_mygica_d689_properties,
THIS_MODULE, NULL, adapter_nr) ||
+ 0 == dvb_usb_device_init(intf, &cxusb_tt_ct2_4400_properties,
+ THIS_MODULE, NULL, adapter_nr) ||
0)
return 0;
return -EINVAL;
}
+static void cxusb_disconnect(struct usb_interface *intf)
+{
+ struct dvb_usb_device *d = usb_get_intfdata(intf);
+ struct cxusb_state *st = d->priv;
+ struct i2c_client *client;
+
+ /* remove I2C client for tuner */
+ client = st->i2c_client_tuner;
+ if (client) {
+ module_put(client->dev.driver->owner);
+ i2c_unregister_device(client);
+ }
+
+ /* remove I2C client for demodulator */
+ client = st->i2c_client_demod;
+ if (client) {
+ module_put(client->dev.driver->owner);
+ i2c_unregister_device(client);
+ }
+
+ dvb_usb_device_exit(intf);
+}
+
static struct usb_device_id cxusb_table [] = {
{ USB_DEVICE(USB_VID_MEDION, USB_PID_MEDION_MD95700) },
{ USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LG064F_COLD) },
@@ -1424,6 +1559,7 @@ static struct usb_device_id cxusb_table [] = {
{ USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_4_REV_2) },
{ USB_DEVICE(USB_VID_CONEXANT, USB_PID_CONEXANT_D680_DMB) },
{ USB_DEVICE(USB_VID_CONEXANT, USB_PID_MYGICA_D689) },
+ { USB_DEVICE(USB_VID_TECHNOTREND, USB_PID_TECHNOTREND_TVSTICK_CT2_4400) },
{} /* Terminating entry */
};
MODULE_DEVICE_TABLE (usb, cxusb_table);
@@ -2070,10 +2206,63 @@ static struct dvb_usb_device_properties cxusb_mygica_d689_properties = {
}
};
+static struct dvb_usb_device_properties cxusb_tt_ct2_4400_properties = {
+ .caps = DVB_USB_IS_AN_I2C_ADAPTER,
+
+ .usb_ctrl = CYPRESS_FX2,
+
+ .size_of_priv = sizeof(struct cxusb_state),
+
+ .num_adapters = 1,
+ .adapter = {
+ {
+ .num_frontends = 1,
+ .fe = {{
+ .streaming_ctrl = cxusb_streaming_ctrl,
+ /* both frontend and tuner attached in the
+ same function */
+ .frontend_attach = cxusb_tt_ct2_4400_attach,
+
+ /* parameter for the MPEG2-data transfer */
+ .stream = {
+ .type = USB_BULK,
+ .count = 8,
+ .endpoint = 0x82,
+ .u = {
+ .bulk = {
+ .buffersize = 4096,
+ }
+ }
+ },
+ } },
+ },
+ },
+
+ .i2c_algo = &cxusb_i2c_algo,
+ .generic_bulk_ctrl_endpoint = 0x01,
+ .generic_bulk_ctrl_endpoint_response = 0x81,
+
+ .rc.core = {
+ .rc_codes = RC_MAP_TT_1500,
+ .allowed_protos = RC_BIT_RC5,
+ .rc_query = cxusb_tt_ct2_4400_rc_query,
+ .rc_interval = 150,
+ },
+
+ .num_device_descs = 1,
+ .devices = {
+ {
+ "TechnoTrend TVStick CT2-4400",
+ { NULL },
+ { &cxusb_table[20], NULL },
+ },
+ }
+};
+
static struct usb_driver cxusb_driver = {
.name = "dvb_usb_cxusb",
.probe = cxusb_probe,
- .disconnect = dvb_usb_device_exit,
+ .disconnect = cxusb_disconnect,
.id_table = cxusb_table,
};
diff --git a/drivers/media/usb/dvb-usb/cxusb.h b/drivers/media/usb/dvb-usb/cxusb.h
index 1a51eaf..527ff79 100644
--- a/drivers/media/usb/dvb-usb/cxusb.h
+++ b/drivers/media/usb/dvb-usb/cxusb.h
@@ -30,6 +30,8 @@
struct cxusb_state {
u8 gpio_write_state[3];
+ struct i2c_client *i2c_client_demod;
+ struct i2c_client *i2c_client_tuner;
};
#endif
--
1.9.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH 0/6] [0b48:3014] TechnoTrend TVStick CT2-4400
2014-07-13 13:52 [PATCH 0/6] [0b48:3014] TechnoTrend TVStick CT2-4400 Olli Salonen
` (5 preceding siblings ...)
2014-07-13 13:52 ` [PATCH 6/6] cxusb: TechnoTrend CT2-4400 USB DVB-T2/C tuner support Olli Salonen
@ 2014-07-13 17:14 ` Antti Palosaari
6 siblings, 0 replies; 14+ messages in thread
From: Antti Palosaari @ 2014-07-13 17:14 UTC (permalink / raw)
To: Olli Salonen, linux-media
Applied!
http://git.linuxtv.org/cgit.cgi/anttip/media_tree.git/log/?h=silabs
Antti
On 07/13/2014 04:52 PM, Olli Salonen wrote:
> TechnoTrend TVStick CT2-4400 is a USB 2.0 DVB C/T/T2 tuner with the
> following components.
>
> USB bridge: Cypress FX2
> Demodulator: Silicon Labs Si2168-A30
> Tuner: Silicon Labs Si2158-A20
>
> Both the demodulator and the tuner need a firmware. These can be
> extracted from TT drivers.
>
> Download: http://www.tt-downloads.de/bda-treiber_4.2.0.0.zip
>
> Extract firmware from file ttTVStick4400_64.sys in the zip (MD5 sum below):
> 0276023ce027bab05c2e7053033e2182 ttTVStick4400_64.sys
>
> dd if=ttTVStick4400_64.sys ibs=1 skip=211216 count=17576 of=dvb-demod-si2168-30-01.fw
> dd if=ttTVStick4400_64.sys ibs=1 skip=200816 count=3944 of=dvb-tuner-si2158-20-01.fw
>
> Olli Salonen (6):
> si2168: Small typo fix (SI2157 -> SI2168)
> si2168: Add handling for different chip revisions and firmwares
> si2157: Move chip initialization to si2157_init
> si2157: Add support for Si2158 chip
> si2157: Set delivery system and bandwidth before tuning
> cxusb: TechnoTrend CT2-4400 USB DVB-T2/C tuner support
>
> drivers/media/dvb-core/dvb-usb-ids.h | 1 +
> drivers/media/dvb-frontends/si2168.c | 34 +++++-
> drivers/media/dvb-frontends/si2168_priv.h | 8 +-
> drivers/media/tuners/si2157.c | 161 +++++++++++++++++++------
> drivers/media/tuners/si2157.h | 2 +-
> drivers/media/tuners/si2157_priv.h | 5 +-
> drivers/media/usb/dvb-usb/Kconfig | 3 +
> drivers/media/usb/dvb-usb/cxusb.c | 191 +++++++++++++++++++++++++++++-
> drivers/media/usb/dvb-usb/cxusb.h | 2 +
> 9 files changed, 357 insertions(+), 50 deletions(-)
>
--
http://palosaari.fi/
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/6] si2168: Small typo fix (SI2157 -> SI2168)
2014-07-13 13:52 ` [PATCH 1/6] si2168: Small typo fix (SI2157 -> SI2168) Olli Salonen
@ 2014-07-13 17:14 ` Antti Palosaari
0 siblings, 0 replies; 14+ messages in thread
From: Antti Palosaari @ 2014-07-13 17:14 UTC (permalink / raw)
To: Olli Salonen, linux-media
Applied!
http://git.linuxtv.org/cgit.cgi/anttip/media_tree.git/log/?h=silabs
Antti
On 07/13/2014 04:52 PM, Olli Salonen wrote:
> Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
> ---
> drivers/media/dvb-frontends/si2168_priv.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/dvb-frontends/si2168_priv.h b/drivers/media/dvb-frontends/si2168_priv.h
> index 53f7f06..97f9d87 100644
> --- a/drivers/media/dvb-frontends/si2168_priv.h
> +++ b/drivers/media/dvb-frontends/si2168_priv.h
> @@ -36,9 +36,9 @@ struct si2168 {
> };
>
> /* firmare command struct */
> -#define SI2157_ARGLEN 30
> +#define SI2168_ARGLEN 30
> struct si2168_cmd {
> - u8 args[SI2157_ARGLEN];
> + u8 args[SI2168_ARGLEN];
> unsigned wlen;
> unsigned rlen;
> };
>
--
http://palosaari.fi/
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/6] si2168: Add handling for different chip revisions and firmwares
2014-07-13 13:52 ` [PATCH 2/6] si2168: Add handling for different chip revisions and firmwares Olli Salonen
@ 2014-07-13 17:14 ` Antti Palosaari
0 siblings, 0 replies; 14+ messages in thread
From: Antti Palosaari @ 2014-07-13 17:14 UTC (permalink / raw)
To: Olli Salonen, linux-media
Applied!
http://git.linuxtv.org/cgit.cgi/anttip/media_tree.git/log/?h=silabs
Antti
On 07/13/2014 04:52 PM, Olli Salonen wrote:
> Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
> ---
> drivers/media/dvb-frontends/si2168.c | 34 ++++++++++++++++++++++++++-----
> drivers/media/dvb-frontends/si2168_priv.h | 4 +++-
> 2 files changed, 32 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/media/dvb-frontends/si2168.c b/drivers/media/dvb-frontends/si2168.c
> index bae7771..268fce3 100644
> --- a/drivers/media/dvb-frontends/si2168.c
> +++ b/drivers/media/dvb-frontends/si2168.c
> @@ -333,7 +333,7 @@ static int si2168_init(struct dvb_frontend *fe)
> struct si2168 *s = fe->demodulator_priv;
> int ret, len, remaining;
> const struct firmware *fw = NULL;
> - u8 *fw_file = SI2168_FIRMWARE;
> + u8 *fw_file;
> const unsigned int i2c_wr_max = 8;
> struct si2168_cmd cmd;
>
> @@ -353,6 +353,7 @@ static int si2168_init(struct dvb_frontend *fe)
> if (ret)
> goto err;
>
> + /* query chip revision */
> memcpy(cmd.args, "\x02", 1);
> cmd.wlen = 1;
> cmd.rlen = 13;
> @@ -360,6 +361,20 @@ static int si2168_init(struct dvb_frontend *fe)
> if (ret)
> goto err;
>
> + if (((cmd.args[1] & 0x0f) == 2) && (cmd.args[3] == '4') &&
> + (cmd.args[4] == '0'))
> + fw_file = SI2168_B40_FIRMWARE;
> + else if (((cmd.args[1] & 0x0f) == 1) && (cmd.args[3] == '3') &&
> + (cmd.args[4] == '0'))
> + fw_file = SI2168_A30_FIRMWARE;
> + else {
> + dev_err(&s->client->dev,
> + "%s: no firmware file for Si2168-%c%c defined\n",
> + KBUILD_MODNAME, cmd.args[3], cmd.args[4]);
> + ret = -EINVAL;
> + goto err;
> + }
> +
> /* cold state - try to download firmware */
> dev_info(&s->client->dev, "%s: found a '%s' in cold state\n",
> KBUILD_MODNAME, si2168_ops.info.name);
> @@ -367,9 +382,18 @@ static int si2168_init(struct dvb_frontend *fe)
> /* request the firmware, this will block and timeout */
> ret = request_firmware(&fw, fw_file, &s->client->dev);
> if (ret) {
> - dev_err(&s->client->dev, "%s: firmare file '%s' not found\n",
> - KBUILD_MODNAME, fw_file);
> - goto err;
> + /* fallback mechanism to handle old name for
> + SI2168_B40_FIRMWARE */
> + if (((cmd.args[1] & 0x0f) == 2) && (cmd.args[3] == '4') &&
> + (cmd.args[4] == '0')) {
> + fw_file = SI2168_B40_FIRMWARE_FALLBACK;
> + ret = request_firmware(&fw, fw_file, &s->client->dev);
> + }
> + if (ret) {
> + dev_err(&s->client->dev, "%s: firmware file '%s' not found\n",
> + KBUILD_MODNAME, fw_file);
> + goto err;
> + }
> }
>
> dev_info(&s->client->dev, "%s: downloading firmware from file '%s'\n",
> @@ -629,4 +653,4 @@ module_i2c_driver(si2168_driver);
> MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>");
> MODULE_DESCRIPTION("Silicon Labs Si2168 DVB-T/T2/C demodulator driver");
> MODULE_LICENSE("GPL");
> -MODULE_FIRMWARE(SI2168_FIRMWARE);
> +MODULE_FIRMWARE(SI2168_B40_FIRMWARE);
> diff --git a/drivers/media/dvb-frontends/si2168_priv.h b/drivers/media/dvb-frontends/si2168_priv.h
> index 97f9d87..bebb68a 100644
> --- a/drivers/media/dvb-frontends/si2168_priv.h
> +++ b/drivers/media/dvb-frontends/si2168_priv.h
> @@ -22,7 +22,9 @@
> #include <linux/firmware.h>
> #include <linux/i2c-mux.h>
>
> -#define SI2168_FIRMWARE "dvb-demod-si2168-02.fw"
> +#define SI2168_A30_FIRMWARE "dvb-demod-si2168-a30-01.fw"
> +#define SI2168_B40_FIRMWARE "dvb-demod-si2168-b40-01.fw"
> +#define SI2168_B40_FIRMWARE_FALLBACK "dvb-demod-si2168-02.fw"
>
> /* state struct */
> struct si2168 {
>
--
http://palosaari.fi/
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 3/6] si2157: Move chip initialization to si2157_init
2014-07-13 13:52 ` [PATCH 3/6] si2157: Move chip initialization to si2157_init Olli Salonen
@ 2014-07-13 17:14 ` Antti Palosaari
0 siblings, 0 replies; 14+ messages in thread
From: Antti Palosaari @ 2014-07-13 17:14 UTC (permalink / raw)
To: Olli Salonen, linux-media
Applied!
http://git.linuxtv.org/cgit.cgi/anttip/media_tree.git/log/?h=silabs
Antti
On 07/13/2014 04:52 PM, Olli Salonen wrote:
> Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
> ---
> drivers/media/tuners/si2157.c | 71 ++++++++++++++++++-------------------------
> 1 file changed, 30 insertions(+), 41 deletions(-)
>
> diff --git a/drivers/media/tuners/si2157.c b/drivers/media/tuners/si2157.c
> index a4908ee..a92570f9 100644
> --- a/drivers/media/tuners/si2157.c
> +++ b/drivers/media/tuners/si2157.c
> @@ -80,12 +80,41 @@ err:
> static int si2157_init(struct dvb_frontend *fe)
> {
> struct si2157 *s = fe->tuner_priv;
> + int ret;
> + struct si2157_cmd cmd;
>
> dev_dbg(&s->client->dev, "%s:\n", __func__);
>
> + /* configure? */
> + memcpy(cmd.args, "\xc0\x00\x0c\x00\x00\x01\x01\x01\x01\x01\x01\x02\x00\x00\x01", 15);
> + cmd.wlen = 15;
> + cmd.rlen = 1;
> + ret = si2157_cmd_execute(s, &cmd);
> + if (ret)
> + goto err;
> +
> + /* query chip revision */
> + memcpy(cmd.args, "\x02", 1);
> + cmd.wlen = 1;
> + cmd.rlen = 13;
> + ret = si2157_cmd_execute(s, &cmd);
> + if (ret)
> + goto err;
> +
> + /* reboot the tuner with new firmware? */
> + memcpy(cmd.args, "\x01\x01", 2);
> + cmd.wlen = 2;
> + cmd.rlen = 1;
> + ret = si2157_cmd_execute(s, &cmd);
> + if (ret)
> + goto err;
> +
> s->active = true;
>
> return 0;
> +err:
> + dev_dbg(&s->client->dev, "%s: failed=%d\n", __func__, ret);
> + return ret;
> }
>
> static int si2157_sleep(struct dvb_frontend *fe)
> @@ -128,48 +157,8 @@ static int si2157_set_params(struct dvb_frontend *fe)
> goto err;
> }
>
> - /* configure? */
> - cmd.args[0] = 0xc0;
> - cmd.args[1] = 0x00;
> - cmd.args[2] = 0x0c;
> - cmd.args[3] = 0x00;
> - cmd.args[4] = 0x00;
> - cmd.args[5] = 0x01;
> - cmd.args[6] = 0x01;
> - cmd.args[7] = 0x01;
> - cmd.args[8] = 0x01;
> - cmd.args[9] = 0x01;
> - cmd.args[10] = 0x01;
> - cmd.args[11] = 0x02;
> - cmd.args[12] = 0x00;
> - cmd.args[13] = 0x00;
> - cmd.args[14] = 0x01;
> - cmd.wlen = 15;
> - cmd.rlen = 1;
> - ret = si2157_cmd_execute(s, &cmd);
> - if (ret)
> - goto err;
> -
> - cmd.args[0] = 0x02;
> - cmd.wlen = 1;
> - cmd.rlen = 13;
> - ret = si2157_cmd_execute(s, &cmd);
> - if (ret)
> - goto err;
> -
> - cmd.args[0] = 0x01;
> - cmd.args[1] = 0x01;
> - cmd.wlen = 2;
> - cmd.rlen = 1;
> - ret = si2157_cmd_execute(s, &cmd);
> - if (ret)
> - goto err;
> -
> /* set frequency */
> - cmd.args[0] = 0x41;
> - cmd.args[1] = 0x00;
> - cmd.args[2] = 0x00;
> - cmd.args[3] = 0x00;
> + memcpy(cmd.args, "\x41\x00\x00\x00\x00\x00\x00\x00", 8);
> cmd.args[4] = (c->frequency >> 0) & 0xff;
> cmd.args[5] = (c->frequency >> 8) & 0xff;
> cmd.args[6] = (c->frequency >> 16) & 0xff;
>
--
http://palosaari.fi/
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 4/6] si2157: Add support for Si2158 chip
2014-07-13 13:52 ` [PATCH 4/6] si2157: Add support for Si2158 chip Olli Salonen
@ 2014-07-13 17:14 ` Antti Palosaari
0 siblings, 0 replies; 14+ messages in thread
From: Antti Palosaari @ 2014-07-13 17:14 UTC (permalink / raw)
To: Olli Salonen, linux-media
Applied!
http://git.linuxtv.org/cgit.cgi/anttip/media_tree.git/log/?h=silabs
Antti
On 07/13/2014 04:52 PM, Olli Salonen wrote:
> Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
> ---
> drivers/media/tuners/si2157.c | 73 +++++++++++++++++++++++++++++++++++---
> drivers/media/tuners/si2157.h | 2 +-
> drivers/media/tuners/si2157_priv.h | 5 ++-
> 3 files changed, 73 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/media/tuners/si2157.c b/drivers/media/tuners/si2157.c
> index a92570f9..58c5ef5 100644
> --- a/drivers/media/tuners/si2157.c
> +++ b/drivers/media/tuners/si2157.c
> @@ -1,5 +1,5 @@
> /*
> - * Silicon Labs Si2157 silicon tuner driver
> + * Silicon Labs Si2157/2158 silicon tuner driver
> *
> * Copyright (C) 2014 Antti Palosaari <crope@iki.fi>
> *
> @@ -16,6 +16,8 @@
>
> #include "si2157_priv.h"
>
> +static const struct dvb_tuner_ops si2157_ops;
> +
> /* execute firmware command */
> static int si2157_cmd_execute(struct si2157 *s, struct si2157_cmd *cmd)
> {
> @@ -80,8 +82,11 @@ err:
> static int si2157_init(struct dvb_frontend *fe)
> {
> struct si2157 *s = fe->tuner_priv;
> - int ret;
> + int ret, remaining;
> struct si2157_cmd cmd;
> + u8 chip, len = 0;
> + const struct firmware *fw = NULL;
> + u8 *fw_file;
>
> dev_dbg(&s->client->dev, "%s:\n", __func__);
>
> @@ -101,6 +106,64 @@ static int si2157_init(struct dvb_frontend *fe)
> if (ret)
> goto err;
>
> + chip = cmd.args[2]; /* 57 for Si2157, 58 for Si2158 */
> +
> + /* Si2158 requires firmware download */
> + if (chip == 58) {
> + if (((cmd.args[1] & 0x0f) == 1) && (cmd.args[3] == '2') &&
> + (cmd.args[4] == '0'))
> + fw_file = SI2158_A20_FIRMWARE;
> + else {
> + dev_err(&s->client->dev,
> + "%s: no firmware file for Si%d-%c%c defined\n",
> + KBUILD_MODNAME, chip, cmd.args[3], cmd.args[4]);
> + ret = -EINVAL;
> + goto err;
> + }
> +
> + /* cold state - try to download firmware */
> + dev_info(&s->client->dev, "%s: found a '%s' in cold state\n",
> + KBUILD_MODNAME, si2157_ops.info.name);
> +
> + /* request the firmware, this will block and timeout */
> + ret = request_firmware(&fw, fw_file, &s->client->dev);
> + if (ret) {
> + dev_err(&s->client->dev, "%s: firmware file '%s' not found\n",
> + KBUILD_MODNAME, fw_file);
> + goto err;
> + }
> +
> + dev_info(&s->client->dev, "%s: downloading firmware from file '%s'\n",
> + KBUILD_MODNAME, fw_file);
> +
> + /* firmware should be n chunks of 17 bytes */
> + if (fw->size % 17 != 0) {
> + dev_err(&s->client->dev, "%s: firmware file '%s' is invalid\n",
> + KBUILD_MODNAME, fw_file);
> + ret = -EINVAL;
> + goto err;
> + }
> +
> + for (remaining = fw->size; remaining > 0; remaining -= 17) {
> + memcpy(&len, &fw->data[fw->size - remaining], 1);
> + memcpy(cmd.args, &fw->data[(fw->size - remaining) + 1],
> + len);
> + cmd.wlen = len;
> + cmd.rlen = 1;
> + ret = si2157_cmd_execute(s, &cmd);
> + if (ret) {
> + dev_err(&s->client->dev,
> + "%s: firmware download failed=%d\n",
> + KBUILD_MODNAME, ret);
> + goto err;
> + }
> + }
> +
> + release_firmware(fw);
> + fw = NULL;
> +
> + }
> +
> /* reboot the tuner with new firmware? */
> memcpy(cmd.args, "\x01\x01", 2);
> cmd.wlen = 2;
> @@ -177,7 +240,7 @@ err:
>
> static const struct dvb_tuner_ops si2157_tuner_ops = {
> .info = {
> - .name = "Silicon Labs Si2157",
> + .name = "Silicon Labs Si2157/Si2158",
> .frequency_min = 110000000,
> .frequency_max = 862000000,
> },
> @@ -221,7 +284,7 @@ static int si2157_probe(struct i2c_client *client,
> i2c_set_clientdata(client, s);
>
> dev_info(&s->client->dev,
> - "%s: Silicon Labs Si2157 successfully attached\n",
> + "%s: Silicon Labs Si2157/Si2158 successfully attached\n",
> KBUILD_MODNAME);
> return 0;
> err:
> @@ -263,6 +326,6 @@ static struct i2c_driver si2157_driver = {
>
> module_i2c_driver(si2157_driver);
>
> -MODULE_DESCRIPTION("Silicon Labs Si2157 silicon tuner driver");
> +MODULE_DESCRIPTION("Silicon Labs Si2157/Si2158 silicon tuner driver");
> MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>");
> MODULE_LICENSE("GPL");
> diff --git a/drivers/media/tuners/si2157.h b/drivers/media/tuners/si2157.h
> index f469a09..4465c46 100644
> --- a/drivers/media/tuners/si2157.h
> +++ b/drivers/media/tuners/si2157.h
> @@ -1,5 +1,5 @@
> /*
> - * Silicon Labs Si2157 silicon tuner driver
> + * Silicon Labs Si2157/2158 silicon tuner driver
> *
> * Copyright (C) 2014 Antti Palosaari <crope@iki.fi>
> *
> diff --git a/drivers/media/tuners/si2157_priv.h b/drivers/media/tuners/si2157_priv.h
> index 6db4c97..db79f3c 100644
> --- a/drivers/media/tuners/si2157_priv.h
> +++ b/drivers/media/tuners/si2157_priv.h
> @@ -1,5 +1,5 @@
> /*
> - * Silicon Labs Si2157 silicon tuner driver
> + * Silicon Labs Si2157/2158 silicon tuner driver
> *
> * Copyright (C) 2014 Antti Palosaari <crope@iki.fi>
> *
> @@ -17,6 +17,7 @@
> #ifndef SI2157_PRIV_H
> #define SI2157_PRIV_H
>
> +#include <linux/firmware.h>
> #include "si2157.h"
>
> /* state struct */
> @@ -35,4 +36,6 @@ struct si2157_cmd {
> unsigned rlen;
> };
>
> +#define SI2158_A20_FIRMWARE "dvb-tuner-si2158-a20-01.fw"
> +
> #endif
>
--
http://palosaari.fi/
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 5/6] si2157: Set delivery system and bandwidth before tuning
2014-07-13 13:52 ` [PATCH 5/6] si2157: Set delivery system and bandwidth before tuning Olli Salonen
@ 2014-07-13 17:15 ` Antti Palosaari
0 siblings, 0 replies; 14+ messages in thread
From: Antti Palosaari @ 2014-07-13 17:15 UTC (permalink / raw)
To: Olli Salonen, linux-media
Applied!
http://git.linuxtv.org/cgit.cgi/anttip/media_tree.git/log/?h=silabs
Antti
On 07/13/2014 04:52 PM, Olli Salonen wrote:
> Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
> ---
> drivers/media/tuners/si2157.c | 31 +++++++++++++++++++++++++++++++
> 1 file changed, 31 insertions(+)
>
> diff --git a/drivers/media/tuners/si2157.c b/drivers/media/tuners/si2157.c
> index 58c5ef5..b656f9b 100644
> --- a/drivers/media/tuners/si2157.c
> +++ b/drivers/media/tuners/si2157.c
> @@ -209,6 +209,7 @@ static int si2157_set_params(struct dvb_frontend *fe)
> struct dtv_frontend_properties *c = &fe->dtv_property_cache;
> int ret;
> struct si2157_cmd cmd;
> + u8 bandwidth, delivery_system;
>
> dev_dbg(&s->client->dev,
> "%s: delivery_system=%d frequency=%u bandwidth_hz=%u\n",
> @@ -220,6 +221,36 @@ static int si2157_set_params(struct dvb_frontend *fe)
> goto err;
> }
>
> + if (c->bandwidth_hz <= 6000000)
> + bandwidth = 0x06;
> + else if (c->bandwidth_hz <= 7000000)
> + bandwidth = 0x07;
> + else if (c->bandwidth_hz <= 8000000)
> + bandwidth = 0x08;
> + else
> + bandwidth = 0x0f;
> +
> + switch (c->delivery_system) {
> + case SYS_DVBT:
> + case SYS_DVBT2: /* it seems DVB-T and DVB-T2 both are 0x20 here */
> + delivery_system = 0x20;
> + break;
> + case SYS_DVBC_ANNEX_A:
> + delivery_system = 0x30;
> + break;
> + default:
> + ret = -EINVAL;
> + goto err;
> + }
> +
> + memcpy(cmd.args, "\x14\x00\x03\x07\x00\x00", 6);
> + cmd.args[4] = delivery_system | bandwidth;
> + cmd.wlen = 6;
> + cmd.rlen = 1;
> + ret = si2157_cmd_execute(s, &cmd);
> + if (ret)
> + goto err;
> +
> /* set frequency */
> memcpy(cmd.args, "\x41\x00\x00\x00\x00\x00\x00\x00", 8);
> cmd.args[4] = (c->frequency >> 0) & 0xff;
>
--
http://palosaari.fi/
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 6/6] cxusb: TechnoTrend CT2-4400 USB DVB-T2/C tuner support
2014-07-13 13:52 ` [PATCH 6/6] cxusb: TechnoTrend CT2-4400 USB DVB-T2/C tuner support Olli Salonen
@ 2014-07-13 17:15 ` Antti Palosaari
0 siblings, 0 replies; 14+ messages in thread
From: Antti Palosaari @ 2014-07-13 17:15 UTC (permalink / raw)
To: Olli Salonen, linux-media
Applied!
http://git.linuxtv.org/cgit.cgi/anttip/media_tree.git/log/?h=silabs
Antti
On 07/13/2014 04:52 PM, Olli Salonen wrote:
> Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
> ---
> drivers/media/dvb-core/dvb-usb-ids.h | 1 +
> drivers/media/usb/dvb-usb/Kconfig | 3 +
> drivers/media/usb/dvb-usb/cxusb.c | 191 ++++++++++++++++++++++++++++++++++-
> drivers/media/usb/dvb-usb/cxusb.h | 2 +
> 4 files changed, 196 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/dvb-core/dvb-usb-ids.h b/drivers/media/dvb-core/dvb-usb-ids.h
> index 11d2bea..f8e3150 100644
> --- a/drivers/media/dvb-core/dvb-usb-ids.h
> +++ b/drivers/media/dvb-core/dvb-usb-ids.h
> @@ -244,6 +244,7 @@
> #define USB_PID_TECHNOTREND_CONNECT_S2400 0x3006
> #define USB_PID_TECHNOTREND_CONNECT_S2400_8KEEPROM 0x3009
> #define USB_PID_TECHNOTREND_CONNECT_CT3650 0x300d
> +#define USB_PID_TECHNOTREND_TVSTICK_CT2_4400 0x3014
> #define USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY 0x005a
> #define USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY_2 0x0081
> #define USB_PID_TERRATEC_CINERGY_HT_USB_XE 0x0058
> diff --git a/drivers/media/usb/dvb-usb/Kconfig b/drivers/media/usb/dvb-usb/Kconfig
> index c5d9566..10aef21 100644
> --- a/drivers/media/usb/dvb-usb/Kconfig
> +++ b/drivers/media/usb/dvb-usb/Kconfig
> @@ -117,10 +117,12 @@ config DVB_USB_CXUSB
> select DVB_TUNER_DIB0070 if MEDIA_SUBDRV_AUTOSELECT
> select DVB_ATBM8830 if MEDIA_SUBDRV_AUTOSELECT
> select DVB_LGS8GXX if MEDIA_SUBDRV_AUTOSELECT
> + select DVB_SI2168 if MEDIA_SUBDRV_AUTOSELECT
> select MEDIA_TUNER_SIMPLE if MEDIA_SUBDRV_AUTOSELECT
> select MEDIA_TUNER_XC2028 if MEDIA_SUBDRV_AUTOSELECT
> select MEDIA_TUNER_MXL5005S if MEDIA_SUBDRV_AUTOSELECT
> select MEDIA_TUNER_MAX2165 if MEDIA_SUBDRV_AUTOSELECT
> + select MEDIA_TUNER_SI2157 if MEDIA_SUBDRV_AUTOSELECT
> help
> Say Y here to support the Conexant USB2.0 hybrid reference design.
> Currently, only DVB and ATSC modes are supported, analog mode
> @@ -128,6 +130,7 @@ config DVB_USB_CXUSB
>
> Medion MD95700 hybrid USB2.0 device.
> DViCO FusionHDTV (Bluebird) USB2.0 devices
> + TechnoTrend TVStick CT2-4400
>
> config DVB_USB_M920X
> tristate "Uli m920x DVB-T USB2.0 support"
> diff --git a/drivers/media/usb/dvb-usb/cxusb.c b/drivers/media/usb/dvb-usb/cxusb.c
> index a1c641e..ad20c39 100644
> --- a/drivers/media/usb/dvb-usb/cxusb.c
> +++ b/drivers/media/usb/dvb-usb/cxusb.c
> @@ -42,6 +42,8 @@
> #include "dib0070.h"
> #include "lgs8gxx.h"
> #include "atbm8830.h"
> +#include "si2168.h"
> +#include "si2157.h"
>
> /* Max transfer size done by I2C transfer functions */
> #define MAX_XFER_SIZE 64
> @@ -144,6 +146,22 @@ static int cxusb_d680_dmb_gpio_tuner(struct dvb_usb_device *d,
> }
> }
>
> +static int cxusb_tt_ct2_4400_gpio_tuner(struct dvb_usb_device *d, int onoff)
> +{
> + u8 o[2], i;
> + int rc;
> +
> + o[0] = 0x83;
> + o[1] = onoff;
> + rc = cxusb_ctrl_msg(d, CMD_GPIO_WRITE, o, 2, &i, 1);
> +
> + if (rc) {
> + deb_info("gpio_write failed.\n");
> + return -EIO;
> + }
> + return 0;
> +}
> +
> /* I2C */
> static int cxusb_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],
> int num)
> @@ -505,6 +523,30 @@ static int cxusb_d680_dmb_rc_query(struct dvb_usb_device *d, u32 *event,
> return 0;
> }
>
> +static int cxusb_tt_ct2_4400_rc_query(struct dvb_usb_device *d)
> +{
> + u8 i[2];
> + int ret;
> + u32 cmd, keycode;
> + u8 rc5_cmd, rc5_addr, rc5_toggle;
> +
> + ret = cxusb_ctrl_msg(d, 0x10, NULL, 0, i, 2);
> + if (ret)
> + return ret;
> +
> + cmd = (i[0] << 8) | i[1];
> +
> + if (cmd != 0xffff) {
> + rc5_cmd = cmd & 0x3F; /* bits 1-6 for command */
> + rc5_addr = (cmd & 0x07C0) >> 6; /* bits 7-11 for address */
> + rc5_toggle = (cmd & 0x0800) >> 11; /* bit 12 for toggle */
> + keycode = (rc5_addr << 8) | rc5_cmd;
> + rc_keydown(d->rc_dev, keycode, rc5_toggle);
> + }
> +
> + return 0;
> +}
> +
> static struct rc_map_table rc_map_dvico_mce_table[] = {
> { 0xfe02, KEY_TV },
> { 0xfe0e, KEY_MP3 },
> @@ -1286,6 +1328,73 @@ static int cxusb_mygica_d689_frontend_attach(struct dvb_usb_adapter *adap)
> return 0;
> }
>
> +static int cxusb_tt_ct2_4400_attach(struct dvb_usb_adapter *adap)
> +{
> + struct dvb_usb_device *d = adap->dev;
> + struct cxusb_state *st = d->priv;
> + struct i2c_adapter *adapter;
> + struct i2c_client *client_demod;
> + struct i2c_client *client_tuner;
> + struct i2c_board_info info;
> + struct si2168_config si2168_config;
> + struct si2157_config si2157_config;
> +
> + /* reset the tuner */
> + if (cxusb_tt_ct2_4400_gpio_tuner(d, 0) < 0) {
> + err("clear tuner gpio failed");
> + return -EIO;
> + }
> + msleep(100);
> + if (cxusb_tt_ct2_4400_gpio_tuner(d, 1) < 0) {
> + err("set tuner gpio failed");
> + return -EIO;
> + }
> + msleep(100);
> +
> + /* attach frontend */
> + si2168_config.i2c_adapter = &adapter;
> + si2168_config.fe = &adap->fe_adap[0].fe;
> + memset(&info, 0, sizeof(struct i2c_board_info));
> + strlcpy(info.type, "si2168", I2C_NAME_SIZE);
> + info.addr = 0x64;
> + info.platform_data = &si2168_config;
> + request_module(info.type);
> + client_demod = i2c_new_device(&d->i2c_adap, &info);
> + if (client_demod == NULL || client_demod->dev.driver == NULL)
> + return -ENODEV;
> +
> + if (!try_module_get(client_demod->dev.driver->owner)) {
> + i2c_unregister_device(client_demod);
> + return -ENODEV;
> + }
> +
> + st->i2c_client_demod = client_demod;
> +
> + /* attach tuner */
> + si2157_config.fe = adap->fe_adap[0].fe;
> + memset(&info, 0, sizeof(struct i2c_board_info));
> + strlcpy(info.type, "si2157", I2C_NAME_SIZE);
> + info.addr = 0x60;
> + info.platform_data = &si2157_config;
> + request_module(info.type);
> + client_tuner = i2c_new_device(adapter, &info);
> + if (client_tuner == NULL || client_tuner->dev.driver == NULL) {
> + module_put(client_demod->dev.driver->owner);
> + i2c_unregister_device(client_demod);
> + return -ENODEV;
> + }
> + if (!try_module_get(client_tuner->dev.driver->owner)) {
> + i2c_unregister_device(client_tuner);
> + module_put(client_demod->dev.driver->owner);
> + i2c_unregister_device(client_demod);
> + return -ENODEV;
> + }
> +
> + st->i2c_client_tuner = client_tuner;
> +
> + return 0;
> +}
> +
> /*
> * DViCO has shipped two devices with the same USB ID, but only one of them
> * needs a firmware download. Check the device class details to see if they
> @@ -1367,6 +1476,7 @@ static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_prope
> static struct dvb_usb_device_properties cxusb_aver_a868r_properties;
> static struct dvb_usb_device_properties cxusb_d680_dmb_properties;
> static struct dvb_usb_device_properties cxusb_mygica_d689_properties;
> +static struct dvb_usb_device_properties cxusb_tt_ct2_4400_properties;
>
> static int cxusb_probe(struct usb_interface *intf,
> const struct usb_device_id *id)
> @@ -1397,12 +1507,37 @@ static int cxusb_probe(struct usb_interface *intf,
> THIS_MODULE, NULL, adapter_nr) ||
> 0 == dvb_usb_device_init(intf, &cxusb_mygica_d689_properties,
> THIS_MODULE, NULL, adapter_nr) ||
> + 0 == dvb_usb_device_init(intf, &cxusb_tt_ct2_4400_properties,
> + THIS_MODULE, NULL, adapter_nr) ||
> 0)
> return 0;
>
> return -EINVAL;
> }
>
> +static void cxusb_disconnect(struct usb_interface *intf)
> +{
> + struct dvb_usb_device *d = usb_get_intfdata(intf);
> + struct cxusb_state *st = d->priv;
> + struct i2c_client *client;
> +
> + /* remove I2C client for tuner */
> + client = st->i2c_client_tuner;
> + if (client) {
> + module_put(client->dev.driver->owner);
> + i2c_unregister_device(client);
> + }
> +
> + /* remove I2C client for demodulator */
> + client = st->i2c_client_demod;
> + if (client) {
> + module_put(client->dev.driver->owner);
> + i2c_unregister_device(client);
> + }
> +
> + dvb_usb_device_exit(intf);
> +}
> +
> static struct usb_device_id cxusb_table [] = {
> { USB_DEVICE(USB_VID_MEDION, USB_PID_MEDION_MD95700) },
> { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LG064F_COLD) },
> @@ -1424,6 +1559,7 @@ static struct usb_device_id cxusb_table [] = {
> { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_4_REV_2) },
> { USB_DEVICE(USB_VID_CONEXANT, USB_PID_CONEXANT_D680_DMB) },
> { USB_DEVICE(USB_VID_CONEXANT, USB_PID_MYGICA_D689) },
> + { USB_DEVICE(USB_VID_TECHNOTREND, USB_PID_TECHNOTREND_TVSTICK_CT2_4400) },
> {} /* Terminating entry */
> };
> MODULE_DEVICE_TABLE (usb, cxusb_table);
> @@ -2070,10 +2206,63 @@ static struct dvb_usb_device_properties cxusb_mygica_d689_properties = {
> }
> };
>
> +static struct dvb_usb_device_properties cxusb_tt_ct2_4400_properties = {
> + .caps = DVB_USB_IS_AN_I2C_ADAPTER,
> +
> + .usb_ctrl = CYPRESS_FX2,
> +
> + .size_of_priv = sizeof(struct cxusb_state),
> +
> + .num_adapters = 1,
> + .adapter = {
> + {
> + .num_frontends = 1,
> + .fe = {{
> + .streaming_ctrl = cxusb_streaming_ctrl,
> + /* both frontend and tuner attached in the
> + same function */
> + .frontend_attach = cxusb_tt_ct2_4400_attach,
> +
> + /* parameter for the MPEG2-data transfer */
> + .stream = {
> + .type = USB_BULK,
> + .count = 8,
> + .endpoint = 0x82,
> + .u = {
> + .bulk = {
> + .buffersize = 4096,
> + }
> + }
> + },
> + } },
> + },
> + },
> +
> + .i2c_algo = &cxusb_i2c_algo,
> + .generic_bulk_ctrl_endpoint = 0x01,
> + .generic_bulk_ctrl_endpoint_response = 0x81,
> +
> + .rc.core = {
> + .rc_codes = RC_MAP_TT_1500,
> + .allowed_protos = RC_BIT_RC5,
> + .rc_query = cxusb_tt_ct2_4400_rc_query,
> + .rc_interval = 150,
> + },
> +
> + .num_device_descs = 1,
> + .devices = {
> + {
> + "TechnoTrend TVStick CT2-4400",
> + { NULL },
> + { &cxusb_table[20], NULL },
> + },
> + }
> +};
> +
> static struct usb_driver cxusb_driver = {
> .name = "dvb_usb_cxusb",
> .probe = cxusb_probe,
> - .disconnect = dvb_usb_device_exit,
> + .disconnect = cxusb_disconnect,
> .id_table = cxusb_table,
> };
>
> diff --git a/drivers/media/usb/dvb-usb/cxusb.h b/drivers/media/usb/dvb-usb/cxusb.h
> index 1a51eaf..527ff79 100644
> --- a/drivers/media/usb/dvb-usb/cxusb.h
> +++ b/drivers/media/usb/dvb-usb/cxusb.h
> @@ -30,6 +30,8 @@
>
> struct cxusb_state {
> u8 gpio_write_state[3];
> + struct i2c_client *i2c_client_demod;
> + struct i2c_client *i2c_client_tuner;
> };
>
> #endif
>
--
http://palosaari.fi/
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2014-07-13 17:15 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-13 13:52 [PATCH 0/6] [0b48:3014] TechnoTrend TVStick CT2-4400 Olli Salonen
2014-07-13 13:52 ` [PATCH 1/6] si2168: Small typo fix (SI2157 -> SI2168) Olli Salonen
2014-07-13 17:14 ` Antti Palosaari
2014-07-13 13:52 ` [PATCH 2/6] si2168: Add handling for different chip revisions and firmwares Olli Salonen
2014-07-13 17:14 ` Antti Palosaari
2014-07-13 13:52 ` [PATCH 3/6] si2157: Move chip initialization to si2157_init Olli Salonen
2014-07-13 17:14 ` Antti Palosaari
2014-07-13 13:52 ` [PATCH 4/6] si2157: Add support for Si2158 chip Olli Salonen
2014-07-13 17:14 ` Antti Palosaari
2014-07-13 13:52 ` [PATCH 5/6] si2157: Set delivery system and bandwidth before tuning Olli Salonen
2014-07-13 17:15 ` Antti Palosaari
2014-07-13 13:52 ` [PATCH 6/6] cxusb: TechnoTrend CT2-4400 USB DVB-T2/C tuner support Olli Salonen
2014-07-13 17:15 ` Antti Palosaari
2014-07-13 17:14 ` [PATCH 0/6] [0b48:3014] TechnoTrend TVStick CT2-4400 Antti Palosaari
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).