V4L/DVB (8530): au0828: add support for new revision of HVR950Q
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / drivers / media / video / au0828 / au0828-cards.c
blob443e590097628873a7f6ad490ecbcb15a97dbce4
1 /*
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.
22 #include "au0828.h"
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_HAUPPAUGE_HVR950Q_MXL] = {
36 .name = "Hauppauge HVR950Q rev xxF8",
38 [AU0828_BOARD_DVICO_FUSIONHDTV7] = {
39 .name = "DViCO FusionHDTV USB",
43 /* Tuner callback function for au0828 boards. Currently only needed
44 * for HVR1500Q, which has an xc5000 tuner.
46 int au0828_tuner_callback(void *priv, int command, int arg)
48 struct au0828_dev *dev = priv;
50 dprintk(1, "%s()\n", __func__);
52 switch (dev->board) {
53 case AU0828_BOARD_HAUPPAUGE_HVR850:
54 case AU0828_BOARD_HAUPPAUGE_HVR950Q:
55 case AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL:
56 case AU0828_BOARD_DVICO_FUSIONHDTV7:
57 if (command == 0) {
58 /* Tuner Reset Command from xc5000 */
59 /* Drive the tuner into reset and out */
60 au0828_clear(dev, REG_001, 2);
61 mdelay(200);
62 au0828_set(dev, REG_001, 2);
63 mdelay(50);
64 return 0;
65 } else {
66 printk(KERN_ERR
67 "%s(): Unknown command.\n", __func__);
68 return -EINVAL;
70 break;
73 return 0; /* Should never be here */
76 static void hauppauge_eeprom(struct au0828_dev *dev, u8 *eeprom_data)
78 struct tveeprom tv;
80 tveeprom_hauppauge_analog(&dev->i2c_client, &tv, eeprom_data);
82 /* Make sure we support the board model */
83 switch (tv.model) {
84 case 72000: /* WinTV-HVR950q (Retail, IR, ATSC/QAM */
85 case 72001: /* WinTV-HVR950q (Retail, IR, ATSC/QAM and basic analog video */
86 case 72211: /* WinTV-HVR950q (OEM, IR, ATSC/QAM and basic analog video */
87 case 72221: /* WinTV-HVR950q (OEM, IR, ATSC/QAM and basic analog video */
88 case 72231: /* WinTV-HVR950q (OEM, IR, ATSC/QAM and basic analog video */
89 case 72241: /* WinTV-HVR950q (OEM, No IR, ATSC/QAM and basic analog video */
90 case 72301: /* WinTV-HVR850 (Retail, IR, ATSC and basic analog video */
91 case 72500: /* WinTV-HVR950q (OEM, No IR, ATSC/QAM */
92 break;
93 default:
94 printk(KERN_WARNING "%s: warning: "
95 "unknown hauppauge model #%d\n", __func__, tv.model);
96 break;
99 printk(KERN_INFO "%s: hauppauge eeprom: model=%d\n",
100 __func__, tv.model);
103 void au0828_card_setup(struct au0828_dev *dev)
105 static u8 eeprom[256];
107 dprintk(1, "%s()\n", __func__);
109 if (dev->i2c_rc == 0) {
110 dev->i2c_client.addr = 0xa0 >> 1;
111 tveeprom_read(&dev->i2c_client, eeprom, sizeof(eeprom));
114 switch (dev->board) {
115 case AU0828_BOARD_HAUPPAUGE_HVR850:
116 case AU0828_BOARD_HAUPPAUGE_HVR950Q:
117 case AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL:
118 if (dev->i2c_rc == 0)
119 hauppauge_eeprom(dev, eeprom+0xa0);
120 break;
125 * The bridge has between 8 and 12 gpios.
126 * Regs 1 and 0 deal with output enables.
127 * Regs 3 and 2 deal with direction.
129 void au0828_gpio_setup(struct au0828_dev *dev)
131 dprintk(1, "%s()\n", __func__);
133 switch (dev->board) {
134 case AU0828_BOARD_HAUPPAUGE_HVR850:
135 case AU0828_BOARD_HAUPPAUGE_HVR950Q:
136 case AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL:
137 /* GPIO's
138 * 4 - CS5340
139 * 5 - AU8522 Demodulator
140 * 6 - eeprom W/P
141 * 9 - XC5000 Tuner
144 /* Into reset */
145 au0828_write(dev, REG_003, 0x02);
146 au0828_write(dev, REG_002, 0x88 | 0x20);
147 au0828_write(dev, REG_001, 0x0);
148 au0828_write(dev, REG_000, 0x0);
149 msleep(100);
151 /* Out of reset */
152 au0828_write(dev, REG_003, 0x02);
153 au0828_write(dev, REG_001, 0x02);
154 au0828_write(dev, REG_002, 0x88 | 0x20);
155 au0828_write(dev, REG_000, 0x88 | 0x20 | 0x40);
156 msleep(250);
157 break;
158 case AU0828_BOARD_DVICO_FUSIONHDTV7:
159 /* GPIO's
160 * 6 - ?
161 * 8 - AU8522 Demodulator
162 * 9 - XC5000 Tuner
165 /* Into reset */
166 au0828_write(dev, REG_003, 0x02);
167 au0828_write(dev, REG_002, 0xa0);
168 au0828_write(dev, REG_001, 0x0);
169 au0828_write(dev, REG_000, 0x0);
170 msleep(100);
172 /* Out of reset */
173 au0828_write(dev, REG_003, 0x02);
174 au0828_write(dev, REG_002, 0xa0);
175 au0828_write(dev, REG_001, 0x02);
176 au0828_write(dev, REG_000, 0xa0);
177 msleep(250);
178 break;
182 /* table of devices that work with this driver */
183 struct usb_device_id au0828_usb_id_table [] = {
184 { USB_DEVICE(0x2040, 0x7200),
185 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q },
186 { USB_DEVICE(0x2040, 0x7240),
187 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR850 },
188 { USB_DEVICE(0x0fe9, 0xd620),
189 .driver_info = AU0828_BOARD_DVICO_FUSIONHDTV7 },
190 { USB_DEVICE(0x2040, 0x7210),
191 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q },
192 { USB_DEVICE(0x2040, 0x7217),
193 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q },
194 { USB_DEVICE(0x2040, 0x721b),
195 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q },
196 { USB_DEVICE(0x2040, 0x721f),
197 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q },
198 { USB_DEVICE(0x2040, 0x7280),
199 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q },
200 { USB_DEVICE(0x0fd9, 0x0008),
201 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q },
202 { USB_DEVICE(0x2040, 0x7201),
203 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL },
204 { USB_DEVICE(0x2040, 0x7211),
205 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL },
206 { USB_DEVICE(0x2040, 0x7281),
207 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL },
208 { },
211 MODULE_DEVICE_TABLE(usb, au0828_usb_id_table);