2 * Driver for the Auvitek USB bridge
4 * Copyright (c) 2008 Steven Toth <stoth@hauppauge.com>
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"
25 #define _dbg(level, fmt, arg...)\
28 printk(KERN_DEBUG DRIVER_NAME "/0: " fmt, ## arg);\
31 struct au0828_board au0828_boards[] = {
32 [AU0828_BOARD_UNKNOWN] = {
33 .name = "Unknown board",
35 [AU0828_BOARD_HAUPPAUGE_HVR850] = {
36 .name = "Hauppauge HVR850",
38 [AU0828_BOARD_HAUPPAUGE_HVR950Q] = {
39 .name = "Hauppauge HVR950Q",
41 [AU0828_BOARD_DVICO_FUSIONHDTV7] = {
42 .name = "DViCO FusionHDTV USB",
45 const unsigned int au0828_bcount = ARRAY_SIZE(au0828_boards);
47 /* Tuner callback function for au0828 boards. Currently only needed
48 * for HVR1500Q, which has an xc5000 tuner.
50 int au0828_tuner_callback(void *priv, int command, int arg)
52 struct au0828_dev *dev = priv;
55 case AU0828_BOARD_HAUPPAUGE_HVR850:
56 case AU0828_BOARD_HAUPPAUGE_HVR950Q:
57 case AU0828_BOARD_DVICO_FUSIONHDTV7:
59 /* Tuner Reset Command from xc5000 */
60 /* Drive the tuner into reset and out */
61 au0828_clear(dev, REG_001, 2);
63 au0828_set(dev, REG_001, 2);
69 "%s(): Unknown command.\n", __FUNCTION__);
75 return 0; /* Should never be here */
78 static void hauppauge_eeprom(struct au0828_dev *dev, u8 *eeprom_data)
82 tveeprom_hauppauge_analog(&dev->i2c_client, &tv, eeprom_data);
84 /* Make sure we support the board model */
87 case 72001: /* WinTV-HVR950q (Retail, IR, ATSC/QAM and basic analog video */
90 printk("%s: warning: unknown hauppauge model #%d\n", __FUNCTION__, tv.model);
94 printk(KERN_INFO "%s: hauppauge eeprom: model=%d\n", __FUNCTION__, tv.model);
98 void au0828_card_setup(struct au0828_dev *dev)
101 static u8 eeprom[256];
103 if (dev->i2c_rc == 0) {
104 dev->i2c_client.addr = 0xa0 >> 1;
105 tveeprom_read(&dev->i2c_client, eeprom, sizeof(eeprom));
109 case AU0828_BOARD_HAUPPAUGE_HVR850:
110 case AU0828_BOARD_HAUPPAUGE_HVR950Q:
111 if (dev->i2c_rc == 0)
112 hauppauge_eeprom(dev, eeprom+0xa0);
118 * The bridge has between 8 and 12 gpios.
119 * Regs 1 and 0 deal with output enables.
120 * Regs 3 and 2 * deal with direction.
122 void au0828_gpio_setup(struct au0828_dev *dev)
125 case AU0828_BOARD_HAUPPAUGE_HVR850:
126 case AU0828_BOARD_HAUPPAUGE_HVR950Q:
129 * 5 - AU8522 Demodulator
135 au0828_write(dev, REG_003, 0x02);
136 au0828_write(dev, REG_002, 0x88 | 0x20);
137 au0828_write(dev, REG_001, 0x0);
138 au0828_write(dev, REG_000, 0x0);
142 au0828_write(dev, REG_003, 0x02);
143 au0828_write(dev, REG_001, 0x02);
144 au0828_write(dev, REG_002, 0x88 | 0x20);
145 au0828_write(dev, REG_000, 0x88 | 0x20 | 0x40);
148 case AU0828_BOARD_DVICO_FUSIONHDTV7:
151 * 8 - AU8522 Demodulator
156 au0828_write(dev, REG_003, 0x02);
157 au0828_write(dev, REG_002, 0xa0);
158 au0828_write(dev, REG_001, 0x0);
159 au0828_write(dev, REG_000, 0x0);
163 au0828_write(dev, REG_003, 0x02);
164 au0828_write(dev, REG_002, 0xa0);
165 au0828_write(dev, REG_001, 0x02);
166 au0828_write(dev, REG_000, 0xa0);
172 /* table of devices that work with this driver */
173 struct usb_device_id au0828_usb_id_table [] = {
174 { USB_DEVICE(0x2040, 0x7200),
175 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q },
176 { USB_DEVICE(0x2040, 0x7240),
177 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR850 },
178 { USB_DEVICE(0x0fe9, 0xd620),
179 .driver_info = AU0828_BOARD_DVICO_FUSIONHDTV7 },
183 MODULE_DEVICE_TABLE(usb, au0828_usb_id_table);