cron job: media_tree daily build: OK

2014-07-13 Thread Hans Verkuil
This message is generated daily by a cron job that builds media_tree for
the kernels and architectures in the list below.

Results of the daily build of media_tree:

date:   Mon Jul 14 04:00:25 CEST 2014
git branch: test
git hash:   3c0d394ea7022bb9666d9df97a5776c4bcc3045c
gcc version:i686-linux-gcc (GCC) 4.8.2
sparse version: v0.5.0-14-gf11dd94
host hardware:  x86_64
host os:3.14-5.slh.5-amd64

linux-git-arm-at91: OK
linux-git-arm-davinci: OK
linux-git-arm-exynos: OK
linux-git-arm-mx: OK
linux-git-arm-omap: OK
linux-git-arm-omap1: OK
linux-git-arm-pxa: OK
linux-git-blackfin: OK
linux-git-i686: OK
linux-git-m32r: OK
linux-git-mips: OK
linux-git-powerpc64: OK
linux-git-sh: OK
linux-git-x86_64: OK
linux-2.6.31.14-i686: OK
linux-2.6.32.27-i686: OK
linux-2.6.33.7-i686: OK
linux-2.6.34.7-i686: OK
linux-2.6.35.9-i686: OK
linux-2.6.36.4-i686: OK
linux-2.6.37.6-i686: OK
linux-2.6.38.8-i686: OK
linux-2.6.39.4-i686: OK
linux-3.0.60-i686: OK
linux-3.1.10-i686: OK
linux-3.2.37-i686: OK
linux-3.3.8-i686: OK
linux-3.4.27-i686: OK
linux-3.5.7-i686: OK
linux-3.6.11-i686: OK
linux-3.7.4-i686: OK
linux-3.8-i686: OK
linux-3.9.2-i686: OK
linux-3.10.1-i686: OK
linux-3.11.1-i686: OK
linux-3.12.23-i686: OK
linux-3.13.11-i686: OK
linux-3.14.9-i686: OK
linux-3.15.2-i686: OK
linux-3.16-rc1-i686: OK
linux-2.6.31.14-x86_64: OK
linux-2.6.32.27-x86_64: OK
linux-2.6.33.7-x86_64: OK
linux-2.6.34.7-x86_64: OK
linux-2.6.35.9-x86_64: OK
linux-2.6.36.4-x86_64: OK
linux-2.6.37.6-x86_64: OK
linux-2.6.38.8-x86_64: OK
linux-2.6.39.4-x86_64: OK
linux-3.0.60-x86_64: OK
linux-3.1.10-x86_64: OK
linux-3.2.37-x86_64: OK
linux-3.3.8-x86_64: OK
linux-3.4.27-x86_64: OK
linux-3.5.7-x86_64: OK
linux-3.6.11-x86_64: OK
linux-3.7.4-x86_64: OK
linux-3.8-x86_64: OK
linux-3.9.2-x86_64: OK
linux-3.10.1-x86_64: OK
linux-3.11.1-x86_64: OK
linux-3.12.23-x86_64: OK
linux-3.13.11-x86_64: OK
linux-3.14.9-x86_64: OK
linux-3.15.2-x86_64: OK
linux-3.16-rc1-x86_64: OK
apps: OK
spec-git: OK
sparse: WARNINGS

Detailed results are available here:

http://www.xs4all.nl/~hverkuil/logs/Monday.log

Full logs are available here:

http://www.xs4all.nl/~hverkuil/logs/Monday.tar.bz2

The Media Infrastructure API from this daily build is here:

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


Re: [PATCH 4/6] si2157: Add support for Si2158 chip

2014-07-13 Thread Antti Palosaari

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 
---
  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 
   *
@@ -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  = 11000,
.frequency_max  = 86200,
},
@@ -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

Re: [PATCH 5/6] si2157: Set delivery system and bandwidth before tuning

2014-07-13 Thread Antti Palosaari

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 
---
  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 <= 600)
+   bandwidth = 0x06;
+   else if (c->bandwidth_hz <= 700)
+   bandwidth = 0x07;
+   else if (c->bandwidth_hz <= 800)
+   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/
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 6/6] cxusb: TechnoTrend CT2-4400 USB DVB-T2/C tuner support

2014-07-13 Thread Antti Palosaari

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 
---
  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_8KEEPROM0x3009
  #define USB_PID_TECHNOTREND_CONNECT_CT36500x300d
