blob: 13739e002a63fb6460bec16572bad10581fcb998 [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.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */
21
22#include <linux/init.h>
23#include <linux/module.h>
24#include <linux/pci.h>
25#include <linux/delay.h>
Steven Toth7b888012008-01-10 03:40:49 -030026#include <media/cx25840.h>
Igor M. Liplianin78db8542011-01-25 17:04:00 -030027#include <linux/firmware.h>
Igor M. Liplianincff4fa82011-09-23 11:17:41 -030028#include <misc/altera.h>
Steven Tothd19770e2007-03-11 20:44:05 -030029
30#include "cx23885.h"
Steven Toth90a71b12008-08-04 21:38:46 -030031#include "tuner-xc2028.h"
Abylay Ospanb8f0d302011-07-14 05:20:29 -030032#include "netup-eeprom.h"
Igor M. Liplianin5a23b072009-03-03 12:06:09 -030033#include "netup-init.h"
Igor M. Liplianin78db8542011-01-25 17:04:00 -030034#include "altera-ci.h"
istvan_v@mailbox.hu0cf8af52011-07-11 10:58:35 -030035#include "xc4000.h"
Igor M. Liplianin78db8542011-01-25 17:04:00 -030036#include "xc5000.h"
Andy Walls29f8a0a2009-09-26 23:17:30 -030037#include "cx23888-ir.h"
Steven Tothd19770e2007-03-11 20:44:05 -030038
Abylay Ospan2d124212011-07-18 04:14:28 -030039static unsigned int netup_card_rev = 1;
40module_param(netup_card_rev, int, 0644);
41MODULE_PARM_DESC(netup_card_rev,
42 "NetUP Dual DVB-T/C CI card revision");
Andy Wallsfa647f22010-07-19 21:22:05 -030043static unsigned int enable_885_ir;
44module_param(enable_885_ir, int, 0644);
45MODULE_PARM_DESC(enable_885_ir,
46 "Enable integrated IR controller for supported\n"
47 "\t\t CX2388[57] boards that are wired for it:\n"
48 "\t\t\tHVR-1250 (reported safe)\n"
49 "\t\t\tTeVii S470 (reported unsafe)\n"
50 "\t\t This can cause an interrupt storm with some cards.\n"
51 "\t\t Default: 0 [Disabled]");
52
Steven Tothd19770e2007-03-11 20:44:05 -030053/* ------------------------------------------------------------------ */
54/* board config info */
55
56struct cx23885_board cx23885_boards[] = {
57 [CX23885_BOARD_UNKNOWN] = {
58 .name = "UNKNOWN/GENERIC",
Steven Tothc7712612008-01-10 02:24:27 -030059 /* Ensure safe default for unknown boards */
60 .clk_freq = 0,
Steven Tothd19770e2007-03-11 20:44:05 -030061 .input = {{
62 .type = CX23885_VMUX_COMPOSITE1,
63 .vmux = 0,
Steven Toth9c8ced52008-10-16 20:18:44 -030064 }, {
Steven Tothd19770e2007-03-11 20:44:05 -030065 .type = CX23885_VMUX_COMPOSITE2,
66 .vmux = 1,
Steven Toth9c8ced52008-10-16 20:18:44 -030067 }, {
Steven Tothd19770e2007-03-11 20:44:05 -030068 .type = CX23885_VMUX_COMPOSITE3,
69 .vmux = 2,
Steven Toth9c8ced52008-10-16 20:18:44 -030070 }, {
Steven Tothd19770e2007-03-11 20:44:05 -030071 .type = CX23885_VMUX_COMPOSITE4,
72 .vmux = 3,
Steven Toth9c8ced52008-10-16 20:18:44 -030073 } },
Steven Tothd19770e2007-03-11 20:44:05 -030074 },
75 [CX23885_BOARD_HAUPPAUGE_HVR1800lp] = {
76 .name = "Hauppauge WinTV-HVR1800lp",
Steven Tothd19770e2007-03-11 20:44:05 -030077 .portc = CX23885_MPEG_DVB,
78 .input = {{
79 .type = CX23885_VMUX_TELEVISION,
80 .vmux = 0,
81 .gpio0 = 0xff00,
Steven Toth9c8ced52008-10-16 20:18:44 -030082 }, {
Steven Tothd19770e2007-03-11 20:44:05 -030083 .type = CX23885_VMUX_DEBUG,
84 .vmux = 0,
85 .gpio0 = 0xff01,
Steven Toth9c8ced52008-10-16 20:18:44 -030086 }, {
Steven Tothd19770e2007-03-11 20:44:05 -030087 .type = CX23885_VMUX_COMPOSITE1,
88 .vmux = 1,
89 .gpio0 = 0xff02,
Steven Toth9c8ced52008-10-16 20:18:44 -030090 }, {
Steven Tothd19770e2007-03-11 20:44:05 -030091 .type = CX23885_VMUX_SVIDEO,
92 .vmux = 2,
93 .gpio0 = 0xff02,
Steven Toth9c8ced52008-10-16 20:18:44 -030094 } },
Steven Tothd19770e2007-03-11 20:44:05 -030095 },
96 [CX23885_BOARD_HAUPPAUGE_HVR1800] = {
97 .name = "Hauppauge WinTV-HVR1800",
Steven Toth7b888012008-01-10 03:40:49 -030098 .porta = CX23885_ANALOG_VIDEO,
Steven Totha589b662008-01-13 23:44:47 -030099 .portb = CX23885_MPEG_ENCODER,
Steven Tothd19770e2007-03-11 20:44:05 -0300100 .portc = CX23885_MPEG_DVB,
Steven Toth7b888012008-01-10 03:40:49 -0300101 .tuner_type = TUNER_PHILIPS_TDA8290,
102 .tuner_addr = 0x42, /* 0x84 >> 1 */
Igor M. Liplianin557f48d2011-01-25 17:05:00 -0300103 .tuner_bus = 1,
Steven Tothd19770e2007-03-11 20:44:05 -0300104 .input = {{
105 .type = CX23885_VMUX_TELEVISION,
Steven Toth7b888012008-01-10 03:40:49 -0300106 .vmux = CX25840_VIN7_CH3 |
107 CX25840_VIN5_CH2 |
108 CX25840_VIN2_CH1,
Steven Toth33cdeb32011-10-10 11:09:55 -0300109 .amux = CX25840_AUDIO8,
Steven Toth7b888012008-01-10 03:40:49 -0300110 .gpio0 = 0,
Steven Toth9c8ced52008-10-16 20:18:44 -0300111 }, {
Steven Tothd19770e2007-03-11 20:44:05 -0300112 .type = CX23885_VMUX_COMPOSITE1,
Steven Toth7b888012008-01-10 03:40:49 -0300113 .vmux = CX25840_VIN7_CH3 |
114 CX25840_VIN4_CH2 |
115 CX25840_VIN6_CH1,
Steven Toth33cdeb32011-10-10 11:09:55 -0300116 .amux = CX25840_AUDIO7,
Steven Toth7b888012008-01-10 03:40:49 -0300117 .gpio0 = 0,
Steven Toth9c8ced52008-10-16 20:18:44 -0300118 }, {
Steven Tothd19770e2007-03-11 20:44:05 -0300119 .type = CX23885_VMUX_SVIDEO,
Steven Toth7b888012008-01-10 03:40:49 -0300120 .vmux = CX25840_VIN7_CH3 |
121 CX25840_VIN4_CH2 |
122 CX25840_VIN8_CH1 |
123 CX25840_SVIDEO_ON,
Steven Toth33cdeb32011-10-10 11:09:55 -0300124 .amux = CX25840_AUDIO7,
Steven Toth7b888012008-01-10 03:40:49 -0300125 .gpio0 = 0,
Steven Toth9c8ced52008-10-16 20:18:44 -0300126 } },
Steven Tothd19770e2007-03-11 20:44:05 -0300127 },
Steven Totha77743b2007-08-22 21:01:20 -0300128 [CX23885_BOARD_HAUPPAUGE_HVR1250] = {
129 .name = "Hauppauge WinTV-HVR1250",
130 .portc = CX23885_MPEG_DVB,
131 .input = {{
132 .type = CX23885_VMUX_TELEVISION,
133 .vmux = 0,
134 .gpio0 = 0xff00,
Steven Toth9c8ced52008-10-16 20:18:44 -0300135 }, {
Steven Totha77743b2007-08-22 21:01:20 -0300136 .type = CX23885_VMUX_DEBUG,
137 .vmux = 0,
138 .gpio0 = 0xff01,
Steven Toth9c8ced52008-10-16 20:18:44 -0300139 }, {
Steven Totha77743b2007-08-22 21:01:20 -0300140 .type = CX23885_VMUX_COMPOSITE1,
141 .vmux = 1,
142 .gpio0 = 0xff02,
Steven Toth9c8ced52008-10-16 20:18:44 -0300143 }, {
Steven Totha77743b2007-08-22 21:01:20 -0300144 .type = CX23885_VMUX_SVIDEO,
145 .vmux = 2,
146 .gpio0 = 0xff02,
Steven Toth9c8ced52008-10-16 20:18:44 -0300147 } },
Steven Totha77743b2007-08-22 21:01:20 -0300148 },
Michael Krufky9bc37ca2007-09-08 15:17:13 -0300149 [CX23885_BOARD_DVICO_FUSIONHDTV_5_EXP] = {
150 .name = "DViCO FusionHDTV5 Express",
Steven Totha6a3f142007-09-08 21:31:56 -0300151 .portb = CX23885_MPEG_DVB,
Michael Krufky9bc37ca2007-09-08 15:17:13 -0300152 },
Steven Tothd1987d52007-12-18 01:57:06 -0300153 [CX23885_BOARD_HAUPPAUGE_HVR1500Q] = {
154 .name = "Hauppauge WinTV-HVR1500Q",
155 .portc = CX23885_MPEG_DVB,
156 },
Michael Krufky07b4a832007-12-18 01:09:11 -0300157 [CX23885_BOARD_HAUPPAUGE_HVR1500] = {
158 .name = "Hauppauge WinTV-HVR1500",
Mijhail Moreyra18d64472011-10-10 11:09:53 -0300159 .porta = CX23885_ANALOG_VIDEO,
Michael Krufky07b4a832007-12-18 01:09:11 -0300160 .portc = CX23885_MPEG_DVB,
Mijhail Moreyra18d64472011-10-10 11:09:53 -0300161 .tuner_type = TUNER_XC2028,
162 .tuner_addr = 0x61, /* 0xc2 >> 1 */
163 .input = {{
164 .type = CX23885_VMUX_TELEVISION,
165 .vmux = CX25840_VIN7_CH3 |
166 CX25840_VIN5_CH2 |
167 CX25840_VIN2_CH1,
168 .gpio0 = 0,
169 }, {
170 .type = CX23885_VMUX_COMPOSITE1,
171 .vmux = CX25840_VIN7_CH3 |
172 CX25840_VIN4_CH2 |
173 CX25840_VIN6_CH1,
174 .gpio0 = 0,
175 }, {
176 .type = CX23885_VMUX_SVIDEO,
177 .vmux = CX25840_VIN7_CH3 |
178 CX25840_VIN4_CH2 |
179 CX25840_VIN8_CH1 |
180 CX25840_SVIDEO_ON,
181 .gpio0 = 0,
182 } },
Michael Krufky07b4a832007-12-18 01:09:11 -0300183 },
Steven Tothb3ea0162008-04-19 01:14:19 -0300184 [CX23885_BOARD_HAUPPAUGE_HVR1200] = {
185 .name = "Hauppauge WinTV-HVR1200",
186 .portc = CX23885_MPEG_DVB,
187 },
Steven Totha780a312008-04-19 01:25:52 -0300188 [CX23885_BOARD_HAUPPAUGE_HVR1700] = {
189 .name = "Hauppauge WinTV-HVR1700",
190 .portc = CX23885_MPEG_DVB,
191 },
Steven Toth66762372008-04-22 15:38:26 -0300192 [CX23885_BOARD_HAUPPAUGE_HVR1400] = {
193 .name = "Hauppauge WinTV-HVR1400",
194 .portc = CX23885_MPEG_DVB,
195 },
Michael Krufky335377b2008-05-07 01:43:10 -0300196 [CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP] = {
197 .name = "DViCO FusionHDTV7 Dual Express",
Steven Tothaaadeac2008-06-30 20:58:38 -0300198 .portb = CX23885_MPEG_DVB,
Michael Krufky335377b2008-05-07 01:43:10 -0300199 .portc = CX23885_MPEG_DVB,
200 },
Steven Tothaef2d182008-08-04 21:39:53 -0300201 [CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP] = {
202 .name = "DViCO FusionHDTV DVB-T Dual Express",
203 .portb = CX23885_MPEG_DVB,
204 .portc = CX23885_MPEG_DVB,
205 },
Steven Toth4c56b042008-08-12 13:30:03 -0300206 [CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H] = {
207 .name = "Leadtek Winfast PxDVR3200 H",
208 .portc = CX23885_MPEG_DVB,
209 },
istvan_v@mailbox.hu0cf8af52011-07-11 10:58:35 -0300210 [CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H_XC4000] = {
211 .name = "Leadtek Winfast PxDVR3200 H XC4000",
212 .porta = CX23885_ANALOG_VIDEO,
213 .portc = CX23885_MPEG_DVB,
214 .tuner_type = TUNER_XC4000,
215 .tuner_addr = 0x61,
Miroslav Slugen9ee85372011-12-11 20:19:34 -0300216 .radio_type = UNSET,
217 .radio_addr = ADDR_UNSET,
istvan_v@mailbox.hu0cf8af52011-07-11 10:58:35 -0300218 .input = {{
219 .type = CX23885_VMUX_TELEVISION,
220 .vmux = CX25840_VIN2_CH1 |
221 CX25840_VIN5_CH2 |
222 CX25840_NONE0_CH3,
223 }, {
224 .type = CX23885_VMUX_COMPOSITE1,
225 .vmux = CX25840_COMPOSITE1,
226 }, {
227 .type = CX23885_VMUX_SVIDEO,
228 .vmux = CX25840_SVIDEO_LUMA3 |
229 CX25840_SVIDEO_CHROMA4,
230 }, {
231 .type = CX23885_VMUX_COMPONENT,
232 .vmux = CX25840_VIN7_CH1 |
233 CX25840_VIN6_CH2 |
234 CX25840_VIN8_CH3 |
235 CX25840_COMPONENT_ON,
236 } },
237 },
Igor M. Liplianin9bb1b7e2008-11-23 14:11:16 -0300238 [CX23885_BOARD_COMPRO_VIDEOMATE_E650F] = {
239 .name = "Compro VideoMate E650F",
240 .portc = CX23885_MPEG_DVB,
241 },
Igor M. Liplianin96318d02009-01-17 12:11:20 -0300242 [CX23885_BOARD_TBS_6920] = {
243 .name = "TurboSight TBS 6920",
244 .portb = CX23885_MPEG_DVB,
245 },
Igor M. Liplianin579943f2009-01-17 12:18:26 -0300246 [CX23885_BOARD_TEVII_S470] = {
247 .name = "TeVii S470",
248 .portb = CX23885_MPEG_DVB,
249 },
Igor M. Liplianinc9b8b042009-01-17 12:23:31 -0300250 [CX23885_BOARD_DVBWORLD_2005] = {
251 .name = "DVBWorld DVB-S2 2005",
252 .portb = CX23885_MPEG_DVB,
253 },
Igor M. Liplianin5a23b072009-03-03 12:06:09 -0300254 [CX23885_BOARD_NETUP_DUAL_DVBS2_CI] = {
Igor M. Liplianin78db8542011-01-25 17:04:00 -0300255 .ci_type = 1,
Igor M. Liplianin5a23b072009-03-03 12:06:09 -0300256 .name = "NetUP Dual DVB-S2 CI",
257 .portb = CX23885_MPEG_DVB,
258 .portc = CX23885_MPEG_DVB,
259 },
Steven Toth2074dff2009-05-02 11:39:46 -0300260 [CX23885_BOARD_HAUPPAUGE_HVR1270] = {
261 .name = "Hauppauge WinTV-HVR1270",
Michael Krufkya5dbf452009-05-03 23:27:02 -0300262 .portc = CX23885_MPEG_DVB,
Steven Toth2074dff2009-05-02 11:39:46 -0300263 },
Michael Krufkyd099bec2009-05-08 22:39:24 -0300264 [CX23885_BOARD_HAUPPAUGE_HVR1275] = {
265 .name = "Hauppauge WinTV-HVR1275",
266 .portc = CX23885_MPEG_DVB,
267 },
Michael Krufky19bc5792009-05-08 16:05:29 -0300268 [CX23885_BOARD_HAUPPAUGE_HVR1255] = {
269 .name = "Hauppauge WinTV-HVR1255",
270 .portc = CX23885_MPEG_DVB,
271 },
Michael Krufky6b926ec2009-05-12 17:32:17 -0300272 [CX23885_BOARD_HAUPPAUGE_HVR1210] = {
273 .name = "Hauppauge WinTV-HVR1210",
274 .portc = CX23885_MPEG_DVB,
275 },
David Wong493b7122009-05-18 05:25:49 -0300276 [CX23885_BOARD_MYGICA_X8506] = {
277 .name = "Mygica X8506 DMB-TH",
David T.L. Wong6f0d8c02009-10-21 13:15:30 -0300278 .tuner_type = TUNER_XC5000,
279 .tuner_addr = 0x61,
Igor M. Liplianin557f48d2011-01-25 17:05:00 -0300280 .tuner_bus = 1,
David T.L. Wongbc1548a2009-10-21 11:09:28 -0300281 .porta = CX23885_ANALOG_VIDEO,
David Wong493b7122009-05-18 05:25:49 -0300282 .portb = CX23885_MPEG_DVB,
David T.L. Wongbc1548a2009-10-21 11:09:28 -0300283 .input = {
284 {
David T.L. Wong6f0d8c02009-10-21 13:15:30 -0300285 .type = CX23885_VMUX_TELEVISION,
286 .vmux = CX25840_COMPOSITE2,
287 },
288 {
David T.L. Wongbc1548a2009-10-21 11:09:28 -0300289 .type = CX23885_VMUX_COMPOSITE1,
290 .vmux = CX25840_COMPOSITE8,
291 },
292 {
293 .type = CX23885_VMUX_SVIDEO,
294 .vmux = CX25840_SVIDEO_LUMA3 |
295 CX25840_SVIDEO_CHROMA4,
296 },
297 {
298 .type = CX23885_VMUX_COMPONENT,
299 .vmux = CX25840_COMPONENT_ON |
300 CX25840_VIN1_CH1 |
301 CX25840_VIN6_CH2 |
302 CX25840_VIN7_CH3,
303 },
304 },
David Wong493b7122009-05-18 05:25:49 -0300305 },
David Wong2365b2d2009-06-17 01:38:12 -0300306 [CX23885_BOARD_MAGICPRO_PROHDTVE2] = {
307 .name = "Magic-Pro ProHDTV Extreme 2",
David T.L. Wong6f0d8c02009-10-21 13:15:30 -0300308 .tuner_type = TUNER_XC5000,
309 .tuner_addr = 0x61,
Igor M. Liplianin557f48d2011-01-25 17:05:00 -0300310 .tuner_bus = 1,
David T.L. Wongbc1548a2009-10-21 11:09:28 -0300311 .porta = CX23885_ANALOG_VIDEO,
David Wong2365b2d2009-06-17 01:38:12 -0300312 .portb = CX23885_MPEG_DVB,
David T.L. Wongbc1548a2009-10-21 11:09:28 -0300313 .input = {
314 {
David T.L. Wong6f0d8c02009-10-21 13:15:30 -0300315 .type = CX23885_VMUX_TELEVISION,
316 .vmux = CX25840_COMPOSITE2,
317 },
318 {
David T.L. Wongbc1548a2009-10-21 11:09:28 -0300319 .type = CX23885_VMUX_COMPOSITE1,
320 .vmux = CX25840_COMPOSITE8,
321 },
322 {
323 .type = CX23885_VMUX_SVIDEO,
324 .vmux = CX25840_SVIDEO_LUMA3 |
325 CX25840_SVIDEO_CHROMA4,
326 },
327 {
328 .type = CX23885_VMUX_COMPONENT,
329 .vmux = CX25840_COMPONENT_ON |
330 CX25840_VIN1_CH1 |
331 CX25840_VIN6_CH2 |
332 CX25840_VIN7_CH3,
333 },
334 },
David Wong2365b2d2009-06-17 01:38:12 -0300335 },
Steven Toth136973802009-07-20 15:37:25 -0300336 [CX23885_BOARD_HAUPPAUGE_HVR1850] = {
337 .name = "Hauppauge WinTV-HVR1850",
Steven Toth35045132012-01-04 21:08:35 -0300338 .porta = CX23885_ANALOG_VIDEO,
Steven Toth136973802009-07-20 15:37:25 -0300339 .portb = CX23885_MPEG_ENCODER,
340 .portc = CX23885_MPEG_DVB,
Steven Toth35045132012-01-04 21:08:35 -0300341 .tuner_type = TUNER_ABSENT,
342 .tuner_addr = 0x42, /* 0x84 >> 1 */
343 .force_bff = 1,
344 .input = {{
345 .type = CX23885_VMUX_TELEVISION,
346 .vmux = CX25840_VIN7_CH3 |
347 CX25840_VIN5_CH2 |
348 CX25840_VIN2_CH1 |
349 CX25840_DIF_ON,
350 .amux = CX25840_AUDIO8,
351 }, {
352 .type = CX23885_VMUX_COMPOSITE1,
353 .vmux = CX25840_VIN7_CH3 |
354 CX25840_VIN4_CH2 |
355 CX25840_VIN6_CH1,
356 .amux = CX25840_AUDIO7,
357 }, {
358 .type = CX23885_VMUX_SVIDEO,
359 .vmux = CX25840_VIN7_CH3 |
360 CX25840_VIN4_CH2 |
361 CX25840_VIN8_CH1 |
362 CX25840_SVIDEO_ON,
363 .amux = CX25840_AUDIO7,
364 } },
Steven Toth136973802009-07-20 15:37:25 -0300365 },
Vladimir Geroy34e383d2009-09-18 18:55:47 -0300366 [CX23885_BOARD_COMPRO_VIDEOMATE_E800] = {
367 .name = "Compro VideoMate E800",
368 .portc = CX23885_MPEG_DVB,
369 },
Michael Krufkyaee0b242009-11-11 01:52:45 -0300370 [CX23885_BOARD_HAUPPAUGE_HVR1290] = {
371 .name = "Hauppauge WinTV-HVR1290",
372 .portc = CX23885_MPEG_DVB,
373 },
David T. L. Wongea5697f2009-10-26 08:54:04 -0300374 [CX23885_BOARD_MYGICA_X8558PRO] = {
375 .name = "Mygica X8558 PRO DMB-TH",
376 .portb = CX23885_MPEG_DVB,
377 .portc = CX23885_MPEG_DVB,
378 },
Kusanagi Kouichi0b32d652010-01-22 04:55:28 -0300379 [CX23885_BOARD_LEADTEK_WINFAST_PXTV1200] = {
380 .name = "LEADTEK WinFast PxTV1200",
381 .porta = CX23885_ANALOG_VIDEO,
382 .tuner_type = TUNER_XC2028,
383 .tuner_addr = 0x61,
Igor M. Liplianin557f48d2011-01-25 17:05:00 -0300384 .tuner_bus = 1,
Kusanagi Kouichi0b32d652010-01-22 04:55:28 -0300385 .input = {{
386 .type = CX23885_VMUX_TELEVISION,
387 .vmux = CX25840_VIN2_CH1 |
388 CX25840_VIN5_CH2 |
389 CX25840_NONE0_CH3,
390 }, {
391 .type = CX23885_VMUX_COMPOSITE1,
392 .vmux = CX25840_COMPOSITE1,
393 }, {
394 .type = CX23885_VMUX_SVIDEO,
395 .vmux = CX25840_SVIDEO_LUMA3 |
396 CX25840_SVIDEO_CHROMA4,
397 }, {
398 .type = CX23885_VMUX_COMPONENT,
399 .vmux = CX25840_VIN7_CH1 |
400 CX25840_VIN6_CH2 |
401 CX25840_VIN8_CH3 |
402 CX25840_COMPONENT_ON,
403 } },
404 },
Alexey Chernov9028f582010-12-06 17:09:53 -0300405 [CX23885_BOARD_GOTVIEW_X5_3D_HYBRID] = {
406 .name = "GoTView X5 3D Hybrid",
407 .tuner_type = TUNER_XC5000,
408 .tuner_addr = 0x64,
Igor M. Liplianin557f48d2011-01-25 17:05:00 -0300409 .tuner_bus = 1,
Alexey Chernov9028f582010-12-06 17:09:53 -0300410 .porta = CX23885_ANALOG_VIDEO,
411 .portb = CX23885_MPEG_DVB,
412 .input = {{
413 .type = CX23885_VMUX_TELEVISION,
414 .vmux = CX25840_VIN2_CH1 |
415 CX25840_VIN5_CH2,
416 .gpio0 = 0x02,
417 }, {
418 .type = CX23885_VMUX_COMPOSITE1,
419 .vmux = CX23885_VMUX_COMPOSITE1,
420 }, {
421 .type = CX23885_VMUX_SVIDEO,
422 .vmux = CX25840_SVIDEO_LUMA3 |
423 CX25840_SVIDEO_CHROMA4,
424 } },
425 },
Igor M. Liplianin78db8542011-01-25 17:04:00 -0300426 [CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF] = {
427 .ci_type = 2,
428 .name = "NetUP Dual DVB-T/C-CI RF",
429 .porta = CX23885_ANALOG_VIDEO,
430 .portb = CX23885_MPEG_DVB,
431 .portc = CX23885_MPEG_DVB,
Igor M. Liplianin10d0dcd2011-01-25 17:06:00 -0300432 .num_fds_portb = 2,
433 .num_fds_portc = 2,
Igor M. Liplianin78db8542011-01-25 17:04:00 -0300434 .tuner_type = TUNER_XC5000,
435 .tuner_addr = 0x64,
436 .input = { {
437 .type = CX23885_VMUX_TELEVISION,
438 .vmux = CX25840_COMPOSITE1,
439 } },
440 },
Steven Toth2cb9ccd2011-10-10 11:09:55 -0300441 [CX23885_BOARD_MPX885] = {
442 .name = "MPX-885",
443 .porta = CX23885_ANALOG_VIDEO,
444 .input = {{
445 .type = CX23885_VMUX_COMPOSITE1,
446 .vmux = CX25840_COMPOSITE1,
447 .amux = CX25840_AUDIO6,
448 .gpio0 = 0,
449 }, {
450 .type = CX23885_VMUX_COMPOSITE2,
451 .vmux = CX25840_COMPOSITE2,
452 .amux = CX25840_AUDIO6,
453 .gpio0 = 0,
454 }, {
455 .type = CX23885_VMUX_COMPOSITE3,
456 .vmux = CX25840_COMPOSITE3,
457 .amux = CX25840_AUDIO7,
458 .gpio0 = 0,
459 }, {
460 .type = CX23885_VMUX_COMPOSITE4,
461 .vmux = CX25840_COMPOSITE4,
462 .amux = CX25840_AUDIO7,
463 .gpio0 = 0,
464 } },
465 },
Alfredo Jesús Delaiti87988752011-11-09 15:13:00 -0300466 [CX23885_BOARD_MYGICA_X8507] = {
467 .name = "Mygica X8507",
468 .tuner_type = TUNER_XC5000,
469 .tuner_addr = 0x61,
470 .tuner_bus = 1,
471 .porta = CX23885_ANALOG_VIDEO,
472 .input = {
473 {
474 .type = CX23885_VMUX_TELEVISION,
475 .vmux = CX25840_COMPOSITE2,
476 .amux = CX25840_AUDIO8,
477 },
478 {
479 .type = CX23885_VMUX_COMPOSITE1,
480 .vmux = CX25840_COMPOSITE8,
481 },
482 {
483 .type = CX23885_VMUX_SVIDEO,
484 .vmux = CX25840_SVIDEO_LUMA3 |
485 CX25840_SVIDEO_CHROMA4,
486 },
487 {
488 .type = CX23885_VMUX_COMPONENT,
489 .vmux = CX25840_COMPONENT_ON |
490 CX25840_VIN1_CH1 |
491 CX25840_VIN6_CH2 |
492 CX25840_VIN7_CH3,
493 },
494 },
Stefan Ringel722c90e2012-01-07 09:20:48 -0300495 },
496 [CX23885_BOARD_TERRATEC_CINERGY_T_PCIE_DUAL] = {
497 .name = "TerraTec Cinergy T PCIe Dual",
498 .portb = CX23885_MPEG_DVB,
499 .portc = CX23885_MPEG_DVB,
Igor M. Liplianin7b134e82012-05-11 11:45:42 -0300500 },
501 [CX23885_BOARD_TEVII_S471] = {
502 .name = "TeVii S471",
503 .portb = CX23885_MPEG_DVB,
Alfredo Jesús Delaiti87988752011-11-09 15:13:00 -0300504 }
Steven Tothd19770e2007-03-11 20:44:05 -0300505};
506const unsigned int cx23885_bcount = ARRAY_SIZE(cx23885_boards);
507
508/* ------------------------------------------------------------------ */
509/* PCI subsystem IDs */
510
511struct cx23885_subid cx23885_subids[] = {
512 {
513 .subvendor = 0x0070,
514 .subdevice = 0x3400,
515 .card = CX23885_BOARD_UNKNOWN,
Steven Toth9c8ced52008-10-16 20:18:44 -0300516 }, {
Steven Tothd19770e2007-03-11 20:44:05 -0300517 .subvendor = 0x0070,
518 .subdevice = 0x7600,
519 .card = CX23885_BOARD_HAUPPAUGE_HVR1800lp,
Steven Toth9c8ced52008-10-16 20:18:44 -0300520 }, {
Steven Tothd19770e2007-03-11 20:44:05 -0300521 .subvendor = 0x0070,
522 .subdevice = 0x7800,
523 .card = CX23885_BOARD_HAUPPAUGE_HVR1800,
Steven Toth9c8ced52008-10-16 20:18:44 -0300524 }, {
Steven Tothd19770e2007-03-11 20:44:05 -0300525 .subvendor = 0x0070,
526 .subdevice = 0x7801,
527 .card = CX23885_BOARD_HAUPPAUGE_HVR1800,
Steven Toth9c8ced52008-10-16 20:18:44 -0300528 }, {
Steven Totha77743b2007-08-22 21:01:20 -0300529 .subvendor = 0x0070,
Michael Krufky6ccb8cf2007-12-27 21:46:34 -0300530 .subdevice = 0x7809,
531 .card = CX23885_BOARD_HAUPPAUGE_HVR1800,
Steven Toth9c8ced52008-10-16 20:18:44 -0300532 }, {
Michael Krufky6ccb8cf2007-12-27 21:46:34 -0300533 .subvendor = 0x0070,
Steven Totha77743b2007-08-22 21:01:20 -0300534 .subdevice = 0x7911,
535 .card = CX23885_BOARD_HAUPPAUGE_HVR1250,
Steven Toth9c8ced52008-10-16 20:18:44 -0300536 }, {
Michael Krufky9bc37ca2007-09-08 15:17:13 -0300537 .subvendor = 0x18ac,
538 .subdevice = 0xd500,
539 .card = CX23885_BOARD_DVICO_FUSIONHDTV_5_EXP,
Steven Toth9c8ced52008-10-16 20:18:44 -0300540 }, {
Steven Tothd1987d52007-12-18 01:57:06 -0300541 .subvendor = 0x0070,
Michael Krufkyb00fff02007-12-27 22:19:31 -0300542 .subdevice = 0x7790,
543 .card = CX23885_BOARD_HAUPPAUGE_HVR1500Q,
Steven Toth9c8ced52008-10-16 20:18:44 -0300544 }, {
Michael Krufkyb00fff02007-12-27 22:19:31 -0300545 .subvendor = 0x0070,
Steven Tothd1987d52007-12-18 01:57:06 -0300546 .subdevice = 0x7797,
547 .card = CX23885_BOARD_HAUPPAUGE_HVR1500Q,
Steven Toth9c8ced52008-10-16 20:18:44 -0300548 }, {
Michael Krufky07b4a832007-12-18 01:09:11 -0300549 .subvendor = 0x0070,
Michael Krufkyb00fff02007-12-27 22:19:31 -0300550 .subdevice = 0x7710,
551 .card = CX23885_BOARD_HAUPPAUGE_HVR1500,
Steven Toth9c8ced52008-10-16 20:18:44 -0300552 }, {
Michael Krufkyb00fff02007-12-27 22:19:31 -0300553 .subvendor = 0x0070,
Michael Krufky07b4a832007-12-18 01:09:11 -0300554 .subdevice = 0x7717,
555 .card = CX23885_BOARD_HAUPPAUGE_HVR1500,
Steven Tothb3ea0162008-04-19 01:14:19 -0300556 }, {
557 .subvendor = 0x0070,
558 .subdevice = 0x71d1,
559 .card = CX23885_BOARD_HAUPPAUGE_HVR1200,
Steven Totha780a312008-04-19 01:25:52 -0300560 }, {
561 .subvendor = 0x0070,
Michael Krufky3c3852c2008-05-02 16:12:44 -0300562 .subdevice = 0x71d3,
563 .card = CX23885_BOARD_HAUPPAUGE_HVR1200,
564 }, {
565 .subvendor = 0x0070,
Steven Totha780a312008-04-19 01:25:52 -0300566 .subdevice = 0x8101,
567 .card = CX23885_BOARD_HAUPPAUGE_HVR1700,
Steven Toth66762372008-04-22 15:38:26 -0300568 }, {
569 .subvendor = 0x0070,
570 .subdevice = 0x8010,
571 .card = CX23885_BOARD_HAUPPAUGE_HVR1400,
Steven Toth9c8ced52008-10-16 20:18:44 -0300572 }, {
Michael Krufky335377b2008-05-07 01:43:10 -0300573 .subvendor = 0x18ac,
574 .subdevice = 0xd618,
575 .card = CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP,
Steven Toth9c8ced52008-10-16 20:18:44 -0300576 }, {
Steven Tothaef2d182008-08-04 21:39:53 -0300577 .subvendor = 0x18ac,
578 .subdevice = 0xdb78,
579 .card = CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP,
Steven Toth4c56b042008-08-12 13:30:03 -0300580 }, {
581 .subvendor = 0x107d,
582 .subdevice = 0x6681,
583 .card = CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H,
Igor M. Liplianin9bb1b7e2008-11-23 14:11:16 -0300584 }, {
istvan_v@mailbox.hu0cf8af52011-07-11 10:58:35 -0300585 .subvendor = 0x107d,
586 .subdevice = 0x6f39,
587 .card = CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H_XC4000,
588 }, {
Igor M. Liplianin9bb1b7e2008-11-23 14:11:16 -0300589 .subvendor = 0x185b,
590 .subdevice = 0xe800,
591 .card = CX23885_BOARD_COMPRO_VIDEOMATE_E650F,
Igor M. Liplianin96318d02009-01-17 12:11:20 -0300592 }, {
593 .subvendor = 0x6920,
594 .subdevice = 0x8888,
595 .card = CX23885_BOARD_TBS_6920,
Igor M. Liplianin579943f2009-01-17 12:18:26 -0300596 }, {
597 .subvendor = 0xd470,
598 .subdevice = 0x9022,
599 .card = CX23885_BOARD_TEVII_S470,
Igor M. Liplianinc9b8b042009-01-17 12:23:31 -0300600 }, {
601 .subvendor = 0x0001,
602 .subdevice = 0x2005,
603 .card = CX23885_BOARD_DVBWORLD_2005,
Igor M. Liplianin5a23b072009-03-03 12:06:09 -0300604 }, {
605 .subvendor = 0x1b55,
606 .subdevice = 0x2a2c,
607 .card = CX23885_BOARD_NETUP_DUAL_DVBS2_CI,
Steven Toth2074dff2009-05-02 11:39:46 -0300608 }, {
609 .subvendor = 0x0070,
610 .subdevice = 0x2211,
611 .card = CX23885_BOARD_HAUPPAUGE_HVR1270,
Michael Krufkyd099bec2009-05-08 22:39:24 -0300612 }, {
613 .subvendor = 0x0070,
614 .subdevice = 0x2215,
615 .card = CX23885_BOARD_HAUPPAUGE_HVR1275,
Michael Krufky19bc5792009-05-08 16:05:29 -0300616 }, {
617 .subvendor = 0x0070,
Michael Krufky7d7b5282010-06-30 18:17:35 -0300618 .subdevice = 0x221d,
619 .card = CX23885_BOARD_HAUPPAUGE_HVR1275,
620 }, {
621 .subvendor = 0x0070,
Michael Krufky19bc5792009-05-08 16:05:29 -0300622 .subdevice = 0x2251,
623 .card = CX23885_BOARD_HAUPPAUGE_HVR1255,
Michael Krufky6b926ec2009-05-12 17:32:17 -0300624 }, {
625 .subvendor = 0x0070,
Michael Krufky7d7b5282010-06-30 18:17:35 -0300626 .subdevice = 0x2259,
627 .card = CX23885_BOARD_HAUPPAUGE_HVR1255,
628 }, {
629 .subvendor = 0x0070,
Michael Krufky6b926ec2009-05-12 17:32:17 -0300630 .subdevice = 0x2291,
631 .card = CX23885_BOARD_HAUPPAUGE_HVR1210,
632 }, {
633 .subvendor = 0x0070,
634 .subdevice = 0x2295,
635 .card = CX23885_BOARD_HAUPPAUGE_HVR1210,
David Wong493b7122009-05-18 05:25:49 -0300636 }, {
Michael Krufky7d7b5282010-06-30 18:17:35 -0300637 .subvendor = 0x0070,
638 .subdevice = 0x2299,
639 .card = CX23885_BOARD_HAUPPAUGE_HVR1210,
640 }, {
641 .subvendor = 0x0070,
642 .subdevice = 0x229d,
643 .card = CX23885_BOARD_HAUPPAUGE_HVR1210, /* HVR1215 */
644 }, {
645 .subvendor = 0x0070,
646 .subdevice = 0x22f0,
647 .card = CX23885_BOARD_HAUPPAUGE_HVR1210,
648 }, {
649 .subvendor = 0x0070,
650 .subdevice = 0x22f1,
651 .card = CX23885_BOARD_HAUPPAUGE_HVR1255,
652 }, {
653 .subvendor = 0x0070,
654 .subdevice = 0x22f2,
655 .card = CX23885_BOARD_HAUPPAUGE_HVR1275,
656 }, {
657 .subvendor = 0x0070,
658 .subdevice = 0x22f3,
659 .card = CX23885_BOARD_HAUPPAUGE_HVR1210, /* HVR1215 */
660 }, {
661 .subvendor = 0x0070,
662 .subdevice = 0x22f4,
663 .card = CX23885_BOARD_HAUPPAUGE_HVR1210,
664 }, {
665 .subvendor = 0x0070,
666 .subdevice = 0x22f5,
667 .card = CX23885_BOARD_HAUPPAUGE_HVR1210, /* HVR1215 */
668 }, {
David Wong493b7122009-05-18 05:25:49 -0300669 .subvendor = 0x14f1,
670 .subdevice = 0x8651,
671 .card = CX23885_BOARD_MYGICA_X8506,
David Wong2365b2d2009-06-17 01:38:12 -0300672 }, {
673 .subvendor = 0x14f1,
674 .subdevice = 0x8657,
675 .card = CX23885_BOARD_MAGICPRO_PROHDTVE2,
Steven Toth136973802009-07-20 15:37:25 -0300676 }, {
677 .subvendor = 0x0070,
678 .subdevice = 0x8541,
679 .card = CX23885_BOARD_HAUPPAUGE_HVR1850,
Vladimir Geroy34e383d2009-09-18 18:55:47 -0300680 }, {
681 .subvendor = 0x1858,
682 .subdevice = 0xe800,
683 .card = CX23885_BOARD_COMPRO_VIDEOMATE_E800,
Michael Krufkyaee0b242009-11-11 01:52:45 -0300684 }, {
685 .subvendor = 0x0070,
686 .subdevice = 0x8551,
687 .card = CX23885_BOARD_HAUPPAUGE_HVR1290,
David T. L. Wongea5697f2009-10-26 08:54:04 -0300688 }, {
689 .subvendor = 0x14f1,
690 .subdevice = 0x8578,
691 .card = CX23885_BOARD_MYGICA_X8558PRO,
Kusanagi Kouichi0b32d652010-01-22 04:55:28 -0300692 }, {
693 .subvendor = 0x107d,
694 .subdevice = 0x6f22,
695 .card = CX23885_BOARD_LEADTEK_WINFAST_PXTV1200,
Alexey Chernov9028f582010-12-06 17:09:53 -0300696 }, {
697 .subvendor = 0x5654,
698 .subdevice = 0x2390,
699 .card = CX23885_BOARD_GOTVIEW_X5_3D_HYBRID,
Igor M. Liplianin78db8542011-01-25 17:04:00 -0300700 }, {
701 .subvendor = 0x1b55,
702 .subdevice = 0xe2e4,
703 .card = CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF,
Alfredo Jesús Delaiti87988752011-11-09 15:13:00 -0300704 }, {
705 .subvendor = 0x14f1,
706 .subdevice = 0x8502,
707 .card = CX23885_BOARD_MYGICA_X8507,
Stefan Ringel722c90e2012-01-07 09:20:48 -0300708 }, {
709 .subvendor = 0x153b,
710 .subdevice = 0x117e,
711 .card = CX23885_BOARD_TERRATEC_CINERGY_T_PCIE_DUAL,
Igor M. Liplianin7b134e82012-05-11 11:45:42 -0300712 }, {
713 .subvendor = 0xd471,
714 .subdevice = 0x9022,
715 .card = CX23885_BOARD_TEVII_S471,
Steven Tothd19770e2007-03-11 20:44:05 -0300716 },
717};
718const unsigned int cx23885_idcount = ARRAY_SIZE(cx23885_subids);
719
720void cx23885_card_list(struct cx23885_dev *dev)
721{
722 int i;
723
724 if (0 == dev->pci->subsystem_vendor &&
725 0 == dev->pci->subsystem_device) {
Steven Toth9c8ced52008-10-16 20:18:44 -0300726 printk(KERN_INFO
727 "%s: Board has no valid PCIe Subsystem ID and can't\n"
728 "%s: be autodetected. Pass card=<n> insmod option\n"
729 "%s: to workaround that. Redirect complaints to the\n"
730 "%s: vendor of the TV card. Best regards,\n"
Steven Tothd19770e2007-03-11 20:44:05 -0300731 "%s: -- tux\n",
732 dev->name, dev->name, dev->name, dev->name, dev->name);
733 } else {
Steven Toth9c8ced52008-10-16 20:18:44 -0300734 printk(KERN_INFO
735 "%s: Your board isn't known (yet) to the driver.\n"
736 "%s: Try to pick one of the existing card configs via\n"
Steven Tothd19770e2007-03-11 20:44:05 -0300737 "%s: card=<n> insmod option. Updating to the latest\n"
738 "%s: version might help as well.\n",
739 dev->name, dev->name, dev->name, dev->name);
740 }
Steven Toth9c8ced52008-10-16 20:18:44 -0300741 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 -0300742 dev->name);
743 for (i = 0; i < cx23885_bcount; i++)
Steven Toth9c8ced52008-10-16 20:18:44 -0300744 printk(KERN_INFO "%s: card=%d -> %s\n",
Steven Tothd19770e2007-03-11 20:44:05 -0300745 dev->name, i, cx23885_boards[i].name);
746}
747
748static void hauppauge_eeprom(struct cx23885_dev *dev, u8 *eeprom_data)
749{
750 struct tveeprom tv;
751
Steven Toth9c8ced52008-10-16 20:18:44 -0300752 tveeprom_hauppauge_analog(&dev->i2c_bus[0].i2c_client, &tv,
753 eeprom_data);
Steven Tothd19770e2007-03-11 20:44:05 -0300754
Steven Tothd19770e2007-03-11 20:44:05 -0300755 /* Make sure we support the board model */
Steven Toth9c8ced52008-10-16 20:18:44 -0300756 switch (tv.model) {
Michael Krufky5308cf02009-05-12 18:37:35 -0300757 case 22001:
758 /* WinTV-HVR1270 (PCIe, Retail, half height)
759 * ATSC/QAM and basic analog, IR Blast */
760 case 22009:
761 /* WinTV-HVR1210 (PCIe, Retail, half height)
762 * DVB-T and basic analog, IR Blast */
763 case 22011:
764 /* WinTV-HVR1270 (PCIe, Retail, half height)
765 * ATSC/QAM and basic analog, IR Recv */
766 case 22019:
767 /* WinTV-HVR1210 (PCIe, Retail, half height)
768 * DVB-T and basic analog, IR Recv */
769 case 22021:
770 /* WinTV-HVR1275 (PCIe, Retail, half height)
771 * ATSC/QAM and basic analog, IR Recv */
772 case 22029:
773 /* WinTV-HVR1210 (PCIe, Retail, half height)
774 * DVB-T and basic analog, IR Recv */
775 case 22101:
776 /* WinTV-HVR1270 (PCIe, Retail, full height)
777 * ATSC/QAM and basic analog, IR Blast */
778 case 22109:
779 /* WinTV-HVR1210 (PCIe, Retail, full height)
780 * DVB-T and basic analog, IR Blast */
781 case 22111:
782 /* WinTV-HVR1270 (PCIe, Retail, full height)
783 * ATSC/QAM and basic analog, IR Recv */
784 case 22119:
785 /* WinTV-HVR1210 (PCIe, Retail, full height)
786 * DVB-T and basic analog, IR Recv */
787 case 22121:
788 /* WinTV-HVR1275 (PCIe, Retail, full height)
789 * ATSC/QAM and basic analog, IR Recv */
790 case 22129:
791 /* WinTV-HVR1210 (PCIe, Retail, full height)
792 * DVB-T and basic analog, IR Recv */
Michael Krufky36396c82008-05-02 16:14:33 -0300793 case 71009:
794 /* WinTV-HVR1200 (PCIe, Retail, full height)
795 * DVB-T and basic analog */
796 case 71359:
797 /* WinTV-HVR1200 (PCIe, OEM, half height)
798 * DVB-T and basic analog */
799 case 71439:
800 /* WinTV-HVR1200 (PCIe, OEM, half height)
801 * DVB-T and basic analog */
802 case 71449:
803 /* WinTV-HVR1200 (PCIe, OEM, full height)
804 * DVB-T and basic analog */
805 case 71939:
806 /* WinTV-HVR1200 (PCIe, OEM, half height)
807 * DVB-T and basic analog */
808 case 71949:
809 /* WinTV-HVR1200 (PCIe, OEM, full height)
810 * DVB-T and basic analog */
811 case 71959:
812 /* WinTV-HVR1200 (PCIe, OEM, full height)
813 * DVB-T and basic analog */
814 case 71979:
815 /* WinTV-HVR1200 (PCIe, OEM, half height)
816 * DVB-T and basic analog */
817 case 71999:
818 /* WinTV-HVR1200 (PCIe, OEM, full height)
819 * DVB-T and basic analog */
Steven Toth9c8ced52008-10-16 20:18:44 -0300820 case 76601:
821 /* WinTV-HVR1800lp (PCIe, Retail, No IR, Dual
822 channel ATSC and MPEG2 HW Encoder */
823 case 77001:
824 /* WinTV-HVR1500 (Express Card, OEM, No IR, ATSC
825 and Basic analog */
826 case 77011:
827 /* WinTV-HVR1500 (Express Card, Retail, No IR, ATSC
828 and Basic analog */
829 case 77041:
830 /* WinTV-HVR1500Q (Express Card, OEM, No IR, ATSC/QAM
831 and Basic analog */
832 case 77051:
833 /* WinTV-HVR1500Q (Express Card, Retail, No IR, ATSC/QAM
834 and Basic analog */
835 case 78011:
836 /* WinTV-HVR1800 (PCIe, Retail, 3.5mm in, IR, No FM,
837 Dual channel ATSC and MPEG2 HW Encoder */
838 case 78501:
839 /* WinTV-HVR1800 (PCIe, OEM, RCA in, No IR, FM,
840 Dual channel ATSC and MPEG2 HW Encoder */
841 case 78521:
842 /* WinTV-HVR1800 (PCIe, OEM, RCA in, No IR, FM,
843 Dual channel ATSC and MPEG2 HW Encoder */
844 case 78531:
845 /* WinTV-HVR1800 (PCIe, OEM, RCA in, No IR, No FM,
846 Dual channel ATSC and MPEG2 HW Encoder */
847 case 78631:
848 /* WinTV-HVR1800 (PCIe, OEM, No IR, No FM,
849 Dual channel ATSC and MPEG2 HW Encoder */
850 case 79001:
851 /* WinTV-HVR1250 (PCIe, Retail, IR, full height,
852 ATSC and Basic analog */
853 case 79101:
854 /* WinTV-HVR1250 (PCIe, Retail, IR, half height,
855 ATSC and Basic analog */
Andy Wallsebbeb462010-07-18 17:35:00 -0300856 case 79501:
857 /* WinTV-HVR1250 (PCIe, No IR, half height,
858 ATSC [at least] and Basic analog) */
Steven Toth9c8ced52008-10-16 20:18:44 -0300859 case 79561:
860 /* WinTV-HVR1250 (PCIe, OEM, No IR, half height,
861 ATSC and Basic analog */
862 case 79571:
863 /* WinTV-HVR1250 (PCIe, OEM, No IR, full height,
864 ATSC and Basic analog */
865 case 79671:
866 /* WinTV-HVR1250 (PCIe, OEM, No IR, half height,
867 ATSC and Basic analog */
Steven Toth66762372008-04-22 15:38:26 -0300868 case 80019:
869 /* WinTV-HVR1400 (Express Card, Retail, IR,
870 * DVB-T and Basic analog */
Michael Krufky36396c82008-05-02 16:14:33 -0300871 case 81509:
872 /* WinTV-HVR1700 (PCIe, OEM, No IR, half height)
873 * DVB-T and MPEG2 HW Encoder */
Steven Totha780a312008-04-19 01:25:52 -0300874 case 81519:
Michael Krufky36396c82008-05-02 16:14:33 -0300875 /* WinTV-HVR1700 (PCIe, OEM, No IR, full height)
Steven Totha780a312008-04-19 01:25:52 -0300876 * DVB-T and MPEG2 HW Encoder */
Steven Tothd19770e2007-03-11 20:44:05 -0300877 break;
Steven Toth136973802009-07-20 15:37:25 -0300878 case 85021:
Michael Krufky73a5f412009-11-11 10:46:40 -0300879 /* WinTV-HVR1850 (PCIe, Retail, 3.5mm in, IR, FM,
Steven Toth136973802009-07-20 15:37:25 -0300880 Dual channel ATSC and MPEG2 HW Encoder */
881 break;
Michael Krufky73a5f412009-11-11 10:46:40 -0300882 case 85721:
883 /* WinTV-HVR1290 (PCIe, OEM, RCA in, IR,
884 Dual channel ATSC and Basic analog */
885 break;
Steven Tothd19770e2007-03-11 20:44:05 -0300886 default:
Steven Toth136973802009-07-20 15:37:25 -0300887 printk(KERN_WARNING "%s: warning: "
888 "unknown hauppauge model #%d\n",
Steven Toth9c8ced52008-10-16 20:18:44 -0300889 dev->name, tv.model);
Steven Tothd19770e2007-03-11 20:44:05 -0300890 break;
891 }
892
893 printk(KERN_INFO "%s: hauppauge eeprom: model=%d\n",
894 dev->name, tv.model);
895}
896
Michael Krufkyd7cba042008-09-12 13:31:45 -0300897int cx23885_tuner_callback(void *priv, int component, int command, int arg)
Steven Toth8c700172008-01-05 16:55:45 -0300898{
Steven Toth89ce2212008-08-04 22:18:19 -0300899 struct cx23885_tsport *port = priv;
900 struct cx23885_dev *dev = port->dev;
Steven Toth6df51692008-06-30 22:17:05 -0300901 u32 bitmask = 0;
902
Steven Toth89ce2212008-08-04 22:18:19 -0300903 if (command == XC2028_RESET_CLK)
904 return 0;
905
Steven Toth6df51692008-06-30 22:17:05 -0300906 if (command != 0) {
907 printk(KERN_ERR "%s(): Unknown command 0x%x.\n",
908 __func__, command);
909 return -EINVAL;
910 }
Steven Toth8c700172008-01-05 16:55:45 -0300911
Steven Toth9c8ced52008-10-16 20:18:44 -0300912 switch (dev->board) {
Steven Toth90a71b12008-08-04 21:38:46 -0300913 case CX23885_BOARD_HAUPPAUGE_HVR1400:
914 case CX23885_BOARD_HAUPPAUGE_HVR1500:
Steven Toth8c700172008-01-05 16:55:45 -0300915 case CX23885_BOARD_HAUPPAUGE_HVR1500Q:
Steven Toth4c56b042008-08-12 13:30:03 -0300916 case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H:
istvan_v@mailbox.hu0cf8af52011-07-11 10:58:35 -0300917 case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H_XC4000:
Igor M. Liplianin9bb1b7e2008-11-23 14:11:16 -0300918 case CX23885_BOARD_COMPRO_VIDEOMATE_E650F:
Vladimir Geroy34e383d2009-09-18 18:55:47 -0300919 case CX23885_BOARD_COMPRO_VIDEOMATE_E800:
Kusanagi Kouichi0b32d652010-01-22 04:55:28 -0300920 case CX23885_BOARD_LEADTEK_WINFAST_PXTV1200:
Steven Toth90a71b12008-08-04 21:38:46 -0300921 /* Tuner Reset Command */
Steven Toth4c56b042008-08-12 13:30:03 -0300922 bitmask = 0x04;
Steven Toth6df51692008-06-30 22:17:05 -0300923 break;
924 case CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP:
Steven Tothaef2d182008-08-04 21:39:53 -0300925 case CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP:
Steven Toth4c56b042008-08-12 13:30:03 -0300926 /* Two identical tuners on two different i2c buses,
927 * we need to reset the correct gpio. */
Christopher Pascoed4dc6732009-04-27 11:27:04 -0300928 if (port->nr == 1)
Steven Toth4c56b042008-08-12 13:30:03 -0300929 bitmask = 0x01;
Christopher Pascoed4dc6732009-04-27 11:27:04 -0300930 else if (port->nr == 2)
Steven Toth4c56b042008-08-12 13:30:03 -0300931 bitmask = 0x04;
Steven Toth8c700172008-01-05 16:55:45 -0300932 break;
Alexey Chernov9028f582010-12-06 17:09:53 -0300933 case CX23885_BOARD_GOTVIEW_X5_3D_HYBRID:
934 /* Tuner Reset Command */
935 bitmask = 0x02;
936 break;
Igor M. Liplianin78db8542011-01-25 17:04:00 -0300937 case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF:
938 altera_ci_tuner_reset(dev, port->nr);
939 break;
Steven Toth8c700172008-01-05 16:55:45 -0300940 }
941
Steven Toth6df51692008-06-30 22:17:05 -0300942 if (bitmask) {
943 /* Drive the tuner into reset and back out */
944 cx_clear(GP0_IO, bitmask);
945 mdelay(200);
946 cx_set(GP0_IO, bitmask);
947 }
948
949 return 0;
Steven Toth8c700172008-01-05 16:55:45 -0300950}
Steven Toth73c993a2008-01-05 17:08:05 -0300951
Steven Totha6a3f142007-09-08 21:31:56 -0300952void cx23885_gpio_setup(struct cx23885_dev *dev)
953{
Steven Toth9c8ced52008-10-16 20:18:44 -0300954 switch (dev->board) {
Steven Totha6a3f142007-09-08 21:31:56 -0300955 case CX23885_BOARD_HAUPPAUGE_HVR1250:
956 /* GPIO-0 cx24227 demodulator reset */
957 cx_set(GP0_IO, 0x00010001); /* Bring the part out of reset */
958 break;
Michael Krufky07b4a832007-12-18 01:09:11 -0300959 case CX23885_BOARD_HAUPPAUGE_HVR1500:
960 /* GPIO-0 cx24227 demodulator */
961 /* GPIO-2 xc3028 tuner */
962
963 /* Put the parts into reset */
964 cx_set(GP0_IO, 0x00050000);
965 cx_clear(GP0_IO, 0x00000005);
966 msleep(5);
967
968 /* Bring the parts out of reset */
969 cx_set(GP0_IO, 0x00050005);
970 break;
Steven Tothd1987d52007-12-18 01:57:06 -0300971 case CX23885_BOARD_HAUPPAUGE_HVR1500Q:
972 /* GPIO-0 cx24227 demodulator reset */
973 /* GPIO-2 xc5000 tuner reset */
974 cx_set(GP0_IO, 0x00050005); /* Bring the part out of reset */
975 break;
Steven Totha6a3f142007-09-08 21:31:56 -0300976 case CX23885_BOARD_HAUPPAUGE_HVR1800:
977 /* GPIO-0 656_CLK */
978 /* GPIO-1 656_D0 */
979 /* GPIO-2 8295A Reset */
980 /* GPIO-3-10 cx23417 data0-7 */
981 /* GPIO-11-14 cx23417 addr0-3 */
982 /* GPIO-15-18 cx23417 READY, CS, RD, WR */
983 /* GPIO-19 IR_RX */
Michael Krufky3ba71d22007-12-07 01:40:36 -0300984
Steven Totha589b662008-01-13 23:44:47 -0300985 /* CX23417 GPIO's */
986 /* EIO15 Zilog Reset */
987 /* EIO14 S5H1409/CX24227 Reset */
Steven Tothf659c512009-06-25 23:43:31 -0300988 mc417_gpio_enable(dev, GPIO_15 | GPIO_14, 1);
989
990 /* Put the demod into reset and protect the eeprom */
991 mc417_gpio_clear(dev, GPIO_15 | GPIO_14);
992 mdelay(100);
993
994 /* Bring the demod and blaster out of reset */
995 mc417_gpio_set(dev, GPIO_15 | GPIO_14);
996 mdelay(100);
Steven Totha589b662008-01-13 23:44:47 -0300997
Steven Toth5206d6e2008-01-10 02:09:27 -0300998 /* Force the TDA8295A into reset and back */
Steven Toth21ff3e42009-06-25 23:50:39 -0300999 cx23885_gpio_enable(dev, GPIO_2, 1);
1000 cx23885_gpio_set(dev, GPIO_2);
Steven Toth5206d6e2008-01-10 02:09:27 -03001001 mdelay(20);
Steven Toth21ff3e42009-06-25 23:50:39 -03001002 cx23885_gpio_clear(dev, GPIO_2);
Steven Toth5206d6e2008-01-10 02:09:27 -03001003 mdelay(20);
Steven Toth21ff3e42009-06-25 23:50:39 -03001004 cx23885_gpio_set(dev, GPIO_2);
Steven Toth5206d6e2008-01-10 02:09:27 -03001005 mdelay(20);
Steven Totha6a3f142007-09-08 21:31:56 -03001006 break;
Steven Tothb3ea0162008-04-19 01:14:19 -03001007 case CX23885_BOARD_HAUPPAUGE_HVR1200:
1008 /* GPIO-0 tda10048 demodulator reset */
1009 /* GPIO-2 tda18271 tuner reset */
1010
1011 /* Put the parts into reset and back */
1012 cx_set(GP0_IO, 0x00050000);
1013 mdelay(20);
1014 cx_clear(GP0_IO, 0x00000005);
1015 mdelay(20);
1016 cx_set(GP0_IO, 0x00050005);
1017 break;
Steven Totha780a312008-04-19 01:25:52 -03001018 case CX23885_BOARD_HAUPPAUGE_HVR1700:
1019 /* GPIO-0 TDA10048 demodulator reset */
1020 /* GPIO-2 TDA8295A Reset */
1021 /* GPIO-3-10 cx23417 data0-7 */
1022 /* GPIO-11-14 cx23417 addr0-3 */
1023 /* GPIO-15-18 cx23417 READY, CS, RD, WR */
1024
1025 /* The following GPIO's are on the interna AVCore (cx25840) */
1026 /* GPIO-19 IR_RX */
1027 /* GPIO-20 IR_TX 416/DVBT Select */
1028 /* GPIO-21 IIS DAT */
1029 /* GPIO-22 IIS WCLK */
1030 /* GPIO-23 IIS BCLK */
1031
1032 /* Put the parts into reset and back */
1033 cx_set(GP0_IO, 0x00050000);
1034 mdelay(20);
1035 cx_clear(GP0_IO, 0x00000005);
1036 mdelay(20);
1037 cx_set(GP0_IO, 0x00050005);
1038 break;
Steven Toth66762372008-04-22 15:38:26 -03001039 case CX23885_BOARD_HAUPPAUGE_HVR1400:
1040 /* GPIO-0 Dibcom7000p demodulator reset */
1041 /* GPIO-2 xc3028L tuner reset */
1042 /* GPIO-13 LED */
1043
1044 /* Put the parts into reset and back */
1045 cx_set(GP0_IO, 0x00050000);
1046 mdelay(20);
1047 cx_clear(GP0_IO, 0x00000005);
1048 mdelay(20);
1049 cx_set(GP0_IO, 0x00050005);
1050 break;
Steven Toth1ecc5ae2008-06-30 21:23:50 -03001051 case CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP:
1052 /* GPIO-0 xc5000 tuner reset i2c bus 0 */
1053 /* GPIO-1 s5h1409 demod reset i2c bus 0 */
1054 /* GPIO-2 xc5000 tuner reset i2c bus 1 */
1055 /* GPIO-3 s5h1409 demod reset i2c bus 0 */
1056
1057 /* Put the parts into reset and back */
1058 cx_set(GP0_IO, 0x000f0000);
1059 mdelay(20);
1060 cx_clear(GP0_IO, 0x0000000f);
1061 mdelay(20);
1062 cx_set(GP0_IO, 0x000f000f);
1063 break;
Steven Tothaef2d182008-08-04 21:39:53 -03001064 case CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP:
1065 /* GPIO-0 portb xc3028 reset */
1066 /* GPIO-1 portb zl10353 reset */
1067 /* GPIO-2 portc xc3028 reset */
1068 /* GPIO-3 portc zl10353 reset */
1069
1070 /* Put the parts into reset and back */
1071 cx_set(GP0_IO, 0x000f0000);
1072 mdelay(20);
1073 cx_clear(GP0_IO, 0x0000000f);
1074 mdelay(20);
1075 cx_set(GP0_IO, 0x000f000f);
1076 break;
Steven Toth4c56b042008-08-12 13:30:03 -03001077 case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H:
istvan_v@mailbox.hu0cf8af52011-07-11 10:58:35 -03001078 case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H_XC4000:
Igor M. Liplianin9bb1b7e2008-11-23 14:11:16 -03001079 case CX23885_BOARD_COMPRO_VIDEOMATE_E650F:
Vladimir Geroy34e383d2009-09-18 18:55:47 -03001080 case CX23885_BOARD_COMPRO_VIDEOMATE_E800:
Kusanagi Kouichi0b32d652010-01-22 04:55:28 -03001081 case CX23885_BOARD_LEADTEK_WINFAST_PXTV1200:
Steven Toth4c56b042008-08-12 13:30:03 -03001082 /* GPIO-2 xc3028 tuner reset */
1083
1084 /* The following GPIO's are on the internal AVCore (cx25840) */
1085 /* GPIO-? zl10353 demod reset */
1086
1087 /* Put the parts into reset and back */
1088 cx_set(GP0_IO, 0x00040000);
1089 mdelay(20);
1090 cx_clear(GP0_IO, 0x00000004);
1091 mdelay(20);
1092 cx_set(GP0_IO, 0x00040004);
1093 break;
Igor M. Liplianin96318d02009-01-17 12:11:20 -03001094 case CX23885_BOARD_TBS_6920:
1095 cx_write(MC417_CTL, 0x00000036);
1096 cx_write(MC417_OEN, 0x00001000);
Igor M. Liplianin09ea33e2009-11-24 20:16:04 -03001097 cx_set(MC417_RWD, 0x00000002);
1098 mdelay(200);
1099 cx_clear(MC417_RWD, 0x00000800);
1100 mdelay(200);
1101 cx_set(MC417_RWD, 0x00000800);
1102 mdelay(200);
Igor M. Liplianin96318d02009-01-17 12:11:20 -03001103 break;
Igor M. Liplianin5a23b072009-03-03 12:06:09 -03001104 case CX23885_BOARD_NETUP_DUAL_DVBS2_CI:
1105 /* GPIO-0 INTA from CiMax1
1106 GPIO-1 INTB from CiMax2
1107 GPIO-2 reset chips
1108 GPIO-3 to GPIO-10 data/addr for CA
1109 GPIO-11 ~CS0 to CiMax1
1110 GPIO-12 ~CS1 to CiMax2
1111 GPIO-13 ADL0 load LSB addr
1112 GPIO-14 ADL1 load MSB addr
1113 GPIO-15 ~RDY from CiMax
1114 GPIO-17 ~RD to CiMax
1115 GPIO-18 ~WR to CiMax
1116 */
1117 cx_set(GP0_IO, 0x00040000); /* GPIO as out */
1118 /* GPIO1 and GPIO2 as INTA and INTB from CiMaxes, reset low */
1119 cx_clear(GP0_IO, 0x00030004);
1120 mdelay(100);/* reset delay */
1121 cx_set(GP0_IO, 0x00040004); /* GPIO as out, reset high */
1122 cx_write(MC417_CTL, 0x00000037);/* enable GPIO3-18 pins */
1123 /* GPIO-15 IN as ~ACK, rest as OUT */
1124 cx_write(MC417_OEN, 0x00001000);
1125 /* ~RD, ~WR high; ADL0, ADL1 low; ~CS0, ~CS1 high */
1126 cx_write(MC417_RWD, 0x0000c300);
1127 /* enable irq */
1128 cx_write(GPIO_ISM, 0x00000000);/* INTERRUPTS active low*/
1129 break;
Steven Toth2074dff2009-05-02 11:39:46 -03001130 case CX23885_BOARD_HAUPPAUGE_HVR1270:
Michael Krufkyd099bec2009-05-08 22:39:24 -03001131 case CX23885_BOARD_HAUPPAUGE_HVR1275:
Michael Krufky19bc5792009-05-08 16:05:29 -03001132 case CX23885_BOARD_HAUPPAUGE_HVR1255:
Michael Krufky6b926ec2009-05-12 17:32:17 -03001133 case CX23885_BOARD_HAUPPAUGE_HVR1210:
Michael Krufkyd099bec2009-05-08 22:39:24 -03001134 /* GPIO-5 RF Control: 0 = RF1 Terrestrial, 1 = RF2 Cable */
Michael Krufky6b926ec2009-05-12 17:32:17 -03001135 /* GPIO-6 I2C Gate which can isolate the demod from the bus */
1136 /* GPIO-9 Demod reset */
Steven Toth2074dff2009-05-02 11:39:46 -03001137
1138 /* Put the parts into reset and back */
Michael Krufkyd099bec2009-05-08 22:39:24 -03001139 cx23885_gpio_enable(dev, GPIO_9 | GPIO_6 | GPIO_5, 1);
1140 cx23885_gpio_set(dev, GPIO_9 | GPIO_6 | GPIO_5);
Steven Toth2074dff2009-05-02 11:39:46 -03001141 cx23885_gpio_clear(dev, GPIO_9);
1142 mdelay(20);
1143 cx23885_gpio_set(dev, GPIO_9);
1144 break;
David Wong493b7122009-05-18 05:25:49 -03001145 case CX23885_BOARD_MYGICA_X8506:
David Wong2365b2d2009-06-17 01:38:12 -03001146 case CX23885_BOARD_MAGICPRO_PROHDTVE2:
Alfredo Jesús Delaiti87988752011-11-09 15:13:00 -03001147 case CX23885_BOARD_MYGICA_X8507:
David T.L. Wong8e069bb2009-10-21 12:29:11 -03001148 /* GPIO-0 (0)Analog / (1)Digital TV */
David Wong493b7122009-05-18 05:25:49 -03001149 /* GPIO-1 reset XC5000 */
David Wong2365b2d2009-06-17 01:38:12 -03001150 /* GPIO-2 reset LGS8GL5 / LGS8G75 */
David T.L. Wong8e069bb2009-10-21 12:29:11 -03001151 cx23885_gpio_enable(dev, GPIO_0 | GPIO_1 | GPIO_2, 1);
1152 cx23885_gpio_clear(dev, GPIO_1 | GPIO_2);
David Wong493b7122009-05-18 05:25:49 -03001153 mdelay(100);
David T.L. Wong8e069bb2009-10-21 12:29:11 -03001154 cx23885_gpio_set(dev, GPIO_0 | GPIO_1 | GPIO_2);
David Wong493b7122009-05-18 05:25:49 -03001155 mdelay(100);
1156 break;
David T. L. Wongea5697f2009-10-26 08:54:04 -03001157 case CX23885_BOARD_MYGICA_X8558PRO:
1158 /* GPIO-0 reset first ATBM8830 */
1159 /* GPIO-1 reset second ATBM8830 */
1160 cx23885_gpio_enable(dev, GPIO_0 | GPIO_1, 1);
1161 cx23885_gpio_clear(dev, GPIO_0 | GPIO_1);
1162 mdelay(100);
1163 cx23885_gpio_set(dev, GPIO_0 | GPIO_1);
1164 mdelay(100);
1165 break;
Steven Toth136973802009-07-20 15:37:25 -03001166 case CX23885_BOARD_HAUPPAUGE_HVR1850:
Michael Krufkyaee0b242009-11-11 01:52:45 -03001167 case CX23885_BOARD_HAUPPAUGE_HVR1290:
Steven Toth136973802009-07-20 15:37:25 -03001168 /* GPIO-0 656_CLK */
1169 /* GPIO-1 656_D0 */
1170 /* GPIO-2 Wake# */
1171 /* GPIO-3-10 cx23417 data0-7 */
1172 /* GPIO-11-14 cx23417 addr0-3 */
1173 /* GPIO-15-18 cx23417 READY, CS, RD, WR */
1174 /* GPIO-19 IR_RX */
1175 /* GPIO-20 C_IR_TX */
1176 /* GPIO-21 I2S DAT */
1177 /* GPIO-22 I2S WCLK */
1178 /* GPIO-23 I2S BCLK */
1179 /* ALT GPIO: EXP GPIO LATCH */
1180
1181 /* CX23417 GPIO's */
1182 /* GPIO-14 S5H1411/CX24228 Reset */
1183 /* GPIO-13 EEPROM write protect */
1184 mc417_gpio_enable(dev, GPIO_14 | GPIO_13, 1);
1185
1186 /* Put the demod into reset and protect the eeprom */
1187 mc417_gpio_clear(dev, GPIO_14 | GPIO_13);
1188 mdelay(100);
1189
1190 /* Bring the demod out of reset */
1191 mc417_gpio_set(dev, GPIO_14);
1192 mdelay(100);
1193
1194 /* CX24228 GPIO */
1195 /* Connected to IF / Mux */
1196 break;
Alexey Chernov9028f582010-12-06 17:09:53 -03001197 case CX23885_BOARD_GOTVIEW_X5_3D_HYBRID:
1198 cx_set(GP0_IO, 0x00010001); /* Bring the part out of reset */
1199 break;
Igor M. Liplianin78db8542011-01-25 17:04:00 -03001200 case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF:
1201 /* GPIO-0 ~INT in
1202 GPIO-1 TMS out
1203 GPIO-2 ~reset chips out
1204 GPIO-3 to GPIO-10 data/addr for CA in/out
1205 GPIO-11 ~CS out
1206 GPIO-12 ADDR out
1207 GPIO-13 ~WR out
1208 GPIO-14 ~RD out
1209 GPIO-15 ~RDY in
1210 GPIO-16 TCK out
1211 GPIO-17 TDO in
1212 GPIO-18 TDI out
1213 */
1214 cx_set(GP0_IO, 0x00060000); /* GPIO-1,2 as out */
1215 /* GPIO-0 as INT, reset & TMS low */
1216 cx_clear(GP0_IO, 0x00010006);
1217 mdelay(100);/* reset delay */
1218 cx_set(GP0_IO, 0x00000004); /* reset high */
1219 cx_write(MC417_CTL, 0x00000037);/* enable GPIO-3..18 pins */
1220 /* GPIO-17 is TDO in, GPIO-15 is ~RDY in, rest is out */
1221 cx_write(MC417_OEN, 0x00005000);
1222 /* ~RD, ~WR high; ADDR low; ~CS high */
1223 cx_write(MC417_RWD, 0x00000d00);
1224 /* enable irq */
1225 cx_write(GPIO_ISM, 0x00000000);/* INTERRUPTS active low*/
1226 break;
Steven Totha6a3f142007-09-08 21:31:56 -03001227 }
1228}
1229
1230int cx23885_ir_init(struct cx23885_dev *dev)
1231{
Andy Walls98d109f2010-07-19 00:41:41 -03001232 static struct v4l2_subdev_io_pin_config ir_rxtx_pin_cfg[] = {
Andy Walls81f287d2010-07-18 20:26:37 -03001233 {
1234 .flags = V4L2_SUBDEV_IO_PIN_INPUT,
1235 .pin = CX23885_PIN_IR_RX_GPIO19,
1236 .function = CX23885_PAD_IR_RX,
1237 .value = 0,
1238 .strength = CX25840_PIN_DRIVE_MEDIUM,
1239 }, {
1240 .flags = V4L2_SUBDEV_IO_PIN_OUTPUT,
1241 .pin = CX23885_PIN_IR_TX_GPIO20,
1242 .function = CX23885_PAD_IR_TX,
1243 .value = 0,
1244 .strength = CX25840_PIN_DRIVE_MEDIUM,
1245 }
1246 };
Andy Walls98d109f2010-07-19 00:41:41 -03001247 const size_t ir_rxtx_pin_cfg_count = ARRAY_SIZE(ir_rxtx_pin_cfg);
1248
1249 static struct v4l2_subdev_io_pin_config ir_rx_pin_cfg[] = {
1250 {
1251 .flags = V4L2_SUBDEV_IO_PIN_INPUT,
1252 .pin = CX23885_PIN_IR_RX_GPIO19,
1253 .function = CX23885_PAD_IR_RX,
1254 .value = 0,
1255 .strength = CX25840_PIN_DRIVE_MEDIUM,
1256 }
1257 };
1258 const size_t ir_rx_pin_cfg_count = ARRAY_SIZE(ir_rx_pin_cfg);
Andy Walls81f287d2010-07-18 20:26:37 -03001259
1260 struct v4l2_subdev_ir_parameters params;
Andy Walls29f8a0a2009-09-26 23:17:30 -03001261 int ret = 0;
Steven Totha6a3f142007-09-08 21:31:56 -03001262 switch (dev->board) {
Michael Krufky07b4a832007-12-18 01:09:11 -03001263 case CX23885_BOARD_HAUPPAUGE_HVR1500:
Steven Tothd1987d52007-12-18 01:57:06 -03001264 case CX23885_BOARD_HAUPPAUGE_HVR1500Q:
Steven Totha6a3f142007-09-08 21:31:56 -03001265 case CX23885_BOARD_HAUPPAUGE_HVR1800:
Steven Tothb3ea0162008-04-19 01:14:19 -03001266 case CX23885_BOARD_HAUPPAUGE_HVR1200:
Steven Toth66762372008-04-22 15:38:26 -03001267 case CX23885_BOARD_HAUPPAUGE_HVR1400:
Michael Krufkyd099bec2009-05-08 22:39:24 -03001268 case CX23885_BOARD_HAUPPAUGE_HVR1275:
Michael Krufky19bc5792009-05-08 16:05:29 -03001269 case CX23885_BOARD_HAUPPAUGE_HVR1255:
Michael Krufky6b926ec2009-05-12 17:32:17 -03001270 case CX23885_BOARD_HAUPPAUGE_HVR1210:
Steven Totha6a3f142007-09-08 21:31:56 -03001271 /* FIXME: Implement me */
1272 break;
Andy Walls9b3d8ec2011-06-08 21:24:25 -03001273 case CX23885_BOARD_HAUPPAUGE_HVR1270:
1274 ret = cx23888_ir_probe(dev);
1275 if (ret)
1276 break;
1277 dev->sd_ir = cx23885_find_hw(dev, CX23885_HW_888_IR);
1278 v4l2_subdev_call(dev->sd_cx25840, core, s_io_pin_config,
1279 ir_rx_pin_cfg_count, ir_rx_pin_cfg);
1280 break;
Andy Walls29f8a0a2009-09-26 23:17:30 -03001281 case CX23885_BOARD_HAUPPAUGE_HVR1850:
Michael Krufky7fec6fe2009-11-11 15:46:09 -03001282 case CX23885_BOARD_HAUPPAUGE_HVR1290:
Andy Walls29f8a0a2009-09-26 23:17:30 -03001283 ret = cx23888_ir_probe(dev);
1284 if (ret)
1285 break;
1286 dev->sd_ir = cx23885_find_hw(dev, CX23885_HW_888_IR);
Andy Walls81f287d2010-07-18 20:26:37 -03001287 v4l2_subdev_call(dev->sd_cx25840, core, s_io_pin_config,
Andy Walls98d109f2010-07-19 00:41:41 -03001288 ir_rxtx_pin_cfg_count, ir_rxtx_pin_cfg);
Andy Walls81f287d2010-07-18 20:26:37 -03001289 /*
1290 * For these boards we need to invert the Tx output via the
1291 * IR controller to have the LED off while idle
1292 */
1293 v4l2_subdev_call(dev->sd_ir, ir, tx_g_parameters, &params);
1294 params.enable = false;
1295 params.shutdown = false;
1296 params.invert_level = true;
1297 v4l2_subdev_call(dev->sd_ir, ir, tx_s_parameters, &params);
1298 params.shutdown = true;
1299 v4l2_subdev_call(dev->sd_ir, ir, tx_s_parameters, &params);
Andy Walls29f8a0a2009-09-26 23:17:30 -03001300 break;
Andy Walls98d109f2010-07-19 00:41:41 -03001301 case CX23885_BOARD_TEVII_S470:
Andy Wallsfa647f22010-07-19 21:22:05 -03001302 if (!enable_885_ir)
1303 break;
Andy Walls98d109f2010-07-19 00:41:41 -03001304 dev->sd_ir = cx23885_find_hw(dev, CX23885_HW_AV_CORE);
1305 if (dev->sd_ir == NULL) {
1306 ret = -ENODEV;
1307 break;
1308 }
1309 v4l2_subdev_call(dev->sd_cx25840, core, s_io_pin_config,
1310 ir_rx_pin_cfg_count, ir_rx_pin_cfg);
Andy Walls98d109f2010-07-19 00:41:41 -03001311 break;
1312 case CX23885_BOARD_HAUPPAUGE_HVR1250:
Andy Wallsfa647f22010-07-19 21:22:05 -03001313 if (!enable_885_ir)
1314 break;
Andy Walls98d109f2010-07-19 00:41:41 -03001315 dev->sd_ir = cx23885_find_hw(dev, CX23885_HW_AV_CORE);
1316 if (dev->sd_ir == NULL) {
1317 ret = -ENODEV;
1318 break;
1319 }
1320 v4l2_subdev_call(dev->sd_cx25840, core, s_io_pin_config,
1321 ir_rxtx_pin_cfg_count, ir_rxtx_pin_cfg);
Andy Walls98d109f2010-07-19 00:41:41 -03001322 break;
Steven Toth12886872008-08-04 21:41:06 -03001323 case CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP:
1324 request_module("ir-kbd-i2c");
1325 break;
Steven Totha6a3f142007-09-08 21:31:56 -03001326 }
1327
Andy Walls29f8a0a2009-09-26 23:17:30 -03001328 return ret;
Steven Totha6a3f142007-09-08 21:31:56 -03001329}
1330
Andy Wallsf59ad612009-09-27 19:51:50 -03001331void cx23885_ir_fini(struct cx23885_dev *dev)
1332{
1333 switch (dev->board) {
Andy Walls9b3d8ec2011-06-08 21:24:25 -03001334 case CX23885_BOARD_HAUPPAUGE_HVR1270:
Andy Wallsf59ad612009-09-27 19:51:50 -03001335 case CX23885_BOARD_HAUPPAUGE_HVR1850:
Michael Krufky7fec6fe2009-11-11 15:46:09 -03001336 case CX23885_BOARD_HAUPPAUGE_HVR1290:
Andy Wallsdbe83a32010-07-19 01:19:43 -03001337 cx23885_irq_remove(dev, PCI_MSK_IR);
Andy Wallsf59ad612009-09-27 19:51:50 -03001338 cx23888_ir_remove(dev);
1339 dev->sd_ir = NULL;
1340 break;
Andy Walls98d109f2010-07-19 00:41:41 -03001341 case CX23885_BOARD_TEVII_S470:
1342 case CX23885_BOARD_HAUPPAUGE_HVR1250:
Andy Wallsdbe83a32010-07-19 01:19:43 -03001343 cx23885_irq_remove(dev, PCI_MSK_AV_CORE);
Andy Walls98d109f2010-07-19 00:41:41 -03001344 /* sd_ir is a duplicate pointer to the AV Core, just clear it */
1345 dev->sd_ir = NULL;
1346 break;
Andy Wallsf59ad612009-09-27 19:51:50 -03001347 }
1348}
1349
Igor M. Liplianin78db8542011-01-25 17:04:00 -03001350int netup_jtag_io(void *device, int tms, int tdi, int read_tdo)
1351{
1352 int data;
1353 int tdo = 0;
1354 struct cx23885_dev *dev = (struct cx23885_dev *)device;
1355 /*TMS*/
1356 data = ((cx_read(GP0_IO)) & (~0x00000002));
1357 data |= (tms ? 0x00020002 : 0x00020000);
1358 cx_write(GP0_IO, data);
1359
1360 /*TDI*/
1361 data = ((cx_read(MC417_RWD)) & (~0x0000a000));
1362 data |= (tdi ? 0x00008000 : 0);
1363 cx_write(MC417_RWD, data);
1364 if (read_tdo)
1365 tdo = (data & 0x00004000) ? 1 : 0; /*TDO*/
1366
1367 cx_write(MC417_RWD, data | 0x00002000);
1368 udelay(1);
1369 /*TCK*/
1370 cx_write(MC417_RWD, data);
1371
1372 return tdo;
1373}
1374
Andy Wallsf59ad612009-09-27 19:51:50 -03001375void cx23885_ir_pci_int_enable(struct cx23885_dev *dev)
1376{
1377 switch (dev->board) {
Andy Walls9b3d8ec2011-06-08 21:24:25 -03001378 case CX23885_BOARD_HAUPPAUGE_HVR1270:
Andy Wallsf59ad612009-09-27 19:51:50 -03001379 case CX23885_BOARD_HAUPPAUGE_HVR1850:
Michael Krufky7fec6fe2009-11-11 15:46:09 -03001380 case CX23885_BOARD_HAUPPAUGE_HVR1290:
Andy Wallsdbe83a32010-07-19 01:19:43 -03001381 if (dev->sd_ir)
1382 cx23885_irq_add_enable(dev, PCI_MSK_IR);
Andy Wallsf59ad612009-09-27 19:51:50 -03001383 break;
Andy Walls98d109f2010-07-19 00:41:41 -03001384 case CX23885_BOARD_TEVII_S470:
1385 case CX23885_BOARD_HAUPPAUGE_HVR1250:
Andy Wallsdbe83a32010-07-19 01:19:43 -03001386 if (dev->sd_ir)
1387 cx23885_irq_add_enable(dev, PCI_MSK_AV_CORE);
Andy Walls98d109f2010-07-19 00:41:41 -03001388 break;
Andy Wallsf59ad612009-09-27 19:51:50 -03001389 }
1390}
1391
Steven Tothd19770e2007-03-11 20:44:05 -03001392void cx23885_card_setup(struct cx23885_dev *dev)
1393{
Steven Totha6a3f142007-09-08 21:31:56 -03001394 struct cx23885_tsport *ts1 = &dev->ts1;
1395 struct cx23885_tsport *ts2 = &dev->ts2;
1396
Steven Tothd19770e2007-03-11 20:44:05 -03001397 static u8 eeprom[256];
1398
1399 if (dev->i2c_bus[0].i2c_rc == 0) {
1400 dev->i2c_bus[0].i2c_client.addr = 0xa0 >> 1;
Michael Krufky44a64812007-03-20 23:00:18 -03001401 tveeprom_read(&dev->i2c_bus[0].i2c_client,
1402 eeprom, sizeof(eeprom));
Steven Tothd19770e2007-03-11 20:44:05 -03001403 }
1404
1405 switch (dev->board) {
Steven Totha77743b2007-08-22 21:01:20 -03001406 case CX23885_BOARD_HAUPPAUGE_HVR1250:
Andy Wallsebbeb462010-07-18 17:35:00 -03001407 if (dev->i2c_bus[0].i2c_rc == 0) {
1408 if (eeprom[0x80] != 0x84)
1409 hauppauge_eeprom(dev, eeprom+0xc0);
1410 else
1411 hauppauge_eeprom(dev, eeprom+0x80);
1412 }
1413 break;
Michael Krufky07b4a832007-12-18 01:09:11 -03001414 case CX23885_BOARD_HAUPPAUGE_HVR1500:
Steven Tothd1987d52007-12-18 01:57:06 -03001415 case CX23885_BOARD_HAUPPAUGE_HVR1500Q:
Steven Toth66762372008-04-22 15:38:26 -03001416 case CX23885_BOARD_HAUPPAUGE_HVR1400:
Steven Tothc88133e2008-03-29 17:36:09 -03001417 if (dev->i2c_bus[0].i2c_rc == 0)
1418 hauppauge_eeprom(dev, eeprom+0x80);
1419 break;
Steven Tothd19770e2007-03-11 20:44:05 -03001420 case CX23885_BOARD_HAUPPAUGE_HVR1800:
1421 case CX23885_BOARD_HAUPPAUGE_HVR1800lp:
Steven Tothb3ea0162008-04-19 01:14:19 -03001422 case CX23885_BOARD_HAUPPAUGE_HVR1200:
Steven Totha780a312008-04-19 01:25:52 -03001423 case CX23885_BOARD_HAUPPAUGE_HVR1700:
Steven Toth2074dff2009-05-02 11:39:46 -03001424 case CX23885_BOARD_HAUPPAUGE_HVR1270:
Michael Krufkyd099bec2009-05-08 22:39:24 -03001425 case CX23885_BOARD_HAUPPAUGE_HVR1275:
Michael Krufky19bc5792009-05-08 16:05:29 -03001426 case CX23885_BOARD_HAUPPAUGE_HVR1255:
Michael Krufky6b926ec2009-05-12 17:32:17 -03001427 case CX23885_BOARD_HAUPPAUGE_HVR1210:
Steven Toth136973802009-07-20 15:37:25 -03001428 case CX23885_BOARD_HAUPPAUGE_HVR1850:
Michael Krufkyaee0b242009-11-11 01:52:45 -03001429 case CX23885_BOARD_HAUPPAUGE_HVR1290:
Steven Tothd19770e2007-03-11 20:44:05 -03001430 if (dev->i2c_bus[0].i2c_rc == 0)
Steven Tothc88133e2008-03-29 17:36:09 -03001431 hauppauge_eeprom(dev, eeprom+0xc0);
Steven Tothd19770e2007-03-11 20:44:05 -03001432 break;
1433 }
Steven Totha6a3f142007-09-08 21:31:56 -03001434
1435 switch (dev->board) {
Michael Krufky335377b2008-05-07 01:43:10 -03001436 case CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP:
Steven Tothaef2d182008-08-04 21:39:53 -03001437 case CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP:
Michael Krufky335377b2008-05-07 01:43:10 -03001438 ts2->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */
1439 ts2->ts_clk_en_val = 0x1; /* Enable TS_CLK */
1440 ts2->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
1441 /* break omitted intentionally */
Steven Totha6a3f142007-09-08 21:31:56 -03001442 case CX23885_BOARD_DVICO_FUSIONHDTV_5_EXP:
1443 ts1->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */
1444 ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */
1445 ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
1446 break;
Steven Toth35045132012-01-04 21:08:35 -03001447 case CX23885_BOARD_HAUPPAUGE_HVR1850:
Steven Totha589b662008-01-13 23:44:47 -03001448 case CX23885_BOARD_HAUPPAUGE_HVR1800:
1449 /* Defaults for VID B - Analog encoder */
1450 /* DREQ_POL, SMODE, PUNC_CLK, MCLK_POL Serial bus + punc clk */
1451 ts1->gen_ctrl_val = 0x10e;
1452 ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */
1453 ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
1454
1455 /* APB_TSVALERR_POL (active low)*/
1456 ts1->vld_misc_val = 0x2000;
1457 ts1->hw_sop_ctrl_val = (0x47 << 16 | 188 << 4 | 0xc);
Steven Toth35045132012-01-04 21:08:35 -03001458 cx_write(0x130184, 0xc);
Steven Totha589b662008-01-13 23:44:47 -03001459
1460 /* Defaults for VID C */
1461 ts2->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */
1462 ts2->ts_clk_en_val = 0x1; /* Enable TS_CLK */
1463 ts2->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
1464 break;
Igor M. Liplianin96318d02009-01-17 12:11:20 -03001465 case CX23885_BOARD_TBS_6920:
Igor M. Liplianin09ea33e2009-11-24 20:16:04 -03001466 ts1->gen_ctrl_val = 0x4; /* Parallel */
1467 ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */
1468 ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
1469 break;
1470 case CX23885_BOARD_TEVII_S470:
Igor M. Liplianin7b134e82012-05-11 11:45:42 -03001471 case CX23885_BOARD_TEVII_S471:
Igor M. Liplianinc9b8b042009-01-17 12:23:31 -03001472 case CX23885_BOARD_DVBWORLD_2005:
Igor M. Liplianin96318d02009-01-17 12:11:20 -03001473 ts1->gen_ctrl_val = 0x5; /* Parallel */
1474 ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */
1475 ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
1476 break;
Igor M. Liplianin5a23b072009-03-03 12:06:09 -03001477 case CX23885_BOARD_NETUP_DUAL_DVBS2_CI:
Igor M. Liplianin78db8542011-01-25 17:04:00 -03001478 case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF:
Stefan Ringel722c90e2012-01-07 09:20:48 -03001479 case CX23885_BOARD_TERRATEC_CINERGY_T_PCIE_DUAL:
Igor M. Liplianin5a23b072009-03-03 12:06:09 -03001480 ts1->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */
1481 ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */
1482 ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
1483 ts2->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */
1484 ts2->ts_clk_en_val = 0x1; /* Enable TS_CLK */
1485 ts2->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
1486 break;
David Wong493b7122009-05-18 05:25:49 -03001487 case CX23885_BOARD_MYGICA_X8506:
David Wong2365b2d2009-06-17 01:38:12 -03001488 case CX23885_BOARD_MAGICPRO_PROHDTVE2:
David Wong493b7122009-05-18 05:25:49 -03001489 ts1->gen_ctrl_val = 0x5; /* Parallel */
1490 ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */
1491 ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
1492 break;
David T. L. Wongea5697f2009-10-26 08:54:04 -03001493 case CX23885_BOARD_MYGICA_X8558PRO:
1494 ts1->gen_ctrl_val = 0x5; /* Parallel */
1495 ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */
1496 ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
1497 ts2->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */
1498 ts2->ts_clk_en_val = 0x1; /* Enable TS_CLK */
1499 ts2->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
1500 break;
Steven Totha6a3f142007-09-08 21:31:56 -03001501 case CX23885_BOARD_HAUPPAUGE_HVR1250:
Michael Krufky07b4a832007-12-18 01:09:11 -03001502 case CX23885_BOARD_HAUPPAUGE_HVR1500:
Steven Tothd1987d52007-12-18 01:57:06 -03001503 case CX23885_BOARD_HAUPPAUGE_HVR1500Q:
Steven Totha6a3f142007-09-08 21:31:56 -03001504 case CX23885_BOARD_HAUPPAUGE_HVR1800lp:
Steven Tothb3ea0162008-04-19 01:14:19 -03001505 case CX23885_BOARD_HAUPPAUGE_HVR1200:
Steven Totha780a312008-04-19 01:25:52 -03001506 case CX23885_BOARD_HAUPPAUGE_HVR1700:
Steven Toth66762372008-04-22 15:38:26 -03001507 case CX23885_BOARD_HAUPPAUGE_HVR1400:
Steven Toth4c56b042008-08-12 13:30:03 -03001508 case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H:
istvan_v@mailbox.hu0cf8af52011-07-11 10:58:35 -03001509 case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H_XC4000:
Igor M. Liplianin9bb1b7e2008-11-23 14:11:16 -03001510 case CX23885_BOARD_COMPRO_VIDEOMATE_E650F:
Steven Toth2074dff2009-05-02 11:39:46 -03001511 case CX23885_BOARD_HAUPPAUGE_HVR1270:
Michael Krufkyd099bec2009-05-08 22:39:24 -03001512 case CX23885_BOARD_HAUPPAUGE_HVR1275:
Michael Krufky19bc5792009-05-08 16:05:29 -03001513 case CX23885_BOARD_HAUPPAUGE_HVR1255:
Michael Krufky6b926ec2009-05-12 17:32:17 -03001514 case CX23885_BOARD_HAUPPAUGE_HVR1210:
Vladimir Geroy34e383d2009-09-18 18:55:47 -03001515 case CX23885_BOARD_COMPRO_VIDEOMATE_E800:
Michael Krufkyaee0b242009-11-11 01:52:45 -03001516 case CX23885_BOARD_HAUPPAUGE_HVR1290:
Alexey Chernov9028f582010-12-06 17:09:53 -03001517 case CX23885_BOARD_GOTVIEW_X5_3D_HYBRID:
Steven Totha6a3f142007-09-08 21:31:56 -03001518 default:
1519 ts2->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */
1520 ts2->ts_clk_en_val = 0x1; /* Enable TS_CLK */
1521 ts2->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
1522 }
1523
Steven Tothce89cfb2008-04-19 01:36:06 -03001524 /* Certain boards support analog, or require the avcore to be
1525 * loaded, ensure this happens.
1526 */
1527 switch (dev->board) {
Andy Wallsfa647f22010-07-19 21:22:05 -03001528 case CX23885_BOARD_TEVII_S470:
1529 case CX23885_BOARD_HAUPPAUGE_HVR1250:
1530 /* Currently only enabled for the integrated IR controller */
1531 if (!enable_885_ir)
1532 break;
Steven Tothce89cfb2008-04-19 01:36:06 -03001533 case CX23885_BOARD_HAUPPAUGE_HVR1800:
1534 case CX23885_BOARD_HAUPPAUGE_HVR1800lp:
1535 case CX23885_BOARD_HAUPPAUGE_HVR1700:
Steven Toth4c56b042008-08-12 13:30:03 -03001536 case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H:
istvan_v@mailbox.hu0cf8af52011-07-11 10:58:35 -03001537 case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H_XC4000:
Igor M. Liplianin9bb1b7e2008-11-23 14:11:16 -03001538 case CX23885_BOARD_COMPRO_VIDEOMATE_E650F:
Igor M. Liplianin5a23b072009-03-03 12:06:09 -03001539 case CX23885_BOARD_NETUP_DUAL_DVBS2_CI:
Igor M. Liplianin78db8542011-01-25 17:04:00 -03001540 case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF:
Vladimir Geroy34e383d2009-09-18 18:55:47 -03001541 case CX23885_BOARD_COMPRO_VIDEOMATE_E800:
Andy Walls9b3d8ec2011-06-08 21:24:25 -03001542 case CX23885_BOARD_HAUPPAUGE_HVR1270:
Andy Wallsc6b70532009-09-27 00:14:33 -03001543 case CX23885_BOARD_HAUPPAUGE_HVR1850:
David T.L. Wongbc1548a2009-10-21 11:09:28 -03001544 case CX23885_BOARD_MYGICA_X8506:
1545 case CX23885_BOARD_MAGICPRO_PROHDTVE2:
Michael Krufkyaee0b242009-11-11 01:52:45 -03001546 case CX23885_BOARD_HAUPPAUGE_HVR1290:
Kusanagi Kouichi0b32d652010-01-22 04:55:28 -03001547 case CX23885_BOARD_LEADTEK_WINFAST_PXTV1200:
Alexey Chernov9028f582010-12-06 17:09:53 -03001548 case CX23885_BOARD_GOTVIEW_X5_3D_HYBRID:
Mijhail Moreyra18d64472011-10-10 11:09:53 -03001549 case CX23885_BOARD_HAUPPAUGE_HVR1500:
Steven Toth2cb9ccd2011-10-10 11:09:55 -03001550 case CX23885_BOARD_MPX885:
Alfredo Jesús Delaiti87988752011-11-09 15:13:00 -03001551 case CX23885_BOARD_MYGICA_X8507:
Stefan Ringel722c90e2012-01-07 09:20:48 -03001552 case CX23885_BOARD_TERRATEC_CINERGY_T_PCIE_DUAL:
Hans Verkuile6574f22009-04-01 03:57:53 -03001553 dev->sd_cx25840 = v4l2_i2c_new_subdev(&dev->v4l2_dev,
1554 &dev->i2c_bus[2].i2c_adap,
Laurent Pinchart9a1f8b32010-09-24 10:16:44 -03001555 "cx25840", 0x88 >> 1, NULL);
Andy Wallsd6b18502010-07-18 23:26:29 -03001556 if (dev->sd_cx25840) {
1557 dev->sd_cx25840->grp_id = CX23885_HW_AV_CORE;
1558 v4l2_subdev_call(dev->sd_cx25840, core, load_fw);
1559 }
Steven Tothce89cfb2008-04-19 01:36:06 -03001560 break;
1561 }
Igor M. Liplianin5a23b072009-03-03 12:06:09 -03001562
1563 /* AUX-PLL 27MHz CLK */
1564 switch (dev->board) {
1565 case CX23885_BOARD_NETUP_DUAL_DVBS2_CI:
1566 netup_initialize(dev);
1567 break;
Igor M. Liplianin78db8542011-01-25 17:04:00 -03001568 case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF: {
1569 int ret;
1570 const struct firmware *fw;
1571 const char *filename = "dvb-netup-altera-01.fw";
1572 char *action = "configure";
Abylay Ospanb8f0d302011-07-14 05:20:29 -03001573 static struct netup_card_info cinfo;
Igor M. Liplianin78db8542011-01-25 17:04:00 -03001574 struct altera_config netup_config = {
1575 .dev = dev,
1576 .action = action,
1577 .jtag_io = netup_jtag_io,
1578 };
1579
1580 netup_initialize(dev);
1581
Abylay Ospanb8f0d302011-07-14 05:20:29 -03001582 netup_get_card_info(&dev->i2c_bus[0].i2c_adap, &cinfo);
Abylay Ospan2d124212011-07-18 04:14:28 -03001583 if (netup_card_rev)
1584 cinfo.rev = netup_card_rev;
1585
Abylay Ospanb8f0d302011-07-14 05:20:29 -03001586 switch (cinfo.rev) {
1587 case 0x4:
1588 filename = "dvb-netup-altera-04.fw";
1589 break;
1590 default:
1591 filename = "dvb-netup-altera-01.fw";
1592 break;
1593 }
1594 printk(KERN_INFO "NetUP card rev=0x%x fw_filename=%s\n",
1595 cinfo.rev, filename);
1596
Igor M. Liplianin78db8542011-01-25 17:04:00 -03001597 ret = request_firmware(&fw, filename, &dev->pci->dev);
1598 if (ret != 0)
1599 printk(KERN_ERR "did not find the firmware file. (%s) "
1600 "Please see linux/Documentation/dvb/ for more details "
1601 "on firmware-problems.", filename);
1602 else
1603 altera_init(&netup_config, fw);
1604
Jesper Juhl3f84a4e2011-04-07 16:23:48 -03001605 release_firmware(fw);
Igor M. Liplianin78db8542011-01-25 17:04:00 -03001606 break;
1607 }
Igor M. Liplianin5a23b072009-03-03 12:06:09 -03001608 }
Steven Tothd19770e2007-03-11 20:44:05 -03001609}
1610
1611/* ------------------------------------------------------------------ */