[PATCH 3/3] dvb-usb-cxusb: Geniatech T230C support.

2017-02-07 Thread CrazyCat
Updated Geniatech DVB-T/T2 stick support.

Signed-off-by: Evgeny Plehov 
---
 drivers/media/usb/dvb-usb/cxusb.c | 139 +-
 1 file changed, 138 insertions(+), 1 deletion(-)

diff --git a/drivers/media/usb/dvb-usb/cxusb.c 
b/drivers/media/usb/dvb-usb/cxusb.c
index 5d7b4ea..9b541db 100644
--- a/drivers/media/usb/dvb-usb/cxusb.c
+++ b/drivers/media/usb/dvb-usb/cxusb.c
@@ -1238,6 +1238,82 @@ static int cxusb_mygica_t230_frontend_attach(struct 
dvb_usb_adapter *adap)
return 0;
 }
 
+static int cxusb_mygica_t230c_frontend_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;
+
+   /* Select required USB configuration */
+   if (usb_set_interface(d->udev, 0, 0) < 0)
+   err("set interface failed");
+
+   /* Unblock all USB pipes */
+   usb_clear_halt(d->udev,
+   usb_sndbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint));
+   usb_clear_halt(d->udev,
+   usb_rcvbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint));
+   usb_clear_halt(d->udev,
+   usb_rcvbulkpipe(d->udev, 
d->props.adapter[0].fe[0].stream.endpoint));
+
+   /* attach frontend */
+   memset(_config, 0, sizeof(si2168_config));
+   si2168_config.i2c_adapter = 
+   si2168_config.fe = >fe_adap[0].fe;
+   si2168_config.ts_mode = SI2168_TS_PARALLEL;
+   si2168_config.ts_clock_inv = 1;
+   memset(, 0, sizeof(struct i2c_board_info));
+   strlcpy(info.type, "si2168", I2C_NAME_SIZE);
+   info.addr = 0x64;
+   info.platform_data = _config;
+   request_module(info.type);
+   client_demod = i2c_new_device(>i2c_adap, );
+   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;
+   }
+
+   /* attach tuner */
+   memset(_config, 0, sizeof(si2157_config));
+   si2157_config.fe = adap->fe_adap[0].fe;
+   memset(, 0, sizeof(struct i2c_board_info));
+   strlcpy(info.type, "si2141", I2C_NAME_SIZE);
+   info.addr = 0x60;
+   info.platform_data = _config;
+   request_module("si2157");
+   client_tuner = i2c_new_device(adapter, );
+   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_demod = client_demod;
+   st->i2c_client_tuner = client_tuner;
+
+   /* hook fe: need to resync the slave fifo when signal locks. */
+   mutex_init(>stream_mutex);
+   st->last_lock = 0;
+   st->fe_read_status = adap->fe_adap[0].fe->ops.read_status;
+   adap->fe_adap[0].fe->ops.read_status = cxusb_read_status;
+
+   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
@@ -1320,6 +1396,7 @@ static int bluebird_patch_dvico_firmware_download(struct 
usb_device *udev,
 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_mygica_t230_properties;
+static struct dvb_usb_device_properties cxusb_mygica_t230c_properties;
 
 static int cxusb_probe(struct usb_interface *intf,
   const struct usb_device_id *id)
@@ -1352,6 +1429,8 @@ static int cxusb_probe(struct usb_interface *intf,
 THIS_MODULE, NULL, adapter_nr) ||
0 == dvb_usb_device_init(intf, _mygica_t230_properties,
 THIS_MODULE, NULL, adapter_nr) ||
+   0 == dvb_usb_device_init(intf, _mygica_t230c_properties,
+THIS_MODULE, NULL, adapter_nr) ||
0)
return 0;
 
@@ -1403,6 +1482,7 @@ enum cxusb_table_index {
CONEXANT_D680_DMB,
MYGICA_D689,
MYGICA_T230,
+   MYGICA_T230C,
NR__cxusb_table_index
 };
 
