~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to drivers/media/video/cx23885/cx23885-cards.c

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
#include <linux/pci.h>
25
25
#include <linux/delay.h>
26
26
#include <media/cx25840.h>
 
27
#include <linux/firmware.h>
27
28
 
 
29
#include "../../../staging/altera-stapl/altera.h"
28
30
#include "cx23885.h"
29
31
#include "tuner-xc2028.h"
30
32
#include "netup-init.h"
 
33
#include "altera-ci.h"
 
34
#include "xc5000.h"
31
35
#include "cx23888-ir.h"
32
36
 
33
37
static unsigned int enable_885_ir;
90
94
                .portc          = CX23885_MPEG_DVB,
91
95
                .tuner_type     = TUNER_PHILIPS_TDA8290,
92
96
                .tuner_addr     = 0x42, /* 0x84 >> 1 */
 
97
                .tuner_bus      = 1,
93
98
                .input          = {{
94
99
                        .type   = CX23885_VMUX_TELEVISION,
95
100
                        .vmux   =       CX25840_VIN7_CH3 |
187
192
                .portb          = CX23885_MPEG_DVB,
188
193
        },
189
194
        [CX23885_BOARD_NETUP_DUAL_DVBS2_CI] = {
190
 
                .cimax          = 1,
 
195
                .ci_type        = 1,
191
196
                .name           = "NetUP Dual DVB-S2 CI",
192
197
                .portb          = CX23885_MPEG_DVB,
193
198
                .portc          = CX23885_MPEG_DVB,
212
217
                .name           = "Mygica X8506 DMB-TH",
213
218
                .tuner_type = TUNER_XC5000,
214
219
                .tuner_addr = 0x61,
 
220
                .tuner_bus      = 1,
215
221
                .porta          = CX23885_ANALOG_VIDEO,
216
222
                .portb          = CX23885_MPEG_DVB,
217
223
                .input          = {
241
247
                .name           = "Magic-Pro ProHDTV Extreme 2",
242
248
                .tuner_type = TUNER_XC5000,
243
249
                .tuner_addr = 0x61,
 
250
                .tuner_bus      = 1,
244
251
                .porta          = CX23885_ANALOG_VIDEO,
245
252
                .portb          = CX23885_MPEG_DVB,
246
253
                .input          = {
289
296
                .porta          = CX23885_ANALOG_VIDEO,
290
297
                .tuner_type     = TUNER_XC2028,
291
298
                .tuner_addr     = 0x61,
 
299
                .tuner_bus      = 1,
292
300
                .input          = {{
293
301
                        .type   = CX23885_VMUX_TELEVISION,
294
302
                        .vmux   = CX25840_VIN2_CH1 |
313
321
                .name           = "GoTView X5 3D Hybrid",
314
322
                .tuner_type     = TUNER_XC5000,
315
323
                .tuner_addr     = 0x64,
 
324
                .tuner_bus      = 1,
316
325
                .porta          = CX23885_ANALOG_VIDEO,
317
326
                .portb          = CX23885_MPEG_DVB,
318
327
                .input          = {{
329
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
};
333
357
const unsigned int cx23885_bcount = ARRAY_SIZE(cx23885_boards);
334
358
 
520
544
                .subvendor = 0x5654,
521
545
                .subdevice = 0x2390,
522
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
};
525
553
const unsigned int cx23885_idcount = ARRAY_SIZE(cx23885_subids);
740
768
                /* Tuner Reset Command */
741
769
                bitmask = 0x02;
742
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
776
        if (bitmask) {
998
1029
        case CX23885_BOARD_GOTVIEW_X5_3D_HYBRID:
999
1030
                cx_set(GP0_IO, 0x00010001); /* Bring the part out of reset */
1000
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
1171
        }
1114
1172
}
1115
1173
 
 
1174
int 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
 
1116
1199
void cx23885_ir_pci_int_enable(struct cx23885_dev *dev)
1117
1200
{
1118
1201
        switch (dev->board) {
1212
1295
                ts1->src_sel_val   = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
1213
1296
                break;
1214
1297
        case CX23885_BOARD_NETUP_DUAL_DVBS2_CI:
 
1298
        case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF:
1215
1299
                ts1->gen_ctrl_val  = 0xc; /* Serial bus + punctured clock */
1216
1300
                ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */
1217
1301
                ts1->src_sel_val   = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
1271
1355
        case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H:
1272
1356
        case CX23885_BOARD_COMPRO_VIDEOMATE_E650F:
1273
1357
        case CX23885_BOARD_NETUP_DUAL_DVBS2_CI:
 
1358
        case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF:
1274
1359
        case CX23885_BOARD_COMPRO_VIDEOMATE_E800:
1275
1360
        case CX23885_BOARD_HAUPPAUGE_HVR1850:
1276
1361
        case CX23885_BOARD_MYGICA_X8506:
1293
1378
        case CX23885_BOARD_NETUP_DUAL_DVBS2_CI:
1294
1379
                netup_initialize(dev);
1295
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
                release_firmware(fw);
 
1403
                break;
 
1404
        }
1296
1405
        }
1297
1406
}
1298
1407