blob: db99ca2613ba422d20c60afcbe34a4750a9876c0 [file] [log] [blame]
Steven Tothd19770e2007-03-11 20:44:05 -03001/*
2 * Driver for the Conexant CX23885 PCIe bridge
3 *
Steven Toth6d897612008-09-03 17:12:12 -03004 * Copyright (c) 2006 Steven Toth <stoth@linuxtv.org>
Steven Tothd19770e2007-03-11 20:44:05 -03005 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 *
15 * GNU General Public License for more details.
Steven Tothd19770e2007-03-11 20:44:05 -030016 */
17
18#include <linux/init.h>
19#include <linux/module.h>
20#include <linux/pci.h>
21#include <linux/delay.h>
Steven Toth7b888012008-01-10 03:40:49 -030022#include <media/cx25840.h>
Igor M. Liplianin78db8542011-01-25 17:04:00 -030023#include <linux/firmware.h>
Igor M. Liplianincff4fa82011-09-23 11:17:41 -030024#include <misc/altera.h>
Steven Tothd19770e2007-03-11 20:44:05 -030025
26#include "cx23885.h"
Steven Toth90a71b12008-08-04 21:38:46 -030027#include "tuner-xc2028.h"
Abylay Ospanb8f0d302011-07-14 05:20:29 -030028#include "netup-eeprom.h"
Igor M. Liplianin5a23b072009-03-03 12:06:09 -030029#include "netup-init.h"
Igor M. Liplianin78db8542011-01-25 17:04:00 -030030#include "altera-ci.h"
istvan_v@mailbox.hu0cf8af52011-07-11 10:58:35 -030031#include "xc4000.h"
Igor M. Liplianin78db8542011-01-25 17:04:00 -030032#include "xc5000.h"
Andy Walls29f8a0a2009-09-26 23:17:30 -030033#include "cx23888-ir.h"
Steven Tothd19770e2007-03-11 20:44:05 -030034
Anton Nurkin89343052012-08-14 01:35:44 -030035static unsigned int netup_card_rev = 4;
Abylay Ospan2d124212011-07-18 04:14:28 -030036module_param(netup_card_rev, int, 0644);
37MODULE_PARM_DESC(netup_card_rev,
38 "NetUP Dual DVB-T/C CI card revision");
Andy Wallsfa647f22010-07-19 21:22:05 -030039static unsigned int enable_885_ir;
40module_param(enable_885_ir, int, 0644);
41MODULE_PARM_DESC(enable_885_ir,
42 "Enable integrated IR controller for supported\n"
43 "\t\t CX2388[57] boards that are wired for it:\n"
44 "\t\t\tHVR-1250 (reported safe)\n"
Djuri Baars076f0e32012-07-28 09:01:38 -030045 "\t\t\tTerraTec Cinergy T PCIe Dual (not well tested, appears to be safe)\n"
Andy Wallsfa647f22010-07-19 21:22:05 -030046 "\t\t\tTeVii S470 (reported unsafe)\n"
47 "\t\t This can cause an interrupt storm with some cards.\n"
48 "\t\t Default: 0 [Disabled]");
49
Steven Tothd19770e2007-03-11 20:44:05 -030050/* ------------------------------------------------------------------ */
51/* board config info */
52
53struct cx23885_board cx23885_boards[] = {
54 [CX23885_BOARD_UNKNOWN] = {
55 .name = "UNKNOWN/GENERIC",
Steven Tothc7712612008-01-10 02:24:27 -030056 /* Ensure safe default for unknown boards */
57 .clk_freq = 0,
Steven Tothd19770e2007-03-11 20:44:05 -030058 .input = {{
59 .type = CX23885_VMUX_COMPOSITE1,
60 .vmux = 0,
Steven Toth9c8ced52008-10-16 20:18:44 -030061 }, {
Steven Tothd19770e2007-03-11 20:44:05 -030062 .type = CX23885_VMUX_COMPOSITE2,
63 .vmux = 1,
Steven Toth9c8ced52008-10-16 20:18:44 -030064 }, {
Steven Tothd19770e2007-03-11 20:44:05 -030065 .type = CX23885_VMUX_COMPOSITE3,
66 .vmux = 2,
Steven Toth9c8ced52008-10-16 20:18:44 -030067 }, {
Steven Tothd19770e2007-03-11 20:44:05 -030068 .type = CX23885_VMUX_COMPOSITE4,
69 .vmux = 3,
Steven Toth9c8ced52008-10-16 20:18:44 -030070 } },
Steven Tothd19770e2007-03-11 20:44:05 -030071 },
72 [CX23885_BOARD_HAUPPAUGE_HVR1800lp] = {
73 .name = "Hauppauge WinTV-HVR1800lp",
Steven Tothd19770e2007-03-11 20:44:05 -030074 .portc = CX23885_MPEG_DVB,
75 .input = {{
76 .type = CX23885_VMUX_TELEVISION,
77 .vmux = 0,
78 .gpio0 = 0xff00,
Steven Toth9c8ced52008-10-16 20:18:44 -030079 }, {
Steven Tothd19770e2007-03-11 20:44:05 -030080 .type = CX23885_VMUX_DEBUG,
81 .vmux = 0,
82 .gpio0 = 0xff01,
Steven Toth9c8ced52008-10-16 20:18:44 -030083 }, {
Steven Tothd19770e2007-03-11 20:44:05 -030084 .type = CX23885_VMUX_COMPOSITE1,
85 .vmux = 1,
86 .gpio0 = 0xff02,
Steven Toth9c8ced52008-10-16 20:18:44 -030087 }, {
Steven Tothd19770e2007-03-11 20:44:05 -030088 .type = CX23885_VMUX_SVIDEO,
89 .vmux = 2,
90 .gpio0 = 0xff02,
Steven Toth9c8ced52008-10-16 20:18:44 -030091 } },
Steven Tothd19770e2007-03-11 20:44:05 -030092 },
93 [CX23885_BOARD_HAUPPAUGE_HVR1800] = {
94 .name = "Hauppauge WinTV-HVR1800",
Steven Toth7b888012008-01-10 03:40:49 -030095 .porta = CX23885_ANALOG_VIDEO,
Steven Totha589b662008-01-13 23:44:47 -030096 .portb = CX23885_MPEG_ENCODER,
Steven Tothd19770e2007-03-11 20:44:05 -030097 .portc = CX23885_MPEG_DVB,
Steven Toth7b888012008-01-10 03:40:49 -030098 .tuner_type = TUNER_PHILIPS_TDA8290,
99 .tuner_addr = 0x42, /* 0x84 >> 1 */
Igor M. Liplianin557f48d2011-01-25 17:05:00 -0300100 .tuner_bus = 1,
Steven Tothd19770e2007-03-11 20:44:05 -0300101 .input = {{
102 .type = CX23885_VMUX_TELEVISION,
Steven Toth7b888012008-01-10 03:40:49 -0300103 .vmux = CX25840_VIN7_CH3 |
104 CX25840_VIN5_CH2 |
105 CX25840_VIN2_CH1,
Steven Toth33cdeb32011-10-10 11:09:55 -0300106 .amux = CX25840_AUDIO8,
Steven Toth7b888012008-01-10 03:40:49 -0300107 .gpio0 = 0,
Steven Toth9c8ced52008-10-16 20:18:44 -0300108 }, {
Steven Tothd19770e2007-03-11 20:44:05 -0300109 .type = CX23885_VMUX_COMPOSITE1,
Steven Toth7b888012008-01-10 03:40:49 -0300110 .vmux = CX25840_VIN7_CH3 |
111 CX25840_VIN4_CH2 |
112 CX25840_VIN6_CH1,
Steven Toth33cdeb32011-10-10 11:09:55 -0300113 .amux = CX25840_AUDIO7,
Steven Toth7b888012008-01-10 03:40:49 -0300114 .gpio0 = 0,
Steven Toth9c8ced52008-10-16 20:18:44 -0300115 }, {
Steven Tothd19770e2007-03-11 20:44:05 -0300116 .type = CX23885_VMUX_SVIDEO,
Steven Toth7b888012008-01-10 03:40:49 -0300117 .vmux = CX25840_VIN7_CH3 |
118 CX25840_VIN4_CH2 |
119 CX25840_VIN8_CH1 |
120 CX25840_SVIDEO_ON,
Steven Toth33cdeb32011-10-10 11:09:55 -0300121 .amux = CX25840_AUDIO7,
Steven Toth7b888012008-01-10 03:40:49 -0300122 .gpio0 = 0,
Steven Toth9c8ced52008-10-16 20:18:44 -0300123 } },
Steven Tothd19770e2007-03-11 20:44:05 -0300124 },
Steven Totha77743b2007-08-22 21:01:20 -0300125 [CX23885_BOARD_HAUPPAUGE_HVR1250] = {
126 .name = "Hauppauge WinTV-HVR1250",
Devin Heitmuellerd214ddc2012-07-01 16:15:13 -0300127 .porta = CX23885_ANALOG_VIDEO,
Steven Totha77743b2007-08-22 21:01:20 -0300128 .portc = CX23885_MPEG_DVB,
Devin Heitmuellerd214ddc2012-07-01 16:15:13 -0300129#ifdef MT2131_NO_ANALOG_SUPPORT_YET
130 .tuner_type = TUNER_PHILIPS_TDA8290,
131 .tuner_addr = 0x42, /* 0x84 >> 1 */
132 .tuner_bus = 1,
133#endif
134 .force_bff = 1,
Steven Totha77743b2007-08-22 21:01:20 -0300135 .input = {{
Devin Heitmuellerd214ddc2012-07-01 16:15:13 -0300136#ifdef MT2131_NO_ANALOG_SUPPORT_YET
Steven Totha77743b2007-08-22 21:01:20 -0300137 .type = CX23885_VMUX_TELEVISION,
Devin Heitmuellerd214ddc2012-07-01 16:15:13 -0300138 .vmux = CX25840_VIN7_CH3 |
139 CX25840_VIN5_CH2 |
140 CX25840_VIN2_CH1,
141 .amux = CX25840_AUDIO8,
Steven Totha77743b2007-08-22 21:01:20 -0300142 .gpio0 = 0xff00,
Steven Toth9c8ced52008-10-16 20:18:44 -0300143 }, {
Devin Heitmuellerd214ddc2012-07-01 16:15:13 -0300144#endif
Steven Totha77743b2007-08-22 21:01:20 -0300145 .type = CX23885_VMUX_COMPOSITE1,
Devin Heitmuellerd214ddc2012-07-01 16:15:13 -0300146 .vmux = CX25840_VIN7_CH3 |
147 CX25840_VIN4_CH2 |
148 CX25840_VIN6_CH1,
149 .amux = CX25840_AUDIO7,
Steven Totha77743b2007-08-22 21:01:20 -0300150 .gpio0 = 0xff02,
Steven Toth9c8ced52008-10-16 20:18:44 -0300151 }, {
Steven Totha77743b2007-08-22 21:01:20 -0300152 .type = CX23885_VMUX_SVIDEO,
Devin Heitmuellerd214ddc2012-07-01 16:15:13 -0300153 .vmux = CX25840_VIN7_CH3 |
154 CX25840_VIN4_CH2 |
155 CX25840_VIN8_CH1 |
156 CX25840_SVIDEO_ON,
157 .amux = CX25840_AUDIO7,
Steven Totha77743b2007-08-22 21:01:20 -0300158 .gpio0 = 0xff02,
Steven Toth9c8ced52008-10-16 20:18:44 -0300159 } },
Steven Totha77743b2007-08-22 21:01:20 -0300160 },
Michael Krufky9bc37ca2007-09-08 15:17:13 -0300161 [CX23885_BOARD_DVICO_FUSIONHDTV_5_EXP] = {
162 .name = "DViCO FusionHDTV5 Express",
Steven Totha6a3f142007-09-08 21:31:56 -0300163 .portb = CX23885_MPEG_DVB,
Michael Krufky9bc37ca2007-09-08 15:17:13 -0300164 },
Steven Tothd1987d52007-12-18 01:57:06 -0300165 [CX23885_BOARD_HAUPPAUGE_HVR1500Q] = {
166 .name = "Hauppauge WinTV-HVR1500Q",
167 .portc = CX23885_MPEG_DVB,
168 },
Michael Krufky07b4a832007-12-18 01:09:11 -0300169 [CX23885_BOARD_HAUPPAUGE_HVR1500] = {
170 .name = "Hauppauge WinTV-HVR1500",
Mijhail Moreyra18d64472011-10-10 11:09:53 -0300171 .porta = CX23885_ANALOG_VIDEO,
Michael Krufky07b4a832007-12-18 01:09:11 -0300172 .portc = CX23885_MPEG_DVB,
Mijhail Moreyra18d64472011-10-10 11:09:53 -0300173 .tuner_type = TUNER_XC2028,
174 .tuner_addr = 0x61, /* 0xc2 >> 1 */
175 .input = {{
176 .type = CX23885_VMUX_TELEVISION,
177 .vmux = CX25840_VIN7_CH3 |
178 CX25840_VIN5_CH2 |
179 CX25840_VIN2_CH1,
180 .gpio0 = 0,
181 }, {
182 .type = CX23885_VMUX_COMPOSITE1,
183 .vmux = CX25840_VIN7_CH3 |
184 CX25840_VIN4_CH2 |
185 CX25840_VIN6_CH1,
186 .gpio0 = 0,
187 }, {
188 .type = CX23885_VMUX_SVIDEO,
189 .vmux = CX25840_VIN7_CH3 |
190 CX25840_VIN4_CH2 |
191 CX25840_VIN8_CH1 |
192 CX25840_SVIDEO_ON,
193 .gpio0 = 0,
194 } },
Michael Krufky07b4a832007-12-18 01:09:11 -0300195 },
Steven Tothb3ea0162008-04-19 01:14:19 -0300196 [CX23885_BOARD_HAUPPAUGE_HVR1200] = {
197 .name = "Hauppauge WinTV-HVR1200",
198 .portc = CX23885_MPEG_DVB,
199 },
Steven Totha780a312008-04-19 01:25:52 -0300200 [CX23885_BOARD_HAUPPAUGE_HVR1700] = {
201 .name = "Hauppauge WinTV-HVR1700",
202 .portc = CX23885_MPEG_DVB,
203 },
Steven Toth66762372008-04-22 15:38:26 -0300204 [CX23885_BOARD_HAUPPAUGE_HVR1400] = {
205 .name = "Hauppauge WinTV-HVR1400",
206 .portc = CX23885_MPEG_DVB,
207 },
Michael Krufky335377b2008-05-07 01:43:10 -0300208 [CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP] = {
209 .name = "DViCO FusionHDTV7 Dual Express",
Steven Tothaaadeac2008-06-30 20:58:38 -0300210 .portb = CX23885_MPEG_DVB,
Michael Krufky335377b2008-05-07 01:43:10 -0300211 .portc = CX23885_MPEG_DVB,
212 },
Steven Tothaef2d182008-08-04 21:39:53 -0300213 [CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP] = {
214 .name = "DViCO FusionHDTV DVB-T Dual Express",
215 .portb = CX23885_MPEG_DVB,
216 .portc = CX23885_MPEG_DVB,
217 },
Steven Toth4c56b042008-08-12 13:30:03 -0300218 [CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H] = {
219 .name = "Leadtek Winfast PxDVR3200 H",
220 .portc = CX23885_MPEG_DVB,
221 },
Anca Emanuel642ca1a2013-09-13 11:28:12 -0300222 [CX23885_BOARD_LEADTEK_WINFAST_PXPVR2200] = {
223 .name = "Leadtek Winfast PxPVR2200",
224 .porta = CX23885_ANALOG_VIDEO,
225 .tuner_type = TUNER_XC2028,
226 .tuner_addr = 0x61,
227 .tuner_bus = 1,
228 .input = {{
229 .type = CX23885_VMUX_TELEVISION,
230 .vmux = CX25840_VIN2_CH1 |
231 CX25840_VIN5_CH2,
232 .amux = CX25840_AUDIO8,
233 .gpio0 = 0x704040,
234 }, {
235 .type = CX23885_VMUX_COMPOSITE1,
236 .vmux = CX25840_COMPOSITE1,
237 .amux = CX25840_AUDIO7,
238 .gpio0 = 0x704040,
239 }, {
240 .type = CX23885_VMUX_SVIDEO,
241 .vmux = CX25840_SVIDEO_LUMA3 |
242 CX25840_SVIDEO_CHROMA4,
243 .amux = CX25840_AUDIO7,
244 .gpio0 = 0x704040,
245 }, {
246 .type = CX23885_VMUX_COMPONENT,
247 .vmux = CX25840_VIN7_CH1 |
248 CX25840_VIN6_CH2 |
249 CX25840_VIN8_CH3 |
250 CX25840_COMPONENT_ON,
251 .amux = CX25840_AUDIO7,
252 .gpio0 = 0x704040,
253 } },
254 },
istvan_v@mailbox.hu0cf8af52011-07-11 10:58:35 -0300255 [CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H_XC4000] = {
256 .name = "Leadtek Winfast PxDVR3200 H XC4000",
257 .porta = CX23885_ANALOG_VIDEO,
258 .portc = CX23885_MPEG_DVB,
259 .tuner_type = TUNER_XC4000,
260 .tuner_addr = 0x61,
Miroslav Slugen9ee85372011-12-11 20:19:34 -0300261 .radio_type = UNSET,
262 .radio_addr = ADDR_UNSET,
istvan_v@mailbox.hu0cf8af52011-07-11 10:58:35 -0300263 .input = {{
264 .type = CX23885_VMUX_TELEVISION,
265 .vmux = CX25840_VIN2_CH1 |
266 CX25840_VIN5_CH2 |
267 CX25840_NONE0_CH3,
268 }, {
269 .type = CX23885_VMUX_COMPOSITE1,
270 .vmux = CX25840_COMPOSITE1,
271 }, {
272 .type = CX23885_VMUX_SVIDEO,
273 .vmux = CX25840_SVIDEO_LUMA3 |
274 CX25840_SVIDEO_CHROMA4,
275 }, {
276 .type = CX23885_VMUX_COMPONENT,
277 .vmux = CX25840_VIN7_CH1 |
278 CX25840_VIN6_CH2 |
279 CX25840_VIN8_CH3 |
280 CX25840_COMPONENT_ON,
281 } },
282 },
Igor M. Liplianin9bb1b7e2008-11-23 14:11:16 -0300283 [CX23885_BOARD_COMPRO_VIDEOMATE_E650F] = {
284 .name = "Compro VideoMate E650F",
285 .portc = CX23885_MPEG_DVB,
286 },
Igor M. Liplianin96318d02009-01-17 12:11:20 -0300287 [CX23885_BOARD_TBS_6920] = {
288 .name = "TurboSight TBS 6920",
289 .portb = CX23885_MPEG_DVB,
290 },
Luis Alvese6001482013-10-01 22:11:35 -0300291 [CX23885_BOARD_TBS_6980] = {
292 .name = "TurboSight TBS 6980",
293 .portb = CX23885_MPEG_DVB,
294 .portc = CX23885_MPEG_DVB,
295 },
296 [CX23885_BOARD_TBS_6981] = {
297 .name = "TurboSight TBS 6981",
298 .portb = CX23885_MPEG_DVB,
299 .portc = CX23885_MPEG_DVB,
300 },
Igor M. Liplianin579943f2009-01-17 12:18:26 -0300301 [CX23885_BOARD_TEVII_S470] = {
302 .name = "TeVii S470",
303 .portb = CX23885_MPEG_DVB,
304 },
Igor M. Liplianinc9b8b042009-01-17 12:23:31 -0300305 [CX23885_BOARD_DVBWORLD_2005] = {
306 .name = "DVBWorld DVB-S2 2005",
307 .portb = CX23885_MPEG_DVB,
308 },
Igor M. Liplianin5a23b072009-03-03 12:06:09 -0300309 [CX23885_BOARD_NETUP_DUAL_DVBS2_CI] = {
Igor M. Liplianin78db8542011-01-25 17:04:00 -0300310 .ci_type = 1,
Igor M. Liplianin5a23b072009-03-03 12:06:09 -0300311 .name = "NetUP Dual DVB-S2 CI",
312 .portb = CX23885_MPEG_DVB,
313 .portc = CX23885_MPEG_DVB,
314 },
Steven Toth2074dff2009-05-02 11:39:46 -0300315 [CX23885_BOARD_HAUPPAUGE_HVR1270] = {
316 .name = "Hauppauge WinTV-HVR1270",
Michael Krufkya5dbf452009-05-03 23:27:02 -0300317 .portc = CX23885_MPEG_DVB,
Steven Toth2074dff2009-05-02 11:39:46 -0300318 },
Michael Krufkyd099bec2009-05-08 22:39:24 -0300319 [CX23885_BOARD_HAUPPAUGE_HVR1275] = {
320 .name = "Hauppauge WinTV-HVR1275",
321 .portc = CX23885_MPEG_DVB,
322 },
Michael Krufky19bc5792009-05-08 16:05:29 -0300323 [CX23885_BOARD_HAUPPAUGE_HVR1255] = {
324 .name = "Hauppauge WinTV-HVR1255",
Devin Heitmueller0ac60ac2012-07-01 16:15:14 -0300325 .porta = CX23885_ANALOG_VIDEO,
Michael Krufky19bc5792009-05-08 16:05:29 -0300326 .portc = CX23885_MPEG_DVB,
Devin Heitmueller0ac60ac2012-07-01 16:15:14 -0300327 .tuner_type = TUNER_ABSENT,
328 .tuner_addr = 0x42, /* 0x84 >> 1 */
329 .force_bff = 1,
330 .input = {{
331 .type = CX23885_VMUX_TELEVISION,
332 .vmux = CX25840_VIN7_CH3 |
333 CX25840_VIN5_CH2 |
334 CX25840_VIN2_CH1 |
335 CX25840_DIF_ON,
336 .amux = CX25840_AUDIO8,
337 }, {
338 .type = CX23885_VMUX_COMPOSITE1,
339 .vmux = CX25840_VIN7_CH3 |
340 CX25840_VIN4_CH2 |
341 CX25840_VIN6_CH1,
342 .amux = CX25840_AUDIO7,
343 }, {
344 .type = CX23885_VMUX_SVIDEO,
345 .vmux = CX25840_VIN7_CH3 |
346 CX25840_VIN4_CH2 |
347 CX25840_VIN8_CH1 |
348 CX25840_SVIDEO_ON,
349 .amux = CX25840_AUDIO7,
350 } },
351 },
352 [CX23885_BOARD_HAUPPAUGE_HVR1255_22111] = {
353 .name = "Hauppauge WinTV-HVR1255",
354 .porta = CX23885_ANALOG_VIDEO,
355 .portc = CX23885_MPEG_DVB,
356 .tuner_type = TUNER_ABSENT,
357 .tuner_addr = 0x42, /* 0x84 >> 1 */
358 .force_bff = 1,
359 .input = {{
360 .type = CX23885_VMUX_TELEVISION,
361 .vmux = CX25840_VIN7_CH3 |
362 CX25840_VIN5_CH2 |
363 CX25840_VIN2_CH1 |
364 CX25840_DIF_ON,
365 .amux = CX25840_AUDIO8,
366 }, {
367 .type = CX23885_VMUX_SVIDEO,
368 .vmux = CX25840_VIN7_CH3 |
369 CX25840_VIN4_CH2 |
370 CX25840_VIN8_CH1 |
371 CX25840_SVIDEO_ON,
372 .amux = CX25840_AUDIO7,
373 } },
Michael Krufky19bc5792009-05-08 16:05:29 -0300374 },
Michael Krufky6b926ec2009-05-12 17:32:17 -0300375 [CX23885_BOARD_HAUPPAUGE_HVR1210] = {
376 .name = "Hauppauge WinTV-HVR1210",
377 .portc = CX23885_MPEG_DVB,
378 },
David Wong493b7122009-05-18 05:25:49 -0300379 [CX23885_BOARD_MYGICA_X8506] = {
380 .name = "Mygica X8506 DMB-TH",
David T.L. Wong6f0d8c02009-10-21 13:15:30 -0300381 .tuner_type = TUNER_XC5000,
382 .tuner_addr = 0x61,
Igor M. Liplianin557f48d2011-01-25 17:05:00 -0300383 .tuner_bus = 1,
David T.L. Wongbc1548a2009-10-21 11:09:28 -0300384 .porta = CX23885_ANALOG_VIDEO,
David Wong493b7122009-05-18 05:25:49 -0300385 .portb = CX23885_MPEG_DVB,
David T.L. Wongbc1548a2009-10-21 11:09:28 -0300386 .input = {
387 {
David T.L. Wong6f0d8c02009-10-21 13:15:30 -0300388 .type = CX23885_VMUX_TELEVISION,
389 .vmux = CX25840_COMPOSITE2,
390 },
391 {
David T.L. Wongbc1548a2009-10-21 11:09:28 -0300392 .type = CX23885_VMUX_COMPOSITE1,
393 .vmux = CX25840_COMPOSITE8,
394 },
395 {
396 .type = CX23885_VMUX_SVIDEO,
397 .vmux = CX25840_SVIDEO_LUMA3 |
398 CX25840_SVIDEO_CHROMA4,
399 },
400 {
401 .type = CX23885_VMUX_COMPONENT,
402 .vmux = CX25840_COMPONENT_ON |
403 CX25840_VIN1_CH1 |
404 CX25840_VIN6_CH2 |
405 CX25840_VIN7_CH3,
406 },
407 },
David Wong493b7122009-05-18 05:25:49 -0300408 },
David Wong2365b2d2009-06-17 01:38:12 -0300409 [CX23885_BOARD_MAGICPRO_PROHDTVE2] = {
410 .name = "Magic-Pro ProHDTV Extreme 2",
David T.L. Wong6f0d8c02009-10-21 13:15:30 -0300411 .tuner_type = TUNER_XC5000,
412 .tuner_addr = 0x61,
Igor M. Liplianin557f48d2011-01-25 17:05:00 -0300413 .tuner_bus = 1,
David T.L. Wongbc1548a2009-10-21 11:09:28 -0300414 .porta = CX23885_ANALOG_VIDEO,
David Wong2365b2d2009-06-17 01:38:12 -0300415 .portb = CX23885_MPEG_DVB,
David T.L. Wongbc1548a2009-10-21 11:09:28 -0300416 .input = {
417 {
David T.L. Wong6f0d8c02009-10-21 13:15:30 -0300418 .type = CX23885_VMUX_TELEVISION,
419 .vmux = CX25840_COMPOSITE2,
420 },
421 {
David T.L. Wongbc1548a2009-10-21 11:09:28 -0300422 .type = CX23885_VMUX_COMPOSITE1,
423 .vmux = CX25840_COMPOSITE8,
424 },
425 {
426 .type = CX23885_VMUX_SVIDEO,
427 .vmux = CX25840_SVIDEO_LUMA3 |
428 CX25840_SVIDEO_CHROMA4,
429 },
430 {
431 .type = CX23885_VMUX_COMPONENT,
432 .vmux = CX25840_COMPONENT_ON |
433 CX25840_VIN1_CH1 |
434 CX25840_VIN6_CH2 |
435 CX25840_VIN7_CH3,
436 },
437 },
David Wong2365b2d2009-06-17 01:38:12 -0300438 },
Steven Toth136973802009-07-20 15:37:25 -0300439 [CX23885_BOARD_HAUPPAUGE_HVR1850] = {
440 .name = "Hauppauge WinTV-HVR1850",
Steven Toth35045132012-01-04 21:08:35 -0300441 .porta = CX23885_ANALOG_VIDEO,
Steven Toth136973802009-07-20 15:37:25 -0300442 .portb = CX23885_MPEG_ENCODER,
443 .portc = CX23885_MPEG_DVB,
Steven Toth35045132012-01-04 21:08:35 -0300444 .tuner_type = TUNER_ABSENT,
445 .tuner_addr = 0x42, /* 0x84 >> 1 */
446 .force_bff = 1,
447 .input = {{
448 .type = CX23885_VMUX_TELEVISION,
449 .vmux = CX25840_VIN7_CH3 |
450 CX25840_VIN5_CH2 |
451 CX25840_VIN2_CH1 |
452 CX25840_DIF_ON,
453 .amux = CX25840_AUDIO8,
454 }, {
455 .type = CX23885_VMUX_COMPOSITE1,
456 .vmux = CX25840_VIN7_CH3 |
457 CX25840_VIN4_CH2 |
458 CX25840_VIN6_CH1,
459 .amux = CX25840_AUDIO7,
460 }, {
461 .type = CX23885_VMUX_SVIDEO,
462 .vmux = CX25840_VIN7_CH3 |
463 CX25840_VIN4_CH2 |
464 CX25840_VIN8_CH1 |
465 CX25840_SVIDEO_ON,
466 .amux = CX25840_AUDIO7,
467 } },
Steven Toth136973802009-07-20 15:37:25 -0300468 },
Vladimir Geroy34e383d2009-09-18 18:55:47 -0300469 [CX23885_BOARD_COMPRO_VIDEOMATE_E800] = {
470 .name = "Compro VideoMate E800",
471 .portc = CX23885_MPEG_DVB,
472 },
Michael Krufkyaee0b242009-11-11 01:52:45 -0300473 [CX23885_BOARD_HAUPPAUGE_HVR1290] = {
474 .name = "Hauppauge WinTV-HVR1290",
475 .portc = CX23885_MPEG_DVB,
476 },
David T. L. Wongea5697f2009-10-26 08:54:04 -0300477 [CX23885_BOARD_MYGICA_X8558PRO] = {
478 .name = "Mygica X8558 PRO DMB-TH",
479 .portb = CX23885_MPEG_DVB,
480 .portc = CX23885_MPEG_DVB,
481 },
Kusanagi Kouichi0b32d652010-01-22 04:55:28 -0300482 [CX23885_BOARD_LEADTEK_WINFAST_PXTV1200] = {
483 .name = "LEADTEK WinFast PxTV1200",
484 .porta = CX23885_ANALOG_VIDEO,
485 .tuner_type = TUNER_XC2028,
486 .tuner_addr = 0x61,
Igor M. Liplianin557f48d2011-01-25 17:05:00 -0300487 .tuner_bus = 1,
Kusanagi Kouichi0b32d652010-01-22 04:55:28 -0300488 .input = {{
489 .type = CX23885_VMUX_TELEVISION,
490 .vmux = CX25840_VIN2_CH1 |
491 CX25840_VIN5_CH2 |
492 CX25840_NONE0_CH3,
493 }, {
494 .type = CX23885_VMUX_COMPOSITE1,
495 .vmux = CX25840_COMPOSITE1,
496 }, {
497 .type = CX23885_VMUX_SVIDEO,
498 .vmux = CX25840_SVIDEO_LUMA3 |
499 CX25840_SVIDEO_CHROMA4,
500 }, {
501 .type = CX23885_VMUX_COMPONENT,
502 .vmux = CX25840_VIN7_CH1 |
503 CX25840_VIN6_CH2 |
504 CX25840_VIN8_CH3 |
505 CX25840_COMPONENT_ON,
506 } },
507 },
Alexey Chernov9028f582010-12-06 17:09:53 -0300508 [CX23885_BOARD_GOTVIEW_X5_3D_HYBRID] = {
509 .name = "GoTView X5 3D Hybrid",
510 .tuner_type = TUNER_XC5000,
511 .tuner_addr = 0x64,
Igor M. Liplianin557f48d2011-01-25 17:05:00 -0300512 .tuner_bus = 1,
Alexey Chernov9028f582010-12-06 17:09:53 -0300513 .porta = CX23885_ANALOG_VIDEO,
514 .portb = CX23885_MPEG_DVB,
515 .input = {{
516 .type = CX23885_VMUX_TELEVISION,
517 .vmux = CX25840_VIN2_CH1 |
518 CX25840_VIN5_CH2,
519 .gpio0 = 0x02,
520 }, {
521 .type = CX23885_VMUX_COMPOSITE1,
522 .vmux = CX23885_VMUX_COMPOSITE1,
523 }, {
524 .type = CX23885_VMUX_SVIDEO,
525 .vmux = CX25840_SVIDEO_LUMA3 |
526 CX25840_SVIDEO_CHROMA4,
527 } },
528 },
Igor M. Liplianin78db8542011-01-25 17:04:00 -0300529 [CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF] = {
530 .ci_type = 2,
531 .name = "NetUP Dual DVB-T/C-CI RF",
532 .porta = CX23885_ANALOG_VIDEO,
533 .portb = CX23885_MPEG_DVB,
534 .portc = CX23885_MPEG_DVB,
Igor M. Liplianin10d0dcd2011-01-25 17:06:00 -0300535 .num_fds_portb = 2,
536 .num_fds_portc = 2,
Igor M. Liplianin78db8542011-01-25 17:04:00 -0300537 .tuner_type = TUNER_XC5000,
538 .tuner_addr = 0x64,
539 .input = { {
540 .type = CX23885_VMUX_TELEVISION,
541 .vmux = CX25840_COMPOSITE1,
542 } },
543 },
Steven Toth2cb9ccd2011-10-10 11:09:55 -0300544 [CX23885_BOARD_MPX885] = {
545 .name = "MPX-885",
546 .porta = CX23885_ANALOG_VIDEO,
547 .input = {{
548 .type = CX23885_VMUX_COMPOSITE1,
549 .vmux = CX25840_COMPOSITE1,
550 .amux = CX25840_AUDIO6,
551 .gpio0 = 0,
552 }, {
553 .type = CX23885_VMUX_COMPOSITE2,
554 .vmux = CX25840_COMPOSITE2,
555 .amux = CX25840_AUDIO6,
556 .gpio0 = 0,
557 }, {
558 .type = CX23885_VMUX_COMPOSITE3,
559 .vmux = CX25840_COMPOSITE3,
560 .amux = CX25840_AUDIO7,
561 .gpio0 = 0,
562 }, {
563 .type = CX23885_VMUX_COMPOSITE4,
564 .vmux = CX25840_COMPOSITE4,
565 .amux = CX25840_AUDIO7,
566 .gpio0 = 0,
567 } },
568 },
Alfredo Jesús Delaiti87988752011-11-09 15:13:00 -0300569 [CX23885_BOARD_MYGICA_X8507] = {
Mauro Carvalho Chehab0d1b5262013-08-09 08:53:27 -0300570 .name = "Mygica X8502/X8507 ISDB-T",
Alfredo Jesús Delaiti87988752011-11-09 15:13:00 -0300571 .tuner_type = TUNER_XC5000,
572 .tuner_addr = 0x61,
573 .tuner_bus = 1,
574 .porta = CX23885_ANALOG_VIDEO,
Mauro Carvalho Chehab0d1b5262013-08-09 08:53:27 -0300575 .portb = CX23885_MPEG_DVB,
Alfredo Jesús Delaiti87988752011-11-09 15:13:00 -0300576 .input = {
577 {
578 .type = CX23885_VMUX_TELEVISION,
579 .vmux = CX25840_COMPOSITE2,
580 .amux = CX25840_AUDIO8,
581 },
582 {
583 .type = CX23885_VMUX_COMPOSITE1,
584 .vmux = CX25840_COMPOSITE8,
Alfredo Jesús Delaiti082c0572012-09-21 10:33:51 -0300585 .amux = CX25840_AUDIO7,
Alfredo Jesús Delaiti87988752011-11-09 15:13:00 -0300586 },
587 {
588 .type = CX23885_VMUX_SVIDEO,
589 .vmux = CX25840_SVIDEO_LUMA3 |
590 CX25840_SVIDEO_CHROMA4,
Alfredo Jesús Delaiti082c0572012-09-21 10:33:51 -0300591 .amux = CX25840_AUDIO7,
Alfredo Jesús Delaiti87988752011-11-09 15:13:00 -0300592 },
593 {
594 .type = CX23885_VMUX_COMPONENT,
595 .vmux = CX25840_COMPONENT_ON |
596 CX25840_VIN1_CH1 |
597 CX25840_VIN6_CH2 |
598 CX25840_VIN7_CH3,
Alfredo Jesús Delaiti082c0572012-09-21 10:33:51 -0300599 .amux = CX25840_AUDIO7,
Alfredo Jesús Delaiti87988752011-11-09 15:13:00 -0300600 },
601 },
Stefan Ringel722c90e2012-01-07 09:20:48 -0300602 },
603 [CX23885_BOARD_TERRATEC_CINERGY_T_PCIE_DUAL] = {
604 .name = "TerraTec Cinergy T PCIe Dual",
605 .portb = CX23885_MPEG_DVB,
606 .portc = CX23885_MPEG_DVB,
Igor M. Liplianin7b134e82012-05-11 11:45:42 -0300607 },
608 [CX23885_BOARD_TEVII_S471] = {
609 .name = "TeVii S471",
610 .portb = CX23885_MPEG_DVB,
Mariusz Bia?o?czykf6671902012-09-12 07:59:18 -0300611 },
612 [CX23885_BOARD_PROF_8000] = {
613 .name = "Prof Revolution DVB-S2 8000",
614 .portb = CX23885_MPEG_DVB,
Michael Krufky7c62f5a2012-12-15 23:34:09 -0300615 },
616 [CX23885_BOARD_HAUPPAUGE_HVR4400] = {
617 .name = "Hauppauge WinTV-HVR4400",
Matthias Schwarzott36efec42014-07-22 17:12:13 -0300618 .porta = CX23885_ANALOG_VIDEO,
Michael Krufky7c62f5a2012-12-15 23:34:09 -0300619 .portb = CX23885_MPEG_DVB,
Matthias Schwarzott36efec42014-07-22 17:12:13 -0300620 .portc = CX23885_MPEG_DVB,
621 .tuner_type = TUNER_NXP_TDA18271,
622 .tuner_addr = 0x60, /* 0xc0 >> 1 */
623 .tuner_bus = 1,
Michael Krufky7c62f5a2012-12-15 23:34:09 -0300624 },
Oleh Kravchenkoe8d42372012-12-08 18:20:59 -0300625 [CX23885_BOARD_AVERMEDIA_HC81R] = {
626 .name = "AVerTV Hybrid Express Slim HC81R",
627 .tuner_type = TUNER_XC2028,
628 .tuner_addr = 0x61, /* 0xc2 >> 1 */
629 .tuner_bus = 1,
630 .porta = CX23885_ANALOG_VIDEO,
631 .input = {{
632 .type = CX23885_VMUX_TELEVISION,
633 .vmux = CX25840_VIN2_CH1 |
634 CX25840_VIN5_CH2 |
635 CX25840_NONE0_CH3 |
636 CX25840_NONE1_CH3,
637 .amux = CX25840_AUDIO8,
638 }, {
639 .type = CX23885_VMUX_SVIDEO,
640 .vmux = CX25840_VIN8_CH1 |
641 CX25840_NONE_CH2 |
642 CX25840_VIN7_CH3 |
643 CX25840_SVIDEO_ON,
644 .amux = CX25840_AUDIO6,
645 }, {
646 .type = CX23885_VMUX_COMPONENT,
647 .vmux = CX25840_VIN1_CH1 |
648 CX25840_NONE_CH2 |
649 CX25840_NONE0_CH3 |
650 CX25840_NONE1_CH3,
651 .amux = CX25840_AUDIO6,
652 } },
Hans Verkuilcce11b02014-06-27 11:15:42 -0300653 },
James Harper46b21bb2014-06-12 07:12:24 -0300654 [CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP2] = {
655 .name = "DViCO FusionHDTV DVB-T Dual Express2",
656 .portb = CX23885_MPEG_DVB,
657 .portc = CX23885_MPEG_DVB,
658 },
Hans Verkuilcce11b02014-06-27 11:15:42 -0300659 [CX23885_BOARD_HAUPPAUGE_IMPACTVCBE] = {
660 .name = "Hauppauge ImpactVCB-e",
661 .tuner_type = TUNER_ABSENT,
662 .porta = CX23885_ANALOG_VIDEO,
663 .input = {{
664 .type = CX23885_VMUX_COMPOSITE1,
665 .vmux = CX25840_VIN7_CH3 |
666 CX25840_VIN4_CH2 |
667 CX25840_VIN6_CH1,
668 .amux = CX25840_AUDIO7,
669 }, {
670 .type = CX23885_VMUX_SVIDEO,
671 .vmux = CX25840_VIN7_CH3 |
672 CX25840_VIN4_CH2 |
673 CX25840_VIN8_CH1 |
674 CX25840_SVIDEO_ON,
675 .amux = CX25840_AUDIO7,
676 } },
677 },
Olli Salonen29442262014-08-11 16:58:15 -0300678 [CX23885_BOARD_DVBSKY_T9580] = {
679 .name = "DVBSky T9580",
680 .portb = CX23885_MPEG_DVB,
681 .portc = CX23885_MPEG_DVB,
682 },
Olli Salonen82c10272014-09-29 04:44:16 -0300683 [CX23885_BOARD_DVBSKY_T980C] = {
684 .name = "DVBSky T980C",
685 .portb = CX23885_MPEG_DVB,
686 },
nibble.max0e6c7b02014-10-23 07:01:44 -0300687 [CX23885_BOARD_DVBSKY_S950C] = {
688 .name = "DVBSky S950C",
689 .portb = CX23885_MPEG_DVB,
690 },
Olli Salonen61b103e2014-10-30 17:48:27 -0300691 [CX23885_BOARD_TT_CT2_4500_CI] = {
692 .name = "Technotrend TT-budget CT2-4500 CI",
693 .portb = CX23885_MPEG_DVB,
694 },
nibble.maxcba54802014-11-05 11:58:07 -0300695 [CX23885_BOARD_DVBSKY_S950] = {
696 .name = "DVBSky S950",
697 .portb = CX23885_MPEG_DVB,
698 },
nibble.maxc29d6a82014-11-05 11:58:38 -0300699 [CX23885_BOARD_DVBSKY_S952] = {
700 .name = "DVBSky S952",
701 .portb = CX23885_MPEG_DVB,
702 .portc = CX23885_MPEG_DVB,
703 },
Nibble Maxc02ef642014-11-12 01:23:12 -0300704 [CX23885_BOARD_DVBSKY_T982] = {
705 .name = "DVBSky T982",
706 .portb = CX23885_MPEG_DVB,
707 .portc = CX23885_MPEG_DVB,
708 },
Steven Tothd19770e2007-03-11 20:44:05 -0300709};
710const unsigned int cx23885_bcount = ARRAY_SIZE(cx23885_boards);
711
712/* ------------------------------------------------------------------ */
713/* PCI subsystem IDs */
714
715struct cx23885_subid cx23885_subids[] = {
716 {
717 .subvendor = 0x0070,
718 .subdevice = 0x3400,
719 .card = CX23885_BOARD_UNKNOWN,
Steven Toth9c8ced52008-10-16 20:18:44 -0300720 }, {
Steven Tothd19770e2007-03-11 20:44:05 -0300721 .subvendor = 0x0070,
722 .subdevice = 0x7600,
723 .card = CX23885_BOARD_HAUPPAUGE_HVR1800lp,
Steven Toth9c8ced52008-10-16 20:18:44 -0300724 }, {
Steven Tothd19770e2007-03-11 20:44:05 -0300725 .subvendor = 0x0070,
726 .subdevice = 0x7800,
727 .card = CX23885_BOARD_HAUPPAUGE_HVR1800,
Steven Toth9c8ced52008-10-16 20:18:44 -0300728 }, {
Steven Tothd19770e2007-03-11 20:44:05 -0300729 .subvendor = 0x0070,
730 .subdevice = 0x7801,
731 .card = CX23885_BOARD_HAUPPAUGE_HVR1800,
Steven Toth9c8ced52008-10-16 20:18:44 -0300732 }, {
Steven Totha77743b2007-08-22 21:01:20 -0300733 .subvendor = 0x0070,
Michael Krufky6ccb8cf2007-12-27 21:46:34 -0300734 .subdevice = 0x7809,
735 .card = CX23885_BOARD_HAUPPAUGE_HVR1800,
Steven Toth9c8ced52008-10-16 20:18:44 -0300736 }, {
Michael Krufky6ccb8cf2007-12-27 21:46:34 -0300737 .subvendor = 0x0070,
Steven Totha77743b2007-08-22 21:01:20 -0300738 .subdevice = 0x7911,
739 .card = CX23885_BOARD_HAUPPAUGE_HVR1250,
Steven Toth9c8ced52008-10-16 20:18:44 -0300740 }, {
Michael Krufky9bc37ca2007-09-08 15:17:13 -0300741 .subvendor = 0x18ac,
742 .subdevice = 0xd500,
743 .card = CX23885_BOARD_DVICO_FUSIONHDTV_5_EXP,
Steven Toth9c8ced52008-10-16 20:18:44 -0300744 }, {
Steven Tothd1987d52007-12-18 01:57:06 -0300745 .subvendor = 0x0070,
Michael Krufkyb00fff02007-12-27 22:19:31 -0300746 .subdevice = 0x7790,
747 .card = CX23885_BOARD_HAUPPAUGE_HVR1500Q,
Steven Toth9c8ced52008-10-16 20:18:44 -0300748 }, {
Michael Krufkyb00fff02007-12-27 22:19:31 -0300749 .subvendor = 0x0070,
Steven Tothd1987d52007-12-18 01:57:06 -0300750 .subdevice = 0x7797,
751 .card = CX23885_BOARD_HAUPPAUGE_HVR1500Q,
Steven Toth9c8ced52008-10-16 20:18:44 -0300752 }, {
Michael Krufky07b4a832007-12-18 01:09:11 -0300753 .subvendor = 0x0070,
Michael Krufkyb00fff02007-12-27 22:19:31 -0300754 .subdevice = 0x7710,
755 .card = CX23885_BOARD_HAUPPAUGE_HVR1500,
Steven Toth9c8ced52008-10-16 20:18:44 -0300756 }, {
Michael Krufkyb00fff02007-12-27 22:19:31 -0300757 .subvendor = 0x0070,
Michael Krufky07b4a832007-12-18 01:09:11 -0300758 .subdevice = 0x7717,
759 .card = CX23885_BOARD_HAUPPAUGE_HVR1500,
Steven Tothb3ea0162008-04-19 01:14:19 -0300760 }, {
761 .subvendor = 0x0070,
762 .subdevice = 0x71d1,
763 .card = CX23885_BOARD_HAUPPAUGE_HVR1200,
Steven Totha780a312008-04-19 01:25:52 -0300764 }, {
765 .subvendor = 0x0070,
Michael Krufky3c3852c2008-05-02 16:12:44 -0300766 .subdevice = 0x71d3,
767 .card = CX23885_BOARD_HAUPPAUGE_HVR1200,
768 }, {
769 .subvendor = 0x0070,
Steven Totha780a312008-04-19 01:25:52 -0300770 .subdevice = 0x8101,
771 .card = CX23885_BOARD_HAUPPAUGE_HVR1700,
Steven Toth66762372008-04-22 15:38:26 -0300772 }, {
773 .subvendor = 0x0070,
774 .subdevice = 0x8010,
775 .card = CX23885_BOARD_HAUPPAUGE_HVR1400,
Steven Toth9c8ced52008-10-16 20:18:44 -0300776 }, {
Michael Krufky335377b2008-05-07 01:43:10 -0300777 .subvendor = 0x18ac,
778 .subdevice = 0xd618,
779 .card = CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP,
Steven Toth9c8ced52008-10-16 20:18:44 -0300780 }, {
Steven Tothaef2d182008-08-04 21:39:53 -0300781 .subvendor = 0x18ac,
782 .subdevice = 0xdb78,
783 .card = CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP,
Steven Toth4c56b042008-08-12 13:30:03 -0300784 }, {
785 .subvendor = 0x107d,
786 .subdevice = 0x6681,
787 .card = CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H,
Igor M. Liplianin9bb1b7e2008-11-23 14:11:16 -0300788 }, {
istvan_v@mailbox.hu0cf8af52011-07-11 10:58:35 -0300789 .subvendor = 0x107d,
Anca Emanuel642ca1a2013-09-13 11:28:12 -0300790 .subdevice = 0x6f21,
791 .card = CX23885_BOARD_LEADTEK_WINFAST_PXPVR2200,
792 }, {
793 .subvendor = 0x107d,
istvan_v@mailbox.hu0cf8af52011-07-11 10:58:35 -0300794 .subdevice = 0x6f39,
795 .card = CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H_XC4000,
796 }, {
Igor M. Liplianin9bb1b7e2008-11-23 14:11:16 -0300797 .subvendor = 0x185b,
798 .subdevice = 0xe800,
799 .card = CX23885_BOARD_COMPRO_VIDEOMATE_E650F,
Igor M. Liplianin96318d02009-01-17 12:11:20 -0300800 }, {
801 .subvendor = 0x6920,
802 .subdevice = 0x8888,
803 .card = CX23885_BOARD_TBS_6920,
Igor M. Liplianin579943f2009-01-17 12:18:26 -0300804 }, {
Luis Alvese6001482013-10-01 22:11:35 -0300805 .subvendor = 0x6980,
806 .subdevice = 0x8888,
807 .card = CX23885_BOARD_TBS_6980,
808 }, {
809 .subvendor = 0x6981,
810 .subdevice = 0x8888,
811 .card = CX23885_BOARD_TBS_6981,
812 }, {
Igor M. Liplianin579943f2009-01-17 12:18:26 -0300813 .subvendor = 0xd470,
814 .subdevice = 0x9022,
815 .card = CX23885_BOARD_TEVII_S470,
Igor M. Liplianinc9b8b042009-01-17 12:23:31 -0300816 }, {
817 .subvendor = 0x0001,
818 .subdevice = 0x2005,
819 .card = CX23885_BOARD_DVBWORLD_2005,
Igor M. Liplianin5a23b072009-03-03 12:06:09 -0300820 }, {
821 .subvendor = 0x1b55,
822 .subdevice = 0x2a2c,
823 .card = CX23885_BOARD_NETUP_DUAL_DVBS2_CI,
Steven Toth2074dff2009-05-02 11:39:46 -0300824 }, {
825 .subvendor = 0x0070,
826 .subdevice = 0x2211,
827 .card = CX23885_BOARD_HAUPPAUGE_HVR1270,
Michael Krufkyd099bec2009-05-08 22:39:24 -0300828 }, {
829 .subvendor = 0x0070,
830 .subdevice = 0x2215,
831 .card = CX23885_BOARD_HAUPPAUGE_HVR1275,
Michael Krufky19bc5792009-05-08 16:05:29 -0300832 }, {
833 .subvendor = 0x0070,
Michael Krufky7d7b5282010-06-30 18:17:35 -0300834 .subdevice = 0x221d,
835 .card = CX23885_BOARD_HAUPPAUGE_HVR1275,
836 }, {
837 .subvendor = 0x0070,
Michael Krufky19bc5792009-05-08 16:05:29 -0300838 .subdevice = 0x2251,
839 .card = CX23885_BOARD_HAUPPAUGE_HVR1255,
Michael Krufky6b926ec2009-05-12 17:32:17 -0300840 }, {
841 .subvendor = 0x0070,
Michael Krufky7d7b5282010-06-30 18:17:35 -0300842 .subdevice = 0x2259,
Devin Heitmueller0ac60ac2012-07-01 16:15:14 -0300843 .card = CX23885_BOARD_HAUPPAUGE_HVR1255_22111,
Michael Krufky7d7b5282010-06-30 18:17:35 -0300844 }, {
845 .subvendor = 0x0070,
Michael Krufky6b926ec2009-05-12 17:32:17 -0300846 .subdevice = 0x2291,
847 .card = CX23885_BOARD_HAUPPAUGE_HVR1210,
848 }, {
849 .subvendor = 0x0070,
850 .subdevice = 0x2295,
851 .card = CX23885_BOARD_HAUPPAUGE_HVR1210,
David Wong493b7122009-05-18 05:25:49 -0300852 }, {
Michael Krufky7d7b5282010-06-30 18:17:35 -0300853 .subvendor = 0x0070,
854 .subdevice = 0x2299,
855 .card = CX23885_BOARD_HAUPPAUGE_HVR1210,
856 }, {
857 .subvendor = 0x0070,
858 .subdevice = 0x229d,
859 .card = CX23885_BOARD_HAUPPAUGE_HVR1210, /* HVR1215 */
860 }, {
861 .subvendor = 0x0070,
862 .subdevice = 0x22f0,
863 .card = CX23885_BOARD_HAUPPAUGE_HVR1210,
864 }, {
865 .subvendor = 0x0070,
866 .subdevice = 0x22f1,
867 .card = CX23885_BOARD_HAUPPAUGE_HVR1255,
868 }, {
869 .subvendor = 0x0070,
870 .subdevice = 0x22f2,
871 .card = CX23885_BOARD_HAUPPAUGE_HVR1275,
872 }, {
873 .subvendor = 0x0070,
874 .subdevice = 0x22f3,
875 .card = CX23885_BOARD_HAUPPAUGE_HVR1210, /* HVR1215 */
876 }, {
877 .subvendor = 0x0070,
878 .subdevice = 0x22f4,
879 .card = CX23885_BOARD_HAUPPAUGE_HVR1210,
880 }, {
881 .subvendor = 0x0070,
882 .subdevice = 0x22f5,
883 .card = CX23885_BOARD_HAUPPAUGE_HVR1210, /* HVR1215 */
884 }, {
David Wong493b7122009-05-18 05:25:49 -0300885 .subvendor = 0x14f1,
886 .subdevice = 0x8651,
887 .card = CX23885_BOARD_MYGICA_X8506,
David Wong2365b2d2009-06-17 01:38:12 -0300888 }, {
889 .subvendor = 0x14f1,
890 .subdevice = 0x8657,
891 .card = CX23885_BOARD_MAGICPRO_PROHDTVE2,
Steven Toth136973802009-07-20 15:37:25 -0300892 }, {
893 .subvendor = 0x0070,
894 .subdevice = 0x8541,
895 .card = CX23885_BOARD_HAUPPAUGE_HVR1850,
Vladimir Geroy34e383d2009-09-18 18:55:47 -0300896 }, {
897 .subvendor = 0x1858,
898 .subdevice = 0xe800,
899 .card = CX23885_BOARD_COMPRO_VIDEOMATE_E800,
Michael Krufkyaee0b242009-11-11 01:52:45 -0300900 }, {
901 .subvendor = 0x0070,
902 .subdevice = 0x8551,
903 .card = CX23885_BOARD_HAUPPAUGE_HVR1290,
David T. L. Wongea5697f2009-10-26 08:54:04 -0300904 }, {
905 .subvendor = 0x14f1,
906 .subdevice = 0x8578,
907 .card = CX23885_BOARD_MYGICA_X8558PRO,
Kusanagi Kouichi0b32d652010-01-22 04:55:28 -0300908 }, {
909 .subvendor = 0x107d,
910 .subdevice = 0x6f22,
911 .card = CX23885_BOARD_LEADTEK_WINFAST_PXTV1200,
Alexey Chernov9028f582010-12-06 17:09:53 -0300912 }, {
913 .subvendor = 0x5654,
914 .subdevice = 0x2390,
915 .card = CX23885_BOARD_GOTVIEW_X5_3D_HYBRID,
Igor M. Liplianin78db8542011-01-25 17:04:00 -0300916 }, {
917 .subvendor = 0x1b55,
918 .subdevice = 0xe2e4,
919 .card = CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF,
Alfredo Jesús Delaiti87988752011-11-09 15:13:00 -0300920 }, {
921 .subvendor = 0x14f1,
922 .subdevice = 0x8502,
923 .card = CX23885_BOARD_MYGICA_X8507,
Stefan Ringel722c90e2012-01-07 09:20:48 -0300924 }, {
925 .subvendor = 0x153b,
926 .subdevice = 0x117e,
927 .card = CX23885_BOARD_TERRATEC_CINERGY_T_PCIE_DUAL,
Igor M. Liplianin7b134e82012-05-11 11:45:42 -0300928 }, {
929 .subvendor = 0xd471,
930 .subdevice = 0x9022,
931 .card = CX23885_BOARD_TEVII_S471,
Mariusz Bia?o?czykf6671902012-09-12 07:59:18 -0300932 }, {
933 .subvendor = 0x8000,
934 .subdevice = 0x3034,
935 .card = CX23885_BOARD_PROF_8000,
Michael Krufky7c62f5a2012-12-15 23:34:09 -0300936 }, {
937 .subvendor = 0x0070,
938 .subdevice = 0xc108,
939 .card = CX23885_BOARD_HAUPPAUGE_HVR4400,
940 }, {
941 .subvendor = 0x0070,
942 .subdevice = 0xc138,
943 .card = CX23885_BOARD_HAUPPAUGE_HVR4400,
944 }, {
945 .subvendor = 0x0070,
946 .subdevice = 0xc12a,
947 .card = CX23885_BOARD_HAUPPAUGE_HVR4400,
948 }, {
949 .subvendor = 0x0070,
950 .subdevice = 0xc1f8,
951 .card = CX23885_BOARD_HAUPPAUGE_HVR4400,
Oleh Kravchenkoe8d42372012-12-08 18:20:59 -0300952 }, {
953 .subvendor = 0x1461,
954 .subdevice = 0xd939,
955 .card = CX23885_BOARD_AVERMEDIA_HC81R,
Hans Verkuilcce11b02014-06-27 11:15:42 -0300956 }, {
957 .subvendor = 0x0070,
958 .subdevice = 0x7133,
959 .card = CX23885_BOARD_HAUPPAUGE_IMPACTVCBE,
James Harper46b21bb2014-06-12 07:12:24 -0300960 }, {
961 .subvendor = 0x18ac,
962 .subdevice = 0xdb98,
963 .card = CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP2,
Olli Salonen29442262014-08-11 16:58:15 -0300964 }, {
965 .subvendor = 0x4254,
966 .subdevice = 0x9580,
967 .card = CX23885_BOARD_DVBSKY_T9580,
Olli Salonen82c10272014-09-29 04:44:16 -0300968 }, {
969 .subvendor = 0x4254,
970 .subdevice = 0x980c,
971 .card = CX23885_BOARD_DVBSKY_T980C,
nibble.max0e6c7b02014-10-23 07:01:44 -0300972 }, {
973 .subvendor = 0x4254,
974 .subdevice = 0x950c,
975 .card = CX23885_BOARD_DVBSKY_S950C,
Olli Salonen61b103e2014-10-30 17:48:27 -0300976 }, {
977 .subvendor = 0x13c2,
978 .subdevice = 0x3013,
979 .card = CX23885_BOARD_TT_CT2_4500_CI,
nibble.maxcba54802014-11-05 11:58:07 -0300980 }, {
981 .subvendor = 0x4254,
982 .subdevice = 0x0950,
983 .card = CX23885_BOARD_DVBSKY_S950,
nibble.maxc29d6a82014-11-05 11:58:38 -0300984 }, {
985 .subvendor = 0x4254,
986 .subdevice = 0x0952,
987 .card = CX23885_BOARD_DVBSKY_S952,
Nibble Maxc02ef642014-11-12 01:23:12 -0300988 }, {
989 .subvendor = 0x4254,
990 .subdevice = 0x0982,
991 .card = CX23885_BOARD_DVBSKY_T982,
Steven Tothd19770e2007-03-11 20:44:05 -0300992 },
993};
994const unsigned int cx23885_idcount = ARRAY_SIZE(cx23885_subids);
995
996void cx23885_card_list(struct cx23885_dev *dev)
997{
998 int i;
999
1000 if (0 == dev->pci->subsystem_vendor &&
1001 0 == dev->pci->subsystem_device) {
Steven Toth9c8ced52008-10-16 20:18:44 -03001002 printk(KERN_INFO
1003 "%s: Board has no valid PCIe Subsystem ID and can't\n"
1004 "%s: be autodetected. Pass card=<n> insmod option\n"
1005 "%s: to workaround that. Redirect complaints to the\n"
1006 "%s: vendor of the TV card. Best regards,\n"
Steven Tothd19770e2007-03-11 20:44:05 -03001007 "%s: -- tux\n",
1008 dev->name, dev->name, dev->name, dev->name, dev->name);
1009 } else {
Steven Toth9c8ced52008-10-16 20:18:44 -03001010 printk(KERN_INFO
1011 "%s: Your board isn't known (yet) to the driver.\n"
1012 "%s: Try to pick one of the existing card configs via\n"
Steven Tothd19770e2007-03-11 20:44:05 -03001013 "%s: card=<n> insmod option. Updating to the latest\n"
1014 "%s: version might help as well.\n",
1015 dev->name, dev->name, dev->name, dev->name);
1016 }
Steven Toth9c8ced52008-10-16 20:18:44 -03001017 printk(KERN_INFO "%s: Here is a list of valid choices for the card=<n> insmod option:\n",
Steven Tothd19770e2007-03-11 20:44:05 -03001018 dev->name);
1019 for (i = 0; i < cx23885_bcount; i++)
Steven Toth9c8ced52008-10-16 20:18:44 -03001020 printk(KERN_INFO "%s: card=%d -> %s\n",
Steven Tothd19770e2007-03-11 20:44:05 -03001021 dev->name, i, cx23885_boards[i].name);
1022}
1023
1024static void hauppauge_eeprom(struct cx23885_dev *dev, u8 *eeprom_data)
1025{
1026 struct tveeprom tv;
1027
Steven Toth9c8ced52008-10-16 20:18:44 -03001028 tveeprom_hauppauge_analog(&dev->i2c_bus[0].i2c_client, &tv,
1029 eeprom_data);
Steven Tothd19770e2007-03-11 20:44:05 -03001030
Steven Tothd19770e2007-03-11 20:44:05 -03001031 /* Make sure we support the board model */
Steven Toth9c8ced52008-10-16 20:18:44 -03001032 switch (tv.model) {
Michael Krufky5308cf02009-05-12 18:37:35 -03001033 case 22001:
1034 /* WinTV-HVR1270 (PCIe, Retail, half height)
1035 * ATSC/QAM and basic analog, IR Blast */
1036 case 22009:
1037 /* WinTV-HVR1210 (PCIe, Retail, half height)
1038 * DVB-T and basic analog, IR Blast */
1039 case 22011:
1040 /* WinTV-HVR1270 (PCIe, Retail, half height)
1041 * ATSC/QAM and basic analog, IR Recv */
1042 case 22019:
1043 /* WinTV-HVR1210 (PCIe, Retail, half height)
1044 * DVB-T and basic analog, IR Recv */
1045 case 22021:
1046 /* WinTV-HVR1275 (PCIe, Retail, half height)
1047 * ATSC/QAM and basic analog, IR Recv */
1048 case 22029:
1049 /* WinTV-HVR1210 (PCIe, Retail, half height)
1050 * DVB-T and basic analog, IR Recv */
1051 case 22101:
1052 /* WinTV-HVR1270 (PCIe, Retail, full height)
1053 * ATSC/QAM and basic analog, IR Blast */
1054 case 22109:
1055 /* WinTV-HVR1210 (PCIe, Retail, full height)
1056 * DVB-T and basic analog, IR Blast */
1057 case 22111:
1058 /* WinTV-HVR1270 (PCIe, Retail, full height)
1059 * ATSC/QAM and basic analog, IR Recv */
1060 case 22119:
1061 /* WinTV-HVR1210 (PCIe, Retail, full height)
1062 * DVB-T and basic analog, IR Recv */
1063 case 22121:
1064 /* WinTV-HVR1275 (PCIe, Retail, full height)
1065 * ATSC/QAM and basic analog, IR Recv */
1066 case 22129:
1067 /* WinTV-HVR1210 (PCIe, Retail, full height)
1068 * DVB-T and basic analog, IR Recv */
Michael Krufky36396c82008-05-02 16:14:33 -03001069 case 71009:
1070 /* WinTV-HVR1200 (PCIe, Retail, full height)
1071 * DVB-T and basic analog */
Hans Verkuilcce11b02014-06-27 11:15:42 -03001072 case 71100:
1073 /* WinTV-ImpactVCB-e (PCIe, Retail, half height)
1074 * Basic analog */
Michael Krufky36396c82008-05-02 16:14:33 -03001075 case 71359:
1076 /* WinTV-HVR1200 (PCIe, OEM, half height)
1077 * DVB-T and basic analog */
1078 case 71439:
1079 /* WinTV-HVR1200 (PCIe, OEM, half height)
1080 * DVB-T and basic analog */
1081 case 71449:
1082 /* WinTV-HVR1200 (PCIe, OEM, full height)
1083 * DVB-T and basic analog */
1084 case 71939:
1085 /* WinTV-HVR1200 (PCIe, OEM, half height)
1086 * DVB-T and basic analog */
1087 case 71949:
1088 /* WinTV-HVR1200 (PCIe, OEM, full height)
1089 * DVB-T and basic analog */
1090 case 71959:
1091 /* WinTV-HVR1200 (PCIe, OEM, full height)
1092 * DVB-T and basic analog */
1093 case 71979:
1094 /* WinTV-HVR1200 (PCIe, OEM, half height)
1095 * DVB-T and basic analog */
1096 case 71999:
1097 /* WinTV-HVR1200 (PCIe, OEM, full height)
1098 * DVB-T and basic analog */
Steven Toth9c8ced52008-10-16 20:18:44 -03001099 case 76601:
1100 /* WinTV-HVR1800lp (PCIe, Retail, No IR, Dual
1101 channel ATSC and MPEG2 HW Encoder */
1102 case 77001:
1103 /* WinTV-HVR1500 (Express Card, OEM, No IR, ATSC
1104 and Basic analog */
1105 case 77011:
1106 /* WinTV-HVR1500 (Express Card, Retail, No IR, ATSC
1107 and Basic analog */
1108 case 77041:
1109 /* WinTV-HVR1500Q (Express Card, OEM, No IR, ATSC/QAM
1110 and Basic analog */
1111 case 77051:
1112 /* WinTV-HVR1500Q (Express Card, Retail, No IR, ATSC/QAM
1113 and Basic analog */
1114 case 78011:
1115 /* WinTV-HVR1800 (PCIe, Retail, 3.5mm in, IR, No FM,
1116 Dual channel ATSC and MPEG2 HW Encoder */
1117 case 78501:
1118 /* WinTV-HVR1800 (PCIe, OEM, RCA in, No IR, FM,
1119 Dual channel ATSC and MPEG2 HW Encoder */
1120 case 78521:
1121 /* WinTV-HVR1800 (PCIe, OEM, RCA in, No IR, FM,
1122 Dual channel ATSC and MPEG2 HW Encoder */
1123 case 78531:
1124 /* WinTV-HVR1800 (PCIe, OEM, RCA in, No IR, No FM,
1125 Dual channel ATSC and MPEG2 HW Encoder */
1126 case 78631:
1127 /* WinTV-HVR1800 (PCIe, OEM, No IR, No FM,
1128 Dual channel ATSC and MPEG2 HW Encoder */
1129 case 79001:
1130 /* WinTV-HVR1250 (PCIe, Retail, IR, full height,
1131 ATSC and Basic analog */
1132 case 79101:
1133 /* WinTV-HVR1250 (PCIe, Retail, IR, half height,
1134 ATSC and Basic analog */
Andy Wallsebbeb462010-07-18 17:35:00 -03001135 case 79501:
1136 /* WinTV-HVR1250 (PCIe, No IR, half height,
1137 ATSC [at least] and Basic analog) */
Steven Toth9c8ced52008-10-16 20:18:44 -03001138 case 79561:
1139 /* WinTV-HVR1250 (PCIe, OEM, No IR, half height,
1140 ATSC and Basic analog */
1141 case 79571:
1142 /* WinTV-HVR1250 (PCIe, OEM, No IR, full height,
1143 ATSC and Basic analog */
1144 case 79671:
1145 /* WinTV-HVR1250 (PCIe, OEM, No IR, half height,
1146 ATSC and Basic analog */
Steven Toth66762372008-04-22 15:38:26 -03001147 case 80019:
1148 /* WinTV-HVR1400 (Express Card, Retail, IR,
1149 * DVB-T and Basic analog */
Michael Krufky36396c82008-05-02 16:14:33 -03001150 case 81509:
1151 /* WinTV-HVR1700 (PCIe, OEM, No IR, half height)
1152 * DVB-T and MPEG2 HW Encoder */
Steven Totha780a312008-04-19 01:25:52 -03001153 case 81519:
Michael Krufky36396c82008-05-02 16:14:33 -03001154 /* WinTV-HVR1700 (PCIe, OEM, No IR, full height)
Steven Totha780a312008-04-19 01:25:52 -03001155 * DVB-T and MPEG2 HW Encoder */
Steven Tothd19770e2007-03-11 20:44:05 -03001156 break;
Steven Toth136973802009-07-20 15:37:25 -03001157 case 85021:
Michael Krufky73a5f412009-11-11 10:46:40 -03001158 /* WinTV-HVR1850 (PCIe, Retail, 3.5mm in, IR, FM,
Steven Toth136973802009-07-20 15:37:25 -03001159 Dual channel ATSC and MPEG2 HW Encoder */
1160 break;
Michael Krufky73a5f412009-11-11 10:46:40 -03001161 case 85721:
1162 /* WinTV-HVR1290 (PCIe, OEM, RCA in, IR,
1163 Dual channel ATSC and Basic analog */
1164 break;
Steven Tothd19770e2007-03-11 20:44:05 -03001165 default:
Steven Toth136973802009-07-20 15:37:25 -03001166 printk(KERN_WARNING "%s: warning: "
1167 "unknown hauppauge model #%d\n",
Steven Toth9c8ced52008-10-16 20:18:44 -03001168 dev->name, tv.model);
Steven Tothd19770e2007-03-11 20:44:05 -03001169 break;
1170 }
1171
1172 printk(KERN_INFO "%s: hauppauge eeprom: model=%d\n",
1173 dev->name, tv.model);
1174}
1175
Luis Alvese6001482013-10-01 22:11:35 -03001176/* Some TBS cards require initing a chip using a bitbanged SPI attached
1177 to the cx23885 gpio's. If this chip doesn't get init'ed the demod
1178 doesn't respond to any command. */
1179static void tbs_card_init(struct cx23885_dev *dev)
1180{
1181 int i;
1182 const u8 buf[] = {
1183 0xe0, 0x06, 0x66, 0x33, 0x65,
1184 0x01, 0x17, 0x06, 0xde};
1185
1186 switch (dev->board) {
1187 case CX23885_BOARD_TBS_6980:
1188 case CX23885_BOARD_TBS_6981:
1189 cx_set(GP0_IO, 0x00070007);
1190 usleep_range(1000, 10000);
1191 cx_clear(GP0_IO, 2);
1192 usleep_range(1000, 10000);
1193 for (i = 0; i < 9 * 8; i++) {
1194 cx_clear(GP0_IO, 7);
1195 usleep_range(1000, 10000);
1196 cx_set(GP0_IO,
1197 ((buf[i >> 3] >> (7 - (i & 7))) & 1) | 4);
1198 usleep_range(1000, 10000);
1199 }
1200 cx_set(GP0_IO, 7);
1201 break;
1202 }
1203}
1204
Michael Krufkyd7cba042008-09-12 13:31:45 -03001205int cx23885_tuner_callback(void *priv, int component, int command, int arg)
Steven Toth8c700172008-01-05 16:55:45 -03001206{
Steven Toth89ce2212008-08-04 22:18:19 -03001207 struct cx23885_tsport *port = priv;
1208 struct cx23885_dev *dev = port->dev;
Steven Toth6df51692008-06-30 22:17:05 -03001209 u32 bitmask = 0;
1210
Anton Blanchardc6cff162012-07-01 21:38:03 -03001211 if ((command == XC2028_RESET_CLK) || (command == XC2028_I2C_FLUSH))
Steven Toth89ce2212008-08-04 22:18:19 -03001212 return 0;
1213
Steven Toth6df51692008-06-30 22:17:05 -03001214 if (command != 0) {
1215 printk(KERN_ERR "%s(): Unknown command 0x%x.\n",
1216 __func__, command);
1217 return -EINVAL;
1218 }
Steven Toth8c700172008-01-05 16:55:45 -03001219
Steven Toth9c8ced52008-10-16 20:18:44 -03001220 switch (dev->board) {
Steven Toth90a71b12008-08-04 21:38:46 -03001221 case CX23885_BOARD_HAUPPAUGE_HVR1400:
1222 case CX23885_BOARD_HAUPPAUGE_HVR1500:
Steven Toth8c700172008-01-05 16:55:45 -03001223 case CX23885_BOARD_HAUPPAUGE_HVR1500Q:
Steven Toth4c56b042008-08-12 13:30:03 -03001224 case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H:
Anca Emanuel642ca1a2013-09-13 11:28:12 -03001225 case CX23885_BOARD_LEADTEK_WINFAST_PXPVR2200:
istvan_v@mailbox.hu0cf8af52011-07-11 10:58:35 -03001226 case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H_XC4000:
Igor M. Liplianin9bb1b7e2008-11-23 14:11:16 -03001227 case CX23885_BOARD_COMPRO_VIDEOMATE_E650F:
Vladimir Geroy34e383d2009-09-18 18:55:47 -03001228 case CX23885_BOARD_COMPRO_VIDEOMATE_E800:
Kusanagi Kouichi0b32d652010-01-22 04:55:28 -03001229 case CX23885_BOARD_LEADTEK_WINFAST_PXTV1200:
Steven Toth90a71b12008-08-04 21:38:46 -03001230 /* Tuner Reset Command */
Steven Toth4c56b042008-08-12 13:30:03 -03001231 bitmask = 0x04;
Steven Toth6df51692008-06-30 22:17:05 -03001232 break;
1233 case CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP:
Steven Tothaef2d182008-08-04 21:39:53 -03001234 case CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP:
James Harper46b21bb2014-06-12 07:12:24 -03001235 case CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP2:
Steven Toth4c56b042008-08-12 13:30:03 -03001236 /* Two identical tuners on two different i2c buses,
1237 * we need to reset the correct gpio. */
Christopher Pascoed4dc6732009-04-27 11:27:04 -03001238 if (port->nr == 1)
Steven Toth4c56b042008-08-12 13:30:03 -03001239 bitmask = 0x01;
Christopher Pascoed4dc6732009-04-27 11:27:04 -03001240 else if (port->nr == 2)
Steven Toth4c56b042008-08-12 13:30:03 -03001241 bitmask = 0x04;
Steven Toth8c700172008-01-05 16:55:45 -03001242 break;
Alexey Chernov9028f582010-12-06 17:09:53 -03001243 case CX23885_BOARD_GOTVIEW_X5_3D_HYBRID:
1244 /* Tuner Reset Command */
1245 bitmask = 0x02;
1246 break;
Igor M. Liplianin78db8542011-01-25 17:04:00 -03001247 case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF:
1248 altera_ci_tuner_reset(dev, port->nr);
1249 break;
Oleh Kravchenkoe8d42372012-12-08 18:20:59 -03001250 case CX23885_BOARD_AVERMEDIA_HC81R:
1251 /* XC3028L Reset Command */
1252 bitmask = 1 << 2;
1253 break;
Steven Toth8c700172008-01-05 16:55:45 -03001254 }
1255
Steven Toth6df51692008-06-30 22:17:05 -03001256 if (bitmask) {
1257 /* Drive the tuner into reset and back out */
1258 cx_clear(GP0_IO, bitmask);
1259 mdelay(200);
1260 cx_set(GP0_IO, bitmask);
1261 }
1262
1263 return 0;
Steven Toth8c700172008-01-05 16:55:45 -03001264}
Steven Toth73c993a2008-01-05 17:08:05 -03001265
Steven Totha6a3f142007-09-08 21:31:56 -03001266void cx23885_gpio_setup(struct cx23885_dev *dev)
1267{
Steven Toth9c8ced52008-10-16 20:18:44 -03001268 switch (dev->board) {
Steven Totha6a3f142007-09-08 21:31:56 -03001269 case CX23885_BOARD_HAUPPAUGE_HVR1250:
1270 /* GPIO-0 cx24227 demodulator reset */
1271 cx_set(GP0_IO, 0x00010001); /* Bring the part out of reset */
1272 break;
Michael Krufky07b4a832007-12-18 01:09:11 -03001273 case CX23885_BOARD_HAUPPAUGE_HVR1500:
1274 /* GPIO-0 cx24227 demodulator */
1275 /* GPIO-2 xc3028 tuner */
1276
1277 /* Put the parts into reset */
1278 cx_set(GP0_IO, 0x00050000);
1279 cx_clear(GP0_IO, 0x00000005);
1280 msleep(5);
1281
1282 /* Bring the parts out of reset */
1283 cx_set(GP0_IO, 0x00050005);
1284 break;
Steven Tothd1987d52007-12-18 01:57:06 -03001285 case CX23885_BOARD_HAUPPAUGE_HVR1500Q:
1286 /* GPIO-0 cx24227 demodulator reset */
1287 /* GPIO-2 xc5000 tuner reset */
1288 cx_set(GP0_IO, 0x00050005); /* Bring the part out of reset */
1289 break;
Steven Totha6a3f142007-09-08 21:31:56 -03001290 case CX23885_BOARD_HAUPPAUGE_HVR1800:
1291 /* GPIO-0 656_CLK */
1292 /* GPIO-1 656_D0 */
1293 /* GPIO-2 8295A Reset */
1294 /* GPIO-3-10 cx23417 data0-7 */
1295 /* GPIO-11-14 cx23417 addr0-3 */
1296 /* GPIO-15-18 cx23417 READY, CS, RD, WR */
1297 /* GPIO-19 IR_RX */
Michael Krufky3ba71d22007-12-07 01:40:36 -03001298
Steven Totha589b662008-01-13 23:44:47 -03001299 /* CX23417 GPIO's */
1300 /* EIO15 Zilog Reset */
1301 /* EIO14 S5H1409/CX24227 Reset */
Steven Tothf659c512009-06-25 23:43:31 -03001302 mc417_gpio_enable(dev, GPIO_15 | GPIO_14, 1);
1303
1304 /* Put the demod into reset and protect the eeprom */
1305 mc417_gpio_clear(dev, GPIO_15 | GPIO_14);
1306 mdelay(100);
1307
1308 /* Bring the demod and blaster out of reset */
1309 mc417_gpio_set(dev, GPIO_15 | GPIO_14);
1310 mdelay(100);
Steven Totha589b662008-01-13 23:44:47 -03001311
Steven Toth5206d6e2008-01-10 02:09:27 -03001312 /* Force the TDA8295A into reset and back */
Steven Toth21ff3e42009-06-25 23:50:39 -03001313 cx23885_gpio_enable(dev, GPIO_2, 1);
1314 cx23885_gpio_set(dev, GPIO_2);
Steven Toth5206d6e2008-01-10 02:09:27 -03001315 mdelay(20);
Steven Toth21ff3e42009-06-25 23:50:39 -03001316 cx23885_gpio_clear(dev, GPIO_2);
Steven Toth5206d6e2008-01-10 02:09:27 -03001317 mdelay(20);
Steven Toth21ff3e42009-06-25 23:50:39 -03001318 cx23885_gpio_set(dev, GPIO_2);
Steven Toth5206d6e2008-01-10 02:09:27 -03001319 mdelay(20);
Steven Totha6a3f142007-09-08 21:31:56 -03001320 break;
Steven Tothb3ea0162008-04-19 01:14:19 -03001321 case CX23885_BOARD_HAUPPAUGE_HVR1200:
1322 /* GPIO-0 tda10048 demodulator reset */
1323 /* GPIO-2 tda18271 tuner reset */
1324
1325 /* Put the parts into reset and back */
1326 cx_set(GP0_IO, 0x00050000);
1327 mdelay(20);
1328 cx_clear(GP0_IO, 0x00000005);
1329 mdelay(20);
1330 cx_set(GP0_IO, 0x00050005);
1331 break;
Steven Totha780a312008-04-19 01:25:52 -03001332 case CX23885_BOARD_HAUPPAUGE_HVR1700:
1333 /* GPIO-0 TDA10048 demodulator reset */
1334 /* GPIO-2 TDA8295A Reset */
1335 /* GPIO-3-10 cx23417 data0-7 */
1336 /* GPIO-11-14 cx23417 addr0-3 */
1337 /* GPIO-15-18 cx23417 READY, CS, RD, WR */
1338
1339 /* The following GPIO's are on the interna AVCore (cx25840) */
1340 /* GPIO-19 IR_RX */
1341 /* GPIO-20 IR_TX 416/DVBT Select */
1342 /* GPIO-21 IIS DAT */
1343 /* GPIO-22 IIS WCLK */
1344 /* GPIO-23 IIS BCLK */
1345
1346 /* Put the parts into reset and back */
1347 cx_set(GP0_IO, 0x00050000);
1348 mdelay(20);
1349 cx_clear(GP0_IO, 0x00000005);
1350 mdelay(20);
1351 cx_set(GP0_IO, 0x00050005);
1352 break;
Steven Toth66762372008-04-22 15:38:26 -03001353 case CX23885_BOARD_HAUPPAUGE_HVR1400:
1354 /* GPIO-0 Dibcom7000p demodulator reset */
1355 /* GPIO-2 xc3028L tuner reset */
1356 /* GPIO-13 LED */
1357
1358 /* Put the parts into reset and back */
1359 cx_set(GP0_IO, 0x00050000);
1360 mdelay(20);
1361 cx_clear(GP0_IO, 0x00000005);
1362 mdelay(20);
1363 cx_set(GP0_IO, 0x00050005);
1364 break;
Steven Toth1ecc5ae2008-06-30 21:23:50 -03001365 case CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP:
1366 /* GPIO-0 xc5000 tuner reset i2c bus 0 */
1367 /* GPIO-1 s5h1409 demod reset i2c bus 0 */
1368 /* GPIO-2 xc5000 tuner reset i2c bus 1 */
1369 /* GPIO-3 s5h1409 demod reset i2c bus 0 */
1370
1371 /* Put the parts into reset and back */
1372 cx_set(GP0_IO, 0x000f0000);
1373 mdelay(20);
1374 cx_clear(GP0_IO, 0x0000000f);
1375 mdelay(20);
1376 cx_set(GP0_IO, 0x000f000f);
1377 break;
Steven Tothaef2d182008-08-04 21:39:53 -03001378 case CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP:
James Harper46b21bb2014-06-12 07:12:24 -03001379 case CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP2:
Steven Tothaef2d182008-08-04 21:39:53 -03001380 /* GPIO-0 portb xc3028 reset */
1381 /* GPIO-1 portb zl10353 reset */
1382 /* GPIO-2 portc xc3028 reset */
1383 /* GPIO-3 portc zl10353 reset */
1384
1385 /* Put the parts into reset and back */
1386 cx_set(GP0_IO, 0x000f0000);
1387 mdelay(20);
1388 cx_clear(GP0_IO, 0x0000000f);
1389 mdelay(20);
1390 cx_set(GP0_IO, 0x000f000f);
1391 break;
Steven Toth4c56b042008-08-12 13:30:03 -03001392 case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H:
Anca Emanuel642ca1a2013-09-13 11:28:12 -03001393 case CX23885_BOARD_LEADTEK_WINFAST_PXPVR2200:
istvan_v@mailbox.hu0cf8af52011-07-11 10:58:35 -03001394 case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H_XC4000:
Igor M. Liplianin9bb1b7e2008-11-23 14:11:16 -03001395 case CX23885_BOARD_COMPRO_VIDEOMATE_E650F:
Vladimir Geroy34e383d2009-09-18 18:55:47 -03001396 case CX23885_BOARD_COMPRO_VIDEOMATE_E800:
Kusanagi Kouichi0b32d652010-01-22 04:55:28 -03001397 case CX23885_BOARD_LEADTEK_WINFAST_PXTV1200:
Steven Toth4c56b042008-08-12 13:30:03 -03001398 /* GPIO-2 xc3028 tuner reset */
1399
1400 /* The following GPIO's are on the internal AVCore (cx25840) */
1401 /* GPIO-? zl10353 demod reset */
1402
1403 /* Put the parts into reset and back */
1404 cx_set(GP0_IO, 0x00040000);
1405 mdelay(20);
1406 cx_clear(GP0_IO, 0x00000004);
1407 mdelay(20);
1408 cx_set(GP0_IO, 0x00040004);
1409 break;
Igor M. Liplianin96318d02009-01-17 12:11:20 -03001410 case CX23885_BOARD_TBS_6920:
Luis Alvese6001482013-10-01 22:11:35 -03001411 case CX23885_BOARD_TBS_6980:
1412 case CX23885_BOARD_TBS_6981:
Mariusz Bia?o?czykf6671902012-09-12 07:59:18 -03001413 case CX23885_BOARD_PROF_8000:
Igor M. Liplianin96318d02009-01-17 12:11:20 -03001414 cx_write(MC417_CTL, 0x00000036);
1415 cx_write(MC417_OEN, 0x00001000);
Igor M. Liplianin09ea33e2009-11-24 20:16:04 -03001416 cx_set(MC417_RWD, 0x00000002);
1417 mdelay(200);
1418 cx_clear(MC417_RWD, 0x00000800);
1419 mdelay(200);
1420 cx_set(MC417_RWD, 0x00000800);
1421 mdelay(200);
Igor M. Liplianin96318d02009-01-17 12:11:20 -03001422 break;
Igor M. Liplianin5a23b072009-03-03 12:06:09 -03001423 case CX23885_BOARD_NETUP_DUAL_DVBS2_CI:
1424 /* GPIO-0 INTA from CiMax1
1425 GPIO-1 INTB from CiMax2
1426 GPIO-2 reset chips
1427 GPIO-3 to GPIO-10 data/addr for CA
1428 GPIO-11 ~CS0 to CiMax1
1429 GPIO-12 ~CS1 to CiMax2
1430 GPIO-13 ADL0 load LSB addr
1431 GPIO-14 ADL1 load MSB addr
1432 GPIO-15 ~RDY from CiMax
1433 GPIO-17 ~RD to CiMax
1434 GPIO-18 ~WR to CiMax
1435 */
1436 cx_set(GP0_IO, 0x00040000); /* GPIO as out */
1437 /* GPIO1 and GPIO2 as INTA and INTB from CiMaxes, reset low */
1438 cx_clear(GP0_IO, 0x00030004);
1439 mdelay(100);/* reset delay */
1440 cx_set(GP0_IO, 0x00040004); /* GPIO as out, reset high */
1441 cx_write(MC417_CTL, 0x00000037);/* enable GPIO3-18 pins */
1442 /* GPIO-15 IN as ~ACK, rest as OUT */
1443 cx_write(MC417_OEN, 0x00001000);
1444 /* ~RD, ~WR high; ADL0, ADL1 low; ~CS0, ~CS1 high */
1445 cx_write(MC417_RWD, 0x0000c300);
1446 /* enable irq */
1447 cx_write(GPIO_ISM, 0x00000000);/* INTERRUPTS active low*/
1448 break;
Steven Toth2074dff2009-05-02 11:39:46 -03001449 case CX23885_BOARD_HAUPPAUGE_HVR1270:
Michael Krufkyd099bec2009-05-08 22:39:24 -03001450 case CX23885_BOARD_HAUPPAUGE_HVR1275:
Michael Krufky19bc5792009-05-08 16:05:29 -03001451 case CX23885_BOARD_HAUPPAUGE_HVR1255:
Devin Heitmueller0ac60ac2012-07-01 16:15:14 -03001452 case CX23885_BOARD_HAUPPAUGE_HVR1255_22111:
Michael Krufky6b926ec2009-05-12 17:32:17 -03001453 case CX23885_BOARD_HAUPPAUGE_HVR1210:
Michael Krufkyd099bec2009-05-08 22:39:24 -03001454 /* GPIO-5 RF Control: 0 = RF1 Terrestrial, 1 = RF2 Cable */
Michael Krufky6b926ec2009-05-12 17:32:17 -03001455 /* GPIO-6 I2C Gate which can isolate the demod from the bus */
1456 /* GPIO-9 Demod reset */
Steven Toth2074dff2009-05-02 11:39:46 -03001457
1458 /* Put the parts into reset and back */
Michael Krufkyd099bec2009-05-08 22:39:24 -03001459 cx23885_gpio_enable(dev, GPIO_9 | GPIO_6 | GPIO_5, 1);
1460 cx23885_gpio_set(dev, GPIO_9 | GPIO_6 | GPIO_5);
Steven Toth2074dff2009-05-02 11:39:46 -03001461 cx23885_gpio_clear(dev, GPIO_9);
1462 mdelay(20);
1463 cx23885_gpio_set(dev, GPIO_9);
1464 break;
David Wong493b7122009-05-18 05:25:49 -03001465 case CX23885_BOARD_MYGICA_X8506:
David Wong2365b2d2009-06-17 01:38:12 -03001466 case CX23885_BOARD_MAGICPRO_PROHDTVE2:
Alfredo Jesús Delaiti87988752011-11-09 15:13:00 -03001467 case CX23885_BOARD_MYGICA_X8507:
David T.L. Wong8e069bb2009-10-21 12:29:11 -03001468 /* GPIO-0 (0)Analog / (1)Digital TV */
David Wong493b7122009-05-18 05:25:49 -03001469 /* GPIO-1 reset XC5000 */
Mauro Carvalho Chehab0d1b5262013-08-09 08:53:27 -03001470 /* GPIO-2 demod reset */
David T.L. Wong8e069bb2009-10-21 12:29:11 -03001471 cx23885_gpio_enable(dev, GPIO_0 | GPIO_1 | GPIO_2, 1);
1472 cx23885_gpio_clear(dev, GPIO_1 | GPIO_2);
David Wong493b7122009-05-18 05:25:49 -03001473 mdelay(100);
David T.L. Wong8e069bb2009-10-21 12:29:11 -03001474 cx23885_gpio_set(dev, GPIO_0 | GPIO_1 | GPIO_2);
David Wong493b7122009-05-18 05:25:49 -03001475 mdelay(100);
1476 break;
David T. L. Wongea5697f2009-10-26 08:54:04 -03001477 case CX23885_BOARD_MYGICA_X8558PRO:
1478 /* GPIO-0 reset first ATBM8830 */
1479 /* GPIO-1 reset second ATBM8830 */
1480 cx23885_gpio_enable(dev, GPIO_0 | GPIO_1, 1);
1481 cx23885_gpio_clear(dev, GPIO_0 | GPIO_1);
1482 mdelay(100);
1483 cx23885_gpio_set(dev, GPIO_0 | GPIO_1);
1484 mdelay(100);
1485 break;
Steven Toth136973802009-07-20 15:37:25 -03001486 case CX23885_BOARD_HAUPPAUGE_HVR1850:
Michael Krufkyaee0b242009-11-11 01:52:45 -03001487 case CX23885_BOARD_HAUPPAUGE_HVR1290:
Steven Toth136973802009-07-20 15:37:25 -03001488 /* GPIO-0 656_CLK */
1489 /* GPIO-1 656_D0 */
1490 /* GPIO-2 Wake# */
1491 /* GPIO-3-10 cx23417 data0-7 */
1492 /* GPIO-11-14 cx23417 addr0-3 */
1493 /* GPIO-15-18 cx23417 READY, CS, RD, WR */
1494 /* GPIO-19 IR_RX */
1495 /* GPIO-20 C_IR_TX */
1496 /* GPIO-21 I2S DAT */
1497 /* GPIO-22 I2S WCLK */
1498 /* GPIO-23 I2S BCLK */
1499 /* ALT GPIO: EXP GPIO LATCH */
1500
1501 /* CX23417 GPIO's */
1502 /* GPIO-14 S5H1411/CX24228 Reset */
1503 /* GPIO-13 EEPROM write protect */
1504 mc417_gpio_enable(dev, GPIO_14 | GPIO_13, 1);
1505
1506 /* Put the demod into reset and protect the eeprom */
1507 mc417_gpio_clear(dev, GPIO_14 | GPIO_13);
1508 mdelay(100);
1509
1510 /* Bring the demod out of reset */
1511 mc417_gpio_set(dev, GPIO_14);
1512 mdelay(100);
1513
1514 /* CX24228 GPIO */
1515 /* Connected to IF / Mux */
1516 break;
Alexey Chernov9028f582010-12-06 17:09:53 -03001517 case CX23885_BOARD_GOTVIEW_X5_3D_HYBRID:
1518 cx_set(GP0_IO, 0x00010001); /* Bring the part out of reset */
1519 break;
Igor M. Liplianin78db8542011-01-25 17:04:00 -03001520 case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF:
1521 /* GPIO-0 ~INT in
1522 GPIO-1 TMS out
1523 GPIO-2 ~reset chips out
1524 GPIO-3 to GPIO-10 data/addr for CA in/out
1525 GPIO-11 ~CS out
1526 GPIO-12 ADDR out
1527 GPIO-13 ~WR out
1528 GPIO-14 ~RD out
1529 GPIO-15 ~RDY in
1530 GPIO-16 TCK out
1531 GPIO-17 TDO in
1532 GPIO-18 TDI out
1533 */
1534 cx_set(GP0_IO, 0x00060000); /* GPIO-1,2 as out */
1535 /* GPIO-0 as INT, reset & TMS low */
1536 cx_clear(GP0_IO, 0x00010006);
1537 mdelay(100);/* reset delay */
1538 cx_set(GP0_IO, 0x00000004); /* reset high */
1539 cx_write(MC417_CTL, 0x00000037);/* enable GPIO-3..18 pins */
1540 /* GPIO-17 is TDO in, GPIO-15 is ~RDY in, rest is out */
1541 cx_write(MC417_OEN, 0x00005000);
1542 /* ~RD, ~WR high; ADDR low; ~CS high */
1543 cx_write(MC417_RWD, 0x00000d00);
1544 /* enable irq */
1545 cx_write(GPIO_ISM, 0x00000000);/* INTERRUPTS active low*/
1546 break;
Michael Krufky7c62f5a2012-12-15 23:34:09 -03001547 case CX23885_BOARD_HAUPPAUGE_HVR4400:
1548 /* GPIO-8 tda10071 demod reset */
Matthias Schwarzott36efec42014-07-22 17:12:13 -03001549 /* GPIO-9 si2165 demod reset */
Michael Krufky7c62f5a2012-12-15 23:34:09 -03001550
1551 /* Put the parts into reset and back */
Matthias Schwarzott36efec42014-07-22 17:12:13 -03001552 cx23885_gpio_enable(dev, GPIO_8 | GPIO_9, 1);
1553
1554 cx23885_gpio_clear(dev, GPIO_8 | GPIO_9);
Michael Krufky7c62f5a2012-12-15 23:34:09 -03001555 mdelay(100);
Matthias Schwarzott36efec42014-07-22 17:12:13 -03001556 cx23885_gpio_set(dev, GPIO_8 | GPIO_9);
Michael Krufky7c62f5a2012-12-15 23:34:09 -03001557 mdelay(100);
Matthias Schwarzott36efec42014-07-22 17:12:13 -03001558
Michael Krufky7c62f5a2012-12-15 23:34:09 -03001559 break;
Oleh Kravchenkoe8d42372012-12-08 18:20:59 -03001560 case CX23885_BOARD_AVERMEDIA_HC81R:
1561 cx_clear(MC417_CTL, 1);
1562 /* GPIO-0,1,2 setup direction as output */
1563 cx_set(GP0_IO, 0x00070000);
1564 mdelay(10);
1565 /* AF9013 demod reset */
1566 cx_set(GP0_IO, 0x00010001);
1567 mdelay(10);
1568 cx_clear(GP0_IO, 0x00010001);
1569 mdelay(10);
1570 cx_set(GP0_IO, 0x00010001);
1571 mdelay(10);
1572 /* demod tune? */
1573 cx_clear(GP0_IO, 0x00030003);
1574 mdelay(10);
1575 cx_set(GP0_IO, 0x00020002);
1576 mdelay(10);
1577 cx_set(GP0_IO, 0x00010001);
1578 mdelay(10);
1579 cx_clear(GP0_IO, 0x00020002);
1580 /* XC3028L tuner reset */
1581 cx_set(GP0_IO, 0x00040004);
1582 cx_clear(GP0_IO, 0x00040004);
1583 cx_set(GP0_IO, 0x00040004);
1584 mdelay(60);
1585 break;
Olli Salonen29442262014-08-11 16:58:15 -03001586 case CX23885_BOARD_DVBSKY_T9580:
nibble.maxc29d6a82014-11-05 11:58:38 -03001587 case CX23885_BOARD_DVBSKY_S952:
Nibble Maxc02ef642014-11-12 01:23:12 -03001588 case CX23885_BOARD_DVBSKY_T982:
Olli Salonen29442262014-08-11 16:58:15 -03001589 /* enable GPIO3-18 pins */
1590 cx_write(MC417_CTL, 0x00000037);
1591 cx23885_gpio_enable(dev, GPIO_2 | GPIO_11, 1);
1592 cx23885_gpio_clear(dev, GPIO_2 | GPIO_11);
1593 mdelay(100);
1594 cx23885_gpio_set(dev, GPIO_2 | GPIO_11);
1595 break;
Olli Salonen82c10272014-09-29 04:44:16 -03001596 case CX23885_BOARD_DVBSKY_T980C:
nibble.max0e6c7b02014-10-23 07:01:44 -03001597 case CX23885_BOARD_DVBSKY_S950C:
Olli Salonen61b103e2014-10-30 17:48:27 -03001598 case CX23885_BOARD_TT_CT2_4500_CI:
Olli Salonen82c10272014-09-29 04:44:16 -03001599 /*
1600 * GPIO-0 INTA from CiMax, input
1601 * GPIO-1 reset CiMax, output, high active
1602 * GPIO-2 reset demod, output, low active
1603 * GPIO-3 to GPIO-10 data/addr for CAM
1604 * GPIO-11 ~CS0 to CiMax1
1605 * GPIO-12 ~CS1 to CiMax2
1606 * GPIO-13 ADL0 load LSB addr
1607 * GPIO-14 ADL1 load MSB addr
1608 * GPIO-15 ~RDY from CiMax
1609 * GPIO-17 ~RD to CiMax
1610 * GPIO-18 ~WR to CiMax
1611 */
1612
1613 cx_set(GP0_IO, 0x00060002); /* GPIO 1/2 as output */
1614 cx_clear(GP0_IO, 0x00010004); /* GPIO 0 as input */
1615 mdelay(100); /* reset delay */
1616 cx_set(GP0_IO, 0x00060004); /* GPIO as out, reset high */
1617 cx_clear(GP0_IO, 0x00010002);
1618 cx_write(MC417_CTL, 0x00000037); /* enable GPIO3-18 pins */
1619
1620 /* GPIO-15 IN as ~ACK, rest as OUT */
1621 cx_write(MC417_OEN, 0x00001000);
1622
1623 /* ~RD, ~WR high; ADL0, ADL1 low; ~CS0, ~CS1 high */
1624 cx_write(MC417_RWD, 0x0000c300);
1625
1626 /* enable irq */
1627 cx_write(GPIO_ISM, 0x00000000); /* INTERRUPTS active low */
nibble.maxcba54802014-11-05 11:58:07 -03001628 break;
1629 case CX23885_BOARD_DVBSKY_S950:
1630 cx23885_gpio_enable(dev, GPIO_2, 1);
1631 cx23885_gpio_clear(dev, GPIO_2);
1632 msleep(100);
1633 cx23885_gpio_set(dev, GPIO_2);
1634 break;
Steven Totha6a3f142007-09-08 21:31:56 -03001635 }
1636}
1637
1638int cx23885_ir_init(struct cx23885_dev *dev)
1639{
Andy Walls98d109f2010-07-19 00:41:41 -03001640 static struct v4l2_subdev_io_pin_config ir_rxtx_pin_cfg[] = {
Andy Walls81f287d2010-07-18 20:26:37 -03001641 {
1642 .flags = V4L2_SUBDEV_IO_PIN_INPUT,
1643 .pin = CX23885_PIN_IR_RX_GPIO19,
1644 .function = CX23885_PAD_IR_RX,
1645 .value = 0,
1646 .strength = CX25840_PIN_DRIVE_MEDIUM,
1647 }, {
1648 .flags = V4L2_SUBDEV_IO_PIN_OUTPUT,
1649 .pin = CX23885_PIN_IR_TX_GPIO20,
1650 .function = CX23885_PAD_IR_TX,
1651 .value = 0,
1652 .strength = CX25840_PIN_DRIVE_MEDIUM,
1653 }
1654 };
Andy Walls98d109f2010-07-19 00:41:41 -03001655 const size_t ir_rxtx_pin_cfg_count = ARRAY_SIZE(ir_rxtx_pin_cfg);
1656
1657 static struct v4l2_subdev_io_pin_config ir_rx_pin_cfg[] = {
1658 {
1659 .flags = V4L2_SUBDEV_IO_PIN_INPUT,
1660 .pin = CX23885_PIN_IR_RX_GPIO19,
1661 .function = CX23885_PAD_IR_RX,
1662 .value = 0,
1663 .strength = CX25840_PIN_DRIVE_MEDIUM,
1664 }
1665 };
1666 const size_t ir_rx_pin_cfg_count = ARRAY_SIZE(ir_rx_pin_cfg);
Andy Walls81f287d2010-07-18 20:26:37 -03001667
1668 struct v4l2_subdev_ir_parameters params;
Andy Walls29f8a0a2009-09-26 23:17:30 -03001669 int ret = 0;
Steven Totha6a3f142007-09-08 21:31:56 -03001670 switch (dev->board) {
Michael Krufky07b4a832007-12-18 01:09:11 -03001671 case CX23885_BOARD_HAUPPAUGE_HVR1500:
Steven Tothd1987d52007-12-18 01:57:06 -03001672 case CX23885_BOARD_HAUPPAUGE_HVR1500Q:
Steven Totha6a3f142007-09-08 21:31:56 -03001673 case CX23885_BOARD_HAUPPAUGE_HVR1800:
Steven Tothb3ea0162008-04-19 01:14:19 -03001674 case CX23885_BOARD_HAUPPAUGE_HVR1200:
Steven Toth66762372008-04-22 15:38:26 -03001675 case CX23885_BOARD_HAUPPAUGE_HVR1400:
Michael Krufkyd099bec2009-05-08 22:39:24 -03001676 case CX23885_BOARD_HAUPPAUGE_HVR1275:
Michael Krufky19bc5792009-05-08 16:05:29 -03001677 case CX23885_BOARD_HAUPPAUGE_HVR1255:
Devin Heitmueller0ac60ac2012-07-01 16:15:14 -03001678 case CX23885_BOARD_HAUPPAUGE_HVR1255_22111:
Michael Krufky6b926ec2009-05-12 17:32:17 -03001679 case CX23885_BOARD_HAUPPAUGE_HVR1210:
Steven Totha6a3f142007-09-08 21:31:56 -03001680 /* FIXME: Implement me */
1681 break;
Andy Walls9b3d8ec2011-06-08 21:24:25 -03001682 case CX23885_BOARD_HAUPPAUGE_HVR1270:
1683 ret = cx23888_ir_probe(dev);
1684 if (ret)
1685 break;
1686 dev->sd_ir = cx23885_find_hw(dev, CX23885_HW_888_IR);
1687 v4l2_subdev_call(dev->sd_cx25840, core, s_io_pin_config,
1688 ir_rx_pin_cfg_count, ir_rx_pin_cfg);
1689 break;
Andy Walls29f8a0a2009-09-26 23:17:30 -03001690 case CX23885_BOARD_HAUPPAUGE_HVR1850:
Michael Krufky7fec6fe2009-11-11 15:46:09 -03001691 case CX23885_BOARD_HAUPPAUGE_HVR1290:
Andy Walls29f8a0a2009-09-26 23:17:30 -03001692 ret = cx23888_ir_probe(dev);
1693 if (ret)
1694 break;
1695 dev->sd_ir = cx23885_find_hw(dev, CX23885_HW_888_IR);
Andy Walls81f287d2010-07-18 20:26:37 -03001696 v4l2_subdev_call(dev->sd_cx25840, core, s_io_pin_config,
Andy Walls98d109f2010-07-19 00:41:41 -03001697 ir_rxtx_pin_cfg_count, ir_rxtx_pin_cfg);
Andy Walls81f287d2010-07-18 20:26:37 -03001698 /*
1699 * For these boards we need to invert the Tx output via the
1700 * IR controller to have the LED off while idle
1701 */
1702 v4l2_subdev_call(dev->sd_ir, ir, tx_g_parameters, &params);
1703 params.enable = false;
1704 params.shutdown = false;
1705 params.invert_level = true;
1706 v4l2_subdev_call(dev->sd_ir, ir, tx_s_parameters, &params);
1707 params.shutdown = true;
1708 v4l2_subdev_call(dev->sd_ir, ir, tx_s_parameters, &params);
Andy Walls29f8a0a2009-09-26 23:17:30 -03001709 break;
Djuri Baars076f0e32012-07-28 09:01:38 -03001710 case CX23885_BOARD_TERRATEC_CINERGY_T_PCIE_DUAL:
Andy Walls98d109f2010-07-19 00:41:41 -03001711 case CX23885_BOARD_TEVII_S470:
Alfredo Jesús Delaitie5f670b2012-11-08 15:50:25 -03001712 case CX23885_BOARD_MYGICA_X8507:
Luis Alvese6001482013-10-01 22:11:35 -03001713 case CX23885_BOARD_TBS_6980:
1714 case CX23885_BOARD_TBS_6981:
nibble.maxd11a3832014-09-29 11:17:36 -03001715 case CX23885_BOARD_DVBSKY_T9580:
nibble.max070e6662014-10-23 07:02:16 -03001716 case CX23885_BOARD_DVBSKY_T980C:
1717 case CX23885_BOARD_DVBSKY_S950C:
Olli Salonen61b103e2014-10-30 17:48:27 -03001718 case CX23885_BOARD_TT_CT2_4500_CI:
nibble.maxcba54802014-11-05 11:58:07 -03001719 case CX23885_BOARD_DVBSKY_S950:
nibble.maxc29d6a82014-11-05 11:58:38 -03001720 case CX23885_BOARD_DVBSKY_S952:
Nibble Maxc02ef642014-11-12 01:23:12 -03001721 case CX23885_BOARD_DVBSKY_T982:
Andy Wallsfa647f22010-07-19 21:22:05 -03001722 if (!enable_885_ir)
1723 break;
Andy Walls98d109f2010-07-19 00:41:41 -03001724 dev->sd_ir = cx23885_find_hw(dev, CX23885_HW_AV_CORE);
1725 if (dev->sd_ir == NULL) {
1726 ret = -ENODEV;
1727 break;
1728 }
1729 v4l2_subdev_call(dev->sd_cx25840, core, s_io_pin_config,
1730 ir_rx_pin_cfg_count, ir_rx_pin_cfg);
Andy Walls98d109f2010-07-19 00:41:41 -03001731 break;
1732 case CX23885_BOARD_HAUPPAUGE_HVR1250:
Andy Wallsfa647f22010-07-19 21:22:05 -03001733 if (!enable_885_ir)
1734 break;
Andy Walls98d109f2010-07-19 00:41:41 -03001735 dev->sd_ir = cx23885_find_hw(dev, CX23885_HW_AV_CORE);
1736 if (dev->sd_ir == NULL) {
1737 ret = -ENODEV;
1738 break;
1739 }
1740 v4l2_subdev_call(dev->sd_cx25840, core, s_io_pin_config,
1741 ir_rxtx_pin_cfg_count, ir_rxtx_pin_cfg);
Andy Walls98d109f2010-07-19 00:41:41 -03001742 break;
Steven Toth12886872008-08-04 21:41:06 -03001743 case CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP:
James Harper46b21bb2014-06-12 07:12:24 -03001744 case CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP2:
Steven Toth12886872008-08-04 21:41:06 -03001745 request_module("ir-kbd-i2c");
1746 break;
Steven Totha6a3f142007-09-08 21:31:56 -03001747 }
1748
Andy Walls29f8a0a2009-09-26 23:17:30 -03001749 return ret;
Steven Totha6a3f142007-09-08 21:31:56 -03001750}
1751
Andy Wallsf59ad612009-09-27 19:51:50 -03001752void cx23885_ir_fini(struct cx23885_dev *dev)
1753{
1754 switch (dev->board) {
Andy Walls9b3d8ec2011-06-08 21:24:25 -03001755 case CX23885_BOARD_HAUPPAUGE_HVR1270:
Andy Wallsf59ad612009-09-27 19:51:50 -03001756 case CX23885_BOARD_HAUPPAUGE_HVR1850:
Michael Krufky7fec6fe2009-11-11 15:46:09 -03001757 case CX23885_BOARD_HAUPPAUGE_HVR1290:
Andy Wallsdbe83a32010-07-19 01:19:43 -03001758 cx23885_irq_remove(dev, PCI_MSK_IR);
Andy Wallsf59ad612009-09-27 19:51:50 -03001759 cx23888_ir_remove(dev);
1760 dev->sd_ir = NULL;
1761 break;
Djuri Baars076f0e32012-07-28 09:01:38 -03001762 case CX23885_BOARD_TERRATEC_CINERGY_T_PCIE_DUAL:
Andy Walls98d109f2010-07-19 00:41:41 -03001763 case CX23885_BOARD_TEVII_S470:
1764 case CX23885_BOARD_HAUPPAUGE_HVR1250:
Alfredo Jesús Delaitie5f670b2012-11-08 15:50:25 -03001765 case CX23885_BOARD_MYGICA_X8507:
Luis Alvese6001482013-10-01 22:11:35 -03001766 case CX23885_BOARD_TBS_6980:
1767 case CX23885_BOARD_TBS_6981:
nibble.maxd11a3832014-09-29 11:17:36 -03001768 case CX23885_BOARD_DVBSKY_T9580:
nibble.max070e6662014-10-23 07:02:16 -03001769 case CX23885_BOARD_DVBSKY_T980C:
1770 case CX23885_BOARD_DVBSKY_S950C:
Olli Salonen61b103e2014-10-30 17:48:27 -03001771 case CX23885_BOARD_TT_CT2_4500_CI:
nibble.maxcba54802014-11-05 11:58:07 -03001772 case CX23885_BOARD_DVBSKY_S950:
nibble.maxc29d6a82014-11-05 11:58:38 -03001773 case CX23885_BOARD_DVBSKY_S952:
Nibble Maxc02ef642014-11-12 01:23:12 -03001774 case CX23885_BOARD_DVBSKY_T982:
Andy Wallsdbe83a32010-07-19 01:19:43 -03001775 cx23885_irq_remove(dev, PCI_MSK_AV_CORE);
Andy Walls98d109f2010-07-19 00:41:41 -03001776 /* sd_ir is a duplicate pointer to the AV Core, just clear it */
1777 dev->sd_ir = NULL;
1778 break;
Andy Wallsf59ad612009-09-27 19:51:50 -03001779 }
1780}
1781
Mauro Carvalho Chehabada73ee2012-10-27 11:29:23 -03001782static int netup_jtag_io(void *device, int tms, int tdi, int read_tdo)
Igor M. Liplianin78db8542011-01-25 17:04:00 -03001783{
1784 int data;
1785 int tdo = 0;
1786 struct cx23885_dev *dev = (struct cx23885_dev *)device;
1787 /*TMS*/
1788 data = ((cx_read(GP0_IO)) & (~0x00000002));
1789 data |= (tms ? 0x00020002 : 0x00020000);
1790 cx_write(GP0_IO, data);
1791
1792 /*TDI*/
1793 data = ((cx_read(MC417_RWD)) & (~0x0000a000));
1794 data |= (tdi ? 0x00008000 : 0);
1795 cx_write(MC417_RWD, data);
1796 if (read_tdo)
1797 tdo = (data & 0x00004000) ? 1 : 0; /*TDO*/
1798
1799 cx_write(MC417_RWD, data | 0x00002000);
1800 udelay(1);
1801 /*TCK*/
1802 cx_write(MC417_RWD, data);
1803
1804 return tdo;
1805}
1806
Andy Wallsf59ad612009-09-27 19:51:50 -03001807void cx23885_ir_pci_int_enable(struct cx23885_dev *dev)
1808{
1809 switch (dev->board) {
Andy Walls9b3d8ec2011-06-08 21:24:25 -03001810 case CX23885_BOARD_HAUPPAUGE_HVR1270:
Andy Wallsf59ad612009-09-27 19:51:50 -03001811 case CX23885_BOARD_HAUPPAUGE_HVR1850:
Michael Krufky7fec6fe2009-11-11 15:46:09 -03001812 case CX23885_BOARD_HAUPPAUGE_HVR1290:
Andy Wallsdbe83a32010-07-19 01:19:43 -03001813 if (dev->sd_ir)
1814 cx23885_irq_add_enable(dev, PCI_MSK_IR);
Andy Wallsf59ad612009-09-27 19:51:50 -03001815 break;
Djuri Baars076f0e32012-07-28 09:01:38 -03001816 case CX23885_BOARD_TERRATEC_CINERGY_T_PCIE_DUAL:
Andy Walls98d109f2010-07-19 00:41:41 -03001817 case CX23885_BOARD_TEVII_S470:
1818 case CX23885_BOARD_HAUPPAUGE_HVR1250:
Alfredo Jesús Delaitie5f670b2012-11-08 15:50:25 -03001819 case CX23885_BOARD_MYGICA_X8507:
Luis Alvese6001482013-10-01 22:11:35 -03001820 case CX23885_BOARD_TBS_6980:
1821 case CX23885_BOARD_TBS_6981:
nibble.maxd11a3832014-09-29 11:17:36 -03001822 case CX23885_BOARD_DVBSKY_T9580:
nibble.max070e6662014-10-23 07:02:16 -03001823 case CX23885_BOARD_DVBSKY_T980C:
1824 case CX23885_BOARD_DVBSKY_S950C:
Olli Salonen61b103e2014-10-30 17:48:27 -03001825 case CX23885_BOARD_TT_CT2_4500_CI:
nibble.maxcba54802014-11-05 11:58:07 -03001826 case CX23885_BOARD_DVBSKY_S950:
nibble.maxc29d6a82014-11-05 11:58:38 -03001827 case CX23885_BOARD_DVBSKY_S952:
Nibble Maxc02ef642014-11-12 01:23:12 -03001828 case CX23885_BOARD_DVBSKY_T982:
Andy Wallsdbe83a32010-07-19 01:19:43 -03001829 if (dev->sd_ir)
1830 cx23885_irq_add_enable(dev, PCI_MSK_AV_CORE);
Andy Walls98d109f2010-07-19 00:41:41 -03001831 break;
Andy Wallsf59ad612009-09-27 19:51:50 -03001832 }
1833}
1834
Steven Tothd19770e2007-03-11 20:44:05 -03001835void cx23885_card_setup(struct cx23885_dev *dev)
1836{
Steven Totha6a3f142007-09-08 21:31:56 -03001837 struct cx23885_tsport *ts1 = &dev->ts1;
1838 struct cx23885_tsport *ts2 = &dev->ts2;
1839
Steven Tothd19770e2007-03-11 20:44:05 -03001840 static u8 eeprom[256];
1841
1842 if (dev->i2c_bus[0].i2c_rc == 0) {
1843 dev->i2c_bus[0].i2c_client.addr = 0xa0 >> 1;
Michael Krufky44a64812007-03-20 23:00:18 -03001844 tveeprom_read(&dev->i2c_bus[0].i2c_client,
1845 eeprom, sizeof(eeprom));
Steven Tothd19770e2007-03-11 20:44:05 -03001846 }
1847
1848 switch (dev->board) {
Steven Totha77743b2007-08-22 21:01:20 -03001849 case CX23885_BOARD_HAUPPAUGE_HVR1250:
Andy Wallsebbeb462010-07-18 17:35:00 -03001850 if (dev->i2c_bus[0].i2c_rc == 0) {
1851 if (eeprom[0x80] != 0x84)
1852 hauppauge_eeprom(dev, eeprom+0xc0);
1853 else
1854 hauppauge_eeprom(dev, eeprom+0x80);
1855 }
1856 break;
Michael Krufky07b4a832007-12-18 01:09:11 -03001857 case CX23885_BOARD_HAUPPAUGE_HVR1500:
Steven Tothd1987d52007-12-18 01:57:06 -03001858 case CX23885_BOARD_HAUPPAUGE_HVR1500Q:
Steven Toth66762372008-04-22 15:38:26 -03001859 case CX23885_BOARD_HAUPPAUGE_HVR1400:
Steven Tothc88133e2008-03-29 17:36:09 -03001860 if (dev->i2c_bus[0].i2c_rc == 0)
1861 hauppauge_eeprom(dev, eeprom+0x80);
1862 break;
Steven Tothd19770e2007-03-11 20:44:05 -03001863 case CX23885_BOARD_HAUPPAUGE_HVR1800:
1864 case CX23885_BOARD_HAUPPAUGE_HVR1800lp:
Steven Tothb3ea0162008-04-19 01:14:19 -03001865 case CX23885_BOARD_HAUPPAUGE_HVR1200:
Steven Totha780a312008-04-19 01:25:52 -03001866 case CX23885_BOARD_HAUPPAUGE_HVR1700:
Steven Toth2074dff2009-05-02 11:39:46 -03001867 case CX23885_BOARD_HAUPPAUGE_HVR1270:
Michael Krufkyd099bec2009-05-08 22:39:24 -03001868 case CX23885_BOARD_HAUPPAUGE_HVR1275:
Michael Krufky19bc5792009-05-08 16:05:29 -03001869 case CX23885_BOARD_HAUPPAUGE_HVR1255:
Devin Heitmueller0ac60ac2012-07-01 16:15:14 -03001870 case CX23885_BOARD_HAUPPAUGE_HVR1255_22111:
Michael Krufky6b926ec2009-05-12 17:32:17 -03001871 case CX23885_BOARD_HAUPPAUGE_HVR1210:
Steven Toth136973802009-07-20 15:37:25 -03001872 case CX23885_BOARD_HAUPPAUGE_HVR1850:
Michael Krufkyaee0b242009-11-11 01:52:45 -03001873 case CX23885_BOARD_HAUPPAUGE_HVR1290:
Michael Krufky7c62f5a2012-12-15 23:34:09 -03001874 case CX23885_BOARD_HAUPPAUGE_HVR4400:
Hans Verkuilcce11b02014-06-27 11:15:42 -03001875 case CX23885_BOARD_HAUPPAUGE_IMPACTVCBE:
Steven Tothd19770e2007-03-11 20:44:05 -03001876 if (dev->i2c_bus[0].i2c_rc == 0)
Steven Tothc88133e2008-03-29 17:36:09 -03001877 hauppauge_eeprom(dev, eeprom+0xc0);
Steven Tothd19770e2007-03-11 20:44:05 -03001878 break;
1879 }
Steven Totha6a3f142007-09-08 21:31:56 -03001880
1881 switch (dev->board) {
Oleh Kravchenkoe8d42372012-12-08 18:20:59 -03001882 case CX23885_BOARD_AVERMEDIA_HC81R:
1883 /* Defaults for VID B */
1884 ts1->gen_ctrl_val = 0x4; /* Parallel */
1885 ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */
1886 ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
1887 /* Defaults for VID C */
1888 /* DREQ_POL, SMODE, PUNC_CLK, MCLK_POL Serial bus + punc clk */
1889 ts2->gen_ctrl_val = 0x10e;
1890 ts2->ts_clk_en_val = 0x1; /* Enable TS_CLK */
1891 ts2->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
1892 break;
Michael Krufky335377b2008-05-07 01:43:10 -03001893 case CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP:
Steven Tothaef2d182008-08-04 21:39:53 -03001894 case CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP:
James Harper46b21bb2014-06-12 07:12:24 -03001895 case CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP2:
Michael Krufky335377b2008-05-07 01:43:10 -03001896 ts2->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */
1897 ts2->ts_clk_en_val = 0x1; /* Enable TS_CLK */
1898 ts2->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
1899 /* break omitted intentionally */
Steven Totha6a3f142007-09-08 21:31:56 -03001900 case CX23885_BOARD_DVICO_FUSIONHDTV_5_EXP:
1901 ts1->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */
1902 ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */
1903 ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
1904 break;
Steven Toth35045132012-01-04 21:08:35 -03001905 case CX23885_BOARD_HAUPPAUGE_HVR1850:
Steven Totha589b662008-01-13 23:44:47 -03001906 case CX23885_BOARD_HAUPPAUGE_HVR1800:
1907 /* Defaults for VID B - Analog encoder */
1908 /* DREQ_POL, SMODE, PUNC_CLK, MCLK_POL Serial bus + punc clk */
1909 ts1->gen_ctrl_val = 0x10e;
1910 ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */
1911 ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
1912
1913 /* APB_TSVALERR_POL (active low)*/
1914 ts1->vld_misc_val = 0x2000;
1915 ts1->hw_sop_ctrl_val = (0x47 << 16 | 188 << 4 | 0xc);
Steven Toth35045132012-01-04 21:08:35 -03001916 cx_write(0x130184, 0xc);
Steven Totha589b662008-01-13 23:44:47 -03001917
1918 /* Defaults for VID C */
1919 ts2->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */
1920 ts2->ts_clk_en_val = 0x1; /* Enable TS_CLK */
1921 ts2->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
1922 break;
Igor M. Liplianin96318d02009-01-17 12:11:20 -03001923 case CX23885_BOARD_TBS_6920:
Igor M. Liplianin09ea33e2009-11-24 20:16:04 -03001924 ts1->gen_ctrl_val = 0x4; /* Parallel */
1925 ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */
1926 ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
1927 break;
1928 case CX23885_BOARD_TEVII_S470:
Igor M. Liplianin7b134e82012-05-11 11:45:42 -03001929 case CX23885_BOARD_TEVII_S471:
Igor M. Liplianinc9b8b042009-01-17 12:23:31 -03001930 case CX23885_BOARD_DVBWORLD_2005:
Mariusz Bia?o?czykf6671902012-09-12 07:59:18 -03001931 case CX23885_BOARD_PROF_8000:
Olli Salonen82c10272014-09-29 04:44:16 -03001932 case CX23885_BOARD_DVBSKY_T980C:
nibble.max0e6c7b02014-10-23 07:01:44 -03001933 case CX23885_BOARD_DVBSKY_S950C:
Olli Salonen61b103e2014-10-30 17:48:27 -03001934 case CX23885_BOARD_TT_CT2_4500_CI:
nibble.maxcba54802014-11-05 11:58:07 -03001935 case CX23885_BOARD_DVBSKY_S950:
Igor M. Liplianin96318d02009-01-17 12:11:20 -03001936 ts1->gen_ctrl_val = 0x5; /* Parallel */
1937 ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */
1938 ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
1939 break;
Igor M. Liplianin5a23b072009-03-03 12:06:09 -03001940 case CX23885_BOARD_NETUP_DUAL_DVBS2_CI:
Igor M. Liplianin78db8542011-01-25 17:04:00 -03001941 case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF:
Stefan Ringel722c90e2012-01-07 09:20:48 -03001942 case CX23885_BOARD_TERRATEC_CINERGY_T_PCIE_DUAL:
Igor M. Liplianin5a23b072009-03-03 12:06:09 -03001943 ts1->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */
1944 ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */
1945 ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
1946 ts2->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */
1947 ts2->ts_clk_en_val = 0x1; /* Enable TS_CLK */
1948 ts2->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
1949 break;
Luis Alvese6001482013-10-01 22:11:35 -03001950 case CX23885_BOARD_TBS_6980:
1951 case CX23885_BOARD_TBS_6981:
1952 ts1->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */
1953 ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */
1954 ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
1955 ts2->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */
1956 ts2->ts_clk_en_val = 0x1; /* Enable TS_CLK */
1957 ts2->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
1958 tbs_card_init(dev);
1959 break;
David Wong493b7122009-05-18 05:25:49 -03001960 case CX23885_BOARD_MYGICA_X8506:
David Wong2365b2d2009-06-17 01:38:12 -03001961 case CX23885_BOARD_MAGICPRO_PROHDTVE2:
Mauro Carvalho Chehab0d1b5262013-08-09 08:53:27 -03001962 case CX23885_BOARD_MYGICA_X8507:
David Wong493b7122009-05-18 05:25:49 -03001963 ts1->gen_ctrl_val = 0x5; /* Parallel */
1964 ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */
1965 ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
1966 break;
David T. L. Wongea5697f2009-10-26 08:54:04 -03001967 case CX23885_BOARD_MYGICA_X8558PRO:
1968 ts1->gen_ctrl_val = 0x5; /* Parallel */
1969 ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */
1970 ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
1971 ts2->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */
1972 ts2->ts_clk_en_val = 0x1; /* Enable TS_CLK */
1973 ts2->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
1974 break;
Michael Krufky7c62f5a2012-12-15 23:34:09 -03001975 case CX23885_BOARD_HAUPPAUGE_HVR4400:
1976 ts1->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */
1977 ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */
1978 ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
Matthias Schwarzott36efec42014-07-22 17:12:13 -03001979 ts2->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */
1980 ts2->ts_clk_en_val = 0x1; /* Enable TS_CLK */
1981 ts2->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
Michael Krufky7c62f5a2012-12-15 23:34:09 -03001982 break;
Olli Salonen29442262014-08-11 16:58:15 -03001983 case CX23885_BOARD_DVBSKY_T9580:
Nibble Maxc02ef642014-11-12 01:23:12 -03001984 case CX23885_BOARD_DVBSKY_T982:
Olli Salonen29442262014-08-11 16:58:15 -03001985 ts1->gen_ctrl_val = 0x5; /* Parallel */
1986 ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */
1987 ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
1988 ts2->gen_ctrl_val = 0x8; /* Serial bus */
1989 ts2->ts_clk_en_val = 0x1; /* Enable TS_CLK */
1990 ts2->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
1991 break;
nibble.maxc29d6a82014-11-05 11:58:38 -03001992 case CX23885_BOARD_DVBSKY_S952:
1993 ts1->gen_ctrl_val = 0x5; /* Parallel */
1994 ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */
1995 ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
1996 ts2->gen_ctrl_val = 0xe; /* Serial bus */
1997 ts2->ts_clk_en_val = 0x1; /* Enable TS_CLK */
1998 ts2->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
1999 break;
Steven Totha6a3f142007-09-08 21:31:56 -03002000 case CX23885_BOARD_HAUPPAUGE_HVR1250:
Michael Krufky07b4a832007-12-18 01:09:11 -03002001 case CX23885_BOARD_HAUPPAUGE_HVR1500:
Steven Tothd1987d52007-12-18 01:57:06 -03002002 case CX23885_BOARD_HAUPPAUGE_HVR1500Q:
Steven Totha6a3f142007-09-08 21:31:56 -03002003 case CX23885_BOARD_HAUPPAUGE_HVR1800lp:
Steven Tothb3ea0162008-04-19 01:14:19 -03002004 case CX23885_BOARD_HAUPPAUGE_HVR1200:
Steven Totha780a312008-04-19 01:25:52 -03002005 case CX23885_BOARD_HAUPPAUGE_HVR1700:
Steven Toth66762372008-04-22 15:38:26 -03002006 case CX23885_BOARD_HAUPPAUGE_HVR1400:
Hans Verkuilcce11b02014-06-27 11:15:42 -03002007 case CX23885_BOARD_HAUPPAUGE_IMPACTVCBE:
Steven Toth4c56b042008-08-12 13:30:03 -03002008 case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H:
Anca Emanuel642ca1a2013-09-13 11:28:12 -03002009 case CX23885_BOARD_LEADTEK_WINFAST_PXPVR2200:
istvan_v@mailbox.hu0cf8af52011-07-11 10:58:35 -03002010 case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H_XC4000:
Igor M. Liplianin9bb1b7e2008-11-23 14:11:16 -03002011 case CX23885_BOARD_COMPRO_VIDEOMATE_E650F:
Steven Toth2074dff2009-05-02 11:39:46 -03002012 case CX23885_BOARD_HAUPPAUGE_HVR1270:
Michael Krufkyd099bec2009-05-08 22:39:24 -03002013 case CX23885_BOARD_HAUPPAUGE_HVR1275:
Michael Krufky19bc5792009-05-08 16:05:29 -03002014 case CX23885_BOARD_HAUPPAUGE_HVR1255:
Devin Heitmueller0ac60ac2012-07-01 16:15:14 -03002015 case CX23885_BOARD_HAUPPAUGE_HVR1255_22111:
Michael Krufky6b926ec2009-05-12 17:32:17 -03002016 case CX23885_BOARD_HAUPPAUGE_HVR1210:
Vladimir Geroy34e383d2009-09-18 18:55:47 -03002017 case CX23885_BOARD_COMPRO_VIDEOMATE_E800:
Michael Krufkyaee0b242009-11-11 01:52:45 -03002018 case CX23885_BOARD_HAUPPAUGE_HVR1290:
Alexey Chernov9028f582010-12-06 17:09:53 -03002019 case CX23885_BOARD_GOTVIEW_X5_3D_HYBRID:
Steven Totha6a3f142007-09-08 21:31:56 -03002020 default:
2021 ts2->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */
2022 ts2->ts_clk_en_val = 0x1; /* Enable TS_CLK */
2023 ts2->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
2024 }
2025
Steven Tothce89cfb2008-04-19 01:36:06 -03002026 /* Certain boards support analog, or require the avcore to be
2027 * loaded, ensure this happens.
2028 */
2029 switch (dev->board) {
Andy Wallsfa647f22010-07-19 21:22:05 -03002030 case CX23885_BOARD_TEVII_S470:
Andy Wallsfa647f22010-07-19 21:22:05 -03002031 /* Currently only enabled for the integrated IR controller */
2032 if (!enable_885_ir)
2033 break;
Devin Heitmuellerd214ddc2012-07-01 16:15:13 -03002034 case CX23885_BOARD_HAUPPAUGE_HVR1250:
Steven Tothce89cfb2008-04-19 01:36:06 -03002035 case CX23885_BOARD_HAUPPAUGE_HVR1800:
Hans Verkuilcce11b02014-06-27 11:15:42 -03002036 case CX23885_BOARD_HAUPPAUGE_IMPACTVCBE:
Steven Tothce89cfb2008-04-19 01:36:06 -03002037 case CX23885_BOARD_HAUPPAUGE_HVR1800lp:
2038 case CX23885_BOARD_HAUPPAUGE_HVR1700:
Steven Toth4c56b042008-08-12 13:30:03 -03002039 case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H:
Anca Emanuel642ca1a2013-09-13 11:28:12 -03002040 case CX23885_BOARD_LEADTEK_WINFAST_PXPVR2200:
istvan_v@mailbox.hu0cf8af52011-07-11 10:58:35 -03002041 case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H_XC4000:
Igor M. Liplianin9bb1b7e2008-11-23 14:11:16 -03002042 case CX23885_BOARD_COMPRO_VIDEOMATE_E650F:
Igor M. Liplianin5a23b072009-03-03 12:06:09 -03002043 case CX23885_BOARD_NETUP_DUAL_DVBS2_CI:
Igor M. Liplianin78db8542011-01-25 17:04:00 -03002044 case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF:
Vladimir Geroy34e383d2009-09-18 18:55:47 -03002045 case CX23885_BOARD_COMPRO_VIDEOMATE_E800:
Devin Heitmueller0ac60ac2012-07-01 16:15:14 -03002046 case CX23885_BOARD_HAUPPAUGE_HVR1255:
2047 case CX23885_BOARD_HAUPPAUGE_HVR1255_22111:
Andy Walls9b3d8ec2011-06-08 21:24:25 -03002048 case CX23885_BOARD_HAUPPAUGE_HVR1270:
Andy Wallsc6b70532009-09-27 00:14:33 -03002049 case CX23885_BOARD_HAUPPAUGE_HVR1850:
David T.L. Wongbc1548a2009-10-21 11:09:28 -03002050 case CX23885_BOARD_MYGICA_X8506:
2051 case CX23885_BOARD_MAGICPRO_PROHDTVE2:
Michael Krufkyaee0b242009-11-11 01:52:45 -03002052 case CX23885_BOARD_HAUPPAUGE_HVR1290:
Kusanagi Kouichi0b32d652010-01-22 04:55:28 -03002053 case CX23885_BOARD_LEADTEK_WINFAST_PXTV1200:
Alexey Chernov9028f582010-12-06 17:09:53 -03002054 case CX23885_BOARD_GOTVIEW_X5_3D_HYBRID:
Mijhail Moreyra18d64472011-10-10 11:09:53 -03002055 case CX23885_BOARD_HAUPPAUGE_HVR1500:
Steven Toth2cb9ccd2011-10-10 11:09:55 -03002056 case CX23885_BOARD_MPX885:
Alfredo Jesús Delaiti87988752011-11-09 15:13:00 -03002057 case CX23885_BOARD_MYGICA_X8507:
Stefan Ringel722c90e2012-01-07 09:20:48 -03002058 case CX23885_BOARD_TERRATEC_CINERGY_T_PCIE_DUAL:
Oleh Kravchenkoe8d42372012-12-08 18:20:59 -03002059 case CX23885_BOARD_AVERMEDIA_HC81R:
Luis Alvese6001482013-10-01 22:11:35 -03002060 case CX23885_BOARD_TBS_6980:
2061 case CX23885_BOARD_TBS_6981:
Olli Salonen29442262014-08-11 16:58:15 -03002062 case CX23885_BOARD_DVBSKY_T9580:
Olli Salonen82c10272014-09-29 04:44:16 -03002063 case CX23885_BOARD_DVBSKY_T980C:
nibble.max0e6c7b02014-10-23 07:01:44 -03002064 case CX23885_BOARD_DVBSKY_S950C:
Olli Salonen61b103e2014-10-30 17:48:27 -03002065 case CX23885_BOARD_TT_CT2_4500_CI:
nibble.maxcba54802014-11-05 11:58:07 -03002066 case CX23885_BOARD_DVBSKY_S950:
nibble.maxc29d6a82014-11-05 11:58:38 -03002067 case CX23885_BOARD_DVBSKY_S952:
Nibble Maxc02ef642014-11-12 01:23:12 -03002068 case CX23885_BOARD_DVBSKY_T982:
Hans Verkuile6574f22009-04-01 03:57:53 -03002069 dev->sd_cx25840 = v4l2_i2c_new_subdev(&dev->v4l2_dev,
2070 &dev->i2c_bus[2].i2c_adap,
Laurent Pinchart9a1f8b32010-09-24 10:16:44 -03002071 "cx25840", 0x88 >> 1, NULL);
Andy Wallsd6b18502010-07-18 23:26:29 -03002072 if (dev->sd_cx25840) {
2073 dev->sd_cx25840->grp_id = CX23885_HW_AV_CORE;
2074 v4l2_subdev_call(dev->sd_cx25840, core, load_fw);
2075 }
Steven Tothce89cfb2008-04-19 01:36:06 -03002076 break;
2077 }
Igor M. Liplianin5a23b072009-03-03 12:06:09 -03002078
2079 /* AUX-PLL 27MHz CLK */
2080 switch (dev->board) {
2081 case CX23885_BOARD_NETUP_DUAL_DVBS2_CI:
2082 netup_initialize(dev);
2083 break;
Igor M. Liplianin78db8542011-01-25 17:04:00 -03002084 case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF: {
2085 int ret;
2086 const struct firmware *fw;
2087 const char *filename = "dvb-netup-altera-01.fw";
2088 char *action = "configure";
Abylay Ospanb8f0d302011-07-14 05:20:29 -03002089 static struct netup_card_info cinfo;
Igor M. Liplianin78db8542011-01-25 17:04:00 -03002090 struct altera_config netup_config = {
2091 .dev = dev,
2092 .action = action,
2093 .jtag_io = netup_jtag_io,
2094 };
2095
2096 netup_initialize(dev);
2097
Abylay Ospanb8f0d302011-07-14 05:20:29 -03002098 netup_get_card_info(&dev->i2c_bus[0].i2c_adap, &cinfo);
Abylay Ospan2d124212011-07-18 04:14:28 -03002099 if (netup_card_rev)
2100 cinfo.rev = netup_card_rev;
2101
Abylay Ospanb8f0d302011-07-14 05:20:29 -03002102 switch (cinfo.rev) {
2103 case 0x4:
2104 filename = "dvb-netup-altera-04.fw";
2105 break;
2106 default:
2107 filename = "dvb-netup-altera-01.fw";
2108 break;
2109 }
2110 printk(KERN_INFO "NetUP card rev=0x%x fw_filename=%s\n",
2111 cinfo.rev, filename);
2112
Igor M. Liplianin78db8542011-01-25 17:04:00 -03002113 ret = request_firmware(&fw, filename, &dev->pci->dev);
2114 if (ret != 0)
2115 printk(KERN_ERR "did not find the firmware file. (%s) "
2116 "Please see linux/Documentation/dvb/ for more details "
2117 "on firmware-problems.", filename);
2118 else
2119 altera_init(&netup_config, fw);
2120
Jesper Juhl3f84a4e2011-04-07 16:23:48 -03002121 release_firmware(fw);
Igor M. Liplianin78db8542011-01-25 17:04:00 -03002122 break;
2123 }
Igor M. Liplianin5a23b072009-03-03 12:06:09 -03002124 }
Steven Tothd19770e2007-03-11 20:44:05 -03002125}