Commit 8bb09db3 authored by Andy Walls's avatar Andy Walls Committed by Mauro Carvalho Chehab

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: default avatarTerry Wu <terrywu2009@gmail.com>
Tested-by: default avatarTerry Wu <terrywu2009@gmail.com>
Signed-off-by: default avatarAndy Walls <awalls@radix.net>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 9d5af862
...@@ -369,10 +369,7 @@ static const struct cx18_card cx18_card_leadtek_pvr2100 = { ...@@ -369,10 +369,7 @@ static const struct cx18_card cx18_card_leadtek_pvr2100 = {
}, },
.radio_input = { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 2 }, .radio_input = { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 2 },
.ddr = { .ddr = {
/* /* Pointer to proper DDR config values provided by Terry Wu */
* Pointer to proper DDR config values provided by
* Terry Wu <terrywu at leadtek.com.tw>
*/
.chip_config = 0x303, .chip_config = 0x303,
.refresh = 0x3bb, .refresh = 0x3bb,
.timing1 = 0x24220e83, .timing1 = 0x24220e83,
...@@ -401,13 +398,13 @@ static const struct cx18_card_pci_info cx18_pci_leadtek_dvr3100h[] = { ...@@ -401,13 +398,13 @@ static const struct cx18_card_pci_info cx18_pci_leadtek_dvr3100h[] = {
static const struct cx18_card cx18_card_leadtek_dvr3100h = { static const struct cx18_card cx18_card_leadtek_dvr3100h = {
.type = CX18_CARD_LEADTEK_DVR3100H, .type = CX18_CARD_LEADTEK_DVR3100H,
.name = "Leadtek WinFast DVR3100 H", .name = "Leadtek WinFast DVR3100 H",
.comment = "Experimenters and photos needed for device to work well.\n" .comment = "Simultaneous DVB-T and Analog capture supported,\n"
"\tTo help, mail the ivtv-devel list (www.ivtvdriver.org).\n", "\texcept when capturing Analog from the antenna input.\n",
.v4l2_capabilities = CX18_CAP_ENCODER, .v4l2_capabilities = CX18_CAP_ENCODER,
.hw_audio_ctrl = CX18_HW_418_AV, .hw_audio_ctrl = CX18_HW_418_AV,
.hw_muxer = CX18_HW_GPIO_MUX, .hw_muxer = CX18_HW_GPIO_MUX,
.hw_all = CX18_HW_418_AV | CX18_HW_TUNER | CX18_HW_GPIO_MUX | .hw_all = CX18_HW_418_AV | CX18_HW_TUNER | CX18_HW_GPIO_MUX |
CX18_HW_GPIO_RESET_CTRL, CX18_HW_DVB | CX18_HW_GPIO_RESET_CTRL,
.video_inputs = { .video_inputs = {
{ CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE2 }, { CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE2 },
{ CX18_CARD_INPUT_SVIDEO1, 1, { CX18_CARD_INPUT_SVIDEO1, 1,
...@@ -424,10 +421,7 @@ static const struct cx18_card cx18_card_leadtek_dvr3100h = { ...@@ -424,10 +421,7 @@ static const struct cx18_card cx18_card_leadtek_dvr3100h = {
}, },
.radio_input = { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 2 }, .radio_input = { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 2 },
.ddr = { .ddr = {
/* /* Pointer to proper DDR config values provided by Terry Wu */
* Pointer to proper DDR config values provided by
* Terry Wu <terrywu at leadtek.com.tw>
*/
.chip_config = 0x303, .chip_config = 0x303,
.refresh = 0x3bb, .refresh = 0x3bb,
.timing1 = 0x24220e83, .timing1 = 0x24220e83,
...@@ -439,7 +433,7 @@ static const struct cx18_card cx18_card_leadtek_dvr3100h = { ...@@ -439,7 +433,7 @@ static const struct cx18_card cx18_card_leadtek_dvr3100h = {
.gpio_init.direction = 0x7, .gpio_init.direction = 0x7,
.gpio_audio_input = { .mask = 0x7, .gpio_audio_input = { .mask = 0x7,
.tuner = 0x6, .linein = 0x2, .radio = 0x2 }, .tuner = 0x6, .linein = 0x2, .radio = 0x2 },
.xceive_pin = 15, .xceive_pin = 1,
.pci_list = cx18_pci_leadtek_dvr3100h, .pci_list = cx18_pci_leadtek_dvr3100h,
.i2c = &cx18_i2c_std, .i2c = &cx18_i2c_std,
}; };
......
...@@ -26,12 +26,17 @@ ...@@ -26,12 +26,17 @@
#include "cx18-queue.h" #include "cx18-queue.h"
#include "cx18-streams.h" #include "cx18-streams.h"
#include "cx18-cards.h" #include "cx18-cards.h"
#include "cx18-gpio.h"
#include "s5h1409.h" #include "s5h1409.h"
#include "mxl5005s.h" #include "mxl5005s.h"
#include "zl10353.h"
#include "tuner-xc2028.h"
DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
#define CX18_REG_DMUX_NUM_PORT_0_CONTROL 0xd5a000 #define CX18_REG_DMUX_NUM_PORT_0_CONTROL 0xd5a000
#define CX18_CLOCK_ENABLE2 0xc71024
#define CX18_DMUX_CLK_MASK 0x0080
static struct mxl5005s_config hauppauge_hvr1600_tuner = { static struct mxl5005s_config hauppauge_hvr1600_tuner = {
.i2c_address = 0xC6 >> 1, .i2c_address = 0xC6 >> 1,
...@@ -58,7 +63,15 @@ static struct s5h1409_config hauppauge_hvr1600_config = { ...@@ -58,7 +63,15 @@ static struct s5h1409_config hauppauge_hvr1600_config = {
.inversion = S5H1409_INVERSION_OFF, .inversion = S5H1409_INVERSION_OFF,
.status_mode = S5H1409_DEMODLOCKING, .status_mode = S5H1409_DEMODLOCKING,
.mpeg_timing = S5H1409_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK .mpeg_timing = S5H1409_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK
};
/* Information/confirmation of proper config values provided by Terry Wu */
static struct zl10353_config leadtek_dvr3100h_demod = {
.demod_address = 0x1e >> 1, /* Datasheet suggested straps */
.if2 = 45600, /* 4.560 MHz IF from the XC3028 */
.parallel_ts = 1, /* Not a serial TS */
.no_tuner = 1, /* XC3028 is not behind the gate */
.disable_i2c_gate_ctrl = 1, /* Disable the I2C gate */
}; };
static int dvb_register(struct cx18_stream *stream); static int dvb_register(struct cx18_stream *stream);
...@@ -99,6 +112,7 @@ static int cx18_dvb_start_feed(struct dvb_demux_feed *feed) ...@@ -99,6 +112,7 @@ static int cx18_dvb_start_feed(struct dvb_demux_feed *feed)
cx18_write_reg(cx, v, CX18_REG_DMUX_NUM_PORT_0_CONTROL); cx18_write_reg(cx, v, CX18_REG_DMUX_NUM_PORT_0_CONTROL);
break; break;
case CX18_CARD_LEADTEK_DVR3100H:
default: default:
/* Assumption - Parallel transport - Signalling /* Assumption - Parallel transport - Signalling
* undefined or default. * undefined or default.
...@@ -268,8 +282,7 @@ void cx18_dvb_unregister(struct cx18_stream *stream) ...@@ -268,8 +282,7 @@ void cx18_dvb_unregister(struct cx18_stream *stream)
} }
/* All the DVB attach calls go here, this function get's modified /* All the DVB attach calls go here, this function get's modified
* for each new card. No other function in this file needs * for each new card. cx18_dvb_start_feed() will also need changes.
* to change.
*/ */
static int dvb_register(struct cx18_stream *stream) static int dvb_register(struct cx18_stream *stream)
{ {
...@@ -290,6 +303,29 @@ static int dvb_register(struct cx18_stream *stream) ...@@ -290,6 +303,29 @@ static int dvb_register(struct cx18_stream *stream)
ret = 0; ret = 0;
} }
break; break;
case CX18_CARD_LEADTEK_DVR3100H:
dvb->fe = dvb_attach(zl10353_attach,
&leadtek_dvr3100h_demod,
&cx->i2c_adap[1]);
if (dvb->fe != NULL) {
struct dvb_frontend *fe;
struct xc2028_config cfg = {
.i2c_adap = &cx->i2c_adap[1],
.i2c_addr = 0xc2 >> 1,
.ctrl = NULL,
};
static struct xc2028_ctrl ctrl = {
.fname = XC2028_DEFAULT_FIRMWARE,
.max_len = 64,
.demod = XC3028_FE_ZARLINK456,
.type = XC2028_AUTO,
};
fe = dvb_attach(xc2028_attach, dvb->fe, &cfg);
if (fe != NULL && fe->ops.tuner_ops.set_config != NULL)
fe->ops.tuner_ops.set_config(fe, &ctrl);
}
break;
default: default:
/* No Digital Tv Support */ /* No Digital Tv Support */
break; break;
...@@ -300,6 +336,8 @@ static int dvb_register(struct cx18_stream *stream) ...@@ -300,6 +336,8 @@ static int dvb_register(struct cx18_stream *stream)
return -1; return -1;
} }
dvb->fe->callback = cx18_reset_tuner_gpio;
ret = dvb_register_frontend(&dvb->dvb_adapter, dvb->fe); ret = dvb_register_frontend(&dvb->dvb_adapter, dvb->fe);
if (ret < 0) { if (ret < 0) {
if (dvb->fe->ops.release) if (dvb->fe->ops.release)
...@@ -307,5 +345,16 @@ static int dvb_register(struct cx18_stream *stream) ...@@ -307,5 +345,16 @@ static int dvb_register(struct cx18_stream *stream)
return ret; return ret;
} }
/*
* The firmware seems to enable the TS DMUX clock
* under various circumstances. However, since we know we
* might use it, let's just turn it on ourselves here.
*/
cx18_write_reg_expect(cx,
(CX18_DMUX_CLK_MASK << 16) | CX18_DMUX_CLK_MASK,
CX18_CLOCK_ENABLE2,
CX18_DMUX_CLK_MASK,
(CX18_DMUX_CLK_MASK << 16) | CX18_DMUX_CLK_MASK);
return ret; return ret;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment