All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] em28xx: Improve compatiblity with the Terratec Cinergy HTC Stick HD
@ 2012-06-12 22:19 Martin Blumenstingl
  2012-06-12 22:19 ` [PATCH 1/3] [media] Add support for downloading the firmware of the Terratec Cinergy HTC Stick HD's firmware Martin Blumenstingl
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Martin Blumenstingl @ 2012-06-12 22:19 UTC (permalink / raw)
  To: linux-media; +Cc: sven.pilz, soeren.moch

Hi,

this patch-set tries to improve compatibility with the Terratec Cinergy HTC Stick HD.
It includes a completely new GPIO and analog decoder setup, which is now
similar to what the driver on windows does.

I also disabled LNA by default as it's what the windows-driver seems to do.
This should also fix DVB-C.

Thanks to Antti Palosaari and Devin Heitmueller for their help!

@Soren, Sven: could you please try out this patch-set and give feedback?

The patches were written against the staging/for_v3.5 branch of media_tree.git.
They depend upon my previous patch-set (see [0] and [1]):
"em28xx: Remote control support for another board".

Patch 2 and 3 should also apply against linux 3.4.
On 3.4 an additional patch from Antti Palosaari is also required, see [2].
The drxk-firmware (required for DVB-T) can be downloaded from [3] (if patch
1 does not work on 3.4).

Regards,
Martin

[0] http://patchwork.linuxtv.org/patch/11544/
[1] http://patchwork.linuxtv.org/patch/11548/
[2] http://patchwork.linuxtv.org/patch/11310/
[3] http://filebin.ca/55M5bF38USL/dvb-usb-terratec-htc-stick-drxk.fw



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

* [PATCH 1/3] [media] Add support for downloading the firmware of the Terratec Cinergy HTC Stick HD's firmware.
  2012-06-12 22:19 [PATCH 0/3] em28xx: Improve compatiblity with the Terratec Cinergy HTC Stick HD Martin Blumenstingl
@ 2012-06-12 22:19 ` Martin Blumenstingl
  2012-06-12 22:19 ` [PATCH 2/3] [media] em28xx: Add the DRX-K at I2C address 0x29 to the list of known I2C devices Martin Blumenstingl
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Martin Blumenstingl @ 2012-06-12 22:19 UTC (permalink / raw)
  To: linux-media; +Cc: sven.pilz, soeren.moch, Martin Blumenstingl

As of June 2012 it uses the same firmware as the Hauppauge WinTV HVR 930C.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
---
 Documentation/dvb/get_dvb_firmware |   20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/Documentation/dvb/get_dvb_firmware b/Documentation/dvb/get_dvb_firmware
index fbb2411..94b0168 100755
--- a/Documentation/dvb/get_dvb_firmware
+++ b/Documentation/dvb/get_dvb_firmware
@@ -29,7 +29,7 @@ use IO::Handle;
 		"af9015", "ngene", "az6027", "lme2510_lg", "lme2510c_s7395",
 		"lme2510c_s7395_old", "drxk", "drxk_terratec_h5",
 		"drxk_hauppauge_hvr930c", "tda10071", "it9135", "it9137",
-		"drxk_pctv");
+		"drxk_pctv", "drxk_terratec_htc_stick");
 
 # Check args
 syntax() if (scalar(@ARGV) != 1);
@@ -676,6 +676,24 @@ sub drxk_terratec_h5 {
     "$fwfile"
 }
 
+sub drxk_terratec_htc_stick {
+    my $url = "http://ftp.terratec.de/Receiver/Cinergy_HTC_Stick/Updates/";
+    my $zipfile = "Cinergy_HTC_Stick_Drv_5.09.1202.00_XP_Vista_7.exe";
+    my $hash = "6722a2442a05423b781721fbc069ed5e";
+    my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 0);
+    my $drvfile = "Cinergy HTC Stick/BDA Driver 5.09.1202.00/Windows 32 Bit/emOEM.sys";
+    my $fwfile = "dvb-usb-terratec-htc-stick-drxk.fw";
+
+    checkstandard();
+
+    wgetfile($zipfile, $url . $zipfile);
+    verify($zipfile, $hash);
+    unzip($zipfile, $tmpdir);
+    extract("$tmpdir/$drvfile", 0x4e5c0, 42692, "$fwfile");
+
+    "$fwfile"
+}
+
 sub it9135 {
 	my $sourcefile = "dvb-usb-it9135.zip";
 	my $url = "http://www.ite.com.tw/uploads/firmware/v3.6.0.0/$sourcefile";
-- 
1.7.10.4


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

* [PATCH 2/3] [media] em28xx: Add the DRX-K at I2C address 0x29 to the list of known I2C devices.
  2012-06-12 22:19 [PATCH 0/3] em28xx: Improve compatiblity with the Terratec Cinergy HTC Stick HD Martin Blumenstingl
  2012-06-12 22:19 ` [PATCH 1/3] [media] Add support for downloading the firmware of the Terratec Cinergy HTC Stick HD's firmware Martin Blumenstingl
