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 struct au0828_board au0828_boards[] = {
26 [AU0828_BOARD_UNKNOWN] = {
27 .name = "Unknown board",
29 [AU0828_BOARD_HAUPPAUGE_HVR850] = {
30 .name = "Hauppauge HVR850",
32 [AU0828_BOARD_HAUPPAUGE_HVR950Q] = {
33 .name = "Hauppauge HVR950Q",
35 [AU0828_BOARD_DVICO_FUSIONHDTV7] = {
36 .name = "DViCO FusionHDTV USB",
40 /* Tuner callback function for au0828 boards. Currently only needed
41 * for HVR1500Q, which has an xc5000 tuner.
43 int au0828_tuner_callback(void *priv, int command, int arg)
45 struct au0828_dev *dev = priv;
47 dprintk(1, "%s()\n", __func__);
50 case AU0828_BOARD_HAUPPAUGE_HVR850:
51 case AU0828_BOARD_HAUPPAUGE_HVR950Q:
52 case AU0828_BOARD_DVICO_FUSIONHDTV7:
54 /* Tuner Reset Command from xc5000 */
55 /* Drive the tuner into reset and out */
56 au0828_clear(dev, REG_001, 2);
58 au0828_set(dev, REG_001, 2);
63 "%s(): Unknown command.\n", __func__);
69 return 0; /* Should never be here */
72 static void hauppauge_eeprom(struct au0828_dev *dev, u8 *eeprom_data)
76 tveeprom_hauppauge_analog(&dev->i2c_client, &tv, eeprom_data);
78 /* Make sure we support the board model */
80 case 72001: /* WinTV-HVR950q (Retail, IR, ATSC/QAM and basic analog video */
81 case 72301: /* WinTV-HVR850 (Retail, IR, ATSC and basic analog video */
84 printk(KERN_WARNING "%s: warning: "
85 "unknown hauppauge model #%d\n", __func__, tv.model);
89 printk(KERN_INFO "%s: hauppauge eeprom: model=%d\n",
93 void au0828_card_setup(struct au0828_dev *dev)
95 static u8 eeprom[256];
97 dprintk(1, "%s()\n", __func__);
99 if (dev->i2c_rc == 0) {
100 dev->i2c_client.addr = 0xa0 >> 1;
101 tveeprom_read(&dev->i2c_client, eeprom, sizeof(eeprom));
104 switch (dev->board) {
105 case AU0828_BOARD_HAUPPAUGE_HVR850:
106 case AU0828_BOARD_HAUPPAUGE_HVR950Q:
107 if (dev->i2c_rc == 0)
108 hauppauge_eeprom(dev, eeprom+0xa0);
114 * The bridge has between 8 and 12 gpios.
115 * Regs 1 and 0 deal with output enables.
116 * Regs 3 and 2 deal with direction.
118 void au0828_gpio_setup(struct au0828_dev *dev)
120 dprintk(1, "%s()\n", __func__);
122 switch (dev->board) {
123 case AU0828_BOARD_HAUPPAUGE_HVR850:
124 case AU0828_BOARD_HAUPPAUGE_HVR950Q:
127 * 5 - AU8522 Demodulator
133 au0828_write(dev, REG_003, 0x02);
134 au0828_write(dev, REG_002, 0x88 | 0x20);
135 au0828_write(dev, REG_001, 0x0);
136 au0828_write(dev, REG_000, 0x0);
140 au0828_write(dev, REG_003, 0x02);
141 au0828_write(dev, REG_001, 0x02);
142 au0828_write(dev, REG_002, 0x88 | 0x20);
143 au0828_write(dev, REG_000, 0x88 | 0x20 | 0x40);
146 case AU0828_BOARD_DVICO_FUSIONHDTV7:
149 * 8 - AU8522 Demodulator
154 au0828_write(dev, REG_003, 0x02);
155 au0828_write(dev, REG_002, 0xa0);
156 au0828_write(dev, REG_001, 0x0);
157 au0828_write(dev, REG_000, 0x0);
161 au0828_write(dev, REG_003, 0x02);
162 au0828_write(dev, REG_002, 0xa0);
163 au0828_write(dev, REG_001, 0x02);
164 au0828_write(dev, REG_000, 0xa0);
170 /* table of devices that work with this driver */
171 struct usb_device_id au0828_usb_id_table [] = {
172 { USB_DEVICE(0x2040, 0x7200),
173 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q },
174 { USB_DEVICE(0x2040, 0x7240),
175 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR850 },
176 { USB_DEVICE(0x0fe9, 0xd620),
177 .driver_info = AU0828_BOARD_DVICO_FUSIONHDTV7 },
181 MODULE_DEVICE_TABLE(usb, au0828_usb_id_table);