aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorAndy Walls <awalls@radix.net>2009-06-09 19:47:21 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-06-16 18:07:33 -0400
commit8bb09db375fe4f15d16315947500e827caa0fe9c (patch)
tree4c3b6762db953ea2904ce9669ea5b3916e15c9e9 /drivers/media
parent9d5af8629255ef6e62481ee7dea8c6787facc579 (diff)
V4L/DVB (11951): cx18: Add DVB-T support for the Leadtek WinFast DVR3100 H
This adds support for DVB-T on the Leadtek DVR3100 H and should also get analog TV capture from the tuner working properly as well. DVB-T 6 MHz and 8 MHz have been tested and verified to work by Terry Wu of Leadtek. DVB-T 7 MHz has also been verified working with a change developed by Terry to the tuner-xc2028.c driver. Special thanks go to Terry Wu <terrywu2009@gmail.com> of Leadtek who provided the needed information and testing to get digital TV working for the Leadtek DVR3100 H. Reported-by: Terry Wu <terrywu2009@gmail.com> Tested-by: Terry Wu <terrywu2009@gmail.com> Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/cx18/cx18-cards.c18
-rw-r--r--drivers/media/video/cx18/cx18-dvb.c53
2 files changed, 57 insertions, 14 deletions
diff --git a/drivers/media/video/cx18/cx18-cards.c b/drivers/media/video/cx18/cx18-cards.c
index ae631aa2cd33..c92a25036f0e 100644
--- a/drivers/media/video/cx18/cx18-cards.c
+++ b/drivers/media/video/cx18/cx18-cards.c
@@ -369,10 +369,7 @@ static const struct cx18_card cx18_card_leadtek_pvr2100 = {
369 }, 369 },
370 .radio_input = { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 2 }, 370 .radio_input = { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 2 },
371 .ddr = { 371 .ddr = {
372 /* 372 /* Pointer to proper DDR config values provided by Terry Wu */
373 * Pointer to proper DDR config values provided by
374 * Terry Wu <terrywu at leadtek.com.tw>
375 */
376 .chip_config = 0x303, 373 .chip_config = 0x303,
377 .refresh = 0x3bb, 374 .refresh = 0x3bb,
378 .timing1 = 0x24220e83, 375 .timing1 = 0x24220e83,
@@ -401,13 +398,13 @@ static const struct cx18_card_pci_info cx18_pci_leadtek_dvr3100h[] = {
401static const struct cx18_card cx18_card_leadtek_dvr3100h = { 398static const struct cx18_card cx18_card_leadtek_dvr3100h = {
402 .type = CX18_CARD_LEADTEK_DVR3100H, 399 .type = CX18_CARD_LEADTEK_DVR3100H,
403 .name = "Leadtek WinFast DVR3100 H", 400 .name = "Leadtek WinFast DVR3100 H",
404 .comment = "Experimenters and photos needed for device to work well.\n" 401 .comment = "Simultaneous DVB-T and Analog capture supported,\n"
405 "\tTo help, mail the ivtv-devel list (www.ivtvdriver.org).\n", 402 "\texcept when capturing Analog from the antenna input.\n",
406 .v4l2_capabilities = CX18_CAP_ENCODER, 403 .v4l2_capabilities = CX18_CAP_ENCODER,
407 .hw_audio_ctrl = CX18_HW_418_AV, 404 .hw_audio_ctrl = CX18_HW_418_AV,
408 .hw_muxer = CX18_HW_GPIO_MUX, 405 .hw_muxer = CX18_HW_GPIO_MUX,
409 .hw_all = CX18_HW_418_AV | CX18_HW_TUNER | CX18_HW_GPIO_MUX | 406 .hw_all = CX18_HW_418_AV | CX18_HW_TUNER | CX18_HW_GPIO_MUX |
410 CX18_HW_GPIO_RESET_CTRL, 407 CX18_HW_DVB | CX18_HW_GPIO_RESET_CTRL,
411 .video_inputs = { 408 .video_inputs = {
412 { CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE2 }, 409 { CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE2 },
413 { CX18_CARD_INPUT_SVIDEO1, 1, 410 { CX18_CARD_INPUT_SVIDEO1, 1,
@@ -424,10 +421,7 @@ static const struct cx18_card cx18_card_leadtek_dvr3100h = {
424 }, 421 },
425 .radio_input = { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 2 }, 422 .radio_input = { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 2 },
426 .ddr = { 423 .ddr = {
427 /* 424 /* Pointer to proper DDR config values provided by Terry Wu */
428 * Pointer to proper DDR config values provided by
429 * Terry Wu <terrywu at leadtek.com.tw>
430 */
431 .chip_config = 0x303, 425 .chip_config = 0x303,
432 .refresh = 0x3bb, 426 .refresh = 0x3bb,
433 .timing1 = 0x24220e83, 427 .timing1 = 0x24220e83,
@@ -439,7 +433,7 @@ static const struct cx18_card cx18_card_leadtek_dvr3100h = {
439 .gpio_init.direction = 0x7, 433 .gpio_init.direction = 0x7,
440 .gpio_audio_input = { .mask = 0x7, 434 .gpio_audio_input = { .mask = 0x7,
441 .tuner = 0x6, .linein = 0x2, .radio = 0x2 }, 435 .tuner = 0x6, .linein = 0x2, .radio = 0x2 },
442 .xceive_pin = 15, 436 .xceive_pin = 1,
443 .pci_list = cx18_pci_leadtek_dvr3100h, 437 .pci_list = cx18_pci_leadtek_dvr3100h,
444 .i2c = &cx18_i2c_std, 438 .i2c = &cx18_i2c_std,
445}; 439};
diff --git a/drivers/media/video/cx18/cx18-dvb.c b/drivers/media/video/cx18/cx18-dvb.c
index e7285a1096f2..6ea3fe623ef4 100644
--- a/drivers/media/video/cx18/cx18-dvb.c
+++ b/drivers/media/video/cx18/cx18-dvb.c
@@ -26,12 +26,17 @@
26#include "cx18-queue.h" 26#include "cx18-queue.h"
27#include "cx18-streams.h" 27#include "cx18-streams.h"
28#include "cx18-cards.h" 28#include "cx18-cards.h"
29#include "cx18-gpio.h"
29#include "s5h1409.h" 30#include "s5h1409.h"
30#include "mxl5005s.h" 31#include "mxl5005s.h"
32#include "zl10353.h"
33#include "tuner-xc2028.h"
31 34
32DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); 35DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
33 36
34#define CX18_REG_DMUX_NUM_PORT_0_CONTROL 0xd5a000 37#define CX18_REG_DMUX_NUM_PORT_0_CONTROL 0xd5a000
38#define CX18_CLOCK_ENABLE2 0xc71024
39#define CX18_DMUX_CLK_MASK 0x0080
35 40
36static struct mxl5005s_config hauppauge_hvr1600_tuner = { 41static struct mxl5005s_config hauppauge_hvr1600_tuner = {
37 .i2c_address = 0xC6 >> 1, 42 .i2c_address = 0xC6 >> 1,
@@ -58,7 +63,15 @@ static struct s5h1409_config hauppauge_hvr1600_config = {
58 .inversion = S5H1409_INVERSION_OFF, 63 .inversion = S5H1409_INVERSION_OFF,
59 .status_mode = S5H1409_DEMODLOCKING, 64 .status_mode = S5H1409_DEMODLOCKING,
60 .mpeg_timing = S5H1409_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK 65 .mpeg_timing = S5H1409_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK
66};
61 67
68/* Information/confirmation of proper config values provided by Terry Wu */
69static struct zl10353_config leadtek_dvr3100h_demod = {
70 .demod_address = 0x1e >> 1, /* Datasheet suggested straps */
71 .if2 = 45600, /* 4.560 MHz IF from the XC3028 */
72 .parallel_ts = 1, /* Not a serial TS */
73 .no_tuner = 1, /* XC3028 is not behind the gate */
74 .disable_i2c_gate_ctrl = 1, /* Disable the I2C gate */
62}; 75};
63 76
64static int dvb_register(struct cx18_stream *stream); 77static int dvb_register(struct cx18_stream *stream);
@@ -99,6 +112,7 @@ static int cx18_dvb_start_feed(struct dvb_demux_feed *feed)
99 cx18_write_reg(cx, v, CX18_REG_DMUX_NUM_PORT_0_CONTROL); 112 cx18_write_reg(cx, v, CX18_REG_DMUX_NUM_PORT_0_CONTROL);
100 break; 113 break;
101 114
115 case CX18_CARD_LEADTEK_DVR3100H:
102 default: 116 default:
103 /* Assumption - Parallel transport - Signalling 117 /* Assumption - Parallel transport - Signalling
104 * undefined or default. 118 * undefined or default.
@@ -268,8 +282,7 @@ void cx18_dvb_unregister(struct cx18_stream *stream)
268} 282}
269 283
270/* All the DVB attach calls go here, this function get's modified 284/* All the DVB attach calls go here, this function get's modified
271 * for each new card. No other function in this file needs 285 * for each new card. cx18_dvb_start_feed() will also need changes.
272 * to change.
273 */ 286 */
274static int dvb_register(struct cx18_stream *stream) 287static int dvb_register(struct cx18_stream *stream)
275{ 288{
@@ -290,6 +303,29 @@ static int dvb_register(struct cx18_stream *stream)
290 ret = 0; 303 ret = 0;
291 } 304 }
292 break; 305 break;
306 case CX18_CARD_LEADTEK_DVR3100H:
307 dvb->fe = dvb_attach(zl10353_attach,
308 &leadtek_dvr3100h_demod,
309 &cx->i2c_adap[1]);
310 if (dvb->fe != NULL) {
311 struct dvb_frontend *fe;
312 struct xc2028_config cfg = {
313 .i2c_adap = &cx->i2c_adap[1],
314 .i2c_addr = 0xc2 >> 1,
315 .ctrl = NULL,
316 };
317 static struct xc2028_ctrl ctrl = {
318 .fname = XC2028_DEFAULT_FIRMWARE,
319 .max_len = 64,
320 .demod = XC3028_FE_ZARLINK456,
321 .type = XC2028_AUTO,
322 };
323
324 fe = dvb_attach(xc2028_attach, dvb->fe, &cfg);
325 if (fe != NULL && fe->ops.tuner_ops.set_config != NULL)
326 fe->ops.tuner_ops.set_config(fe, &ctrl);
327 }
328 break;
293 default: 329 default:
294 /* No Digital Tv Support */ 330 /* No Digital Tv Support */
295 break; 331 break;
@@ -300,6 +336,8 @@ static int dvb_register(struct cx18_stream *stream)
300 return -1; 336 return -1;
301 } 337 }
302 338
339 dvb->fe->callback = cx18_reset_tuner_gpio;
340
303 ret = dvb_register_frontend(&dvb->dvb_adapter, dvb->fe); 341 ret = dvb_register_frontend(&dvb->dvb_adapter, dvb->fe);
304 if (ret < 0) { 342 if (ret < 0) {
305 if (dvb->fe->ops.release) 343 if (dvb->fe->ops.release)
@@ -307,5 +345,16 @@ static int dvb_register(struct cx18_stream *stream)
307 return ret; 345 return ret;
308 } 346 }
309 347
348 /*
349 * The firmware seems to enable the TS DMUX clock
350 * under various circumstances. However, since we know we
351 * might use it, let's just turn it on ourselves here.
352 */
353 cx18_write_reg_expect(cx,
354 (CX18_DMUX_CLK_MASK << 16) | CX18_DMUX_CLK_MASK,
355 CX18_CLOCK_ENABLE2,
356 CX18_DMUX_CLK_MASK,
357 (CX18_DMUX_CLK_MASK << 16) | CX18_DMUX_CLK_MASK);
358
310 return ret; 359 return ret;
311} 360}