@ 2012-06-12 22:19 ` Martin Blumenstingl
  2012-06-12 22:19 ` [PATCH 3/3] [media] em28xx: Improve support for the Terratec Cinergy HTC Stick HD Martin Blumenstingl
       [not found] ` <4FD818EC.6060300@ims.uni-hannover.de>
  3 siblings, 0 replies; 8+ messages in thread
From: Martin Blumenstingl @ 2012-06-12 22:19 UTC (permalink / raw)
  To: linux-media; +Cc: sven.pilz, soeren.moch, Martin Blumenstingl

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
---
 drivers/media/video/em28xx/em28xx-i2c.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/video/em28xx/em28xx-i2c.c b/drivers/media/video/em28xx/em28xx-i2c.c
index 185db65..1683bd9 100644
--- a/drivers/media/video/em28xx/em28xx-i2c.c
+++ b/drivers/media/video/em28xx/em28xx-i2c.c
@@ -475,6 +475,7 @@ static struct i2c_client em28xx_client_template = {
  */
 static char *i2c_devs[128] = {
 	[0x4a >> 1] = "saa7113h",
+	[0x52 >> 1] = "drxk",
 	[0x60 >> 1] = "remote IR sensor",
 	[0x8e >> 1] = "remote IR sensor",
 	[0x86 >> 1] = "tda9887",
-- 
1.7.10.4


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

* [PATCH 3/3] [media] em28xx: Improve support for the Terratec Cinergy HTC Stick HD.
  2012-06-12 22:19 [PATCH 0/3] em28xx: Improve compatiblity with the Terratec Cinergy HTC Stick HD Martin Blumenstingl
  2012-06-12 22:19 ` [PATCH 1/3] [media] Add support for downloading the firmware of the Terratec Cinergy HTC Stick HD's firmware Martin Blumenstingl
  2012-06-12 22:19 ` [PATCH 2/3] [media] em28xx: Add the DRX-K at I2C address 0x29 to the list of known I2C devices Martin Blumenstingl
@ 2012-06-12 22:19 ` Martin Blumenstingl
       [not found] ` <4FD818EC.6060300@ims.uni-hannover.de>
  3 siblings, 0 replies; 8+ messages in thread
From: Martin Blumenstingl @ 2012-06-12 22:19 UTC (permalink / raw)
  To: linux-media; +Cc: sven.pilz, soeren.moch, Martin Blumenstingl

The windows driver used different values for the GPIOs and analog
decoder configuration. The values from the windows driver are now
used.
It also seems that the windows driver has LNA always disabled.
Thus we are doing the same (using the same flags as on windows).

I (only) tested with DVB-T and it worked quite well.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
---
 drivers/media/video/em28xx/em28xx-cards.c |    7 +--
 drivers/media/video/em28xx/em28xx-dvb.c   |   83 ++++++++++++++++++++++++++++-
 2 files changed, 83 insertions(+), 7 deletions(-)

diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c
index 92da7c2..12bc54a 100644
--- a/drivers/media/video/em28xx/em28xx-cards.c
+++ b/drivers/media/video/em28xx/em28xx-cards.c
@@ -975,12 +975,7 @@ struct em28xx_board em28xx_boards[] = {
 		.name         = "Terratec Cinergy HTC Stick",
 		.has_dvb      = 1,
 		.ir_codes     = RC_MAP_NEC_TERRATEC_CINERGY_XS,
-#if 0
-		.tuner_type   = TUNER_PHILIPS_TDA8290,
-		.tuner_addr   = 0x41,
-		.dvb_gpio     = terratec_h5_digital, /* FIXME: probably wrong */
-		.tuner_gpio   = terratec_h5_gpio,
-#endif
+		.tuner_type   = TUNER_ABSENT,
 		.i2c_speed    = EM2874_I2C_SECONDARY_BUS_SELECT |
 				EM28XX_I2C_CLK_WAIT_ENABLE |
 				EM28XX_I2C_FREQ_400_KHZ,
diff --git a/drivers/media/video/em28xx/em28xx-dvb.c b/drivers/media/video/em28xx/em28xx-dvb.c
index 16410ac..2b81427 100644
--- a/drivers/media/video/em28xx/em28xx-dvb.c
+++ b/drivers/media/video/em28xx/em28xx-dvb.c
@@ -317,6 +317,18 @@ struct drxk_config terratec_h5_drxk = {
 	.microcode_name = "dvb-usb-terratec-h5-drxk.fw",
 };
 
+struct drxk_config terratec_htc_stick_drxk = {
+	.adr = 0x29,
+	.single_master = 1,
+	.no_i2c_bridge = 1,
+	.microcode_name = "dvb-usb-terratec-htc-stick-drxk.fw",
+	.chunk_size = 54,
+	/* Required for the antenna_gpio to disable LNA. */
+	.antenna_dvbt = true,
+	/* The windows driver uses the same. This will disable LNA. */
+	.antenna_gpio = 0x6,
+};
+
 struct drxk_config hauppauge_930c_drxk = {
 	.adr = 0x29,
 	.single_master = 1,
@@ -473,6 +485,57 @@ static void terratec_h5_init(struct em28xx *dev)
 	em28xx_gpio_set(dev, terratec_h5_end);
 };
 
+static void terratec_htc_stick_init(struct em28xx *dev)
+{
+	int i;
+
+	/*
+	 * GPIO configuration:
+	 * 0xff: unknown (does not affect DVB-T).
+	 * 0xf6: DRX-K (demodulator).
+	 * 0xe6: unknown (does not affect DVB-T).
+	 * 0xb6: unknown (does not affect DVB-T).
+	 */
+	struct em28xx_reg_seq terratec_htc_stick_init[] = {
+		{EM28XX_R08_GPIO,	0xff,	0xff,	10},
+		{EM2874_R80_GPIO,	0xf6,	0xff,	100},
+		{EM2874_R80_GPIO,	0xe6,	0xff,	50},
+		{EM2874_R80_GPIO,	0xf6,	0xff,	100},
+		{ -1,                   -1,     -1,     -1},
+	};
+	struct em28xx_reg_seq terratec_htc_stick_end[] = {
+		{EM2874_R80_GPIO,	0xb6,	0xff,	100},
+		{EM2874_R80_GPIO,	0xf6,	0xff,	50},
+		{ -1,                   -1,     -1,     -1},
+	};
+
+	/* Init the analog decoder? */
+	struct {
+		unsigned char r[4];
+		int len;
+	} regs[] = {
+		{{ 0x06, 0x02, 0x00, 0x31 }, 4},
+		{{ 0x01, 0x02 }, 2},
+		{{ 0x01, 0x02, 0x00, 0xc6 }, 4},
+		{{ 0x01, 0x00 }, 2},
+		{{ 0x01, 0x00, 0xff, 0xaf }, 4},
+	};
+
+	em28xx_gpio_set(dev, terratec_htc_stick_init);
+
+	em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x40);
+	msleep(10);
+	em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x44);
+	msleep(10);
+
+	dev->i2c_client.addr = 0x82 >> 1;
+
+	for (i = 0; i < ARRAY_SIZE(regs); i++)
+		i2c_master_send(&dev->i2c_client, regs[i].r, regs[i].len);
+
+	em28xx_gpio_set(dev, terratec_htc_stick_end);
+};
+
 static void pctv_520e_init(struct em28xx *dev)
 {
 	/*
@@ -944,7 +1007,6 @@ static int em28xx_dvb_init(struct em28xx *dev)
 		break;
 	}
 	case EM2884_BOARD_TERRATEC_H5:
-	case EM2884_BOARD_CINERGY_HTC_STICK:
 		terratec_h5_init(dev);
 
 		dvb->fe[0] = dvb_attach(drxk_attach, &terratec_h5_drxk, &dev->i2c_adap);
@@ -1021,6 +1083,25 @@ static int em28xx_dvb_init(struct em28xx *dev)
 			}
 		}
 		break;
+	case EM2884_BOARD_CINERGY_HTC_STICK:
+		terratec_htc_stick_init(dev);
+
+		/* attach demodulator */
+		dvb->fe[0] = dvb_attach(drxk_attach, &terratec_htc_stick_drxk,
+					&dev->i2c_adap);
+		if (!dvb->fe[0]) {
+			result = -EINVAL;
+			goto out_free;
+		}
+
+		/* Attach the demodulator. */
+		if (!dvb_attach(tda18271_attach, dvb->fe[0], 0x60,
+				&dev->i2c_adap,
+				&em28xx_cxd2820r_tda18271_config)) {
+			result = -EINVAL;
+			goto out_free;
+		}
+		break;
 	default:
 		em28xx_errdev("/2: The frontend of your DVB/ATSC card"
 				" isn't supported yet\n");
-- 
1.7.10.4


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

* Re: [PATCH 0/3] em28xx: Improve compatiblity with the Terratec Cinergy HTC Stick HD
       [not found] ` <4FD818EC.6060300@ims.uni-hannover.de>
