akpm@osdl.org | a6c2ba2 | 2005-11-08 21:37:07 -0800 | [diff] [blame] | 1 | /* |
Mauro Carvalho Chehab | 596d92d | 2005-11-08 21:37:24 -0800 | [diff] [blame^] | 2 | em2820-cards.c - driver for Empia EM2800/EM2820/2840 USB video capture devices |
akpm@osdl.org | a6c2ba2 | 2005-11-08 21:37:07 -0800 | [diff] [blame] | 3 | |
| 4 | Copyright (C) 2005 Markus Rechberger <mrechberger@gmail.com> |
| 5 | Ludovico Cavedon <cavedon@sssup.it> |
| 6 | Mauro Carvalho Chehab <mchehab@brturbo.com.br> |
| 7 | |
| 8 | Based on the em2800 driver from Sascha Sommer <saschasommer@freenet.de> |
| 9 | |
| 10 | This program is free software; you can redistribute it and/or modify |
| 11 | it under the terms of the GNU General Public License as published by |
| 12 | the Free Software Foundation; either version 2 of the License, or |
| 13 | (at your option) any later version. |
| 14 | |
| 15 | This program is distributed in the hope that it will be useful, |
| 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | GNU General Public License for more details. |
| 19 | |
| 20 | You should have received a copy of the GNU General Public License |
| 21 | along with this program; if not, write to the Free Software |
| 22 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 23 | */ |
| 24 | |
| 25 | #include <linux/init.h> |
| 26 | #include <linux/module.h> |
| 27 | #include <linux/pci.h> |
| 28 | #include <linux/delay.h> |
| 29 | #include <linux/i2c.h> |
| 30 | #include <linux/usb.h> |
| 31 | #include <media/tuner.h> |
Mauro Carvalho Chehab | 1f6173e | 2005-11-08 21:37:16 -0800 | [diff] [blame] | 32 | #include <media/audiochip.h> |
| 33 | #include <media/tveeprom.h> |
akpm@osdl.org | a6c2ba2 | 2005-11-08 21:37:07 -0800 | [diff] [blame] | 34 | #include "msp3400.h" |
| 35 | |
| 36 | #include "em2820.h" |
| 37 | |
akpm@osdl.org | a6c2ba2 | 2005-11-08 21:37:07 -0800 | [diff] [blame] | 38 | struct em2820_board em2820_boards[] = { |
Mauro Carvalho Chehab | 596d92d | 2005-11-08 21:37:24 -0800 | [diff] [blame^] | 39 | [EM2800_BOARD_UNKNOWN] = { |
| 40 | .name = "Unknown EM2800 video grabber", |
| 41 | .is_em2800 = 1, |
| 42 | .vchannels = 2, |
| 43 | .norm = VIDEO_MODE_PAL, |
| 44 | .tda9887_conf = TDA9887_PRESENT, |
| 45 | .has_tuner = 1, |
| 46 | .decoder = EM2820_SAA7113, |
| 47 | .input = {{ |
| 48 | .type = EM2820_VMUX_COMPOSITE1, |
| 49 | .vmux = 0, |
| 50 | .amux = 1, |
| 51 | },{ |
| 52 | .type = EM2820_VMUX_SVIDEO, |
| 53 | .vmux = 9, |
| 54 | .amux = 1, |
| 55 | }}, |
| 56 | }, |
| 57 | [EM2820_BOARD_UNKNOWN] = { |
| 58 | .name = "Unknown EM2820/2840 video grabber", |
| 59 | .is_em2800 = 0, |
| 60 | .vchannels = 2, |
| 61 | .norm = VIDEO_MODE_PAL, |
| 62 | .tda9887_conf = TDA9887_PRESENT, |
| 63 | .has_tuner = 1, |
| 64 | .decoder = EM2820_SAA7113, |
| 65 | .input = {{ |
| 66 | .type = EM2820_VMUX_COMPOSITE1, |
| 67 | .vmux = 0, |
| 68 | .amux = 1, |
| 69 | },{ |
| 70 | .type = EM2820_VMUX_SVIDEO, |
| 71 | .vmux = 9, |
| 72 | .amux = 1, |
| 73 | }}, |
| 74 | }, |
akpm@osdl.org | a6c2ba2 | 2005-11-08 21:37:07 -0800 | [diff] [blame] | 75 | [EM2820_BOARD_TERRATEC_CINERGY_250] = { |
| 76 | .name = "Terratec Cinergy 250 USB", |
| 77 | .vchannels = 3, |
| 78 | .norm = VIDEO_MODE_PAL, |
| 79 | .tuner_type = TUNER_LG_PAL_NEW_TAPC, |
| 80 | .tda9887_conf = TDA9887_PRESENT, |
| 81 | .has_tuner = 1, |
| 82 | .decoder = EM2820_SAA7113, |
| 83 | .input = {{ |
| 84 | .type = EM2820_VMUX_TELEVISION, |
| 85 | .vmux = 2, |
| 86 | .amux = 0, |
| 87 | },{ |
| 88 | .type = EM2820_VMUX_COMPOSITE1, |
| 89 | .vmux = 0, |
| 90 | .amux = 1, |
| 91 | },{ |
| 92 | .type = EM2820_VMUX_SVIDEO, |
| 93 | .vmux = 9, |
| 94 | .amux = 1, |
| 95 | }}, |
| 96 | }, |
| 97 | [EM2820_BOARD_PINNACLE_USB_2] = { |
| 98 | .name = "Pinnacle PCTV USB 2", |
| 99 | .vchannels = 3, |
| 100 | .norm = VIDEO_MODE_PAL, |
| 101 | .tuner_type = TUNER_LG_PAL_NEW_TAPC, |
| 102 | .tda9887_conf = TDA9887_PRESENT, |
| 103 | .has_tuner = 1, |
| 104 | .decoder = EM2820_SAA7113, |
| 105 | .input = {{ |
| 106 | .type = EM2820_VMUX_TELEVISION, |
| 107 | .vmux = 2, |
| 108 | .amux = 0, |
| 109 | },{ |
| 110 | .type = EM2820_VMUX_COMPOSITE1, |
| 111 | .vmux = 0, |
| 112 | .amux = 1, |
| 113 | },{ |
| 114 | .type = EM2820_VMUX_SVIDEO, |
| 115 | .vmux = 9, |
| 116 | .amux = 1, |
| 117 | }}, |
| 118 | }, |
| 119 | [EM2820_BOARD_HAUPPAUGE_WINTV_USB_2] = { |
| 120 | .name = "Hauppauge WinTV USB 2", |
| 121 | .vchannels = 3, |
| 122 | .norm = VIDEO_MODE_NTSC, |
| 123 | .tuner_type = TUNER_PHILIPS_FM1236_MK3, |
| 124 | .tda9887_conf = TDA9887_PRESENT|TDA9887_PORT1_ACTIVE|TDA9887_PORT2_ACTIVE, |
| 125 | .has_tuner = 1, |
| 126 | .decoder = EM2820_TVP5150, |
| 127 | .has_msp34xx = 1, |
| 128 | /*FIXME: S-Video not tested */ |
| 129 | .input = {{ |
| 130 | .type = EM2820_VMUX_TELEVISION, |
| 131 | .vmux = 0, |
| 132 | .amux = 0, |
| 133 | },{ |
| 134 | .type = EM2820_VMUX_SVIDEO, |
| 135 | .vmux = 2, |
| 136 | .amux = 1, |
| 137 | }}, |
| 138 | }, |
| 139 | [EM2820_BOARD_MSI_VOX_USB_2] = { |
| 140 | .name = "MSI VOX USB 2.0", |
| 141 | .vchannels = 3, |
| 142 | .norm = VIDEO_MODE_PAL, |
| 143 | .tuner_type = TUNER_PHILIPS_PAL, |
| 144 | .tda9887_conf = TDA9887_PRESENT|TDA9887_PORT1_ACTIVE|TDA9887_PORT2_ACTIVE, |
| 145 | .has_tuner = 1, |
| 146 | .decoder = EM2820_SAA7114, |
| 147 | .input = {{ |
| 148 | .type = EM2820_VMUX_TELEVISION, |
| 149 | .vmux = 2, |
| 150 | .amux = 0, |
| 151 | },{ |
| 152 | .type = EM2820_VMUX_COMPOSITE1, |
| 153 | .vmux = 0, |
| 154 | .amux = 1, |
| 155 | },{ |
| 156 | .type = EM2820_VMUX_SVIDEO, |
| 157 | .vmux = 9, |
| 158 | .amux = 1, |
| 159 | }}, |
| 160 | }, |
Mauro Carvalho Chehab | 596d92d | 2005-11-08 21:37:24 -0800 | [diff] [blame^] | 161 | [EM2800_BOARD_TERRATEC_CINERGY_200] = { |
| 162 | .name = "Terratec Cinergy 200 USB", |
| 163 | .chip_id = 0x4, |
| 164 | .is_em2800 = 1, |
| 165 | .vchannels = 3, |
| 166 | .norm = VIDEO_MODE_PAL, |
| 167 | .tuner_type = TUNER_LG_PAL_NEW_TAPC, |
| 168 | .tda9887_conf = TDA9887_PRESENT, |
| 169 | .has_tuner = 1, |
| 170 | .decoder = EM2820_SAA7113, |
| 171 | .input = {{ |
| 172 | .type = EM2820_VMUX_TELEVISION, |
| 173 | .vmux = 2, |
| 174 | .amux = 0, |
| 175 | },{ |
| 176 | .type = EM2820_VMUX_COMPOSITE1, |
| 177 | .vmux = 0, |
| 178 | .amux = 1, |
| 179 | },{ |
| 180 | .type = EM2820_VMUX_SVIDEO, |
| 181 | .vmux = 9, |
| 182 | .amux = 1, |
| 183 | }}, |
| 184 | }, |
| 185 | [EM2800_BOARD_LEADTEK_WINFAST_USBII] = { |
| 186 | .name = "Leadtek Winfast USB II", |
| 187 | .chip_id = 0x2, |
| 188 | .is_em2800 = 1, |
| 189 | .vchannels = 3, |
| 190 | .norm = VIDEO_MODE_PAL, |
| 191 | .tuner_type = TUNER_LG_PAL_NEW_TAPC, |
| 192 | .tda9887_conf = TDA9887_PRESENT, |
| 193 | .has_tuner = 1, |
| 194 | .decoder = EM2820_SAA7113, |
| 195 | .input = {{ |
| 196 | .type = EM2820_VMUX_TELEVISION, |
| 197 | .vmux = 2, |
| 198 | .amux = 0, |
| 199 | },{ |
| 200 | .type = EM2820_VMUX_COMPOSITE1, |
| 201 | .vmux = 0, |
| 202 | .amux = 1, |
| 203 | },{ |
| 204 | .type = EM2820_VMUX_SVIDEO, |
| 205 | .vmux = 9, |
| 206 | .amux = 1, |
| 207 | }}, |
| 208 | }, |
| 209 | [EM2800_BOARD_KWORLD_USB2800] = { |
| 210 | .name = "Kworld USB2800", |
| 211 | .chip_id = 0x7, |
| 212 | .is_em2800 = 1, |
| 213 | .vchannels = 3, |
| 214 | .norm = VIDEO_MODE_PAL, |
| 215 | .tuner_type = TUNER_PHILIPS_ATSC, |
| 216 | .tda9887_conf = TDA9887_PRESENT, |
| 217 | .has_tuner = 1, |
| 218 | .decoder = EM2820_SAA7113, |
| 219 | .input = {{ |
| 220 | .type = EM2820_VMUX_TELEVISION, |
| 221 | .vmux = 2, |
| 222 | .amux = 0, |
| 223 | },{ |
| 224 | .type = EM2820_VMUX_COMPOSITE1, |
| 225 | .vmux = 0, |
| 226 | .amux = 1, |
| 227 | },{ |
| 228 | .type = EM2820_VMUX_SVIDEO, |
| 229 | .vmux = 9, |
| 230 | .amux = 1, |
| 231 | }}, |
| 232 | }, |
akpm@osdl.org | a6c2ba2 | 2005-11-08 21:37:07 -0800 | [diff] [blame] | 233 | }; |
Mauro Carvalho Chehab | 596d92d | 2005-11-08 21:37:24 -0800 | [diff] [blame^] | 234 | const unsigned int em2820_bcount = ARRAY_SIZE(em2820_boards); |
akpm@osdl.org | a6c2ba2 | 2005-11-08 21:37:07 -0800 | [diff] [blame] | 235 | |
| 236 | /* table of devices that work with this driver */ |
| 237 | struct usb_device_id em2820_id_table [] = { |
Mauro Carvalho Chehab | 596d92d | 2005-11-08 21:37:24 -0800 | [diff] [blame^] | 238 | { USB_DEVICE(0xeb1a, 0x2800), .driver_info = EM2800_BOARD_UNKNOWN }, |
| 239 | { USB_DEVICE(0xeb1a, 0x2820), .driver_info = EM2820_BOARD_UNKNOWN }, |
akpm@osdl.org | a6c2ba2 | 2005-11-08 21:37:07 -0800 | [diff] [blame] | 240 | { USB_DEVICE(0x0ccd, 0x0036), .driver_info = EM2820_BOARD_TERRATEC_CINERGY_250 }, |
| 241 | { USB_DEVICE(0x2304, 0x0208), .driver_info = EM2820_BOARD_PINNACLE_USB_2 }, |
| 242 | { USB_DEVICE(0x2040, 0x4200), .driver_info = EM2820_BOARD_HAUPPAUGE_WINTV_USB_2 }, |
akpm@osdl.org | a6c2ba2 | 2005-11-08 21:37:07 -0800 | [diff] [blame] | 243 | { }, |
| 244 | }; |
| 245 | |
| 246 | void em2820_card_setup(struct em2820 *dev) |
| 247 | { |
| 248 | /* request some modules */ |
| 249 | if (dev->model == EM2820_BOARD_HAUPPAUGE_WINTV_USB_2) { |
| 250 | struct tveeprom tv; |
| 251 | #ifdef CONFIG_MODULES |
| 252 | request_module("tveeprom"); |
| 253 | #endif |
| 254 | /* Call first TVeeprom */ |
| 255 | |
| 256 | tveeprom_hauppauge_analog(&dev->i2c_client, &tv, dev->eedata); |
| 257 | |
| 258 | dev->tuner_type= tv.tuner_type; |
| 259 | if (tv.audio_processor == AUDIO_CHIP_MSP34XX) { |
| 260 | dev->has_msp34xx=1; |
| 261 | } else dev->has_msp34xx=0; |
| 262 | } |
| 263 | } |
| 264 | |
| 265 | EXPORT_SYMBOL(em2820_boards); |
Mauro Carvalho Chehab | 596d92d | 2005-11-08 21:37:24 -0800 | [diff] [blame^] | 266 | EXPORT_SYMBOL(em2820_bcount); |
akpm@osdl.org | a6c2ba2 | 2005-11-08 21:37:07 -0800 | [diff] [blame] | 267 | EXPORT_SYMBOL(em2820_id_table); |
| 268 | |
| 269 | MODULE_DEVICE_TABLE (usb, em2820_id_table); |