All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] si2168: add support for newer firmwares
@ 2016-06-29 23:38 Antti Palosaari
  2016-06-29 23:38 ` [PATCH 2/3] si2168: do not allow driver unbind Antti Palosaari
  2016-06-29 23:38 ` [PATCH 3/3] si2157: " Antti Palosaari
  0 siblings, 2 replies; 10+ messages in thread
From: Antti Palosaari @ 2016-06-29 23:38 UTC (permalink / raw)
  To: linux-media; +Cc: Antti Palosaari, Olli Salonen

Si2168-B40 firmware API has changed somewhere between 4.0-11 and
4.0-19 so that sleep will lose firmware upgrade from the chip. Due
to that firmware re-upload is needed when newer firmwares are used.

Rewrote firmware handling logic partly at the same.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Cc: Olli Salonen <olli.salonen@iki.fi>
---
 drivers/media/dvb-frontends/si2168.c      | 124 ++++++++++++++++++------------
 drivers/media/dvb-frontends/si2168_priv.h |   8 +-
 2 files changed, 80 insertions(+), 52 deletions(-)

diff --git a/drivers/media/dvb-frontends/si2168.c b/drivers/media/dvb-frontends/si2168.c
index 108a069..124addc 100644
--- a/drivers/media/dvb-frontends/si2168.c
+++ b/drivers/media/dvb-frontends/si2168.c
@@ -357,9 +357,7 @@ static int si2168_init(struct dvb_frontend *fe)
 	struct si2168_dev *dev = i2c_get_clientdata(client);
 	int ret, len, remaining;
 	const struct firmware *fw;
-	const char *fw_name;
 	struct si2168_cmd cmd;
-	unsigned int chip_id;
 
 	dev_dbg(&client->dev, "\n");
 
@@ -371,7 +369,7 @@ static int si2168_init(struct dvb_frontend *fe)
 	if (ret)
 		goto err;
 