@ 2012-06-13  7:00   ` Martin Blumenstingl
       [not found]     ` <4FDA2969.4010002@ims.uni-hannover.de>
  0 siblings, 1 reply; 8+ messages in thread
From: Martin Blumenstingl @ 2012-06-13  7:00 UTC (permalink / raw)
  To: linux-media, Sören Moch; +Cc: sven.pilz

Hi Sven,

> I tested the patchset on linux-3.4.2, unfortunately DVB-C is not working
> here (DVB-T not tested).
> If you have further patches or other suggestions what to test, I would be
> happy to try it.
That's sad.
I guess it was also not working with the old version, right?
Do you get any errors in dmesg?

I can test DVB-C support next week - I'll let you know once I find out
something.

Regards,
Martin

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

* Re: [PATCH 0/3] em28xx: Improve compatiblity with the Terratec Cinergy HTC Stick HD
       [not found]     ` <4FDA2969.4010002@ims.uni-hannover.de>
@ 2012-06-25 21:18       ` Martin Blumenstingl
  2012-06-26 22:45         ` Martin Blumenstingl
  0 siblings, 1 reply; 8+ messages in thread
From: Martin Blumenstingl @ 2012-06-25 21:18 UTC (permalink / raw)
  To: Sören Moch; +Cc: sven.pilz, linux-media

Hi Soren,

I just tested DVB-C (we got some local provider here).

> Correct. My Cinergy HTC Stick is not working for DVB-C with older drivers,
> too. (I didn't test DVB-T, since there are cheaper sticks for that and vdr
> opens the HTC stick for dvb-c)
Here's the first difference: it worked with a stock 3.4.4 kernel here.
The picture was completely broken for the first 10 seconds - after
that everything was fine.
This happened after each channel change with the vanilla kernel.
Afterwards I applied the drxk driver patch (see [0]) and my main patch
(see [1]) to the
3.4.4 kernel patched by Arch Linux (they don't have and media/dvb
related changes in
there though).
With my patch everything was working fine, no broken picture after
channel switching,
etc. :)

> Only the presumably "intentional error":
That's also what I see.

Let's start somewhere else:
How are you scanning for channels?
I used: w_scan -fc -c DE -X > channels.conf
Afterwards I opened channels.conf in VLC.
Which tool do you use for viewing the DVB-C stream?

PS: My patches will probably be included in linux 3.6.

Regards,
Martin

[0] http://git.linuxtv.org/media_tree.git/commitdiff/140534432e8a7edee5814d139dd59c20607479e3?hp=b144c98ca0962ee3cbdbbeafe77a1b300be0cb4f
[1] http://git.linuxtv.org/media_tree.git/commitdiff/c8dce0088a645c21cfb7e554390a4603e0e2139f?hp=729841ed0f41cfae494ad5c50df86af427078442

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

* Re: [PATCH 0/3] em28xx: Improve compatiblity with the Terratec Cinergy HTC Stick HD
  2012-06-25 21:18       ` Martin Blumenstingl
