This source file includes following definitions.
- hvr950q_cs5340_audio
- au0828_tuner_callback
- hauppauge_eeprom
- au0828_card_setup
- au0828_card_analog_fe_setup
- au0828_gpio_setup
1
2
3
4
5
6
7
8 #include "au0828.h"
9 #include "au0828-cards.h"
10 #include "au8522.h"
11 #include "media/tuner.h"
12 #include "media/v4l2-common.h"
13
14 static void hvr950q_cs5340_audio(void *priv, int enable)
15 {
16
17
18 struct au0828_dev *dev = priv;
19 if (enable == 1)
20 au0828_set(dev, REG_000, 0x10);
21 else
22 au0828_clear(dev, REG_000, 0x10);
23 }
24
25
26
27
28
29
30 struct au0828_board au0828_boards[] = {
31 [AU0828_BOARD_UNKNOWN] = {
32 .name = "Unknown board",
33 .tuner_type = -1U,
34 .tuner_addr = ADDR_UNSET,
35 },
36 [AU0828_BOARD_HAUPPAUGE_HVR850] = {
37 .name = "Hauppauge HVR850",
38 .tuner_type = TUNER_XC5000,
39 .tuner_addr = 0x61,
40 .has_ir_i2c = 1,
41 .has_analog = 1,
42 .i2c_clk_divider = AU0828_I2C_CLK_250KHZ,
43 .input = {
44 {
45 .type = AU0828_VMUX_TELEVISION,
46 .vmux = AU8522_COMPOSITE_CH4_SIF,
47 .amux = AU8522_AUDIO_SIF,
48 },
49 {
50 .type = AU0828_VMUX_COMPOSITE,
51 .vmux = AU8522_COMPOSITE_CH1,
52 .amux = AU8522_AUDIO_NONE,
53 .audio_setup = hvr950q_cs5340_audio,
54 },
55 {
56 .type = AU0828_VMUX_SVIDEO,
57 .vmux = AU8522_SVIDEO_CH13,
58 .amux = AU8522_AUDIO_NONE,
59 .audio_setup = hvr950q_cs5340_audio,
60 },
61 },
62 },
63 [AU0828_BOARD_HAUPPAUGE_HVR950Q] = {
64 .name = "Hauppauge HVR950Q",
65 .tuner_type = TUNER_XC5000,
66 .tuner_addr = 0x61,
67 .has_ir_i2c = 1,
68 .has_analog = 1,
69 .i2c_clk_divider = AU0828_I2C_CLK_250KHZ,
70 .input = {
71 {
72 .type = AU0828_VMUX_TELEVISION,
73 .vmux = AU8522_COMPOSITE_CH4_SIF,
74 .amux = AU8522_AUDIO_SIF,
75 },
76 {
77 .type = AU0828_VMUX_COMPOSITE,
78 .vmux = AU8522_COMPOSITE_CH1,
79 .amux = AU8522_AUDIO_NONE,
80 .audio_setup = hvr950q_cs5340_audio,
81 },
82 {
83 .type = AU0828_VMUX_SVIDEO,
84 .vmux = AU8522_SVIDEO_CH13,
85 .amux = AU8522_AUDIO_NONE,
86 .audio_setup = hvr950q_cs5340_audio,
87 },
88 },
89 },
90 [AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL] = {
91 .name = "Hauppauge HVR950Q rev xxF8",
92 .tuner_type = TUNER_XC5000,
93 .tuner_addr = 0x61,
94 .i2c_clk_divider = AU0828_I2C_CLK_250KHZ,
95 },
96 [AU0828_BOARD_DVICO_FUSIONHDTV7] = {
97 .name = "DViCO FusionHDTV USB",
98 .tuner_type = TUNER_XC5000,
99 .tuner_addr = 0x61,
100 .i2c_clk_divider = AU0828_I2C_CLK_250KHZ,
101 },
102 [AU0828_BOARD_HAUPPAUGE_WOODBURY] = {
103 .name = "Hauppauge Woodbury",
104 .tuner_type = TUNER_NXP_TDA18271,
105 .tuner_addr = 0x60,
106 .i2c_clk_divider = AU0828_I2C_CLK_250KHZ,
107 },
108 };
109
110
111
112
113 int au0828_tuner_callback(void *priv, int component, int command, int arg)
114 {
115 struct au0828_dev *dev = priv;
116
117 dprintk(1, "%s()\n", __func__);
118
119 switch (dev->boardnr) {
120 case AU0828_BOARD_HAUPPAUGE_HVR850:
121 case AU0828_BOARD_HAUPPAUGE_HVR950Q:
122 case AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL:
123 case AU0828_BOARD_DVICO_FUSIONHDTV7:
124 if (command == 0) {
125
126
127 au0828_clear(dev, REG_001, 2);
128 mdelay(10);
129 au0828_set(dev, REG_001, 2);
130 mdelay(10);
131 return 0;
132 } else {
133 pr_err("%s(): Unknown command.\n", __func__);
134 return -EINVAL;
135 }
136 break;
137 }
138
139 return 0;
140 }
141
142 static void hauppauge_eeprom(struct au0828_dev *dev, u8 *eeprom_data)
143 {
144 struct tveeprom tv;
145
146 tveeprom_hauppauge_analog(&tv, eeprom_data);
147 dev->board.tuner_type = tv.tuner_type;
148
149
150 switch (tv.model) {
151 case 72000:
152 case 72001:
153 case 72101:
154 case 72201:
155 case 72211:
156 case 72221:
157 case 72231:
158 case 72241:
159 case 72251:
160 case 72261:
161 case 72271:
162 case 72281:
163 case 72301:
164 case 72500:
165 break;
166 default:
167 pr_warn("%s: warning: unknown hauppauge model #%d\n",
168 __func__, tv.model);
169 break;
170 }
171
172 pr_info("%s: hauppauge eeprom: model=%d\n",
173 __func__, tv.model);
174 }
175
176 void au0828_card_analog_fe_setup(struct au0828_dev *dev);
177
178 void au0828_card_setup(struct au0828_dev *dev)
179 {
180 static u8 eeprom[256];
181
182 dprintk(1, "%s()\n", __func__);
183
184 if (dev->i2c_rc == 0) {
185 dev->i2c_client.addr = 0xa0 >> 1;
186 tveeprom_read(&dev->i2c_client, eeprom, sizeof(eeprom));
187 }
188
189 switch (dev->boardnr) {
190 case AU0828_BOARD_HAUPPAUGE_HVR850:
191 case AU0828_BOARD_HAUPPAUGE_HVR950Q:
192 case AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL:
193 case AU0828_BOARD_HAUPPAUGE_WOODBURY:
194 if (dev->i2c_rc == 0)
195 hauppauge_eeprom(dev, eeprom+0xa0);
196 break;
197 }
198
199 au0828_card_analog_fe_setup(dev);
200 }
201
202 void au0828_card_analog_fe_setup(struct au0828_dev *dev)
203 {
204 #ifdef CONFIG_VIDEO_AU0828_V4L2
205 struct tuner_setup tun_setup;
206 struct v4l2_subdev *sd;
207 unsigned int mode_mask = T_ANALOG_TV;
208
209 if (AUVI_INPUT(0).type != AU0828_VMUX_UNDEFINED) {
210
211
212
213 sd = v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap,
214 "au8522", 0x8e >> 1, NULL);
215 if (sd == NULL)
216 pr_err("analog subdev registration failed\n");
217 }
218
219
220 if (dev->board.tuner_type != TUNER_ABSENT && dev->board.has_analog) {
221
222 sd = v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap,
223 "tuner", dev->board.tuner_addr, NULL);
224 if (sd == NULL)
225 pr_err("tuner subdev registration fail\n");
226
227 tun_setup.mode_mask = mode_mask;
228 tun_setup.type = dev->board.tuner_type;
229 tun_setup.addr = dev->board.tuner_addr;
230 tun_setup.tuner_callback = au0828_tuner_callback;
231 v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_type_addr,
232 &tun_setup);
233 }
234 #endif
235 }
236
237
238
239
240
241
242 void au0828_gpio_setup(struct au0828_dev *dev)
243 {
244 dprintk(1, "%s()\n", __func__);
245
246 switch (dev->boardnr) {
247 case AU0828_BOARD_HAUPPAUGE_HVR850:
248 case AU0828_BOARD_HAUPPAUGE_HVR950Q:
249 case AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL:
250 case AU0828_BOARD_HAUPPAUGE_WOODBURY:
251
252
253
254
255
256
257
258
259
260
261
262 au0828_write(dev, REG_003, 0x02);
263 au0828_write(dev, REG_002, 0x80 | 0x20 | 0x10);
264
265
266 au0828_write(dev, REG_001, 0x0);
267 au0828_write(dev, REG_000, 0x0);
268 msleep(50);
269
270
271 au0828_write(dev, REG_000, 0x80);
272 msleep(50);
273
274
275
276 au0828_write(dev, REG_001, 0x02);
277 au0828_write(dev, REG_000, 0x80 | 0x20);
278
279 msleep(250);
280 break;
281 case AU0828_BOARD_DVICO_FUSIONHDTV7:
282
283
284
285
286
287
288
289 au0828_write(dev, REG_003, 0x02);
290 au0828_write(dev, REG_002, 0xa0);
291 au0828_write(dev, REG_001, 0x0);
292 au0828_write(dev, REG_000, 0x0);
293 msleep(100);
294
295
296 au0828_write(dev, REG_003, 0x02);
297 au0828_write(dev, REG_002, 0xa0);
298 au0828_write(dev, REG_001, 0x02);
299 au0828_write(dev, REG_000, 0xa0);
300 msleep(250);
301 break;
302 }
303 }
304
305
306 struct usb_device_id au0828_usb_id_table[] = {
307 { USB_DEVICE(0x2040, 0x7200),
308 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q },
309 { USB_DEVICE(0x2040, 0x7240),
310 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR850 },
311 { USB_DEVICE(0x0fe9, 0xd620),
312 .driver_info = AU0828_BOARD_DVICO_FUSIONHDTV7 },
313 { USB_DEVICE(0x2040, 0x7210),
314 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q },
315 { USB_DEVICE(0x2040, 0x7217),
316 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q },
317 { USB_DEVICE(0x2040, 0x721b),
318 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q },
319 { USB_DEVICE(0x2040, 0x721e),
320 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q },
321 { USB_DEVICE(0x2040, 0x721f),
322 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q },
323 { USB_DEVICE(0x2040, 0x7280),
324 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q },
325 { USB_DEVICE(0x0fd9, 0x0008),
326 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q },
327 { USB_DEVICE(0x2040, 0x7201),
328 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL },
329 { USB_DEVICE(0x2040, 0x7211),
330 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL },
331 { USB_DEVICE(0x2040, 0x7281),
332 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL },
333 { USB_DEVICE(0x05e1, 0x0480),
334 .driver_info = AU0828_BOARD_HAUPPAUGE_WOODBURY },
335 { USB_DEVICE(0x2040, 0x8200),
336 .driver_info = AU0828_BOARD_HAUPPAUGE_WOODBURY },
337 { USB_DEVICE(0x2040, 0x7260),
338 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q },
339 { USB_DEVICE(0x2040, 0x7213),
340 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q },
341 { USB_DEVICE(0x2040, 0x7270),
342 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q },
343 { },
344 };
345
346 MODULE_DEVICE_TABLE(usb, au0828_usb_id_table);