+#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_20x0081
  #define USB_PID_TERRATEC_CINERGY_HT_USB_XE0x0058
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 != 0x) {
+   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) {
+   

Re: [PATCH 2/6] si2168: Add handling for different chip revisions and firmwares

2014-07-13 Thread Antti Palosaari

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 
---
  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 ");
  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 
  #include 

-#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/
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/6] si2157: Move chip initialization to si2157_init

2014-07-13 Thread Antti Palosaari

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 
---
  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/
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/6] si2168: Small typo fix (SI2157 -> SI2168)

2014-07-13 Thread Antti Palosaari

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 
---
  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/
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/6] [0b48:3014] TechnoTrend TVStick CT2-4400

2014-07-13 Thread Antti Palosaari

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/
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 6/6] cxusb: TechnoTrend CT2-4400 USB DVB-T2/C tuner support

2014-07-13 Thread Olli Salonen
Signed-off-by: Olli Salonen 
---
 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 != 0x) {
+   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_con

[PATCH 5/6] si2157: Set delivery system and bandwidth before tuning

2014-07-13 Thread Olli Salonen
Signed-off-by: Olli Salonen 
---
 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 <= 600)
+   bandwidth = 0x06;
+   else if (c->bandwidth_hz <= 700)
+   bandwidth = 0x07;
+   else if (c->bandwidth_hz <= 800)
+   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

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


[PATCH 4/6] si2157: Add support for Si2158 chip

2014-07-13 Thread Olli Salonen
Signed-off-by: Olli Salonen 
---
 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 
  *
@@ -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  = 11000,
.frequency_max  = 86200,
},
@@ -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 ");
 MODULE_LICENSE("GPL");
diff --git a/drivers/media/tuners/si2157.h b/drivers/me

[PATCH 3/6] si2157: Move chip initialization to si2157_init

2014-07-13 Thread Olli Salonen
Signed-off-by: Olli Salonen 
---
 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

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


[PATCH 0/6] [0b48:3014] TechnoTrend TVStick CT2-4400

2014-07-13 Thread 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

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


[PATCH 2/6] si2168: Add handling for different chip revisions and firmwares

2014-07-13 Thread Olli Salonen
Signed-off-by: Olli Salonen 
---
 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 ");
 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 
 #include 
 
-#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

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


[PATCH 1/6] si2168: Small typo fix (SI2157 -> SI2168)

2014-07-13 Thread Olli Salonen
Signed-off-by: Olli Salonen 
---
 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

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


Re: PCTV T292e whole DVBT2 mux/Ultra HD performance question

2014-07-13 Thread Andre Newman

On 9 Jul 2014, at 20:18, Antti Palosaari  wrote:

> Moikka
> 
> 
> On 07/09/2014 04:14 PM, Andre Newman wrote:
>> I’m using a T290e for whole mux DVBT2 capture, using this to record the 
>> current BBC World Cup Ultra HD tests, works well. :-)
>> 
>> It seems impossible to buy more T290e’s, everyone want to sell me a T292e, I 
>> understand there is a driver now, thanks Antti. I read on Antti’s blog that 
>> there is a limit on raw TS performance with the T292, that it didn’t work 
>> well with QAM256 because of this...
>> 
>> I am wondering if this is a hardware limit, or a performance problem that 
>> may have been resolved now the driver is a little tiny bit more mature?
>> 
>> I am very happy to get a T292e and make some tests, help debug if there is a 
>> hope that it can handle 40Mbps in hardware.If there is a hardware limit I’d 
>> rather not be stuck with a limited tuner!
>> 
>> The mux I need to record is QAM256 at ~40Mbps and the UHD video is ~36Mbps 
>> of this.
>> 
>> Otherwise what other DVBT2 tuners are there that can capture a raw QAM256 
>> mux at 40Mbps?
> 
> You simply confused two different devices. There is no such limit on PCTV 
> 292e as far as I know. It is another DVB-T2 device having RTL2832P bridge 
> having problem with stream bandwidth.

And just for the record, as Google seems to find this page first for any 
mention of the PCTV T292e:

I have a T292e now and it records a full DVBT2 mux at ~40Mbps with no problem 
at all. I’m using Ubuntu 14.04 with yesterday's media_build script. 

Thanks again to Antti and anyone else working on this driver.

Andre




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

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