@ 2012-06-26 22:45         ` Martin Blumenstingl
  2012-07-16 13:40           ` Sören Moch
  0 siblings, 1 reply; 8+ messages in thread
From: Martin Blumenstingl @ 2012-06-26 22:45 UTC (permalink / raw)
  To: Sören Moch; +Cc: linux-media

Hi Soren,

I'm just CC'ing the linux-media mailing list ;)
For the record, here's what Soren wrote a few minutes ago:
> thank you for your help and tests. I tried to avoid this, but now I
> installed the windows software of this HTC stick. I see the same reception
> problems in windows, too. So this must be a hardware fault, no driver
> problem.
Thank you for trying it out!

Regards,
Martin

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

* Re: [PATCH 0/3] em28xx: Improve compatiblity with the Terratec Cinergy HTC Stick HD
  2012-06-26 22:45         ` Martin Blumenstingl
@ 2012-07-16 13:40           ` Sören Moch
  0 siblings, 0 replies; 8+ messages in thread
From: Sören Moch @ 2012-07-16 13:40 UTC (permalink / raw)
  To: Martin Blumenstingl; +Cc: linux-media

On 27.06.2012 00:45 Martin Blumenstingl wrote
> Hi Soren,
>
> I'm just CC'ing the linux-media mailing list ;)
> For the record, here's what Soren wrote a few minutes ago:
>> thank you for your help and tests. I tried to avoid this, but now I
>> installed the windows software of this HTC stick. I see the same reception
>> problems in windows, too. So this must be a hardware fault, no driver
>> problem.
> Thank you for trying it out!
Now I got a new Terratec Cinergy HTC Stick. I can confirm, that DVB-C is 
working really fine with your patches. I hope they will go in for linux 3.6.

Regards,
Soeren
> Regards,
> Martin



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

end of thread, other threads:[~2012-07-16 13:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-12 22:19 [PATCH 0/3] em28xx: Improve compatiblity with the Terratec Cinergy HTC Stick HD Martin Blumenstingl
2012-06-12 22:19 ` [PATCH 1/3] [media] Add support for downloading the firmware of the Terratec Cinergy HTC Stick HD's firmware Martin Blumenstingl
2012-06-12 22:19 ` [PATCH 2/3] [media] em28xx: Add the DRX-K at I2C address 0x29 to the list of known I2C devices Martin Blumenstingl
2012-06-12 22:19 ` [PATCH 3/3] [media] em28xx: Improve support for the Terratec Cinergy HTC Stick HD Martin Blumenstingl
     [not found] ` <4FD818EC.6060300@ims.uni-hannover.de>
2012-06-13  7:00   ` [PATCH 0/3] em28xx: Improve compatiblity with " Martin Blumenstingl
     [not found]     ` <4FDA2969.4010002@ims.uni-hannover.de>
2012-06-25 21:18       ` Martin Blumenstingl
2012-06-26 22:45         ` Martin Blumenstingl
2012-07-16 13:40           ` Sören Moch

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.