aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx23885/cx23885-cards.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/cx23885/cx23885-cards.c')
-rw-r--r--drivers/media/video/cx23885/cx23885-cards.c110
1 files changed, 109 insertions, 1 deletions
diff --git a/drivers/media/video/cx23885/cx23885-cards.c b/drivers/media/video/cx23885/cx23885-cards.c
index b298b730943c..ea88722cb4ab 100644
--- a/drivers/media/video/cx23885/cx23885-cards.c
+++ b/drivers/media/video/cx23885/cx23885-cards.c
@@ -24,10 +24,14 @@
24#include <linux/pci.h> 24#include <linux/pci.h>
25#include <linux/delay.h> 25#include <linux/delay.h>
26#include <media/cx25840.h> 26#include <media/cx25840.h>
27#include <linux/firmware.h>
28#include <staging/altera.h>
27 29
28#include "cx23885.h" 30#include "cx23885.h"
29#include "tuner-xc2028.h" 31#include "tuner-xc2028.h"
30#include "netup-init.h" 32#include "netup-init.h"
33#include "altera-ci.h"
34#include "xc5000.h"
31#include "cx23888-ir.h" 35#include "cx23888-ir.h"
32 36
33static unsigned int enable_885_ir; 37static unsigned int enable_885_ir;
@@ -90,6 +94,7 @@ struct cx23885_board cx23885_boards[] = {
90 .portc = CX23885_MPEG_DVB, 94 .portc = CX23885_MPEG_DVB,
91 .tuner_type = TUNER_PHILIPS_TDA8290, 95 .tuner_type = TUNER_PHILIPS_TDA8290,
92 .tuner_addr = 0x42, /* 0x84 >> 1 */ 96 .tuner_addr = 0x42, /* 0x84 >> 1 */
97 .tuner_bus = 1,
93 .input = {{ 98 .input = {{
94 .type = CX23885_VMUX_TELEVISION, 99 .type = CX23885_VMUX_TELEVISION,
95 .vmux = CX25840_VIN7_CH3 | 100 .vmux = CX25840_VIN7_CH3 |
@@ -187,7 +192,7 @@ struct cx23885_board cx23885_boards[] = {
187 .portb = CX23885_MPEG_DVB, 192 .portb = CX23885_MPEG_DVB,
188 }, 193 },
189 [CX23885_BOARD_NETUP_DUAL_DVBS2_CI] = { 194 [CX23885_BOARD_NETUP_DUAL_DVBS2_CI] = {
190 .cimax = 1, 195 .ci_type = 1,
191 .name = "NetUP Dual DVB-S2 CI", 196 .name = "NetUP Dual DVB-S2 CI",
192 .portb = CX23885_MPEG_DVB, 197 .portb = CX23885_MPEG_DVB,
193 .portc = CX23885_MPEG_DVB, 198 .portc = CX23885_MPEG_DVB,
@@ -212,6 +217,7 @@ struct cx23885_board cx23885_boards[] = {
212 .name = "Mygica X8506 DMB-TH", 217 .name = "Mygica X8506 DMB-TH",
213 .tuner_type = TUNER_XC5000, 218 .tuner_type = TUNER_XC5000,
214 .tuner_addr = 0x61, 219 .tuner_addr = 0x61,
220 .tuner_bus = 1,
215 .porta = CX23885_ANALOG_VIDEO, 221 .porta = CX23885_ANALOG_VIDEO,
216 .portb = CX23885_MPEG_DVB, 222 .portb = CX23885_MPEG_DVB,
217 .input = { 223 .input = {
@@ -241,6 +247,7 @@ struct cx23885_board cx23885_boards[] = {
241 .name = "Magic-Pro ProHDTV Extreme 2", 247 .name = "Magic-Pro ProHDTV Extreme 2",
242 .tuner_type = TUNER_XC5000, 248 .tuner_type = TUNER_XC5000,
243 .tuner_addr = 0x61, 249 .tuner_addr = 0x61,
250 .tuner_bus = 1,
244 .porta = CX23885_ANALOG_VIDEO, 251 .porta = CX23885_ANALOG_VIDEO,
245 .portb = CX23885_MPEG_DVB, 252 .portb = CX23885_MPEG_DVB,
246 .input = { 253 .input = {
@@ -289,6 +296,7 @@ struct cx23885_board cx23885_boards[] = {
289 .porta = CX23885_ANALOG_VIDEO, 296 .porta = CX23885_ANALOG_VIDEO,
290 .tuner_type = TUNER_XC2028, 297 .tuner_type = TUNER_XC2028,
291 .tuner_addr = 0x61, 298 .tuner_addr = 0x61,
299 .tuner_bus = 1,
292 .input = {{ 300 .input = {{
293 .type = CX23885_VMUX_TELEVISION, 301 .type = CX23885_VMUX_TELEVISION,
294 .vmux = CX25840_VIN2_CH1 | 302 .vmux = CX25840_VIN2_CH1 |
@@ -313,6 +321,7 @@ struct cx23885_board cx23885_boards[] = {
313 .name = "GoTView X5 3D Hybrid", 321 .name = "GoTView X5 3D Hybrid",
314 .tuner_type = TUNER_XC5000, 322 .tuner_type = TUNER_XC5000,
315 .tuner_addr = 0x64, 323 .tuner_addr = 0x64,
324 .tuner_bus = 1,
316 .porta = CX23885_ANALOG_VIDEO, 325 .porta = CX23885_ANALOG_VIDEO,
317 .portb = CX23885_MPEG_DVB, 326 .portb = CX23885_MPEG_DVB,
318 .input = {{ 327 .input = {{
@@ -329,6 +338,21 @@ struct cx23885_board cx23885_boards[] = {
329 CX25840_SVIDEO_CHROMA4, 338 CX25840_SVIDEO_CHROMA4,
330 } }, 339 } },
331 }, 340 },
341 [CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF] = {
342 .ci_type = 2,
343 .name = "NetUP Dual DVB-T/C-CI RF",
344 .porta = CX23885_ANALOG_VIDEO,
345 .portb = CX23885_MPEG_DVB,
346 .portc = CX23885_MPEG_DVB,
347 .num_fds_portb = 2,
348 .num_fds_portc = 2,
349 .tuner_type = TUNER_XC5000,
350 .tuner_addr = 0x64,
351 .input = { {
352 .type = CX23885_VMUX_TELEVISION,
353 .vmux = CX25840_COMPOSITE1,
354 } },
355 },
332}; 356};
333const unsigned int cx23885_bcount = ARRAY_SIZE(cx23885_boards); 357const unsigned int cx23885_bcount = ARRAY_SIZE(cx23885_boards);
334 358
@@ -520,6 +544,10 @@ struct cx23885_subid cx23885_subids[] = {
520 .subvendor = 0x5654, 544 .subvendor = 0x5654,
521 .subdevice = 0x2390, 545 .subdevice = 0x2390,
522 .card = CX23885_BOARD_GOTVIEW_X5_3D_HYBRID, 546 .card = CX23885_BOARD_GOTVIEW_X5_3D_HYBRID,
547 }, {
548 .subvendor = 0x1b55,
549 .subdevice = 0xe2e4,
550 .card = CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF,
523 }, 551 },
524}; 552};
525const unsigned int cx23885_idcount = ARRAY_SIZE(cx23885_subids); 553const unsigned int cx23885_idcount = ARRAY_SIZE(cx23885_subids);
@@ -740,6 +768,9 @@ int cx23885_tuner_callback(void *priv, int component, int command, int arg)
740 /* Tuner Reset Command */ 768 /* Tuner Reset Command */
741 bitmask = 0x02; 769 bitmask = 0x02;
742 break; 770 break;
771 case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF:
772 altera_ci_tuner_reset(dev, port->nr);
773 break;
743 } 774 }
744 775
745 if (bitmask) { 776 if (bitmask) {
@@ -998,6 +1029,33 @@ void cx23885_gpio_setup(struct cx23885_dev *dev)
998 case CX23885_BOARD_GOTVIEW_X5_3D_HYBRID: 1029 case CX23885_BOARD_GOTVIEW_X5_3D_HYBRID:
999 cx_set(GP0_IO, 0x00010001); /* Bring the part out of reset */ 1030 cx_set(GP0_IO, 0x00010001); /* Bring the part out of reset */
1000 break; 1031 break;
1032 case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF:
1033 /* GPIO-0 ~INT in
1034 GPIO-1 TMS out
1035 GPIO-2 ~reset chips out
1036 GPIO-3 to GPIO-10 data/addr for CA in/out
1037 GPIO-11 ~CS out
1038 GPIO-12 ADDR out
1039 GPIO-13 ~WR out
1040 GPIO-14 ~RD out
1041 GPIO-15 ~RDY in
1042 GPIO-16 TCK out
1043 GPIO-17 TDO in
1044 GPIO-18 TDI out
1045 */
1046 cx_set(GP0_IO, 0x00060000); /* GPIO-1,2 as out */
1047 /* GPIO-0 as INT, reset & TMS low */
1048 cx_clear(GP0_IO, 0x00010006);
1049 mdelay(100);/* reset delay */
1050 cx_set(GP0_IO, 0x00000004); /* reset high */
1051 cx_write(MC417_CTL, 0x00000037);/* enable GPIO-3..18 pins */
1052 /* GPIO-17 is TDO in, GPIO-15 is ~RDY in, rest is out */
1053 cx_write(MC417_OEN, 0x00005000);
1054 /* ~RD, ~WR high; ADDR low; ~CS high */
1055 cx_write(MC417_RWD, 0x00000d00);
1056 /* enable irq */
1057 cx_write(GPIO_ISM, 0x00000000);/* INTERRUPTS active low*/
1058 break;
1001 } 1059 }
1002} 1060}
1003 1061
@@ -1113,6 +1171,31 @@ void cx23885_ir_fini(struct cx23885_dev *dev)
1113 } 1171 }
1114} 1172}
1115 1173
1174int netup_jtag_io(void *device, int tms, int tdi, int read_tdo)
1175{
1176 int data;
1177 int tdo = 0;
1178 struct cx23885_dev *dev = (struct cx23885_dev *)device;
1179 /*TMS*/
1180 data = ((cx_read(GP0_IO)) & (~0x00000002));
1181 data |= (tms ? 0x00020002 : 0x00020000);
1182 cx_write(GP0_IO, data);
1183
1184 /*TDI*/
1185 data = ((cx_read(MC417_RWD)) & (~0x0000a000));
1186 data |= (tdi ? 0x00008000 : 0);
1187 cx_write(MC417_RWD, data);
1188 if (read_tdo)
1189 tdo = (data & 0x00004000) ? 1 : 0; /*TDO*/
1190
1191 cx_write(MC417_RWD, data | 0x00002000);
1192 udelay(1);
1193 /*TCK*/
1194 cx_write(MC417_RWD, data);
1195
1196 return tdo;
1197}
1198
1116void cx23885_ir_pci_int_enable(struct cx23885_dev *dev) 1199void cx23885_ir_pci_int_enable(struct cx23885_dev *dev)
1117{ 1200{
1118 switch (dev->board) { 1201 switch (dev->board) {
@@ -1212,6 +1295,7 @@ void cx23885_card_setup(struct cx23885_dev *dev)
1212 ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO; 1295 ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
1213 break; 1296 break;
1214 case CX23885_BOARD_NETUP_DUAL_DVBS2_CI: 1297 case CX23885_BOARD_NETUP_DUAL_DVBS2_CI:
1298 case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF:
1215 ts1->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */ 1299 ts1->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */
1216 ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */ 1300 ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */
1217 ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO; 1301 ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
@@ -1271,6 +1355,7 @@ void cx23885_card_setup(struct cx23885_dev *dev)
1271 case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H: 1355 case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H:
1272 case CX23885_BOARD_COMPRO_VIDEOMATE_E650F: 1356 case CX23885_BOARD_COMPRO_VIDEOMATE_E650F:
1273 case CX23885_BOARD_NETUP_DUAL_DVBS2_CI: 1357 case CX23885_BOARD_NETUP_DUAL_DVBS2_CI:
1358 case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF:
1274 case CX23885_BOARD_COMPRO_VIDEOMATE_E800: 1359 case CX23885_BOARD_COMPRO_VIDEOMATE_E800:
1275 case CX23885_BOARD_HAUPPAUGE_HVR1850: 1360 case CX23885_BOARD_HAUPPAUGE_HVR1850:
1276 case CX23885_BOARD_MYGICA_X8506: 1361 case CX23885_BOARD_MYGICA_X8506:
@@ -1293,6 +1378,29 @@ void cx23885_card_setup(struct cx23885_dev *dev)
1293 case CX23885_BOARD_NETUP_DUAL_DVBS2_CI: 1378 case CX23885_BOARD_NETUP_DUAL_DVBS2_CI:
1294 netup_initialize(dev); 1379 netup_initialize(dev);
1295 break; 1380 break;
1381 case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF: {
1382 int ret;
1383 const struct firmware *fw;
1384 const char *filename = "dvb-netup-altera-01.fw";
1385 char *action = "configure";
1386 struct altera_config netup_config = {
1387 .dev = dev,
1388 .action = action,
1389 .jtag_io = netup_jtag_io,
1390 };
1391
1392 netup_initialize(dev);
1393
1394 ret = request_firmware(&fw, filename, &dev->pci->dev);
1395 if (ret != 0)
1396 printk(KERN_ERR "did not find the firmware file. (%s) "
1397 "Please see linux/Documentation/dvb/ for more details "
1398 "on firmware-problems.", filename);
1399 else
1400 altera_init(&netup_config, fw);
1401
1402 break;
1403 }
1296 } 1404 }
1297} 1405}
1298 1406