Steven Toth | 265a651 | 2008-04-18 21:34:00 -0300 | [diff] [blame] | 1 | /* |
| 2 | * Driver for the Auvitek USB bridge |
| 3 | * |
| 4 | * Copyright (c) 2008 Steven Toth <stoth@hauppauge.com> |
| 5 | * |
| 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> |
| 23 | #include <linux/init.h> |
| 24 | #include <linux/device.h> |
| 25 | #include <linux/suspend.h> |
| 26 | #include <media/v4l2-common.h> |
| 27 | |
| 28 | #include "au0828.h" |
Steven Toth | 265a651 | 2008-04-18 21:34:00 -0300 | [diff] [blame] | 29 | #include "au8522.h" |
| 30 | #include "xc5000.h" |
Michael Krufky | 59d2752 | 2008-07-09 00:23:08 -0300 | [diff] [blame] | 31 | #include "mxl5007t.h" |
Michael Krufky | 8e8bd22 | 2008-09-03 16:46:36 -0300 | [diff] [blame] | 32 | #include "tda18271.h" |
Steven Toth | 265a651 | 2008-04-18 21:34:00 -0300 | [diff] [blame] | 33 | |
| 34 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); |
| 35 | |
Steven Toth | a9c36aa | 2008-04-17 21:41:28 -0300 | [diff] [blame] | 36 | #define _AU0828_BULKPIPE 0x83 |
| 37 | #define _BULKPIPESIZE 0xe522 |
| 38 | |
Steven Toth | 265a651 | 2008-04-18 21:34:00 -0300 | [diff] [blame] | 39 | static struct au8522_config hauppauge_hvr950q_config = { |
| 40 | .demod_address = 0x8e >> 1, |
| 41 | .status_mode = AU8522_DEMODLOCKING, |
| 42 | }; |
| 43 | |
Michael Krufky | 8e8bd22 | 2008-09-03 16:46:36 -0300 | [diff] [blame] | 44 | static struct au8522_config hauppauge_woodbury_config = { |
| 45 | .demod_address = 0x8e >> 1, |
| 46 | .status_mode = AU8522_DEMODLOCKING, |
| 47 | .qam_if = AU8522_IF_4MHZ, |
| 48 | .vsb_if = AU8522_IF_3_25MHZ, |
| 49 | }; |
| 50 | |
Steven Toth | 265a651 | 2008-04-18 21:34:00 -0300 | [diff] [blame] | 51 | static struct xc5000_config hauppauge_hvr950q_tunerconfig = { |
| 52 | .i2c_address = 0x61, |
| 53 | .if_khz = 6000, |
| 54 | .tuner_callback = au0828_tuner_callback |
| 55 | }; |
| 56 | |
Michael Krufky | 59d2752 | 2008-07-09 00:23:08 -0300 | [diff] [blame] | 57 | static struct mxl5007t_config mxl5007t_hvr950q_config = { |
| 58 | .xtal_freq_hz = MxL_XTAL_24_MHZ, |
| 59 | .if_freq_hz = MxL_IF_6_MHZ, |
| 60 | }; |
| 61 | |
Michael Krufky | 8e8bd22 | 2008-09-03 16:46:36 -0300 | [diff] [blame] | 62 | static struct tda18271_config hauppauge_woodbury_tunerconfig = { |
| 63 | .gate = TDA18271_GATE_DIGITAL, |
| 64 | }; |
| 65 | |
Steven Toth | 265a651 | 2008-04-18 21:34:00 -0300 | [diff] [blame] | 66 | /*-------------------------------------------------------------------*/ |
| 67 | static void urb_completion(struct urb *purb) |
| 68 | { |
| 69 | u8 *ptr; |
| 70 | struct au0828_dev *dev = purb->context; |
| 71 | int ptype = usb_pipetype(purb->pipe); |
| 72 | |
Michael Krufky | f07e8e4 | 2008-04-18 21:42:30 -0300 | [diff] [blame] | 73 | dprintk(2, "%s()\n", __func__); |
Steven Toth | bc3c613 | 2008-04-18 21:39:11 -0300 | [diff] [blame] | 74 | |
Steven Toth | 9c26de55 | 2008-04-02 01:10:40 -0300 | [diff] [blame] | 75 | if (!dev) |
| 76 | return; |
| 77 | |
Steven Toth | 265a651 | 2008-04-18 21:34:00 -0300 | [diff] [blame] | 78 | if (dev->urb_streaming == 0) |
| 79 | return; |
| 80 | |
| 81 | if (ptype != PIPE_BULK) { |
Michael Krufky | f07e8e4 | 2008-04-18 21:42:30 -0300 | [diff] [blame] | 82 | printk(KERN_ERR "%s() Unsupported URB type %d\n", |
| 83 | __func__, ptype); |
Steven Toth | 265a651 | 2008-04-18 21:34:00 -0300 | [diff] [blame] | 84 | return; |
| 85 | } |
| 86 | |
| 87 | ptr = (u8 *)purb->transfer_buffer; |
| 88 | |
| 89 | /* Feed the transport payload into the kernel demux */ |
Steven Toth | a9c36aa | 2008-04-17 21:41:28 -0300 | [diff] [blame] | 90 | dvb_dmx_swfilter_packets(&dev->dvb.demux, |
| 91 | purb->transfer_buffer, purb->actual_length / 188); |
Steven Toth | 265a651 | 2008-04-18 21:34:00 -0300 | [diff] [blame] | 92 | |
| 93 | /* Clean the buffer before we requeue */ |
| 94 | memset(purb->transfer_buffer, 0, URB_BUFSIZE); |
| 95 | |
| 96 | /* Requeue URB */ |
| 97 | usb_submit_urb(purb, GFP_ATOMIC); |
| 98 | } |
| 99 | |
| 100 | static int stop_urb_transfer(struct au0828_dev *dev) |
| 101 | { |
| 102 | int i; |
| 103 | |
Michael Krufky | f07e8e4 | 2008-04-18 21:42:30 -0300 | [diff] [blame] | 104 | dprintk(2, "%s()\n", __func__); |
Steven Toth | 265a651 | 2008-04-18 21:34:00 -0300 | [diff] [blame] | 105 | |
Steven Toth | 265a651 | 2008-04-18 21:34:00 -0300 | [diff] [blame] | 106 | for (i = 0; i < URB_COUNT; i++) { |
| 107 | usb_kill_urb(dev->urbs[i]); |
| 108 | kfree(dev->urbs[i]->transfer_buffer); |
| 109 | usb_free_urb(dev->urbs[i]); |
| 110 | } |
| 111 | |
| 112 | dev->urb_streaming = 0; |
| 113 | |
| 114 | return 0; |
| 115 | } |
| 116 | |
Steven Toth | 265a651 | 2008-04-18 21:34:00 -0300 | [diff] [blame] | 117 | static int start_urb_transfer(struct au0828_dev *dev) |
| 118 | { |
| 119 | struct urb *purb; |
| 120 | int i, ret = -ENOMEM; |
Steven Toth | 265a651 | 2008-04-18 21:34:00 -0300 | [diff] [blame] | 121 | |
Michael Krufky | f07e8e4 | 2008-04-18 21:42:30 -0300 | [diff] [blame] | 122 | dprintk(2, "%s()\n", __func__); |
Steven Toth | 265a651 | 2008-04-18 21:34:00 -0300 | [diff] [blame] | 123 | |
| 124 | if (dev->urb_streaming) { |
Michael Krufky | f07e8e4 | 2008-04-18 21:42:30 -0300 | [diff] [blame] | 125 | dprintk(2, "%s: iso xfer already running!\n", __func__); |
Steven Toth | 265a651 | 2008-04-18 21:34:00 -0300 | [diff] [blame] | 126 | return 0; |
| 127 | } |
| 128 | |
| 129 | for (i = 0; i < URB_COUNT; i++) { |
| 130 | |
| 131 | dev->urbs[i] = usb_alloc_urb(0, GFP_KERNEL); |
Mauro Carvalho Chehab | 18d73c5 | 2008-04-18 22:12:52 -0300 | [diff] [blame] | 132 | if (!dev->urbs[i]) |
Steven Toth | 265a651 | 2008-04-18 21:34:00 -0300 | [diff] [blame] | 133 | goto err; |
Steven Toth | 265a651 | 2008-04-18 21:34:00 -0300 | [diff] [blame] | 134 | |
| 135 | purb = dev->urbs[i]; |
| 136 | |
| 137 | purb->transfer_buffer = kzalloc(URB_BUFSIZE, GFP_KERNEL); |
| 138 | if (!purb->transfer_buffer) { |
| 139 | usb_free_urb(purb); |
Harvey Harrison | a6a3a17 | 2008-04-28 16:50:03 -0700 | [diff] [blame] | 140 | dev->urbs[i] = NULL; |
Steven Toth | 265a651 | 2008-04-18 21:34:00 -0300 | [diff] [blame] | 141 | goto err; |
| 142 | } |
| 143 | |
| 144 | purb->status = -EINPROGRESS; |
| 145 | usb_fill_bulk_urb(purb, |
| 146 | dev->usbdev, |
| 147 | usb_rcvbulkpipe(dev->usbdev, _AU0828_BULKPIPE), |
| 148 | purb->transfer_buffer, |
| 149 | URB_BUFSIZE, |
| 150 | urb_completion, |
| 151 | dev); |
| 152 | |
| 153 | } |
| 154 | |
| 155 | for (i = 0; i < URB_COUNT; i++) { |
| 156 | ret = usb_submit_urb(dev->urbs[i], GFP_ATOMIC); |
| 157 | if (ret != 0) { |
| 158 | stop_urb_transfer(dev); |
Michael Krufky | f07e8e4 | 2008-04-18 21:42:30 -0300 | [diff] [blame] | 159 | printk(KERN_ERR "%s: failed urb submission, " |
| 160 | "err = %d\n", __func__, ret); |
Steven Toth | 265a651 | 2008-04-18 21:34:00 -0300 | [diff] [blame] | 161 | return ret; |
| 162 | } |
| 163 | } |
| 164 | |
| 165 | dev->urb_streaming = 1; |
| 166 | ret = 0; |
| 167 | |
| 168 | err: |
| 169 | return ret; |
| 170 | } |
| 171 | |
| 172 | static int au0828_dvb_start_feed(struct dvb_demux_feed *feed) |
| 173 | { |
| 174 | struct dvb_demux *demux = feed->demux; |
| 175 | struct au0828_dev *dev = (struct au0828_dev *) demux->priv; |
| 176 | struct au0828_dvb *dvb = &dev->dvb; |
| 177 | int ret = 0; |
| 178 | |
Michael Krufky | f07e8e4 | 2008-04-18 21:42:30 -0300 | [diff] [blame] | 179 | dprintk(1, "%s()\n", __func__); |
Steven Toth | 265a651 | 2008-04-18 21:34:00 -0300 | [diff] [blame] | 180 | |
| 181 | if (!demux->dmx.frontend) |
| 182 | return -EINVAL; |
| 183 | |
Steven Toth | 265a651 | 2008-04-18 21:34:00 -0300 | [diff] [blame] | 184 | if (dvb) { |
| 185 | mutex_lock(&dvb->lock); |
| 186 | if (dvb->feeding++ == 0) { |
Steven Toth | bc3c613 | 2008-04-18 21:39:11 -0300 | [diff] [blame] | 187 | /* Start transport */ |
Steven Toth | 265a651 | 2008-04-18 21:34:00 -0300 | [diff] [blame] | 188 | au0828_write(dev, 0x608, 0x90); |
| 189 | au0828_write(dev, 0x609, 0x72); |
| 190 | au0828_write(dev, 0x60a, 0x71); |
| 191 | au0828_write(dev, 0x60b, 0x01); |
| 192 | ret = start_urb_transfer(dev); |
| 193 | } |
| 194 | mutex_unlock(&dvb->lock); |
| 195 | } |
| 196 | |
| 197 | return ret; |
| 198 | } |
| 199 | |
| 200 | static int au0828_dvb_stop_feed(struct dvb_demux_feed *feed) |
| 201 | { |
| 202 | struct dvb_demux *demux = feed->demux; |
| 203 | struct au0828_dev *dev = (struct au0828_dev *) demux->priv; |
| 204 | struct au0828_dvb *dvb = &dev->dvb; |
| 205 | int ret = 0; |
| 206 | |
Michael Krufky | f07e8e4 | 2008-04-18 21:42:30 -0300 | [diff] [blame] | 207 | dprintk(1, "%s()\n", __func__); |
Steven Toth | 265a651 | 2008-04-18 21:34:00 -0300 | [diff] [blame] | 208 | |
| 209 | if (dvb) { |
| 210 | mutex_lock(&dvb->lock); |
| 211 | if (--dvb->feeding == 0) { |
Steven Toth | bc3c613 | 2008-04-18 21:39:11 -0300 | [diff] [blame] | 212 | /* Stop transport */ |
Steven Toth | 265a651 | 2008-04-18 21:34:00 -0300 | [diff] [blame] | 213 | au0828_write(dev, 0x608, 0x00); |
| 214 | au0828_write(dev, 0x609, 0x00); |
| 215 | au0828_write(dev, 0x60a, 0x00); |
| 216 | au0828_write(dev, 0x60b, 0x00); |
| 217 | ret = stop_urb_transfer(dev); |
| 218 | } |
| 219 | mutex_unlock(&dvb->lock); |
| 220 | } |
| 221 | |
| 222 | return ret; |
| 223 | } |
| 224 | |
Adrian Bunk | b33d24c | 2008-04-25 19:06:03 -0300 | [diff] [blame] | 225 | static int dvb_register(struct au0828_dev *dev) |
Steven Toth | 265a651 | 2008-04-18 21:34:00 -0300 | [diff] [blame] | 226 | { |
| 227 | struct au0828_dvb *dvb = &dev->dvb; |
| 228 | int result; |
| 229 | |
Michael Krufky | f07e8e4 | 2008-04-18 21:42:30 -0300 | [diff] [blame] | 230 | dprintk(1, "%s()\n", __func__); |
Steven Toth | bc3c613 | 2008-04-18 21:39:11 -0300 | [diff] [blame] | 231 | |
Steven Toth | 265a651 | 2008-04-18 21:34:00 -0300 | [diff] [blame] | 232 | /* register adapter */ |
| 233 | result = dvb_register_adapter(&dvb->adapter, DRIVER_NAME, THIS_MODULE, |
| 234 | &dev->usbdev->dev, adapter_nr); |
| 235 | if (result < 0) { |
Michael Krufky | f07e8e4 | 2008-04-18 21:42:30 -0300 | [diff] [blame] | 236 | printk(KERN_ERR "%s: dvb_register_adapter failed " |
| 237 | "(errno = %d)\n", DRIVER_NAME, result); |
Steven Toth | 265a651 | 2008-04-18 21:34:00 -0300 | [diff] [blame] | 238 | goto fail_adapter; |
| 239 | } |
| 240 | dvb->adapter.priv = dev; |
| 241 | |
| 242 | /* register frontend */ |
| 243 | result = dvb_register_frontend(&dvb->adapter, dvb->frontend); |
| 244 | if (result < 0) { |
Michael Krufky | f07e8e4 | 2008-04-18 21:42:30 -0300 | [diff] [blame] | 245 | printk(KERN_ERR "%s: dvb_register_frontend failed " |
| 246 | "(errno = %d)\n", DRIVER_NAME, result); |
Steven Toth | 265a651 | 2008-04-18 21:34:00 -0300 | [diff] [blame] | 247 | goto fail_frontend; |
| 248 | } |
| 249 | |
| 250 | /* register demux stuff */ |
| 251 | dvb->demux.dmx.capabilities = |
| 252 | DMX_TS_FILTERING | DMX_SECTION_FILTERING | |
| 253 | DMX_MEMORY_BASED_FILTERING; |
| 254 | dvb->demux.priv = dev; |
| 255 | dvb->demux.filternum = 256; |
| 256 | dvb->demux.feednum = 256; |
| 257 | dvb->demux.start_feed = au0828_dvb_start_feed; |
| 258 | dvb->demux.stop_feed = au0828_dvb_stop_feed; |
| 259 | result = dvb_dmx_init(&dvb->demux); |
| 260 | if (result < 0) { |
Steven Toth | bc3c613 | 2008-04-18 21:39:11 -0300 | [diff] [blame] | 261 | printk(KERN_ERR "%s: dvb_dmx_init failed (errno = %d)\n", |
Steven Toth | 265a651 | 2008-04-18 21:34:00 -0300 | [diff] [blame] | 262 | DRIVER_NAME, result); |
| 263 | goto fail_dmx; |
| 264 | } |
| 265 | |
| 266 | dvb->dmxdev.filternum = 256; |
| 267 | dvb->dmxdev.demux = &dvb->demux.dmx; |
| 268 | dvb->dmxdev.capabilities = 0; |
| 269 | result = dvb_dmxdev_init(&dvb->dmxdev, &dvb->adapter); |
| 270 | if (result < 0) { |
Steven Toth | bc3c613 | 2008-04-18 21:39:11 -0300 | [diff] [blame] | 271 | printk(KERN_ERR "%s: dvb_dmxdev_init failed (errno = %d)\n", |
Steven Toth | 265a651 | 2008-04-18 21:34:00 -0300 | [diff] [blame] | 272 | DRIVER_NAME, result); |
| 273 | goto fail_dmxdev; |
| 274 | } |
| 275 | |
| 276 | dvb->fe_hw.source = DMX_FRONTEND_0; |
| 277 | result = dvb->demux.dmx.add_frontend(&dvb->demux.dmx, &dvb->fe_hw); |
| 278 | if (result < 0) { |
Michael Krufky | f07e8e4 | 2008-04-18 21:42:30 -0300 | [diff] [blame] | 279 | printk(KERN_ERR "%s: add_frontend failed " |
| 280 | "(DMX_FRONTEND_0, errno = %d)\n", DRIVER_NAME, result); |
Steven Toth | 265a651 | 2008-04-18 21:34:00 -0300 | [diff] [blame] | 281 | goto fail_fe_hw; |
| 282 | } |
| 283 | |
| 284 | dvb->fe_mem.source = DMX_MEMORY_FE; |
| 285 | result = dvb->demux.dmx.add_frontend(&dvb->demux.dmx, &dvb->fe_mem); |
| 286 | if (result < 0) { |
Michael Krufky | f07e8e4 | 2008-04-18 21:42:30 -0300 | [diff] [blame] | 287 | printk(KERN_ERR "%s: add_frontend failed " |
| 288 | "(DMX_MEMORY_FE, errno = %d)\n", DRIVER_NAME, result); |
Steven Toth | 265a651 | 2008-04-18 21:34:00 -0300 | [diff] [blame] | 289 | goto fail_fe_mem; |
| 290 | } |
| 291 | |
| 292 | result = dvb->demux.dmx.connect_frontend(&dvb->demux.dmx, &dvb->fe_hw); |
| 293 | if (result < 0) { |
Steven Toth | bc3c613 | 2008-04-18 21:39:11 -0300 | [diff] [blame] | 294 | printk(KERN_ERR "%s: connect_frontend failed (errno = %d)\n", |
Steven Toth | 265a651 | 2008-04-18 21:34:00 -0300 | [diff] [blame] | 295 | DRIVER_NAME, result); |
| 296 | goto fail_fe_conn; |
| 297 | } |
| 298 | |
| 299 | /* register network adapter */ |
| 300 | dvb_net_init(&dvb->adapter, &dvb->net, &dvb->demux.dmx); |
| 301 | return 0; |
| 302 | |
| 303 | fail_fe_conn: |
| 304 | dvb->demux.dmx.remove_frontend(&dvb->demux.dmx, &dvb->fe_mem); |
| 305 | fail_fe_mem: |
| 306 | dvb->demux.dmx.remove_frontend(&dvb->demux.dmx, &dvb->fe_hw); |
| 307 | fail_fe_hw: |
| 308 | dvb_dmxdev_release(&dvb->dmxdev); |
| 309 | fail_dmxdev: |
| 310 | dvb_dmx_release(&dvb->demux); |
| 311 | fail_dmx: |
| 312 | dvb_unregister_frontend(dvb->frontend); |
| 313 | fail_frontend: |
| 314 | dvb_frontend_detach(dvb->frontend); |
| 315 | dvb_unregister_adapter(&dvb->adapter); |
| 316 | fail_adapter: |
| 317 | return result; |
| 318 | } |
| 319 | |
| 320 | void au0828_dvb_unregister(struct au0828_dev *dev) |
| 321 | { |
| 322 | struct au0828_dvb *dvb = &dev->dvb; |
| 323 | |
Michael Krufky | f07e8e4 | 2008-04-18 21:42:30 -0300 | [diff] [blame] | 324 | dprintk(1, "%s()\n", __func__); |
Steven Toth | bc3c613 | 2008-04-18 21:39:11 -0300 | [diff] [blame] | 325 | |
Steven Toth | a9c36aa | 2008-04-17 21:41:28 -0300 | [diff] [blame] | 326 | if (dvb->frontend == NULL) |
Steven Toth | 9c26de55 | 2008-04-02 01:10:40 -0300 | [diff] [blame] | 327 | return; |
| 328 | |
Steven Toth | 265a651 | 2008-04-18 21:34:00 -0300 | [diff] [blame] | 329 | dvb_net_release(&dvb->net); |
| 330 | dvb->demux.dmx.remove_frontend(&dvb->demux.dmx, &dvb->fe_mem); |
| 331 | dvb->demux.dmx.remove_frontend(&dvb->demux.dmx, &dvb->fe_hw); |
| 332 | dvb_dmxdev_release(&dvb->dmxdev); |
| 333 | dvb_dmx_release(&dvb->demux); |
| 334 | dvb_unregister_frontend(dvb->frontend); |
| 335 | dvb_frontend_detach(dvb->frontend); |
| 336 | dvb_unregister_adapter(&dvb->adapter); |
| 337 | } |
| 338 | |
| 339 | /* All the DVB attach calls go here, this function get's modified |
| 340 | * for each new card. No other function in this file needs |
| 341 | * to change. |
| 342 | */ |
| 343 | int au0828_dvb_register(struct au0828_dev *dev) |
| 344 | { |
| 345 | struct au0828_dvb *dvb = &dev->dvb; |
| 346 | int ret; |
| 347 | |
Michael Krufky | f07e8e4 | 2008-04-18 21:42:30 -0300 | [diff] [blame] | 348 | dprintk(1, "%s()\n", __func__); |
Steven Toth | bc3c613 | 2008-04-18 21:39:11 -0300 | [diff] [blame] | 349 | |
Steven Toth | 265a651 | 2008-04-18 21:34:00 -0300 | [diff] [blame] | 350 | /* init frontend */ |
| 351 | switch (dev->board) { |
| 352 | case AU0828_BOARD_HAUPPAUGE_HVR850: |
| 353 | case AU0828_BOARD_HAUPPAUGE_HVR950Q: |
| 354 | case AU0828_BOARD_DVICO_FUSIONHDTV7: |
| 355 | dvb->frontend = dvb_attach(au8522_attach, |
| 356 | &hauppauge_hvr950q_config, |
| 357 | &dev->i2c_adap); |
Michael Krufky | 4872354 | 2008-05-10 14:34:09 -0300 | [diff] [blame] | 358 | if (dvb->frontend != NULL) |
Steven Toth | 265a651 | 2008-04-18 21:34:00 -0300 | [diff] [blame] | 359 | dvb_attach(xc5000_attach, dvb->frontend, |
| 360 | &dev->i2c_adap, |
Michael Krufky | 4872354 | 2008-05-10 14:34:09 -0300 | [diff] [blame] | 361 | &hauppauge_hvr950q_tunerconfig, dev); |
Steven Toth | 265a651 | 2008-04-18 21:34:00 -0300 | [diff] [blame] | 362 | break; |
Michael Krufky | 59d2752 | 2008-07-09 00:23:08 -0300 | [diff] [blame] | 363 | case AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL: |
| 364 | dvb->frontend = dvb_attach(au8522_attach, |
| 365 | &hauppauge_hvr950q_config, |
| 366 | &dev->i2c_adap); |
| 367 | if (dvb->frontend != NULL) |
| 368 | dvb_attach(mxl5007t_attach, dvb->frontend, |
| 369 | &dev->i2c_adap, 0x60, |
| 370 | &mxl5007t_hvr950q_config); |
| 371 | break; |
Michael Krufky | 8e8bd22 | 2008-09-03 16:46:36 -0300 | [diff] [blame] | 372 | case AU0828_BOARD_HAUPPAUGE_WOODBURY: |
| 373 | dvb->frontend = dvb_attach(au8522_attach, |
| 374 | &hauppauge_woodbury_config, |
| 375 | &dev->i2c_adap); |
| 376 | if (dvb->frontend != NULL) |
| 377 | dvb_attach(tda18271_attach, dvb->frontend, |
| 378 | 0x60, &dev->i2c_adap, |
| 379 | &hauppauge_woodbury_tunerconfig); |
| 380 | break; |
Steven Toth | 265a651 | 2008-04-18 21:34:00 -0300 | [diff] [blame] | 381 | default: |
Michael Krufky | f07e8e4 | 2008-04-18 21:42:30 -0300 | [diff] [blame] | 382 | printk(KERN_WARNING "The frontend of your DVB/ATSC card " |
| 383 | "isn't supported yet\n"); |
Steven Toth | 265a651 | 2008-04-18 21:34:00 -0300 | [diff] [blame] | 384 | break; |
| 385 | } |
| 386 | if (NULL == dvb->frontend) { |
Michael Krufky | f07e8e4 | 2008-04-18 21:42:30 -0300 | [diff] [blame] | 387 | printk(KERN_ERR "%s() Frontend initialization failed\n", |
| 388 | __func__); |
Steven Toth | 265a651 | 2008-04-18 21:34:00 -0300 | [diff] [blame] | 389 | return -1; |
| 390 | } |
| 391 | |
Steven Toth | 265a651 | 2008-04-18 21:34:00 -0300 | [diff] [blame] | 392 | /* register everything */ |
| 393 | ret = dvb_register(dev); |
| 394 | if (ret < 0) { |
| 395 | if (dvb->frontend->ops.release) |
| 396 | dvb->frontend->ops.release(dvb->frontend); |
| 397 | return ret; |
| 398 | } |
| 399 | |
| 400 | return 0; |
| 401 | } |