@@ -1470,6 +1550,9 @@ enum cxusb_table_index {
[MYGICA_T230] = {
USB_DEVICE(USB_VID_CONEXANT, USB_PID_MYGICA_T230)
},
+   [MYGICA_T230C] = {
+

[PATCH 1/3] si2168: Si2168-D60 support.

2017-02-07 Thread CrazyCat
Support for new demod version.

Signed-off-by: Evgeny Plehov 
---
 drivers/media/dvb-frontends/si2168.c  | 4 
 drivers/media/dvb-frontends/si2168_priv.h | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/drivers/media/dvb-frontends/si2168.c 
b/drivers/media/dvb-frontends/si2168.c
index 680ba06..172fc36 100644
--- a/drivers/media/dvb-frontends/si2168.c
+++ b/drivers/media/dvb-frontends/si2168.c
@@ -740,6 +740,9 @@ static int si2168_probe(struct i2c_client *client,
case SI2168_CHIP_ID_B40:
dev->firmware_name = SI2168_B40_FIRMWARE;
break;
+   case SI2168_CHIP_ID_D60:
+   dev->firmware_name = SI2168_D60_FIRMWARE;
+   break;
default:
dev_dbg(>dev, "unknown chip version Si21%d-%c%c%c\n",
cmd.args[2], cmd.args[1], cmd.args[3], cmd.args[4]);
@@ -827,3 +830,4 @@ static int si2168_remove(struct i2c_client *client)
 MODULE_FIRMWARE(SI2168_A20_FIRMWARE);
 MODULE_FIRMWARE(SI2168_A30_FIRMWARE);
 MODULE_FIRMWARE(SI2168_B40_FIRMWARE);
+MODULE_FIRMWARE(SI2168_D60_FIRMWARE);
diff --git a/drivers/media/dvb-frontends/si2168_priv.h 
b/drivers/media/dvb-frontends/si2168_priv.h
index 2fecac6..737cf41 100644
--- a/drivers/media/dvb-frontends/si2168_priv.h
+++ b/drivers/media/dvb-frontends/si2168_priv.h
@@ -26,6 +26,7 @@
 #define SI2168_A20_FIRMWARE "dvb-demod-si2168-a20-01.fw"
 #define SI2168_A30_FIRMWARE "dvb-demod-si2168-a30-01.fw"
 #define SI2168_B40_FIRMWARE "dvb-demod-si2168-b40-01.fw"
+#define SI2168_D60_FIRMWARE "dvb-demod-si2168-d60-01.fw"
 #define SI2168_B40_FIRMWARE_FALLBACK "dvb-demod-si2168-02.fw"
 
 /* state struct */
@@ -38,6 +39,7 @@ struct si2168_dev {
#define SI2168_CHIP_ID_A20 ('A' << 24 | 68 << 16 | '2' << 8 | '0' << 0)
#define SI2168_CHIP_ID_A30 ('A' << 24 | 68 << 16 | '3' << 8 | '0' << 0)
#define SI2168_CHIP_ID_B40 ('B' << 24 | 68 << 16 | '4' << 8 | '0' << 0)
+   #define SI2168_CHIP_ID_D60 ('D' << 24 | 68 << 16 | '6' << 8 | '0' << 0)
unsigned int chip_id;
unsigned int version;
const char *firmware_name;
-- 
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/3] si2157: Si2141/2151 tuner support.

2017-02-07 Thread CrazyCat
Support for new tuner version.

Signed-off-by: Evgeny Plehov 
---
 drivers/media/tuners/si2157.c  | 70 ++
 drivers/media/tuners/si2157_priv.h |  2 ++
 2 files changed, 66 insertions(+), 6 deletions(-)

diff --git a/drivers/media/tuners/si2157.c b/drivers/media/tuners/si2157.c
index 57b2508..b46b149 100644
--- a/drivers/media/tuners/si2157.c
+++ b/drivers/media/tuners/si2157.c
@@ -1,5 +1,5 @@
 /*
- * Silicon Labs Si2146/2147/2148/2157/2158 silicon tuner driver
+ * Silicon Labs Si2141/2146/2147/2148/2151/2157/2158 silicon tuner driver
  *
  * Copyright (C) 2014 Antti Palosaari 
  *
@@ -75,6 +75,7 @@ static int si2157_cmd_execute(struct i2c_client *client, 
struct si2157_cmd *cmd)
return ret;
 }
 
+#define MAX_RESET_ATTEMPTS 10
 static int si2157_init(struct dvb_frontend *fe)
 {
struct i2c_client *client = fe->tuner_priv;
@@ -84,7 +85,7 @@ static int si2157_init(struct dvb_frontend *fe)
struct si2157_cmd cmd;
const struct firmware *fw;
const char *fw_name;
-   unsigned int uitmp, chip_id;
+   unsigned int uitmp, chip_id, i;
 
dev_dbg(>dev, "\n");
 
@@ -102,14 +103,44 @@ static int si2157_init(struct dvb_frontend *fe)
if (uitmp == dev->if_frequency / 1000)
goto warm;
 
+   if (dev->chiptype == SI2157_CHIPTYPE_SI2141) {
+   for (i = 0; i < MAX_RESET_ATTEMPTS; i++)  {
+   /* reset */
+   memcpy(cmd.args, "\xc0\x05\x00\x00", 4);
+   cmd.wlen = 4;
+   cmd.rlen = 1;
+   ret = si2157_cmd_execute(client, );
+   if (ret)
+   goto err;
+
+   memcpy(cmd.args, 
"\xc0\x00\x0d\x0e\x00\x01\x01\x01\x01\x03", 10);
+   cmd.wlen = 10;
+   cmd.rlen = 1;
+   ret = si2157_cmd_execute(client, );
+   if (ret)
+   goto err;
+   if (cmd.args[0] != 0xfe)
+   break;
+   }
+   if (i >= MAX_RESET_ATTEMPTS)
+   goto err;
+   }
+
/* power up */
-   if (dev->chiptype == SI2157_CHIPTYPE_SI2146) {
+   switch (dev->chiptype) {
+   case SI2157_CHIPTYPE_SI2146:
memcpy(cmd.args, "\xc0\x05\x01\x00\x00\x0b\x00\x00\x01", 9);
cmd.wlen = 9;
-   } else {
+   break;
+   case SI2157_CHIPTYPE_SI2141:
+   memcpy(cmd.args, "\xc0\x08\x01\x02\x00\x08\x01", 7);
+   cmd.wlen = 7;
+   break;
+   default:
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(client, );
if (ret)
@@ -131,6 +162,8 @@ static int si2157_init(struct dvb_frontend *fe)
#define SI2157_A30 ('A' << 24 | 57 << 16 | '3' << 8 | '0' << 0)
#define SI2147_A30 ('A' << 24 | 47 << 16 | '3' << 8 | '0' << 0)
#define SI2146_A10 ('A' << 24 | 46 << 16 | '1' << 8 | '0' << 0)
+   #define SI2141_A10 ('A' << 24 | 41 << 16 | '1' << 8 | '0' << 0)
+   #define SI2151_A10 ('A' << 24 | 51 << 16 | '1' << 8 | '0' << 0)
 
switch (chip_id) {
case SI2158_A20:
@@ -142,6 +175,10 @@ static int si2157_init(struct dvb_frontend *fe)
case SI2146_A10:
fw_name = NULL;
break;
+   case SI2141_A10:
+   case SI2151_A10:
+   fw_name = SI2141_A10_FIRMWARE;
+   break;
default:
dev_err(>dev, "unknown chip version Si21%d-%c%c%c\n",
cmd.args[2], cmd.args[1],
@@ -214,6 +251,23 @@ static int si2157_init(struct dvb_frontend *fe)
 
dev_info(>dev, "firmware version: %c.%c.%d\n",
cmd.args[6], cmd.args[7], cmd.args[8]);
+
+   if (dev->chiptype == SI2157_CHIPTYPE_SI2141) {
+   /* set clock */
+   memcpy(cmd.args, "\xc0\x00\x0d", 3);
+   cmd.wlen = 3;
+   cmd.rlen = 1;
+   ret = si2157_cmd_execute(client, );
+   if (ret)
+   goto err;
+   /* setup PIN */
+   memcpy(cmd.args, "\x12\x80\x80\x85\x00\x81\x00", 7);
+   cmd.wlen = 7;
+   cmd.rlen = 7;
+   ret = si2157_cmd_execute(client, );
+   if (ret)
+   goto err;
+   }
 warm:
/* init statistics in order signal app which are supported */
c->strength.len = 1;
@@ -471,7 +525,8 @@ static int si2157_probe(struct i2c_client *client,
 #endif
 
dev_info(>dev, "Silicon Labs %s successfully attached\n",
-   dev->chiptype == SI2157_CHIPTYPE_SI2146 ?
+   

[PATCH 4/4] dvb-usb-cxusb: Geniatech Mygica T230C support.

2016-12-08 Thread CrazyCat
Updated Geniatech DVB-T/T2 stick support.

Signed-off-by: CrazyCat <crazyca...@narod.ru>
---
 drivers/media/usb/dvb-usb/cxusb.c | 136 ++
 1 file changed, 136 insertions(+)

diff --git a/drivers/media/usb/dvb-usb/cxusb.c 
b/drivers/media/usb/dvb-usb/cxusb.c
index 3edc30d..4bf4c68 100644
--- a/drivers/media/usb/dvb-usb/cxusb.c
+++ b/drivers/media/usb/dvb-usb/cxusb.c
@@ -1439,6 +1439,82 @@ static int cxusb_mygica_t230_frontend_attach(struct 
dvb_usb_adapter *adap)
return 0;
 }
 
+static int cxusb_mygica_t230c_frontend_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;
+
+   /* Select required USB configuration */
+   if (usb_set_interface(d->udev, 0, 0) < 0)
+   err("set interface failed");
+
+   /* Unblock all USB pipes */
+   usb_clear_halt(d->udev,
+   usb_sndbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint));
+   usb_clear_halt(d->udev,
+   usb_rcvbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint));
+   usb_clear_halt(d->udev,
+   usb_rcvbulkpipe(d->udev, 
d->props.adapter[0].fe[0].stream.endpoint));
+
+   /* attach frontend */
+   memset(_config, 0, sizeof(si2168_config));
+   si2168_config.i2c_adapter = 
+   si2168_config.fe = >fe_adap[0].fe;
+   si2168_config.ts_mode = SI2168_TS_PARALLEL;
+   si2168_config.ts_clock_inv = 1;
+   memset(, 0, sizeof(struct i2c_board_info));
+   strlcpy(info.type, "si2168", I2C_NAME_SIZE);
+   info.addr = 0x64;
+   info.platform_data = _config;
+   request_module(info.type);
+   client_demod = i2c_new_device(>i2c_adap, );
+   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;
+   }
+
+   /* attach tuner */
+   memset(_config, 0, sizeof(si2157_config));
+   si2157_config.fe = adap->fe_adap[0].fe;
+   memset(, 0, sizeof(struct i2c_board_info));
+   strlcpy(info.type, "si2141", I2C_NAME_SIZE);
+   info.addr = 0x60;
+   info.platform_data = _config;
+   request_module("si2157");
+   client_tuner = i2c_new_device(adapter, );
+   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_demod = client_demod;
+   st->i2c_client_tuner = client_tuner;
+
+   /* hook fe: need to resync the slave fifo when signal locks. */
+   mutex_init(>stream_mutex);
+   st->last_lock = 0;
+   st->fe_read_status = adap->fe_adap[0].fe->ops.read_status;
+   adap->fe_adap[0].fe->ops.read_status = cxusb_read_status;
+
+   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
@@ -1521,6 +1597,7 @@ static int bluebird_patch_dvico_firmware_download(struct 
usb_device *udev,
 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_mygica_t230_properties;
+static struct dvb_usb_device_properties cxusb_mygica_t230c_properties;
 
 static int cxusb_probe(struct usb_interface *intf,
   const struct usb_device_id *id)
@@ -1553,6 +1630,8 @@ static int cxusb_probe(struct usb_interface *intf,
 THIS_MODULE, NULL, adapter_nr) ||
0 == dvb_usb_device_init(intf, _mygica_t230_properties,
 THIS_MODULE, NULL, adapter_nr) ||
+   0 == dvb_usb_device_init(intf, _mygica_t230c_properties,
+THIS_MODULE, NULL, adapter_nr) ||
0)
return 0;
 
@@ -1604,6 +1683,7 @@ enum cxusb_table_index {
CONEXANT_D680_DMB,
MYGICA_D689,
MYGICA_T230,
+   MYGICA_T230C,
NR__cxusb_table_index
 };
 
@@ -1671,6 +1751,9 @@ enum cxusb_table_index {
 

[PATCH 1/4] dvb-usb-cxusb: New RC map for Geniatech Mygica T230.

2016-12-08 Thread CrazyCat
Updated RC map for Geniatech DVB-T/T2 sticks.

Signed-off-by: CrazyCat <crazyca...@narod.ru>
---
 drivers/media/usb/dvb-usb/cxusb.c | 42 +--
 1 file changed, 40 insertions(+), 2 deletions(-)

diff --git a/drivers/media/usb/dvb-usb/cxusb.c 
b/drivers/media/usb/dvb-usb/cxusb.c
index 9b8771e..3edc30d 100644
--- a/drivers/media/usb/dvb-usb/cxusb.c
+++ b/drivers/media/usb/dvb-usb/cxusb.c
@@ -653,6 +653,44 @@ static int cxusb_d680_dmb_rc_query(struct dvb_usb_device 
*d, u32 *event,
{ 0x0025, KEY_POWER },
 };
 
+static struct rc_map_table rc_map_t230_table[] = {
+   { 0x, KEY_0 },
+   { 0x0001, KEY_1 },
+   { 0x0002, KEY_2 },
+   { 0x0003, KEY_3 },
+   { 0x0004, KEY_4 },
+   { 0x0005, KEY_5 },
+   { 0x0006, KEY_6 },
+   { 0x0007, KEY_7 },
+   { 0x0008, KEY_8 },
+   { 0x0009, KEY_9 },
+   { 0x000a, KEY_MUTE },
+   { 0x000b, KEY_STOP },   /* Stop */
+   { 0x000c, KEY_POWER2 }, /* Turn on/off application */
+   { 0x000d, KEY_OK }, /* OK */
+   { 0x000e, KEY_CAMERA }, /* Snapshot */
+   { 0x000f, KEY_ZOOM },   /* Full Screen/Restore */
+   { 0x0010, KEY_RIGHT },  /* Right arrow */
+   { 0x0011, KEY_LEFT },   /* Left arrow */
+   { 0x0012, KEY_CHANNELUP },
+   { 0x0013, KEY_CHANNELDOWN },
+   { 0x0014, KEY_SHUFFLE },
+   { 0x0016, KEY_PAUSE },
+   { 0x0017, KEY_PLAY },   /* Play */
+   { 0x001e, KEY_TIME },   /* Time Shift */
+   { 0x001f, KEY_RECORD },
+   { 0x0020, KEY_UP },
+   { 0x0021, KEY_DOWN },
+   { 0x0025, KEY_POWER },  /* Turn off computer */
+   { 0x0026, KEY_REWIND }, /* FR << */
+   { 0x0027, KEY_FASTFORWARD },/* FF >> */
+   { 0x0029, KEY_ESC },
+   { 0x002b, KEY_VOLUMEUP },
+   { 0x002c, KEY_VOLUMEDOWN },
+   { 0x002d, KEY_CHANNEL },/* CH Surfing */
+   { 0x0038, KEY_VIDEO },  /* TV/AV/S-Video/YPbPr */
+};
+
 static int cxusb_dee1601_demod_init(struct dvb_frontend* fe)
 {
static u8 clock_config []  = { CLOCK_CTL,  0x38, 0x28 };
@@ -2317,8 +2355,8 @@ struct dvb_usb_device_properties 
cxusb_bluebird_dualdig4_rev2_properties = {
 
.rc.legacy = {
.rc_interval  = 100,
-   .rc_map_table = rc_map_d680_dmb_table,
-   .rc_map_size  = ARRAY_SIZE(rc_map_d680_dmb_table),
+   .rc_map_table = rc_map_t230_table,
+   .rc_map_size  = ARRAY_SIZE(rc_map_t230_table),
.rc_query = cxusb_d680_dmb_rc_query,
},
 
-- 
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/4] si2168: Si2168-D60 support.

2016-12-08 Thread CrazyCat
Support for new demod version.

Signed-off-by: CrazyCat <crazyca...@narod.ru>
---
 drivers/media/dvb-frontends/si2168.c  | 4 
 drivers/media/dvb-frontends/si2168_priv.h | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/drivers/media/dvb-frontends/si2168.c 
b/drivers/media/dvb-frontends/si2168.c
index 20b4a65..28f3bbe 100644
--- a/drivers/media/dvb-frontends/si2168.c
+++ b/drivers/media/dvb-frontends/si2168.c
@@ -674,6 +674,9 @@ static int si2168_probe(struct i2c_client *client,
case SI2168_CHIP_ID_B40:
dev->firmware_name = SI2168_B40_FIRMWARE;
break;
+   case SI2168_CHIP_ID_D60:
+   dev->firmware_name = SI2168_D60_FIRMWARE;
+   break;
default:
dev_dbg(>dev, "unknown chip version Si21%d-%c%c%c\n",
cmd.args[2], cmd.args[1], cmd.args[3], cmd.args[4]);
@@ -761,3 +764,4 @@ static int si2168_remove(struct i2c_client *client)
 MODULE_FIRMWARE(SI2168_A20_FIRMWARE);
 MODULE_FIRMWARE(SI2168_A30_FIRMWARE);
 MODULE_FIRMWARE(SI2168_B40_FIRMWARE);
+MODULE_FIRMWARE(SI2168_D60_FIRMWARE);
diff --git a/drivers/media/dvb-frontends/si2168_priv.h 
b/drivers/media/dvb-frontends/si2168_priv.h
index 7843ccb..4baa95b 100644
--- a/drivers/media/dvb-frontends/si2168_priv.h
+++ b/drivers/media/dvb-frontends/si2168_priv.h
@@ -25,6 +25,7 @@
 #define SI2168_A20_FIRMWARE "dvb-demod-si2168-a20-01.fw"
 #define SI2168_A30_FIRMWARE "dvb-demod-si2168-a30-01.fw"
 #define SI2168_B40_FIRMWARE "dvb-demod-si2168-b40-01.fw"
+#define SI2168_D60_FIRMWARE "dvb-demod-si2168-d60-01.fw"
 #define SI2168_B40_FIRMWARE_FALLBACK "dvb-demod-si2168-02.fw"
 
 /* state struct */
@@ -37,6 +38,7 @@ struct si2168_dev {
#define SI2168_CHIP_ID_A20 ('A' << 24 | 68 << 16 | '2' << 8 | '0' << 0)
#define SI2168_CHIP_ID_A30 ('A' << 24 | 68 << 16 | '3' << 8 | '0' << 0)
#define SI2168_CHIP_ID_B40 ('B' << 24 | 68 << 16 | '4' << 8 | '0' << 0)
+   #define SI2168_CHIP_ID_D60 ('D' << 24 | 68 << 16 | '6' << 8 | '0' << 0)
unsigned int chip_id;
unsigned int version;
const char *firmware_name;
-- 
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 3/4] si2157: Si2141/2151 tuner support.

2016-12-08 Thread CrazyCat
Support for new tuner version.

Signed-off-by: CrazyCat <crazyca...@narod.ru>
---
 drivers/media/tuners/si2157.c  | 71 ++
 drivers/media/tuners/si2157_priv.h |  2 ++
 2 files changed, 67 insertions(+), 6 deletions(-)

diff --git a/drivers/media/tuners/si2157.c b/drivers/media/tuners/si2157.c
index 57b2508..69fd21e 100644
--- a/drivers/media/tuners/si2157.c
+++ b/drivers/media/tuners/si2157.c
@@ -1,5 +1,5 @@
 /*
- * Silicon Labs Si2146/2147/2148/2157/2158 silicon tuner driver
+ * Silicon Labs Si2141/2146/2147/2148/2151/2157/2158 silicon tuner driver
  *
  * Copyright (C) 2014 Antti Palosaari <cr...@iki.fi>
  *
@@ -84,7 +84,7 @@ static int si2157_init(struct dvb_frontend *fe)
struct si2157_cmd cmd;
const struct firmware *fw;
const char *fw_name;
-   unsigned int uitmp, chip_id;
+   unsigned int uitmp, chip_id, count;
 
dev_dbg(>dev, "\n");
 
@@ -102,14 +102,46 @@ static int si2157_init(struct dvb_frontend *fe)
if (uitmp == dev->if_frequency / 1000)
goto warm;
 
+   if (dev->chiptype == SI2157_CHIPTYPE_SI2141) {
+   count = 0;
+   do {
+   if (count > 10)
+   goto err;
+
+   /* reset */
+   memcpy(cmd.args, "\xc0\x05\x00\x00", 4);
+   cmd.wlen = 4;
+   cmd.rlen = 1;
+   ret = si2157_cmd_execute(client, );
+   if (ret)
+   goto err;
+
+   memcpy(cmd.args, 
"\xc0\x00\x0d\x0e\x00\x01\x01\x01\x01\x03", 10);
+   cmd.wlen = 10;
+   cmd.rlen = 1;
+   ret = si2157_cmd_execute(client, );
+   if (ret)
+   goto err;
+   count++;
+   } while (cmd.args[0] == 0xfe);
+   dev_info(>dev, "Si2141/2151 reset attempts %d\n", 
count);
+   }
+
/* power up */
-   if (dev->chiptype == SI2157_CHIPTYPE_SI2146) {
+   switch (dev->chiptype) {
+   case SI2157_CHIPTYPE_SI2146:
memcpy(cmd.args, "\xc0\x05\x01\x00\x00\x0b\x00\x00\x01", 9);
cmd.wlen = 9;
-   } else {
+   break;
+   case SI2157_CHIPTYPE_SI2141:
+   memcpy(cmd.args, "\xc0\x08\x01\x02\x00\x08\x01", 7);
+   cmd.wlen = 7;
+   break;
+   default:
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(client, );
if (ret)
@@ -131,6 +163,8 @@ static int si2157_init(struct dvb_frontend *fe)
#define SI2157_A30 ('A' << 24 | 57 << 16 | '3' << 8 | '0' << 0)
#define SI2147_A30 ('A' << 24 | 47 << 16 | '3' << 8 | '0' << 0)
#define SI2146_A10 ('A' << 24 | 46 << 16 | '1' << 8 | '0' << 0)
+   #define SI2141_A10 ('A' << 24 | 41 << 16 | '1' << 8 | '0' << 0)
+   #define SI2151_A10 ('A' << 24 | 51 << 16 | '1' << 8 | '0' << 0)
 
switch (chip_id) {
case SI2158_A20:
@@ -142,6 +176,10 @@ static int si2157_init(struct dvb_frontend *fe)
case SI2146_A10:
fw_name = NULL;
break;
+   case SI2141_A10:
+   case SI2151_A10:
+   fw_name = SI2141_A10_FIRMWARE;
+   break;
default:
dev_err(>dev, "unknown chip version Si21%d-%c%c%c\n",
cmd.args[2], cmd.args[1],
@@ -214,6 +252,23 @@ static int si2157_init(struct dvb_frontend *fe)
 
dev_info(>dev, "firmware version: %c.%c.%d\n",
cmd.args[6], cmd.args[7], cmd.args[8]);
+
+   if (dev->chiptype == SI2157_CHIPTYPE_SI2141) {
+   /* set clock */
+   memcpy(cmd.args, "\xc0\x00\x0d", 3);
+   cmd.wlen = 3;
+   cmd.rlen = 1;
+   ret = si2157_cmd_execute(client, );
+   if (ret)
+   goto err;
+   /* setup PIN */
+   memcpy(cmd.args, "\x12\x80\x80\x85\x00\x81\x00", 7);
+   cmd.wlen = 7;
+   cmd.rlen = 7;
+   ret = si2157_cmd_execute(client, );
+   if (ret)
+   goto err;
+   }
 warm:
/* init statistics in order signal app which are supported */
c->strength.len = 1;
@@ -471,7 +526,8 @@ static int si2157_probe(struct i2c_client *client,
 #endif
 
dev_info(>dev, "Silicon Labs %s successfully attached\n",
-   

[PATCH] dvb-usb-cxusb: Geniatech T230 - resync TS FIFO after lock

2016-10-21 Thread CrazyCat
This patch fix streaming issue for Geniatech T230/PT360.

Signed-off-by: CrazyCat <crazyca...@narod.ru>
---
 drivers/media/usb/dvb-usb/cxusb.c | 26 ++
 drivers/media/usb/dvb-usb/cxusb.h |  5 +
 2 files changed, 31 insertions(+)

diff --git a/drivers/media/usb/dvb-usb/cxusb.c 
b/drivers/media/usb/dvb-usb/cxusb.c
index 3701f59..46b59c3 100644
--- a/drivers/media/usb/dvb-usb/cxusb.c
+++ b/drivers/media/usb/dvb-usb/cxusb.c
@@ -368,6 +368,26 @@ static int cxusb_aver_streaming_ctrl(struct 
dvb_usb_adapter *adap, int onoff)
return 0;
 }
 
+static int cxusb_read_status(struct dvb_frontend *fe,
+ enum fe_status *status)
+{
+   struct dvb_usb_adapter *adap = (struct dvb_usb_adapter *)fe->dvb->priv;
+   struct cxusb_state *state = (struct cxusb_state *)adap->dev->priv;
+   int ret;
+
+   ret = state->fe_read_status(fe, status);
+
+   /* it need resync slave fifo when signal change from unlock to lock.*/
+   if ((*status & FE_HAS_LOCK) && (!state->last_lock)) {
+   mutex_lock(>stream_mutex);
+   cxusb_streaming_ctrl(adap, 1);
+   mutex_unlock(>stream_mutex);
+   }
+
+   state->last_lock = (*status & FE_HAS_LOCK) ? 1 : 0;
+   return ret;
+}
+
 static void cxusb_d680_dmb_drain_message(struct dvb_usb_device *d)
 {
int   ep = d->props.generic_bulk_ctrl_endpoint;
@@ -1370,6 +1390,12 @@ static int cxusb_mygica_t230_frontend_attach(struct 
dvb_usb_adapter *adap)
st->i2c_client_demod = client_demod;
st->i2c_client_tuner = client_tuner;
 
+   /* hook fe: need to resync the slave fifo when signal locks. */
+   mutex_init(>stream_mutex);
+   st->last_lock = 0;
+   st->fe_read_status = adap->fe_adap[0].fe->ops.read_status;
+   adap->fe_adap[0].fe->ops.read_status = cxusb_read_status;
+
return 0;
 }
 
diff --git a/drivers/media/usb/dvb-usb/cxusb.h 
b/drivers/media/usb/dvb-usb/cxusb.h
index 527ff79..22b3253 100644
--- a/drivers/media/usb/dvb-usb/cxusb.h
+++ b/drivers/media/usb/dvb-usb/cxusb.h
@@ -32,6 +32,11 @@ struct cxusb_state {
u8 gpio_write_state[3];
struct i2c_client *i2c_client_demod;
struct i2c_client *i2c_client_tuner;
+
+   struct mutex stream_mutex;
+   u8 last_lock;
+   int (*fe_read_status)(struct dvb_frontend *fe,
+   enum fe_status *status);
 };
 
 #endif
-- 
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: [PATCH 1/3] tuners: si2157: Si2148 support.

2014-11-20 Thread CrazyCat
No need, because si214x is same si215x without analog filter path.

20.11.2014, 22:10, Olli Salonen olli.salo...@iki.fi:
 Crazycat, do you think you could change the firmware loading for Si2148
 as discussed here though and send a new patch?
--
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/3] tuners: si2157: Si2148 support.

2014-11-14 Thread CrazyCat
Si2148-A20 silicon tuner support.

Signed-off-by: Evgeny Plehov evgenyple...@ukr.net
---
 drivers/media/tuners/si2157.c  | 10 ++
 drivers/media/tuners/si2157.h  |  2 +-
 drivers/media/tuners/si2157_priv.h |  2 +-
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/media/tuners/si2157.c b/drivers/media/tuners/si2157.c
index 25146fa..91f8290 100644
--- a/drivers/media/tuners/si2157.c
+++ b/drivers/media/tuners/si2157.c
@@ -1,5 +1,5 @@
 /*
- * Silicon Labs Si2147/2157/2158 silicon tuner driver
+ * Silicon Labs Si2147/2148/2157/2158 silicon tuner driver
  *
  * Copyright (C) 2014 Antti Palosaari cr...@iki.fi
  *
@@ -112,11 +112,13 @@ static int si2157_init(struct dvb_frontend *fe)
cmd.args[4]  0;
 
#define SI2158_A20 ('A'  24 | 58  16 | '2'  8 | '0'  0)
+   #define SI2148_A20 ('A'  24 | 48  16 | '2'  8 | '0'  0)
#define SI2157_A30 ('A'  24 | 57  16 | '3'  8 | '0'  0)
#define SI2147_A30 ('A'  24 | 47  16 | '3'  8 | '0'  0)
 
switch (chip_id) {
case SI2158_A20:
+   case SI2148_A20:
fw_file = SI2158_A20_FIRMWARE;
break;
case SI2157_A30:
@@ -309,7 +311,7 @@ static int si2157_get_if_frequency(struct dvb_frontend *fe, 
u32 *frequency)
 
 static const struct dvb_tuner_ops si2157_ops = {
.info = {
-   .name   = Silicon Labs Si2157/Si2158,
+   .name   = Silicon Labs Si2147/2148/2157/Si2158,
.frequency_min  = 11000,
.frequency_max  = 86200,
},
@@ -373,7 +375,7 @@ static int si2157_probe(struct i2c_client *client,
i2c_set_clientdata(client, s);
 
dev_info(s-client-dev,
-   Silicon Labs Si2157/Si2158 successfully attached\n);
+   Silicon Labs Si2147/2148/2157/Si2158 successfully 
attached\n);
return 0;
 err:
dev_dbg(client-dev, failed=%d\n, ret);
@@ -414,7 +416,7 @@ static struct i2c_driver si2157_driver = {
 
 module_i2c_driver(si2157_driver);
 
-MODULE_DESCRIPTION(Silicon Labs Si2157/Si2158 silicon tuner driver);
+MODULE_DESCRIPTION(Silicon Labs Si2147/2148/2157/Si2158 silicon tuner 
driver);
 MODULE_AUTHOR(Antti Palosaari cr...@iki.fi);
 MODULE_LICENSE(GPL);
 MODULE_FIRMWARE(SI2158_A20_FIRMWARE);
diff --git a/drivers/media/tuners/si2157.h b/drivers/media/tuners/si2157.h
index d3b19ca..c439d0e 100644
--- a/drivers/media/tuners/si2157.h
+++ b/drivers/media/tuners/si2157.h
@@ -1,5 +1,5 @@
 /*
- * Silicon Labs Si2147/2157/2158 silicon tuner driver
+ * Silicon Labs Si2147/2148/2157/2158 silicon tuner driver
  *
  * Copyright (C) 2014 Antti Palosaari cr...@iki.fi
  *
diff --git a/drivers/media/tuners/si2157_priv.h 
b/drivers/media/tuners/si2157_priv.h
index e71ffaf..6d2aac4 100644
--- a/drivers/media/tuners/si2157_priv.h
+++ b/drivers/media/tuners/si2157_priv.h
@@ -1,5 +1,5 @@
 /*
- * Silicon Labs Si2147/2157/2158 silicon tuner driver
+ * Silicon Labs Si2147/2148/2157/2158 silicon tuner driver
  *
  * Copyright (C) 2014 Antti Palosaari cr...@iki.fi
  *
-- 
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 3/3] cxusb: Geniatech T230 support.

2014-11-14 Thread CrazyCat
Geniatech Mygica T230 DVB-T/T2/C USB stick support.

Signed-off-by: Evgeny Plehov evgenyple...@ukr.net
---
 drivers/media/dvb-core/dvb-usb-ids.h |   1 +
 drivers/media/usb/dvb-usb/cxusb.c| 127 +++
 2 files changed, 128 insertions(+)

diff --git a/drivers/media/dvb-core/dvb-usb-ids.h 
b/drivers/media/dvb-core/dvb-usb-ids.h
index e07a84e..80ab8d0 100644
--- a/drivers/media/dvb-core/dvb-usb-ids.h
+++ b/drivers/media/dvb-core/dvb-usb-ids.h
@@ -356,6 +356,7 @@
 #define USB_PID_MSI_DIGI_VOX_MINI_III   0x8807
 #define USB_PID_SONY_PLAYTV0x0003
 #define USB_PID_MYGICA_D6890xd811
+#define USB_PID_MYGICA_T2300xc688
 #define USB_PID_ELGATO_EYETV_DIVERSITY 0x0011
 #define USB_PID_ELGATO_EYETV_DTT   0x0021
 #define USB_PID_ELGATO_EYETV_DTT_2 0x003f
diff --git a/drivers/media/usb/dvb-usb/cxusb.c 
b/drivers/media/usb/dvb-usb/cxusb.c
index b46f84d..7346698 100644
--- a/drivers/media/usb/dvb-usb/cxusb.c
+++ b/drivers/media/usb/dvb-usb/cxusb.c
@@ -1408,6 +1408,76 @@ static int cxusb_mygica_d689_frontend_attach(struct 
dvb_usb_adapter *adap)
return 0;
 }
 
+static int cxusb_mygica_t230_frontend_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;
+
+   /* Select required USB configuration */
+   if (usb_set_interface(d-udev, 0, 0)  0)
+   err(set interface failed);
+
+   /* Unblock all USB pipes */
+   usb_clear_halt(d-udev,
+   usb_sndbulkpipe(d-udev, d-props.generic_bulk_ctrl_endpoint));
+   usb_clear_halt(d-udev,
+   usb_rcvbulkpipe(d-udev, d-props.generic_bulk_ctrl_endpoint));
+   usb_clear_halt(d-udev,
+   usb_rcvbulkpipe(d-udev, 
d-props.adapter[0].fe[0].stream.endpoint));
+
+   /* attach frontend */
+   si2168_config.i2c_adapter = adapter;
+   si2168_config.fe = adap-fe_adap[0].fe;
+   si2168_config.ts_mode = SI2168_TS_PARALLEL;
+   si2168_config.ts_clock_inv = 1;
+   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 */
+   memset(si2157_config, 0, sizeof(si2157_config));
+   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;
+}
+
 static int cxusb_tt_ct2_4400_attach(struct dvb_usb_adapter *adap)
 {
struct dvb_usb_device *d = adap-dev;
@@ -1609,6 +1679,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_mygica_t230_properties;
 static struct dvb_usb_device_properties cxusb_tt_ct2_4400_properties;
 
 static int cxusb_probe(struct usb_interface *intf,
@@ -1640,6 +1711,8 @@ 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_mygica_t230_properties,
+THIS_MODULE, NULL, adapter_nr) ||

[PATCH 2/3] si2168: TS clock inversion control.

2014-11-14 Thread CrazyCat
TS clock polarity control implemented.

Signed-off-by: Evgeny Plehov evgenyple...@ukr.net
---
 drivers/media/dvb-frontends/si2168.c  | 7 +--
 drivers/media/dvb-frontends/si2168.h  | 4 
 drivers/media/dvb-frontends/si2168_priv.h | 1 +
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/media/dvb-frontends/si2168.c 
b/drivers/media/dvb-frontends/si2168.c
index 7bac748..16a347a 100644
--- a/drivers/media/dvb-frontends/si2168.c
+++ b/drivers/media/dvb-frontends/si2168.c
@@ -308,14 +308,16 @@ static int si2168_set_frontend(struct dvb_frontend *fe)
if (ret)
goto err;
 
-   memcpy(cmd.args, \x14\x00\x09\x10\xe3\x18, 6);
+   memcpy(cmd.args, \x14\x00\x09\x10\xe3\x08, 6);
+   cmd.args[5] |= s-ts_clock_inv ? 0x00 : 0x10;
cmd.wlen = 6;
cmd.rlen = 4;
ret = si2168_cmd_execute(s, cmd);
if (ret)
goto err;
 
-   memcpy(cmd.args, \x14\x00\x08\x10\xd7\x15, 6);
+   memcpy(cmd.args, \x14\x00\x08\x10\xd7\x05, 6);
+   cmd.args[5] |= s-ts_clock_inv ? 0x00 : 0x10;
cmd.wlen = 6;
cmd.rlen = 4;
ret = si2168_cmd_execute(s, cmd);
@@ -669,6 +671,7 @@ static int si2168_probe(struct i2c_client *client,
*config-i2c_adapter = s-adapter;
*config-fe = s-fe;
s-ts_mode = config-ts_mode;
+   s-ts_clock_inv = config-ts_clock_inv;
s-fw_loaded = false;
 
i2c_set_clientdata(client, s);
diff --git a/drivers/media/dvb-frontends/si2168.h 
b/drivers/media/dvb-frontends/si2168.h
index e086d67..87bc121 100644
--- a/drivers/media/dvb-frontends/si2168.h
+++ b/drivers/media/dvb-frontends/si2168.h
@@ -37,6 +37,10 @@ struct si2168_config {
 
/* TS mode */
u8 ts_mode;
+
+   /* TS clock inverted */
+   bool ts_clock_inv;
+
 };
 
 #define SI2168_TS_PARALLEL 0x06
diff --git a/drivers/media/dvb-frontends/si2168_priv.h 
b/drivers/media/dvb-frontends/si2168_priv.h
index 132df67..66ed675 100644
--- a/drivers/media/dvb-frontends/si2168_priv.h
+++ b/drivers/media/dvb-frontends/si2168_priv.h
@@ -36,6 +36,7 @@ struct si2168 {
fe_delivery_system_t delivery_system;
fe_status_t fe_status;
u8 ts_mode;
+   bool ts_clock_inv;
bool active;
bool fw_loaded;
 };
-- 
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: [PATCH 1/3] tuners: si2157: Si2148 support.

2014-11-14 Thread CrazyCat
2148 is 2158 without analog support. Same firmware.

15.11.2014, 03:02, Antti Palosaari cr...@iki.fi:
 I wonder if we should define own firmware for Si2148-A20 just for sure.
 Olli?
--
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] si2168: DVB-T2 PLP selection implemented

2014-08-16 Thread CrazyCat
DVB-T2 PLP selection implemented for Si2168 demod.
Tested with PCTV 292e.

Signed-off-by: Evgeny Plehov evgenyple...@ukr.net
---
 drivers/media/dvb-frontends/si2168.c | 16 ++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/media/dvb-frontends/si2168.c 
b/drivers/media/dvb-frontends/si2168.c
index 37f3f92..9c41281 100644
--- a/drivers/media/dvb-frontends/si2168.c
+++ b/drivers/media/dvb-frontends/si2168.c
@@ -168,10 +168,10 @@ static int si2168_set_frontend(struct dvb_frontend *fe)
u8 bandwidth, delivery_system;
 
dev_dbg(s-client-dev,
-   %s: delivery_system=%u modulation=%u frequency=%u 
bandwidth_hz=%u symbol_rate=%u inversion=%u\n,
+   %s: delivery_system=%u modulation=%u frequency=%u 
bandwidth_hz=%u symbol_rate=%u inversion=%u, stream_id=%d\n,
__func__, c-delivery_system, c-modulation,
c-frequency, c-bandwidth_hz, c-symbol_rate,
-   c-inversion);
+   c-inversion, c-stream_id);
 
if (!s-active) {
ret = -EAGAIN;
@@ -235,6 +235,18 @@ static int si2168_set_frontend(struct dvb_frontend *fe)
if (ret)
goto err;
 
+   if (c-delivery_system == SYS_DVBT2) {
+   /* select PLP */
+   cmd.args[0] = 0x52;
+   cmd.args[1] = c-stream_id  0xff;
+   cmd.args[2] = c-stream_id == NO_STREAM_ID_FILTER ? 0 : 1;
+   cmd.wlen = 3;
+   cmd.rlen = 1;
+   ret = si2168_cmd_execute(s, cmd);
+   if (ret)
+   goto err;
+   }
+
memcpy(cmd.args, \x51\x03, 2);
cmd.wlen = 2;
cmd.rlen = 12;
-- 
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]cxd2820r: TS clock inversion in config

2014-06-03 Thread CrazyCat
TS clock inversion in config.

Signed-off-by: Evgeny Plehov evgenyple...@ukr.net
---
 drivers/media/dvb-frontends/cxd2820r.h| 6 ++
 drivers/media/dvb-frontends/cxd2820r_c.c  | 1 +
 drivers/media/dvb-frontends/cxd2820r_t.c  | 1 +
 drivers/media/dvb-frontends/cxd2820r_t2.c | 1 +
 4 files changed, 9 insertions(+)

diff --git a/drivers/media/dvb-frontends/cxd2820r.h 
b/drivers/media/dvb-frontends/cxd2820r.h
index 82b3d93..6095dbc 100644
--- a/drivers/media/dvb-frontends/cxd2820r.h
+++ b/drivers/media/dvb-frontends/cxd2820r.h
@@ -52,6 +52,12 @@ struct cxd2820r_config {
 */
u8 ts_mode;
 
+   /* TS clock inverted.
+* Default: 0
+* Values: 0, 1
+*/
+   bool ts_clock_inv;
+
/* IF AGC polarity.
 * Default: 0
 * Values: 0, 1
diff --git a/drivers/media/dvb-frontends/cxd2820r_c.c 
b/drivers/media/dvb-frontends/cxd2820r_c.c
index 5c6ab49..0f4657e 100644
--- a/drivers/media/dvb-frontends/cxd2820r_c.c
+++ b/drivers/media/dvb-frontends/cxd2820r_c.c
@@ -45,6 +45,7 @@ int cxd2820r_set_frontend_c(struct dvb_frontend *fe)
{ 0x1008b, 0x07, 0xff },
{ 0x1001f, priv-cfg.if_agc_polarity  7, 0x80 },
{ 0x10070, priv-cfg.ts_mode, 0xff },
+   { 0x10071, !priv-cfg.ts_clock_inv  4, 0x10 },
};
 
dev_dbg(priv-i2c-dev, %s: frequency=%d symbol_rate=%d\n, __func__,
diff --git a/drivers/media/dvb-frontends/cxd2820r_t.c 
b/drivers/media/dvb-frontends/cxd2820r_t.c
index fa184ca..9b5a45b 100644
--- a/drivers/media/dvb-frontends/cxd2820r_t.c
+++ b/drivers/media/dvb-frontends/cxd2820r_t.c
@@ -46,6 +46,7 @@ int cxd2820r_set_frontend_t(struct dvb_frontend *fe)
{ 0x00088, 0x01, 0xff },
 
{ 0x00070, priv-cfg.ts_mode, 0xff },
+   { 0x00071, !priv-cfg.ts_clock_inv  4, 0x10 },
{ 0x000cb, priv-cfg.if_agc_polarity  6, 0x40 },
{ 0x000a5, 0x00, 0x01 },
{ 0x00082, 0x20, 0x60 },
diff --git a/drivers/media/dvb-frontends/cxd2820r_t2.c 
b/drivers/media/dvb-frontends/cxd2820r_t2.c
index 2ba130e..9c0c4f4 100644
--- a/drivers/media/dvb-frontends/cxd2820r_t2.c
+++ b/drivers/media/dvb-frontends/cxd2820r_t2.c
@@ -47,6 +47,7 @@ int cxd2820r_set_frontend_t2(struct dvb_frontend *fe)
{ 0x02083, 0x0a, 0xff },
{ 0x020cb, priv-cfg.if_agc_polarity  6, 0x40 },
{ 0x02070, priv-cfg.ts_mode, 0xff },
+   { 0x02071, !priv-cfg.ts_clock_inv  6, 0x40 },
{ 0x020b5, priv-cfg.spec_inv  4, 0x10 },
{ 0x02567, 0x07, 0x0f },
{ 0x02569, 0x03, 0x03 },
-- 
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] dw2102: Geniatech T220 init fixed

2014-06-03 Thread CrazyCat
Geniatech T220 init fixed - reset cmd from windows driver and fixed TS bus 
config for cxd2820r.

Signed-off-by: Evgeny Plehov evgenyple...@ukr.net
---
 drivers/media/usb/dvb-usb/dw2102.c | 14 +++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/media/usb/dvb-usb/dw2102.c 
b/drivers/media/usb/dvb-usb/dw2102.c
index ae0f56a..7135a3e 100644
--- a/drivers/media/usb/dvb-usb/dw2102.c
+++ b/drivers/media/usb/dvb-usb/dw2102.c
@@ -1109,6 +1109,7 @@ static struct ds3000_config su3000_ds3000_config = {
 static struct cxd2820r_config cxd2820r_config = {
.i2c_address = 0x6c, /* (0xd8  1) */
.ts_mode = 0x38,
+   .ts_clock_inv = 1,
 };
 
 static struct tda18271_config tda18271_config = {
@@ -1387,20 +1388,27 @@ static int su3000_frontend_attach(struct 
dvb_usb_adapter *d)
 
 static int t220_frontend_attach(struct dvb_usb_adapter *d)
 {
-   u8 obuf[3] = { 0xe, 0x80, 0 };
+   u8 obuf[3] = { 0xe, 0x87, 0 };
u8 ibuf[] = { 0 };
 
if (dvb_usb_generic_rw(d-dev, obuf, 3, ibuf, 1, 0)  0)
err(command 0x0e transfer failed.);
 
obuf[0] = 0xe;
-   obuf[1] = 0x83;
+   obuf[1] = 0x86;
+   obuf[2] = 1;
+
+   if (dvb_usb_generic_rw(d-dev, obuf, 3, ibuf, 1, 0)  0)
+   err(command 0x0e transfer failed.);
+
+   obuf[0] = 0xe;
+   obuf[1] = 0x80;
obuf[2] = 0;
 
if (dvb_usb_generic_rw(d-dev, obuf, 3, ibuf, 1, 0)  0)
err(command 0x0e transfer failed.);
 
-   msleep(100);
+   msleep(50);
 
obuf[0] = 0xe;
obuf[1] = 0x80;
-- 
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: [PATCH] cxd2820r: TS clock inversion in config

2014-05-27 Thread CrazyCat
This specific cxd2820r option need for Geniatech T220
https://patchwork.linuxtv.org/patch/23836/

On Tuesday 06 May 2014 00:11:17 you wrote:
 That patch does more than it says and due to that I don't want it. Just 
 implement cxd2820r clock inversion and nothing more. Put the rest stuff, 
 which does not belong to cxd2820r, to another patch.

--
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] technisat-sub2: Fix stream curruption on high bitrate

2014-05-27 Thread CrazyCat
On Sunday 25 May 2014 15:29:57 Mauro Carvalho Chehab wrote:
 Could you please better document this patch? 

Bug catched @ new ABS2 satellite (75E). Transponders with bitrate 70-80mbit. 
Before some european another users report same issue with ~67mbit transponders 
(S2,8PSK,27500,5/6). So just another bug in this driver :)

 I would be expecting a better description of the problem you faced,
 the version of the board you have (assuming that different versions
 might have different minimal intervals) and an lsusb -v output from
 the board you faced issues, showing what the endpoint descriptors
 say about that.

This device have only one hw revision. lsusb -v output:

Bus 001 Device 009: ID 14f7:0500 TechniSat Digital GmbH DVB-PC TV Star HD
Device Descriptor:
  bLength18
  bDescriptorType 1
  bcdUSB   2.00
  bDeviceClass0 (Defined at Interface level)
  bDeviceSubClass 0
  bDeviceProtocol 0
  bMaxPacketSize064
  idVendor   0x14f7 TechniSat Digital GmbH
  idProduct  0x0500 DVB-PC TV Star HD
  bcdDevice0.01
  iManufacturer   1 TechniSat Digital
  iProduct2 TechniSat USB device
  iSerial 3 0008C9F04C76
  bNumConfigurations  1
  Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength   69
bNumInterfaces  1
bConfigurationValue 1
iConfiguration  0
bmAttributes 0xc0
  Self Powered
MaxPower  300mA
Interface Descriptor:
  bLength 9
  bDescriptorType 4
  bInterfaceNumber0
  bAlternateSetting   0
  bNumEndpoints   3
  bInterfaceClass   255 Vendor Specific Class
  bInterfaceSubClass  0
  bInterfaceProtocol  0
  iInterface  0
  Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x82  EP 2 IN
bmAttributes2
  Transfer TypeBulk
  Synch Type   None
  Usage Type   Data
wMaxPacketSize 0x0200  1x 512 bytes
bInterval   0
  Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81  EP 1 IN
bmAttributes2
  Transfer TypeBulk
  Synch Type   None
  Usage Type   Data
wMaxPacketSize 0x0200  1x 512 bytes
bInterval   0
  Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x01  EP 1 OUT
bmAttributes2
  Transfer TypeBulk
  Synch Type   None
  Usage Type   Data
wMaxPacketSize 0x0200  1x 512 bytes
bInterval   0
Interface Descriptor:
  bLength 9
  bDescriptorType 4
  bInterfaceNumber0
  bAlternateSetting   1
  bNumEndpoints   3
  bInterfaceClass   255 Vendor Specific Class
  bInterfaceSubClass  0
  bInterfaceProtocol  0
  iInterface  0
  Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x82  EP 2 IN
bmAttributes1
  Transfer TypeIsochronous
  Synch Type   None
  Usage Type   Data
wMaxPacketSize 0x0c00  2x 1024 bytes
bInterval   1
  Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81  EP 1 IN
bmAttributes2
  Transfer TypeBulk
  Synch Type   None
  Usage Type   Data
wMaxPacketSize 0x0200  1x 512 bytes
bInterval   0
  Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x01  EP 1 OUT
bmAttributes2
  Transfer TypeBulk
  Synch Type   None
  Usage Type   Data
wMaxPacketSize 0x0200  1x 512 bytes
bInterval   0
Device Qualifier (for other device speed):
  bLength10
  bDescriptorType 6
  bcdUSB   2.00
  bDeviceClass0 (Defined at Interface level)
  bDeviceSubClass 0
  bDeviceProtocol 0
  bMaxPacketSize064
  bNumConfigurations  1
Device Status: 0x0001
  Self Powered

 Btw, if those tables are ok, can't we just retrieve the information
 directly from the descriptors, instead of hardcoding it, e. g
 filling it with:
 

[PATCH] cxd2820r: TS clock inversion in config

2014-05-05 Thread CrazyCat
TS clock inversion in config.

Signed-off-by: Evgeny Plehov evgenyple...@ukr.net

diff --git a/drivers/media/dvb-frontends/cxd2820r.h 
b/drivers/media/dvb-frontends/cxd2820r.h
index 82b3d93..6095dbc 100644
--- a/drivers/media/dvb-frontends/cxd2820r.h
+++ b/drivers/media/dvb-frontends/cxd2820r.h
@@ -52,6 +52,12 @@ struct cxd2820r_config {
 */
u8 ts_mode;
 
+   /* TS clock inverted.
+* Default: 0
+* Values: 0, 1
+*/
+   bool ts_clock_inv;
+
/* IF AGC polarity.
 * Default: 0
 * Values: 0, 1
diff --git a/drivers/media/dvb-frontends/cxd2820r_c.c 
b/drivers/media/dvb-frontends/cxd2820r_c.c
index 5c6ab49..0f4657e 100644
--- a/drivers/media/dvb-frontends/cxd2820r_c.c
+++ b/drivers/media/dvb-frontends/cxd2820r_c.c
@@ -45,6 +45,7 @@ int cxd2820r_set_frontend_c(struct dvb_frontend *fe)
{ 0x1008b, 0x07, 0xff },
{ 0x1001f, priv-cfg.if_agc_polarity  7, 0x80 },
{ 0x10070, priv-cfg.ts_mode, 0xff },
+   { 0x10071, !priv-cfg.ts_clock_inv  4, 0x10 },
};
 
dev_dbg(priv-i2c-dev, %s: frequency=%d symbol_rate=%d\n, __func__,
diff --git a/drivers/media/dvb-frontends/cxd2820r_t.c 
b/drivers/media/dvb-frontends/cxd2820r_t.c
index fa184ca..9b5a45b 100644
--- a/drivers/media/dvb-frontends/cxd2820r_t.c
+++ b/drivers/media/dvb-frontends/cxd2820r_t.c
@@ -46,6 +46,7 @@ int cxd2820r_set_frontend_t(struct dvb_frontend *fe)
{ 0x00088, 0x01, 0xff },
 
{ 0x00070, priv-cfg.ts_mode, 0xff },
+   { 0x00071, !priv-cfg.ts_clock_inv  4, 0x10 },
{ 0x000cb, priv-cfg.if_agc_polarity  6, 0x40 },
{ 0x000a5, 0x00, 0x01 },
{ 0x00082, 0x20, 0x60 },
diff --git a/drivers/media/dvb-frontends/cxd2820r_t2.c 
b/drivers/media/dvb-frontends/cxd2820r_t2.c
index 2ba130e..9c0c4f4 100644
--- a/drivers/media/dvb-frontends/cxd2820r_t2.c
+++ b/drivers/media/dvb-frontends/cxd2820r_t2.c
@@ -47,6 +47,7 @@ int cxd2820r_set_frontend_t2(struct dvb_frontend *fe)
{ 0x02083, 0x0a, 0xff },
{ 0x020cb, priv-cfg.if_agc_polarity  6, 0x40 },
{ 0x02070, priv-cfg.ts_mode, 0xff },
+   { 0x02071, !priv-cfg.ts_clock_inv  6, 0x40 },
{ 0x020b5, priv-cfg.spec_inv  4, 0x10 },
{ 0x02567, 0x07, 0x0f },
{ 0x02569, 0x03, 0x03 },
diff --git a/drivers/media/usb/dvb-usb/dw2102.c 
b/drivers/media/usb/dvb-usb/dw2102.c
index ae0f56a..7135a3e 100644
--- a/drivers/media/usb/dvb-usb/dw2102.c
+++ b/drivers/media/usb/dvb-usb/dw2102.c
@@ -1109,6 +1109,7 @@ static struct ds3000_config su3000_ds3000_config = {
 static struct cxd2820r_config cxd2820r_config = {
.i2c_address = 0x6c, /* (0xd8  1) */
.ts_mode = 0x38,
+   .ts_clock_inv = 1,
 };
 
 static struct tda18271_config tda18271_config = {
@@ -1387,20 +1388,27 @@ static int su3000_frontend_attach(struct 
dvb_usb_adapter *d)
 
 static int t220_frontend_attach(struct dvb_usb_adapter *d)
 {
-   u8 obuf[3] = { 0xe, 0x80, 0 };
+   u8 obuf[3] = { 0xe, 0x87, 0 };
u8 ibuf[] = { 0 };
 
if (dvb_usb_generic_rw(d-dev, obuf, 3, ibuf, 1, 0)  0)
err(command 0x0e transfer failed.);
 
obuf[0] = 0xe;
-   obuf[1] = 0x83;
+   obuf[1] = 0x86;
+   obuf[2] = 1;
+
+   if (dvb_usb_generic_rw(d-dev, obuf, 3, ibuf, 1, 0)  0)
+   err(command 0x0e transfer failed.);
+
+   obuf[0] = 0xe;
+   obuf[1] = 0x80;
obuf[2] = 0;
 
if (dvb_usb_generic_rw(d-dev, obuf, 3, ibuf, 1, 0)  0)
err(command 0x0e transfer failed.);
 
-   msleep(100);
+   msleep(50);
 
obuf[0] = 0xe;
obuf[1] = 0x80;

--
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] dw2102: Geniatech T220 init fixed

2014-05-05 Thread CrazyCat
Geniatech T220 init fixed.

Signed-off-by: Evgeny Plehov evgenyple...@ukr.net

diff --git a/drivers/media/usb/dvb-usb/dw2102.c 
b/drivers/media/usb/dvb-usb/dw2102.c
index ae0f56a..7135a3e 100644
--- a/drivers/media/usb/dvb-usb/dw2102.c
+++ b/drivers/media/usb/dvb-usb/dw2102.c
@@ -1109,6 +1109,7 @@ static struct ds3000_config su3000_ds3000_config = {
 static struct cxd2820r_config cxd2820r_config = {
.i2c_address = 0x6c, /* (0xd8  1) */
.ts_mode = 0x38,
+   .ts_clock_inv = 1,
 };
 
 static struct tda18271_config tda18271_config = {
@@ -1387,20 +1388,27 @@ static int su3000_frontend_attach(struct 
dvb_usb_adapter *d)
 
 static int t220_frontend_attach(struct dvb_usb_adapter *d)
 {
-   u8 obuf[3] = { 0xe, 0x80, 0 };
+   u8 obuf[3] = { 0xe, 0x87, 0 };
u8 ibuf[] = { 0 };
 
if (dvb_usb_generic_rw(d-dev, obuf, 3, ibuf, 1, 0)  0)
err(command 0x0e transfer failed.);
 
obuf[0] = 0xe;
-   obuf[1] = 0x83;
+   obuf[1] = 0x86;
+   obuf[2] = 1;
+
+   if (dvb_usb_generic_rw(d-dev, obuf, 3, ibuf, 1, 0)  0)
+   err(command 0x0e transfer failed.);
+
+   obuf[0] = 0xe;
+   obuf[1] = 0x80;
obuf[2] = 0;
 
if (dvb_usb_generic_rw(d-dev, obuf, 3, ibuf, 1, 0)  0)
err(command 0x0e transfer failed.);
 
-   msleep(100);
+   msleep(50);
 
obuf[0] = 0xe;
obuf[1] = 0x80;

--
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] technisat-sub2: Fix stream curruption on high bitrate

2014-04-16 Thread CrazyCat
Fix stream curruption on high bitrate (60mbit).

Signed-off-by: Evgeny Plehov evgenyple...@ukr.net
---
 drivers/media/usb/dvb-usb/technisat-usb2.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/usb/dvb-usb/technisat-usb2.c 
b/drivers/media/usb/dvb-usb/technisat-usb2.c
index 420198f..4604c084 100644
--- a/drivers/media/usb/dvb-usb/technisat-usb2.c
+++ b/drivers/media/usb/dvb-usb/technisat-usb2.c
@@ -711,7 +711,7 @@ static struct dvb_usb_device_properties 
technisat_usb2_devices = {
.isoc = {
.framesperurb = 32,
.framesize = 2048,
-   .interval = 3,
+   .interval = 1,
}
}
},
-- 
1.7.9.5

--
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: Upstreaming SAA716x driver to the media_tree

2014-01-07 Thread CrazyCat

Konstantin Dimitrov пишет:

so, i was waiting Manu to upstream his SAA716x driver code some day
and then submit the improvements i made to it. yet again you're trying
to take that from me and again, conveniently you included many people
on CC, but not me.


it's ok :) and stop compile binary blobs for TBS :) like 'stupid' binaries for 
LNB power control and init for 6925/5925 :)



in my opinion what you're doing is not right, because that patch is
not clean-room reverse-engineering, you just took those changes from
another open-source base and if nothing else it's at least common
courtesy in open-source community when you didn't make them to not
submit them as your patches.


this is open-source world :)


i also think with your actions you're actually hurting the community,
because people like me, that do actually have the technical
understanding and can help and contribute further improvements are
driven away from the community, because
effectively the community accepting behavior like yours is encouraging
code stealing!!


what stealed code ??? :) if you want write closed-source drivers for windose - 
make it ! :)

--
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] dw2102: Use RC Core instead of the legacy RC (second edition)

2013-11-15 Thread CrazyCat
Use RC Core instead of the legacy RC. 
DVBWorld, TBS, TeVii, Prof hardware decode only NEC remotes (one byte code).
Geniatech hardware decode only RC5 (two bytes).
+ New keymap for Geniatech HDStar (SU3000).

Signed-off-by: Evgeny Plehov evgenyple...@ukr.net
---
 drivers/media/rc/keymaps/Makefile|3 +-
 drivers/media/rc/keymaps/rc-su3000.c |   75 +
 drivers/media/usb/dvb-usb/dw2102.c   |  298 +-
 include/media/rc-map.h   |1 +
 4 files changed, 152 insertions(+), 225 deletions(-)
 create mode 100644 drivers/media/rc/keymaps/rc-su3000.c

diff --git a/drivers/media/rc/keymaps/Makefile 
b/drivers/media/rc/keymaps/Makefile
index b1cde8c..0b8c549 100644
--- a/drivers/media/rc/keymaps/Makefile
+++ b/drivers/media/rc/keymaps/Makefile
@@ -98,4 +98,5 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \
rc-videomate-s350.o \
rc-videomate-tv-pvr.o \
rc-winfast.o \
-   rc-winfast-usbii-deluxe.o
+   rc-winfast-usbii-deluxe.o \
+   rc-su3000.o
diff --git a/drivers/media/rc/keymaps/rc-su3000.c 
b/drivers/media/rc/keymaps/rc-su3000.c
new file mode 100644
index 000..8dbd3e9
--- /dev/null
+++ b/drivers/media/rc/keymaps/rc-su3000.c
@@ -0,0 +1,75 @@
+/* rc-su3000.h - Keytable for Geniatech HDStar Remote Controller
+ *
+ * Copyright (c) 2013 by Evgeny Plehov Evgeny ple...@ukr.net
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include media/rc-map.h
+#include linux/module.h
+
+static struct rc_map_table su3000[] = {
+   { 0x25, KEY_POWER },/* right-bottom Red */
+   { 0x0a, KEY_MUTE }, /* -/-- */
+   { 0x01, KEY_1 },
+   { 0x02, KEY_2 },
+   { 0x03, KEY_3 },
+   { 0x04, KEY_4 },
+   { 0x05, KEY_5 },
+   { 0x06, KEY_6 },
+   { 0x07, KEY_7 },
+   { 0x08, KEY_8 },
+   { 0x09, KEY_9 },
+   { 0x00, KEY_0 },
+   { 0x20, KEY_UP },   /* CH+ */
+   { 0x21, KEY_DOWN }, /* CH+ */
+   { 0x12, KEY_VOLUMEUP }, /* Brightness Up */
+   { 0x13, KEY_VOLUMEDOWN },/* Brightness Down */
+   { 0x1f, KEY_RECORD },
+   { 0x17, KEY_PLAY },
+   { 0x16, KEY_PAUSE },
+   { 0x0b, KEY_STOP },
+   { 0x27, KEY_FASTFORWARD },/*  */
+   { 0x26, KEY_REWIND },   /*  */
+   { 0x0d, KEY_OK },   /* Mute */
+   { 0x11, KEY_LEFT }, /* VOL- */
+   { 0x10, KEY_RIGHT },/* VOL+ */
+   { 0x29, KEY_BACK }, /* button under 9 */
+   { 0x2c, KEY_MENU }, /* TTX */
+   { 0x2b, KEY_EPG },  /* EPG */
+   { 0x1e, KEY_RED },  /* OSD */
+   { 0x0e, KEY_GREEN },/* Window */
+   { 0x2d, KEY_YELLOW },   /* button under  */
+   { 0x0f, KEY_BLUE }, /* bottom yellow button */
+   { 0x14, KEY_AUDIO },/* Snapshot */
+   { 0x38, KEY_TV },   /* TV/Radio */
+   { 0x0c, KEY_ESC }   /* upper Red button */
+};
+
+static struct rc_map_list su3000_map = {
+   .map = {
+   .scan= su3000,
+   .size= ARRAY_SIZE(su3000),
+   .rc_type = RC_TYPE_RC5,
+   .name= RC_MAP_SU3000,
+   }
+};
+
+static int __init init_rc_map_su3000(void)
+{
+   return rc_map_register(su3000_map);
+}
+
+static void __exit exit_rc_map_su3000(void)
+{
+   rc_map_unregister(su3000_map);
+}
+
+module_init(init_rc_map_su3000)
+module_exit(exit_rc_map_su3000)
+
+MODULE_LICENSE(GPL);
+MODULE_AUTHOR(Evgeny Plehov Evgeny ple...@ukr.net);
diff --git a/drivers/media/usb/dvb-usb/dw2102.c 
b/drivers/media/usb/dvb-usb/dw2102.c
index 12e00aa..5ec7ca8 100644
--- a/drivers/media/usb/dvb-usb/dw2102.c
+++ b/drivers/media/usb/dvb-usb/dw2102.c
@@ -109,11 +109,6 @@
Please see linux/Documentation/dvb/ for more details  \
on firmware-problems.
 
-struct rc_map_dvb_usb_table_table {
-   struct rc_map_table *rc_keys;
-   int rc_keys_size;
-};
-
 struct su3000_state {
u8 initialized;
 };
@@ -128,12 +123,6 @@ module_param_named(debug, dvb_usb_dw2102_debug, int, 0644);
 MODULE_PARM_DESC(debug, set debugging level (1=info 2=xfer 4=rc(or-able)).
DVB_USB_DEBUG_STATUS);
 
-/* keymaps */
-static int ir_keymap;
-module_param_named(keymap, ir_keymap, int, 0644);
-MODULE_PARM_DESC(keymap, set keymap 0=default 1=dvbworld 2=tevii 3=tbs  ...
-256=none);
-
 /* demod probe */
 static int demod_probe = 1;
 module_param_named(demod, demod_probe, int, 0644);
@@ -1389,174 +1378,29 @@ static int dw3101_tuner_attach(struct dvb_usb_adapter 
*adap)
return 0;
 }
 
-static struct rc_map_table rc_map_dw210x_table[] = {
-   { 0xf80a, KEY_POWER2 }, /*power*/
- 

Re: [PATCH] dw2102: Use RC Core instead of the legacy RC.

2013-11-14 Thread CrazyCat
On Thursday 14 November 2013 11:26:44 Mauro Carvalho Chehab wrote:
 Type here is likely RC_TYPE_NEC. It seems, however, that the keycodes
 have just the least-significant 8 bits.

Geniatech HDStar (su3000) remote is RC5 (conflict with my Philips TV remote). 
But rc pulse decoded by Cypress FX2 firmware and send only one byte code.
So i mark this remote as TYPE_UNKNOWN (like existing keymaps for DVBWorld, 
TeVii, TBS).

 You should also port the above keytables if they don't exist there yet,
 or if the existing table have just the least-significant 8 bits, and if
 this device can report the full NEC keycode.

TBS, TeVii, DVBWorld (DM1105) RC keymas already present. So i use it.

Tested with real TeVii S630, 660; Prof 7500; DW2104; Geniatech HDStar.

But now  i implement separate rc_query routine for prof  (device send inverted 
key code).

Signed-off-by: Evgeny Plehov evgenyple...@ukr.net
---
 drivers/media/rc/keymaps/Makefile|3 +-
 drivers/media/rc/keymaps/rc-su3000.c |   77 ++
 drivers/media/usb/dvb-usb/dw2102.c   |  277 +++---
 include/media/rc-map.h   |1 +
 4 files changed, 133 insertions(+), 225 deletions(-)
 create mode 100644 drivers/media/rc/keymaps/rc-su3000.c

diff --git a/drivers/media/rc/keymaps/Makefile 
b/drivers/media/rc/keymaps/Makefile
index b1cde8c..0b8c549 100644
--- a/drivers/media/rc/keymaps/Makefile
+++ b/drivers/media/rc/keymaps/Makefile
@@ -98,4 +98,5 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \
rc-videomate-s350.o \
rc-videomate-tv-pvr.o \
rc-winfast.o \
-   rc-winfast-usbii-deluxe.o
+   rc-winfast-usbii-deluxe.o \
+   rc-su3000.o
diff --git a/drivers/media/rc/keymaps/rc-su3000.c 
b/drivers/media/rc/keymaps/rc-su3000.c
new file mode 100644
index 000..8b14bdd
--- /dev/null
+++ b/drivers/media/rc/keymaps/rc-su3000.c
@@ -0,0 +1,77 @@
+/* tbs-nec.h - Keytable for tbs_nec Remote Controller
+ *
+ * keymap imported from ir-keymaps.c
+ *
+ * Copyright (c) 2010 by Mauro Carvalho Chehab mche...@redhat.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include media/rc-map.h
+#include linux/module.h
+
+static struct rc_map_table su3000[] = {
+   { 0x25, KEY_POWER },/* right-bottom Red */
+   { 0x0a, KEY_MUTE }, /* -/-- */
+   { 0x01, KEY_1 },
+   { 0x02, KEY_2 },
+   { 0x03, KEY_3 },
+   { 0x04, KEY_4 },
+   { 0x05, KEY_5 },
+   { 0x06, KEY_6 },
+   { 0x07, KEY_7 },
+   { 0x08, KEY_8 },
+   { 0x09, KEY_9 },
+   { 0x00, KEY_0 },
+   { 0x20, KEY_UP },   /* CH+ */
+   { 0x21, KEY_DOWN }, /* CH+ */
+   { 0x12, KEY_VOLUMEUP }, /* Brightness Up */
+   { 0x13, KEY_VOLUMEDOWN },/* Brightness Down */
+   { 0x1f, KEY_RECORD },
+   { 0x17, KEY_PLAY },
+   { 0x16, KEY_PAUSE },
+   { 0x0b, KEY_STOP },
+   { 0x27, KEY_FASTFORWARD },/*  */
+   { 0x26, KEY_REWIND },   /*  */
+   { 0x0d, KEY_OK },   /* Mute */
+   { 0x11, KEY_LEFT }, /* VOL- */
+   { 0x10, KEY_RIGHT },/* VOL+ */
+   { 0x29, KEY_BACK }, /* button under 9 */
+   { 0x2c, KEY_MENU }, /* TTX */
+   { 0x2b, KEY_EPG },  /* EPG */
+   { 0x1e, KEY_RED },  /* OSD */
+   { 0x0e, KEY_GREEN },/* Window */
+   { 0x2d, KEY_YELLOW },   /* button under  */
+   { 0x0f, KEY_BLUE }, /* bottom yellow button */
+   { 0x14, KEY_AUDIO },/* Snapshot */
+   { 0x38, KEY_TV },   /* TV/Radio */
+   { 0x0c, KEY_ESC }   /* upper Red button */
+};
+
+static struct rc_map_list su3000_map = {
+   .map = {
+   .scan= su3000,
+   .size= ARRAY_SIZE(su3000),
+   .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
+   .name= RC_MAP_SU3000,
+   }
+};
+
+static int __init init_rc_map_su3000(void)
+{
+   return rc_map_register(su3000_map);
+}
+
+static void __exit exit_rc_map_su3000(void)
+{
+   rc_map_unregister(su3000_map);
+}
+
+module_init(init_rc_map_su3000)
+module_exit(exit_rc_map_su3000)
+
+MODULE_LICENSE(GPL);
+MODULE_AUTHOR(Mauro Carvalho Chehab mche...@redhat.com);
diff --git a/drivers/media/usb/dvb-usb/dw2102.c 
b/drivers/media/usb/dvb-usb/dw2102.c
index 12e00aa..5a4fa6d 100644
--- a/drivers/media/usb/dvb-usb/dw2102.c
+++ b/drivers/media/usb/dvb-usb/dw2102.c
@@ -109,11 +109,6 @@
Please see linux/Documentation/dvb/ for more details  \
on firmware-problems.
 
-struct rc_map_dvb_usb_table_table {
-   struct rc_map_table *rc_keys;
-   int rc_keys_size;
-};
-
 struct su3000_state {
u8 initialized;
 };
@@ -128,12 +123,6 @@ 

[PATCH] dw2102: Geniatech T220 support

2013-11-13 Thread CrazyCat
Support for Geniatech T220 DVB-T/T2/C USB stick.

Signed-off-by: Evgeny Plehov evgenyple...@ukr.net
---
diff --git a/drivers/media/usb/dvb-usb/dw2102.c 
b/drivers/media/usb/dvb-usb/dw2102.c
index 6136a2c..12e00aa 100644
--- a/drivers/media/usb/dvb-usb/dw2102.c
+++ b/drivers/media/usb/dvb-usb/dw2102.c
@@ -2,7 +2,7 @@
  * DVBWorld DVB-S 2101, 2102, DVB-S2 2104, DVB-C 3101,
  * TeVii S600, S630, S650, S660, S480, S421, S632
  * Prof 1100, 7500,
- * Geniatech SU3000 Cards
+ * Geniatech SU3000, T220 Cards
  * Copyright (C) 2008-2012 Igor M. Liplianin (liplia...@me.by)
  *
  * This program is free software; you can redistribute it and/or modify it
@@ -29,6 +29,8 @@
 #include stb6100.h
 #include stb6100_proc.h
 #include m88rs2000.h
+#include tda18271.h
+#include cxd2820r.h
 
 #ifndef USB_PID_DW2102
 #define USB_PID_DW2102 0x2102
@@ -1025,6 +1027,16 @@ static struct ds3000_config su3000_ds3000_config = {
.set_lock_led = dw210x_led_ctrl,
 };
 
+static struct cxd2820r_config cxd2820r_config = {
+   .i2c_address = 0x6c, /* (0xd8  1) */
+   .ts_mode = 0x38,
+};
+
+static struct tda18271_config tda18271_config = {
+   .output_opt = TDA18271_OUTPUT_LT_OFF,
+   .gate = TDA18271_GATE_DIGITAL,
+};
+
 static u8 m88rs2000_inittab[] = {
DEMOD_WRITE, 0x9a, 0x30,
DEMOD_WRITE, 0x00, 0x01,
@@ -1294,6 +1306,49 @@ static int su3000_frontend_attach(struct dvb_usb_adapter 
*d)
return -EIO;
 }
 
+static int t220_frontend_attach(struct dvb_usb_adapter *d)
+{
+   u8 obuf[3] = { 0xe, 0x80, 0 };
+   u8 ibuf[] = { 0 };
+
+   if (dvb_usb_generic_rw(d-dev, obuf, 3, ibuf, 1, 0)  0)
+   err(command 0x0e transfer failed.);
+
+   obuf[0] = 0xe;
+   obuf[1] = 0x83;
+   obuf[2] = 0;
+
+   if (dvb_usb_generic_rw(d-dev, obuf, 3, ibuf, 1, 0)  0)
+   err(command 0x0e transfer failed.);
+
+   msleep(100);
+
+   obuf[0] = 0xe;
+   obuf[1] = 0x80;
+   obuf[2] = 1;
+
+   if (dvb_usb_generic_rw(d-dev, obuf, 3, ibuf, 1, 0)  0)
+   err(command 0x0e transfer failed.);
+
+   obuf[0] = 0x51;
+
+   if (dvb_usb_generic_rw(d-dev, obuf, 1, ibuf, 1, 0)  0)
+   err(command 0x51 transfer failed.);
+
+   d-fe_adap[0].fe = dvb_attach(cxd2820r_attach, cxd2820r_config,
+   d-dev-i2c_adap, NULL);
+   if (d-fe_adap[0].fe != NULL) {
+   if (dvb_attach(tda18271_attach, d-fe_adap[0].fe, 0x60,
+   d-dev-i2c_adap, tda18271_config)) {
+   info(Attached TDA18271HD/CXD2820R!\n);
+   return 0;
+   }
+   }
+
+   info(Failed to attach TDA18271HD/CXD2820R!\n);
+   return -EIO;
+}
+
 static int m88rs2000_frontend_attach(struct dvb_usb_adapter *d)
 {
u8 obuf[] = { 0x51 };
@@ -1560,6 +1615,7 @@ enum dw2102_table_entry {
TEVII_S632,
TERRATEC_CINERGY_S2_R2,
GOTVIEW_SAT_HD,
+   GENIATECH_T220,
 };
 
 static struct usb_device_id dw2102_table[] = {
@@ -1582,6 +1638,7 @@ static struct usb_device_id dw2102_table[] = {
[TEVII_S632] = {USB_DEVICE(0x9022, USB_PID_TEVII_S632)},
[TERRATEC_CINERGY_S2_R2] = {USB_DEVICE(USB_VID_TERRATEC, 0x00b0)},
[GOTVIEW_SAT_HD] = {USB_DEVICE(0x1FE1, USB_PID_GOTVIEW_SAT_HD)},
+   [GENIATECH_T220] = {USB_DEVICE(0x1f4d, 0xD220)},
{ }
 };
 
@@ -2007,6 +2064,54 @@ static struct dvb_usb_device_properties 
su3000_properties = {
}
 };
 
+static struct dvb_usb_device_properties t220_properties = {
+   .caps = DVB_USB_IS_AN_I2C_ADAPTER,
+   .usb_ctrl = DEVICE_SPECIFIC,
+   .size_of_priv = sizeof(struct su3000_state),
+   .power_ctrl = su3000_power_ctrl,
+   .num_adapters = 1,
+   .identify_state = su3000_identify_state,
+   .i2c_algo = su3000_i2c_algo,
+
+   .rc.legacy = {
+   .rc_map_table = rc_map_su3000_table,
+   .rc_map_size = ARRAY_SIZE(rc_map_su3000_table),
+   .rc_interval = 150,
+   .rc_query = dw2102_rc_query,
+   },
+
+   .read_mac_address = su3000_read_mac_address,
+
+   .generic_bulk_ctrl_endpoint = 0x01,
+
+   .adapter = {
+   {
+   .num_frontends = 1,
+   .fe = { {
+   .streaming_ctrl   = su3000_streaming_ctrl,
+   .frontend_attach  = t220_frontend_attach,
+   .stream = {
+   .type = USB_BULK,
+   .count = 8,
+   .endpoint = 0x82,
+   .u = {
+   .bulk = {
+   .buffersize = 4096,
+   }
+   }
+   }
+   } },
+   }
+   },
+   .num_device_descs = 1,
+   .devices = {
+ 

[PATCH] dw2102: Use RC Core instead of the legacy RC.

2013-11-13 Thread CrazyCat
Use RC Core instead of the legacy RC

Signed-off-by: Evgeny Plehov evgenyple...@ukr.net
---
diff --git a/drivers/media/rc/keymaps/Makefile 
b/drivers/media/rc/keymaps/Makefile
index b1cde8c..0b8c549 100644
--- a/drivers/media/rc/keymaps/Makefile
+++ b/drivers/media/rc/keymaps/Makefile
@@ -98,4 +98,5 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \
rc-videomate-s350.o \
rc-videomate-tv-pvr.o \
rc-winfast.o \
-   rc-winfast-usbii-deluxe.o
+   rc-winfast-usbii-deluxe.o \
+   rc-su3000.o
diff --git a/drivers/media/rc/keymaps/rc-su3000.c 
b/drivers/media/rc/keymaps/rc-su3000.c
new file mode 100644
index 000..8b14bdd
--- /dev/null
+++ b/drivers/media/rc/keymaps/rc-su3000.c
@@ -0,0 +1,77 @@
+/* tbs-nec.h - Keytable for tbs_nec Remote Controller
+ *
+ * keymap imported from ir-keymaps.c
+ *
+ * Copyright (c) 2010 by Mauro Carvalho Chehab mche...@redhat.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include media/rc-map.h
+#include linux/module.h
+
+static struct rc_map_table su3000[] = {
+   { 0x25, KEY_POWER },/* right-bottom Red */
+   { 0x0a, KEY_MUTE }, /* -/-- */
+   { 0x01, KEY_1 },
+   { 0x02, KEY_2 },
+   { 0x03, KEY_3 },
+   { 0x04, KEY_4 },
+   { 0x05, KEY_5 },
+   { 0x06, KEY_6 },
+   { 0x07, KEY_7 },
+   { 0x08, KEY_8 },
+   { 0x09, KEY_9 },
+   { 0x00, KEY_0 },
+   { 0x20, KEY_UP },   /* CH+ */
+   { 0x21, KEY_DOWN }, /* CH+ */
+   { 0x12, KEY_VOLUMEUP }, /* Brightness Up */
+   { 0x13, KEY_VOLUMEDOWN },/* Brightness Down */
+   { 0x1f, KEY_RECORD },
+   { 0x17, KEY_PLAY },
+   { 0x16, KEY_PAUSE },
+   { 0x0b, KEY_STOP },
+   { 0x27, KEY_FASTFORWARD },/*  */
+   { 0x26, KEY_REWIND },   /*  */
+   { 0x0d, KEY_OK },   /* Mute */
+   { 0x11, KEY_LEFT }, /* VOL- */
+   { 0x10, KEY_RIGHT },/* VOL+ */
+   { 0x29, KEY_BACK }, /* button under 9 */
+   { 0x2c, KEY_MENU }, /* TTX */
+   { 0x2b, KEY_EPG },  /* EPG */
+   { 0x1e, KEY_RED },  /* OSD */
+   { 0x0e, KEY_GREEN },/* Window */
+   { 0x2d, KEY_YELLOW },   /* button under  */
+   { 0x0f, KEY_BLUE }, /* bottom yellow button */
+   { 0x14, KEY_AUDIO },/* Snapshot */
+   { 0x38, KEY_TV },   /* TV/Radio */
+   { 0x0c, KEY_ESC }   /* upper Red button */
+};
+
+static struct rc_map_list su3000_map = {
+   .map = {
+   .scan= su3000,
+   .size= ARRAY_SIZE(su3000),
+   .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
+   .name= RC_MAP_SU3000,
+   }
+};
+
+static int __init init_rc_map_su3000(void)
+{
+   return rc_map_register(su3000_map);
+}
+
+static void __exit exit_rc_map_su3000(void)
+{
+   rc_map_unregister(su3000_map);
+}
+
+module_init(init_rc_map_su3000)
+module_exit(exit_rc_map_su3000)
+
+MODULE_LICENSE(GPL);
+MODULE_AUTHOR(Mauro Carvalho Chehab mche...@redhat.com);
diff --git a/drivers/media/usb/dvb-usb/dw2102.c 
b/drivers/media/usb/dvb-usb/dw2102.c
index 12e00aa..8400238 100644
--- a/drivers/media/usb/dvb-usb/dw2102.c
+++ b/drivers/media/usb/dvb-usb/dw2102.c
@@ -109,11 +109,6 @@
Please see linux/Documentation/dvb/ for more details  \
on firmware-problems.
 
-struct rc_map_dvb_usb_table_table {
-   struct rc_map_table *rc_keys;
-   int rc_keys_size;
-};
-
 struct su3000_state {
u8 initialized;
 };
@@ -128,12 +123,6 @@ module_param_named(debug, dvb_usb_dw2102_debug, int, 0644);
 MODULE_PARM_DESC(debug, set debugging level (1=info 2=xfer 4=rc(or-able)).
DVB_USB_DEBUG_STATUS);
 
-/* keymaps */
-static int ir_keymap;
-module_param_named(keymap, ir_keymap, int, 0644);
-MODULE_PARM_DESC(keymap, set keymap 0=default 1=dvbworld 2=tevii 3=tbs  ...
-256=none);
-
 /* demod probe */
 static int demod_probe = 1;
 module_param_named(demod, demod_probe, int, 0644);
@@ -1389,174 +1378,8 @@ static int dw3101_tuner_attach(struct dvb_usb_adapter 
*adap)
return 0;
 }
 
-static struct rc_map_table rc_map_dw210x_table[] = {
-   { 0xf80a, KEY_POWER2 }, /*power*/
-   { 0xf80c, KEY_MUTE },   /*mute*/
-   { 0xf811, KEY_1 },
-   { 0xf812, KEY_2 },
-   { 0xf813, KEY_3 },
-   { 0xf814, KEY_4 },
-   { 0xf815, KEY_5 },
-   { 0xf816, KEY_6 },
-   { 0xf817, KEY_7 },
-   { 0xf818, KEY_8 },
-   { 0xf819, KEY_9 },
-   { 0xf810, KEY_0 },
-   { 0xf81c, KEY_CHANNELUP },  /*ch+*/
-   { 0xf80f, KEY_CHANNELDOWN },/*ch-*/
-   { 0xf81a, KEY_VOLUMEUP 

Re: [PATCH] dw2102: Geniatech T220 support

2013-11-03 Thread CrazyCat
On Sunday 03 November 2013 09:39:39 Mauro Carvalho Chehab wrote:
 While you're here, could you please port this driver to use the
 RC core, instead of the legacy RC support?
 
 Porting it to rc core is not hard (but, ideally, it should be done by
 someone with a hardware to test).

Ok - i do it later. And look like my patch in first mail is broken by mailer. 
So i resend it later.
--
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] tda18271-fe: Fix dvb-c standard selection

2013-11-02 Thread CrazyCat

Fix dvb-c standard selection - qam8 for ANNEX_AC

Signed-off-by: Evgeny Plehov evgenyple...@ukr.net
diff --git a/drivers/media/tuners/tda18271-fe.c 
b/drivers/media/tuners/tda18271-fe.c
index 4995b89..6a385c8 100644
--- a/drivers/media/tuners/tda18271-fe.c
+++ b/drivers/media/tuners/tda18271-fe.c
@@ -960,16 +960,12 @@ static int tda18271_set_params(struct dvb_frontend *fe)
break;
case SYS_DVBC_ANNEX_B:
bw = 600;
-   /* falltrough */
+   map = std_map-qam_6;
+   break;
case SYS_DVBC_ANNEX_A:
case SYS_DVBC_ANNEX_C:
-   if (bw = 600) {
-   map = std_map-qam_6;
-   } else if (bw = 700) {
-   map = std_map-qam_7;
-   } else {
-   map = std_map-qam_8;
-   }
+   bw = 800;
+   map = std_map-qam_8;
break;
default:
tda_warn(modulation type not supported!\n);

--
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] cxd2820r_c: Fix if_ctl calculation

2013-11-02 Thread CrazyCat

Fix tune for DVB-C.

Signed-off-by: Evgeny Plehov evgenyple...@ukr.net
diff --git a/drivers/media/dvb-frontends/cxd2820r_c.c 
b/drivers/media/dvb-frontends/cxd2820r_c.c
index 125a440..5c6ab49 100644
--- a/drivers/media/dvb-frontends/cxd2820r_c.c
+++ b/drivers/media/dvb-frontends/cxd2820r_c.c
@@ -78,7 +78,7 @@ int cxd2820r_set_frontend_c(struct dvb_frontend *fe)

num = if_freq / 1000; /* Hz = kHz */
num *= 0x4000;
-   if_ctl = cxd2820r_div_u64_round_closest(num, 41000);
+   if_ctl = 0x4000 - cxd2820r_div_u64_round_closest(num, 41000);
buf[0] = (if_ctl  8)  0x3f;
buf[1] = (if_ctl  0)  0xff;


--
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] dw2102: Geniatech T220 support

2013-11-02 Thread CrazyCat

Support for Geniatech T220 DVB-T/T2/C USB stick.

Signed-off-by: Evgeny Plehov evgenyple...@ukr.net
diff --git a/drivers/media/usb/dvb-usb/dw2102.c 
b/drivers/media/usb/dvb-usb/dw2102.c
index 6136a2c..12e00aa 100644
--- a/drivers/media/usb/dvb-usb/dw2102.c
+++ b/drivers/media/usb/dvb-usb/dw2102.c
@@ -2,7 +2,7 @@
  * DVBWorld DVB-S 2101, 2102, DVB-S2 2104, DVB-C 3101,
  * TeVii S600, S630, S650, S660, S480, S421, S632
  * Prof 1100, 7500,
- * Geniatech SU3000 Cards
+ * Geniatech SU3000, T220 Cards
  * Copyright (C) 2008-2012 Igor M. Liplianin (liplia...@me.by)
  *
  * This program is free software; you can redistribute it and/or modify it
@@ -29,6 +29,8 @@
 #include stb6100.h
 #include stb6100_proc.h
 #include m88rs2000.h
+#include tda18271.h
+#include cxd2820r.h

 #ifndef USB_PID_DW2102
 #define USB_PID_DW2102 0x2102
@@ -1025,6 +1027,16 @@ static struct ds3000_config su3000_ds3000_config = {
.set_lock_led = dw210x_led_ctrl,
 };

+static struct cxd2820r_config cxd2820r_config = {
+   .i2c_address = 0x6c, /* (0xd8  1) */
+   .ts_mode = 0x38,
+};
+
+static struct tda18271_config tda18271_config = {
+   .output_opt = TDA18271_OUTPUT_LT_OFF,
+   .gate = TDA18271_GATE_DIGITAL,
+};
+
 static u8 m88rs2000_inittab[] = {
DEMOD_WRITE, 0x9a, 0x30,
DEMOD_WRITE, 0x00, 0x01,
@@ -1294,6 +1306,49 @@ static int su3000_frontend_attach(struct dvb_usb_adapter 
*d)
return -EIO;
 }

+static int t220_frontend_attach(struct dvb_usb_adapter *d)
+{
+   u8 obuf[3] = { 0xe, 0x80, 0 };
+   u8 ibuf[] = { 0 };
+
+   if (dvb_usb_generic_rw(d-dev, obuf, 3, ibuf, 1, 0)  0)
+   err(command 0x0e transfer failed.);
+
+   obuf[0] = 0xe;
+   obuf[1] = 0x83;
+   obuf[2] = 0;
+
+   if (dvb_usb_generic_rw(d-dev, obuf, 3, ibuf, 1, 0)  0)
+   err(command 0x0e transfer failed.);
+
+   msleep(100);
+
+   obuf[0] = 0xe;
+   obuf[1] = 0x80;
+   obuf[2] = 1;
+
+   if (dvb_usb_generic_rw(d-dev, obuf, 3, ibuf, 1, 0)  0)
+   err(command 0x0e transfer failed.);
+
+   obuf[0] = 0x51;
+
+   if (dvb_usb_generic_rw(d-dev, obuf, 1, ibuf, 1, 0)  0)
+   err(command 0x51 transfer failed.);
+
+   d-fe_adap[0].fe = dvb_attach(cxd2820r_attach, cxd2820r_config,
+   d-dev-i2c_adap, NULL);
+   if (d-fe_adap[0].fe != NULL) {
+   if (dvb_attach(tda18271_attach, d-fe_adap[0].fe, 0x60,
+   d-dev-i2c_adap, tda18271_config)) {
+   info(Attached TDA18271HD/CXD2820R!\n);
+   return 0;
+   }
+   }
+
+   info(Failed to attach TDA18271HD/CXD2820R!\n);
+   return -EIO;
+}
+
 static int m88rs2000_frontend_attach(struct dvb_usb_adapter *d)
 {
u8 obuf[] = { 0x51 };
@@ -1560,6 +1615,7 @@ enum dw2102_table_entry {
TEVII_S632,
TERRATEC_CINERGY_S2_R2,
GOTVIEW_SAT_HD,
+   GENIATECH_T220,
 };

 static struct usb_device_id dw2102_table[] = {
@@ -1582,6 +1638,7 @@ static struct usb_device_id dw2102_table[] = {
[TEVII_S632] = {USB_DEVICE(0x9022, USB_PID_TEVII_S632)},
[TERRATEC_CINERGY_S2_R2] = {USB_DEVICE(USB_VID_TERRATEC, 0x00b0)},
[GOTVIEW_SAT_HD] = {USB_DEVICE(0x1FE1, USB_PID_GOTVIEW_SAT_HD)},
+   [GENIATECH_T220] = {USB_DEVICE(0x1f4d, 0xD220)},
{ }
 };

@@ -2007,6 +2064,54 @@ static struct dvb_usb_device_properties 
su3000_properties = {
}
 };

+static struct dvb_usb_device_properties t220_properties = {
+   .caps = DVB_USB_IS_AN_I2C_ADAPTER,
+   .usb_ctrl = DEVICE_SPECIFIC,
+   .size_of_priv = sizeof(struct su3000_state),
+   .power_ctrl = su3000_power_ctrl,
+   .num_adapters = 1,
+   .identify_state = su3000_identify_state,
+   .i2c_algo = su3000_i2c_algo,
+
+   .rc.legacy = {
+   .rc_map_table = rc_map_su3000_table,
+   .rc_map_size = ARRAY_SIZE(rc_map_su3000_table),
+   .rc_interval = 150,
+   .rc_query = dw2102_rc_query,
+   },
+
+   .read_mac_address = su3000_read_mac_address,
+
+   .generic_bulk_ctrl_endpoint = 0x01,
+
+   .adapter = {
+   {
+   .num_frontends = 1,
+   .fe = { {
+   .streaming_ctrl   = su3000_streaming_ctrl,
+   .frontend_attach  = t220_frontend_attach,
+   .stream = {
+   .type = USB_BULK,
+   .count = 8,
+   .endpoint = 0x82,
+   .u = {
+   .bulk = {
+   .buffersize = 4096,
+   }
+   }
+   }
+   } },
+   }
+   },
+   .num_device_descs = 1,
+   .devices = {
+  

[PATCH] cxd2820r_c: Fix if_ctl calculation

2013-11-01 Thread CrazyCat

Fix tune for DVB-C.
Signed-off-by: Evgeny Plehov evgenyple...@ukr.net 
mailto:evgenyple...@ukr.net
diff --git a/drivers/media/dvb-frontends/cxd2820r_c.c 
b/drivers/media/dvb-frontends/cxd2820r_c.c

index 125a440..5c6ab49 100644
--- a/drivers/media/dvb-frontends/cxd2820r_c.c
+++ b/drivers/media/dvb-frontends/cxd2820r_c.c
@@ -78,7 +78,7 @@ int cxd2820r_set_frontend_c(struct dvb_frontend *fe)
num = if_freq / 1000; /* Hz = kHz */
num *= 0x4000;
-if_ctl = cxd2820r_div_u64_round_closest(num, 41000);
+if_ctl = 0x4000 - cxd2820r_div_u64_round_closest(num, 41000);
buf[0] = (if_ctl  8)  0x3f;
buf[1] = (if_ctl  0)  0xff;
--
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] tda18271-fe: Fix dvb-c standard selection

2013-11-01 Thread CrazyCat

Fix dvb-c standard selection - qam8 for ANNEX_AC

Signed-off-by: Evgeny Plehov evgenyple...@ukr.net
diff --git a/drivers/media/tuners/tda18271-fe.c 
b/drivers/media/tuners/tda18271-fe.c

index 4995b89..6a385c8 100644
--- a/drivers/media/tuners/tda18271-fe.c
+++ b/drivers/media/tuners/tda18271-fe.c
@@ -960,16 +960,12 @@ static int tda18271_set_params(struct dvb_frontend 
*fe)

 break;
 case SYS_DVBC_ANNEX_B:
 bw = 600;
-/* falltrough */
+map = std_map-qam_6;
+break;
 case SYS_DVBC_ANNEX_A:
 case SYS_DVBC_ANNEX_C:
-if (bw = 600) {
-map = std_map-qam_6;
-} else if (bw = 700) {
-map = std_map-qam_7;
-} else {
-map = std_map-qam_8;
-}
+bw = 800;
+map = std_map-qam_8;
 break;
 default:
 tda_warn(modulation type not supported!\n);

--
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] dw2102: Geniatech T220 support

2013-11-01 Thread CrazyCat

Support for Geniatech T220 DVB-T/T2/C USB stick.

Signed-off-by: Evgeny Plehov evgenyple...@ukr.net
diff --git a/drivers/media/usb/dvb-usb/dw2102.c 
b/drivers/media/usb/dvb-usb/dw2102.c

index 6136a2c..12e00aa 100644
--- a/drivers/media/usb/dvb-usb/dw2102.c
+++ b/drivers/media/usb/dvb-usb/dw2102.c
@@ -2,7 +2,7 @@
  *DVBWorld DVB-S 2101, 2102, DVB-S2 2104, DVB-C 3101,
  *TeVii S600, S630, S650, S660, S480, S421, S632
  *Prof 1100, 7500,
- *Geniatech SU3000 Cards
+ *Geniatech SU3000, T220 Cards
  * Copyright (C) 2008-2012 Igor M. Liplianin (liplia...@me.by)
  *
  *This program is free software; you can redistribute it and/or 
modify it

@@ -29,6 +29,8 @@
 #include stb6100.h
 #include stb6100_proc.h
 #include m88rs2000.h
+#include tda18271.h
+#include cxd2820r.h

 #ifndef USB_PID_DW2102
 #define USB_PID_DW2102 0x2102
@@ -1025,6 +1027,16 @@ static struct ds3000_config su3000_ds3000_config = {
 .set_lock_led = dw210x_led_ctrl,
 };

+static struct cxd2820r_config cxd2820r_config = {
+.i2c_address = 0x6c, /* (0xd8  1) */
+.ts_mode = 0x38,
+};
+
+static struct tda18271_config tda18271_config = {
+.output_opt = TDA18271_OUTPUT_LT_OFF,
+.gate = TDA18271_GATE_DIGITAL,
+};
+
 static u8 m88rs2000_inittab[] = {
 DEMOD_WRITE, 0x9a, 0x30,
 DEMOD_WRITE, 0x00, 0x01,
@@ -1294,6 +1306,49 @@ static int su3000_frontend_attach(struct 
dvb_usb_adapter *d)

 return -EIO;
 }

+static int t220_frontend_attach(struct dvb_usb_adapter *d)
+{
+u8 obuf[3] = { 0xe, 0x80, 0 };
+u8 ibuf[] = { 0 };
+
+if (dvb_usb_generic_rw(d-dev, obuf, 3, ibuf, 1, 0)  0)
+err(command 0x0e transfer failed.);
+
+obuf[0] = 0xe;
+obuf[1] = 0x83;
+obuf[2] = 0;
+
+if (dvb_usb_generic_rw(d-dev, obuf, 3, ibuf, 1, 0)  0)
+err(command 0x0e transfer failed.);
+
+msleep(100);
+
+obuf[0] = 0xe;
+obuf[1] = 0x80;
+obuf[2] = 1;
+
+if (dvb_usb_generic_rw(d-dev, obuf, 3, ibuf, 1, 0)  0)
+err(command 0x0e transfer failed.);
+
+obuf[0] = 0x51;
+
+if (dvb_usb_generic_rw(d-dev, obuf, 1, ibuf, 1, 0)  0)
+err(command 0x51 transfer failed.);
+
+d-fe_adap[0].fe = dvb_attach(cxd2820r_attach, cxd2820r_config,
+d-dev-i2c_adap, NULL);
+if (d-fe_adap[0].fe != NULL) {
+if (dvb_attach(tda18271_attach, d-fe_adap[0].fe, 0x60,
+d-dev-i2c_adap, tda18271_config)) {
+info(Attached TDA18271HD/CXD2820R!\n);
+return 0;
+}
+}
+
+info(Failed to attach TDA18271HD/CXD2820R!\n);
+return -EIO;
+}
+
 static int m88rs2000_frontend_attach(struct dvb_usb_adapter *d)
 {
 u8 obuf[] = { 0x51 };
@@ -1560,6 +1615,7 @@ enum dw2102_table_entry {
 TEVII_S632,
 TERRATEC_CINERGY_S2_R2,
 GOTVIEW_SAT_HD,
+GENIATECH_T220,
 };

 static struct usb_device_id dw2102_table[] = {
@@ -1582,6 +1638,7 @@ static struct usb_device_id dw2102_table[] = {
 [TEVII_S632] = {USB_DEVICE(0x9022, USB_PID_TEVII_S632)},
 [TERRATEC_CINERGY_S2_R2] = {USB_DEVICE(USB_VID_TERRATEC, 0x00b0)},
 [GOTVIEW_SAT_HD] = {USB_DEVICE(0x1FE1, USB_PID_GOTVIEW_SAT_HD)},
+[GENIATECH_T220] = {USB_DEVICE(0x1f4d, 0xD220)},
 { }
 };

@@ -2007,6 +2064,54 @@ static struct dvb_usb_device_properties 
su3000_properties = {

 }
 };

+static struct dvb_usb_device_properties t220_properties = {
+.caps = DVB_USB_IS_AN_I2C_ADAPTER,
+.usb_ctrl = DEVICE_SPECIFIC,
+.size_of_priv = sizeof(struct su3000_state),
+.power_ctrl = su3000_power_ctrl,
+.num_adapters = 1,
+.identify_state= su3000_identify_state,
+.i2c_algo = su3000_i2c_algo,
+
+.rc.legacy = {
+.rc_map_table = rc_map_su3000_table,
+.rc_map_size = ARRAY_SIZE(rc_map_su3000_table),
+.rc_interval = 150,
+.rc_query = dw2102_rc_query,
+},
+
+.read_mac_address = su3000_read_mac_address,
+
+.generic_bulk_ctrl_endpoint = 0x01,
+
+.adapter = {
+{
+.num_frontends = 1,
+.fe = { {
+.streaming_ctrl   = su3000_streaming_ctrl,
+.frontend_attach  = t220_frontend_attach,
+.stream = {
+.type = USB_BULK,
+.count = 8,
+.endpoint = 0x82,
+.u = {
+.bulk = {
+.buffersize = 4096,
+}
+}
+}
+} },
+}
+},
+.num_device_descs = 1,
+.devices = {
+{ Geniatech T220 DVB-T/T2 USB2.0,
+{ dw2102_table[GENIATECH_T220], NULL },
+{ NULL },
+},
+}
+};
+
 static int dw2102_probe(struct usb_interface *intf,
 const struct usb_device_id *id)
 {
@@ -2079,7 +2184,9 @@ static int dw2102_probe(struct usb_interface *intf,
 0 == dvb_usb_device_init(intf, s421,
 THIS_MODULE, NULL, adapter_nr) ||
 0 == dvb_usb_device_init(intf, su3000_properties,
- THIS_MODULE, NULL, 

[PATCH] cxd2820r_c: Fix if_ctl calculation

2013-11-01 Thread CrazyCat

Fix tune for DVB-C.

Signed-off-by: Evgeny Plehov evgenyple...@ukr.net
diff --git a/drivers/media/dvb-frontends/cxd2820r_c.c 
b/drivers/media/dvb-frontends/cxd2820r_c.c

index 125a440..5c6ab49 100644
--- a/drivers/media/dvb-frontends/cxd2820r_c.c
+++ b/drivers/media/dvb-frontends/cxd2820r_c.c
@@ -78,7 +78,7 @@ int cxd2820r_set_frontend_c(struct dvb_frontend *fe)

 num = if_freq / 1000; /* Hz = kHz */
 num *= 0x4000;
-if_ctl = cxd2820r_div_u64_round_closest(num, 41000);
+if_ctl = 0x4000 - cxd2820r_div_u64_round_closest(num, 41000);
 buf[0] = (if_ctl  8)  0x3f;
 buf[1] = (if_ctl  0)  0xff;

--
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] cxd2820r_t2: Multistream support (MultiPLP)

2013-04-02 Thread CrazyCat
Now confirmed in Russia - work ok.
Used my mods scan-s2 + tzap-t2 + vdr 1.7.27

https://bitbucket.org/CrazyCat/szap-s2
https://bitbucket.org/CrazyCat/scan-s2

24.03.2013, 20:19, Antti Palosaari cr...@iki.fi:
 Is there anyone who could test that patch?

 I have no multi PLP signal here.

 Also there is minor issue on that patch. As stream ID validy is already
 checked there is no reason for bit AND 0xff.
--
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] cxd2820r_t2: Multistream support (MultiPLP)

2013-03-06 Thread CrazyCat
MultiPLP filtering support for CXD2820r, not tested.
Somebody from Russia please test (exclude Moscow, because used singlePLP). 
Usual used PLP 0 (4TV + 3 radio) and 1 (4TV). PLP 2,3 reserved (regional 
channels).

P.S. You can use my scan-s2 with multistream support - 
https://bitbucket.org/CrazyCat/scan-s2. Generated channel list compatible with 
current VDR 1.7.3x

Signed-off-by: Evgeny Plehov evgenyple...@ukr.net
diff --git a/drivers/media/dvb-frontends/cxd2820r_core.c 
b/drivers/media/dvb-frontends/cxd2820r_core.c
index 9b658c1..7ca5c69 100644
--- a/drivers/media/dvb-frontends/cxd2820r_core.c
+++ b/drivers/media/dvb-frontends/cxd2820r_core.c
@@ -660,7 +660,8 @@ static const struct dvb_frontend_ops cxd2820r_ops = {
FE_CAN_GUARD_INTERVAL_AUTO  |
FE_CAN_HIERARCHY_AUTO   |
FE_CAN_MUTE_TS  |
-   FE_CAN_2G_MODULATION
+   FE_CAN_2G_MODULATION|
+   FE_CAN_MULTISTREAM
},
 
.release= cxd2820r_release,
diff --git a/drivers/media/dvb-frontends/cxd2820r_t2.c 
b/drivers/media/dvb-frontends/cxd2820r_t2.c
index e82d82a..c2bfea7 100644
--- a/drivers/media/dvb-frontends/cxd2820r_t2.c
+++ b/drivers/media/dvb-frontends/cxd2820r_t2.c
@@ -124,6 +124,23 @@ int cxd2820r_set_frontend_t2(struct dvb_frontend *fe)
buf[1] = ((if_ctl   8)  0xff);
buf[2] = ((if_ctl   0)  0xff);
 
+   /* PLP filtering */
+   if (c-stream_id  0 || c-stream_id  255) {
+   dev_dbg(priv-i2c-dev, %s: Disable PLP filtering\n, 
__func__);
+   ret = cxd2820r_wr_reg(priv, 0x023ad , 0);
+   if (ret)
+   goto error;
+   } else {
+   dev_dbg(priv-i2c-dev, %s: Enable PLP filtering = %d\n, 
__func__,
+   c-stream_id);
+   ret = cxd2820r_wr_reg(priv, 0x023af , c-stream_id  0xFF);
+   if (ret)
+   goto error;
+   ret = cxd2820r_wr_reg(priv, 0x023ad , 1);
+   if (ret)
+   goto error;
+   }
+
ret = cxd2820r_wr_regs(priv, 0x020b6, buf, 3);
if (ret)
goto error;
--
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] stv0900: Multistream support

2012-11-29 Thread CrazyCat
Multistream support for stv0900. For Netup Dual S2 CI with STV0900BAC/AAC.

Signed-off-by: Evgeny Plehov evgenyple...@ukr.net
diff --git a/drivers/media/dvb-frontends/stv0900_core.c 
b/drivers/media/dvb-frontends/stv0900_core.c
index b551ca3..0fb34e1 100644
--- a/drivers/media/dvb-frontends/stv0900_core.c
+++ b/drivers/media/dvb-frontends/stv0900_core.c
@@ -1558,6 +1558,27 @@ static int stv0900_status(struct stv0900_internal *intp,
return locked;
 }
 
+static int stv0900_set_mis(struct stv0900_internal *intp,
+   enum fe_stv0900_demod_num demod, int mis)
+{
+   enum fe_stv0900_error error = STV0900_NO_ERROR;
+
+   dprintk(%s\n, __func__);
+
+   if (mis  0 || mis  255) {
+   dprintk(Disable MIS filtering\n);
+   stv0900_write_bits(intp, FILTER_EN, 0);
+   } else {
+   dprintk(Enable MIS filtering - %d\n, mis);
+   stv0900_write_bits(intp, FILTER_EN, 1);
+   stv0900_write_reg(intp, ISIENTRY, mis);
+   stv0900_write_reg(intp, ISIBITENA, 0xff);
+   }
+
+   return error;
+}
+
+
 static enum dvbfe_search stv0900_search(struct dvb_frontend *fe)
 {
struct stv0900_state *state = fe-demodulator_priv;
@@ -1578,6 +1599,8 @@ static enum dvbfe_search stv0900_search(struct 
dvb_frontend *fe)
if (state-config-set_ts_params)
state-config-set_ts_params(fe, 0);
 
+   stv0900_set_mis(intp, demod, c-stream_id);
+
p_result.locked = FALSE;
p_search.path = demod;
p_search.frequency = c-frequency;
@@ -1935,6 +1958,9 @@ struct dvb_frontend *stv0900_attach(const struct 
stv0900_config *config,
if (err_stv0900)
goto error;
 
+   if (state-internal-chip_id = 0x30)
+   state-frontend.ops.info.caps |= FE_CAN_MULTISTREAM;
+
break;
default:
goto error;
diff --git a/drivers/media/dvb-frontends/stv0900_reg.h 
b/drivers/media/dvb-frontends/stv0900_reg.h
index 731afe9..511ed2a 100644
--- a/drivers/media/dvb-frontends/stv0900_reg.h
+++ b/drivers/media/dvb-frontends/stv0900_reg.h
@@ -3446,8 +3446,11 @@ extern s32 shiftx(s32 x, int demod, s32 shift);
 #define R0900_P1_PDELCTRL1 0xf550
 #define PDELCTRL1 REGx(R0900_P1_PDELCTRL1)
 #define F0900_P1_INV_MISMASK 0xf5500080
+#define INV_MISMASK FLDx(F0900_P1_INV_MISMASK)
 #define F0900_P1_FILTER_EN 0xf5500020
+#define FILTER_EN FLDx(F0900_P1_FILTER_EN)
 #define F0900_P1_EN_MIS00 0xf552
+#define EN_MIS00 FLDx(F0900_P1_EN_MIS00)
 #define F0900_P1_ALGOSWRST 0xf551
 #define ALGOSWRST FLDx(F0900_P1_ALGOSWRST)
 
--
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] stv0900: Multistream support

2012-11-29 Thread CrazyCat
Yes, really useless :) Need remove it:)

29.11.2012, 21:41, Ezequiel Garcia elezegar...@gmail.com:
 Mmm, that's a pretty useless printk, IMHO.
 If someone wants to trace a driver it's better to use ftrace, again IMHO.
--
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] dvb_frontend: Multistream support

2012-09-13 Thread CrazyCat
Multistream support for DVBAPI. Version increased to 5.8.

Signed-off-by: Evgeny Plehov evgenyple...@ukr.net
diff --git a/include/linux/dvb/frontend.h b/include/linux/dvb/frontend.h
index bb51edf..a6a6839 100644
--- a/include/linux/dvb/frontend.h
+++ b/include/linux/dvb/frontend.h
@@ -62,6 +62,7 @@ typedef enum fe_caps {
FE_CAN_8VSB = 0x20,
FE_CAN_16VSB= 0x40,
FE_HAS_EXTENDED_CAPS= 0x80,   /* We need more bitspace 
for newer APIs, indicate this. */
+   FE_CAN_MULTISTREAM  = 0x400,  /* frontend supports 
multistream filtering */
FE_CAN_TURBO_FEC= 0x800,  /* frontend supports 
turbo fec modulation */
FE_CAN_2G_MODULATION= 0x1000, /* frontend supports 2nd 
generation modulation (DVB-S2) */
FE_NEEDS_BENDING= 0x2000, /* not supported anymore, 
don't use (frontend requires frequency bending) */
@@ -338,9 +339,9 @@ struct dvb_frontend_event {
 
 #define DTV_ISDBT_LAYER_ENABLED41
 
-#define DTV_ISDBS_TS_ID42
-
-#define DTV_DVBT2_PLP_ID   43
+#define DTV_STREAM_ID  42
+#define DTV_ISDBS_TS_ID_LEGACY DTV_STREAM_ID
+#define DTV_DVBT2_PLP_ID_LEGACY43
 
 #define DTV_ENUM_DELSYS44
 
@@ -436,6 +437,7 @@ enum atscmh_rs_code_mode {
ATSCMH_RSCODE_RES= 3,
 };
 
+#define NO_STREAM_ID_FILTER(~0U)
 
 struct dtv_cmds_h {
char*name;  /* A display name for debugging purposes */
diff --git a/drivers/media/dvb-core/dvb_frontend.h 
b/drivers/media/dvb-core/dvb_frontend.h
index db309db..33996a0 100644
--- a/drivers/media/dvb-core/dvb_frontend.h
+++ b/drivers/media/dvb-core/dvb_frontend.h
@@ -370,11 +370,8 @@ struct dtv_frontend_properties {
u8  interleaving;
} layer[3];
 
-   /* ISDB-T specifics */
-   u32 isdbs_ts_id;
-
-   /* DVB-T2 specifics */
-   u32 dvbt2_plp_id;
+   /* Multistream specifics */
+   u32 stream_id;
 
/* ATSC-MH specifics */
u8  atscmh_fic_ver;
diff --git a/drivers/media/dvb-core/dvb_frontend.c 
b/drivers/media/dvb-core/dvb_frontend.c
index aa4d4d8..fc0c0ca 100644
--- a/drivers/media/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb-core/dvb_frontend.c
@@ -946,8 +946,7 @@ static int dvb_frontend_clear_cache(struct dvb_frontend *fe)
c-layer[i].segment_count = 0;
}
 
-   c-isdbs_ts_id = 0;
-   c-dvbt2_plp_id = 0;
+   c-stream_id = NO_STREAM_ID_FILTER;
 
switch (c-delivery_system) {
case SYS_DVBS:
@@ -1018,8 +1017,8 @@ static struct dtv_cmds_h dtv_cmds[DTV_MAX_COMMAND + 1] = {
_DTV_CMD(DTV_ISDBT_LAYERC_SEGMENT_COUNT, 1, 0),
_DTV_CMD(DTV_ISDBT_LAYERC_TIME_INTERLEAVING, 1, 0),
 
-   _DTV_CMD(DTV_ISDBS_TS_ID, 1, 0),
-   _DTV_CMD(DTV_DVBT2_PLP_ID, 1, 0),
+   _DTV_CMD(DTV_STREAM_ID, 1, 0),
+   _DTV_CMD(DTV_DVBT2_PLP_ID_LEGACY, 1, 0),
 
/* Get */
_DTV_CMD(DTV_DISEQC_SLAVE_REPLY, 0, 1),
@@ -1387,11 +1386,11 @@ static int dtv_property_process_get(struct dvb_frontend 
*fe,
case DTV_ISDBT_LAYERC_TIME_INTERLEAVING:
tvp-u.data = c-layer[2].interleaving;
break;
-   case DTV_ISDBS_TS_ID:
-   tvp-u.data = c-isdbs_ts_id;
-   break;
-   case DTV_DVBT2_PLP_ID:
-   tvp-u.data = c-dvbt2_plp_id;
+
+   /* Multistream support */
+   case DTV_STREAM_ID:
+   case DTV_DVBT2_PLP_ID_LEGACY:
+   tvp-u.data = c-stream_id;
break;
 
/* ATSC-MH */
@@ -1779,11 +1778,11 @@ static int dtv_property_process_set(struct dvb_frontend 
*fe,
case DTV_ISDBT_LAYERC_TIME_INTERLEAVING:
c-layer[2].interleaving = tvp-u.data;
break;
-   case DTV_ISDBS_TS_ID:
-   c-isdbs_ts_id = tvp-u.data;
-   break;
-   case DTV_DVBT2_PLP_ID:
-   c-dvbt2_plp_id = tvp-u.data;
+
+   /* Multistream support */
+   case DTV_STREAM_ID:
+   case DTV_DVBT2_PLP_ID_LEGACY:
+   c-stream_id = tvp-u.data;
break;
 
/* ATSC-MH */
diff --git a/include/linux/dvb/version.h b/include/linux/dvb/version.h
index 70c2c7e..20e5eac 100644
--- a/include/linux/dvb/version.h
+++ b/include/linux/dvb/version.h
@@ -24,6 +24,6 @@
 #define _DVBVERSION_H_
 
 #define DVB_API_VERSION 5
-#define DVB_API_VERSION_MINOR 7
+#define DVB_API_VERSION_MINOR 8
 
 #endif /*_DVBVERSION_H_*/
--
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] stv090x: Multistream support

2012-09-13 Thread CrazyCat
Multistream support for stv090x

Signed-off-by: Evgeny Plehov evgenyple...@ukr.net
diff --git a/drivers/media/dvb-frontends/stv090x.c 
b/drivers/media/dvb-frontends/stv090x.c
index ea86a56..13caec0 100644
--- a/drivers/media/dvb-frontends/stv090x.c
+++ b/drivers/media/dvb-frontends/stv090x.c
@@ -3425,6 +3425,33 @@ err:
return -1;
 }
 
+static int stv090x_set_mis(struct stv090x_state *state, int mis)
+{
+   u32 reg;
+
+   if (mis  0 || mis  255) {
+   dprintk(FE_DEBUG, 1, Disable MIS filtering);
+   reg = STV090x_READ_DEMOD(state, PDELCTRL1);
+   STV090x_SETFIELD_Px(reg, FILTER_EN_FIELD, 0x00);
+   if (STV090x_WRITE_DEMOD(state, PDELCTRL1, reg)  0)
+   goto err;
+   } else {
+   dprintk(FE_DEBUG, 1, Enable MIS filtering - %d, mis);
+   reg = STV090x_READ_DEMOD(state, PDELCTRL1);
+   STV090x_SETFIELD_Px(reg, FILTER_EN_FIELD, 0x01);
+   if (STV090x_WRITE_DEMOD(state, PDELCTRL1, reg)  0)
+   goto err;
+   if (STV090x_WRITE_DEMOD(state, ISIENTRY, mis)  0)
+   goto err;
+   if (STV090x_WRITE_DEMOD(state, ISIBITENA, 0xff)  0)
+   goto err;
+   }
+   return 0;
+err:
+   dprintk(FE_ERROR, 1, I/O error);
+   return -1;
+}
+
 static enum dvbfe_search stv090x_search(struct dvb_frontend *fe)
 {
struct stv090x_state *state = fe-demodulator_priv;
@@ -3447,6 +3474,8 @@ static enum dvbfe_search stv090x_search(struct 
dvb_frontend *fe)
state-search_range = 500;
}
 
+   stv090x_set_mis(state, props-stream_id);
+
if (stv090x_algo(state) == STV090x_RANGEOK) {
dprintk(FE_DEBUG, 1, Search success!);
return DVBFE_ALGO_SEARCH_SUCCESS;
@@ -4798,6 +4827,9 @@ struct dvb_frontend *stv090x_attach(const struct 
stv090x_config *config,
}
}
 
+   if (state-internal-dev_ver = 0x30)
+   state-frontend.ops.info.caps |= FE_CAN_MULTISTREAM;
+
/* workaround for stuck DiSEqC output */
if (config-diseqc_envelope_mode)
stv090x_send_diseqc_burst(state-frontend, SEC_MINI_A);
--
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] va1j5jf8007s: Multistream support

2012-09-13 Thread CrazyCat
Update multistream support.

Signed-off-by: Evgeny Plehov evgenyple...@ukr.net
diff --git a/drivers/media/pci/pt1/va1j5jf8007s.c 
b/drivers/media/pci/pt1/va1j5jf8007s.c
index d980dfb..1b637b7 100644
--- a/drivers/media/pci/pt1/va1j5jf8007s.c
+++ b/drivers/media/pci/pt1/va1j5jf8007s.c
@@ -329,8 +329,8 @@ va1j5jf8007s_set_ts_id(struct va1j5jf8007s_state *state)
u8 buf[3];
struct i2c_msg msg;
 
-   ts_id = state-fe.dtv_property_cache.isdbs_ts_id;
-   if (!ts_id)
+   ts_id = state-fe.dtv_property_cache.stream_id;
+   if (!ts_id || ts_id == NO_STREAM_ID_FILTER)
return 0;
 
buf[0] = 0x8f;
@@ -356,8 +356,8 @@ va1j5jf8007s_check_ts_id(struct va1j5jf8007s_state *state, 
int *lock)
struct i2c_msg msgs[2];
u32 ts_id;
 
-   ts_id = state-fe.dtv_property_cache.isdbs_ts_id;
-   if (!ts_id) {
+   ts_id = state-fe.dtv_property_cache.stream_id;
+   if (!ts_id || ts_id == NO_STREAM_ID_FILTER) {
*lock = 1;
return 0;
}
@@ -587,7 +587,8 @@ static struct dvb_frontend_ops va1j5jf8007s_ops = {
.frequency_stepsize = 1000,
.caps = FE_CAN_INVERSION_AUTO | FE_CAN_FEC_AUTO |
FE_CAN_QAM_AUTO | FE_CAN_TRANSMISSION_MODE_AUTO |
-   FE_CAN_GUARD_INTERVAL_AUTO | FE_CAN_HIERARCHY_AUTO,
+   FE_CAN_GUARD_INTERVAL_AUTO | FE_CAN_HIERARCHY_AUTO |
+   FE_CAN_MULTISTREAM,
},
 
.read_snr = va1j5jf8007s_read_snr,
--
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] DocBook: Multistream support

2012-09-13 Thread CrazyCat
Multistream support for DVBAPI. If my english bad - please fix it somebody :)

Signed-off-by: Evgeny Plehov evgenyple...@ukr.net
diff --git a/Documentation/DocBook/media/dvb/dvbproperty.xml 
b/Documentation/DocBook/media/dvb/dvbproperty.xml
index d188be9..c7c14be 100644
--- a/Documentation/DocBook/media/dvb/dvbproperty.xml
+++ b/Documentation/DocBook/media/dvb/dvbproperty.xml
@@ -793,15 +793,16 @@ typedef enum fe_hierarchy {
  } fe_hierarchy_t;
/programlisting
/section
-   section id=DTV-ISDBS-TS-ID
-   titleconstantDTV_ISDBS_TS_ID/constant/title
-   paraCurrently unused./para
+   section id=DTV-STREAM-ID
+   titleconstantDTV_STREAM_ID/constant/title
+   paraDVB-S2/T2, ISDB-S supports transmission several streams via a 
single carrier.
+   Depend from standards can be used for many purposes. This 
property enable
+   substream filtering. For DVB-S2/T2 valid substream id from 0 to 
255, for ISDB from 1 to 65535.
+   Anoter id values disable filtering (better use special define 
NO_STREAM_ID_FILTER)./para
/section
-   section id=DTV-DVBT2-PLP-ID
-   titleconstantDTV_DVBT2_PLP_ID/constant/title
-   paraDVB-T2 supports Physical Layer Pipes (PLP) to allow 
transmission of
-   many data types via a single multiplex. The API will 
soon support this
-   at which point this section will be expanded./para
+   section id=DTV-DVBT2-PLP-ID-LEGACY
+   titleconstantDTV_DVBT2_PLP_ID_LEGACY/constant/title
+   paraObsolete, replaced with DTV_STREAM_ID./para
/section
section id=DTV-ENUM-DELSYS
titleconstantDTV_ENUM_DELSYS/constant/title
@@ -869,7 +870,7 @@ enum fe_interleaving {
listitemparalink 
linkend=DTV-GUARD-INTERVALconstantDTV_GUARD_INTERVAL/constant/link/para/listitem
listitemparalink 
linkend=DTV-TRANSMISSION-MODEconstantDTV_TRANSMISSION_MODE/constant/link/para/listitem
listitemparalink 
linkend=DTV-HIERARCHYconstantDTV_HIERARCHY/constant/link/para/listitem
-   listitemparalink 
linkend=DTV-DVBT2-PLP-IDconstantDTV_DVBT2_PLP_ID/constant/link/para/listitem
+   listitemparalink 
linkend=DTV-STREAM-IDconstantDTV_STREAM_ID/constant/link/para/listitem
/itemizedlist
/section
section id=isdbt
@@ -1048,6 +1049,7 @@ enum fe_interleaving {
listitemparalink 
linkend=DTV-MODULATIONconstantDTV_MODULATION/constant/link/para/listitem
listitemparalink 
linkend=DTV-PILOTconstantDTV_PILOT/constant/link/para/listitem
listitemparalink 
linkend=DTV-ROLLOFFconstantDTV_ROLLOFF/constant/link/para/listitem
+   listitemparalink 
linkend=DTV-STREAM-IDconstantDTV_STREAM_ID/constant/link/para/listitem
/itemizedlist
/section
section id=turbo-params
@@ -1070,7 +1072,7 @@ enum fe_interleaving {
listitemparalink 
linkend=DTV-SYMBOL-RATEconstantDTV_SYMBOL_RATE/constant/link/para/listitem
listitemparalink 
linkend=DTV-INNER-FECconstantDTV_INNER_FEC/constant/link/para/listitem
listitemparalink 
linkend=DTV-VOLTAGEconstantDTV_VOLTAGE/constant/link/para/listitem
-   listitemparalink 
linkend=DTV-ISDBS-TS-IDconstantDTV_ISDBS_TS_ID/constant/link/para/listitem
+   listitemparalink 
linkend=DTV-STREAM-IDconstantDTV_STREAM_ID/constant/link/para/listitem
/itemizedlist
/section
/section
diff --git a/Documentation/DocBook/media/dvb/frontend.xml 
b/Documentation/DocBook/media/dvb/frontend.xml
index 950bdfb..426c252 100644
--- a/Documentation/DocBook/media/dvb/frontend.xml
+++ b/Documentation/DocBook/media/dvb/frontend.xml
@@ -101,6 +101,7 @@ a specific frontend type./para
FE_CAN_8VSB   = 0x20,
FE_CAN_16VSB  = 0x40,
FE_HAS_EXTENDED_CAPS  = 0x80,
+   FE_CAN_MULTISTREAM= 0x400,
FE_CAN_TURBO_FEC  = 0x800,
FE_CAN_2G_MODULATION  = 0x1000,
FE_NEEDS_BENDING  = 0x2000,
diff --git a/Documentation/DocBook/media/dvb/intro.xml 
b/Documentation/DocBook/media/dvb/intro.xml
index 170064a..2048b53 100644
--- a/Documentation/DocBook/media/dvb/intro.xml
+++ b/Documentation/DocBook/media/dvb/intro.xml
@@ -205,7 +205,7 @@ a partial path like:/para
 additional include file emphasis
 role=ttlinux/dvb/version.h/emphasis exists, which defines the
 constant emphasis role=ttDVB_API_VERSION/emphasis. This document
-describes emphasis role=ttDVB_API_VERSION 5.4/emphasis.
+describes emphasis role=ttDVB_API_VERSION 5.8/emphasis.
 /para
 
 /section
--
To unsubscribe from this list: send the line 

Re: [PATCH] dvb_frontend: Multistream support

2012-08-20 Thread CrazyCat
Multistream support with all recommendations.

Signed-off-by: Evgeny Plehov evgenyple...@ukr.net
diff --git a/include/linux/dvb/frontend.h b/include/linux/dvb/frontend.h
index bb51edf..a6a6839 100644
--- a/include/linux/dvb/frontend.h
+++ b/include/linux/dvb/frontend.h
@@ -62,6 +62,7 @@ typedef enum fe_caps {
FE_CAN_8VSB = 0x20,
FE_CAN_16VSB= 0x40,
FE_HAS_EXTENDED_CAPS= 0x80,   /* We need more bitspace 
for newer APIs, indicate this. */
+   FE_CAN_MULTISTREAM  = 0x400,  /* frontend supports 
DVB-S2 multistream filtering */
FE_CAN_TURBO_FEC= 0x800,  /* frontend supports 
turbo fec modulation */
FE_CAN_2G_MODULATION= 0x1000, /* frontend supports 2nd 
generation modulation (DVB-S2) */
FE_NEEDS_BENDING= 0x2000, /* not supported anymore, 
don't use (frontend requires frequency bending) */
@@ -338,9 +339,9 @@ struct dvb_frontend_event {
 
 #define DTV_ISDBT_LAYER_ENABLED41
 
-#define DTV_ISDBS_TS_ID42
-
-#define DTV_DVBT2_PLP_ID   43
+#define DTV_STREAM_ID  42
+#define DTV_ISDBS_TS_ID_LEGACY DTV_STREAM_ID
+#define DTV_DVBT2_PLP_ID_LEGACY43
 
 #define DTV_ENUM_DELSYS44
 
@@ -436,6 +437,7 @@ enum atscmh_rs_code_mode {
ATSCMH_RSCODE_RES= 3,
 };
 
+#define NO_STREAM_ID_FILTER(~0U)
 
 struct dtv_cmds_h {
char*name;  /* A display name for debugging purposes */
diff --git a/drivers/media/dvb-core/dvb_frontend.h 
b/drivers/media/dvb-core/dvb_frontend.h
index db309db..33996a0 100644
--- a/drivers/media/dvb-core/dvb_frontend.h
+++ b/drivers/media/dvb-core/dvb_frontend.h
@@ -370,11 +370,8 @@ struct dtv_frontend_properties {
u8  interleaving;
} layer[3];
 
-   /* ISDB-T specifics */
-   u32 isdbs_ts_id;
-
-   /* DVB-T2 specifics */
-   u32 dvbt2_plp_id;
+   /* Multistream specifics */
+   u32 stream_id;
 
/* ATSC-MH specifics */
u8  atscmh_fic_ver;
diff --git a/drivers/media/dvb-core/dvb_frontend.c 
b/drivers/media/dvb-core/dvb_frontend.c
index aa4d4d8..fc0c0ca 100644
--- a/drivers/media/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb-core/dvb_frontend.c
@@ -946,8 +946,7 @@ static int dvb_frontend_clear_cache(struct dvb_frontend *fe)
c-layer[i].segment_count = 0;
}
 
-   c-isdbs_ts_id = 0;
-   c-dvbt2_plp_id = 0;
+   c-stream_id = NO_STREAM_ID_FILTER;
 
switch (c-delivery_system) {
case SYS_DVBS:
@@ -1018,8 +1017,8 @@ static struct dtv_cmds_h dtv_cmds[DTV_MAX_COMMAND + 1] = {
_DTV_CMD(DTV_ISDBT_LAYERC_SEGMENT_COUNT, 1, 0),
_DTV_CMD(DTV_ISDBT_LAYERC_TIME_INTERLEAVING, 1, 0),
 
-   _DTV_CMD(DTV_ISDBS_TS_ID, 1, 0),
-   _DTV_CMD(DTV_DVBT2_PLP_ID, 1, 0),
+   _DTV_CMD(DTV_STREAM_ID, 1, 0),
+   _DTV_CMD(DTV_DVBT2_PLP_ID_LEGACY, 1, 0),
 
/* Get */
_DTV_CMD(DTV_DISEQC_SLAVE_REPLY, 0, 1),
@@ -1387,11 +1386,11 @@ static int dtv_property_process_get(struct dvb_frontend 
*fe,
case DTV_ISDBT_LAYERC_TIME_INTERLEAVING:
tvp-u.data = c-layer[2].interleaving;
break;
-   case DTV_ISDBS_TS_ID:
-   tvp-u.data = c-isdbs_ts_id;
-   break;
-   case DTV_DVBT2_PLP_ID:
-   tvp-u.data = c-dvbt2_plp_id;
+
+   /* Multistream support */
+   case DTV_STREAM_ID:
+   case DTV_DVBT2_PLP_ID_LEGACY:
+   tvp-u.data = c-stream_id;
break;
 
/* ATSC-MH */
@@ -1779,11 +1778,11 @@ static int dtv_property_process_set(struct dvb_frontend 
*fe,
case DTV_ISDBT_LAYERC_TIME_INTERLEAVING:
c-layer[2].interleaving = tvp-u.data;
break;
-   case DTV_ISDBS_TS_ID:
-   c-isdbs_ts_id = tvp-u.data;
-   break;
-   case DTV_DVBT2_PLP_ID:
-   c-dvbt2_plp_id = tvp-u.data;
+
+   /* Multistream support */
+   case DTV_STREAM_ID:
+   case DTV_DVBT2_PLP_ID_LEGACY:
+   c-stream_id = tvp-u.data;
break;
 
/* ATSC-MH */

--
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] dvb_frontend: Multistream support

2012-08-17 Thread CrazyCat

16.08.2012, 21:11, Antti Palosaari cr...@iki.fi:
  - /* ISDB-T specifics */
  - u32 isdbs_ts_id;
  -
  - /* DVB-T2 specifics */
  - u32 dvbt2_plp_id;
  + /* Multistream specifics */
  + u32 stream_id;

 u32 == 32 bit long unsigned number. See next comment.

  - c-isdbs_ts_id = 0;
  - c-dvbt2_plp_id = 0;
  + c-stream_id = -1;

 unsigned number cannot be -1. It can be only 0 or bigger. Due to that
 this is wrong.

so maybe better declare in as int ? depend from standard valid stream id (for 
DVB is 0-255) and any another value (-1) disable stream filtering in demod.
--
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] dvb_frontend: Multistream support

2012-08-17 Thread CrazyCat
16.08.2012, 21:11, Antti Palosaari cr...@iki.fi:
 @Mauro, should we rename also DTV_ISDBS_TS_ID to DTV_ISDBS_TS_ID_LEGACY
 to remind users ?

Maybe leave DTV_ISDBS_TS_ID and convert DTV_DVBT2_PLP_ID to  DTV_DVB_STREAM_ID 
? and dvbt2_plp_id convert to dvb_stream_id.

Because DVB and ISDB different standards and look like stream id for ISDB is 16 
bit, for DVB-S2/T2 8 bit.
--
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] dvb_frontend: Multistream support

2012-08-16 Thread CrazyCat
DTV_ISDBS_TS_ID replaced with DTV_STREAM_ID.
Aliases DTV_ISDBS_TS_ID, DTV_DVBS2_MIS_ID for DTV_STREAM_ID.
DTV_DVBT2_PLP_ID marked as legacy.

Signed-off-by: Evgeny Plehov evgenyple...@ukr.net
diff --git a/include/linux/dvb/frontend.h b/include/linux/dvb/frontend.h
index f50d405..3444dda 100644
--- a/include/linux/dvb/frontend.h
+++ b/include/linux/dvb/frontend.h
@@ -62,6 +62,7 @@ typedef enum fe_caps {
 FE_CAN_8VSB = 0x20,
 FE_CAN_16VSB = 0x40,
 FE_HAS_EXTENDED_CAPS = 0x80,   /* We need more bitspace for newer 
APIs, indicate this. */
+ FE_CAN_MULTISTREAM = 0x400,  /* frontend supports DVB-S2 multistream 
filtering */
 FE_CAN_TURBO_FEC = 0x800,  /* frontend supports turbo fec 
modulation */
 FE_CAN_2G_MODULATION = 0x1000, /* frontend supports 2nd 
generation modulation (DVB-S2) */
 FE_NEEDS_BENDING = 0x2000, /* not supported anymore, don't use 
(frontend requires frequency bending) */
@@ -314,9 +315,11 @@ struct dvb_frontend_event {

 #define DTV_ISDBT_LAYER_ENABLED 41

-#define DTV_ISDBS_TS_ID 42
+#define DTV_STREAM_ID 42
+#define DTV_ISDBS_TS_ID DTV_STREAM_ID
+#define DTV_DVBS2_MIS_ID DTV_STREAM_ID

-#define DTV_DVBT2_PLP_ID 43
+#define DTV_DVBT2_PLP_ID_LEGACY 43

 #define DTV_ENUM_DELSYS 44

diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.h 
b/drivers/media/dvb/dvb-core/dvb_frontend.h
index 7c64c09..bec0cda 100644
--- a/drivers/media/dvb/dvb-core/dvb_frontend.h
+++ b/drivers/media/dvb/dvb-core/dvb_frontend.h
@@ -368,11 +368,8 @@ struct dtv_frontend_properties {
 u8 interleaving;
 } layer[3];

- /* ISDB-T specifics */
- u32 isdbs_ts_id;
-
- /* DVB-T2 specifics */
- u32 dvbt2_plp_id;
+ /* Multistream specifics */
+ u32 stream_id;

 /* ATSC-MH specifics */
 u8 atscmh_fic_ver;
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c 
b/drivers/media/dvb/dvb-core/dvb_frontend.c
index aebcdf2..bccd245 100644
--- a/drivers/media/dvb/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb/dvb-core/dvb_frontend.c
@@ -946,8 +946,7 @@ static int dvb_frontend_clear_cache(struct dvb_frontend *fe)
 c-layer[i].segment_count = 0;
 }

- c-isdbs_ts_id = 0;
- c-dvbt2_plp_id = 0;
+ c-stream_id = -1;

 switch (c-delivery_system) {
 case SYS_DVBS:
@@ -1017,8 +1016,8 @@ static struct dtv_cmds_h dtv_cmds[DTV_MAX_COMMAND + 1] = {
 _DTV_CMD(DTV_ISDBT_LAYERC_SEGMENT_COUNT, 1, 0),
 _DTV_CMD(DTV_ISDBT_LAYERC_TIME_INTERLEAVING, 1, 0),

- _DTV_CMD(DTV_ISDBS_TS_ID, 1, 0),
- _DTV_CMD(DTV_DVBT2_PLP_ID, 1, 0),
+ _DTV_CMD(DTV_STREAM_ID, 1, 0),
+ _DTV_CMD(DTV_DVBT2_PLP_ID_LEGACY, 1, 0),

 /* Get */
 _DTV_CMD(DTV_DISEQC_SLAVE_REPLY, 0, 1),
@@ -1382,11 +1381,10 @@ static int dtv_property_process_get(struct dvb_frontend 
*fe,
 case DTV_ISDBT_LAYERC_TIME_INTERLEAVING:
 tvp-u.data = c-layer[2].interleaving;
 break;
- case DTV_ISDBS_TS_ID:
- tvp-u.data = c-isdbs_ts_id;
- break;
- case DTV_DVBT2_PLP_ID:
- tvp-u.data = c-dvbt2_plp_id;
+
+ case DTV_STREAM_ID:
+ case DTV_DVBT2_PLP_ID_LEGACY:
+ tvp-u.data = c-stream_id;
 break;

 /* ATSC-MH */
@@ -1771,11 +1769,10 @@ static int dtv_property_process_set(struct dvb_frontend 
*fe,
 case DTV_ISDBT_LAYERC_TIME_INTERLEAVING:
 c-layer[2].interleaving = tvp-u.data;
 break;
- case DTV_ISDBS_TS_ID:
- c-isdbs_ts_id = tvp-u.data;
- break;
- case DTV_DVBT2_PLP_ID:
- c-dvbt2_plp_id = tvp-u.data;
+
+ case DTV_STREAM_ID:
+ case DTV_DVBT2_PLP_ID_LEGACY:
+ c-stream_id = tvp-u.data;
 break;

 /* ATSC-MH */
--
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] stv090x: Multistream support

2012-08-16 Thread CrazyCat
DVB-S2 Multistream support for stv090x

Signed-off-by: Evgeny Plehov evgenyple...@ukr.net
diff --git a/drivers/media/dvb/frontends/stv090x.c 
b/drivers/media/dvb/frontends/stv090x.c
index ea86a56..13caec0 100644
--- a/drivers/media/dvb/frontends/stv090x.c
+++ b/drivers/media/dvb/frontends/stv090x.c
@@ -3425,6 +3425,33 @@ err:
return -1;
 }
 
+static int stv090x_set_mis(struct stv090x_state *state, int mis)
+{
+   u32 reg;
+
+   if (mis  0 || mis  255) {
+   dprintk(FE_DEBUG, 1, Disable MIS filtering);
+   reg = STV090x_READ_DEMOD(state, PDELCTRL1);
+   STV090x_SETFIELD_Px(reg, FILTER_EN_FIELD, 0x00);
+   if (STV090x_WRITE_DEMOD(state, PDELCTRL1, reg)  0)
+   goto err;
+   } else {
+   dprintk(FE_DEBUG, 1, Enable MIS filtering - %d, mis);
+   reg = STV090x_READ_DEMOD(state, PDELCTRL1);
+   STV090x_SETFIELD_Px(reg, FILTER_EN_FIELD, 0x01);
+   if (STV090x_WRITE_DEMOD(state, PDELCTRL1, reg)  0)
+   goto err;
+   if (STV090x_WRITE_DEMOD(state, ISIENTRY, mis)  0)
+   goto err;
+   if (STV090x_WRITE_DEMOD(state, ISIBITENA, 0xff)  0)
+   goto err;
+   }
+   return 0;
+err:
+   dprintk(FE_ERROR, 1, I/O error);
+   return -1;
+}
+
 static enum dvbfe_search stv090x_search(struct dvb_frontend *fe)
 {
struct stv090x_state *state = fe-demodulator_priv;
@@ -3447,6 +3474,8 @@ static enum dvbfe_search stv090x_search(struct 
dvb_frontend *fe)
state-search_range = 500;
}
 
+   stv090x_set_mis(state, props-stream_id);
+
if (stv090x_algo(state) == STV090x_RANGEOK) {
dprintk(FE_DEBUG, 1, Search success!);
return DVBFE_ALGO_SEARCH_SUCCESS;
@@ -4798,6 +4827,9 @@ struct dvb_frontend *stv090x_attach(const struct 
stv090x_config *config,
}
}
 
+   if (state-internal-dev_ver = 0x30)
+   state-frontend.ops.info.caps |= FE_CAN_MULTISTREAM;
+
/* workaround for stuck DiSEqC output */
if (config-diseqc_envelope_mode)
stv090x_send_diseqc_burst(state-frontend, SEC_MINI_A);
--
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] DVB-S2 multistream support

2012-08-12 Thread CrazyCat
Ok, done :) Look like DTV_DVBT2_PLP_ID not implemented for CXD2820r ?

12.08.2012, 03:00, Antti Palosaari cr...@iki.fi:
 We asked you to merge isdbs_ts_id, dvbt2_plp_id and dvbs2_mis_id to one
 as those are logically same thing from the user-point of view.
 Technically those differs, but that is userspace API so underlying
 technique should not matter.

 It is some more work for you, but it should not be such big issue you
 cannot do. So please use few hours and merge all those. I think correct
 name is DTV_STREAM_ID. So remove isdbs_ts_id, dvbt2_plp_id and
 dvbs2_mis_id. Add new variable stream_id. As DTV_ISDBS_TS_ID and
 DTV_DVBT2_PLP_ID already exists you should make some logic those could
 be still used.

Signed-off-by: Evgeny Plehov evgenyple...@ukr.net
diff --git a/include/linux/dvb/frontend.h b/include/linux/dvb/frontend.h
index f50d405..32d51bc 100644
--- a/include/linux/dvb/frontend.h
+++ b/include/linux/dvb/frontend.h
@@ -62,6 +62,7 @@ typedef enum fe_caps {
FE_CAN_8VSB = 0x20,
FE_CAN_16VSB= 0x40,
FE_HAS_EXTENDED_CAPS= 0x80,   /* We need more bitspace 
for newer APIs, indicate this. */
+   FE_CAN_MULTISTREAM  = 0x400,  /* frontend supports 
DVB-S2 multistream filtering */
FE_CAN_TURBO_FEC= 0x800,  /* frontend supports 
turbo fec modulation */
FE_CAN_2G_MODULATION= 0x1000, /* frontend supports 2nd 
generation modulation (DVB-S2) */
FE_NEEDS_BENDING= 0x2000, /* not supported anymore, 
don't use (frontend requires frequency bending) */
@@ -314,9 +315,10 @@ struct dvb_frontend_event {
 
 #define DTV_ISDBT_LAYER_ENABLED41
 
-#define DTV_ISDBS_TS_ID42
-
-#define DTV_DVBT2_PLP_ID   43
+#define DTV_STREAM_ID  42
+#define DTV_ISDBS_TS_IDDTV_STREAM_ID
+#define DTV_DVBT2_PLP_ID   DTV_STREAM_ID
+#define DTV_DVBS2_MIS_ID   DTV_STREAM_ID
 
 #define DTV_ENUM_DELSYS44
 
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c 
b/drivers/media/dvb/dvb-core/dvb_frontend.c
index aebcdf2..8fb7eac 100644
--- a/drivers/media/dvb/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb/dvb-core/dvb_frontend.c
@@ -946,8 +946,7 @@ static int dvb_frontend_clear_cache(struct dvb_frontend *fe)
c-layer[i].segment_count = 0;
}
 
-   c-isdbs_ts_id = 0;
-   c-dvbt2_plp_id = 0;
+   c-stream_id = -1;
 
switch (c-delivery_system) {
case SYS_DVBS:
@@ -1017,8 +1016,7 @@ static struct dtv_cmds_h dtv_cmds[DTV_MAX_COMMAND + 1] = {
_DTV_CMD(DTV_ISDBT_LAYERC_SEGMENT_COUNT, 1, 0),
_DTV_CMD(DTV_ISDBT_LAYERC_TIME_INTERLEAVING, 1, 0),
 
-   _DTV_CMD(DTV_ISDBS_TS_ID, 1, 0),
-   _DTV_CMD(DTV_DVBT2_PLP_ID, 1, 0),
+   _DTV_CMD(DTV_STREAM_ID, 1, 0),
 
/* Get */
_DTV_CMD(DTV_DISEQC_SLAVE_REPLY, 0, 1),
@@ -1382,11 +1380,9 @@ static int dtv_property_process_get(struct dvb_frontend 
*fe,
case DTV_ISDBT_LAYERC_TIME_INTERLEAVING:
tvp-u.data = c-layer[2].interleaving;
break;
-   case DTV_ISDBS_TS_ID:
-   tvp-u.data = c-isdbs_ts_id;
-   break;
-   case DTV_DVBT2_PLP_ID:
-   tvp-u.data = c-dvbt2_plp_id;
+
+   case DTV_STREAM_ID:
+   tvp-u.data = c-stream_id;
break;
 
/* ATSC-MH */
@@ -1771,11 +1767,8 @@ static int dtv_property_process_set(struct dvb_frontend 
*fe,
case DTV_ISDBT_LAYERC_TIME_INTERLEAVING:
c-layer[2].interleaving = tvp-u.data;
break;
-   case DTV_ISDBS_TS_ID:
-   c-isdbs_ts_id = tvp-u.data;
-   break;
-   case DTV_DVBT2_PLP_ID:
-   c-dvbt2_plp_id = tvp-u.data;
+   case DTV_STREAM_ID:
+   c-stream_id = tvp-u.data;
break;
 
/* ATSC-MH */
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.h 
b/drivers/media/dvb/dvb-core/dvb_frontend.h
index 7c64c09..bec0cda 100644
--- a/drivers/media/dvb/dvb-core/dvb_frontend.h
+++ b/drivers/media/dvb/dvb-core/dvb_frontend.h
@@ -368,11 +368,8 @@ struct dtv_frontend_properties {
u8  interleaving;
} layer[3];
 
-   /* ISDB-T specifics */
-   u32 isdbs_ts_id;
-
-   /* DVB-T2 specifics */
-   u32 dvbt2_plp_id;
+   /* Multistream specifics */
+   u32 stream_id;
 
/* ATSC-MH specifics */
u8  atscmh_fic_ver;
diff --git a/drivers/media/dvb/frontends/stv090x.c 
b/drivers/media/dvb/frontends/stv090x.c
index ea86a56..13caec0 100644
--- a/drivers/media/dvb/frontends/stv090x.c
+++ b/drivers/media/dvb/frontends/stv090x.c
@@ -3425,6 +3425,33 @@ err:
return -1;
 }
 
+static int stv090x_set_mis(struct stv090x_state *state, int mis)
+{
+   u32 reg;
+
+   if (mis  0 || 

Re: [PATCH]Omicom S2 PCI support

2012-08-11 Thread CrazyCat
Ok, fixed patch.

Signed-off-by: Evgeny Plehov evgenyple...@ukr.net
diff --git a/drivers/media/dvb/ttpci/budget.c b/drivers/media/dvb/ttpci/budget.c
index b21bcce..7e6e43a 100644
--- a/drivers/media/dvb/ttpci/budget.c
+++ b/drivers/media/dvb/ttpci/budget.c
@@ -50,6 +50,8 @@
 #include stv6110x.h
 #include stv090x.h
 #include isl6423.h
+#include lnbh24.h
+
 
 static int diseqc_method;
 module_param(diseqc_method, int, 0444);
@@ -679,6 +681,62 @@ static void frontend_init(struct budget *budget)
}
}
break;
+
+   case 0x1020: { /* Omicom S2 */
+   struct stv6110x_devctl *ctl;
+   saa7146_setgpio(budget-dev, 2, SAA7146_GPIO_OUTLO);
+   msleep(50);
+   saa7146_setgpio(budget-dev, 2, SAA7146_GPIO_OUTHI);
+   msleep(250);
+
+   budget-dvb_frontend = dvb_attach(stv090x_attach,
+ 
tt1600_stv090x_config,
+ budget-i2c_adap,
+ 
STV090x_DEMODULATOR_0);
+
+   if (budget-dvb_frontend) {
+   printk(KERN_INFO budget: Omicom S2 
detected\n);
+
+   ctl = dvb_attach(stv6110x_attach,
+budget-dvb_frontend,
+tt1600_stv6110x_config,
+budget-i2c_adap);
+
+   if (ctl) {
+   tt1600_stv090x_config.tuner_init
  = ctl-tuner_init;
+   tt1600_stv090x_config.tuner_sleep   
  = ctl-tuner_sleep;
+   tt1600_stv090x_config.tuner_set_mode
  = ctl-tuner_set_mode;
+   
tt1600_stv090x_config.tuner_set_frequency = ctl-tuner_set_frequency;
+   
tt1600_stv090x_config.tuner_get_frequency = ctl-tuner_get_frequency;
+   
tt1600_stv090x_config.tuner_set_bandwidth = ctl-tuner_set_bandwidth;
+   
tt1600_stv090x_config.tuner_get_bandwidth = ctl-tuner_get_bandwidth;
+   tt1600_stv090x_config.tuner_set_bbgain  
  = ctl-tuner_set_bbgain;
+   tt1600_stv090x_config.tuner_get_bbgain  
  = ctl-tuner_get_bbgain;
+   tt1600_stv090x_config.tuner_set_refclk  
  = ctl-tuner_set_refclk;
+   tt1600_stv090x_config.tuner_get_status  
  = ctl-tuner_get_status;
+
+   /* call the init function once to 
initialize
+  tuner's clock output divider and 
demod's
+  master clock */
+   if (budget-dvb_frontend-ops.init)
+   
budget-dvb_frontend-ops.init(budget-dvb_frontend);
+
+   if (dvb_attach(lnbh24_attach,
+   budget-dvb_frontend,
+   budget-i2c_adap,
+   LNBH24_PCL | LNBH24_TTX,
+   LNBH24_TEN, 0x141) == 
NULL) {
+   printk(KERN_ERR
+   No LNBH24 found!\n);
+   goto error_out;
+   }
+   } else {
+   printk(KERN_ERR %s: No STV6110(A) 
Silicon Tuner found!\n, __func__);
+   goto error_out;
+   }
+   }
+   }
+   break;
}
 
if (budget-dvb_frontend == NULL) {
@@ -759,6 +817,7 @@ MAKE_BUDGET_INFO(fsacs0, Fujitsu Siemens Activy Budget-S 
PCI (rev GR/grundig fr
 MAKE_BUDGET_INFO(fsacs1, Fujitsu Siemens Activy Budget-S PCI (rev AL/alps 
frontend), BUDGET_FS_ACTIVY);
 MAKE_BUDGET_INFO(fsact, Fujitsu Siemens Activy Budget-T PCI (rev 
GR/Grundig frontend), BUDGET_FS_ACTIVY);
 MAKE_BUDGET_INFO(fsact1, Fujitsu Siemens Activy Budget-T PCI (rev AL/ALPS 
TDHD1-204A), BUDGET_FS_ACTIVY);
+MAKE_BUDGET_INFO(omicom, Omicom S2 PCI, BUDGET_TT);
 
 static struct pci_device_id pci_tbl[] = {
MAKE_EXTENSION_PCI(ttbs,  0x13c2, 0x1003),
@@ -772,6 +831,7 @@ static struct pci_device_id pci_tbl[] = {
MAKE_EXTENSION_PCI(fsacs0,0x1131, 0x4f61),
MAKE_EXTENSION_PCI(fsact1, 0x1131, 0x5f60),

Re: [PATCH] DVB-S2 multistream support

2012-08-11 Thread CrazyCat
Fixed patch.

Signed-off-by: Evgeny Plehov evgenyple...@ukr.net
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c 
b/drivers/media/dvb/dvb-core/dvb_frontend.c
index aebcdf2..7813165 100644
--- a/drivers/media/dvb/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb/dvb-core/dvb_frontend.c
@@ -948,6 +948,7 @@ static int dvb_frontend_clear_cache(struct dvb_frontend *fe)
 
c-isdbs_ts_id = 0;
c-dvbt2_plp_id = 0;
+   c-dvbs2_mis_id = -1;
 
switch (c-delivery_system) {
case SYS_DVBS:
@@ -1049,6 +1050,8 @@ static struct dtv_cmds_h dtv_cmds[DTV_MAX_COMMAND + 1] = {
_DTV_CMD(DTV_ATSCMH_SCCC_CODE_MODE_B, 0, 0),
_DTV_CMD(DTV_ATSCMH_SCCC_CODE_MODE_C, 0, 0),
_DTV_CMD(DTV_ATSCMH_SCCC_CODE_MODE_D, 0, 0),
+
+   _DTV_CMD(DTV_DVBS2_MIS_ID, 1, 0),
 };
 
 static void dtv_property_dump(struct dtv_property *tvp)
@@ -1436,6 +1439,10 @@ static int dtv_property_process_get(struct dvb_frontend 
*fe,
tvp-u.data = fe-dtv_property_cache.atscmh_sccc_code_mode_d;
break;
 
+   case DTV_DVBS2_MIS_ID:
+   tvp-u.data = c-dvbs2_mis_id;
+   break;
+
default:
return -EINVAL;
}
@@ -1786,6 +1793,10 @@ static int dtv_property_process_set(struct dvb_frontend 
*fe,
fe-dtv_property_cache.atscmh_rs_frame_ensemble = tvp-u.data;
break;
 
+   case DTV_DVBS2_MIS_ID:
+   c-dvbs2_mis_id = tvp-u.data;
+   break;
+
default:
return -EINVAL;
}
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.h 
b/drivers/media/dvb/dvb-core/dvb_frontend.h
index 7c64c09..cf10b05 100644
--- a/drivers/media/dvb/dvb-core/dvb_frontend.h
+++ b/drivers/media/dvb/dvb-core/dvb_frontend.h
@@ -374,6 +374,9 @@ struct dtv_frontend_properties {
/* DVB-T2 specifics */
u32 dvbt2_plp_id;
 
+   /* DVB-S2 specifics */
+   u32 dvbs2_mis_id;
+
/* ATSC-MH specifics */
u8  atscmh_fic_ver;
u8  atscmh_parade_id;
diff --git a/drivers/media/dvb/frontends/stv090x.c 
b/drivers/media/dvb/frontends/stv090x.c
index ea86a56..a9c2bc5 100644
--- a/drivers/media/dvb/frontends/stv090x.c
+++ b/drivers/media/dvb/frontends/stv090x.c
@@ -3425,6 +3425,33 @@ err:
return -1;
 }
 
+static int stv090x_set_mis(struct stv090x_state *state, int mis)
+{
+   u32 reg;
+
+   if (mis  0 || mis  255) {
+   dprintk(FE_DEBUG, 1, Disable MIS filtering);
+   reg = STV090x_READ_DEMOD(state, PDELCTRL1);
+   STV090x_SETFIELD_Px(reg, FILTER_EN_FIELD, 0x00);
+   if (STV090x_WRITE_DEMOD(state, PDELCTRL1, reg)  0)
+   goto err;
+   } else {
+   dprintk(FE_DEBUG, 1, Enable MIS filtering - %d, mis);
+   reg = STV090x_READ_DEMOD(state, PDELCTRL1);
+   STV090x_SETFIELD_Px(reg, FILTER_EN_FIELD, 0x01);
+   if (STV090x_WRITE_DEMOD(state, PDELCTRL1, reg)  0)
+   goto err;
+   if (STV090x_WRITE_DEMOD(state, ISIENTRY, mis)  0)
+   goto err;
+   if (STV090x_WRITE_DEMOD(state, ISIBITENA, 0xff)  0)
+   goto err;
+   }
+   return 0;
+err:
+   dprintk(FE_ERROR, 1, I/O error);
+   return -1;
+}
+
 static enum dvbfe_search stv090x_search(struct dvb_frontend *fe)
 {
struct stv090x_state *state = fe-demodulator_priv;
@@ -3447,6 +3474,8 @@ static enum dvbfe_search stv090x_search(struct 
dvb_frontend *fe)
state-search_range = 500;
}
 
+   stv090x_set_mis(state, props-dvbs2_mis_id);
+
if (stv090x_algo(state) == STV090x_RANGEOK) {
dprintk(FE_DEBUG, 1, Search success!);
return DVBFE_ALGO_SEARCH_SUCCESS;
@@ -4798,6 +4827,9 @@ struct dvb_frontend *stv090x_attach(const struct 
stv090x_config *config,
}
}
 
+   if (state-internal-dev_ver = 0x30)
+   state-frontend.ops.info.caps |= FE_CAN_MULTISTREAM;
+
/* workaround for stuck DiSEqC output */
if (config-diseqc_envelope_mode)
stv090x_send_diseqc_burst(state-frontend, SEC_MINI_A);
diff --git a/include/linux/dvb/frontend.h b/include/linux/dvb/frontend.h
index f50d405..b37996e 100644
--- a/include/linux/dvb/frontend.h
+++ b/include/linux/dvb/frontend.h
@@ -62,6 +62,7 @@ typedef enum fe_caps {
FE_CAN_8VSB = 0x20,
FE_CAN_16VSB= 0x40,
FE_HAS_EXTENDED_CAPS= 0x80,   /* We need more bitspace 
for newer APIs, indicate this. */
+   FE_CAN_MULTISTREAM  = 0x400,  /* frontend supports 
DVB-S2 multistream filtering */
FE_CAN_TURBO_FEC= 0x800,  /* frontend supports 
turbo fec modulation */
FE_CAN_2G_MODULATION= 0x1000, /* 

Re: [PATCH] DVB-S2 multistream support

2012-08-10 Thread CrazyCat
Stream can be anything :) But for DVB standards this anyway DVBS transport 
stream 188 byte. Most media-bridges can handle only this stream. Specific 
generic-continous DVB-S2/T2/C2 streams require extended bus for passing 
frame-based stream, so this out of V4L DVB.

Now MIS used often for distribution multiple digital terrestial muxes over one 
satellite carrier (implemented in my patch, now i make patches for VDR and 
TVHeadend for MIS). DVB-T2 PLP is same, but i not see any real-life 
implementation (have some tda18712/cxd2820r-based hardware and 
T2/256QAM-in-air, but only one PLP). Don't know anything about ISDB :)

11.08.2012, 04:07, Antti Palosaari cr...@iki.fi:
 #define DTV_ISDBS_TS_ID   42
 #define DTV_DVBT2_PLP_ID  43
  +#define DTV_DVBS2_MIS_ID   43
  It would be better to define it as:

  #define DTV_DVBS2_MIS_ID    DTV_DVBT2_PLP_ID

  Even better, we should instead find a better name that would cover both
  DVB-T2 and DVB-S2 program ID fields, like:
--
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]Omicom S2 PCI support

2012-07-14 Thread CrazyCat
Support for yet another SAA7146-based budget card (very similar to TT S2-1600, 
but use LNBH23 instead ISL6423).
diff --git a/drivers/media/dvb/ttpci/budget.c b/drivers/media/dvb/ttpci/budget.c
index b21bcce..1774c53 100644
--- a/drivers/media/dvb/ttpci/budget.c
+++ b/drivers/media/dvb/ttpci/budget.c
@@ -50,6 +50,8 @@
 #include stv6110x.h
 #include stv090x.h
 #include isl6423.h
+#include lnbh24.h
+
 
 static int diseqc_method;
 module_param(diseqc_method, int, 0444);
@@ -679,6 +681,63 @@ static void frontend_init(struct budget *budget)
}
}
break;
+
+   case 0x1020: { /* Omicom S2 */
+   struct stv6110x_devctl *ctl;
+   saa7146_setgpio(budget-dev, 2, SAA7146_GPIO_OUTLO);
+   msleep(50);
+   saa7146_setgpio(budget-dev, 2, SAA7146_GPIO_OUTHI);
+   msleep(250);
+
+   budget-dvb_frontend = dvb_attach(stv090x_attach,
+ 
tt1600_stv090x_config,
+ budget-i2c_adap,
+ 
STV090x_DEMODULATOR_0);
+
+   if (budget-dvb_frontend) {
+   printk(KERN_INFO budget: Omicom S2 
detected\n);
+
+   ctl = dvb_attach(stv6110x_attach,
+budget-dvb_frontend,
+tt1600_stv6110x_config,
+budget-i2c_adap);
+
+   if (ctl) {
+   tt1600_stv090x_config.tuner_init
  = ctl-tuner_init;
+   tt1600_stv090x_config.tuner_sleep   
  = ctl-tuner_sleep;
+   tt1600_stv090x_config.tuner_set_mode
  = ctl-tuner_set_mode;
+   
tt1600_stv090x_config.tuner_set_frequency = ctl-tuner_set_frequency;
+   
tt1600_stv090x_config.tuner_get_frequency = ctl-tuner_get_frequency;
+   
tt1600_stv090x_config.tuner_set_bandwidth = ctl-tuner_set_bandwidth;
+   
tt1600_stv090x_config.tuner_get_bandwidth = ctl-tuner_get_bandwidth;
+   tt1600_stv090x_config.tuner_set_bbgain  
  = ctl-tuner_set_bbgain;
+   tt1600_stv090x_config.tuner_get_bbgain  
  = ctl-tuner_get_bbgain;
+   tt1600_stv090x_config.tuner_set_refclk  
  = ctl-tuner_set_refclk;
+   tt1600_stv090x_config.tuner_get_status  
  = ctl-tuner_get_status;
+
+   /* call the init function once to 
initialize
+  tuner's clock output divider and 
demod's
+  master clock */
+   if (budget-dvb_frontend-ops.init)
+   
budget-dvb_frontend-ops.init(budget-dvb_frontend);
+
+   if (dvb_attach(lnbh24_attach,
+   budget-dvb_frontend,
+   budget-i2c_adap,
+   LNBH24_PCL | LNBH24_TTX,
+   LNBH24_TEN, 0x141) == 
NULL)
+   {
+   printk(KERN_ERR
+   No LNBH24 found!\n);
+   goto error_out;
+   }
+   } else {
+   printk(KERN_ERR %s: No STV6110(A) 
Silicon Tuner found!\n, __func__);
+   goto error_out;
+   }
+   }
+   }
+   break;
}
 
if (budget-dvb_frontend == NULL) {
@@ -759,6 +818,7 @@ MAKE_BUDGET_INFO(fsacs0, Fujitsu Siemens Activy Budget-S 
PCI (rev GR/grundig fr
 MAKE_BUDGET_INFO(fsacs1, Fujitsu Siemens Activy Budget-S PCI (rev AL/alps 
frontend), BUDGET_FS_ACTIVY);
 MAKE_BUDGET_INFO(fsact, Fujitsu Siemens Activy Budget-T PCI (rev 
GR/Grundig frontend), BUDGET_FS_ACTIVY);
 MAKE_BUDGET_INFO(fsact1, Fujitsu Siemens Activy Budget-T PCI (rev AL/ALPS 
TDHD1-204A), BUDGET_FS_ACTIVY);
+MAKE_BUDGET_INFO(omicom, Omicom S2 PCI, BUDGET_TT);
 
 static struct pci_device_id pci_tbl[] = {
MAKE_EXTENSION_PCI(ttbs,  0x13c2, 0x1003),
@@ -772,6 +832,7 @@ static struct pci_device_id pci_tbl[] = {
MAKE_EXTENSION_PCI(fsacs0,0x1131, 

[PATCH]DVB-S2 multistream support

2012-07-13 Thread CrazyCat
Now present DTV_DVBT2_PLP_ID property for DVB-T2, so i add alias 
DTV_DVBS2_MIS_ID (same feature for advanced DVB-S2). Now DVB-S2 multistream 
filtration supported for current STV090x demod cut 3.0, so i implement support 
for stv090x demod driver. Additional fe-caps FE_CAN_MULTISTREAM also added.

diff --git a/include/linux/dvb/frontend.h b/include/linux/dvb/frontend.h
index f50d405..f625f8d 100644
--- a/include/linux/dvb/frontend.h
+++ b/include/linux/dvb/frontend.h
@@ -62,6 +62,7 @@ typedef enum fe_caps {
FE_CAN_8VSB = 0x20,
FE_CAN_16VSB= 0x40,
FE_HAS_EXTENDED_CAPS= 0x80,   /* We need more bitspace 
for newer APIs, indicate this. */
+   FE_CAN_MULTISTREAM  = 0x400,  /* frontend supports 
DVB-S2 multistream filtering */
FE_CAN_TURBO_FEC= 0x800,  /* frontend supports 
turbo fec modulation */
FE_CAN_2G_MODULATION= 0x1000, /* frontend supports 2nd 
generation modulation (DVB-S2) */
FE_NEEDS_BENDING= 0x2000, /* not supported anymore, 
don't use (frontend requires frequency bending) */
@@ -317,6 +318,7 @@ struct dvb_frontend_event {
 #define DTV_ISDBS_TS_ID42
 
 #define DTV_DVBT2_PLP_ID   43
+#define DTV_DVBS2_MIS_ID   43
 
 #define DTV_ENUM_DELSYS44
 
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c 
b/drivers/media/dvb/dvb-core/dvb_frontend.c
index aebcdf2..83e51f9 100644
--- a/drivers/media/dvb/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb/dvb-core/dvb_frontend.c
@@ -947,7 +947,7 @@ static int dvb_frontend_clear_cache(struct dvb_frontend *fe)
}
 
c-isdbs_ts_id = 0;
-   c-dvbt2_plp_id = 0;
+   c-dvbt2_plp_id = -1;
 
switch (c-delivery_system) {
case SYS_DVBS:
diff --git a/drivers/media/dvb/frontends/stv090x.c 
b/drivers/media/dvb/frontends/stv090x.c
index ea86a56..eb6f1cf 100644
--- a/drivers/media/dvb/frontends/stv090x.c
+++ b/drivers/media/dvb/frontends/stv090x.c
@@ -3425,6 +3425,33 @@ err:
return -1;
 }
 
+static int stv090x_set_mis(struct stv090x_state *state, int mis)
+{
+   u32 reg;
+
+   if (mis0 || mis255) {
+   dprintk(FE_DEBUG, 1, Disable MIS filtering);
+   reg = STV090x_READ_DEMOD(state, PDELCTRL1);
+   STV090x_SETFIELD_Px(reg, FILTER_EN_FIELD, 0x00);
+   if (STV090x_WRITE_DEMOD(state, PDELCTRL1, reg)  0)
+   goto err;
+   } else {
+   dprintk(FE_DEBUG, 1, Enable MIS filtering - %d, mis);
+   reg = STV090x_READ_DEMOD(state, PDELCTRL1);
+   STV090x_SETFIELD_Px(reg, FILTER_EN_FIELD, 0x01);
+   if (STV090x_WRITE_DEMOD(state, PDELCTRL1, reg)  0)
+   goto err;
+   if (STV090x_WRITE_DEMOD(state, ISIENTRY, mis)  0)
+   goto err;
+   if (STV090x_WRITE_DEMOD(state, ISIBITENA, 0xff)  0)
+   goto err;
+   }
+   return 0;
+err:
+   dprintk(FE_ERROR, 1, I/O error);
+   return -1;
+}
+
 static enum dvbfe_search stv090x_search(struct dvb_frontend *fe)
 {
struct stv090x_state *state = fe-demodulator_priv;
@@ -3433,6 +3460,8 @@ static enum dvbfe_search stv090x_search(struct 
dvb_frontend *fe)
if (props-frequency == 0)
return DVBFE_ALGO_SEARCH_INVALID;
 
+   stv090x_set_mis(state,props-dvbt2_plp_id);
+
state-delsys = props-delivery_system;
state-frequency = props-frequency;
state-srate = props-symbol_rate;
@@ -3447,6 +3476,8 @@ static enum dvbfe_search stv090x_search(struct 
dvb_frontend *fe)
state-search_range = 500;
}
 
+   stv090x_set_mis(state,props-dvbt2_plp_id);
+
if (stv090x_algo(state) == STV090x_RANGEOK) {
dprintk(FE_DEBUG, 1, Search success!);
return DVBFE_ALGO_SEARCH_SUCCESS;
@@ -4798,6 +4829,9 @@ struct dvb_frontend *stv090x_attach(const struct 
stv090x_config *config,
}
}
 
+   if (state-internal-dev_ver=0x30)
+   state-frontend.ops.info.caps |= FE_CAN_MULTISTREAM;
+
/* workaround for stuck DiSEqC output */
if (config-diseqc_envelope_mode)
stv090x_send_diseqc_burst(state-frontend, SEC_MINI_A);


--
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] DVB-S2 multistream support

2012-07-13 Thread CrazyCat
Now present DTV_DVBT2_PLP_ID property for DVB-T2, so i add alias 
DTV_DVBS2_MIS_ID (same feature for advanced DVB-S2). Now DVB-S2 multistream 
filtration supported for current STV090x demod cut 3.0, so i implement support 
for stv090x demod driver. Additional fe-caps FE_CAN_MULTISTREAM also added.
diff --git a/include/linux/dvb/frontend.h b/include/linux/dvb/frontend.h
index f50d405..f625f8d 100644
--- a/include/linux/dvb/frontend.h
+++ b/include/linux/dvb/frontend.h
@@ -62,6 +62,7 @@ typedef enum fe_caps {
 	FE_CAN_8VSB			= 0x20,
 	FE_CAN_16VSB			= 0x40,
 	FE_HAS_EXTENDED_CAPS		= 0x80,   /* We need more bitspace for newer APIs, indicate this. */
+	FE_CAN_MULTISTREAM		= 0x400,  /* frontend supports DVB-S2 multistream filtering */
 	FE_CAN_TURBO_FEC		= 0x800,  /* frontend supports turbo fec modulation */
 	FE_CAN_2G_MODULATION		= 0x1000, /* frontend supports 2nd generation modulation (DVB-S2) */
 	FE_NEEDS_BENDING		= 0x2000, /* not supported anymore, don't use (frontend requires frequency bending) */
@@ -317,6 +318,7 @@ struct dvb_frontend_event {
 #define DTV_ISDBS_TS_ID		42
 
 #define DTV_DVBT2_PLP_ID	43
+#define DTV_DVBS2_MIS_ID	43
 
 #define DTV_ENUM_DELSYS		44
 
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c
index aebcdf2..83e51f9 100644
--- a/drivers/media/dvb/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb/dvb-core/dvb_frontend.c
@@ -947,7 +947,7 @@ static int dvb_frontend_clear_cache(struct dvb_frontend *fe)
 	}
 
 	c-isdbs_ts_id = 0;
-	c-dvbt2_plp_id = 0;
+	c-dvbt2_plp_id = -1;
 
 	switch (c-delivery_system) {
 	case SYS_DVBS:
diff --git a/drivers/media/dvb/frontends/stv090x.c b/drivers/media/dvb/frontends/stv090x.c
index ea86a56..eb6f1cf 100644
--- a/drivers/media/dvb/frontends/stv090x.c
+++ b/drivers/media/dvb/frontends/stv090x.c
@@ -3425,6 +3425,33 @@ err:
 	return -1;
 }
 
+static int stv090x_set_mis(struct stv090x_state *state, int mis)
+{
+	u32 reg;
+
+	if (mis0 || mis255) {
+		dprintk(FE_DEBUG, 1, Disable MIS filtering);
+		reg = STV090x_READ_DEMOD(state, PDELCTRL1);
+		STV090x_SETFIELD_Px(reg, FILTER_EN_FIELD, 0x00);
+		if (STV090x_WRITE_DEMOD(state, PDELCTRL1, reg)  0)
+			goto err;
+	} else {
+		dprintk(FE_DEBUG, 1, Enable MIS filtering - %d, mis);
+		reg = STV090x_READ_DEMOD(state, PDELCTRL1);
+		STV090x_SETFIELD_Px(reg, FILTER_EN_FIELD, 0x01);
+		if (STV090x_WRITE_DEMOD(state, PDELCTRL1, reg)  0)
+			goto err;
+		if (STV090x_WRITE_DEMOD(state, ISIENTRY, mis)  0)
+			goto err;
+		if (STV090x_WRITE_DEMOD(state, ISIBITENA, 0xff)  0)
+			goto err;
+	}
+	return 0;
+err:
+	dprintk(FE_ERROR, 1, I/O error);
+	return -1;
+}
+
 static enum dvbfe_search stv090x_search(struct dvb_frontend *fe)
 {
 	struct stv090x_state *state = fe-demodulator_priv;
@@ -3433,6 +3460,8 @@ static enum dvbfe_search stv090x_search(struct dvb_frontend *fe)
 	if (props-frequency == 0)
 		return DVBFE_ALGO_SEARCH_INVALID;
 
+	stv090x_set_mis(state,props-dvbt2_plp_id);
+
 	state-delsys = props-delivery_system;
 	state-frequency = props-frequency;
 	state-srate = props-symbol_rate;
@@ -3447,6 +3476,8 @@ static enum dvbfe_search stv090x_search(struct dvb_frontend *fe)
 		state-search_range = 500;
 	}
 
+	stv090x_set_mis(state,props-dvbt2_plp_id);
+
 	if (stv090x_algo(state) == STV090x_RANGEOK) {
 		dprintk(FE_DEBUG, 1, Search success!);
 		return DVBFE_ALGO_SEARCH_SUCCESS;
@@ -4798,6 +4829,9 @@ struct dvb_frontend *stv090x_attach(const struct stv090x_config *config,
 		}
 	}
 
+	if (state-internal-dev_ver=0x30)
+	state-frontend.ops.info.caps |= FE_CAN_MULTISTREAM;
+
 	/* workaround for stuck DiSEqC output */
 	if (config-diseqc_envelope_mode)
 		stv090x_send_diseqc_burst(state-frontend, SEC_MINI_A);