-	if (dev->fw_loaded) {
+	if (dev->warm) {
 		/* resume */
 		memcpy(cmd.args, "\xc0\x06\x08\x0f\x00\x20\x21\x01", 8);
 		cmd.wlen = 8;
@@ -398,49 +396,14 @@ static int si2168_init(struct dvb_frontend *fe)
 	if (ret)
 		goto err;
 
-	/* query chip revision */
-	memcpy(cmd.args, "\x02", 1);
-	cmd.wlen = 1;
-	cmd.rlen = 13;
-	ret = si2168_cmd_execute(client, &cmd);
-	if (ret)
-		goto err;
-
-	chip_id = cmd.args[1] << 24 | cmd.args[2] << 16 | cmd.args[3] << 8 |
-			cmd.args[4] << 0;
-
-	#define SI2168_A20 ('A' << 24 | 68 << 16 | '2' << 8 | '0' << 0)
-	#define SI2168_A30 ('A' << 24 | 68 << 16 | '3' << 8 | '0' << 0)
-	#define SI2168_B40 ('B' << 24 | 68 << 16 | '4' << 8 | '0' << 0)
-
-	switch (chip_id) {
-	case SI2168_A20:
-		fw_name = SI2168_A20_FIRMWARE;
-		break;
-	case SI2168_A30:
-		fw_name = SI2168_A30_FIRMWARE;
-		break;
-	case SI2168_B40:
-		fw_name = SI2168_B40_FIRMWARE;
-		break;
-	default:
-		dev_err(&client->dev, "unknown chip version Si21%d-%c%c%c\n",
-				cmd.args[2], cmd.args[1],
-				cmd.args[3], cmd.args[4]);
-		ret = -EINVAL;
-		goto err;
-	}
-
-	dev_info(&client->dev, "found a 'Silicon Labs Si21%d-%c%c%c'\n",
-			cmd.args[2], cmd.args[1], cmd.args[3], cmd.args[4]);
-
 	/* request the firmware, this will block and timeout */
-	ret = request_firmware(&fw, fw_name, &client->dev);
+	ret = request_firmware(&fw, dev->firmware_name, &client->dev);
 	if (ret) {
 		/* fallback mechanism to handle old name for Si2168 B40 fw */
-		if (chip_id == SI2168_B40) {
-			fw_name = SI2168_B40_FIRMWARE_FALLBACK;
-			ret = request_firmware(&fw, fw_name, &client->dev);
+		if (dev->chip_id == SI2168_CHIP_ID_B40) {
+			dev->firmware_name = SI2168_B40_FIRMWARE_FALLBACK;
+			ret = request_firmware(&fw, dev->firmware_name,
+					       &client->dev);
 		}
 
 		if (ret == 0) {
@@ -450,13 +413,13 @@ static int si2168_init(struct dvb_frontend *fe)
 		} else {
 			dev_err(&client->dev,
 					"firmware file '%s' not found\n",
-					fw_name);
+					dev->firmware_name);
 			goto err_release_firmware;
 		}
 	}
 
 	dev_info(&client->dev, "downloading firmware from file '%s'\n",
-			fw_name);
+			dev->firmware_name);
 
 	if ((fw->size % 17 == 0) && (fw->data[0] > 5)) {
 		/* firmware is in the new format */
@@ -511,8 +474,11 @@ static int si2168_init(struct dvb_frontend *fe)
 	if (ret)
 		goto err;
 
-	dev_info(&client->dev, "firmware version: %c.%c.%d\n",
-			cmd.args[6], cmd.args[7], cmd.args[8]);
+	dev->version = (cmd.args[9] + '@') << 24 | (cmd.args[6] - '0') << 16 |
+		       (cmd.args[7] - '0') << 8 | (cmd.args[8]) << 0;
+	dev_info(&client->dev, "firmware version: %c %d.%d.%d\n",
+		 dev->version >> 24 & 0xff, dev->version >> 16 & 0xff,
+		 dev->version >> 8 & 0xff, dev->version >> 0 & 0xff);
 
 	/* set ts mode */
 	memcpy(cmd.args, "\x14\x00\x01\x10\x10\x00", 6);
@@ -525,7 +491,7 @@ static int si2168_init(struct dvb_frontend *fe)
 	if (ret)
 		goto err;
 
-	dev->fw_loaded = true;
+	dev->warm = true;
 warm:
 	dev->active = true;
 
@@ -549,6 +515,10 @@ static int si2168_sleep(struct dvb_frontend *fe)
 
 	dev->active = false;
 
+	/* Firmware B 4.0-11 or later loses warm state during sleep */
+	if (dev->version > ('B' << 24 | 4 << 16 | 0 << 8 | 11 << 0))
+		dev->warm = false;
+
 	memcpy(cmd.args, "\x13", 1);
 	cmd.wlen = 1;
 	cmd.rlen = 0;
@@ -653,6 +623,7 @@ static int si2168_probe(struct i2c_client *client,
 	struct si2168_config *config = client->dev.platform_data;
 	struct si2168_dev *dev;
 	int ret;
+	struct si2168_cmd cmd;
 
 	dev_dbg(&client->dev, "\n");
 
@@ -663,8 +634,56 @@ static int si2168_probe(struct i2c_client *client,
 		goto err;
 	}
 
+	i2c_set_clientdata(client, dev);
 	mutex_init(&dev->i2c_mutex);
 
+	/* Initialize */
+	memcpy(cmd.args, "\xc0\x12\x00\x0c\x00\x0d\x16\x00\x00\x00\x00\x00\x00", 13);
+	cmd.wlen = 13;
+	cmd.rlen = 0;
+	ret = si2168_cmd_execute(client, &cmd);
+	if (ret)
+		goto err_kfree;
+
+	/* Power up */
+	memcpy(cmd.args, "\xc0\x06\x01\x0f\x00\x20\x20\x01", 8);
+	cmd.wlen = 8;
+	cmd.rlen = 1;
+	ret = si2168_cmd_execute(client, &cmd);
+	if (ret)
+		goto err_kfree;
+
+	/* Query chip revision */
+	memcpy(cmd.args, "\x02", 1);
+	cmd.wlen = 1;
+	cmd.rlen = 13;
+	ret = si2168_cmd_execute(client, &cmd);
+	if (ret)
+		goto err_kfree;
+
+	dev->chip_id = cmd.args[1] << 24 | cmd.args[2] << 16 |
+		       cmd.args[3] << 8 | cmd.args[4] << 0;
+
+	switch (dev->chip_id) {
+	case SI2168_CHIP_ID_A20:
+		dev->firmware_name = SI2168_A20_FIRMWARE;
+		break;
+	case SI2168_CHIP_ID_A30:
+		dev->firmware_name = SI2168_A30_FIRMWARE;
+		break;
+	case SI2168_CHIP_ID_B40:
+		dev->firmware_name = SI2168_B40_FIRMWARE;
+		break;
+	default:
+		dev_dbg(&client->dev, "unknown chip version Si21%d-%c%c%c\n",
+			cmd.args[2], cmd.args[1], cmd.args[3], cmd.args[4]);
+		ret = -ENODEV;
+		goto err_kfree;
+	}
+
+	dev->version = (cmd.args[1]) << 24 | (cmd.args[3] - '0') << 16 |
+		       (cmd.args[4] - '0') << 8 | (cmd.args[5]) << 0;
+
 	/* create mux i2c adapter for tuner */
 	dev->muxc = i2c_mux_alloc(client->adapter, &client->dev,
 				  1, 0, I2C_MUX_LOCKED,
@@ -686,11 +705,14 @@ static int si2168_probe(struct i2c_client *client,
 	dev->ts_mode = config->ts_mode;
 	dev->ts_clock_inv = config->ts_clock_inv;
 	dev->ts_clock_gapped = config->ts_clock_gapped;
-	dev->fw_loaded = false;
 
-	i2c_set_clientdata(client, dev);
+	dev_info(&client->dev, "Silicon Labs Si2168-%c%d%d successfully identified\n",
+		 dev->version >> 24 & 0xff, dev->version >> 16 & 0xff,
+		 dev->version >> 8 & 0xff);
+	dev_info(&client->dev, "firmware version: %c %d.%d.%d\n",
+		 dev->version >> 24 & 0xff, dev->version >> 16 & 0xff,
+		 dev->version >> 8 & 0xff, dev->version >> 0 & 0xff);
 
-	dev_info(&client->dev, "Silicon Labs Si2168 successfully attached\n");
 	return 0;
 err_kfree:
 	kfree(dev);
diff --git a/drivers/media/dvb-frontends/si2168_priv.h b/drivers/media/dvb-frontends/si2168_priv.h
index 8a1f36d..7843ccb 100644
--- a/drivers/media/dvb-frontends/si2168_priv.h
+++ b/drivers/media/dvb-frontends/si2168_priv.h
@@ -34,8 +34,14 @@ struct si2168_dev {
 	struct dvb_frontend fe;
 	enum fe_delivery_system delivery_system;
 	enum fe_status fe_status;
+	#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)
+	unsigned int chip_id;
+	unsigned int version;
+	const char *firmware_name;
 	bool active;
-	bool fw_loaded;
+	bool warm;
 	u8 ts_mode;
 	bool ts_clock_inv;
 	bool ts_clock_gapped;
-- 
http://palosaari.fi/


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/3] si2168: do not allow driver unbind
  2016-06-29 23:38 [PATCH 1/3] si2168: add support for newer firmwares Antti Palosaari
@ 2016-06-29 23:38 ` Antti Palosaari
  2016-06-29 23:38 ` [PATCH 3/3] si2157: " Antti Palosaari
  1 sibling, 0 replies; 10+ messages in thread
From: Antti Palosaari @ 2016-06-29 23:38 UTC (permalink / raw)
  To: linux-media; +Cc: Antti Palosaari

Disable runtime unbind as driver does not support it.

Signed-off-by: Antti Palosaari <crope@iki.fi>
---
 drivers/media/dvb-frontends/si2168.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/media/dvb-frontends/si2168.c b/drivers/media/dvb-frontends/si2168.c
index 124addc..20b4a65 100644
--- a/drivers/media/dvb-frontends/si2168.c
+++ b/drivers/media/dvb-frontends/si2168.c
@@ -745,7 +745,8 @@ MODULE_DEVICE_TABLE(i2c, si2168_id_table);
 
 static struct i2c_driver si2168_driver = {
 	.driver = {
-		.name	= "si2168",
+		.name                = "si2168",
+		.suppress_bind_attrs = true,
 	},
 	.probe		= si2168_probe,
 	.remove		= si2168_remove,
-- 
http://palosaari.fi/


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 3/3] si2157: do not allow driver unbind
  2016-06-29 23:38 [PATCH 1/3] si2168: add support for newer firmwares Antti Palosaari
  2016-06-29 23:38 ` [PATCH 2/3] si2168: do not allow driver unbind Antti Palosaari
@ 2016-06-29 23:38 ` Antti Palosaari
       [not found]   ` <577AAD3C.2060204@kaa.org.ua>
  1 sibling, 1 reply; 10+ messages in thread
From: Antti Palosaari @ 2016-06-29 23:38 UTC (permalink / raw)
  To: linux-media; +Cc: Antti Palosaari

Disable runtime unbind as driver does not support it.

Signed-off-by: Antti Palosaari <crope@iki.fi>
---
 drivers/media/tuners/si2157.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/media/tuners/si2157.c b/drivers/media/tuners/si2157.c
index b07a681..57b2508 100644
--- a/drivers/media/tuners/si2157.c
+++ b/drivers/media/tuners/si2157.c
@@ -514,7 +514,8 @@ MODULE_DEVICE_TABLE(i2c, si2157_id_table);
 
 static struct i2c_driver si2157_driver = {
 	.driver = {
-		.name	= "si2157",
+		.name	             = "si2157",
+		.suppress_bind_attrs = true,
 	},
 	.probe		= si2157_probe,
 	.remove		= si2157_remove,
-- 
http://palosaari.fi/


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: si2157: new revision?
       [not found]   ` <577AAD3C.2060204@kaa.org.ua>
@ 2016-07-04 18:47     ` Antti Palosaari
  2016-07-04 18:56       ` Oleh Kravchenko
  2016-07-09 21:18       ` Oleh Kravchenko
  0 siblings, 2 replies; 10+ messages in thread
From: Antti Palosaari @ 2016-07-04 18:47 UTC (permalink / raw)
  To: Oleh Kravchenko, linux-media

Hello
On 07/04/2016 09:38 PM, Oleh Kravchenko wrote:
> Hello Antti!
>
> I started reverse-engineering of my new TV tuner "Evromedia USB Full
> Hybrid Full HD" and discovered that start sequence is different from
> si2157.c:
> i2c_read_C1
>  1 \xFE
> i2c_write_C0
>  15 \xC0\x00\x00\x00\x00\x01\x01\x01\x01\x01\x01\x02\x00\x00\x01
>
> Do you familiar with this revision?
> Should I merge my changes to si2158.c?
> Or define another driver?

According to chip markings those are tuner Si2158-A20 and demod 
Si2168-A30. Both are supported already by si2157 and si2168 drivers.

Difference is just some settings. You need to identify which setting is 
wrong and add that to configuration options. It should be pretty easy to 
find it from the I2C dumps and just testing.

regards
Antti

-- 
http://palosaari.fi/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: si2157: new revision?
  2016-07-04 18:47     ` si2157: new revision? Antti Palosaari
@ 2016-07-04 18:56       ` Oleh Kravchenko
  2016-07-04 19:36         ` Antti Palosaari
  2016-07-09 21:18       ` Oleh Kravchenko
  1 sibling, 1 reply; 10+ messages in thread
From: Oleh Kravchenko @ 2016-07-04 18:56 UTC (permalink / raw)
  To: Antti Palosaari, linux-media

Thank you for your reply!

What about Analog TV support? Do you plan to implement it?

On 04.07.16 21:47, Antti Palosaari wrote:
> Hello
> On 07/04/2016 09:38 PM, Oleh Kravchenko wrote:
>> Hello Antti!
>>
>> I started reverse-engineering of my new TV tuner "Evromedia USB Full
>> Hybrid Full HD" and discovered that start sequence is different from
>> si2157.c:
>> i2c_read_C1
>>  1 \xFE
>> i2c_write_C0
>>  15 \xC0\x00\x00\x00\x00\x01\x01\x01\x01\x01\x01\x02\x00\x00\x01
>>
>> Do you familiar with this revision?
>> Should I merge my changes to si2158.c?
>> Or define another driver?
> 
> According to chip markings those are tuner Si2158-A20 and demod
> Si2168-A30. Both are supported already by si2157 and si2168 drivers.
> 
> Difference is just some settings. You need to identify which setting is
> wrong and add that to configuration options. It should be pretty easy to
> find it from the I2C dumps and just testing.
> 
> regards
> Antti
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: si2157: new revision?
  2016-07-04 18:56       ` Oleh Kravchenko
@ 2016-07-04 19:36         ` Antti Palosaari
  0 siblings, 0 replies; 10+ messages in thread
From: Antti Palosaari @ 2016-07-04 19:36 UTC (permalink / raw)
  To: Oleh Kravchenko, linux-media

I am not interested at all about analog support. Analog transmissions 
are ran down many, many years ago here.

regards
Antti


On 07/04/2016 09:56 PM, Oleh Kravchenko wrote:
> Thank you for your reply!
>
> What about Analog TV support? Do you plan to implement it?
>
> On 04.07.16 21:47, Antti Palosaari wrote:
>> Hello
>> On 07/04/2016 09:38 PM, Oleh Kravchenko wrote:
>>> Hello Antti!
>>>
>>> I started reverse-engineering of my new TV tuner "Evromedia USB Full
>>> Hybrid Full HD" and discovered that start sequence is different from
>>> si2157.c:
>>> i2c_read_C1
>>>  1 \xFE
>>> i2c_write_C0
>>>  15 \xC0\x00\x00\x00\x00\x01\x01\x01\x01\x01\x01\x02\x00\x00\x01
>>>
>>> Do you familiar with this revision?
>>> Should I merge my changes to si2158.c?
>>> Or define another driver?
>>
>> According to chip markings those are tuner Si2158-A20 and demod
>> Si2168-A30. Both are supported already by si2157 and si2168 drivers.
>>
>> Difference is just some settings. You need to identify which setting is
>> wrong and add that to configuration options. It should be pretty easy to
>> find it from the I2C dumps and just testing.
>>
>> regards
>> Antti
>>

-- 
http://palosaari.fi/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: si2157: new revision?
  2016-07-04 18:47     ` si2157: new revision? Antti Palosaari
  2016-07-04 18:56       ` Oleh Kravchenko
@ 2016-07-09 21:18       ` Oleh Kravchenko
  2016-07-09 22:34         ` Antti Palosaari
  1 sibling, 1 reply; 10+ messages in thread
From: Oleh Kravchenko @ 2016-07-09 21:18 UTC (permalink / raw)
  To: Antti Palosaari, linux-media

Hello!

I'm started playing i2c, but stuck with unknown error for me - 32 (EPIPE?):
	[ 5651.958763] cx231xx #0 at cx231xx_i2c_xfer: write stop addr=0x60
len=15: c0 00 00 00 00 01 01 01 01 01 01 02 00 00 01
	[ 5651.958774] cx231xx #0: (pipe 0x80001000): OUT:  40 02 21 c0 00 00
0f 00
	[ 5651.958775] >>> c0 00 00 00 00 01 01 01 01 01 01 02 00 00 01FAILED!
	[ 5651.959110] cx231xx 1-2:1.1: cx231xx_send_usb_command: failed with
status --32
	[ 5651.959111] cx231xx #0 at cx231xx_i2c_xfer:  ERROR: -32

How this error can be fixed? :)

On 04.07.16 21:47, Antti Palosaari wrote:
> Hello
> On 07/04/2016 09:38 PM, Oleh Kravchenko wrote:
>> Hello Antti!
>>
>> I started reverse-engineering of my new TV tuner "Evromedia USB Full
>> Hybrid Full HD" and discovered that start sequence is different from
>> si2157.c:
>> i2c_read_C1
>>  1 \xFE
>> i2c_write_C0
>>  15 \xC0\x00\x00\x00\x00\x01\x01\x01\x01\x01\x01\x02\x00\x00\x01
>>
>> Do you familiar with this revision?
>> Should I merge my changes to si2158.c?
>> Or define another driver?
> 
> According to chip markings those are tuner Si2158-A20 and demod
> Si2168-A30. Both are supported already by si2157 and si2168 drivers.
> 
> Difference is just some settings. You need to identify which setting is
> wrong and add that to configuration options. It should be pretty easy to
> find it from the I2C dumps and just testing.
> 
> regards
> Antti
> 


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: si2157: new revision?
  2016-07-09 21:18       ` Oleh Kravchenko
@ 2016-07-09 22:34         ` Antti Palosaari
  2016-07-13  8:22           ` Oleh Kravchenko
  0 siblings, 1 reply; 10+ messages in thread
From: Antti Palosaari @ 2016-07-09 22:34 UTC (permalink / raw)
  To: Oleh Kravchenko, linux-media

Hey, that's your problem :] Driver development is all the time resolving 
this kind of issues and you really need to resolve those yourself.

You will need to get I2C communication working with all the chips. First 
si2168 demod and after it answers to I2C you will need to get connection 
to Si2157 tuner. After both of those are answering you could try to get 
tuning tests to see if demod locks. After demod locks you know tuner is 
working and also demod is somehow working. If demod lock but there is no 
picture you know problem is TS interface. Try different TS settings for 
both USB-bridge and demod - those should match. If it does not starts 
working then you have to look sniffs and start replacing driver code 
with data from sniffs to until it starts working => problematic setting 
is found.

regards
Antti



On 07/10/2016 12:18 AM, Oleh Kravchenko wrote:
> Hello!
>
> I'm started playing i2c, but stuck with unknown error for me - 32 (EPIPE?):
> 	[ 5651.958763] cx231xx #0 at cx231xx_i2c_xfer: write stop addr=0x60
> len=15: c0 00 00 00 00 01 01 01 01 01 01 02 00 00 01
> 	[ 5651.958774] cx231xx #0: (pipe 0x80001000): OUT:  40 02 21 c0 00 00
> 0f 00
> 	[ 5651.958775] >>> c0 00 00 00 00 01 01 01 01 01 01 02 00 00 01FAILED!
> 	[ 5651.959110] cx231xx 1-2:1.1: cx231xx_send_usb_command: failed with
> status --32
> 	[ 5651.959111] cx231xx #0 at cx231xx_i2c_xfer:  ERROR: -32
>
> How this error can be fixed? :)
>
> On 04.07.16 21:47, Antti Palosaari wrote:
>> Hello
>> On 07/04/2016 09:38 PM, Oleh Kravchenko wrote:
>>> Hello Antti!
>>>
>>> I started reverse-engineering of my new TV tuner "Evromedia USB Full
>>> Hybrid Full HD" and discovered that start sequence is different from
>>> si2157.c:
>>> i2c_read_C1
>>>  1 \xFE
>>> i2c_write_C0
>>>  15 \xC0\x00\x00\x00\x00\x01\x01\x01\x01\x01\x01\x02\x00\x00\x01
>>>
>>> Do you familiar with this revision?
>>> Should I merge my changes to si2158.c?
>>> Or define another driver?
>>
>> According to chip markings those are tuner Si2158-A20 and demod
>> Si2168-A30. Both are supported already by si2157 and si2168 drivers.
>>
>> Difference is just some settings. You need to identify which setting is
>> wrong and add that to configuration options. It should be pretty easy to
>> find it from the I2C dumps and just testing.
>>
>> regards
>> Antti
>>
>

-- 
http://palosaari.fi/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: si2157: new revision?
  2016-07-09 22:34         ` Antti Palosaari
@ 2016-07-13  8:22           ` Oleh Kravchenko
  2016-07-18 19:55             ` Oleh Kravchenko
  0 siblings, 1 reply; 10+ messages in thread
From: Oleh Kravchenko @ 2016-07-13  8:22 UTC (permalink / raw)
  To: Antti Palosaari, linux-media

Hello Antti!

Thank you for your advice. I succeed with demod chip!
...
[ 3454.060649] cx231xx #0: (pipe 0x80000b80): IN:  c0 0d 0f 00 74 00 04
00 <<< 6f 03 00 00
[ 3454.060784] cx231xx #0 at cx231xx_i2c_xfer: read stop addr=0x64 len=10:
[ 3454.060793] cx231xx #0: (pipe 0x80000b80): IN:  c0 05 23 c8 00 00 04 00
[ 3454.061392] <<< 80 44 33 30
[ 3454.061403] cx231xx #0: (pipe 0x80000b80): IN:  c0 05 63 c8 00 00 04
00 <<< 0b 73 33 30
[ 3454.061899] cx231xx #0: (pipe 0x80000b80): IN:  c0 05 61 c8 00 00 02
00 <<< 13 01
[ 3454.062278]  80 44 33 30 0b 73 33 30 13 01
[ 3454.062294] si2168 17-0064: firmware version: 3.0.19

But with tuner chip I have only error -32 :(
...
[ 2795.770276] cx231xx #0 at cx231xx_i2c_xfer: read stop addr=0x60 len=1:
[ 2795.770281] cx231xx #0: (pipe 0x80000680): IN:  c0 06 21 c0 00 00 01 00
[ 2795.771045] <<< fe
[ 2795.771048]  fe
[ 2795.771205] cx231xx #0 at cx231xx_i2c_xfer: write stop addr=0x60
len=15: c0 00 00 00 00 01 01 01 01 01 01 02 00 00 01
[ 2795.771234] cx231xx #0: (pipe 0x80000600): OUT:  40 02 21 c0 00 00 0f 00
[ 2795.771235] >>>
[ 2795.771236]  c0
[ 2795.771237]  00 00 00 00 01 01 01 01 01 01 02 00 00 01FAILED!
[ 2795.771886] cx231xx 1-2:1.1: cx231xx_send_usb_command: failed with
status --32
[ 2795.771888] cx231xx #0 at cx231xx_i2c_xfer:  ERROR: -32

But I discovered one thing, error will come - if write payload is bigger
than 4 bytes..
Any ideas, why this happening?
...
[ 3454.143285] cx231xx #0 at cx231xx_i2c_xfer: write stop addr=0x60
len=4: c0 00 00 00
[ 3454.143288] cx231xx #0: (pipe 0x80000b00): OUT:  40 02 21 c0 00 00 04 00
[ 3454.143289] >>> c0 00 00 00
[ 3454.143884] cx231xx #0 at cx231xx_i2c_xfer: read stop addr=0x60 len=1:
[ 3454.143893] cx231xx #0: (pipe 0x80000b80): IN:  c0 06 21 c0 00 00 01 00
[ 3454.144242] <<< fe
[ 3454.144244]  fe
[ 3454.144391] cx231xx #0 at cx231xx_i2c_xfer: write stop addr=0x60
len=1: 02
[ 3454.144406] cx231xx #0: (pipe 0x80000b00): OUT:  40 02 21 c0 00 00 01 00
[ 3454.144406] >>>
[ 3454.144407]  02
[ 3454.144767] cx231xx #0 at cx231xx_i2c_xfer: read stop addr=0x60 len=13:
[ 3454.144767] cx231xx #0: (pipe 0x80000b80): IN:  c0 06 23 c0 00 00 04
00 <<< fe fe fe fe
[ 3454.145397] cx231xx #0: (pipe 0x80000b80): IN:  c0 06 63 c0 00 00 04
00 <<< fe fe fe fe
[ 3454.145893] cx231xx #0: (pipe 0x80000b80): IN:  c0 06 63 c0 00 00 04 00
[ 3454.146377] <<< fe fe fe fe
[ 3454.146394] cx231xx #0: (pipe 0x80000b80): IN:  c0 06 61 c0 00 00 01 00
[ 3454.146639] <<< fe
[ 3454.146640]  fe fe fe fe fe fe fe fe fe fe fe fe fe
[ 3454.146676] si2157 15-0060: unknown chip version
Si21254-\xfffffffe\xfffffffe\xfffffffe


On 10.07.16 01:34, Antti Palosaari wrote:
> Hey, that's your problem :] Driver development is all the time
> resolving this kind of issues and you really need to resolve those
> yourself.
>
> You will need to get I2C communication working with all the chips.
> First si2168 demod and after it answers to I2C you will need to get
> connection to Si2157 tuner. After both of those are answering you
> could try to get tuning tests to see if demod locks. After demod locks
> you know tuner is working and also demod is somehow working. If demod
> lock but there is no picture you know problem is TS interface. Try
> different TS settings for both USB-bridge and demod - those should
> match. If it does not starts working then you have to look sniffs and
> start replacing driver code with data from sniffs to until it starts
> working => problematic setting is found.
>
> regards
> Antti
>
>
>
> On 07/10/2016 12:18 AM, Oleh Kravchenko wrote:
>> Hello!
>>
>> I'm started playing i2c, but stuck with unknown error for me - 32
>> (EPIPE?):
>>     [ 5651.958763] cx231xx #0 at cx231xx_i2c_xfer: write stop addr=0x60
>> len=15: c0 00 00 00 00 01 01 01 01 01 01 02 00 00 01
>>     [ 5651.958774] cx231xx #0: (pipe 0x80001000): OUT:  40 02 21 c0
>> 00 00
>> 0f 00
>>     [ 5651.958775] >>> c0 00 00 00 00 01 01 01 01 01 01 02 00 00
>> 01FAILED!
>>     [ 5651.959110] cx231xx 1-2:1.1: cx231xx_send_usb_command: failed
>> with
>> status --32
>>     [ 5651.959111] cx231xx #0 at cx231xx_i2c_xfer:  ERROR: -32
>>
>> How this error can be fixed? :)
>>
>> On 04.07.16 21:47, Antti Palosaari wrote:
>>> Hello
>>> On 07/04/2016 09:38 PM, Oleh Kravchenko wrote:
>>>> Hello Antti!
>>>>
>>>> I started reverse-engineering of my new TV tuner "Evromedia USB Full
>>>> Hybrid Full HD" and discovered that start sequence is different from
>>>> si2157.c:
>>>> i2c_read_C1
>>>>  1 \xFE
>>>> i2c_write_C0
>>>>  15 \xC0\x00\x00\x00\x00\x01\x01\x01\x01\x01\x01\x02\x00\x00\x01
>>>>
>>>> Do you familiar with this revision?
>>>> Should I merge my changes to si2158.c?
>>>> Or define another driver?
>>>
>>> According to chip markings those are tuner Si2158-A20 and demod
>>> Si2168-A30. Both are supported already by si2157 and si2168 drivers.
>>>
>>> Difference is just some settings. You need to identify which setting is
>>> wrong and add that to configuration options. It should be pretty
>>> easy to
>>> find it from the I2C dumps and just testing.
>>>
>>> regards
>>> Antti
>>>
>>
>



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: si2157: new revision?
  2016-07-13  8:22           ` Oleh Kravchenko
@ 2016-07-18 19:55             ` Oleh Kravchenko
  0 siblings, 0 replies; 10+ messages in thread
From: Oleh Kravchenko @ 2016-07-18 19:55 UTC (permalink / raw)
  To: Antti Palosaari, linux-media

Hello Antii!

I succeed with my tuner Evromedia USB Full Hybrid Full HD!!
$ w_scan -ft -c UA -M
...
tune to: QAM_AUTO f = 474000 kHz I999B8C999D999T999G999Y999 (0:1:43)
(time: 02:59.095)
        service = 5 KANAL (Scopus Network Technologies)
        service = NEWS ONE (News One)
        service = EU MUSIC (EU MUSIC)
        service = OTV (SPACECOM)
        service = ICTV (ICTV)
        service = SONCE (SOLAR MEDIA)

(time: 03:12.851) dumping lists (6 services)

MPlayer and VLC play video and sound, but it's very broken (ugly):
$ mplayer dvb://ICTV
...
[mpeg2video @ 0x7fbec7ae2900]00 motion_type at 43 1
[mpeg2video @ 0x7fbec7ae2900]00 motion_type at 1 4
[mpeg2video @ 0x7fbec7ae2900]00 motion_type at 33 8
[mpeg2video @ 0x7fbec7ae2900]00 motion_type at 27 9
[mpeg2video @ 0x7fbec7ae2900]00 motion_type at 21 13
[mpeg2video @ 0x7fbec7ae2900]00 motion_type at 14 17
[mpeg2video @ 0x7fbec7ae2900]00 motion_type at 23 25
[mpeg2video @ 0x7fbec7ae2900]00 motion_type at 16 27
[mpeg2video @ 0x7fbec7ae2900]ac-tex damaged at 11 31
[mpeg2video @ 0x7fbec7ae2900]slice mismatch
[mpeg2video @ 0x7fbec7ae2900]Warning MVs not available
[mpeg2video @ 0x7fbec7ae2900]concealing 599 DC, 599 AC, 599 MV errors in
B frame

Why happens?

On 13.07.16 11:22, Oleh Kravchenko wrote:
> Hello Antti!
> 
> Thank you for your advice. I succeed with demod chip!
> ...
> [ 3454.060649] cx231xx #0: (pipe 0x80000b80): IN:  c0 0d 0f 00 74 00 04
> 00 <<< 6f 03 00 00
> [ 3454.060784] cx231xx #0 at cx231xx_i2c_xfer: read stop addr=0x64 len=10:
> [ 3454.060793] cx231xx #0: (pipe 0x80000b80): IN:  c0 05 23 c8 00 00 04 00
> [ 3454.061392] <<< 80 44 33 30
> [ 3454.061403] cx231xx #0: (pipe 0x80000b80): IN:  c0 05 63 c8 00 00 04
> 00 <<< 0b 73 33 30
> [ 3454.061899] cx231xx #0: (pipe 0x80000b80): IN:  c0 05 61 c8 00 00 02
> 00 <<< 13 01
> [ 3454.062278]  80 44 33 30 0b 73 33 30 13 01
> [ 3454.062294] si2168 17-0064: firmware version: 3.0.19
> 
> But with tuner chip I have only error -32 :(
> ...
> [ 2795.770276] cx231xx #0 at cx231xx_i2c_xfer: read stop addr=0x60 len=1:
> [ 2795.770281] cx231xx #0: (pipe 0x80000680): IN:  c0 06 21 c0 00 00 01 00
> [ 2795.771045] <<< fe
> [ 2795.771048]  fe
> [ 2795.771205] cx231xx #0 at cx231xx_i2c_xfer: write stop addr=0x60
> len=15: c0 00 00 00 00 01 01 01 01 01 01 02 00 00 01
> [ 2795.771234] cx231xx #0: (pipe 0x80000600): OUT:  40 02 21 c0 00 00 0f 00
> [ 2795.771235] >>>
> [ 2795.771236]  c0
> [ 2795.771237]  00 00 00 00 01 01 01 01 01 01 02 00 00 01FAILED!
> [ 2795.771886] cx231xx 1-2:1.1: cx231xx_send_usb_command: failed with
> status --32
> [ 2795.771888] cx231xx #0 at cx231xx_i2c_xfer:  ERROR: -32
> 
> But I discovered one thing, error will come - if write payload is bigger
> than 4 bytes..
> Any ideas, why this happening?
> ...
> [ 3454.143285] cx231xx #0 at cx231xx_i2c_xfer: write stop addr=0x60
> len=4: c0 00 00 00
> [ 3454.143288] cx231xx #0: (pipe 0x80000b00): OUT:  40 02 21 c0 00 00 04 00
> [ 3454.143289] >>> c0 00 00 00
> [ 3454.143884] cx231xx #0 at cx231xx_i2c_xfer: read stop addr=0x60 len=1:
> [ 3454.143893] cx231xx #0: (pipe 0x80000b80): IN:  c0 06 21 c0 00 00 01 00
> [ 3454.144242] <<< fe
> [ 3454.144244]  fe
> [ 3454.144391] cx231xx #0 at cx231xx_i2c_xfer: write stop addr=0x60
> len=1: 02
> [ 3454.144406] cx231xx #0: (pipe 0x80000b00): OUT:  40 02 21 c0 00 00 01 00
> [ 3454.144406] >>>
> [ 3454.144407]  02
> [ 3454.144767] cx231xx #0 at cx231xx_i2c_xfer: read stop addr=0x60 len=13:
> [ 3454.144767] cx231xx #0: (pipe 0x80000b80): IN:  c0 06 23 c0 00 00 04
> 00 <<< fe fe fe fe
> [ 3454.145397] cx231xx #0: (pipe 0x80000b80): IN:  c0 06 63 c0 00 00 04
> 00 <<< fe fe fe fe
> [ 3454.145893] cx231xx #0: (pipe 0x80000b80): IN:  c0 06 63 c0 00 00 04 00
> [ 3454.146377] <<< fe fe fe fe
> [ 3454.146394] cx231xx #0: (pipe 0x80000b80): IN:  c0 06 61 c0 00 00 01 00
> [ 3454.146639] <<< fe
> [ 3454.146640]  fe fe fe fe fe fe fe fe fe fe fe fe fe
> [ 3454.146676] si2157 15-0060: unknown chip version
> Si21254-\xfffffffe\xfffffffe\xfffffffe
> 
> 
> On 10.07.16 01:34, Antti Palosaari wrote:
>> Hey, that's your problem :] Driver development is all the time
>> resolving this kind of issues and you really need to resolve those
>> yourself.
>>
>> You will need to get I2C communication working with all the chips.
>> First si2168 demod and after it answers to I2C you will need to get
>> connection to Si2157 tuner. After both of those are answering you
>> could try to get tuning tests to see if demod locks. After demod locks
>> you know tuner is working and also demod is somehow working. If demod
>> lock but there is no picture you know problem is TS interface. Try
>> different TS settings for both USB-bridge and demod - those should
>> match. If it does not starts working then you have to look sniffs and
>> start replacing driver code with data from sniffs to until it starts
>> working => problematic setting is found.
>>
>> regards
>> Antti
>>
>>
>>
>> On 07/10/2016 12:18 AM, Oleh Kravchenko wrote:
>>> Hello!
>>>
>>> I'm started playing i2c, but stuck with unknown error for me - 32
>>> (EPIPE?):
>>>     [ 5651.958763] cx231xx #0 at cx231xx_i2c_xfer: write stop addr=0x60
>>> len=15: c0 00 00 00 00 01 01 01 01 01 01 02 00 00 01
>>>     [ 5651.958774] cx231xx #0: (pipe 0x80001000): OUT:  40 02 21 c0
>>> 00 00
>>> 0f 00
>>>     [ 5651.958775] >>> c0 00 00 00 00 01 01 01 01 01 01 02 00 00
>>> 01FAILED!
>>>     [ 5651.959110] cx231xx 1-2:1.1: cx231xx_send_usb_command: failed
>>> with
>>> status --32
>>>     [ 5651.959111] cx231xx #0 at cx231xx_i2c_xfer:  ERROR: -32
>>>
>>> How this error can be fixed? :)
>>>
>>> On 04.07.16 21:47, Antti Palosaari wrote:
>>>> Hello
>>>> On 07/04/2016 09:38 PM, Oleh Kravchenko wrote:
>>>>> Hello Antti!
>>>>>
>>>>> I started reverse-engineering of my new TV tuner "Evromedia USB Full
>>>>> Hybrid Full HD" and discovered that start sequence is different from
>>>>> si2157.c:
>>>>> i2c_read_C1
>>>>>  1 \xFE
>>>>> i2c_write_C0
>>>>>  15 \xC0\x00\x00\x00\x00\x01\x01\x01\x01\x01\x01\x02\x00\x00\x01
>>>>>
>>>>> Do you familiar with this revision?
>>>>> Should I merge my changes to si2158.c?
>>>>> Or define another driver?
>>>>
>>>> According to chip markings those are tuner Si2158-A20 and demod
>>>> Si2168-A30. Both are supported already by si2157 and si2168 drivers.
>>>>
>>>> Difference is just some settings. You need to identify which setting is
>>>> wrong and add that to configuration options. It should be pretty
>>>> easy to
>>>> find it from the I2C dumps and just testing.
>>>>
>>>> regards
>>>> Antti
>>>>
>>>
>>
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2016-07-18 19:55 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-29 23:38 [PATCH 1/3] si2168: add support for newer firmwares Antti Palosaari
2016-06-29 23:38 ` [PATCH 2/3] si2168: do not allow driver unbind Antti Palosaari
2016-06-29 23:38 ` [PATCH 3/3] si2157: " Antti Palosaari
     [not found]   ` <577AAD3C.2060204@kaa.org.ua>
2016-07-04 18:47     ` si2157: new revision? Antti Palosaari
2016-07-04 18:56       ` Oleh Kravchenko
2016-07-04 19:36         ` Antti Palosaari
2016-07-09 21:18       ` Oleh Kravchenko
2016-07-09 22:34         ` Antti Palosaari
2016-07-13  8:22           ` Oleh Kravchenko
2016-07-18 19:55             ` Oleh Kravchenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.