blob: 9a6f15613a3832d7c17754938098ed7f815458aa [file] [log] [blame]
Steven Toth265a6512008-04-18 21:34:00 -03001/*
2 * Driver for the Auvitek USB bridge
3 *
Steven Toth6d897612008-09-03 17:12:12 -03004 * Copyright (c) 2008 Steven Toth <stoth@linuxtv.org>
Steven Toth265a6512008-04-18 21:34:00 -03005 *
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.
10 *
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
14 *
15 * GNU General Public License for more details.
16 *
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.
20 */
21
22#include <linux/module.h>
Tejun Heo5a0e3ad2010-03-24 17:04:11 +090023#include <linux/slab.h>
Steven Toth265a6512008-04-18 21:34:00 -030024#include <linux/init.h>
25#include <linux/device.h>
26#include <linux/suspend.h>
27#include <media/v4l2-common.h>
Michael Krufkybe183dc2012-04-08 21:39:56 -030028#include <media/tuner.h>
Steven Toth265a6512008-04-18 21:34:00 -030029
30#include "au0828.h"
Steven Toth265a6512008-04-18 21:34:00 -030031#include "au8522.h"
32#include "xc5000.h"
Michael Krufky59d27522008-07-09 00:23:08 -030033#include "mxl5007t.h"
Michael Krufky8e8bd222008-09-03 16:46:36 -030034#include "tda18271.h"
Steven Toth265a6512008-04-18 21:34:00 -030035
36DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
37
Steven Totha9c36aa2008-04-17 21:41:28 -030038#define _AU0828_BULKPIPE 0x83
39#define _BULKPIPESIZE 0xe522
40
Michael Krufkyadeeac32008-04-05 20:55:14 -030041static u8 hauppauge_hvr950q_led_states[] = {
42 0x00, /* off */
43 0x02, /* yellow */
44 0x04, /* green */
45};
46
47static struct au8522_led_config hauppauge_hvr950q_led_cfg = {
48 .gpio_output = 0x00e0,
49 .gpio_output_enable = 0x6006,
50 .gpio_output_disable = 0x0660,
51
52 .gpio_leds = 0x00e2,
53 .led_states = hauppauge_hvr950q_led_states,
54 .num_led_states = sizeof(hauppauge_hvr950q_led_states),
55
56 .vsb8_strong = 20 /* dB */ * 10,
57 .qam64_strong = 25 /* dB */ * 10,
58 .qam256_strong = 32 /* dB */ * 10,
59};
60
Steven Toth265a6512008-04-18 21:34:00 -030061static struct au8522_config hauppauge_hvr950q_config = {
62 .demod_address = 0x8e >> 1,
63 .status_mode = AU8522_DEMODLOCKING,
Michael Krufkye908b6e2008-09-03 16:46:43 -030064 .qam_if = AU8522_IF_6MHZ,
65 .vsb_if = AU8522_IF_6MHZ,
Michael Krufkyadeeac32008-04-05 20:55:14 -030066 .led_cfg = &hauppauge_hvr950q_led_cfg,
67};
68
69static struct au8522_config fusionhdtv7usb_config = {
70 .demod_address = 0x8e >> 1,
71 .status_mode = AU8522_DEMODLOCKING,
72 .qam_if = AU8522_IF_6MHZ,
73 .vsb_if = AU8522_IF_6MHZ,
Steven Toth265a6512008-04-18 21:34:00 -030074};
75
Michael Krufky8e8bd222008-09-03 16:46:36 -030076static struct au8522_config hauppauge_woodbury_config = {
77 .demod_address = 0x8e >> 1,
78 .status_mode = AU8522_DEMODLOCKING,
79 .qam_if = AU8522_IF_4MHZ,
80 .vsb_if = AU8522_IF_3_25MHZ,
81};
82
Michael Krufkybe183dc2012-04-08 21:39:56 -030083static struct xc5000_config hauppauge_xc5000a_config = {
Steven Toth265a6512008-04-18 21:34:00 -030084 .i2c_address = 0x61,
85 .if_khz = 6000,
Michael Krufkybe183dc2012-04-08 21:39:56 -030086 .chip_id = XC5000A,
87};
88
89static struct xc5000_config hauppauge_xc5000c_config = {
90 .i2c_address = 0x61,
91 .if_khz = 6000,
92 .chip_id = XC5000C,
Steven Toth265a6512008-04-18 21:34:00 -030093};
94
Michael Krufky59d27522008-07-09 00:23:08 -030095static struct mxl5007t_config mxl5007t_hvr950q_config = {
96 .xtal_freq_hz = MxL_XTAL_24_MHZ,
97 .if_freq_hz = MxL_IF_6_MHZ,
98};
99
Michael Krufky8e8bd222008-09-03 16:46:36 -0300100static struct tda18271_config hauppauge_woodbury_tunerconfig = {
101 .gate = TDA18271_GATE_DIGITAL,
102};
103
Devin Heitmueller43f2ccc2012-08-06 22:46:53 -0300104static void au0828_restart_dvb_streaming(struct work_struct *work);
105
Steven Toth265a6512008-04-18 21:34:00 -0300106/*-------------------------------------------------------------------*/
107static void urb_completion(struct urb *purb)
108{
Steven Toth265a6512008-04-18 21:34:00 -0300109 struct au0828_dev *dev = purb->context;
110 int ptype = usb_pipetype(purb->pipe);
Devin Heitmueller43f2ccc2012-08-06 22:46:53 -0300111 unsigned char *ptr;
Steven Toth265a6512008-04-18 21:34:00 -0300112
Michael Krufkyf07e8e42008-04-18 21:42:30 -0300113 dprintk(2, "%s()\n", __func__);
Steven Tothbc3c6132008-04-18 21:39:11 -0300114
Steven Toth9c26de552008-04-02 01:10:40 -0300115 if (!dev)
116 return;
117
Steven Toth265a6512008-04-18 21:34:00 -0300118 if (dev->urb_streaming == 0)
119 return;
120
121 if (ptype != PIPE_BULK) {
Michael Krufkyf07e8e42008-04-18 21:42:30 -0300122 printk(KERN_ERR "%s() Unsupported URB type %d\n",
123 __func__, ptype);
Steven Toth265a6512008-04-18 21:34:00 -0300124 return;
125 }
126
Devin Heitmueller43f2ccc2012-08-06 22:46:53 -0300127 /* See if the stream is corrupted (to work around a hardware
128 bug where the stream gets misaligned */
129 ptr = purb->transfer_buffer;
130 if (purb->actual_length > 0 && ptr[0] != 0x47) {
131 dprintk(1, "Need to restart streaming %02x len=%d!\n",
132 ptr[0], purb->actual_length);
133 schedule_work(&dev->restart_streaming);
134 return;
135 }
136
Steven Toth265a6512008-04-18 21:34:00 -0300137 /* Feed the transport payload into the kernel demux */
Steven Totha9c36aa2008-04-17 21:41:28 -0300138 dvb_dmx_swfilter_packets(&dev->dvb.demux,
139 purb->transfer_buffer, purb->actual_length / 188);
Steven Toth265a6512008-04-18 21:34:00 -0300140
141 /* Clean the buffer before we requeue */
142 memset(purb->transfer_buffer, 0, URB_BUFSIZE);
143
144 /* Requeue URB */
145 usb_submit_urb(purb, GFP_ATOMIC);
146}
147
148static int stop_urb_transfer(struct au0828_dev *dev)
149{
150 int i;
151
Michael Krufkyf07e8e42008-04-18 21:42:30 -0300152 dprintk(2, "%s()\n", __func__);
Steven Toth265a6512008-04-18 21:34:00 -0300153
Devin Heitmueller43f2ccc2012-08-06 22:46:53 -0300154 dev->urb_streaming = 0;
Steven Toth265a6512008-04-18 21:34:00 -0300155 for (i = 0; i < URB_COUNT; i++) {
156 usb_kill_urb(dev->urbs[i]);
157 kfree(dev->urbs[i]->transfer_buffer);
158 usb_free_urb(dev->urbs[i]);
159 }
160
Steven Toth265a6512008-04-18 21:34:00 -0300161 return 0;
162}
163
Steven Toth265a6512008-04-18 21:34:00 -0300164static int start_urb_transfer(struct au0828_dev *dev)
165{
166 struct urb *purb;
167 int i, ret = -ENOMEM;
Steven Toth265a6512008-04-18 21:34:00 -0300168
Michael Krufkyf07e8e42008-04-18 21:42:30 -0300169 dprintk(2, "%s()\n", __func__);
Steven Toth265a6512008-04-18 21:34:00 -0300170
171 if (dev->urb_streaming) {
Michael Krufky53761762009-07-27 17:35:59 -0300172 dprintk(2, "%s: bulk xfer already running!\n", __func__);
Steven Toth265a6512008-04-18 21:34:00 -0300173 return 0;
174 }
175
176 for (i = 0; i < URB_COUNT; i++) {
177
178 dev->urbs[i] = usb_alloc_urb(0, GFP_KERNEL);
Mauro Carvalho Chehab18d73c52008-04-18 22:12:52 -0300179 if (!dev->urbs[i])
Steven Toth265a6512008-04-18 21:34:00 -0300180 goto err;
Steven Toth265a6512008-04-18 21:34:00 -0300181
182 purb = dev->urbs[i];
183
184 purb->transfer_buffer = kzalloc(URB_BUFSIZE, GFP_KERNEL);
185 if (!purb->transfer_buffer) {
186 usb_free_urb(purb);
Harvey Harrisona6a3a172008-04-28 16:50:03 -0700187 dev->urbs[i] = NULL;
Steven Toth265a6512008-04-18 21:34:00 -0300188 goto err;
189 }
190
191 purb->status = -EINPROGRESS;
192 usb_fill_bulk_urb(purb,
193 dev->usbdev,
Steven Totha8eb9122008-10-16 20:19:41 -0300194 usb_rcvbulkpipe(dev->usbdev,
195 _AU0828_BULKPIPE),
Steven Toth265a6512008-04-18 21:34:00 -0300196 purb->transfer_buffer,
197 URB_BUFSIZE,
198 urb_completion,
199 dev);
200
201 }
202
203 for (i = 0; i < URB_COUNT; i++) {
204 ret = usb_submit_urb(dev->urbs[i], GFP_ATOMIC);
205 if (ret != 0) {
206 stop_urb_transfer(dev);
Michael Krufkyf07e8e42008-04-18 21:42:30 -0300207 printk(KERN_ERR "%s: failed urb submission, "
208 "err = %d\n", __func__, ret);
Steven Toth265a6512008-04-18 21:34:00 -0300209 return ret;
210 }
211 }
212
213 dev->urb_streaming = 1;
214 ret = 0;
215
216err:
217 return ret;
218}
219
220static int au0828_dvb_start_feed(struct dvb_demux_feed *feed)
221{
222 struct dvb_demux *demux = feed->demux;
223 struct au0828_dev *dev = (struct au0828_dev *) demux->priv;
224 struct au0828_dvb *dvb = &dev->dvb;
225 int ret = 0;
226
Michael Krufkyf07e8e42008-04-18 21:42:30 -0300227 dprintk(1, "%s()\n", __func__);
Steven Toth265a6512008-04-18 21:34:00 -0300228
229 if (!demux->dmx.frontend)
230 return -EINVAL;
231
Steven Toth265a6512008-04-18 21:34:00 -0300232 if (dvb) {
233 mutex_lock(&dvb->lock);
234 if (dvb->feeding++ == 0) {
Steven Tothbc3c6132008-04-18 21:39:11 -0300235 /* Start transport */
Steven Toth265a6512008-04-18 21:34:00 -0300236 au0828_write(dev, 0x608, 0x90);
237 au0828_write(dev, 0x609, 0x72);
238 au0828_write(dev, 0x60a, 0x71);
239 au0828_write(dev, 0x60b, 0x01);
240 ret = start_urb_transfer(dev);
241 }
242 mutex_unlock(&dvb->lock);
243 }
244
245 return ret;
246}
247
248static int au0828_dvb_stop_feed(struct dvb_demux_feed *feed)
249{
250 struct dvb_demux *demux = feed->demux;
251 struct au0828_dev *dev = (struct au0828_dev *) demux->priv;
252 struct au0828_dvb *dvb = &dev->dvb;
253 int ret = 0;
254
Michael Krufkyf07e8e42008-04-18 21:42:30 -0300255 dprintk(1, "%s()\n", __func__);
Steven Toth265a6512008-04-18 21:34:00 -0300256
257 if (dvb) {
258 mutex_lock(&dvb->lock);
259 if (--dvb->feeding == 0) {
Steven Tothbc3c6132008-04-18 21:39:11 -0300260 /* Stop transport */
Steven Toth265a6512008-04-18 21:34:00 -0300261 ret = stop_urb_transfer(dev);
Devin Heitmueller43f2ccc2012-08-06 22:46:53 -0300262 au0828_write(dev, 0x60b, 0x00);
Steven Toth265a6512008-04-18 21:34:00 -0300263 }
264 mutex_unlock(&dvb->lock);
265 }
266
267 return ret;
268}
269
Devin Heitmueller43f2ccc2012-08-06 22:46:53 -0300270static void au0828_restart_dvb_streaming(struct work_struct *work)
271{
272 struct au0828_dev *dev = container_of(work, struct au0828_dev,
273 restart_streaming);
274 struct au0828_dvb *dvb = &dev->dvb;
Devin Heitmueller43f2ccc2012-08-06 22:46:53 -0300275
276 if (dev->urb_streaming == 0)
277 return;
278
279 dprintk(1, "Restarting streaming...!\n");
280
281 mutex_lock(&dvb->lock);
282
283 /* Stop transport */
Mauro Carvalho Chehab2e7b3182012-10-27 16:36:34 -0300284 stop_urb_transfer(dev);
Devin Heitmueller43f2ccc2012-08-06 22:46:53 -0300285 au0828_write(dev, 0x608, 0x00);
286 au0828_write(dev, 0x609, 0x00);
287 au0828_write(dev, 0x60a, 0x00);
288 au0828_write(dev, 0x60b, 0x00);
289
290 /* Start transport */
291 au0828_write(dev, 0x608, 0x90);
292 au0828_write(dev, 0x609, 0x72);
293 au0828_write(dev, 0x60a, 0x71);
294 au0828_write(dev, 0x60b, 0x01);
Mauro Carvalho Chehab2e7b3182012-10-27 16:36:34 -0300295 start_urb_transfer(dev);
Devin Heitmueller43f2ccc2012-08-06 22:46:53 -0300296
297 mutex_unlock(&dvb->lock);
298}
299
Adrian Bunkb33d24c2008-04-25 19:06:03 -0300300static int dvb_register(struct au0828_dev *dev)
Steven Toth265a6512008-04-18 21:34:00 -0300301{
302 struct au0828_dvb *dvb = &dev->dvb;
303 int result;
304
Michael Krufkyf07e8e42008-04-18 21:42:30 -0300305 dprintk(1, "%s()\n", __func__);
Steven Tothbc3c6132008-04-18 21:39:11 -0300306
Devin Heitmueller43f2ccc2012-08-06 22:46:53 -0300307 INIT_WORK(&dev->restart_streaming, au0828_restart_dvb_streaming);
308
Steven Toth265a6512008-04-18 21:34:00 -0300309 /* register adapter */
310 result = dvb_register_adapter(&dvb->adapter, DRIVER_NAME, THIS_MODULE,
311 &dev->usbdev->dev, adapter_nr);
312 if (result < 0) {
Michael Krufkyf07e8e42008-04-18 21:42:30 -0300313 printk(KERN_ERR "%s: dvb_register_adapter failed "
314 "(errno = %d)\n", DRIVER_NAME, result);
Steven Toth265a6512008-04-18 21:34:00 -0300315 goto fail_adapter;
316 }
317 dvb->adapter.priv = dev;
318
319 /* register frontend */
320 result = dvb_register_frontend(&dvb->adapter, dvb->frontend);
321 if (result < 0) {
Michael Krufkyf07e8e42008-04-18 21:42:30 -0300322 printk(KERN_ERR "%s: dvb_register_frontend failed "
323 "(errno = %d)\n", DRIVER_NAME, result);
Steven Toth265a6512008-04-18 21:34:00 -0300324 goto fail_frontend;
325 }
326
327 /* register demux stuff */
328 dvb->demux.dmx.capabilities =
329 DMX_TS_FILTERING | DMX_SECTION_FILTERING |
330 DMX_MEMORY_BASED_FILTERING;
331 dvb->demux.priv = dev;
332 dvb->demux.filternum = 256;
333 dvb->demux.feednum = 256;
334 dvb->demux.start_feed = au0828_dvb_start_feed;
335 dvb->demux.stop_feed = au0828_dvb_stop_feed;
336 result = dvb_dmx_init(&dvb->demux);
337 if (result < 0) {
Steven Tothbc3c6132008-04-18 21:39:11 -0300338 printk(KERN_ERR "%s: dvb_dmx_init failed (errno = %d)\n",
Steven Toth265a6512008-04-18 21:34:00 -0300339 DRIVER_NAME, result);
340 goto fail_dmx;
341 }
342
343 dvb->dmxdev.filternum = 256;
344 dvb->dmxdev.demux = &dvb->demux.dmx;
345 dvb->dmxdev.capabilities = 0;
346 result = dvb_dmxdev_init(&dvb->dmxdev, &dvb->adapter);
347 if (result < 0) {
Steven Tothbc3c6132008-04-18 21:39:11 -0300348 printk(KERN_ERR "%s: dvb_dmxdev_init failed (errno = %d)\n",
Steven Toth265a6512008-04-18 21:34:00 -0300349 DRIVER_NAME, result);
350 goto fail_dmxdev;
351 }
352
353 dvb->fe_hw.source = DMX_FRONTEND_0;
354 result = dvb->demux.dmx.add_frontend(&dvb->demux.dmx, &dvb->fe_hw);
355 if (result < 0) {
Michael Krufkyf07e8e42008-04-18 21:42:30 -0300356 printk(KERN_ERR "%s: add_frontend failed "
357 "(DMX_FRONTEND_0, errno = %d)\n", DRIVER_NAME, result);
Steven Toth265a6512008-04-18 21:34:00 -0300358 goto fail_fe_hw;
359 }
360
361 dvb->fe_mem.source = DMX_MEMORY_FE;
362 result = dvb->demux.dmx.add_frontend(&dvb->demux.dmx, &dvb->fe_mem);
363 if (result < 0) {
Michael Krufkyf07e8e42008-04-18 21:42:30 -0300364 printk(KERN_ERR "%s: add_frontend failed "
365 "(DMX_MEMORY_FE, errno = %d)\n", DRIVER_NAME, result);
Steven Toth265a6512008-04-18 21:34:00 -0300366 goto fail_fe_mem;
367 }
368
369 result = dvb->demux.dmx.connect_frontend(&dvb->demux.dmx, &dvb->fe_hw);
370 if (result < 0) {
Steven Tothbc3c6132008-04-18 21:39:11 -0300371 printk(KERN_ERR "%s: connect_frontend failed (errno = %d)\n",
Steven Toth265a6512008-04-18 21:34:00 -0300372 DRIVER_NAME, result);
373 goto fail_fe_conn;
374 }
375
376 /* register network adapter */
377 dvb_net_init(&dvb->adapter, &dvb->net, &dvb->demux.dmx);
378 return 0;
379
380fail_fe_conn:
381 dvb->demux.dmx.remove_frontend(&dvb->demux.dmx, &dvb->fe_mem);
382fail_fe_mem:
383 dvb->demux.dmx.remove_frontend(&dvb->demux.dmx, &dvb->fe_hw);
384fail_fe_hw:
385 dvb_dmxdev_release(&dvb->dmxdev);
386fail_dmxdev:
387 dvb_dmx_release(&dvb->demux);
388fail_dmx:
389 dvb_unregister_frontend(dvb->frontend);
390fail_frontend:
391 dvb_frontend_detach(dvb->frontend);
392 dvb_unregister_adapter(&dvb->adapter);
393fail_adapter:
394 return result;
395}
396
397void au0828_dvb_unregister(struct au0828_dev *dev)
398{
399 struct au0828_dvb *dvb = &dev->dvb;
400
Michael Krufkyf07e8e42008-04-18 21:42:30 -0300401 dprintk(1, "%s()\n", __func__);
Steven Tothbc3c6132008-04-18 21:39:11 -0300402
Steven Totha9c36aa2008-04-17 21:41:28 -0300403 if (dvb->frontend == NULL)
Steven Toth9c26de552008-04-02 01:10:40 -0300404 return;
405
Steven Toth265a6512008-04-18 21:34:00 -0300406 dvb_net_release(&dvb->net);
407 dvb->demux.dmx.remove_frontend(&dvb->demux.dmx, &dvb->fe_mem);
408 dvb->demux.dmx.remove_frontend(&dvb->demux.dmx, &dvb->fe_hw);
409 dvb_dmxdev_release(&dvb->dmxdev);
410 dvb_dmx_release(&dvb->demux);
411 dvb_unregister_frontend(dvb->frontend);
412 dvb_frontend_detach(dvb->frontend);
413 dvb_unregister_adapter(&dvb->adapter);
414}
415
416/* All the DVB attach calls go here, this function get's modified
417 * for each new card. No other function in this file needs
418 * to change.
419 */
420int au0828_dvb_register(struct au0828_dev *dev)
421{
422 struct au0828_dvb *dvb = &dev->dvb;
423 int ret;
424
Michael Krufkyf07e8e42008-04-18 21:42:30 -0300425 dprintk(1, "%s()\n", __func__);
Steven Tothbc3c6132008-04-18 21:39:11 -0300426
Steven Toth265a6512008-04-18 21:34:00 -0300427 /* init frontend */
Devin Heitmuellerf1add5b2009-03-11 03:00:47 -0300428 switch (dev->boardnr) {
Steven Toth265a6512008-04-18 21:34:00 -0300429 case AU0828_BOARD_HAUPPAUGE_HVR850:
430 case AU0828_BOARD_HAUPPAUGE_HVR950Q:
Steven Toth265a6512008-04-18 21:34:00 -0300431 dvb->frontend = dvb_attach(au8522_attach,
432 &hauppauge_hvr950q_config,
433 &dev->i2c_adap);
Michael Krufky48723542008-05-10 14:34:09 -0300434 if (dvb->frontend != NULL)
Michael Krufkybe183dc2012-04-08 21:39:56 -0300435 switch (dev->board.tuner_type) {
436 default:
437 case TUNER_XC5000:
438 dvb_attach(xc5000_attach, dvb->frontend,
439 &dev->i2c_adap,
440 &hauppauge_xc5000a_config);
441 break;
442 case TUNER_XC5000C:
443 dvb_attach(xc5000_attach, dvb->frontend,
444 &dev->i2c_adap,
445 &hauppauge_xc5000c_config);
446 break;
447 }
Steven Toth265a6512008-04-18 21:34:00 -0300448 break;
Michael Krufky59d27522008-07-09 00:23:08 -0300449 case AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL:
450 dvb->frontend = dvb_attach(au8522_attach,
451 &hauppauge_hvr950q_config,
452 &dev->i2c_adap);
453 if (dvb->frontend != NULL)
454 dvb_attach(mxl5007t_attach, dvb->frontend,
455 &dev->i2c_adap, 0x60,
456 &mxl5007t_hvr950q_config);
457 break;
Michael Krufky8e8bd222008-09-03 16:46:36 -0300458 case AU0828_BOARD_HAUPPAUGE_WOODBURY:
459 dvb->frontend = dvb_attach(au8522_attach,
460 &hauppauge_woodbury_config,
461 &dev->i2c_adap);
462 if (dvb->frontend != NULL)
463 dvb_attach(tda18271_attach, dvb->frontend,
464 0x60, &dev->i2c_adap,
465 &hauppauge_woodbury_tunerconfig);
466 break;
Michael Krufkyadeeac32008-04-05 20:55:14 -0300467 case AU0828_BOARD_DVICO_FUSIONHDTV7:
468 dvb->frontend = dvb_attach(au8522_attach,
469 &fusionhdtv7usb_config,
470 &dev->i2c_adap);
471 if (dvb->frontend != NULL) {
472 dvb_attach(xc5000_attach, dvb->frontend,
473 &dev->i2c_adap,
Michael Krufkybe183dc2012-04-08 21:39:56 -0300474 &hauppauge_xc5000a_config);
Michael Krufkyadeeac32008-04-05 20:55:14 -0300475 }
476 break;
Steven Toth265a6512008-04-18 21:34:00 -0300477 default:
Michael Krufkyf07e8e42008-04-18 21:42:30 -0300478 printk(KERN_WARNING "The frontend of your DVB/ATSC card "
479 "isn't supported yet\n");
Steven Toth265a6512008-04-18 21:34:00 -0300480 break;
481 }
482 if (NULL == dvb->frontend) {
Michael Krufkyf07e8e42008-04-18 21:42:30 -0300483 printk(KERN_ERR "%s() Frontend initialization failed\n",
484 __func__);
Steven Toth265a6512008-04-18 21:34:00 -0300485 return -1;
486 }
Michael Krufkyd7cba042008-09-12 13:31:45 -0300487 /* define general-purpose callback pointer */
488 dvb->frontend->callback = au0828_tuner_callback;
Steven Toth265a6512008-04-18 21:34:00 -0300489
Steven Toth265a6512008-04-18 21:34:00 -0300490 /* register everything */
491 ret = dvb_register(dev);
492 if (ret < 0) {
493 if (dvb->frontend->ops.release)
494 dvb->frontend->ops.release(dvb->frontend);
495 return ret;
496 }
497
498 return 0;
499}