| Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 1 | /* |
| 2 | * Driver for the Conexant CX23885 PCIe bridge |
| 3 | * |
| Steven Toth | 6d89761 | 2008-09-03 17:12:12 -0300 | [diff] [blame] | 4 | * Copyright (c) 2006 Steven Toth <stoth@linuxtv.org> |
| Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 5 | * |
| 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 Toth | 7b88801 | 2008-01-10 03:40:49 -0300 | [diff] [blame] | 26 | #include <media/cx25840.h> |
| Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 27 | #include <linux/firmware.h> |
| 28 | #include <staging/altera.h> |
| Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 29 | |
| 30 | #include "cx23885.h" |
| Steven Toth | 90a71b1 | 2008-08-04 21:38:46 -0300 | [diff] [blame] | 31 | #include "tuner-xc2028.h" |
| Igor M. Liplianin | 5a23b07 | 2009-03-03 12:06:09 -0300 | [diff] [blame] | 32 | #include "netup-init.h" |
| Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 33 | #include "altera-ci.h" |
| 34 | #include "xc5000.h" |
| Andy Walls | 29f8a0a | 2009-09-26 23:17:30 -0300 | [diff] [blame] | 35 | #include "cx23888-ir.h" |
| Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 36 | |
| Andy Walls | fa647f2 | 2010-07-19 21:22:05 -0300 | [diff] [blame] | 37 | static unsigned int enable_885_ir; |
| 38 | module_param(enable_885_ir, int, 0644); |
| 39 | MODULE_PARM_DESC(enable_885_ir, |
| 40 | "Enable integrated IR controller for supported\n" |
| 41 | "\t\t CX2388[57] boards that are wired for it:\n" |
| 42 | "\t\t\tHVR-1250 (reported safe)\n" |
| 43 | "\t\t\tTeVii S470 (reported unsafe)\n" |
| 44 | "\t\t This can cause an interrupt storm with some cards.\n" |
| 45 | "\t\t Default: 0 [Disabled]"); |
| 46 | |
| Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 47 | /* ------------------------------------------------------------------ */ |
| 48 | /* board config info */ |
| 49 | |
| 50 | struct cx23885_board cx23885_boards[] = { |
| 51 | [CX23885_BOARD_UNKNOWN] = { |
| 52 | .name = "UNKNOWN/GENERIC", |
| Steven Toth | c771261 | 2008-01-10 02:24:27 -0300 | [diff] [blame] | 53 | /* Ensure safe default for unknown boards */ |
| 54 | .clk_freq = 0, |
| Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 55 | .input = {{ |
| 56 | .type = CX23885_VMUX_COMPOSITE1, |
| 57 | .vmux = 0, |
| Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 58 | }, { |
| Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 59 | .type = CX23885_VMUX_COMPOSITE2, |
| 60 | .vmux = 1, |
| Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 61 | }, { |
| Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 62 | .type = CX23885_VMUX_COMPOSITE3, |
| 63 | .vmux = 2, |
| Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 64 | }, { |
| Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 65 | .type = CX23885_VMUX_COMPOSITE4, |
| 66 | .vmux = 3, |
| Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 67 | } }, |
| Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 68 | }, |
| 69 | [CX23885_BOARD_HAUPPAUGE_HVR1800lp] = { |
| 70 | .name = "Hauppauge WinTV-HVR1800lp", |
| Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 71 | .portc = CX23885_MPEG_DVB, |
| 72 | .input = {{ |
| 73 | .type = CX23885_VMUX_TELEVISION, |
| 74 | .vmux = 0, |
| 75 | .gpio0 = 0xff00, |
| Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 76 | }, { |
| Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 77 | .type = CX23885_VMUX_DEBUG, |
| 78 | .vmux = 0, |
| 79 | .gpio0 = 0xff01, |
| Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 80 | }, { |
| Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 81 | .type = CX23885_VMUX_COMPOSITE1, |
| 82 | .vmux = 1, |
| 83 | .gpio0 = 0xff02, |
| Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 84 | }, { |
| Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 85 | .type = CX23885_VMUX_SVIDEO, |
| 86 | .vmux = 2, |
| 87 | .gpio0 = 0xff02, |
| Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 88 | } }, |
| Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 89 | }, |
| 90 | [CX23885_BOARD_HAUPPAUGE_HVR1800] = { |
| 91 | .name = "Hauppauge WinTV-HVR1800", |
| Steven Toth | 7b88801 | 2008-01-10 03:40:49 -0300 | [diff] [blame] | 92 | .porta = CX23885_ANALOG_VIDEO, |
| Steven Toth | a589b66 | 2008-01-13 23:44:47 -0300 | [diff] [blame] | 93 | .portb = CX23885_MPEG_ENCODER, |
| Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 94 | .portc = CX23885_MPEG_DVB, |
| Steven Toth | 7b88801 | 2008-01-10 03:40:49 -0300 | [diff] [blame] | 95 | .tuner_type = TUNER_PHILIPS_TDA8290, |
| 96 | .tuner_addr = 0x42, /* 0x84 >> 1 */ |
| Igor M. Liplianin | 557f48d | 2011-01-25 17:05:00 -0300 | [diff] [blame^] | 97 | .tuner_bus = 1, |
| Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 98 | .input = {{ |
| 99 | .type = CX23885_VMUX_TELEVISION, |
| Steven Toth | 7b88801 | 2008-01-10 03:40:49 -0300 | [diff] [blame] | 100 | .vmux = CX25840_VIN7_CH3 | |
| 101 | CX25840_VIN5_CH2 | |
| 102 | CX25840_VIN2_CH1, |
| 103 | .gpio0 = 0, |
| Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 104 | }, { |
| Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 105 | .type = CX23885_VMUX_COMPOSITE1, |
| Steven Toth | 7b88801 | 2008-01-10 03:40:49 -0300 | [diff] [blame] | 106 | .vmux = CX25840_VIN7_CH3 | |
| 107 | CX25840_VIN4_CH2 | |
| 108 | CX25840_VIN6_CH1, |
| 109 | .gpio0 = 0, |
| Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 110 | }, { |
| Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 111 | .type = CX23885_VMUX_SVIDEO, |
| Steven Toth | 7b88801 | 2008-01-10 03:40:49 -0300 | [diff] [blame] | 112 | .vmux = CX25840_VIN7_CH3 | |
| 113 | CX25840_VIN4_CH2 | |
| 114 | CX25840_VIN8_CH1 | |
| 115 | CX25840_SVIDEO_ON, |
| 116 | .gpio0 = 0, |
| Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 117 | } }, |
| Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 118 | }, |
| Steven Toth | a77743b | 2007-08-22 21:01:20 -0300 | [diff] [blame] | 119 | [CX23885_BOARD_HAUPPAUGE_HVR1250] = { |
| 120 | .name = "Hauppauge WinTV-HVR1250", |
| 121 | .portc = CX23885_MPEG_DVB, |
| 122 | .input = {{ |
| 123 | .type = CX23885_VMUX_TELEVISION, |
| 124 | .vmux = 0, |
| 125 | .gpio0 = 0xff00, |
| Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 126 | }, { |
| Steven Toth | a77743b | 2007-08-22 21:01:20 -0300 | [diff] [blame] | 127 | .type = CX23885_VMUX_DEBUG, |
| 128 | .vmux = 0, |
| 129 | .gpio0 = 0xff01, |
| Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 130 | }, { |
| Steven Toth | a77743b | 2007-08-22 21:01:20 -0300 | [diff] [blame] | 131 | .type = CX23885_VMUX_COMPOSITE1, |
| 132 | .vmux = 1, |
| 133 | .gpio0 = 0xff02, |
| Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 134 | }, { |
| Steven Toth | a77743b | 2007-08-22 21:01:20 -0300 | [diff] [blame] | 135 | .type = CX23885_VMUX_SVIDEO, |
| 136 | .vmux = 2, |
| 137 | .gpio0 = 0xff02, |
| Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 138 | } }, |
| Steven Toth | a77743b | 2007-08-22 21:01:20 -0300 | [diff] [blame] | 139 | }, |
| Michael Krufky | 9bc37ca | 2007-09-08 15:17:13 -0300 | [diff] [blame] | 140 | [CX23885_BOARD_DVICO_FUSIONHDTV_5_EXP] = { |
| 141 | .name = "DViCO FusionHDTV5 Express", |
| Steven Toth | a6a3f14 | 2007-09-08 21:31:56 -0300 | [diff] [blame] | 142 | .portb = CX23885_MPEG_DVB, |
| Michael Krufky | 9bc37ca | 2007-09-08 15:17:13 -0300 | [diff] [blame] | 143 | }, |
| Steven Toth | d1987d5 | 2007-12-18 01:57:06 -0300 | [diff] [blame] | 144 | [CX23885_BOARD_HAUPPAUGE_HVR1500Q] = { |
| 145 | .name = "Hauppauge WinTV-HVR1500Q", |
| 146 | .portc = CX23885_MPEG_DVB, |
| 147 | }, |
| Michael Krufky | 07b4a83 | 2007-12-18 01:09:11 -0300 | [diff] [blame] | 148 | [CX23885_BOARD_HAUPPAUGE_HVR1500] = { |
| 149 | .name = "Hauppauge WinTV-HVR1500", |
| 150 | .portc = CX23885_MPEG_DVB, |
| 151 | }, |
| Steven Toth | b3ea016 | 2008-04-19 01:14:19 -0300 | [diff] [blame] | 152 | [CX23885_BOARD_HAUPPAUGE_HVR1200] = { |
| 153 | .name = "Hauppauge WinTV-HVR1200", |
| 154 | .portc = CX23885_MPEG_DVB, |
| 155 | }, |
| Steven Toth | a780a31 | 2008-04-19 01:25:52 -0300 | [diff] [blame] | 156 | [CX23885_BOARD_HAUPPAUGE_HVR1700] = { |
| 157 | .name = "Hauppauge WinTV-HVR1700", |
| 158 | .portc = CX23885_MPEG_DVB, |
| 159 | }, |
| Steven Toth | 6676237 | 2008-04-22 15:38:26 -0300 | [diff] [blame] | 160 | [CX23885_BOARD_HAUPPAUGE_HVR1400] = { |
| 161 | .name = "Hauppauge WinTV-HVR1400", |
| 162 | .portc = CX23885_MPEG_DVB, |
| 163 | }, |
| Michael Krufky | 335377b | 2008-05-07 01:43:10 -0300 | [diff] [blame] | 164 | [CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP] = { |
| 165 | .name = "DViCO FusionHDTV7 Dual Express", |
| Steven Toth | aaadeac | 2008-06-30 20:58:38 -0300 | [diff] [blame] | 166 | .portb = CX23885_MPEG_DVB, |
| Michael Krufky | 335377b | 2008-05-07 01:43:10 -0300 | [diff] [blame] | 167 | .portc = CX23885_MPEG_DVB, |
| 168 | }, |
| Steven Toth | aef2d18 | 2008-08-04 21:39:53 -0300 | [diff] [blame] | 169 | [CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP] = { |
| 170 | .name = "DViCO FusionHDTV DVB-T Dual Express", |
| 171 | .portb = CX23885_MPEG_DVB, |
| 172 | .portc = CX23885_MPEG_DVB, |
| 173 | }, |
| Steven Toth | 4c56b04 | 2008-08-12 13:30:03 -0300 | [diff] [blame] | 174 | [CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H] = { |
| 175 | .name = "Leadtek Winfast PxDVR3200 H", |
| 176 | .portc = CX23885_MPEG_DVB, |
| 177 | }, |
| Igor M. Liplianin | 9bb1b7e | 2008-11-23 14:11:16 -0300 | [diff] [blame] | 178 | [CX23885_BOARD_COMPRO_VIDEOMATE_E650F] = { |
| 179 | .name = "Compro VideoMate E650F", |
| 180 | .portc = CX23885_MPEG_DVB, |
| 181 | }, |
| Igor M. Liplianin | 96318d0 | 2009-01-17 12:11:20 -0300 | [diff] [blame] | 182 | [CX23885_BOARD_TBS_6920] = { |
| 183 | .name = "TurboSight TBS 6920", |
| 184 | .portb = CX23885_MPEG_DVB, |
| 185 | }, |
| Igor M. Liplianin | 579943f | 2009-01-17 12:18:26 -0300 | [diff] [blame] | 186 | [CX23885_BOARD_TEVII_S470] = { |
| 187 | .name = "TeVii S470", |
| 188 | .portb = CX23885_MPEG_DVB, |
| 189 | }, |
| Igor M. Liplianin | c9b8b04 | 2009-01-17 12:23:31 -0300 | [diff] [blame] | 190 | [CX23885_BOARD_DVBWORLD_2005] = { |
| 191 | .name = "DVBWorld DVB-S2 2005", |
| 192 | .portb = CX23885_MPEG_DVB, |
| 193 | }, |
| Igor M. Liplianin | 5a23b07 | 2009-03-03 12:06:09 -0300 | [diff] [blame] | 194 | [CX23885_BOARD_NETUP_DUAL_DVBS2_CI] = { |
| Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 195 | .ci_type = 1, |
| Igor M. Liplianin | 5a23b07 | 2009-03-03 12:06:09 -0300 | [diff] [blame] | 196 | .name = "NetUP Dual DVB-S2 CI", |
| 197 | .portb = CX23885_MPEG_DVB, |
| 198 | .portc = CX23885_MPEG_DVB, |
| 199 | }, |
| Steven Toth | 2074dff | 2009-05-02 11:39:46 -0300 | [diff] [blame] | 200 | [CX23885_BOARD_HAUPPAUGE_HVR1270] = { |
| 201 | .name = "Hauppauge WinTV-HVR1270", |
| Michael Krufky | a5dbf45 | 2009-05-03 23:27:02 -0300 | [diff] [blame] | 202 | .portc = CX23885_MPEG_DVB, |
| Steven Toth | 2074dff | 2009-05-02 11:39:46 -0300 | [diff] [blame] | 203 | }, |
| Michael Krufky | d099bec | 2009-05-08 22:39:24 -0300 | [diff] [blame] | 204 | [CX23885_BOARD_HAUPPAUGE_HVR1275] = { |
| 205 | .name = "Hauppauge WinTV-HVR1275", |
| 206 | .portc = CX23885_MPEG_DVB, |
| 207 | }, |
| Michael Krufky | 19bc579 | 2009-05-08 16:05:29 -0300 | [diff] [blame] | 208 | [CX23885_BOARD_HAUPPAUGE_HVR1255] = { |
| 209 | .name = "Hauppauge WinTV-HVR1255", |
| 210 | .portc = CX23885_MPEG_DVB, |
| 211 | }, |
| Michael Krufky | 6b926ec | 2009-05-12 17:32:17 -0300 | [diff] [blame] | 212 | [CX23885_BOARD_HAUPPAUGE_HVR1210] = { |
| 213 | .name = "Hauppauge WinTV-HVR1210", |
| 214 | .portc = CX23885_MPEG_DVB, |
| 215 | }, |
| David Wong | 493b712 | 2009-05-18 05:25:49 -0300 | [diff] [blame] | 216 | [CX23885_BOARD_MYGICA_X8506] = { |
| 217 | .name = "Mygica X8506 DMB-TH", |
| David T.L. Wong | 6f0d8c0 | 2009-10-21 13:15:30 -0300 | [diff] [blame] | 218 | .tuner_type = TUNER_XC5000, |
| 219 | .tuner_addr = 0x61, |
| Igor M. Liplianin | 557f48d | 2011-01-25 17:05:00 -0300 | [diff] [blame^] | 220 | .tuner_bus = 1, |
| David T.L. Wong | bc1548a | 2009-10-21 11:09:28 -0300 | [diff] [blame] | 221 | .porta = CX23885_ANALOG_VIDEO, |
| David Wong | 493b712 | 2009-05-18 05:25:49 -0300 | [diff] [blame] | 222 | .portb = CX23885_MPEG_DVB, |
| David T.L. Wong | bc1548a | 2009-10-21 11:09:28 -0300 | [diff] [blame] | 223 | .input = { |
| 224 | { |
| David T.L. Wong | 6f0d8c0 | 2009-10-21 13:15:30 -0300 | [diff] [blame] | 225 | .type = CX23885_VMUX_TELEVISION, |
| 226 | .vmux = CX25840_COMPOSITE2, |
| 227 | }, |
| 228 | { |
| David T.L. Wong | bc1548a | 2009-10-21 11:09:28 -0300 | [diff] [blame] | 229 | .type = CX23885_VMUX_COMPOSITE1, |
| 230 | .vmux = CX25840_COMPOSITE8, |
| 231 | }, |
| 232 | { |
| 233 | .type = CX23885_VMUX_SVIDEO, |
| 234 | .vmux = CX25840_SVIDEO_LUMA3 | |
| 235 | CX25840_SVIDEO_CHROMA4, |
| 236 | }, |
| 237 | { |
| 238 | .type = CX23885_VMUX_COMPONENT, |
| 239 | .vmux = CX25840_COMPONENT_ON | |
| 240 | CX25840_VIN1_CH1 | |
| 241 | CX25840_VIN6_CH2 | |
| 242 | CX25840_VIN7_CH3, |
| 243 | }, |
| 244 | }, |
| David Wong | 493b712 | 2009-05-18 05:25:49 -0300 | [diff] [blame] | 245 | }, |
| David Wong | 2365b2d | 2009-06-17 01:38:12 -0300 | [diff] [blame] | 246 | [CX23885_BOARD_MAGICPRO_PROHDTVE2] = { |
| 247 | .name = "Magic-Pro ProHDTV Extreme 2", |
| David T.L. Wong | 6f0d8c0 | 2009-10-21 13:15:30 -0300 | [diff] [blame] | 248 | .tuner_type = TUNER_XC5000, |
| 249 | .tuner_addr = 0x61, |
| Igor M. Liplianin | 557f48d | 2011-01-25 17:05:00 -0300 | [diff] [blame^] | 250 | .tuner_bus = 1, |
| David T.L. Wong | bc1548a | 2009-10-21 11:09:28 -0300 | [diff] [blame] | 251 | .porta = CX23885_ANALOG_VIDEO, |
| David Wong | 2365b2d | 2009-06-17 01:38:12 -0300 | [diff] [blame] | 252 | .portb = CX23885_MPEG_DVB, |
| David T.L. Wong | bc1548a | 2009-10-21 11:09:28 -0300 | [diff] [blame] | 253 | .input = { |
| 254 | { |
| David T.L. Wong | 6f0d8c0 | 2009-10-21 13:15:30 -0300 | [diff] [blame] | 255 | .type = CX23885_VMUX_TELEVISION, |
| 256 | .vmux = CX25840_COMPOSITE2, |
| 257 | }, |
| 258 | { |
| David T.L. Wong | bc1548a | 2009-10-21 11:09:28 -0300 | [diff] [blame] | 259 | .type = CX23885_VMUX_COMPOSITE1, |
| 260 | .vmux = CX25840_COMPOSITE8, |
| 261 | }, |
| 262 | { |
| 263 | .type = CX23885_VMUX_SVIDEO, |
| 264 | .vmux = CX25840_SVIDEO_LUMA3 | |
| 265 | CX25840_SVIDEO_CHROMA4, |
| 266 | }, |
| 267 | { |
| 268 | .type = CX23885_VMUX_COMPONENT, |
| 269 | .vmux = CX25840_COMPONENT_ON | |
| 270 | CX25840_VIN1_CH1 | |
| 271 | CX25840_VIN6_CH2 | |
| 272 | CX25840_VIN7_CH3, |
| 273 | }, |
| 274 | }, |
| David Wong | 2365b2d | 2009-06-17 01:38:12 -0300 | [diff] [blame] | 275 | }, |
| Steven Toth | 13697380 | 2009-07-20 15:37:25 -0300 | [diff] [blame] | 276 | [CX23885_BOARD_HAUPPAUGE_HVR1850] = { |
| 277 | .name = "Hauppauge WinTV-HVR1850", |
| 278 | .portb = CX23885_MPEG_ENCODER, |
| 279 | .portc = CX23885_MPEG_DVB, |
| 280 | }, |
| Vladimir Geroy | 34e383d | 2009-09-18 18:55:47 -0300 | [diff] [blame] | 281 | [CX23885_BOARD_COMPRO_VIDEOMATE_E800] = { |
| 282 | .name = "Compro VideoMate E800", |
| 283 | .portc = CX23885_MPEG_DVB, |
| 284 | }, |
| Michael Krufky | aee0b24 | 2009-11-11 01:52:45 -0300 | [diff] [blame] | 285 | [CX23885_BOARD_HAUPPAUGE_HVR1290] = { |
| 286 | .name = "Hauppauge WinTV-HVR1290", |
| 287 | .portc = CX23885_MPEG_DVB, |
| 288 | }, |
| David T. L. Wong | ea5697f | 2009-10-26 08:54:04 -0300 | [diff] [blame] | 289 | [CX23885_BOARD_MYGICA_X8558PRO] = { |
| 290 | .name = "Mygica X8558 PRO DMB-TH", |
| 291 | .portb = CX23885_MPEG_DVB, |
| 292 | .portc = CX23885_MPEG_DVB, |
| 293 | }, |
| Kusanagi Kouichi | 0b32d65 | 2010-01-22 04:55:28 -0300 | [diff] [blame] | 294 | [CX23885_BOARD_LEADTEK_WINFAST_PXTV1200] = { |
| 295 | .name = "LEADTEK WinFast PxTV1200", |
| 296 | .porta = CX23885_ANALOG_VIDEO, |
| 297 | .tuner_type = TUNER_XC2028, |
| 298 | .tuner_addr = 0x61, |
| Igor M. Liplianin | 557f48d | 2011-01-25 17:05:00 -0300 | [diff] [blame^] | 299 | .tuner_bus = 1, |
| Kusanagi Kouichi | 0b32d65 | 2010-01-22 04:55:28 -0300 | [diff] [blame] | 300 | .input = {{ |
| 301 | .type = CX23885_VMUX_TELEVISION, |
| 302 | .vmux = CX25840_VIN2_CH1 | |
| 303 | CX25840_VIN5_CH2 | |
| 304 | CX25840_NONE0_CH3, |
| 305 | }, { |
| 306 | .type = CX23885_VMUX_COMPOSITE1, |
| 307 | .vmux = CX25840_COMPOSITE1, |
| 308 | }, { |
| 309 | .type = CX23885_VMUX_SVIDEO, |
| 310 | .vmux = CX25840_SVIDEO_LUMA3 | |
| 311 | CX25840_SVIDEO_CHROMA4, |
| 312 | }, { |
| 313 | .type = CX23885_VMUX_COMPONENT, |
| 314 | .vmux = CX25840_VIN7_CH1 | |
| 315 | CX25840_VIN6_CH2 | |
| 316 | CX25840_VIN8_CH3 | |
| 317 | CX25840_COMPONENT_ON, |
| 318 | } }, |
| 319 | }, |
| Alexey Chernov | 9028f58 | 2010-12-06 17:09:53 -0300 | [diff] [blame] | 320 | [CX23885_BOARD_GOTVIEW_X5_3D_HYBRID] = { |
| 321 | .name = "GoTView X5 3D Hybrid", |
| 322 | .tuner_type = TUNER_XC5000, |
| 323 | .tuner_addr = 0x64, |
| Igor M. Liplianin | 557f48d | 2011-01-25 17:05:00 -0300 | [diff] [blame^] | 324 | .tuner_bus = 1, |
| Alexey Chernov | 9028f58 | 2010-12-06 17:09:53 -0300 | [diff] [blame] | 325 | .porta = CX23885_ANALOG_VIDEO, |
| 326 | .portb = CX23885_MPEG_DVB, |
| 327 | .input = {{ |
| 328 | .type = CX23885_VMUX_TELEVISION, |
| 329 | .vmux = CX25840_VIN2_CH1 | |
| 330 | CX25840_VIN5_CH2, |
| 331 | .gpio0 = 0x02, |
| 332 | }, { |
| 333 | .type = CX23885_VMUX_COMPOSITE1, |
| 334 | .vmux = CX23885_VMUX_COMPOSITE1, |
| 335 | }, { |
| 336 | .type = CX23885_VMUX_SVIDEO, |
| 337 | .vmux = CX25840_SVIDEO_LUMA3 | |
| 338 | CX25840_SVIDEO_CHROMA4, |
| 339 | } }, |
| 340 | }, |
| Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 341 | [CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF] = { |
| 342 | .ci_type = 2, |
| 343 | .name = "NetUP Dual DVB-T/C-CI RF", |
| 344 | .porta = CX23885_ANALOG_VIDEO, |
| 345 | .portb = CX23885_MPEG_DVB, |
| 346 | .portc = CX23885_MPEG_DVB, |
| 347 | .tuner_type = TUNER_XC5000, |
| 348 | .tuner_addr = 0x64, |
| 349 | .input = { { |
| 350 | .type = CX23885_VMUX_TELEVISION, |
| 351 | .vmux = CX25840_COMPOSITE1, |
| 352 | } }, |
| 353 | }, |
| Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 354 | }; |
| 355 | const unsigned int cx23885_bcount = ARRAY_SIZE(cx23885_boards); |
| 356 | |
| 357 | /* ------------------------------------------------------------------ */ |
| 358 | /* PCI subsystem IDs */ |
| 359 | |
| 360 | struct cx23885_subid cx23885_subids[] = { |
| 361 | { |
| 362 | .subvendor = 0x0070, |
| 363 | .subdevice = 0x3400, |
| 364 | .card = CX23885_BOARD_UNKNOWN, |
| Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 365 | }, { |
| Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 366 | .subvendor = 0x0070, |
| 367 | .subdevice = 0x7600, |
| 368 | .card = CX23885_BOARD_HAUPPAUGE_HVR1800lp, |
| Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 369 | }, { |
| Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 370 | .subvendor = 0x0070, |
| 371 | .subdevice = 0x7800, |
| 372 | .card = CX23885_BOARD_HAUPPAUGE_HVR1800, |
| Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 373 | }, { |
| Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 374 | .subvendor = 0x0070, |
| 375 | .subdevice = 0x7801, |
| 376 | .card = CX23885_BOARD_HAUPPAUGE_HVR1800, |
| Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 377 | }, { |
| Steven Toth | a77743b | 2007-08-22 21:01:20 -0300 | [diff] [blame] | 378 | .subvendor = 0x0070, |
| Michael Krufky | 6ccb8cf | 2007-12-27 21:46:34 -0300 | [diff] [blame] | 379 | .subdevice = 0x7809, |
| 380 | .card = CX23885_BOARD_HAUPPAUGE_HVR1800, |
| Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 381 | }, { |
| Michael Krufky | 6ccb8cf | 2007-12-27 21:46:34 -0300 | [diff] [blame] | 382 | .subvendor = 0x0070, |
| Steven Toth | a77743b | 2007-08-22 21:01:20 -0300 | [diff] [blame] | 383 | .subdevice = 0x7911, |
| 384 | .card = CX23885_BOARD_HAUPPAUGE_HVR1250, |
| Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 385 | }, { |
| Michael Krufky | 9bc37ca | 2007-09-08 15:17:13 -0300 | [diff] [blame] | 386 | .subvendor = 0x18ac, |
| 387 | .subdevice = 0xd500, |
| 388 | .card = CX23885_BOARD_DVICO_FUSIONHDTV_5_EXP, |
| Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 389 | }, { |
| Steven Toth | d1987d5 | 2007-12-18 01:57:06 -0300 | [diff] [blame] | 390 | .subvendor = 0x0070, |
| Michael Krufky | b00fff0 | 2007-12-27 22:19:31 -0300 | [diff] [blame] | 391 | .subdevice = 0x7790, |
| 392 | .card = CX23885_BOARD_HAUPPAUGE_HVR1500Q, |
| Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 393 | }, { |
| Michael Krufky | b00fff0 | 2007-12-27 22:19:31 -0300 | [diff] [blame] | 394 | .subvendor = 0x0070, |
| Steven Toth | d1987d5 | 2007-12-18 01:57:06 -0300 | [diff] [blame] | 395 | .subdevice = 0x7797, |
| 396 | .card = CX23885_BOARD_HAUPPAUGE_HVR1500Q, |
| Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 397 | }, { |
| Michael Krufky | 07b4a83 | 2007-12-18 01:09:11 -0300 | [diff] [blame] | 398 | .subvendor = 0x0070, |
| Michael Krufky | b00fff0 | 2007-12-27 22:19:31 -0300 | [diff] [blame] | 399 | .subdevice = 0x7710, |
| 400 | .card = CX23885_BOARD_HAUPPAUGE_HVR1500, |
| Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 401 | }, { |
| Michael Krufky | b00fff0 | 2007-12-27 22:19:31 -0300 | [diff] [blame] | 402 | .subvendor = 0x0070, |
| Michael Krufky | 07b4a83 | 2007-12-18 01:09:11 -0300 | [diff] [blame] | 403 | .subdevice = 0x7717, |
| 404 | .card = CX23885_BOARD_HAUPPAUGE_HVR1500, |
| Steven Toth | b3ea016 | 2008-04-19 01:14:19 -0300 | [diff] [blame] | 405 | }, { |
| 406 | .subvendor = 0x0070, |
| 407 | .subdevice = 0x71d1, |
| 408 | .card = CX23885_BOARD_HAUPPAUGE_HVR1200, |
| Steven Toth | a780a31 | 2008-04-19 01:25:52 -0300 | [diff] [blame] | 409 | }, { |
| 410 | .subvendor = 0x0070, |
| Michael Krufky | 3c3852c | 2008-05-02 16:12:44 -0300 | [diff] [blame] | 411 | .subdevice = 0x71d3, |
| 412 | .card = CX23885_BOARD_HAUPPAUGE_HVR1200, |
| 413 | }, { |
| 414 | .subvendor = 0x0070, |
| Steven Toth | a780a31 | 2008-04-19 01:25:52 -0300 | [diff] [blame] | 415 | .subdevice = 0x8101, |
| 416 | .card = CX23885_BOARD_HAUPPAUGE_HVR1700, |
| Steven Toth | 6676237 | 2008-04-22 15:38:26 -0300 | [diff] [blame] | 417 | }, { |
| 418 | .subvendor = 0x0070, |
| 419 | .subdevice = 0x8010, |
| 420 | .card = CX23885_BOARD_HAUPPAUGE_HVR1400, |
| Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 421 | }, { |
| Michael Krufky | 335377b | 2008-05-07 01:43:10 -0300 | [diff] [blame] | 422 | .subvendor = 0x18ac, |
| 423 | .subdevice = 0xd618, |
| 424 | .card = CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP, |
| Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 425 | }, { |
| Steven Toth | aef2d18 | 2008-08-04 21:39:53 -0300 | [diff] [blame] | 426 | .subvendor = 0x18ac, |
| 427 | .subdevice = 0xdb78, |
| 428 | .card = CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP, |
| Steven Toth | 4c56b04 | 2008-08-12 13:30:03 -0300 | [diff] [blame] | 429 | }, { |
| 430 | .subvendor = 0x107d, |
| 431 | .subdevice = 0x6681, |
| 432 | .card = CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H, |
| Igor M. Liplianin | 9bb1b7e | 2008-11-23 14:11:16 -0300 | [diff] [blame] | 433 | }, { |
| 434 | .subvendor = 0x185b, |
| 435 | .subdevice = 0xe800, |
| 436 | .card = CX23885_BOARD_COMPRO_VIDEOMATE_E650F, |
| Igor M. Liplianin | 96318d0 | 2009-01-17 12:11:20 -0300 | [diff] [blame] | 437 | }, { |
| 438 | .subvendor = 0x6920, |
| 439 | .subdevice = 0x8888, |
| 440 | .card = CX23885_BOARD_TBS_6920, |
| Igor M. Liplianin | 579943f | 2009-01-17 12:18:26 -0300 | [diff] [blame] | 441 | }, { |
| 442 | .subvendor = 0xd470, |
| 443 | .subdevice = 0x9022, |
| 444 | .card = CX23885_BOARD_TEVII_S470, |
| Igor M. Liplianin | c9b8b04 | 2009-01-17 12:23:31 -0300 | [diff] [blame] | 445 | }, { |
| 446 | .subvendor = 0x0001, |
| 447 | .subdevice = 0x2005, |
| 448 | .card = CX23885_BOARD_DVBWORLD_2005, |
| Igor M. Liplianin | 5a23b07 | 2009-03-03 12:06:09 -0300 | [diff] [blame] | 449 | }, { |
| 450 | .subvendor = 0x1b55, |
| 451 | .subdevice = 0x2a2c, |
| 452 | .card = CX23885_BOARD_NETUP_DUAL_DVBS2_CI, |
| Steven Toth | 2074dff | 2009-05-02 11:39:46 -0300 | [diff] [blame] | 453 | }, { |
| 454 | .subvendor = 0x0070, |
| 455 | .subdevice = 0x2211, |
| 456 | .card = CX23885_BOARD_HAUPPAUGE_HVR1270, |
| Michael Krufky | d099bec | 2009-05-08 22:39:24 -0300 | [diff] [blame] | 457 | }, { |
| 458 | .subvendor = 0x0070, |
| 459 | .subdevice = 0x2215, |
| 460 | .card = CX23885_BOARD_HAUPPAUGE_HVR1275, |
| Michael Krufky | 19bc579 | 2009-05-08 16:05:29 -0300 | [diff] [blame] | 461 | }, { |
| 462 | .subvendor = 0x0070, |
| Michael Krufky | 7d7b528 | 2010-06-30 18:17:35 -0300 | [diff] [blame] | 463 | .subdevice = 0x221d, |
| 464 | .card = CX23885_BOARD_HAUPPAUGE_HVR1275, |
| 465 | }, { |
| 466 | .subvendor = 0x0070, |
| Michael Krufky | 19bc579 | 2009-05-08 16:05:29 -0300 | [diff] [blame] | 467 | .subdevice = 0x2251, |
| 468 | .card = CX23885_BOARD_HAUPPAUGE_HVR1255, |
| Michael Krufky | 6b926ec | 2009-05-12 17:32:17 -0300 | [diff] [blame] | 469 | }, { |
| 470 | .subvendor = 0x0070, |
| Michael Krufky | 7d7b528 | 2010-06-30 18:17:35 -0300 | [diff] [blame] | 471 | .subdevice = 0x2259, |
| 472 | .card = CX23885_BOARD_HAUPPAUGE_HVR1255, |
| 473 | }, { |
| 474 | .subvendor = 0x0070, |
| Michael Krufky | 6b926ec | 2009-05-12 17:32:17 -0300 | [diff] [blame] | 475 | .subdevice = 0x2291, |
| 476 | .card = CX23885_BOARD_HAUPPAUGE_HVR1210, |
| 477 | }, { |
| 478 | .subvendor = 0x0070, |
| 479 | .subdevice = 0x2295, |
| 480 | .card = CX23885_BOARD_HAUPPAUGE_HVR1210, |
| David Wong | 493b712 | 2009-05-18 05:25:49 -0300 | [diff] [blame] | 481 | }, { |
| Michael Krufky | 7d7b528 | 2010-06-30 18:17:35 -0300 | [diff] [blame] | 482 | .subvendor = 0x0070, |
| 483 | .subdevice = 0x2299, |
| 484 | .card = CX23885_BOARD_HAUPPAUGE_HVR1210, |
| 485 | }, { |
| 486 | .subvendor = 0x0070, |
| 487 | .subdevice = 0x229d, |
| 488 | .card = CX23885_BOARD_HAUPPAUGE_HVR1210, /* HVR1215 */ |
| 489 | }, { |
| 490 | .subvendor = 0x0070, |
| 491 | .subdevice = 0x22f0, |
| 492 | .card = CX23885_BOARD_HAUPPAUGE_HVR1210, |
| 493 | }, { |
| 494 | .subvendor = 0x0070, |
| 495 | .subdevice = 0x22f1, |
| 496 | .card = CX23885_BOARD_HAUPPAUGE_HVR1255, |
| 497 | }, { |
| 498 | .subvendor = 0x0070, |
| 499 | .subdevice = 0x22f2, |
| 500 | .card = CX23885_BOARD_HAUPPAUGE_HVR1275, |
| 501 | }, { |
| 502 | .subvendor = 0x0070, |
| 503 | .subdevice = 0x22f3, |
| 504 | .card = CX23885_BOARD_HAUPPAUGE_HVR1210, /* HVR1215 */ |
| 505 | }, { |
| 506 | .subvendor = 0x0070, |
| 507 | .subdevice = 0x22f4, |
| 508 | .card = CX23885_BOARD_HAUPPAUGE_HVR1210, |
| 509 | }, { |
| 510 | .subvendor = 0x0070, |
| 511 | .subdevice = 0x22f5, |
| 512 | .card = CX23885_BOARD_HAUPPAUGE_HVR1210, /* HVR1215 */ |
| 513 | }, { |
| David Wong | 493b712 | 2009-05-18 05:25:49 -0300 | [diff] [blame] | 514 | .subvendor = 0x14f1, |
| 515 | .subdevice = 0x8651, |
| 516 | .card = CX23885_BOARD_MYGICA_X8506, |
| David Wong | 2365b2d | 2009-06-17 01:38:12 -0300 | [diff] [blame] | 517 | }, { |
| 518 | .subvendor = 0x14f1, |
| 519 | .subdevice = 0x8657, |
| 520 | .card = CX23885_BOARD_MAGICPRO_PROHDTVE2, |
| Steven Toth | 13697380 | 2009-07-20 15:37:25 -0300 | [diff] [blame] | 521 | }, { |
| 522 | .subvendor = 0x0070, |
| 523 | .subdevice = 0x8541, |
| 524 | .card = CX23885_BOARD_HAUPPAUGE_HVR1850, |
| Vladimir Geroy | 34e383d | 2009-09-18 18:55:47 -0300 | [diff] [blame] | 525 | }, { |
| 526 | .subvendor = 0x1858, |
| 527 | .subdevice = 0xe800, |
| 528 | .card = CX23885_BOARD_COMPRO_VIDEOMATE_E800, |
| Michael Krufky | aee0b24 | 2009-11-11 01:52:45 -0300 | [diff] [blame] | 529 | }, { |
| 530 | .subvendor = 0x0070, |
| 531 | .subdevice = 0x8551, |
| 532 | .card = CX23885_BOARD_HAUPPAUGE_HVR1290, |
| David T. L. Wong | ea5697f | 2009-10-26 08:54:04 -0300 | [diff] [blame] | 533 | }, { |
| 534 | .subvendor = 0x14f1, |
| 535 | .subdevice = 0x8578, |
| 536 | .card = CX23885_BOARD_MYGICA_X8558PRO, |
| Kusanagi Kouichi | 0b32d65 | 2010-01-22 04:55:28 -0300 | [diff] [blame] | 537 | }, { |
| 538 | .subvendor = 0x107d, |
| 539 | .subdevice = 0x6f22, |
| 540 | .card = CX23885_BOARD_LEADTEK_WINFAST_PXTV1200, |
| Alexey Chernov | 9028f58 | 2010-12-06 17:09:53 -0300 | [diff] [blame] | 541 | }, { |
| 542 | .subvendor = 0x5654, |
| 543 | .subdevice = 0x2390, |
| 544 | .card = CX23885_BOARD_GOTVIEW_X5_3D_HYBRID, |
| Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 545 | }, { |
| 546 | .subvendor = 0x1b55, |
| 547 | .subdevice = 0xe2e4, |
| 548 | .card = CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF, |
| Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 549 | }, |
| 550 | }; |
| 551 | const unsigned int cx23885_idcount = ARRAY_SIZE(cx23885_subids); |
| 552 | |
| 553 | void cx23885_card_list(struct cx23885_dev *dev) |
| 554 | { |
| 555 | int i; |
| 556 | |
| 557 | if (0 == dev->pci->subsystem_vendor && |
| 558 | 0 == dev->pci->subsystem_device) { |
| Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 559 | printk(KERN_INFO |
| 560 | "%s: Board has no valid PCIe Subsystem ID and can't\n" |
| 561 | "%s: be autodetected. Pass card=<n> insmod option\n" |
| 562 | "%s: to workaround that. Redirect complaints to the\n" |
| 563 | "%s: vendor of the TV card. Best regards,\n" |
| Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 564 | "%s: -- tux\n", |
| 565 | dev->name, dev->name, dev->name, dev->name, dev->name); |
| 566 | } else { |
| Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 567 | printk(KERN_INFO |
| 568 | "%s: Your board isn't known (yet) to the driver.\n" |
| 569 | "%s: Try to pick one of the existing card configs via\n" |
| Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 570 | "%s: card=<n> insmod option. Updating to the latest\n" |
| 571 | "%s: version might help as well.\n", |
| 572 | dev->name, dev->name, dev->name, dev->name); |
| 573 | } |
| Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 574 | printk(KERN_INFO "%s: Here is a list of valid choices for the card=<n> insmod option:\n", |
| Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 575 | dev->name); |
| 576 | for (i = 0; i < cx23885_bcount; i++) |
| Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 577 | printk(KERN_INFO "%s: card=%d -> %s\n", |
| Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 578 | dev->name, i, cx23885_boards[i].name); |
| 579 | } |
| 580 | |
| 581 | static void hauppauge_eeprom(struct cx23885_dev *dev, u8 *eeprom_data) |
| 582 | { |
| 583 | struct tveeprom tv; |
| 584 | |
| Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 585 | tveeprom_hauppauge_analog(&dev->i2c_bus[0].i2c_client, &tv, |
| 586 | eeprom_data); |
| Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 587 | |
| Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 588 | /* Make sure we support the board model */ |
| Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 589 | switch (tv.model) { |
| Michael Krufky | 5308cf0 | 2009-05-12 18:37:35 -0300 | [diff] [blame] | 590 | case 22001: |
| 591 | /* WinTV-HVR1270 (PCIe, Retail, half height) |
| 592 | * ATSC/QAM and basic analog, IR Blast */ |
| 593 | case 22009: |
| 594 | /* WinTV-HVR1210 (PCIe, Retail, half height) |
| 595 | * DVB-T and basic analog, IR Blast */ |
| 596 | case 22011: |
| 597 | /* WinTV-HVR1270 (PCIe, Retail, half height) |
| 598 | * ATSC/QAM and basic analog, IR Recv */ |
| 599 | case 22019: |
| 600 | /* WinTV-HVR1210 (PCIe, Retail, half height) |
| 601 | * DVB-T and basic analog, IR Recv */ |
| 602 | case 22021: |
| 603 | /* WinTV-HVR1275 (PCIe, Retail, half height) |
| 604 | * ATSC/QAM and basic analog, IR Recv */ |
| 605 | case 22029: |
| 606 | /* WinTV-HVR1210 (PCIe, Retail, half height) |
| 607 | * DVB-T and basic analog, IR Recv */ |
| 608 | case 22101: |
| 609 | /* WinTV-HVR1270 (PCIe, Retail, full height) |
| 610 | * ATSC/QAM and basic analog, IR Blast */ |
| 611 | case 22109: |
| 612 | /* WinTV-HVR1210 (PCIe, Retail, full height) |
| 613 | * DVB-T and basic analog, IR Blast */ |
| 614 | case 22111: |
| 615 | /* WinTV-HVR1270 (PCIe, Retail, full height) |
| 616 | * ATSC/QAM and basic analog, IR Recv */ |
| 617 | case 22119: |
| 618 | /* WinTV-HVR1210 (PCIe, Retail, full height) |
| 619 | * DVB-T and basic analog, IR Recv */ |
| 620 | case 22121: |
| 621 | /* WinTV-HVR1275 (PCIe, Retail, full height) |
| 622 | * ATSC/QAM and basic analog, IR Recv */ |
| 623 | case 22129: |
| 624 | /* WinTV-HVR1210 (PCIe, Retail, full height) |
| 625 | * DVB-T and basic analog, IR Recv */ |
| Michael Krufky | 36396c8 | 2008-05-02 16:14:33 -0300 | [diff] [blame] | 626 | case 71009: |
| 627 | /* WinTV-HVR1200 (PCIe, Retail, full height) |
| 628 | * DVB-T and basic analog */ |
| 629 | case 71359: |
| 630 | /* WinTV-HVR1200 (PCIe, OEM, half height) |
| 631 | * DVB-T and basic analog */ |
| 632 | case 71439: |
| 633 | /* WinTV-HVR1200 (PCIe, OEM, half height) |
| 634 | * DVB-T and basic analog */ |
| 635 | case 71449: |
| 636 | /* WinTV-HVR1200 (PCIe, OEM, full height) |
| 637 | * DVB-T and basic analog */ |
| 638 | case 71939: |
| 639 | /* WinTV-HVR1200 (PCIe, OEM, half height) |
| 640 | * DVB-T and basic analog */ |
| 641 | case 71949: |
| 642 | /* WinTV-HVR1200 (PCIe, OEM, full height) |
| 643 | * DVB-T and basic analog */ |
| 644 | case 71959: |
| 645 | /* WinTV-HVR1200 (PCIe, OEM, full height) |
| 646 | * DVB-T and basic analog */ |
| 647 | case 71979: |
| 648 | /* WinTV-HVR1200 (PCIe, OEM, half height) |
| 649 | * DVB-T and basic analog */ |
| 650 | case 71999: |
| 651 | /* WinTV-HVR1200 (PCIe, OEM, full height) |
| 652 | * DVB-T and basic analog */ |
| Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 653 | case 76601: |
| 654 | /* WinTV-HVR1800lp (PCIe, Retail, No IR, Dual |
| 655 | channel ATSC and MPEG2 HW Encoder */ |
| 656 | case 77001: |
| 657 | /* WinTV-HVR1500 (Express Card, OEM, No IR, ATSC |
| 658 | and Basic analog */ |
| 659 | case 77011: |
| 660 | /* WinTV-HVR1500 (Express Card, Retail, No IR, ATSC |
| 661 | and Basic analog */ |
| 662 | case 77041: |
| 663 | /* WinTV-HVR1500Q (Express Card, OEM, No IR, ATSC/QAM |
| 664 | and Basic analog */ |
| 665 | case 77051: |
| 666 | /* WinTV-HVR1500Q (Express Card, Retail, No IR, ATSC/QAM |
| 667 | and Basic analog */ |
| 668 | case 78011: |
| 669 | /* WinTV-HVR1800 (PCIe, Retail, 3.5mm in, IR, No FM, |
| 670 | Dual channel ATSC and MPEG2 HW Encoder */ |
| 671 | case 78501: |
| 672 | /* WinTV-HVR1800 (PCIe, OEM, RCA in, No IR, FM, |
| 673 | Dual channel ATSC and MPEG2 HW Encoder */ |
| 674 | case 78521: |
| 675 | /* WinTV-HVR1800 (PCIe, OEM, RCA in, No IR, FM, |
| 676 | Dual channel ATSC and MPEG2 HW Encoder */ |
| 677 | case 78531: |
| 678 | /* WinTV-HVR1800 (PCIe, OEM, RCA in, No IR, No FM, |
| 679 | Dual channel ATSC and MPEG2 HW Encoder */ |
| 680 | case 78631: |
| 681 | /* WinTV-HVR1800 (PCIe, OEM, No IR, No FM, |
| 682 | Dual channel ATSC and MPEG2 HW Encoder */ |
| 683 | case 79001: |
| 684 | /* WinTV-HVR1250 (PCIe, Retail, IR, full height, |
| 685 | ATSC and Basic analog */ |
| 686 | case 79101: |
| 687 | /* WinTV-HVR1250 (PCIe, Retail, IR, half height, |
| 688 | ATSC and Basic analog */ |
| Andy Walls | ebbeb46 | 2010-07-18 17:35:00 -0300 | [diff] [blame] | 689 | case 79501: |
| 690 | /* WinTV-HVR1250 (PCIe, No IR, half height, |
| 691 | ATSC [at least] and Basic analog) */ |
| Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 692 | case 79561: |
| 693 | /* WinTV-HVR1250 (PCIe, OEM, No IR, half height, |
| 694 | ATSC and Basic analog */ |
| 695 | case 79571: |
| 696 | /* WinTV-HVR1250 (PCIe, OEM, No IR, full height, |
| 697 | ATSC and Basic analog */ |
| 698 | case 79671: |
| 699 | /* WinTV-HVR1250 (PCIe, OEM, No IR, half height, |
| 700 | ATSC and Basic analog */ |
| Steven Toth | 6676237 | 2008-04-22 15:38:26 -0300 | [diff] [blame] | 701 | case 80019: |
| 702 | /* WinTV-HVR1400 (Express Card, Retail, IR, |
| 703 | * DVB-T and Basic analog */ |
| Michael Krufky | 36396c8 | 2008-05-02 16:14:33 -0300 | [diff] [blame] | 704 | case 81509: |
| 705 | /* WinTV-HVR1700 (PCIe, OEM, No IR, half height) |
| 706 | * DVB-T and MPEG2 HW Encoder */ |
| Steven Toth | a780a31 | 2008-04-19 01:25:52 -0300 | [diff] [blame] | 707 | case 81519: |
| Michael Krufky | 36396c8 | 2008-05-02 16:14:33 -0300 | [diff] [blame] | 708 | /* WinTV-HVR1700 (PCIe, OEM, No IR, full height) |
| Steven Toth | a780a31 | 2008-04-19 01:25:52 -0300 | [diff] [blame] | 709 | * DVB-T and MPEG2 HW Encoder */ |
| Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 710 | break; |
| Steven Toth | 13697380 | 2009-07-20 15:37:25 -0300 | [diff] [blame] | 711 | case 85021: |
| Michael Krufky | 73a5f41 | 2009-11-11 10:46:40 -0300 | [diff] [blame] | 712 | /* WinTV-HVR1850 (PCIe, Retail, 3.5mm in, IR, FM, |
| Steven Toth | 13697380 | 2009-07-20 15:37:25 -0300 | [diff] [blame] | 713 | Dual channel ATSC and MPEG2 HW Encoder */ |
| 714 | break; |
| Michael Krufky | 73a5f41 | 2009-11-11 10:46:40 -0300 | [diff] [blame] | 715 | case 85721: |
| 716 | /* WinTV-HVR1290 (PCIe, OEM, RCA in, IR, |
| 717 | Dual channel ATSC and Basic analog */ |
| 718 | break; |
| Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 719 | default: |
| Steven Toth | 13697380 | 2009-07-20 15:37:25 -0300 | [diff] [blame] | 720 | printk(KERN_WARNING "%s: warning: " |
| 721 | "unknown hauppauge model #%d\n", |
| Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 722 | dev->name, tv.model); |
| Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 723 | break; |
| 724 | } |
| 725 | |
| 726 | printk(KERN_INFO "%s: hauppauge eeprom: model=%d\n", |
| 727 | dev->name, tv.model); |
| 728 | } |
| 729 | |
| Michael Krufky | d7cba04 | 2008-09-12 13:31:45 -0300 | [diff] [blame] | 730 | int cx23885_tuner_callback(void *priv, int component, int command, int arg) |
| Steven Toth | 8c70017 | 2008-01-05 16:55:45 -0300 | [diff] [blame] | 731 | { |
| Steven Toth | 89ce221 | 2008-08-04 22:18:19 -0300 | [diff] [blame] | 732 | struct cx23885_tsport *port = priv; |
| 733 | struct cx23885_dev *dev = port->dev; |
| Steven Toth | 6df5169 | 2008-06-30 22:17:05 -0300 | [diff] [blame] | 734 | u32 bitmask = 0; |
| 735 | |
| Steven Toth | 89ce221 | 2008-08-04 22:18:19 -0300 | [diff] [blame] | 736 | if (command == XC2028_RESET_CLK) |
| 737 | return 0; |
| 738 | |
| Steven Toth | 6df5169 | 2008-06-30 22:17:05 -0300 | [diff] [blame] | 739 | if (command != 0) { |
| 740 | printk(KERN_ERR "%s(): Unknown command 0x%x.\n", |
| 741 | __func__, command); |
| 742 | return -EINVAL; |
| 743 | } |
| Steven Toth | 8c70017 | 2008-01-05 16:55:45 -0300 | [diff] [blame] | 744 | |
| Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 745 | switch (dev->board) { |
| Steven Toth | 90a71b1 | 2008-08-04 21:38:46 -0300 | [diff] [blame] | 746 | case CX23885_BOARD_HAUPPAUGE_HVR1400: |
| 747 | case CX23885_BOARD_HAUPPAUGE_HVR1500: |
| Steven Toth | 8c70017 | 2008-01-05 16:55:45 -0300 | [diff] [blame] | 748 | case CX23885_BOARD_HAUPPAUGE_HVR1500Q: |
| Steven Toth | 4c56b04 | 2008-08-12 13:30:03 -0300 | [diff] [blame] | 749 | case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H: |
| Igor M. Liplianin | 9bb1b7e | 2008-11-23 14:11:16 -0300 | [diff] [blame] | 750 | case CX23885_BOARD_COMPRO_VIDEOMATE_E650F: |
| Vladimir Geroy | 34e383d | 2009-09-18 18:55:47 -0300 | [diff] [blame] | 751 | case CX23885_BOARD_COMPRO_VIDEOMATE_E800: |
| Kusanagi Kouichi | 0b32d65 | 2010-01-22 04:55:28 -0300 | [diff] [blame] | 752 | case CX23885_BOARD_LEADTEK_WINFAST_PXTV1200: |
| Steven Toth | 90a71b1 | 2008-08-04 21:38:46 -0300 | [diff] [blame] | 753 | /* Tuner Reset Command */ |
| Steven Toth | 4c56b04 | 2008-08-12 13:30:03 -0300 | [diff] [blame] | 754 | bitmask = 0x04; |
| Steven Toth | 6df5169 | 2008-06-30 22:17:05 -0300 | [diff] [blame] | 755 | break; |
| 756 | case CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP: |
| Steven Toth | aef2d18 | 2008-08-04 21:39:53 -0300 | [diff] [blame] | 757 | case CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP: |
| Steven Toth | 4c56b04 | 2008-08-12 13:30:03 -0300 | [diff] [blame] | 758 | /* Two identical tuners on two different i2c buses, |
| 759 | * we need to reset the correct gpio. */ |
| Christopher Pascoe | d4dc673 | 2009-04-27 11:27:04 -0300 | [diff] [blame] | 760 | if (port->nr == 1) |
| Steven Toth | 4c56b04 | 2008-08-12 13:30:03 -0300 | [diff] [blame] | 761 | bitmask = 0x01; |
| Christopher Pascoe | d4dc673 | 2009-04-27 11:27:04 -0300 | [diff] [blame] | 762 | else if (port->nr == 2) |
| Steven Toth | 4c56b04 | 2008-08-12 13:30:03 -0300 | [diff] [blame] | 763 | bitmask = 0x04; |
| Steven Toth | 8c70017 | 2008-01-05 16:55:45 -0300 | [diff] [blame] | 764 | break; |
| Alexey Chernov | 9028f58 | 2010-12-06 17:09:53 -0300 | [diff] [blame] | 765 | case CX23885_BOARD_GOTVIEW_X5_3D_HYBRID: |
| 766 | /* Tuner Reset Command */ |
| 767 | bitmask = 0x02; |
| 768 | break; |
| Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 769 | case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF: |
| 770 | altera_ci_tuner_reset(dev, port->nr); |
| 771 | break; |
| Steven Toth | 8c70017 | 2008-01-05 16:55:45 -0300 | [diff] [blame] | 772 | } |
| 773 | |
| Steven Toth | 6df5169 | 2008-06-30 22:17:05 -0300 | [diff] [blame] | 774 | if (bitmask) { |
| 775 | /* Drive the tuner into reset and back out */ |
| 776 | cx_clear(GP0_IO, bitmask); |
| 777 | mdelay(200); |
| 778 | cx_set(GP0_IO, bitmask); |
| 779 | } |
| 780 | |
| 781 | return 0; |
| Steven Toth | 8c70017 | 2008-01-05 16:55:45 -0300 | [diff] [blame] | 782 | } |
| Steven Toth | 73c993a | 2008-01-05 17:08:05 -0300 | [diff] [blame] | 783 | |
| Steven Toth | a6a3f14 | 2007-09-08 21:31:56 -0300 | [diff] [blame] | 784 | void cx23885_gpio_setup(struct cx23885_dev *dev) |
| 785 | { |
| Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 786 | switch (dev->board) { |
| Steven Toth | a6a3f14 | 2007-09-08 21:31:56 -0300 | [diff] [blame] | 787 | case CX23885_BOARD_HAUPPAUGE_HVR1250: |
| 788 | /* GPIO-0 cx24227 demodulator reset */ |
| 789 | cx_set(GP0_IO, 0x00010001); /* Bring the part out of reset */ |
| 790 | break; |
| Michael Krufky | 07b4a83 | 2007-12-18 01:09:11 -0300 | [diff] [blame] | 791 | case CX23885_BOARD_HAUPPAUGE_HVR1500: |
| 792 | /* GPIO-0 cx24227 demodulator */ |
| 793 | /* GPIO-2 xc3028 tuner */ |
| 794 | |
| 795 | /* Put the parts into reset */ |
| 796 | cx_set(GP0_IO, 0x00050000); |
| 797 | cx_clear(GP0_IO, 0x00000005); |
| 798 | msleep(5); |
| 799 | |
| 800 | /* Bring the parts out of reset */ |
| 801 | cx_set(GP0_IO, 0x00050005); |
| 802 | break; |
| Steven Toth | d1987d5 | 2007-12-18 01:57:06 -0300 | [diff] [blame] | 803 | case CX23885_BOARD_HAUPPAUGE_HVR1500Q: |
| 804 | /* GPIO-0 cx24227 demodulator reset */ |
| 805 | /* GPIO-2 xc5000 tuner reset */ |
| 806 | cx_set(GP0_IO, 0x00050005); /* Bring the part out of reset */ |
| 807 | break; |
| Steven Toth | a6a3f14 | 2007-09-08 21:31:56 -0300 | [diff] [blame] | 808 | case CX23885_BOARD_HAUPPAUGE_HVR1800: |
| 809 | /* GPIO-0 656_CLK */ |
| 810 | /* GPIO-1 656_D0 */ |
| 811 | /* GPIO-2 8295A Reset */ |
| 812 | /* GPIO-3-10 cx23417 data0-7 */ |
| 813 | /* GPIO-11-14 cx23417 addr0-3 */ |
| 814 | /* GPIO-15-18 cx23417 READY, CS, RD, WR */ |
| 815 | /* GPIO-19 IR_RX */ |
| Michael Krufky | 3ba71d2 | 2007-12-07 01:40:36 -0300 | [diff] [blame] | 816 | |
| Steven Toth | a589b66 | 2008-01-13 23:44:47 -0300 | [diff] [blame] | 817 | /* CX23417 GPIO's */ |
| 818 | /* EIO15 Zilog Reset */ |
| 819 | /* EIO14 S5H1409/CX24227 Reset */ |
| Steven Toth | f659c51 | 2009-06-25 23:43:31 -0300 | [diff] [blame] | 820 | mc417_gpio_enable(dev, GPIO_15 | GPIO_14, 1); |
| 821 | |
| 822 | /* Put the demod into reset and protect the eeprom */ |
| 823 | mc417_gpio_clear(dev, GPIO_15 | GPIO_14); |
| 824 | mdelay(100); |
| 825 | |
| 826 | /* Bring the demod and blaster out of reset */ |
| 827 | mc417_gpio_set(dev, GPIO_15 | GPIO_14); |
| 828 | mdelay(100); |
| Steven Toth | a589b66 | 2008-01-13 23:44:47 -0300 | [diff] [blame] | 829 | |
| Steven Toth | 5206d6e | 2008-01-10 02:09:27 -0300 | [diff] [blame] | 830 | /* Force the TDA8295A into reset and back */ |
| Steven Toth | 21ff3e4 | 2009-06-25 23:50:39 -0300 | [diff] [blame] | 831 | cx23885_gpio_enable(dev, GPIO_2, 1); |
| 832 | cx23885_gpio_set(dev, GPIO_2); |
| Steven Toth | 5206d6e | 2008-01-10 02:09:27 -0300 | [diff] [blame] | 833 | mdelay(20); |
| Steven Toth | 21ff3e4 | 2009-06-25 23:50:39 -0300 | [diff] [blame] | 834 | cx23885_gpio_clear(dev, GPIO_2); |
| Steven Toth | 5206d6e | 2008-01-10 02:09:27 -0300 | [diff] [blame] | 835 | mdelay(20); |
| Steven Toth | 21ff3e4 | 2009-06-25 23:50:39 -0300 | [diff] [blame] | 836 | cx23885_gpio_set(dev, GPIO_2); |
| Steven Toth | 5206d6e | 2008-01-10 02:09:27 -0300 | [diff] [blame] | 837 | mdelay(20); |
| Steven Toth | a6a3f14 | 2007-09-08 21:31:56 -0300 | [diff] [blame] | 838 | break; |
| Steven Toth | b3ea016 | 2008-04-19 01:14:19 -0300 | [diff] [blame] | 839 | case CX23885_BOARD_HAUPPAUGE_HVR1200: |
| 840 | /* GPIO-0 tda10048 demodulator reset */ |
| 841 | /* GPIO-2 tda18271 tuner reset */ |
| 842 | |
| 843 | /* Put the parts into reset and back */ |
| 844 | cx_set(GP0_IO, 0x00050000); |
| 845 | mdelay(20); |
| 846 | cx_clear(GP0_IO, 0x00000005); |
| 847 | mdelay(20); |
| 848 | cx_set(GP0_IO, 0x00050005); |
| 849 | break; |
| Steven Toth | a780a31 | 2008-04-19 01:25:52 -0300 | [diff] [blame] | 850 | case CX23885_BOARD_HAUPPAUGE_HVR1700: |
| 851 | /* GPIO-0 TDA10048 demodulator reset */ |
| 852 | /* GPIO-2 TDA8295A Reset */ |
| 853 | /* GPIO-3-10 cx23417 data0-7 */ |
| 854 | /* GPIO-11-14 cx23417 addr0-3 */ |
| 855 | /* GPIO-15-18 cx23417 READY, CS, RD, WR */ |
| 856 | |
| 857 | /* The following GPIO's are on the interna AVCore (cx25840) */ |
| 858 | /* GPIO-19 IR_RX */ |
| 859 | /* GPIO-20 IR_TX 416/DVBT Select */ |
| 860 | /* GPIO-21 IIS DAT */ |
| 861 | /* GPIO-22 IIS WCLK */ |
| 862 | /* GPIO-23 IIS BCLK */ |
| 863 | |
| 864 | /* Put the parts into reset and back */ |
| 865 | cx_set(GP0_IO, 0x00050000); |
| 866 | mdelay(20); |
| 867 | cx_clear(GP0_IO, 0x00000005); |
| 868 | mdelay(20); |
| 869 | cx_set(GP0_IO, 0x00050005); |
| 870 | break; |
| Steven Toth | 6676237 | 2008-04-22 15:38:26 -0300 | [diff] [blame] | 871 | case CX23885_BOARD_HAUPPAUGE_HVR1400: |
| 872 | /* GPIO-0 Dibcom7000p demodulator reset */ |
| 873 | /* GPIO-2 xc3028L tuner reset */ |
| 874 | /* GPIO-13 LED */ |
| 875 | |
| 876 | /* Put the parts into reset and back */ |
| 877 | cx_set(GP0_IO, 0x00050000); |
| 878 | mdelay(20); |
| 879 | cx_clear(GP0_IO, 0x00000005); |
| 880 | mdelay(20); |
| 881 | cx_set(GP0_IO, 0x00050005); |
| 882 | break; |
| Steven Toth | 1ecc5ae | 2008-06-30 21:23:50 -0300 | [diff] [blame] | 883 | case CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP: |
| 884 | /* GPIO-0 xc5000 tuner reset i2c bus 0 */ |
| 885 | /* GPIO-1 s5h1409 demod reset i2c bus 0 */ |
| 886 | /* GPIO-2 xc5000 tuner reset i2c bus 1 */ |
| 887 | /* GPIO-3 s5h1409 demod reset i2c bus 0 */ |
| 888 | |
| 889 | /* Put the parts into reset and back */ |
| 890 | cx_set(GP0_IO, 0x000f0000); |
| 891 | mdelay(20); |
| 892 | cx_clear(GP0_IO, 0x0000000f); |
| 893 | mdelay(20); |
| 894 | cx_set(GP0_IO, 0x000f000f); |
| 895 | break; |
| Steven Toth | aef2d18 | 2008-08-04 21:39:53 -0300 | [diff] [blame] | 896 | case CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP: |
| 897 | /* GPIO-0 portb xc3028 reset */ |
| 898 | /* GPIO-1 portb zl10353 reset */ |
| 899 | /* GPIO-2 portc xc3028 reset */ |
| 900 | /* GPIO-3 portc zl10353 reset */ |
| 901 | |
| 902 | /* Put the parts into reset and back */ |
| 903 | cx_set(GP0_IO, 0x000f0000); |
| 904 | mdelay(20); |
| 905 | cx_clear(GP0_IO, 0x0000000f); |
| 906 | mdelay(20); |
| 907 | cx_set(GP0_IO, 0x000f000f); |
| 908 | break; |
| Steven Toth | 4c56b04 | 2008-08-12 13:30:03 -0300 | [diff] [blame] | 909 | case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H: |
| Igor M. Liplianin | 9bb1b7e | 2008-11-23 14:11:16 -0300 | [diff] [blame] | 910 | case CX23885_BOARD_COMPRO_VIDEOMATE_E650F: |
| Vladimir Geroy | 34e383d | 2009-09-18 18:55:47 -0300 | [diff] [blame] | 911 | case CX23885_BOARD_COMPRO_VIDEOMATE_E800: |
| Kusanagi Kouichi | 0b32d65 | 2010-01-22 04:55:28 -0300 | [diff] [blame] | 912 | case CX23885_BOARD_LEADTEK_WINFAST_PXTV1200: |
| Steven Toth | 4c56b04 | 2008-08-12 13:30:03 -0300 | [diff] [blame] | 913 | /* GPIO-2 xc3028 tuner reset */ |
| 914 | |
| 915 | /* The following GPIO's are on the internal AVCore (cx25840) */ |
| 916 | /* GPIO-? zl10353 demod reset */ |
| 917 | |
| 918 | /* Put the parts into reset and back */ |
| 919 | cx_set(GP0_IO, 0x00040000); |
| 920 | mdelay(20); |
| 921 | cx_clear(GP0_IO, 0x00000004); |
| 922 | mdelay(20); |
| 923 | cx_set(GP0_IO, 0x00040004); |
| 924 | break; |
| Igor M. Liplianin | 96318d0 | 2009-01-17 12:11:20 -0300 | [diff] [blame] | 925 | case CX23885_BOARD_TBS_6920: |
| 926 | cx_write(MC417_CTL, 0x00000036); |
| 927 | cx_write(MC417_OEN, 0x00001000); |
| Igor M. Liplianin | 09ea33e | 2009-11-24 20:16:04 -0300 | [diff] [blame] | 928 | cx_set(MC417_RWD, 0x00000002); |
| 929 | mdelay(200); |
| 930 | cx_clear(MC417_RWD, 0x00000800); |
| 931 | mdelay(200); |
| 932 | cx_set(MC417_RWD, 0x00000800); |
| 933 | mdelay(200); |
| Igor M. Liplianin | 96318d0 | 2009-01-17 12:11:20 -0300 | [diff] [blame] | 934 | break; |
| Igor M. Liplianin | 5a23b07 | 2009-03-03 12:06:09 -0300 | [diff] [blame] | 935 | case CX23885_BOARD_NETUP_DUAL_DVBS2_CI: |
| 936 | /* GPIO-0 INTA from CiMax1 |
| 937 | GPIO-1 INTB from CiMax2 |
| 938 | GPIO-2 reset chips |
| 939 | GPIO-3 to GPIO-10 data/addr for CA |
| 940 | GPIO-11 ~CS0 to CiMax1 |
| 941 | GPIO-12 ~CS1 to CiMax2 |
| 942 | GPIO-13 ADL0 load LSB addr |
| 943 | GPIO-14 ADL1 load MSB addr |
| 944 | GPIO-15 ~RDY from CiMax |
| 945 | GPIO-17 ~RD to CiMax |
| 946 | GPIO-18 ~WR to CiMax |
| 947 | */ |
| 948 | cx_set(GP0_IO, 0x00040000); /* GPIO as out */ |
| 949 | /* GPIO1 and GPIO2 as INTA and INTB from CiMaxes, reset low */ |
| 950 | cx_clear(GP0_IO, 0x00030004); |
| 951 | mdelay(100);/* reset delay */ |
| 952 | cx_set(GP0_IO, 0x00040004); /* GPIO as out, reset high */ |
| 953 | cx_write(MC417_CTL, 0x00000037);/* enable GPIO3-18 pins */ |
| 954 | /* GPIO-15 IN as ~ACK, rest as OUT */ |
| 955 | cx_write(MC417_OEN, 0x00001000); |
| 956 | /* ~RD, ~WR high; ADL0, ADL1 low; ~CS0, ~CS1 high */ |
| 957 | cx_write(MC417_RWD, 0x0000c300); |
| 958 | /* enable irq */ |
| 959 | cx_write(GPIO_ISM, 0x00000000);/* INTERRUPTS active low*/ |
| 960 | break; |
| Steven Toth | 2074dff | 2009-05-02 11:39:46 -0300 | [diff] [blame] | 961 | case CX23885_BOARD_HAUPPAUGE_HVR1270: |
| Michael Krufky | d099bec | 2009-05-08 22:39:24 -0300 | [diff] [blame] | 962 | case CX23885_BOARD_HAUPPAUGE_HVR1275: |
| Michael Krufky | 19bc579 | 2009-05-08 16:05:29 -0300 | [diff] [blame] | 963 | case CX23885_BOARD_HAUPPAUGE_HVR1255: |
| Michael Krufky | 6b926ec | 2009-05-12 17:32:17 -0300 | [diff] [blame] | 964 | case CX23885_BOARD_HAUPPAUGE_HVR1210: |
| Michael Krufky | d099bec | 2009-05-08 22:39:24 -0300 | [diff] [blame] | 965 | /* GPIO-5 RF Control: 0 = RF1 Terrestrial, 1 = RF2 Cable */ |
| Michael Krufky | 6b926ec | 2009-05-12 17:32:17 -0300 | [diff] [blame] | 966 | /* GPIO-6 I2C Gate which can isolate the demod from the bus */ |
| 967 | /* GPIO-9 Demod reset */ |
| Steven Toth | 2074dff | 2009-05-02 11:39:46 -0300 | [diff] [blame] | 968 | |
| 969 | /* Put the parts into reset and back */ |
| Michael Krufky | d099bec | 2009-05-08 22:39:24 -0300 | [diff] [blame] | 970 | cx23885_gpio_enable(dev, GPIO_9 | GPIO_6 | GPIO_5, 1); |
| 971 | cx23885_gpio_set(dev, GPIO_9 | GPIO_6 | GPIO_5); |
| Steven Toth | 2074dff | 2009-05-02 11:39:46 -0300 | [diff] [blame] | 972 | cx23885_gpio_clear(dev, GPIO_9); |
| 973 | mdelay(20); |
| 974 | cx23885_gpio_set(dev, GPIO_9); |
| 975 | break; |
| David Wong | 493b712 | 2009-05-18 05:25:49 -0300 | [diff] [blame] | 976 | case CX23885_BOARD_MYGICA_X8506: |
| David Wong | 2365b2d | 2009-06-17 01:38:12 -0300 | [diff] [blame] | 977 | case CX23885_BOARD_MAGICPRO_PROHDTVE2: |
| David T.L. Wong | 8e069bb | 2009-10-21 12:29:11 -0300 | [diff] [blame] | 978 | /* GPIO-0 (0)Analog / (1)Digital TV */ |
| David Wong | 493b712 | 2009-05-18 05:25:49 -0300 | [diff] [blame] | 979 | /* GPIO-1 reset XC5000 */ |
| David Wong | 2365b2d | 2009-06-17 01:38:12 -0300 | [diff] [blame] | 980 | /* GPIO-2 reset LGS8GL5 / LGS8G75 */ |
| David T.L. Wong | 8e069bb | 2009-10-21 12:29:11 -0300 | [diff] [blame] | 981 | cx23885_gpio_enable(dev, GPIO_0 | GPIO_1 | GPIO_2, 1); |
| 982 | cx23885_gpio_clear(dev, GPIO_1 | GPIO_2); |
| David Wong | 493b712 | 2009-05-18 05:25:49 -0300 | [diff] [blame] | 983 | mdelay(100); |
| David T.L. Wong | 8e069bb | 2009-10-21 12:29:11 -0300 | [diff] [blame] | 984 | cx23885_gpio_set(dev, GPIO_0 | GPIO_1 | GPIO_2); |
| David Wong | 493b712 | 2009-05-18 05:25:49 -0300 | [diff] [blame] | 985 | mdelay(100); |
| 986 | break; |
| David T. L. Wong | ea5697f | 2009-10-26 08:54:04 -0300 | [diff] [blame] | 987 | case CX23885_BOARD_MYGICA_X8558PRO: |
| 988 | /* GPIO-0 reset first ATBM8830 */ |
| 989 | /* GPIO-1 reset second ATBM8830 */ |
| 990 | cx23885_gpio_enable(dev, GPIO_0 | GPIO_1, 1); |
| 991 | cx23885_gpio_clear(dev, GPIO_0 | GPIO_1); |
| 992 | mdelay(100); |
| 993 | cx23885_gpio_set(dev, GPIO_0 | GPIO_1); |
| 994 | mdelay(100); |
| 995 | break; |
| Steven Toth | 13697380 | 2009-07-20 15:37:25 -0300 | [diff] [blame] | 996 | case CX23885_BOARD_HAUPPAUGE_HVR1850: |
| Michael Krufky | aee0b24 | 2009-11-11 01:52:45 -0300 | [diff] [blame] | 997 | case CX23885_BOARD_HAUPPAUGE_HVR1290: |
| Steven Toth | 13697380 | 2009-07-20 15:37:25 -0300 | [diff] [blame] | 998 | /* GPIO-0 656_CLK */ |
| 999 | /* GPIO-1 656_D0 */ |
| 1000 | /* GPIO-2 Wake# */ |
| 1001 | /* GPIO-3-10 cx23417 data0-7 */ |
| 1002 | /* GPIO-11-14 cx23417 addr0-3 */ |
| 1003 | /* GPIO-15-18 cx23417 READY, CS, RD, WR */ |
| 1004 | /* GPIO-19 IR_RX */ |
| 1005 | /* GPIO-20 C_IR_TX */ |
| 1006 | /* GPIO-21 I2S DAT */ |
| 1007 | /* GPIO-22 I2S WCLK */ |
| 1008 | /* GPIO-23 I2S BCLK */ |
| 1009 | /* ALT GPIO: EXP GPIO LATCH */ |
| 1010 | |
| 1011 | /* CX23417 GPIO's */ |
| 1012 | /* GPIO-14 S5H1411/CX24228 Reset */ |
| 1013 | /* GPIO-13 EEPROM write protect */ |
| 1014 | mc417_gpio_enable(dev, GPIO_14 | GPIO_13, 1); |
| 1015 | |
| 1016 | /* Put the demod into reset and protect the eeprom */ |
| 1017 | mc417_gpio_clear(dev, GPIO_14 | GPIO_13); |
| 1018 | mdelay(100); |
| 1019 | |
| 1020 | /* Bring the demod out of reset */ |
| 1021 | mc417_gpio_set(dev, GPIO_14); |
| 1022 | mdelay(100); |
| 1023 | |
| 1024 | /* CX24228 GPIO */ |
| 1025 | /* Connected to IF / Mux */ |
| 1026 | break; |
| Alexey Chernov | 9028f58 | 2010-12-06 17:09:53 -0300 | [diff] [blame] | 1027 | case CX23885_BOARD_GOTVIEW_X5_3D_HYBRID: |
| 1028 | cx_set(GP0_IO, 0x00010001); /* Bring the part out of reset */ |
| 1029 | break; |
| Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 1030 | case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF: |
| 1031 | /* GPIO-0 ~INT in |
| 1032 | GPIO-1 TMS out |
| 1033 | GPIO-2 ~reset chips out |
| 1034 | GPIO-3 to GPIO-10 data/addr for CA in/out |
| 1035 | GPIO-11 ~CS out |
| 1036 | GPIO-12 ADDR out |
| 1037 | GPIO-13 ~WR out |
| 1038 | GPIO-14 ~RD out |
| 1039 | GPIO-15 ~RDY in |
| 1040 | GPIO-16 TCK out |
| 1041 | GPIO-17 TDO in |
| 1042 | GPIO-18 TDI out |
| 1043 | */ |
| 1044 | cx_set(GP0_IO, 0x00060000); /* GPIO-1,2 as out */ |
| 1045 | /* GPIO-0 as INT, reset & TMS low */ |
| 1046 | cx_clear(GP0_IO, 0x00010006); |
| 1047 | mdelay(100);/* reset delay */ |
| 1048 | cx_set(GP0_IO, 0x00000004); /* reset high */ |
| 1049 | cx_write(MC417_CTL, 0x00000037);/* enable GPIO-3..18 pins */ |
| 1050 | /* GPIO-17 is TDO in, GPIO-15 is ~RDY in, rest is out */ |
| 1051 | cx_write(MC417_OEN, 0x00005000); |
| 1052 | /* ~RD, ~WR high; ADDR low; ~CS high */ |
| 1053 | cx_write(MC417_RWD, 0x00000d00); |
| 1054 | /* enable irq */ |
| 1055 | cx_write(GPIO_ISM, 0x00000000);/* INTERRUPTS active low*/ |
| 1056 | break; |
| Steven Toth | a6a3f14 | 2007-09-08 21:31:56 -0300 | [diff] [blame] | 1057 | } |
| 1058 | } |
| 1059 | |
| 1060 | int cx23885_ir_init(struct cx23885_dev *dev) |
| 1061 | { |
| Andy Walls | 98d109f | 2010-07-19 00:41:41 -0300 | [diff] [blame] | 1062 | static struct v4l2_subdev_io_pin_config ir_rxtx_pin_cfg[] = { |
| Andy Walls | 81f287d | 2010-07-18 20:26:37 -0300 | [diff] [blame] | 1063 | { |
| 1064 | .flags = V4L2_SUBDEV_IO_PIN_INPUT, |
| 1065 | .pin = CX23885_PIN_IR_RX_GPIO19, |
| 1066 | .function = CX23885_PAD_IR_RX, |
| 1067 | .value = 0, |
| 1068 | .strength = CX25840_PIN_DRIVE_MEDIUM, |
| 1069 | }, { |
| 1070 | .flags = V4L2_SUBDEV_IO_PIN_OUTPUT, |
| 1071 | .pin = CX23885_PIN_IR_TX_GPIO20, |
| 1072 | .function = CX23885_PAD_IR_TX, |
| 1073 | .value = 0, |
| 1074 | .strength = CX25840_PIN_DRIVE_MEDIUM, |
| 1075 | } |
| 1076 | }; |
| Andy Walls | 98d109f | 2010-07-19 00:41:41 -0300 | [diff] [blame] | 1077 | const size_t ir_rxtx_pin_cfg_count = ARRAY_SIZE(ir_rxtx_pin_cfg); |
| 1078 | |
| 1079 | static struct v4l2_subdev_io_pin_config ir_rx_pin_cfg[] = { |
| 1080 | { |
| 1081 | .flags = V4L2_SUBDEV_IO_PIN_INPUT, |
| 1082 | .pin = CX23885_PIN_IR_RX_GPIO19, |
| 1083 | .function = CX23885_PAD_IR_RX, |
| 1084 | .value = 0, |
| 1085 | .strength = CX25840_PIN_DRIVE_MEDIUM, |
| 1086 | } |
| 1087 | }; |
| 1088 | const size_t ir_rx_pin_cfg_count = ARRAY_SIZE(ir_rx_pin_cfg); |
| Andy Walls | 81f287d | 2010-07-18 20:26:37 -0300 | [diff] [blame] | 1089 | |
| 1090 | struct v4l2_subdev_ir_parameters params; |
| Andy Walls | 29f8a0a | 2009-09-26 23:17:30 -0300 | [diff] [blame] | 1091 | int ret = 0; |
| Steven Toth | a6a3f14 | 2007-09-08 21:31:56 -0300 | [diff] [blame] | 1092 | switch (dev->board) { |
| Michael Krufky | 07b4a83 | 2007-12-18 01:09:11 -0300 | [diff] [blame] | 1093 | case CX23885_BOARD_HAUPPAUGE_HVR1500: |
| Steven Toth | d1987d5 | 2007-12-18 01:57:06 -0300 | [diff] [blame] | 1094 | case CX23885_BOARD_HAUPPAUGE_HVR1500Q: |
| Steven Toth | a6a3f14 | 2007-09-08 21:31:56 -0300 | [diff] [blame] | 1095 | case CX23885_BOARD_HAUPPAUGE_HVR1800: |
| Steven Toth | b3ea016 | 2008-04-19 01:14:19 -0300 | [diff] [blame] | 1096 | case CX23885_BOARD_HAUPPAUGE_HVR1200: |
| Steven Toth | 6676237 | 2008-04-22 15:38:26 -0300 | [diff] [blame] | 1097 | case CX23885_BOARD_HAUPPAUGE_HVR1400: |
| Steven Toth | 2074dff | 2009-05-02 11:39:46 -0300 | [diff] [blame] | 1098 | case CX23885_BOARD_HAUPPAUGE_HVR1270: |
| Michael Krufky | d099bec | 2009-05-08 22:39:24 -0300 | [diff] [blame] | 1099 | case CX23885_BOARD_HAUPPAUGE_HVR1275: |
| Michael Krufky | 19bc579 | 2009-05-08 16:05:29 -0300 | [diff] [blame] | 1100 | case CX23885_BOARD_HAUPPAUGE_HVR1255: |
| Michael Krufky | 6b926ec | 2009-05-12 17:32:17 -0300 | [diff] [blame] | 1101 | case CX23885_BOARD_HAUPPAUGE_HVR1210: |
| Steven Toth | a6a3f14 | 2007-09-08 21:31:56 -0300 | [diff] [blame] | 1102 | /* FIXME: Implement me */ |
| 1103 | break; |
| Andy Walls | 29f8a0a | 2009-09-26 23:17:30 -0300 | [diff] [blame] | 1104 | case CX23885_BOARD_HAUPPAUGE_HVR1850: |
| Michael Krufky | 7fec6fe | 2009-11-11 15:46:09 -0300 | [diff] [blame] | 1105 | case CX23885_BOARD_HAUPPAUGE_HVR1290: |
| Andy Walls | 29f8a0a | 2009-09-26 23:17:30 -0300 | [diff] [blame] | 1106 | ret = cx23888_ir_probe(dev); |
| 1107 | if (ret) |
| 1108 | break; |
| 1109 | dev->sd_ir = cx23885_find_hw(dev, CX23885_HW_888_IR); |
| Andy Walls | 81f287d | 2010-07-18 20:26:37 -0300 | [diff] [blame] | 1110 | v4l2_subdev_call(dev->sd_cx25840, core, s_io_pin_config, |
| Andy Walls | 98d109f | 2010-07-19 00:41:41 -0300 | [diff] [blame] | 1111 | ir_rxtx_pin_cfg_count, ir_rxtx_pin_cfg); |
| Andy Walls | 81f287d | 2010-07-18 20:26:37 -0300 | [diff] [blame] | 1112 | /* |
| 1113 | * For these boards we need to invert the Tx output via the |
| 1114 | * IR controller to have the LED off while idle |
| 1115 | */ |
| 1116 | v4l2_subdev_call(dev->sd_ir, ir, tx_g_parameters, ¶ms); |
| 1117 | params.enable = false; |
| 1118 | params.shutdown = false; |
| 1119 | params.invert_level = true; |
| 1120 | v4l2_subdev_call(dev->sd_ir, ir, tx_s_parameters, ¶ms); |
| 1121 | params.shutdown = true; |
| 1122 | v4l2_subdev_call(dev->sd_ir, ir, tx_s_parameters, ¶ms); |
| Andy Walls | 29f8a0a | 2009-09-26 23:17:30 -0300 | [diff] [blame] | 1123 | break; |
| Andy Walls | 98d109f | 2010-07-19 00:41:41 -0300 | [diff] [blame] | 1124 | case CX23885_BOARD_TEVII_S470: |
| Andy Walls | fa647f2 | 2010-07-19 21:22:05 -0300 | [diff] [blame] | 1125 | if (!enable_885_ir) |
| 1126 | break; |
| Andy Walls | 98d109f | 2010-07-19 00:41:41 -0300 | [diff] [blame] | 1127 | dev->sd_ir = cx23885_find_hw(dev, CX23885_HW_AV_CORE); |
| 1128 | if (dev->sd_ir == NULL) { |
| 1129 | ret = -ENODEV; |
| 1130 | break; |
| 1131 | } |
| 1132 | v4l2_subdev_call(dev->sd_cx25840, core, s_io_pin_config, |
| 1133 | ir_rx_pin_cfg_count, ir_rx_pin_cfg); |
| Andy Walls | 98d109f | 2010-07-19 00:41:41 -0300 | [diff] [blame] | 1134 | break; |
| 1135 | case CX23885_BOARD_HAUPPAUGE_HVR1250: |
| Andy Walls | fa647f2 | 2010-07-19 21:22:05 -0300 | [diff] [blame] | 1136 | if (!enable_885_ir) |
| 1137 | break; |
| Andy Walls | 98d109f | 2010-07-19 00:41:41 -0300 | [diff] [blame] | 1138 | dev->sd_ir = cx23885_find_hw(dev, CX23885_HW_AV_CORE); |
| 1139 | if (dev->sd_ir == NULL) { |
| 1140 | ret = -ENODEV; |
| 1141 | break; |
| 1142 | } |
| 1143 | v4l2_subdev_call(dev->sd_cx25840, core, s_io_pin_config, |
| 1144 | ir_rxtx_pin_cfg_count, ir_rxtx_pin_cfg); |
| Andy Walls | 98d109f | 2010-07-19 00:41:41 -0300 | [diff] [blame] | 1145 | break; |
| Steven Toth | 1288687 | 2008-08-04 21:41:06 -0300 | [diff] [blame] | 1146 | case CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP: |
| 1147 | request_module("ir-kbd-i2c"); |
| 1148 | break; |
| Steven Toth | a6a3f14 | 2007-09-08 21:31:56 -0300 | [diff] [blame] | 1149 | } |
| 1150 | |
| Andy Walls | 29f8a0a | 2009-09-26 23:17:30 -0300 | [diff] [blame] | 1151 | return ret; |
| Steven Toth | a6a3f14 | 2007-09-08 21:31:56 -0300 | [diff] [blame] | 1152 | } |
| 1153 | |
| Andy Walls | f59ad61 | 2009-09-27 19:51:50 -0300 | [diff] [blame] | 1154 | void cx23885_ir_fini(struct cx23885_dev *dev) |
| 1155 | { |
| 1156 | switch (dev->board) { |
| 1157 | case CX23885_BOARD_HAUPPAUGE_HVR1850: |
| Michael Krufky | 7fec6fe | 2009-11-11 15:46:09 -0300 | [diff] [blame] | 1158 | case CX23885_BOARD_HAUPPAUGE_HVR1290: |
| Andy Walls | dbe83a3 | 2010-07-19 01:19:43 -0300 | [diff] [blame] | 1159 | cx23885_irq_remove(dev, PCI_MSK_IR); |
| Andy Walls | f59ad61 | 2009-09-27 19:51:50 -0300 | [diff] [blame] | 1160 | cx23888_ir_remove(dev); |
| 1161 | dev->sd_ir = NULL; |
| 1162 | break; |
| Andy Walls | 98d109f | 2010-07-19 00:41:41 -0300 | [diff] [blame] | 1163 | case CX23885_BOARD_TEVII_S470: |
| 1164 | case CX23885_BOARD_HAUPPAUGE_HVR1250: |
| Andy Walls | dbe83a3 | 2010-07-19 01:19:43 -0300 | [diff] [blame] | 1165 | cx23885_irq_remove(dev, PCI_MSK_AV_CORE); |
| Andy Walls | 98d109f | 2010-07-19 00:41:41 -0300 | [diff] [blame] | 1166 | /* sd_ir is a duplicate pointer to the AV Core, just clear it */ |
| 1167 | dev->sd_ir = NULL; |
| 1168 | break; |
| Andy Walls | f59ad61 | 2009-09-27 19:51:50 -0300 | [diff] [blame] | 1169 | } |
| 1170 | } |
| 1171 | |
| Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 1172 | int netup_jtag_io(void *device, int tms, int tdi, int read_tdo) |
| 1173 | { |
| 1174 | int data; |
| 1175 | int tdo = 0; |
| 1176 | struct cx23885_dev *dev = (struct cx23885_dev *)device; |
| 1177 | /*TMS*/ |
| 1178 | data = ((cx_read(GP0_IO)) & (~0x00000002)); |
| 1179 | data |= (tms ? 0x00020002 : 0x00020000); |
| 1180 | cx_write(GP0_IO, data); |
| 1181 | |
| 1182 | /*TDI*/ |
| 1183 | data = ((cx_read(MC417_RWD)) & (~0x0000a000)); |
| 1184 | data |= (tdi ? 0x00008000 : 0); |
| 1185 | cx_write(MC417_RWD, data); |
| 1186 | if (read_tdo) |
| 1187 | tdo = (data & 0x00004000) ? 1 : 0; /*TDO*/ |
| 1188 | |
| 1189 | cx_write(MC417_RWD, data | 0x00002000); |
| 1190 | udelay(1); |
| 1191 | /*TCK*/ |
| 1192 | cx_write(MC417_RWD, data); |
| 1193 | |
| 1194 | return tdo; |
| 1195 | } |
| 1196 | |
| Andy Walls | f59ad61 | 2009-09-27 19:51:50 -0300 | [diff] [blame] | 1197 | void cx23885_ir_pci_int_enable(struct cx23885_dev *dev) |
| 1198 | { |
| 1199 | switch (dev->board) { |
| 1200 | case CX23885_BOARD_HAUPPAUGE_HVR1850: |
| Michael Krufky | 7fec6fe | 2009-11-11 15:46:09 -0300 | [diff] [blame] | 1201 | case CX23885_BOARD_HAUPPAUGE_HVR1290: |
| Andy Walls | dbe83a3 | 2010-07-19 01:19:43 -0300 | [diff] [blame] | 1202 | if (dev->sd_ir) |
| 1203 | cx23885_irq_add_enable(dev, PCI_MSK_IR); |
| Andy Walls | f59ad61 | 2009-09-27 19:51:50 -0300 | [diff] [blame] | 1204 | break; |
| Andy Walls | 98d109f | 2010-07-19 00:41:41 -0300 | [diff] [blame] | 1205 | case CX23885_BOARD_TEVII_S470: |
| 1206 | case CX23885_BOARD_HAUPPAUGE_HVR1250: |
| Andy Walls | dbe83a3 | 2010-07-19 01:19:43 -0300 | [diff] [blame] | 1207 | if (dev->sd_ir) |
| 1208 | cx23885_irq_add_enable(dev, PCI_MSK_AV_CORE); |
| Andy Walls | 98d109f | 2010-07-19 00:41:41 -0300 | [diff] [blame] | 1209 | break; |
| Andy Walls | f59ad61 | 2009-09-27 19:51:50 -0300 | [diff] [blame] | 1210 | } |
| 1211 | } |
| 1212 | |
| Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 1213 | void cx23885_card_setup(struct cx23885_dev *dev) |
| 1214 | { |
| Steven Toth | a6a3f14 | 2007-09-08 21:31:56 -0300 | [diff] [blame] | 1215 | struct cx23885_tsport *ts1 = &dev->ts1; |
| 1216 | struct cx23885_tsport *ts2 = &dev->ts2; |
| 1217 | |
| Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 1218 | static u8 eeprom[256]; |
| 1219 | |
| 1220 | if (dev->i2c_bus[0].i2c_rc == 0) { |
| 1221 | dev->i2c_bus[0].i2c_client.addr = 0xa0 >> 1; |
| Michael Krufky | 44a6481 | 2007-03-20 23:00:18 -0300 | [diff] [blame] | 1222 | tveeprom_read(&dev->i2c_bus[0].i2c_client, |
| 1223 | eeprom, sizeof(eeprom)); |
| Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 1224 | } |
| 1225 | |
| 1226 | switch (dev->board) { |
| Steven Toth | a77743b | 2007-08-22 21:01:20 -0300 | [diff] [blame] | 1227 | case CX23885_BOARD_HAUPPAUGE_HVR1250: |
| Andy Walls | ebbeb46 | 2010-07-18 17:35:00 -0300 | [diff] [blame] | 1228 | if (dev->i2c_bus[0].i2c_rc == 0) { |
| 1229 | if (eeprom[0x80] != 0x84) |
| 1230 | hauppauge_eeprom(dev, eeprom+0xc0); |
| 1231 | else |
| 1232 | hauppauge_eeprom(dev, eeprom+0x80); |
| 1233 | } |
| 1234 | break; |
| Michael Krufky | 07b4a83 | 2007-12-18 01:09:11 -0300 | [diff] [blame] | 1235 | case CX23885_BOARD_HAUPPAUGE_HVR1500: |
| Steven Toth | d1987d5 | 2007-12-18 01:57:06 -0300 | [diff] [blame] | 1236 | case CX23885_BOARD_HAUPPAUGE_HVR1500Q: |
| Steven Toth | 6676237 | 2008-04-22 15:38:26 -0300 | [diff] [blame] | 1237 | case CX23885_BOARD_HAUPPAUGE_HVR1400: |
| Steven Toth | c88133e | 2008-03-29 17:36:09 -0300 | [diff] [blame] | 1238 | if (dev->i2c_bus[0].i2c_rc == 0) |
| 1239 | hauppauge_eeprom(dev, eeprom+0x80); |
| 1240 | break; |
| Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 1241 | case CX23885_BOARD_HAUPPAUGE_HVR1800: |
| 1242 | case CX23885_BOARD_HAUPPAUGE_HVR1800lp: |
| Steven Toth | b3ea016 | 2008-04-19 01:14:19 -0300 | [diff] [blame] | 1243 | case CX23885_BOARD_HAUPPAUGE_HVR1200: |
| Steven Toth | a780a31 | 2008-04-19 01:25:52 -0300 | [diff] [blame] | 1244 | case CX23885_BOARD_HAUPPAUGE_HVR1700: |
| Steven Toth | 2074dff | 2009-05-02 11:39:46 -0300 | [diff] [blame] | 1245 | case CX23885_BOARD_HAUPPAUGE_HVR1270: |
| Michael Krufky | d099bec | 2009-05-08 22:39:24 -0300 | [diff] [blame] | 1246 | case CX23885_BOARD_HAUPPAUGE_HVR1275: |
| Michael Krufky | 19bc579 | 2009-05-08 16:05:29 -0300 | [diff] [blame] | 1247 | case CX23885_BOARD_HAUPPAUGE_HVR1255: |
| Michael Krufky | 6b926ec | 2009-05-12 17:32:17 -0300 | [diff] [blame] | 1248 | case CX23885_BOARD_HAUPPAUGE_HVR1210: |
| Steven Toth | 13697380 | 2009-07-20 15:37:25 -0300 | [diff] [blame] | 1249 | case CX23885_BOARD_HAUPPAUGE_HVR1850: |
| Michael Krufky | aee0b24 | 2009-11-11 01:52:45 -0300 | [diff] [blame] | 1250 | case CX23885_BOARD_HAUPPAUGE_HVR1290: |
| Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 1251 | if (dev->i2c_bus[0].i2c_rc == 0) |
| Steven Toth | c88133e | 2008-03-29 17:36:09 -0300 | [diff] [blame] | 1252 | hauppauge_eeprom(dev, eeprom+0xc0); |
| Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 1253 | break; |
| 1254 | } |
| Steven Toth | a6a3f14 | 2007-09-08 21:31:56 -0300 | [diff] [blame] | 1255 | |
| 1256 | switch (dev->board) { |
| Michael Krufky | 335377b | 2008-05-07 01:43:10 -0300 | [diff] [blame] | 1257 | case CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP: |
| Steven Toth | aef2d18 | 2008-08-04 21:39:53 -0300 | [diff] [blame] | 1258 | case CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP: |
| Michael Krufky | 335377b | 2008-05-07 01:43:10 -0300 | [diff] [blame] | 1259 | ts2->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */ |
| 1260 | ts2->ts_clk_en_val = 0x1; /* Enable TS_CLK */ |
| 1261 | ts2->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO; |
| 1262 | /* break omitted intentionally */ |
| Steven Toth | a6a3f14 | 2007-09-08 21:31:56 -0300 | [diff] [blame] | 1263 | case CX23885_BOARD_DVICO_FUSIONHDTV_5_EXP: |
| 1264 | ts1->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */ |
| 1265 | ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */ |
| 1266 | ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO; |
| 1267 | break; |
| Steven Toth | a589b66 | 2008-01-13 23:44:47 -0300 | [diff] [blame] | 1268 | case CX23885_BOARD_HAUPPAUGE_HVR1800: |
| 1269 | /* Defaults for VID B - Analog encoder */ |
| 1270 | /* DREQ_POL, SMODE, PUNC_CLK, MCLK_POL Serial bus + punc clk */ |
| 1271 | ts1->gen_ctrl_val = 0x10e; |
| 1272 | ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */ |
| 1273 | ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO; |
| 1274 | |
| 1275 | /* APB_TSVALERR_POL (active low)*/ |
| 1276 | ts1->vld_misc_val = 0x2000; |
| 1277 | ts1->hw_sop_ctrl_val = (0x47 << 16 | 188 << 4 | 0xc); |
| 1278 | |
| 1279 | /* Defaults for VID C */ |
| 1280 | ts2->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */ |
| 1281 | ts2->ts_clk_en_val = 0x1; /* Enable TS_CLK */ |
| 1282 | ts2->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO; |
| 1283 | break; |
| Igor M. Liplianin | 96318d0 | 2009-01-17 12:11:20 -0300 | [diff] [blame] | 1284 | case CX23885_BOARD_TBS_6920: |
| Igor M. Liplianin | 09ea33e | 2009-11-24 20:16:04 -0300 | [diff] [blame] | 1285 | ts1->gen_ctrl_val = 0x4; /* Parallel */ |
| 1286 | ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */ |
| 1287 | ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO; |
| 1288 | break; |
| 1289 | case CX23885_BOARD_TEVII_S470: |
| Igor M. Liplianin | c9b8b04 | 2009-01-17 12:23:31 -0300 | [diff] [blame] | 1290 | case CX23885_BOARD_DVBWORLD_2005: |
| Igor M. Liplianin | 96318d0 | 2009-01-17 12:11:20 -0300 | [diff] [blame] | 1291 | ts1->gen_ctrl_val = 0x5; /* Parallel */ |
| 1292 | ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */ |
| 1293 | ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO; |
| 1294 | break; |
| Igor M. Liplianin | 5a23b07 | 2009-03-03 12:06:09 -0300 | [diff] [blame] | 1295 | case CX23885_BOARD_NETUP_DUAL_DVBS2_CI: |
| Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 1296 | case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF: |
| Igor M. Liplianin | 5a23b07 | 2009-03-03 12:06:09 -0300 | [diff] [blame] | 1297 | ts1->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */ |
| 1298 | ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */ |
| 1299 | ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO; |
| 1300 | ts2->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */ |
| 1301 | ts2->ts_clk_en_val = 0x1; /* Enable TS_CLK */ |
| 1302 | ts2->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO; |
| 1303 | break; |
| David Wong | 493b712 | 2009-05-18 05:25:49 -0300 | [diff] [blame] | 1304 | case CX23885_BOARD_MYGICA_X8506: |
| David Wong | 2365b2d | 2009-06-17 01:38:12 -0300 | [diff] [blame] | 1305 | case CX23885_BOARD_MAGICPRO_PROHDTVE2: |
| David Wong | 493b712 | 2009-05-18 05:25:49 -0300 | [diff] [blame] | 1306 | ts1->gen_ctrl_val = 0x5; /* Parallel */ |
| 1307 | ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */ |
| 1308 | ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO; |
| 1309 | break; |
| David T. L. Wong | ea5697f | 2009-10-26 08:54:04 -0300 | [diff] [blame] | 1310 | case CX23885_BOARD_MYGICA_X8558PRO: |
| 1311 | ts1->gen_ctrl_val = 0x5; /* Parallel */ |
| 1312 | ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */ |
| 1313 | ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO; |
| 1314 | ts2->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */ |
| 1315 | ts2->ts_clk_en_val = 0x1; /* Enable TS_CLK */ |
| 1316 | ts2->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO; |
| 1317 | break; |
| Steven Toth | a6a3f14 | 2007-09-08 21:31:56 -0300 | [diff] [blame] | 1318 | case CX23885_BOARD_HAUPPAUGE_HVR1250: |
| Michael Krufky | 07b4a83 | 2007-12-18 01:09:11 -0300 | [diff] [blame] | 1319 | case CX23885_BOARD_HAUPPAUGE_HVR1500: |
| Steven Toth | d1987d5 | 2007-12-18 01:57:06 -0300 | [diff] [blame] | 1320 | case CX23885_BOARD_HAUPPAUGE_HVR1500Q: |
| Steven Toth | a6a3f14 | 2007-09-08 21:31:56 -0300 | [diff] [blame] | 1321 | case CX23885_BOARD_HAUPPAUGE_HVR1800lp: |
| Steven Toth | b3ea016 | 2008-04-19 01:14:19 -0300 | [diff] [blame] | 1322 | case CX23885_BOARD_HAUPPAUGE_HVR1200: |
| Steven Toth | a780a31 | 2008-04-19 01:25:52 -0300 | [diff] [blame] | 1323 | case CX23885_BOARD_HAUPPAUGE_HVR1700: |
| Steven Toth | 6676237 | 2008-04-22 15:38:26 -0300 | [diff] [blame] | 1324 | case CX23885_BOARD_HAUPPAUGE_HVR1400: |
| Steven Toth | 4c56b04 | 2008-08-12 13:30:03 -0300 | [diff] [blame] | 1325 | case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H: |
| Igor M. Liplianin | 9bb1b7e | 2008-11-23 14:11:16 -0300 | [diff] [blame] | 1326 | case CX23885_BOARD_COMPRO_VIDEOMATE_E650F: |
| Steven Toth | 2074dff | 2009-05-02 11:39:46 -0300 | [diff] [blame] | 1327 | case CX23885_BOARD_HAUPPAUGE_HVR1270: |
| Michael Krufky | d099bec | 2009-05-08 22:39:24 -0300 | [diff] [blame] | 1328 | case CX23885_BOARD_HAUPPAUGE_HVR1275: |
| Michael Krufky | 19bc579 | 2009-05-08 16:05:29 -0300 | [diff] [blame] | 1329 | case CX23885_BOARD_HAUPPAUGE_HVR1255: |
| Michael Krufky | 6b926ec | 2009-05-12 17:32:17 -0300 | [diff] [blame] | 1330 | case CX23885_BOARD_HAUPPAUGE_HVR1210: |
| Steven Toth | 13697380 | 2009-07-20 15:37:25 -0300 | [diff] [blame] | 1331 | case CX23885_BOARD_HAUPPAUGE_HVR1850: |
| Vladimir Geroy | 34e383d | 2009-09-18 18:55:47 -0300 | [diff] [blame] | 1332 | case CX23885_BOARD_COMPRO_VIDEOMATE_E800: |
| Michael Krufky | aee0b24 | 2009-11-11 01:52:45 -0300 | [diff] [blame] | 1333 | case CX23885_BOARD_HAUPPAUGE_HVR1290: |
| Alexey Chernov | 9028f58 | 2010-12-06 17:09:53 -0300 | [diff] [blame] | 1334 | case CX23885_BOARD_GOTVIEW_X5_3D_HYBRID: |
| Steven Toth | a6a3f14 | 2007-09-08 21:31:56 -0300 | [diff] [blame] | 1335 | default: |
| 1336 | ts2->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */ |
| 1337 | ts2->ts_clk_en_val = 0x1; /* Enable TS_CLK */ |
| 1338 | ts2->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO; |
| 1339 | } |
| 1340 | |
| Steven Toth | ce89cfb | 2008-04-19 01:36:06 -0300 | [diff] [blame] | 1341 | /* Certain boards support analog, or require the avcore to be |
| 1342 | * loaded, ensure this happens. |
| 1343 | */ |
| 1344 | switch (dev->board) { |
| Andy Walls | fa647f2 | 2010-07-19 21:22:05 -0300 | [diff] [blame] | 1345 | case CX23885_BOARD_TEVII_S470: |
| 1346 | case CX23885_BOARD_HAUPPAUGE_HVR1250: |
| 1347 | /* Currently only enabled for the integrated IR controller */ |
| 1348 | if (!enable_885_ir) |
| 1349 | break; |
| Steven Toth | ce89cfb | 2008-04-19 01:36:06 -0300 | [diff] [blame] | 1350 | case CX23885_BOARD_HAUPPAUGE_HVR1800: |
| 1351 | case CX23885_BOARD_HAUPPAUGE_HVR1800lp: |
| 1352 | case CX23885_BOARD_HAUPPAUGE_HVR1700: |
| Steven Toth | 4c56b04 | 2008-08-12 13:30:03 -0300 | [diff] [blame] | 1353 | case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H: |
| Igor M. Liplianin | 9bb1b7e | 2008-11-23 14:11:16 -0300 | [diff] [blame] | 1354 | case CX23885_BOARD_COMPRO_VIDEOMATE_E650F: |
| Igor M. Liplianin | 5a23b07 | 2009-03-03 12:06:09 -0300 | [diff] [blame] | 1355 | case CX23885_BOARD_NETUP_DUAL_DVBS2_CI: |
| Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 1356 | case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF: |
| Vladimir Geroy | 34e383d | 2009-09-18 18:55:47 -0300 | [diff] [blame] | 1357 | case CX23885_BOARD_COMPRO_VIDEOMATE_E800: |
| Andy Walls | c6b7053 | 2009-09-27 00:14:33 -0300 | [diff] [blame] | 1358 | case CX23885_BOARD_HAUPPAUGE_HVR1850: |
| David T.L. Wong | bc1548a | 2009-10-21 11:09:28 -0300 | [diff] [blame] | 1359 | case CX23885_BOARD_MYGICA_X8506: |
| 1360 | case CX23885_BOARD_MAGICPRO_PROHDTVE2: |
| Michael Krufky | aee0b24 | 2009-11-11 01:52:45 -0300 | [diff] [blame] | 1361 | case CX23885_BOARD_HAUPPAUGE_HVR1290: |
| Kusanagi Kouichi | 0b32d65 | 2010-01-22 04:55:28 -0300 | [diff] [blame] | 1362 | case CX23885_BOARD_LEADTEK_WINFAST_PXTV1200: |
| Alexey Chernov | 9028f58 | 2010-12-06 17:09:53 -0300 | [diff] [blame] | 1363 | case CX23885_BOARD_GOTVIEW_X5_3D_HYBRID: |
| Hans Verkuil | e6574f2 | 2009-04-01 03:57:53 -0300 | [diff] [blame] | 1364 | dev->sd_cx25840 = v4l2_i2c_new_subdev(&dev->v4l2_dev, |
| 1365 | &dev->i2c_bus[2].i2c_adap, |
| Laurent Pinchart | 9a1f8b3 | 2010-09-24 10:16:44 -0300 | [diff] [blame] | 1366 | "cx25840", 0x88 >> 1, NULL); |
| Andy Walls | d6b1850 | 2010-07-18 23:26:29 -0300 | [diff] [blame] | 1367 | if (dev->sd_cx25840) { |
| 1368 | dev->sd_cx25840->grp_id = CX23885_HW_AV_CORE; |
| 1369 | v4l2_subdev_call(dev->sd_cx25840, core, load_fw); |
| 1370 | } |
| Steven Toth | ce89cfb | 2008-04-19 01:36:06 -0300 | [diff] [blame] | 1371 | break; |
| 1372 | } |
| Igor M. Liplianin | 5a23b07 | 2009-03-03 12:06:09 -0300 | [diff] [blame] | 1373 | |
| 1374 | /* AUX-PLL 27MHz CLK */ |
| 1375 | switch (dev->board) { |
| 1376 | case CX23885_BOARD_NETUP_DUAL_DVBS2_CI: |
| 1377 | netup_initialize(dev); |
| 1378 | break; |
| Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 1379 | case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF: { |
| 1380 | int ret; |
| 1381 | const struct firmware *fw; |
| 1382 | const char *filename = "dvb-netup-altera-01.fw"; |
| 1383 | char *action = "configure"; |
| 1384 | struct altera_config netup_config = { |
| 1385 | .dev = dev, |
| 1386 | .action = action, |
| 1387 | .jtag_io = netup_jtag_io, |
| 1388 | }; |
| 1389 | |
| 1390 | netup_initialize(dev); |
| 1391 | |
| 1392 | ret = request_firmware(&fw, filename, &dev->pci->dev); |
| 1393 | if (ret != 0) |
| 1394 | printk(KERN_ERR "did not find the firmware file. (%s) " |
| 1395 | "Please see linux/Documentation/dvb/ for more details " |
| 1396 | "on firmware-problems.", filename); |
| 1397 | else |
| 1398 | altera_init(&netup_config, fw); |
| 1399 | |
| 1400 | break; |
| 1401 | } |
| Igor M. Liplianin | 5a23b07 | 2009-03-03 12:06:09 -0300 | [diff] [blame] | 1402 | } |
| Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 1403 | } |
| 1404 | |
| 1405 | /* ------------------------------------------------------------------ */ |