2 * Driver for the Auvitek USB bridge
4 * Copyright (c) 2008 Steven Toth <stoth@linuxtv.org>
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.
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
15 * GNU General Public License for more details.
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.
23 #include "au0828-cards.h"
26 void hvr950q_cs5340_audio(void *priv, int enable)
28 /* Because the HVR-950q shares an i2s bus between the cs5340 and the
29 au8522, we need to hold cs5340 in reset when using the au8522 */
30 struct au0828_dev *dev = priv;
32 au0828_set(dev, REG_000, 0x10);
34 au0828_clear(dev, REG_000, 0x10);
37 struct au0828_board au0828_boards[] = {
38 [AU0828_BOARD_UNKNOWN] = {
39 .name = "Unknown board",
41 [AU0828_BOARD_HAUPPAUGE_HVR850] = {
42 .name = "Hauppauge HVR850",
45 .type = AU0828_VMUX_TELEVISION,
46 .vmux = AU8522_COMPOSITE_CH4_SIF,
47 .amux = AU8522_AUDIO_SIF,
50 .type = AU0828_VMUX_COMPOSITE,
51 .vmux = AU8522_COMPOSITE_CH1,
52 .amux = AU8522_AUDIO_NONE,
53 .audio_setup = hvr950q_cs5340_audio,
56 .type = AU0828_VMUX_SVIDEO,
57 .vmux = AU8522_SVIDEO_CH13,
58 .amux = AU8522_AUDIO_NONE,
59 .audio_setup = hvr950q_cs5340_audio,
63 [AU0828_BOARD_HAUPPAUGE_HVR950Q] = {
64 .name = "Hauppauge HVR950Q",
67 .type = AU0828_VMUX_TELEVISION,
68 .vmux = AU8522_COMPOSITE_CH4_SIF,
69 .amux = AU8522_AUDIO_SIF,
72 .type = AU0828_VMUX_COMPOSITE,
73 .vmux = AU8522_COMPOSITE_CH1,
74 .amux = AU8522_AUDIO_NONE,
75 .audio_setup = hvr950q_cs5340_audio,
78 .type = AU0828_VMUX_SVIDEO,
79 .vmux = AU8522_SVIDEO_CH13,
80 .amux = AU8522_AUDIO_NONE,
81 .audio_setup = hvr950q_cs5340_audio,
85 [AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL] = {
86 .name = "Hauppauge HVR950Q rev xxF8",
88 [AU0828_BOARD_DVICO_FUSIONHDTV7] = {
89 .name = "DViCO FusionHDTV USB",
91 [AU0828_BOARD_HAUPPAUGE_WOODBURY] = {
92 .name = "Hauppauge Woodbury",
96 /* Tuner callback function for au0828 boards. Currently only needed
97 * for HVR1500Q, which has an xc5000 tuner.
99 int au0828_tuner_callback(void *priv, int component, int command, int arg)
101 struct au0828_dev *dev = priv;
103 dprintk(1, "%s()\n", __func__);
105 switch (dev->board) {
106 case AU0828_BOARD_HAUPPAUGE_HVR850:
107 case AU0828_BOARD_HAUPPAUGE_HVR950Q:
108 case AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL:
109 case AU0828_BOARD_DVICO_FUSIONHDTV7:
111 /* Tuner Reset Command from xc5000 */
112 /* Drive the tuner into reset and out */
113 au0828_clear(dev, REG_001, 2);
115 au0828_set(dev, REG_001, 2);
120 "%s(): Unknown command.\n", __func__);
126 return 0; /* Should never be here */
129 static void hauppauge_eeprom(struct au0828_dev *dev, u8 *eeprom_data)
133 tveeprom_hauppauge_analog(&dev->i2c_client, &tv, eeprom_data);
135 /* Make sure we support the board model */
137 case 72000: /* WinTV-HVR950q (Retail, IR, ATSC/QAM */
138 case 72001: /* WinTV-HVR950q (Retail, IR, ATSC/QAM and basic analog video */
139 case 72211: /* WinTV-HVR950q (OEM, IR, ATSC/QAM and basic analog video */
140 case 72221: /* WinTV-HVR950q (OEM, IR, ATSC/QAM and basic analog video */
141 case 72231: /* WinTV-HVR950q (OEM, IR, ATSC/QAM and basic analog video */
142 case 72241: /* WinTV-HVR950q (OEM, No IR, ATSC/QAM and basic analog video */
143 case 72251: /* WinTV-HVR950q (Retail, IR, ATSC/QAM and basic analog video */
144 case 72301: /* WinTV-HVR850 (Retail, IR, ATSC and basic analog video */
145 case 72500: /* WinTV-HVR950q (OEM, No IR, ATSC/QAM */
148 printk(KERN_WARNING "%s: warning: "
149 "unknown hauppauge model #%d\n", __func__, tv.model);
153 printk(KERN_INFO "%s: hauppauge eeprom: model=%d\n",
157 void au0828_card_setup(struct au0828_dev *dev)
159 static u8 eeprom[256];
161 dprintk(1, "%s()\n", __func__);
163 if (dev->i2c_rc == 0) {
164 dev->i2c_client.addr = 0xa0 >> 1;
165 tveeprom_read(&dev->i2c_client, eeprom, sizeof(eeprom));
168 switch (dev->board) {
169 case AU0828_BOARD_HAUPPAUGE_HVR850:
170 case AU0828_BOARD_HAUPPAUGE_HVR950Q:
171 case AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL:
172 case AU0828_BOARD_HAUPPAUGE_WOODBURY:
173 if (dev->i2c_rc == 0)
174 hauppauge_eeprom(dev, eeprom+0xa0);
180 * The bridge has between 8 and 12 gpios.
181 * Regs 1 and 0 deal with output enables.
182 * Regs 3 and 2 deal with direction.
184 void au0828_gpio_setup(struct au0828_dev *dev)
186 dprintk(1, "%s()\n", __func__);
188 switch (dev->board) {
189 case AU0828_BOARD_HAUPPAUGE_HVR850:
190 case AU0828_BOARD_HAUPPAUGE_HVR950Q:
191 case AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL:
192 case AU0828_BOARD_HAUPPAUGE_WOODBURY:
195 * 5 - AU8522 Demodulator
202 au0828_write(dev, REG_003, 0x02);
203 au0828_write(dev, REG_002, 0x80 | 0x20 | 0x10);
204 au0828_write(dev, REG_001, 0x0);
205 au0828_write(dev, REG_000, 0x0);
208 /* Out of reset (leave the cs5340 in reset until needed) */
209 au0828_write(dev, REG_003, 0x02);
210 au0828_write(dev, REG_001, 0x02);
211 au0828_write(dev, REG_002, 0x80 | 0x20 | 0x10);
212 au0828_write(dev, REG_000, 0x80 | 0x40 | 0x20);
216 case AU0828_BOARD_DVICO_FUSIONHDTV7:
219 * 8 - AU8522 Demodulator
224 au0828_write(dev, REG_003, 0x02);
225 au0828_write(dev, REG_002, 0xa0);
226 au0828_write(dev, REG_001, 0x0);
227 au0828_write(dev, REG_000, 0x0);
231 au0828_write(dev, REG_003, 0x02);
232 au0828_write(dev, REG_002, 0xa0);
233 au0828_write(dev, REG_001, 0x02);
234 au0828_write(dev, REG_000, 0xa0);
240 /* table of devices that work with this driver */
241 struct usb_device_id au0828_usb_id_table[] = {
242 { USB_DEVICE(0x2040, 0x7200),
243 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q },
244 { USB_DEVICE(0x2040, 0x7240),
245 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR850 },
246 { USB_DEVICE(0x0fe9, 0xd620),
247 .driver_info = AU0828_BOARD_DVICO_FUSIONHDTV7 },
248 { USB_DEVICE(0x2040, 0x7210),
249 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q },
250 { USB_DEVICE(0x2040, 0x7217),
251 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q },
252 { USB_DEVICE(0x2040, 0x721b),
253 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q },
254 { USB_DEVICE(0x2040, 0x721e),
255 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q },
256 { USB_DEVICE(0x2040, 0x721f),
257 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q },
258 { USB_DEVICE(0x2040, 0x7280),
259 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q },
260 { USB_DEVICE(0x0fd9, 0x0008),
261 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q },
262 { USB_DEVICE(0x2040, 0x7201),
263 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL },
264 { USB_DEVICE(0x2040, 0x7211),
265 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL },
266 { USB_DEVICE(0x2040, 0x7281),
267 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL },
268 { USB_DEVICE(0x2040, 0x8200),
269 .driver_info = AU0828_BOARD_HAUPPAUGE_WOODBURY },
273 MODULE_DEVICE_TABLE(usb, au0828_usb_id_table);