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> |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 27 | |
| 28 | #include "cx23885.h" |
Steven Toth | 90a71b1 | 2008-08-04 21:38:46 -0300 | [diff] [blame] | 29 | #include "tuner-xc2028.h" |
Igor M. Liplianin | 5a23b07 | 2009-03-03 12:06:09 -0300 | [diff] [blame] | 30 | #include "netup-init.h" |
Andy Walls | 29f8a0a | 2009-09-26 23:17:30 -0300 | [diff] [blame] | 31 | #include "cx23888-ir.h" |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 32 | |
| 33 | /* ------------------------------------------------------------------ */ |
| 34 | /* board config info */ |
| 35 | |
| 36 | struct cx23885_board cx23885_boards[] = { |
| 37 | [CX23885_BOARD_UNKNOWN] = { |
| 38 | .name = "UNKNOWN/GENERIC", |
Steven Toth | c771261 | 2008-01-10 02:24:27 -0300 | [diff] [blame] | 39 | /* Ensure safe default for unknown boards */ |
| 40 | .clk_freq = 0, |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 41 | .input = {{ |
| 42 | .type = CX23885_VMUX_COMPOSITE1, |
| 43 | .vmux = 0, |
Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 44 | }, { |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 45 | .type = CX23885_VMUX_COMPOSITE2, |
| 46 | .vmux = 1, |
Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 47 | }, { |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 48 | .type = CX23885_VMUX_COMPOSITE3, |
| 49 | .vmux = 2, |
Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 50 | }, { |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 51 | .type = CX23885_VMUX_COMPOSITE4, |
| 52 | .vmux = 3, |
Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 53 | } }, |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 54 | }, |
| 55 | [CX23885_BOARD_HAUPPAUGE_HVR1800lp] = { |
| 56 | .name = "Hauppauge WinTV-HVR1800lp", |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 57 | .portc = CX23885_MPEG_DVB, |
| 58 | .input = {{ |
| 59 | .type = CX23885_VMUX_TELEVISION, |
| 60 | .vmux = 0, |
| 61 | .gpio0 = 0xff00, |
Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 62 | }, { |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 63 | .type = CX23885_VMUX_DEBUG, |
| 64 | .vmux = 0, |
| 65 | .gpio0 = 0xff01, |
Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 66 | }, { |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 67 | .type = CX23885_VMUX_COMPOSITE1, |
| 68 | .vmux = 1, |
| 69 | .gpio0 = 0xff02, |
Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 70 | }, { |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 71 | .type = CX23885_VMUX_SVIDEO, |
| 72 | .vmux = 2, |
| 73 | .gpio0 = 0xff02, |
Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 74 | } }, |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 75 | }, |
| 76 | [CX23885_BOARD_HAUPPAUGE_HVR1800] = { |
| 77 | .name = "Hauppauge WinTV-HVR1800", |
Steven Toth | 7b88801 | 2008-01-10 03:40:49 -0300 | [diff] [blame] | 78 | .porta = CX23885_ANALOG_VIDEO, |
Steven Toth | a589b66 | 2008-01-13 23:44:47 -0300 | [diff] [blame] | 79 | .portb = CX23885_MPEG_ENCODER, |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 80 | .portc = CX23885_MPEG_DVB, |
Steven Toth | 7b88801 | 2008-01-10 03:40:49 -0300 | [diff] [blame] | 81 | .tuner_type = TUNER_PHILIPS_TDA8290, |
| 82 | .tuner_addr = 0x42, /* 0x84 >> 1 */ |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 83 | .input = {{ |
| 84 | .type = CX23885_VMUX_TELEVISION, |
Steven Toth | 7b88801 | 2008-01-10 03:40:49 -0300 | [diff] [blame] | 85 | .vmux = CX25840_VIN7_CH3 | |
| 86 | CX25840_VIN5_CH2 | |
| 87 | CX25840_VIN2_CH1, |
| 88 | .gpio0 = 0, |
Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 89 | }, { |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 90 | .type = CX23885_VMUX_COMPOSITE1, |
Steven Toth | 7b88801 | 2008-01-10 03:40:49 -0300 | [diff] [blame] | 91 | .vmux = CX25840_VIN7_CH3 | |
| 92 | CX25840_VIN4_CH2 | |
| 93 | CX25840_VIN6_CH1, |
| 94 | .gpio0 = 0, |
Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 95 | }, { |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 96 | .type = CX23885_VMUX_SVIDEO, |
Steven Toth | 7b88801 | 2008-01-10 03:40:49 -0300 | [diff] [blame] | 97 | .vmux = CX25840_VIN7_CH3 | |
| 98 | CX25840_VIN4_CH2 | |
| 99 | CX25840_VIN8_CH1 | |
| 100 | CX25840_SVIDEO_ON, |
| 101 | .gpio0 = 0, |
Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 102 | } }, |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 103 | }, |
Steven Toth | a77743b | 2007-08-22 21:01:20 -0300 | [diff] [blame] | 104 | [CX23885_BOARD_HAUPPAUGE_HVR1250] = { |
| 105 | .name = "Hauppauge WinTV-HVR1250", |
| 106 | .portc = CX23885_MPEG_DVB, |
| 107 | .input = {{ |
| 108 | .type = CX23885_VMUX_TELEVISION, |
| 109 | .vmux = 0, |
| 110 | .gpio0 = 0xff00, |
Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 111 | }, { |
Steven Toth | a77743b | 2007-08-22 21:01:20 -0300 | [diff] [blame] | 112 | .type = CX23885_VMUX_DEBUG, |
| 113 | .vmux = 0, |
| 114 | .gpio0 = 0xff01, |
Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 115 | }, { |
Steven Toth | a77743b | 2007-08-22 21:01:20 -0300 | [diff] [blame] | 116 | .type = CX23885_VMUX_COMPOSITE1, |
| 117 | .vmux = 1, |
| 118 | .gpio0 = 0xff02, |
Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 119 | }, { |
Steven Toth | a77743b | 2007-08-22 21:01:20 -0300 | [diff] [blame] | 120 | .type = CX23885_VMUX_SVIDEO, |
| 121 | .vmux = 2, |
| 122 | .gpio0 = 0xff02, |
Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 123 | } }, |
Steven Toth | a77743b | 2007-08-22 21:01:20 -0300 | [diff] [blame] | 124 | }, |
Michael Krufky | 9bc37ca | 2007-09-08 15:17:13 -0300 | [diff] [blame] | 125 | [CX23885_BOARD_DVICO_FUSIONHDTV_5_EXP] = { |
| 126 | .name = "DViCO FusionHDTV5 Express", |
Steven Toth | a6a3f14 | 2007-09-08 21:31:56 -0300 | [diff] [blame] | 127 | .portb = CX23885_MPEG_DVB, |
Michael Krufky | 9bc37ca | 2007-09-08 15:17:13 -0300 | [diff] [blame] | 128 | }, |
Steven Toth | d1987d5 | 2007-12-18 01:57:06 -0300 | [diff] [blame] | 129 | [CX23885_BOARD_HAUPPAUGE_HVR1500Q] = { |
| 130 | .name = "Hauppauge WinTV-HVR1500Q", |
| 131 | .portc = CX23885_MPEG_DVB, |
| 132 | }, |
Michael Krufky | 07b4a83 | 2007-12-18 01:09:11 -0300 | [diff] [blame] | 133 | [CX23885_BOARD_HAUPPAUGE_HVR1500] = { |
| 134 | .name = "Hauppauge WinTV-HVR1500", |
| 135 | .portc = CX23885_MPEG_DVB, |
| 136 | }, |
Steven Toth | b3ea016 | 2008-04-19 01:14:19 -0300 | [diff] [blame] | 137 | [CX23885_BOARD_HAUPPAUGE_HVR1200] = { |
| 138 | .name = "Hauppauge WinTV-HVR1200", |
| 139 | .portc = CX23885_MPEG_DVB, |
| 140 | }, |
Steven Toth | a780a31 | 2008-04-19 01:25:52 -0300 | [diff] [blame] | 141 | [CX23885_BOARD_HAUPPAUGE_HVR1700] = { |
| 142 | .name = "Hauppauge WinTV-HVR1700", |
| 143 | .portc = CX23885_MPEG_DVB, |
| 144 | }, |
Steven Toth | 6676237 | 2008-04-22 15:38:26 -0300 | [diff] [blame] | 145 | [CX23885_BOARD_HAUPPAUGE_HVR1400] = { |
| 146 | .name = "Hauppauge WinTV-HVR1400", |
| 147 | .portc = CX23885_MPEG_DVB, |
| 148 | }, |
Michael Krufky | 335377b | 2008-05-07 01:43:10 -0300 | [diff] [blame] | 149 | [CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP] = { |
| 150 | .name = "DViCO FusionHDTV7 Dual Express", |
Steven Toth | aaadeac | 2008-06-30 20:58:38 -0300 | [diff] [blame] | 151 | .portb = CX23885_MPEG_DVB, |
Michael Krufky | 335377b | 2008-05-07 01:43:10 -0300 | [diff] [blame] | 152 | .portc = CX23885_MPEG_DVB, |
| 153 | }, |
Steven Toth | aef2d18 | 2008-08-04 21:39:53 -0300 | [diff] [blame] | 154 | [CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP] = { |
| 155 | .name = "DViCO FusionHDTV DVB-T Dual Express", |
| 156 | .portb = CX23885_MPEG_DVB, |
| 157 | .portc = CX23885_MPEG_DVB, |
| 158 | }, |
Steven Toth | 4c56b04 | 2008-08-12 13:30:03 -0300 | [diff] [blame] | 159 | [CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H] = { |
| 160 | .name = "Leadtek Winfast PxDVR3200 H", |
| 161 | .portc = CX23885_MPEG_DVB, |
| 162 | }, |
Igor M. Liplianin | 9bb1b7e | 2008-11-23 14:11:16 -0300 | [diff] [blame] | 163 | [CX23885_BOARD_COMPRO_VIDEOMATE_E650F] = { |
| 164 | .name = "Compro VideoMate E650F", |
| 165 | .portc = CX23885_MPEG_DVB, |
| 166 | }, |
Igor M. Liplianin | 96318d0 | 2009-01-17 12:11:20 -0300 | [diff] [blame] | 167 | [CX23885_BOARD_TBS_6920] = { |
| 168 | .name = "TurboSight TBS 6920", |
| 169 | .portb = CX23885_MPEG_DVB, |
| 170 | }, |
Igor M. Liplianin | 579943f | 2009-01-17 12:18:26 -0300 | [diff] [blame] | 171 | [CX23885_BOARD_TEVII_S470] = { |
| 172 | .name = "TeVii S470", |
| 173 | .portb = CX23885_MPEG_DVB, |
| 174 | }, |
Igor M. Liplianin | c9b8b04 | 2009-01-17 12:23:31 -0300 | [diff] [blame] | 175 | [CX23885_BOARD_DVBWORLD_2005] = { |
| 176 | .name = "DVBWorld DVB-S2 2005", |
| 177 | .portb = CX23885_MPEG_DVB, |
| 178 | }, |
Igor M. Liplianin | 5a23b07 | 2009-03-03 12:06:09 -0300 | [diff] [blame] | 179 | [CX23885_BOARD_NETUP_DUAL_DVBS2_CI] = { |
| 180 | .cimax = 1, |
| 181 | .name = "NetUP Dual DVB-S2 CI", |
| 182 | .portb = CX23885_MPEG_DVB, |
| 183 | .portc = CX23885_MPEG_DVB, |
| 184 | }, |
Steven Toth | 2074dff | 2009-05-02 11:39:46 -0300 | [diff] [blame] | 185 | [CX23885_BOARD_HAUPPAUGE_HVR1270] = { |
| 186 | .name = "Hauppauge WinTV-HVR1270", |
Michael Krufky | a5dbf45 | 2009-05-03 23:27:02 -0300 | [diff] [blame] | 187 | .portc = CX23885_MPEG_DVB, |
Steven Toth | 2074dff | 2009-05-02 11:39:46 -0300 | [diff] [blame] | 188 | }, |
Michael Krufky | d099bec | 2009-05-08 22:39:24 -0300 | [diff] [blame] | 189 | [CX23885_BOARD_HAUPPAUGE_HVR1275] = { |
| 190 | .name = "Hauppauge WinTV-HVR1275", |
| 191 | .portc = CX23885_MPEG_DVB, |
| 192 | }, |
Michael Krufky | 19bc579 | 2009-05-08 16:05:29 -0300 | [diff] [blame] | 193 | [CX23885_BOARD_HAUPPAUGE_HVR1255] = { |
| 194 | .name = "Hauppauge WinTV-HVR1255", |
| 195 | .portc = CX23885_MPEG_DVB, |
| 196 | }, |
Michael Krufky | 6b926ec | 2009-05-12 17:32:17 -0300 | [diff] [blame] | 197 | [CX23885_BOARD_HAUPPAUGE_HVR1210] = { |
| 198 | .name = "Hauppauge WinTV-HVR1210", |
| 199 | .portc = CX23885_MPEG_DVB, |
| 200 | }, |
David Wong | 493b712 | 2009-05-18 05:25:49 -0300 | [diff] [blame] | 201 | [CX23885_BOARD_MYGICA_X8506] = { |
| 202 | .name = "Mygica X8506 DMB-TH", |
David T.L. Wong | bc1548a | 2009-10-21 11:09:28 -0300 | [diff] [blame] | 203 | .tuner_type = TUNER_ABSENT, |
| 204 | .porta = CX23885_ANALOG_VIDEO, |
David Wong | 493b712 | 2009-05-18 05:25:49 -0300 | [diff] [blame] | 205 | .portb = CX23885_MPEG_DVB, |
David T.L. Wong | bc1548a | 2009-10-21 11:09:28 -0300 | [diff] [blame] | 206 | .input = { |
| 207 | { |
| 208 | .type = CX23885_VMUX_COMPOSITE1, |
| 209 | .vmux = CX25840_COMPOSITE8, |
| 210 | }, |
| 211 | { |
| 212 | .type = CX23885_VMUX_SVIDEO, |
| 213 | .vmux = CX25840_SVIDEO_LUMA3 | |
| 214 | CX25840_SVIDEO_CHROMA4, |
| 215 | }, |
| 216 | { |
| 217 | .type = CX23885_VMUX_COMPONENT, |
| 218 | .vmux = CX25840_COMPONENT_ON | |
| 219 | CX25840_VIN1_CH1 | |
| 220 | CX25840_VIN6_CH2 | |
| 221 | CX25840_VIN7_CH3, |
| 222 | }, |
| 223 | }, |
David Wong | 493b712 | 2009-05-18 05:25:49 -0300 | [diff] [blame] | 224 | }, |
David Wong | 2365b2d | 2009-06-17 01:38:12 -0300 | [diff] [blame] | 225 | [CX23885_BOARD_MAGICPRO_PROHDTVE2] = { |
| 226 | .name = "Magic-Pro ProHDTV Extreme 2", |
David T.L. Wong | bc1548a | 2009-10-21 11:09:28 -0300 | [diff] [blame] | 227 | .tuner_type = TUNER_ABSENT, |
| 228 | .porta = CX23885_ANALOG_VIDEO, |
David Wong | 2365b2d | 2009-06-17 01:38:12 -0300 | [diff] [blame] | 229 | .portb = CX23885_MPEG_DVB, |
David T.L. Wong | bc1548a | 2009-10-21 11:09:28 -0300 | [diff] [blame] | 230 | .input = { |
| 231 | { |
| 232 | .type = CX23885_VMUX_COMPOSITE1, |
| 233 | .vmux = CX25840_COMPOSITE8, |
| 234 | }, |
| 235 | { |
| 236 | .type = CX23885_VMUX_SVIDEO, |
| 237 | .vmux = CX25840_SVIDEO_LUMA3 | |
| 238 | CX25840_SVIDEO_CHROMA4, |
| 239 | }, |
| 240 | { |
| 241 | .type = CX23885_VMUX_COMPONENT, |
| 242 | .vmux = CX25840_COMPONENT_ON | |
| 243 | CX25840_VIN1_CH1 | |
| 244 | CX25840_VIN6_CH2 | |
| 245 | CX25840_VIN7_CH3, |
| 246 | }, |
| 247 | }, |
David Wong | 2365b2d | 2009-06-17 01:38:12 -0300 | [diff] [blame] | 248 | }, |
Steven Toth | 13697380 | 2009-07-20 15:37:25 -0300 | [diff] [blame] | 249 | [CX23885_BOARD_HAUPPAUGE_HVR1850] = { |
| 250 | .name = "Hauppauge WinTV-HVR1850", |
| 251 | .portb = CX23885_MPEG_ENCODER, |
| 252 | .portc = CX23885_MPEG_DVB, |
| 253 | }, |
Vladimir Geroy | 34e383d | 2009-09-18 18:55:47 -0300 | [diff] [blame] | 254 | [CX23885_BOARD_COMPRO_VIDEOMATE_E800] = { |
| 255 | .name = "Compro VideoMate E800", |
| 256 | .portc = CX23885_MPEG_DVB, |
| 257 | }, |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 258 | }; |
| 259 | const unsigned int cx23885_bcount = ARRAY_SIZE(cx23885_boards); |
| 260 | |
| 261 | /* ------------------------------------------------------------------ */ |
| 262 | /* PCI subsystem IDs */ |
| 263 | |
| 264 | struct cx23885_subid cx23885_subids[] = { |
| 265 | { |
| 266 | .subvendor = 0x0070, |
| 267 | .subdevice = 0x3400, |
| 268 | .card = CX23885_BOARD_UNKNOWN, |
Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 269 | }, { |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 270 | .subvendor = 0x0070, |
| 271 | .subdevice = 0x7600, |
| 272 | .card = CX23885_BOARD_HAUPPAUGE_HVR1800lp, |
Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 273 | }, { |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 274 | .subvendor = 0x0070, |
| 275 | .subdevice = 0x7800, |
| 276 | .card = CX23885_BOARD_HAUPPAUGE_HVR1800, |
Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 277 | }, { |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 278 | .subvendor = 0x0070, |
| 279 | .subdevice = 0x7801, |
| 280 | .card = CX23885_BOARD_HAUPPAUGE_HVR1800, |
Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 281 | }, { |
Steven Toth | a77743b | 2007-08-22 21:01:20 -0300 | [diff] [blame] | 282 | .subvendor = 0x0070, |
Michael Krufky | 6ccb8cf | 2007-12-27 21:46:34 -0300 | [diff] [blame] | 283 | .subdevice = 0x7809, |
| 284 | .card = CX23885_BOARD_HAUPPAUGE_HVR1800, |
Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 285 | }, { |
Michael Krufky | 6ccb8cf | 2007-12-27 21:46:34 -0300 | [diff] [blame] | 286 | .subvendor = 0x0070, |
Steven Toth | a77743b | 2007-08-22 21:01:20 -0300 | [diff] [blame] | 287 | .subdevice = 0x7911, |
| 288 | .card = CX23885_BOARD_HAUPPAUGE_HVR1250, |
Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 289 | }, { |
Michael Krufky | 9bc37ca | 2007-09-08 15:17:13 -0300 | [diff] [blame] | 290 | .subvendor = 0x18ac, |
| 291 | .subdevice = 0xd500, |
| 292 | .card = CX23885_BOARD_DVICO_FUSIONHDTV_5_EXP, |
Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 293 | }, { |
Steven Toth | d1987d5 | 2007-12-18 01:57:06 -0300 | [diff] [blame] | 294 | .subvendor = 0x0070, |
Michael Krufky | b00fff0 | 2007-12-27 22:19:31 -0300 | [diff] [blame] | 295 | .subdevice = 0x7790, |
| 296 | .card = CX23885_BOARD_HAUPPAUGE_HVR1500Q, |
Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 297 | }, { |
Michael Krufky | b00fff0 | 2007-12-27 22:19:31 -0300 | [diff] [blame] | 298 | .subvendor = 0x0070, |
Steven Toth | d1987d5 | 2007-12-18 01:57:06 -0300 | [diff] [blame] | 299 | .subdevice = 0x7797, |
| 300 | .card = CX23885_BOARD_HAUPPAUGE_HVR1500Q, |
Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 301 | }, { |
Michael Krufky | 07b4a83 | 2007-12-18 01:09:11 -0300 | [diff] [blame] | 302 | .subvendor = 0x0070, |
Michael Krufky | b00fff0 | 2007-12-27 22:19:31 -0300 | [diff] [blame] | 303 | .subdevice = 0x7710, |
| 304 | .card = CX23885_BOARD_HAUPPAUGE_HVR1500, |
Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 305 | }, { |
Michael Krufky | b00fff0 | 2007-12-27 22:19:31 -0300 | [diff] [blame] | 306 | .subvendor = 0x0070, |
Michael Krufky | 07b4a83 | 2007-12-18 01:09:11 -0300 | [diff] [blame] | 307 | .subdevice = 0x7717, |
| 308 | .card = CX23885_BOARD_HAUPPAUGE_HVR1500, |
Steven Toth | b3ea016 | 2008-04-19 01:14:19 -0300 | [diff] [blame] | 309 | }, { |
| 310 | .subvendor = 0x0070, |
| 311 | .subdevice = 0x71d1, |
| 312 | .card = CX23885_BOARD_HAUPPAUGE_HVR1200, |
Steven Toth | a780a31 | 2008-04-19 01:25:52 -0300 | [diff] [blame] | 313 | }, { |
| 314 | .subvendor = 0x0070, |
Michael Krufky | 3c3852c | 2008-05-02 16:12:44 -0300 | [diff] [blame] | 315 | .subdevice = 0x71d3, |
| 316 | .card = CX23885_BOARD_HAUPPAUGE_HVR1200, |
| 317 | }, { |
| 318 | .subvendor = 0x0070, |
Steven Toth | a780a31 | 2008-04-19 01:25:52 -0300 | [diff] [blame] | 319 | .subdevice = 0x8101, |
| 320 | .card = CX23885_BOARD_HAUPPAUGE_HVR1700, |
Steven Toth | 6676237 | 2008-04-22 15:38:26 -0300 | [diff] [blame] | 321 | }, { |
| 322 | .subvendor = 0x0070, |
| 323 | .subdevice = 0x8010, |
| 324 | .card = CX23885_BOARD_HAUPPAUGE_HVR1400, |
Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 325 | }, { |
Michael Krufky | 335377b | 2008-05-07 01:43:10 -0300 | [diff] [blame] | 326 | .subvendor = 0x18ac, |
| 327 | .subdevice = 0xd618, |
| 328 | .card = CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP, |
Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 329 | }, { |
Steven Toth | aef2d18 | 2008-08-04 21:39:53 -0300 | [diff] [blame] | 330 | .subvendor = 0x18ac, |
| 331 | .subdevice = 0xdb78, |
| 332 | .card = CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP, |
Steven Toth | 4c56b04 | 2008-08-12 13:30:03 -0300 | [diff] [blame] | 333 | }, { |
| 334 | .subvendor = 0x107d, |
| 335 | .subdevice = 0x6681, |
| 336 | .card = CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H, |
Igor M. Liplianin | 9bb1b7e | 2008-11-23 14:11:16 -0300 | [diff] [blame] | 337 | }, { |
| 338 | .subvendor = 0x185b, |
| 339 | .subdevice = 0xe800, |
| 340 | .card = CX23885_BOARD_COMPRO_VIDEOMATE_E650F, |
Igor M. Liplianin | 96318d0 | 2009-01-17 12:11:20 -0300 | [diff] [blame] | 341 | }, { |
| 342 | .subvendor = 0x6920, |
| 343 | .subdevice = 0x8888, |
| 344 | .card = CX23885_BOARD_TBS_6920, |
Igor M. Liplianin | 579943f | 2009-01-17 12:18:26 -0300 | [diff] [blame] | 345 | }, { |
| 346 | .subvendor = 0xd470, |
| 347 | .subdevice = 0x9022, |
| 348 | .card = CX23885_BOARD_TEVII_S470, |
Igor M. Liplianin | c9b8b04 | 2009-01-17 12:23:31 -0300 | [diff] [blame] | 349 | }, { |
| 350 | .subvendor = 0x0001, |
| 351 | .subdevice = 0x2005, |
| 352 | .card = CX23885_BOARD_DVBWORLD_2005, |
Igor M. Liplianin | 5a23b07 | 2009-03-03 12:06:09 -0300 | [diff] [blame] | 353 | }, { |
| 354 | .subvendor = 0x1b55, |
| 355 | .subdevice = 0x2a2c, |
| 356 | .card = CX23885_BOARD_NETUP_DUAL_DVBS2_CI, |
Steven Toth | 2074dff | 2009-05-02 11:39:46 -0300 | [diff] [blame] | 357 | }, { |
| 358 | .subvendor = 0x0070, |
| 359 | .subdevice = 0x2211, |
| 360 | .card = CX23885_BOARD_HAUPPAUGE_HVR1270, |
Michael Krufky | d099bec | 2009-05-08 22:39:24 -0300 | [diff] [blame] | 361 | }, { |
| 362 | .subvendor = 0x0070, |
| 363 | .subdevice = 0x2215, |
| 364 | .card = CX23885_BOARD_HAUPPAUGE_HVR1275, |
Michael Krufky | 19bc579 | 2009-05-08 16:05:29 -0300 | [diff] [blame] | 365 | }, { |
| 366 | .subvendor = 0x0070, |
| 367 | .subdevice = 0x2251, |
| 368 | .card = CX23885_BOARD_HAUPPAUGE_HVR1255, |
Michael Krufky | 6b926ec | 2009-05-12 17:32:17 -0300 | [diff] [blame] | 369 | }, { |
| 370 | .subvendor = 0x0070, |
| 371 | .subdevice = 0x2291, |
| 372 | .card = CX23885_BOARD_HAUPPAUGE_HVR1210, |
| 373 | }, { |
| 374 | .subvendor = 0x0070, |
| 375 | .subdevice = 0x2295, |
| 376 | .card = CX23885_BOARD_HAUPPAUGE_HVR1210, |
David Wong | 493b712 | 2009-05-18 05:25:49 -0300 | [diff] [blame] | 377 | }, { |
| 378 | .subvendor = 0x14f1, |
| 379 | .subdevice = 0x8651, |
| 380 | .card = CX23885_BOARD_MYGICA_X8506, |
David Wong | 2365b2d | 2009-06-17 01:38:12 -0300 | [diff] [blame] | 381 | }, { |
| 382 | .subvendor = 0x14f1, |
| 383 | .subdevice = 0x8657, |
| 384 | .card = CX23885_BOARD_MAGICPRO_PROHDTVE2, |
Steven Toth | 13697380 | 2009-07-20 15:37:25 -0300 | [diff] [blame] | 385 | }, { |
| 386 | .subvendor = 0x0070, |
| 387 | .subdevice = 0x8541, |
| 388 | .card = CX23885_BOARD_HAUPPAUGE_HVR1850, |
Vladimir Geroy | 34e383d | 2009-09-18 18:55:47 -0300 | [diff] [blame] | 389 | }, { |
| 390 | .subvendor = 0x1858, |
| 391 | .subdevice = 0xe800, |
| 392 | .card = CX23885_BOARD_COMPRO_VIDEOMATE_E800, |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 393 | }, |
| 394 | }; |
| 395 | const unsigned int cx23885_idcount = ARRAY_SIZE(cx23885_subids); |
| 396 | |
| 397 | void cx23885_card_list(struct cx23885_dev *dev) |
| 398 | { |
| 399 | int i; |
| 400 | |
| 401 | if (0 == dev->pci->subsystem_vendor && |
| 402 | 0 == dev->pci->subsystem_device) { |
Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 403 | printk(KERN_INFO |
| 404 | "%s: Board has no valid PCIe Subsystem ID and can't\n" |
| 405 | "%s: be autodetected. Pass card=<n> insmod option\n" |
| 406 | "%s: to workaround that. Redirect complaints to the\n" |
| 407 | "%s: vendor of the TV card. Best regards,\n" |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 408 | "%s: -- tux\n", |
| 409 | dev->name, dev->name, dev->name, dev->name, dev->name); |
| 410 | } else { |
Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 411 | printk(KERN_INFO |
| 412 | "%s: Your board isn't known (yet) to the driver.\n" |
| 413 | "%s: Try to pick one of the existing card configs via\n" |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 414 | "%s: card=<n> insmod option. Updating to the latest\n" |
| 415 | "%s: version might help as well.\n", |
| 416 | dev->name, dev->name, dev->name, dev->name); |
| 417 | } |
Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 418 | 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] | 419 | dev->name); |
| 420 | for (i = 0; i < cx23885_bcount; i++) |
Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 421 | printk(KERN_INFO "%s: card=%d -> %s\n", |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 422 | dev->name, i, cx23885_boards[i].name); |
| 423 | } |
| 424 | |
| 425 | static void hauppauge_eeprom(struct cx23885_dev *dev, u8 *eeprom_data) |
| 426 | { |
| 427 | struct tveeprom tv; |
| 428 | |
Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 429 | tveeprom_hauppauge_analog(&dev->i2c_bus[0].i2c_client, &tv, |
| 430 | eeprom_data); |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 431 | |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 432 | /* Make sure we support the board model */ |
Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 433 | switch (tv.model) { |
Michael Krufky | 5308cf0 | 2009-05-12 18:37:35 -0300 | [diff] [blame] | 434 | case 22001: |
| 435 | /* WinTV-HVR1270 (PCIe, Retail, half height) |
| 436 | * ATSC/QAM and basic analog, IR Blast */ |
| 437 | case 22009: |
| 438 | /* WinTV-HVR1210 (PCIe, Retail, half height) |
| 439 | * DVB-T and basic analog, IR Blast */ |
| 440 | case 22011: |
| 441 | /* WinTV-HVR1270 (PCIe, Retail, half height) |
| 442 | * ATSC/QAM and basic analog, IR Recv */ |
| 443 | case 22019: |
| 444 | /* WinTV-HVR1210 (PCIe, Retail, half height) |
| 445 | * DVB-T and basic analog, IR Recv */ |
| 446 | case 22021: |
| 447 | /* WinTV-HVR1275 (PCIe, Retail, half height) |
| 448 | * ATSC/QAM and basic analog, IR Recv */ |
| 449 | case 22029: |
| 450 | /* WinTV-HVR1210 (PCIe, Retail, half height) |
| 451 | * DVB-T and basic analog, IR Recv */ |
| 452 | case 22101: |
| 453 | /* WinTV-HVR1270 (PCIe, Retail, full height) |
| 454 | * ATSC/QAM and basic analog, IR Blast */ |
| 455 | case 22109: |
| 456 | /* WinTV-HVR1210 (PCIe, Retail, full height) |
| 457 | * DVB-T and basic analog, IR Blast */ |
| 458 | case 22111: |
| 459 | /* WinTV-HVR1270 (PCIe, Retail, full height) |
| 460 | * ATSC/QAM and basic analog, IR Recv */ |
| 461 | case 22119: |
| 462 | /* WinTV-HVR1210 (PCIe, Retail, full height) |
| 463 | * DVB-T and basic analog, IR Recv */ |
| 464 | case 22121: |
| 465 | /* WinTV-HVR1275 (PCIe, Retail, full height) |
| 466 | * ATSC/QAM and basic analog, IR Recv */ |
| 467 | case 22129: |
| 468 | /* WinTV-HVR1210 (PCIe, Retail, full height) |
| 469 | * DVB-T and basic analog, IR Recv */ |
Michael Krufky | 36396c8 | 2008-05-02 16:14:33 -0300 | [diff] [blame] | 470 | case 71009: |
| 471 | /* WinTV-HVR1200 (PCIe, Retail, full height) |
| 472 | * DVB-T and basic analog */ |
| 473 | case 71359: |
| 474 | /* WinTV-HVR1200 (PCIe, OEM, half height) |
| 475 | * DVB-T and basic analog */ |
| 476 | case 71439: |
| 477 | /* WinTV-HVR1200 (PCIe, OEM, half height) |
| 478 | * DVB-T and basic analog */ |
| 479 | case 71449: |
| 480 | /* WinTV-HVR1200 (PCIe, OEM, full height) |
| 481 | * DVB-T and basic analog */ |
| 482 | case 71939: |
| 483 | /* WinTV-HVR1200 (PCIe, OEM, half height) |
| 484 | * DVB-T and basic analog */ |
| 485 | case 71949: |
| 486 | /* WinTV-HVR1200 (PCIe, OEM, full height) |
| 487 | * DVB-T and basic analog */ |
| 488 | case 71959: |
| 489 | /* WinTV-HVR1200 (PCIe, OEM, full height) |
| 490 | * DVB-T and basic analog */ |
| 491 | case 71979: |
| 492 | /* WinTV-HVR1200 (PCIe, OEM, half height) |
| 493 | * DVB-T and basic analog */ |
| 494 | case 71999: |
| 495 | /* WinTV-HVR1200 (PCIe, OEM, full height) |
| 496 | * DVB-T and basic analog */ |
Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 497 | case 76601: |
| 498 | /* WinTV-HVR1800lp (PCIe, Retail, No IR, Dual |
| 499 | channel ATSC and MPEG2 HW Encoder */ |
| 500 | case 77001: |
| 501 | /* WinTV-HVR1500 (Express Card, OEM, No IR, ATSC |
| 502 | and Basic analog */ |
| 503 | case 77011: |
| 504 | /* WinTV-HVR1500 (Express Card, Retail, No IR, ATSC |
| 505 | and Basic analog */ |
| 506 | case 77041: |
| 507 | /* WinTV-HVR1500Q (Express Card, OEM, No IR, ATSC/QAM |
| 508 | and Basic analog */ |
| 509 | case 77051: |
| 510 | /* WinTV-HVR1500Q (Express Card, Retail, No IR, ATSC/QAM |
| 511 | and Basic analog */ |
| 512 | case 78011: |
| 513 | /* WinTV-HVR1800 (PCIe, Retail, 3.5mm in, IR, No FM, |
| 514 | Dual channel ATSC and MPEG2 HW Encoder */ |
| 515 | case 78501: |
| 516 | /* WinTV-HVR1800 (PCIe, OEM, RCA in, No IR, FM, |
| 517 | Dual channel ATSC and MPEG2 HW Encoder */ |
| 518 | case 78521: |
| 519 | /* WinTV-HVR1800 (PCIe, OEM, RCA in, No IR, FM, |
| 520 | Dual channel ATSC and MPEG2 HW Encoder */ |
| 521 | case 78531: |
| 522 | /* WinTV-HVR1800 (PCIe, OEM, RCA in, No IR, No FM, |
| 523 | Dual channel ATSC and MPEG2 HW Encoder */ |
| 524 | case 78631: |
| 525 | /* WinTV-HVR1800 (PCIe, OEM, No IR, No FM, |
| 526 | Dual channel ATSC and MPEG2 HW Encoder */ |
| 527 | case 79001: |
| 528 | /* WinTV-HVR1250 (PCIe, Retail, IR, full height, |
| 529 | ATSC and Basic analog */ |
| 530 | case 79101: |
| 531 | /* WinTV-HVR1250 (PCIe, Retail, IR, half height, |
| 532 | ATSC and Basic analog */ |
| 533 | case 79561: |
| 534 | /* WinTV-HVR1250 (PCIe, OEM, No IR, half height, |
| 535 | ATSC and Basic analog */ |
| 536 | case 79571: |
| 537 | /* WinTV-HVR1250 (PCIe, OEM, No IR, full height, |
| 538 | ATSC and Basic analog */ |
| 539 | case 79671: |
| 540 | /* WinTV-HVR1250 (PCIe, OEM, No IR, half height, |
| 541 | ATSC and Basic analog */ |
Steven Toth | 6676237 | 2008-04-22 15:38:26 -0300 | [diff] [blame] | 542 | case 80019: |
| 543 | /* WinTV-HVR1400 (Express Card, Retail, IR, |
| 544 | * DVB-T and Basic analog */ |
Michael Krufky | 36396c8 | 2008-05-02 16:14:33 -0300 | [diff] [blame] | 545 | case 81509: |
| 546 | /* WinTV-HVR1700 (PCIe, OEM, No IR, half height) |
| 547 | * DVB-T and MPEG2 HW Encoder */ |
Steven Toth | a780a31 | 2008-04-19 01:25:52 -0300 | [diff] [blame] | 548 | case 81519: |
Michael Krufky | 36396c8 | 2008-05-02 16:14:33 -0300 | [diff] [blame] | 549 | /* WinTV-HVR1700 (PCIe, OEM, No IR, full height) |
Steven Toth | a780a31 | 2008-04-19 01:25:52 -0300 | [diff] [blame] | 550 | * DVB-T and MPEG2 HW Encoder */ |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 551 | break; |
Steven Toth | 13697380 | 2009-07-20 15:37:25 -0300 | [diff] [blame] | 552 | case 85021: |
| 553 | /* WinTV-HVR1850 (PCIe, OEM, RCA in, IR, FM, |
| 554 | Dual channel ATSC and MPEG2 HW Encoder */ |
| 555 | break; |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 556 | default: |
Steven Toth | 13697380 | 2009-07-20 15:37:25 -0300 | [diff] [blame] | 557 | printk(KERN_WARNING "%s: warning: " |
| 558 | "unknown hauppauge model #%d\n", |
Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 559 | dev->name, tv.model); |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 560 | break; |
| 561 | } |
| 562 | |
| 563 | printk(KERN_INFO "%s: hauppauge eeprom: model=%d\n", |
| 564 | dev->name, tv.model); |
| 565 | } |
| 566 | |
Michael Krufky | d7cba04 | 2008-09-12 13:31:45 -0300 | [diff] [blame] | 567 | int cx23885_tuner_callback(void *priv, int component, int command, int arg) |
Steven Toth | 8c70017 | 2008-01-05 16:55:45 -0300 | [diff] [blame] | 568 | { |
Steven Toth | 89ce221 | 2008-08-04 22:18:19 -0300 | [diff] [blame] | 569 | struct cx23885_tsport *port = priv; |
| 570 | struct cx23885_dev *dev = port->dev; |
Steven Toth | 6df5169 | 2008-06-30 22:17:05 -0300 | [diff] [blame] | 571 | u32 bitmask = 0; |
| 572 | |
Steven Toth | 89ce221 | 2008-08-04 22:18:19 -0300 | [diff] [blame] | 573 | if (command == XC2028_RESET_CLK) |
| 574 | return 0; |
| 575 | |
Steven Toth | 6df5169 | 2008-06-30 22:17:05 -0300 | [diff] [blame] | 576 | if (command != 0) { |
| 577 | printk(KERN_ERR "%s(): Unknown command 0x%x.\n", |
| 578 | __func__, command); |
| 579 | return -EINVAL; |
| 580 | } |
Steven Toth | 8c70017 | 2008-01-05 16:55:45 -0300 | [diff] [blame] | 581 | |
Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 582 | switch (dev->board) { |
Steven Toth | 90a71b1 | 2008-08-04 21:38:46 -0300 | [diff] [blame] | 583 | case CX23885_BOARD_HAUPPAUGE_HVR1400: |
| 584 | case CX23885_BOARD_HAUPPAUGE_HVR1500: |
Steven Toth | 8c70017 | 2008-01-05 16:55:45 -0300 | [diff] [blame] | 585 | case CX23885_BOARD_HAUPPAUGE_HVR1500Q: |
Steven Toth | 4c56b04 | 2008-08-12 13:30:03 -0300 | [diff] [blame] | 586 | case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H: |
Igor M. Liplianin | 9bb1b7e | 2008-11-23 14:11:16 -0300 | [diff] [blame] | 587 | case CX23885_BOARD_COMPRO_VIDEOMATE_E650F: |
Vladimir Geroy | 34e383d | 2009-09-18 18:55:47 -0300 | [diff] [blame] | 588 | case CX23885_BOARD_COMPRO_VIDEOMATE_E800: |
Steven Toth | 90a71b1 | 2008-08-04 21:38:46 -0300 | [diff] [blame] | 589 | /* Tuner Reset Command */ |
Steven Toth | 4c56b04 | 2008-08-12 13:30:03 -0300 | [diff] [blame] | 590 | bitmask = 0x04; |
Steven Toth | 6df5169 | 2008-06-30 22:17:05 -0300 | [diff] [blame] | 591 | break; |
| 592 | case CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP: |
Steven Toth | aef2d18 | 2008-08-04 21:39:53 -0300 | [diff] [blame] | 593 | case CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP: |
Steven Toth | 4c56b04 | 2008-08-12 13:30:03 -0300 | [diff] [blame] | 594 | /* Two identical tuners on two different i2c buses, |
| 595 | * we need to reset the correct gpio. */ |
Christopher Pascoe | d4dc673 | 2009-04-27 11:27:04 -0300 | [diff] [blame] | 596 | if (port->nr == 1) |
Steven Toth | 4c56b04 | 2008-08-12 13:30:03 -0300 | [diff] [blame] | 597 | bitmask = 0x01; |
Christopher Pascoe | d4dc673 | 2009-04-27 11:27:04 -0300 | [diff] [blame] | 598 | else if (port->nr == 2) |
Steven Toth | 4c56b04 | 2008-08-12 13:30:03 -0300 | [diff] [blame] | 599 | bitmask = 0x04; |
Steven Toth | 8c70017 | 2008-01-05 16:55:45 -0300 | [diff] [blame] | 600 | break; |
| 601 | } |
| 602 | |
Steven Toth | 6df5169 | 2008-06-30 22:17:05 -0300 | [diff] [blame] | 603 | if (bitmask) { |
| 604 | /* Drive the tuner into reset and back out */ |
| 605 | cx_clear(GP0_IO, bitmask); |
| 606 | mdelay(200); |
| 607 | cx_set(GP0_IO, bitmask); |
| 608 | } |
| 609 | |
| 610 | return 0; |
Steven Toth | 8c70017 | 2008-01-05 16:55:45 -0300 | [diff] [blame] | 611 | } |
Steven Toth | 73c993a | 2008-01-05 17:08:05 -0300 | [diff] [blame] | 612 | |
Steven Toth | a6a3f14 | 2007-09-08 21:31:56 -0300 | [diff] [blame] | 613 | void cx23885_gpio_setup(struct cx23885_dev *dev) |
| 614 | { |
Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 615 | switch (dev->board) { |
Steven Toth | a6a3f14 | 2007-09-08 21:31:56 -0300 | [diff] [blame] | 616 | case CX23885_BOARD_HAUPPAUGE_HVR1250: |
| 617 | /* GPIO-0 cx24227 demodulator reset */ |
| 618 | cx_set(GP0_IO, 0x00010001); /* Bring the part out of reset */ |
| 619 | break; |
Michael Krufky | 07b4a83 | 2007-12-18 01:09:11 -0300 | [diff] [blame] | 620 | case CX23885_BOARD_HAUPPAUGE_HVR1500: |
| 621 | /* GPIO-0 cx24227 demodulator */ |
| 622 | /* GPIO-2 xc3028 tuner */ |
| 623 | |
| 624 | /* Put the parts into reset */ |
| 625 | cx_set(GP0_IO, 0x00050000); |
| 626 | cx_clear(GP0_IO, 0x00000005); |
| 627 | msleep(5); |
| 628 | |
| 629 | /* Bring the parts out of reset */ |
| 630 | cx_set(GP0_IO, 0x00050005); |
| 631 | break; |
Steven Toth | d1987d5 | 2007-12-18 01:57:06 -0300 | [diff] [blame] | 632 | case CX23885_BOARD_HAUPPAUGE_HVR1500Q: |
| 633 | /* GPIO-0 cx24227 demodulator reset */ |
| 634 | /* GPIO-2 xc5000 tuner reset */ |
| 635 | cx_set(GP0_IO, 0x00050005); /* Bring the part out of reset */ |
| 636 | break; |
Steven Toth | a6a3f14 | 2007-09-08 21:31:56 -0300 | [diff] [blame] | 637 | case CX23885_BOARD_HAUPPAUGE_HVR1800: |
| 638 | /* GPIO-0 656_CLK */ |
| 639 | /* GPIO-1 656_D0 */ |
| 640 | /* GPIO-2 8295A Reset */ |
| 641 | /* GPIO-3-10 cx23417 data0-7 */ |
| 642 | /* GPIO-11-14 cx23417 addr0-3 */ |
| 643 | /* GPIO-15-18 cx23417 READY, CS, RD, WR */ |
| 644 | /* GPIO-19 IR_RX */ |
Michael Krufky | 3ba71d2 | 2007-12-07 01:40:36 -0300 | [diff] [blame] | 645 | |
Steven Toth | a589b66 | 2008-01-13 23:44:47 -0300 | [diff] [blame] | 646 | /* CX23417 GPIO's */ |
| 647 | /* EIO15 Zilog Reset */ |
| 648 | /* EIO14 S5H1409/CX24227 Reset */ |
Steven Toth | f659c51 | 2009-06-25 23:43:31 -0300 | [diff] [blame] | 649 | mc417_gpio_enable(dev, GPIO_15 | GPIO_14, 1); |
| 650 | |
| 651 | /* Put the demod into reset and protect the eeprom */ |
| 652 | mc417_gpio_clear(dev, GPIO_15 | GPIO_14); |
| 653 | mdelay(100); |
| 654 | |
| 655 | /* Bring the demod and blaster out of reset */ |
| 656 | mc417_gpio_set(dev, GPIO_15 | GPIO_14); |
| 657 | mdelay(100); |
Steven Toth | a589b66 | 2008-01-13 23:44:47 -0300 | [diff] [blame] | 658 | |
Steven Toth | 5206d6e | 2008-01-10 02:09:27 -0300 | [diff] [blame] | 659 | /* Force the TDA8295A into reset and back */ |
Steven Toth | 21ff3e4 | 2009-06-25 23:50:39 -0300 | [diff] [blame] | 660 | cx23885_gpio_enable(dev, GPIO_2, 1); |
| 661 | cx23885_gpio_set(dev, GPIO_2); |
Steven Toth | 5206d6e | 2008-01-10 02:09:27 -0300 | [diff] [blame] | 662 | mdelay(20); |
Steven Toth | 21ff3e4 | 2009-06-25 23:50:39 -0300 | [diff] [blame] | 663 | cx23885_gpio_clear(dev, GPIO_2); |
Steven Toth | 5206d6e | 2008-01-10 02:09:27 -0300 | [diff] [blame] | 664 | mdelay(20); |
Steven Toth | 21ff3e4 | 2009-06-25 23:50:39 -0300 | [diff] [blame] | 665 | cx23885_gpio_set(dev, GPIO_2); |
Steven Toth | 5206d6e | 2008-01-10 02:09:27 -0300 | [diff] [blame] | 666 | mdelay(20); |
Steven Toth | a6a3f14 | 2007-09-08 21:31:56 -0300 | [diff] [blame] | 667 | break; |
Steven Toth | b3ea016 | 2008-04-19 01:14:19 -0300 | [diff] [blame] | 668 | case CX23885_BOARD_HAUPPAUGE_HVR1200: |
| 669 | /* GPIO-0 tda10048 demodulator reset */ |
| 670 | /* GPIO-2 tda18271 tuner reset */ |
| 671 | |
| 672 | /* Put the parts into reset and back */ |
| 673 | cx_set(GP0_IO, 0x00050000); |
| 674 | mdelay(20); |
| 675 | cx_clear(GP0_IO, 0x00000005); |
| 676 | mdelay(20); |
| 677 | cx_set(GP0_IO, 0x00050005); |
| 678 | break; |
Steven Toth | a780a31 | 2008-04-19 01:25:52 -0300 | [diff] [blame] | 679 | case CX23885_BOARD_HAUPPAUGE_HVR1700: |
| 680 | /* GPIO-0 TDA10048 demodulator reset */ |
| 681 | /* GPIO-2 TDA8295A Reset */ |
| 682 | /* GPIO-3-10 cx23417 data0-7 */ |
| 683 | /* GPIO-11-14 cx23417 addr0-3 */ |
| 684 | /* GPIO-15-18 cx23417 READY, CS, RD, WR */ |
| 685 | |
| 686 | /* The following GPIO's are on the interna AVCore (cx25840) */ |
| 687 | /* GPIO-19 IR_RX */ |
| 688 | /* GPIO-20 IR_TX 416/DVBT Select */ |
| 689 | /* GPIO-21 IIS DAT */ |
| 690 | /* GPIO-22 IIS WCLK */ |
| 691 | /* GPIO-23 IIS BCLK */ |
| 692 | |
| 693 | /* Put the parts into reset and back */ |
| 694 | cx_set(GP0_IO, 0x00050000); |
| 695 | mdelay(20); |
| 696 | cx_clear(GP0_IO, 0x00000005); |
| 697 | mdelay(20); |
| 698 | cx_set(GP0_IO, 0x00050005); |
| 699 | break; |
Steven Toth | 6676237 | 2008-04-22 15:38:26 -0300 | [diff] [blame] | 700 | case CX23885_BOARD_HAUPPAUGE_HVR1400: |
| 701 | /* GPIO-0 Dibcom7000p demodulator reset */ |
| 702 | /* GPIO-2 xc3028L tuner reset */ |
| 703 | /* GPIO-13 LED */ |
| 704 | |
| 705 | /* Put the parts into reset and back */ |
| 706 | cx_set(GP0_IO, 0x00050000); |
| 707 | mdelay(20); |
| 708 | cx_clear(GP0_IO, 0x00000005); |
| 709 | mdelay(20); |
| 710 | cx_set(GP0_IO, 0x00050005); |
| 711 | break; |
Steven Toth | 1ecc5ae | 2008-06-30 21:23:50 -0300 | [diff] [blame] | 712 | case CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP: |
| 713 | /* GPIO-0 xc5000 tuner reset i2c bus 0 */ |
| 714 | /* GPIO-1 s5h1409 demod reset i2c bus 0 */ |
| 715 | /* GPIO-2 xc5000 tuner reset i2c bus 1 */ |
| 716 | /* GPIO-3 s5h1409 demod reset i2c bus 0 */ |
| 717 | |
| 718 | /* Put the parts into reset and back */ |
| 719 | cx_set(GP0_IO, 0x000f0000); |
| 720 | mdelay(20); |
| 721 | cx_clear(GP0_IO, 0x0000000f); |
| 722 | mdelay(20); |
| 723 | cx_set(GP0_IO, 0x000f000f); |
| 724 | break; |
Steven Toth | aef2d18 | 2008-08-04 21:39:53 -0300 | [diff] [blame] | 725 | case CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP: |
| 726 | /* GPIO-0 portb xc3028 reset */ |
| 727 | /* GPIO-1 portb zl10353 reset */ |
| 728 | /* GPIO-2 portc xc3028 reset */ |
| 729 | /* GPIO-3 portc zl10353 reset */ |
| 730 | |
| 731 | /* Put the parts into reset and back */ |
| 732 | cx_set(GP0_IO, 0x000f0000); |
| 733 | mdelay(20); |
| 734 | cx_clear(GP0_IO, 0x0000000f); |
| 735 | mdelay(20); |
| 736 | cx_set(GP0_IO, 0x000f000f); |
| 737 | break; |
Steven Toth | 4c56b04 | 2008-08-12 13:30:03 -0300 | [diff] [blame] | 738 | case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H: |
Igor M. Liplianin | 9bb1b7e | 2008-11-23 14:11:16 -0300 | [diff] [blame] | 739 | case CX23885_BOARD_COMPRO_VIDEOMATE_E650F: |
Vladimir Geroy | 34e383d | 2009-09-18 18:55:47 -0300 | [diff] [blame] | 740 | case CX23885_BOARD_COMPRO_VIDEOMATE_E800: |
Steven Toth | 4c56b04 | 2008-08-12 13:30:03 -0300 | [diff] [blame] | 741 | /* GPIO-2 xc3028 tuner reset */ |
| 742 | |
| 743 | /* The following GPIO's are on the internal AVCore (cx25840) */ |
| 744 | /* GPIO-? zl10353 demod reset */ |
| 745 | |
| 746 | /* Put the parts into reset and back */ |
| 747 | cx_set(GP0_IO, 0x00040000); |
| 748 | mdelay(20); |
| 749 | cx_clear(GP0_IO, 0x00000004); |
| 750 | mdelay(20); |
| 751 | cx_set(GP0_IO, 0x00040004); |
| 752 | break; |
Igor M. Liplianin | 96318d0 | 2009-01-17 12:11:20 -0300 | [diff] [blame] | 753 | case CX23885_BOARD_TBS_6920: |
Igor M. Liplianin | 579943f | 2009-01-17 12:18:26 -0300 | [diff] [blame] | 754 | case CX23885_BOARD_TEVII_S470: |
Igor M. Liplianin | 96318d0 | 2009-01-17 12:11:20 -0300 | [diff] [blame] | 755 | cx_write(MC417_CTL, 0x00000036); |
| 756 | cx_write(MC417_OEN, 0x00001000); |
| 757 | cx_write(MC417_RWD, 0x00001800); |
| 758 | break; |
Igor M. Liplianin | 5a23b07 | 2009-03-03 12:06:09 -0300 | [diff] [blame] | 759 | case CX23885_BOARD_NETUP_DUAL_DVBS2_CI: |
| 760 | /* GPIO-0 INTA from CiMax1 |
| 761 | GPIO-1 INTB from CiMax2 |
| 762 | GPIO-2 reset chips |
| 763 | GPIO-3 to GPIO-10 data/addr for CA |
| 764 | GPIO-11 ~CS0 to CiMax1 |
| 765 | GPIO-12 ~CS1 to CiMax2 |
| 766 | GPIO-13 ADL0 load LSB addr |
| 767 | GPIO-14 ADL1 load MSB addr |
| 768 | GPIO-15 ~RDY from CiMax |
| 769 | GPIO-17 ~RD to CiMax |
| 770 | GPIO-18 ~WR to CiMax |
| 771 | */ |
| 772 | cx_set(GP0_IO, 0x00040000); /* GPIO as out */ |
| 773 | /* GPIO1 and GPIO2 as INTA and INTB from CiMaxes, reset low */ |
| 774 | cx_clear(GP0_IO, 0x00030004); |
| 775 | mdelay(100);/* reset delay */ |
| 776 | cx_set(GP0_IO, 0x00040004); /* GPIO as out, reset high */ |
| 777 | cx_write(MC417_CTL, 0x00000037);/* enable GPIO3-18 pins */ |
| 778 | /* GPIO-15 IN as ~ACK, rest as OUT */ |
| 779 | cx_write(MC417_OEN, 0x00001000); |
| 780 | /* ~RD, ~WR high; ADL0, ADL1 low; ~CS0, ~CS1 high */ |
| 781 | cx_write(MC417_RWD, 0x0000c300); |
| 782 | /* enable irq */ |
| 783 | cx_write(GPIO_ISM, 0x00000000);/* INTERRUPTS active low*/ |
| 784 | break; |
Steven Toth | 2074dff | 2009-05-02 11:39:46 -0300 | [diff] [blame] | 785 | case CX23885_BOARD_HAUPPAUGE_HVR1270: |
Michael Krufky | d099bec | 2009-05-08 22:39:24 -0300 | [diff] [blame] | 786 | case CX23885_BOARD_HAUPPAUGE_HVR1275: |
Michael Krufky | 19bc579 | 2009-05-08 16:05:29 -0300 | [diff] [blame] | 787 | case CX23885_BOARD_HAUPPAUGE_HVR1255: |
Michael Krufky | 6b926ec | 2009-05-12 17:32:17 -0300 | [diff] [blame] | 788 | case CX23885_BOARD_HAUPPAUGE_HVR1210: |
Michael Krufky | d099bec | 2009-05-08 22:39:24 -0300 | [diff] [blame] | 789 | /* GPIO-5 RF Control: 0 = RF1 Terrestrial, 1 = RF2 Cable */ |
Michael Krufky | 6b926ec | 2009-05-12 17:32:17 -0300 | [diff] [blame] | 790 | /* GPIO-6 I2C Gate which can isolate the demod from the bus */ |
| 791 | /* GPIO-9 Demod reset */ |
Steven Toth | 2074dff | 2009-05-02 11:39:46 -0300 | [diff] [blame] | 792 | |
| 793 | /* Put the parts into reset and back */ |
Michael Krufky | d099bec | 2009-05-08 22:39:24 -0300 | [diff] [blame] | 794 | cx23885_gpio_enable(dev, GPIO_9 | GPIO_6 | GPIO_5, 1); |
| 795 | cx23885_gpio_set(dev, GPIO_9 | GPIO_6 | GPIO_5); |
Steven Toth | 2074dff | 2009-05-02 11:39:46 -0300 | [diff] [blame] | 796 | cx23885_gpio_clear(dev, GPIO_9); |
| 797 | mdelay(20); |
| 798 | cx23885_gpio_set(dev, GPIO_9); |
| 799 | break; |
David Wong | 493b712 | 2009-05-18 05:25:49 -0300 | [diff] [blame] | 800 | case CX23885_BOARD_MYGICA_X8506: |
David Wong | 2365b2d | 2009-06-17 01:38:12 -0300 | [diff] [blame] | 801 | case CX23885_BOARD_MAGICPRO_PROHDTVE2: |
David T.L. Wong | 8e069bb | 2009-10-21 12:29:11 -0300 | [diff] [blame^] | 802 | /* GPIO-0 (0)Analog / (1)Digital TV */ |
David Wong | 493b712 | 2009-05-18 05:25:49 -0300 | [diff] [blame] | 803 | /* GPIO-1 reset XC5000 */ |
David Wong | 2365b2d | 2009-06-17 01:38:12 -0300 | [diff] [blame] | 804 | /* GPIO-2 reset LGS8GL5 / LGS8G75 */ |
David T.L. Wong | 8e069bb | 2009-10-21 12:29:11 -0300 | [diff] [blame^] | 805 | cx23885_gpio_enable(dev, GPIO_0 | GPIO_1 | GPIO_2, 1); |
| 806 | cx23885_gpio_clear(dev, GPIO_1 | GPIO_2); |
David Wong | 493b712 | 2009-05-18 05:25:49 -0300 | [diff] [blame] | 807 | mdelay(100); |
David T.L. Wong | 8e069bb | 2009-10-21 12:29:11 -0300 | [diff] [blame^] | 808 | cx23885_gpio_set(dev, GPIO_0 | GPIO_1 | GPIO_2); |
David Wong | 493b712 | 2009-05-18 05:25:49 -0300 | [diff] [blame] | 809 | mdelay(100); |
| 810 | break; |
Steven Toth | 13697380 | 2009-07-20 15:37:25 -0300 | [diff] [blame] | 811 | case CX23885_BOARD_HAUPPAUGE_HVR1850: |
| 812 | /* GPIO-0 656_CLK */ |
| 813 | /* GPIO-1 656_D0 */ |
| 814 | /* GPIO-2 Wake# */ |
| 815 | /* GPIO-3-10 cx23417 data0-7 */ |
| 816 | /* GPIO-11-14 cx23417 addr0-3 */ |
| 817 | /* GPIO-15-18 cx23417 READY, CS, RD, WR */ |
| 818 | /* GPIO-19 IR_RX */ |
| 819 | /* GPIO-20 C_IR_TX */ |
| 820 | /* GPIO-21 I2S DAT */ |
| 821 | /* GPIO-22 I2S WCLK */ |
| 822 | /* GPIO-23 I2S BCLK */ |
| 823 | /* ALT GPIO: EXP GPIO LATCH */ |
| 824 | |
| 825 | /* CX23417 GPIO's */ |
| 826 | /* GPIO-14 S5H1411/CX24228 Reset */ |
| 827 | /* GPIO-13 EEPROM write protect */ |
| 828 | mc417_gpio_enable(dev, GPIO_14 | GPIO_13, 1); |
| 829 | |
| 830 | /* Put the demod into reset and protect the eeprom */ |
| 831 | mc417_gpio_clear(dev, GPIO_14 | GPIO_13); |
| 832 | mdelay(100); |
| 833 | |
| 834 | /* Bring the demod out of reset */ |
| 835 | mc417_gpio_set(dev, GPIO_14); |
| 836 | mdelay(100); |
| 837 | |
| 838 | /* CX24228 GPIO */ |
| 839 | /* Connected to IF / Mux */ |
| 840 | break; |
Steven Toth | a6a3f14 | 2007-09-08 21:31:56 -0300 | [diff] [blame] | 841 | } |
| 842 | } |
| 843 | |
| 844 | int cx23885_ir_init(struct cx23885_dev *dev) |
| 845 | { |
Andy Walls | 29f8a0a | 2009-09-26 23:17:30 -0300 | [diff] [blame] | 846 | int ret = 0; |
Steven Toth | a6a3f14 | 2007-09-08 21:31:56 -0300 | [diff] [blame] | 847 | switch (dev->board) { |
| 848 | case CX23885_BOARD_HAUPPAUGE_HVR1250: |
Michael Krufky | 07b4a83 | 2007-12-18 01:09:11 -0300 | [diff] [blame] | 849 | case CX23885_BOARD_HAUPPAUGE_HVR1500: |
Steven Toth | d1987d5 | 2007-12-18 01:57:06 -0300 | [diff] [blame] | 850 | case CX23885_BOARD_HAUPPAUGE_HVR1500Q: |
Steven Toth | a6a3f14 | 2007-09-08 21:31:56 -0300 | [diff] [blame] | 851 | case CX23885_BOARD_HAUPPAUGE_HVR1800: |
Steven Toth | b3ea016 | 2008-04-19 01:14:19 -0300 | [diff] [blame] | 852 | case CX23885_BOARD_HAUPPAUGE_HVR1200: |
Steven Toth | 6676237 | 2008-04-22 15:38:26 -0300 | [diff] [blame] | 853 | case CX23885_BOARD_HAUPPAUGE_HVR1400: |
Steven Toth | 2074dff | 2009-05-02 11:39:46 -0300 | [diff] [blame] | 854 | case CX23885_BOARD_HAUPPAUGE_HVR1270: |
Michael Krufky | d099bec | 2009-05-08 22:39:24 -0300 | [diff] [blame] | 855 | case CX23885_BOARD_HAUPPAUGE_HVR1275: |
Michael Krufky | 19bc579 | 2009-05-08 16:05:29 -0300 | [diff] [blame] | 856 | case CX23885_BOARD_HAUPPAUGE_HVR1255: |
Michael Krufky | 6b926ec | 2009-05-12 17:32:17 -0300 | [diff] [blame] | 857 | case CX23885_BOARD_HAUPPAUGE_HVR1210: |
Steven Toth | a6a3f14 | 2007-09-08 21:31:56 -0300 | [diff] [blame] | 858 | /* FIXME: Implement me */ |
| 859 | break; |
Andy Walls | 29f8a0a | 2009-09-26 23:17:30 -0300 | [diff] [blame] | 860 | case CX23885_BOARD_HAUPPAUGE_HVR1850: |
| 861 | ret = cx23888_ir_probe(dev); |
| 862 | if (ret) |
| 863 | break; |
| 864 | dev->sd_ir = cx23885_find_hw(dev, CX23885_HW_888_IR); |
Andy Walls | f59ad61 | 2009-09-27 19:51:50 -0300 | [diff] [blame] | 865 | dev->pci_irqmask |= PCI_MSK_IR; |
Andy Walls | 29f8a0a | 2009-09-26 23:17:30 -0300 | [diff] [blame] | 866 | break; |
Steven Toth | 1288687 | 2008-08-04 21:41:06 -0300 | [diff] [blame] | 867 | case CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP: |
| 868 | request_module("ir-kbd-i2c"); |
| 869 | break; |
Steven Toth | a6a3f14 | 2007-09-08 21:31:56 -0300 | [diff] [blame] | 870 | } |
| 871 | |
Andy Walls | 29f8a0a | 2009-09-26 23:17:30 -0300 | [diff] [blame] | 872 | return ret; |
Steven Toth | a6a3f14 | 2007-09-08 21:31:56 -0300 | [diff] [blame] | 873 | } |
| 874 | |
Andy Walls | f59ad61 | 2009-09-27 19:51:50 -0300 | [diff] [blame] | 875 | void cx23885_ir_fini(struct cx23885_dev *dev) |
| 876 | { |
| 877 | switch (dev->board) { |
| 878 | case CX23885_BOARD_HAUPPAUGE_HVR1850: |
| 879 | dev->pci_irqmask &= ~PCI_MSK_IR; |
| 880 | cx_clear(PCI_INT_MSK, PCI_MSK_IR); |
| 881 | cx23888_ir_remove(dev); |
| 882 | dev->sd_ir = NULL; |
| 883 | break; |
| 884 | } |
| 885 | } |
| 886 | |
| 887 | void cx23885_ir_pci_int_enable(struct cx23885_dev *dev) |
| 888 | { |
| 889 | switch (dev->board) { |
| 890 | case CX23885_BOARD_HAUPPAUGE_HVR1850: |
| 891 | if (dev->sd_ir && (dev->pci_irqmask & PCI_MSK_IR)) |
| 892 | cx_set(PCI_INT_MSK, PCI_MSK_IR); |
| 893 | break; |
| 894 | } |
| 895 | } |
| 896 | |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 897 | void cx23885_card_setup(struct cx23885_dev *dev) |
| 898 | { |
Steven Toth | a6a3f14 | 2007-09-08 21:31:56 -0300 | [diff] [blame] | 899 | struct cx23885_tsport *ts1 = &dev->ts1; |
| 900 | struct cx23885_tsport *ts2 = &dev->ts2; |
| 901 | |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 902 | static u8 eeprom[256]; |
| 903 | |
| 904 | if (dev->i2c_bus[0].i2c_rc == 0) { |
| 905 | dev->i2c_bus[0].i2c_client.addr = 0xa0 >> 1; |
Michael Krufky | 44a6481 | 2007-03-20 23:00:18 -0300 | [diff] [blame] | 906 | tveeprom_read(&dev->i2c_bus[0].i2c_client, |
| 907 | eeprom, sizeof(eeprom)); |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 908 | } |
| 909 | |
| 910 | switch (dev->board) { |
Steven Toth | a77743b | 2007-08-22 21:01:20 -0300 | [diff] [blame] | 911 | case CX23885_BOARD_HAUPPAUGE_HVR1250: |
Michael Krufky | 07b4a83 | 2007-12-18 01:09:11 -0300 | [diff] [blame] | 912 | case CX23885_BOARD_HAUPPAUGE_HVR1500: |
Steven Toth | d1987d5 | 2007-12-18 01:57:06 -0300 | [diff] [blame] | 913 | case CX23885_BOARD_HAUPPAUGE_HVR1500Q: |
Steven Toth | 6676237 | 2008-04-22 15:38:26 -0300 | [diff] [blame] | 914 | case CX23885_BOARD_HAUPPAUGE_HVR1400: |
Steven Toth | c88133e | 2008-03-29 17:36:09 -0300 | [diff] [blame] | 915 | if (dev->i2c_bus[0].i2c_rc == 0) |
| 916 | hauppauge_eeprom(dev, eeprom+0x80); |
| 917 | break; |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 918 | case CX23885_BOARD_HAUPPAUGE_HVR1800: |
| 919 | case CX23885_BOARD_HAUPPAUGE_HVR1800lp: |
Steven Toth | b3ea016 | 2008-04-19 01:14:19 -0300 | [diff] [blame] | 920 | case CX23885_BOARD_HAUPPAUGE_HVR1200: |
Steven Toth | a780a31 | 2008-04-19 01:25:52 -0300 | [diff] [blame] | 921 | case CX23885_BOARD_HAUPPAUGE_HVR1700: |
Steven Toth | 2074dff | 2009-05-02 11:39:46 -0300 | [diff] [blame] | 922 | case CX23885_BOARD_HAUPPAUGE_HVR1270: |
Michael Krufky | d099bec | 2009-05-08 22:39:24 -0300 | [diff] [blame] | 923 | case CX23885_BOARD_HAUPPAUGE_HVR1275: |
Michael Krufky | 19bc579 | 2009-05-08 16:05:29 -0300 | [diff] [blame] | 924 | case CX23885_BOARD_HAUPPAUGE_HVR1255: |
Michael Krufky | 6b926ec | 2009-05-12 17:32:17 -0300 | [diff] [blame] | 925 | case CX23885_BOARD_HAUPPAUGE_HVR1210: |
Steven Toth | 13697380 | 2009-07-20 15:37:25 -0300 | [diff] [blame] | 926 | case CX23885_BOARD_HAUPPAUGE_HVR1850: |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 927 | if (dev->i2c_bus[0].i2c_rc == 0) |
Steven Toth | c88133e | 2008-03-29 17:36:09 -0300 | [diff] [blame] | 928 | hauppauge_eeprom(dev, eeprom+0xc0); |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 929 | break; |
| 930 | } |
Steven Toth | a6a3f14 | 2007-09-08 21:31:56 -0300 | [diff] [blame] | 931 | |
| 932 | switch (dev->board) { |
Michael Krufky | 335377b | 2008-05-07 01:43:10 -0300 | [diff] [blame] | 933 | case CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP: |
Steven Toth | aef2d18 | 2008-08-04 21:39:53 -0300 | [diff] [blame] | 934 | case CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP: |
Michael Krufky | 335377b | 2008-05-07 01:43:10 -0300 | [diff] [blame] | 935 | ts2->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */ |
| 936 | ts2->ts_clk_en_val = 0x1; /* Enable TS_CLK */ |
| 937 | ts2->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO; |
| 938 | /* break omitted intentionally */ |
Steven Toth | a6a3f14 | 2007-09-08 21:31:56 -0300 | [diff] [blame] | 939 | case CX23885_BOARD_DVICO_FUSIONHDTV_5_EXP: |
| 940 | ts1->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */ |
| 941 | ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */ |
| 942 | ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO; |
| 943 | break; |
Steven Toth | a589b66 | 2008-01-13 23:44:47 -0300 | [diff] [blame] | 944 | case CX23885_BOARD_HAUPPAUGE_HVR1800: |
| 945 | /* Defaults for VID B - Analog encoder */ |
| 946 | /* DREQ_POL, SMODE, PUNC_CLK, MCLK_POL Serial bus + punc clk */ |
| 947 | ts1->gen_ctrl_val = 0x10e; |
| 948 | ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */ |
| 949 | ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO; |
| 950 | |
| 951 | /* APB_TSVALERR_POL (active low)*/ |
| 952 | ts1->vld_misc_val = 0x2000; |
| 953 | ts1->hw_sop_ctrl_val = (0x47 << 16 | 188 << 4 | 0xc); |
| 954 | |
| 955 | /* Defaults for VID C */ |
| 956 | ts2->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */ |
| 957 | ts2->ts_clk_en_val = 0x1; /* Enable TS_CLK */ |
| 958 | ts2->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO; |
| 959 | break; |
Igor M. Liplianin | 579943f | 2009-01-17 12:18:26 -0300 | [diff] [blame] | 960 | case CX23885_BOARD_TEVII_S470: |
Igor M. Liplianin | 96318d0 | 2009-01-17 12:11:20 -0300 | [diff] [blame] | 961 | case CX23885_BOARD_TBS_6920: |
Igor M. Liplianin | c9b8b04 | 2009-01-17 12:23:31 -0300 | [diff] [blame] | 962 | case CX23885_BOARD_DVBWORLD_2005: |
Igor M. Liplianin | 96318d0 | 2009-01-17 12:11:20 -0300 | [diff] [blame] | 963 | ts1->gen_ctrl_val = 0x5; /* Parallel */ |
| 964 | ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */ |
| 965 | ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO; |
| 966 | break; |
Igor M. Liplianin | 5a23b07 | 2009-03-03 12:06:09 -0300 | [diff] [blame] | 967 | case CX23885_BOARD_NETUP_DUAL_DVBS2_CI: |
| 968 | ts1->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */ |
| 969 | ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */ |
| 970 | ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO; |
| 971 | ts2->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */ |
| 972 | ts2->ts_clk_en_val = 0x1; /* Enable TS_CLK */ |
| 973 | ts2->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO; |
| 974 | break; |
David Wong | 493b712 | 2009-05-18 05:25:49 -0300 | [diff] [blame] | 975 | case CX23885_BOARD_MYGICA_X8506: |
David Wong | 2365b2d | 2009-06-17 01:38:12 -0300 | [diff] [blame] | 976 | case CX23885_BOARD_MAGICPRO_PROHDTVE2: |
David Wong | 493b712 | 2009-05-18 05:25:49 -0300 | [diff] [blame] | 977 | ts1->gen_ctrl_val = 0x5; /* Parallel */ |
| 978 | ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */ |
| 979 | ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO; |
| 980 | break; |
Steven Toth | a6a3f14 | 2007-09-08 21:31:56 -0300 | [diff] [blame] | 981 | case CX23885_BOARD_HAUPPAUGE_HVR1250: |
Michael Krufky | 07b4a83 | 2007-12-18 01:09:11 -0300 | [diff] [blame] | 982 | case CX23885_BOARD_HAUPPAUGE_HVR1500: |
Steven Toth | d1987d5 | 2007-12-18 01:57:06 -0300 | [diff] [blame] | 983 | case CX23885_BOARD_HAUPPAUGE_HVR1500Q: |
Steven Toth | a6a3f14 | 2007-09-08 21:31:56 -0300 | [diff] [blame] | 984 | case CX23885_BOARD_HAUPPAUGE_HVR1800lp: |
Steven Toth | b3ea016 | 2008-04-19 01:14:19 -0300 | [diff] [blame] | 985 | case CX23885_BOARD_HAUPPAUGE_HVR1200: |
Steven Toth | a780a31 | 2008-04-19 01:25:52 -0300 | [diff] [blame] | 986 | case CX23885_BOARD_HAUPPAUGE_HVR1700: |
Steven Toth | 6676237 | 2008-04-22 15:38:26 -0300 | [diff] [blame] | 987 | case CX23885_BOARD_HAUPPAUGE_HVR1400: |
Steven Toth | 4c56b04 | 2008-08-12 13:30:03 -0300 | [diff] [blame] | 988 | case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H: |
Igor M. Liplianin | 9bb1b7e | 2008-11-23 14:11:16 -0300 | [diff] [blame] | 989 | case CX23885_BOARD_COMPRO_VIDEOMATE_E650F: |
Steven Toth | 2074dff | 2009-05-02 11:39:46 -0300 | [diff] [blame] | 990 | case CX23885_BOARD_HAUPPAUGE_HVR1270: |
Michael Krufky | d099bec | 2009-05-08 22:39:24 -0300 | [diff] [blame] | 991 | case CX23885_BOARD_HAUPPAUGE_HVR1275: |
Michael Krufky | 19bc579 | 2009-05-08 16:05:29 -0300 | [diff] [blame] | 992 | case CX23885_BOARD_HAUPPAUGE_HVR1255: |
Michael Krufky | 6b926ec | 2009-05-12 17:32:17 -0300 | [diff] [blame] | 993 | case CX23885_BOARD_HAUPPAUGE_HVR1210: |
Steven Toth | 13697380 | 2009-07-20 15:37:25 -0300 | [diff] [blame] | 994 | case CX23885_BOARD_HAUPPAUGE_HVR1850: |
Vladimir Geroy | 34e383d | 2009-09-18 18:55:47 -0300 | [diff] [blame] | 995 | case CX23885_BOARD_COMPRO_VIDEOMATE_E800: |
Steven Toth | a6a3f14 | 2007-09-08 21:31:56 -0300 | [diff] [blame] | 996 | default: |
| 997 | ts2->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */ |
| 998 | ts2->ts_clk_en_val = 0x1; /* Enable TS_CLK */ |
| 999 | ts2->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO; |
| 1000 | } |
| 1001 | |
Steven Toth | ce89cfb | 2008-04-19 01:36:06 -0300 | [diff] [blame] | 1002 | /* Certain boards support analog, or require the avcore to be |
| 1003 | * loaded, ensure this happens. |
| 1004 | */ |
| 1005 | switch (dev->board) { |
| 1006 | case CX23885_BOARD_HAUPPAUGE_HVR1800: |
| 1007 | case CX23885_BOARD_HAUPPAUGE_HVR1800lp: |
| 1008 | case CX23885_BOARD_HAUPPAUGE_HVR1700: |
Steven Toth | 4c56b04 | 2008-08-12 13:30:03 -0300 | [diff] [blame] | 1009 | case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H: |
Igor M. Liplianin | 9bb1b7e | 2008-11-23 14:11:16 -0300 | [diff] [blame] | 1010 | case CX23885_BOARD_COMPRO_VIDEOMATE_E650F: |
Igor M. Liplianin | 5a23b07 | 2009-03-03 12:06:09 -0300 | [diff] [blame] | 1011 | case CX23885_BOARD_NETUP_DUAL_DVBS2_CI: |
Vladimir Geroy | 34e383d | 2009-09-18 18:55:47 -0300 | [diff] [blame] | 1012 | case CX23885_BOARD_COMPRO_VIDEOMATE_E800: |
Andy Walls | c6b7053 | 2009-09-27 00:14:33 -0300 | [diff] [blame] | 1013 | case CX23885_BOARD_HAUPPAUGE_HVR1850: |
David T.L. Wong | bc1548a | 2009-10-21 11:09:28 -0300 | [diff] [blame] | 1014 | case CX23885_BOARD_MYGICA_X8506: |
| 1015 | case CX23885_BOARD_MAGICPRO_PROHDTVE2: |
Hans Verkuil | e6574f2 | 2009-04-01 03:57:53 -0300 | [diff] [blame] | 1016 | dev->sd_cx25840 = v4l2_i2c_new_subdev(&dev->v4l2_dev, |
| 1017 | &dev->i2c_bus[2].i2c_adap, |
Hans Verkuil | 53dacb1 | 2009-08-10 02:49:08 -0300 | [diff] [blame] | 1018 | "cx25840", "cx25840", 0x88 >> 1, NULL); |
Hans Verkuil | cc26b07 | 2009-03-29 19:20:26 -0300 | [diff] [blame] | 1019 | v4l2_subdev_call(dev->sd_cx25840, core, load_fw); |
Steven Toth | ce89cfb | 2008-04-19 01:36:06 -0300 | [diff] [blame] | 1020 | break; |
| 1021 | } |
Igor M. Liplianin | 5a23b07 | 2009-03-03 12:06:09 -0300 | [diff] [blame] | 1022 | |
| 1023 | /* AUX-PLL 27MHz CLK */ |
| 1024 | switch (dev->board) { |
| 1025 | case CX23885_BOARD_NETUP_DUAL_DVBS2_CI: |
| 1026 | netup_initialize(dev); |
| 1027 | break; |
| 1028 | } |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 1029 | } |
| 1030 | |
| 1031 | /* ------------------------------------------------------------------ */ |