Mauro Carvalho Chehab | 3aefb79 | 2008-04-17 21:36:41 -0300 | [diff] [blame] | 1 | /* |
| 2 | DVB device driver for em28xx |
| 3 | |
Mauro Carvalho Chehab | fec528b | 2011-07-03 21:05:06 -0300 | [diff] [blame] | 4 | (c) 2008-2011 Mauro Carvalho Chehab <mchehab@infradead.org> |
Mauro Carvalho Chehab | 3aefb79 | 2008-04-17 21:36:41 -0300 | [diff] [blame] | 5 | |
Devin Heitmueller | bdfbf95 | 2008-04-17 21:38:27 -0300 | [diff] [blame] | 6 | (c) 2008 Devin Heitmueller <devin.heitmueller@gmail.com> |
| 7 | - Fixes for the driver to properly work with HVR-950 |
Devin Heitmueller | 4fd305b | 2008-06-04 13:43:46 -0300 | [diff] [blame] | 8 | - Fixes for the driver to properly work with Pinnacle PCTV HD Pro Stick |
Devin Heitmueller | e14b365 | 2008-07-26 11:04:33 -0300 | [diff] [blame] | 9 | - Fixes for the driver to properly work with AMD ATI TV Wonder HD 600 |
Devin Heitmueller | bdfbf95 | 2008-04-17 21:38:27 -0300 | [diff] [blame] | 10 | |
Aidan Thornton | 3421b77 | 2008-04-17 21:40:36 -0300 | [diff] [blame] | 11 | (c) 2008 Aidan Thornton <makosoft@googlemail.com> |
| 12 | |
| 13 | Based on cx88-dvb, saa7134-dvb and videobuf-dvb originally written by: |
Mauro Carvalho Chehab | 3aefb79 | 2008-04-17 21:36:41 -0300 | [diff] [blame] | 14 | (c) 2004, 2005 Chris Pascoe <c.pascoe@itee.uq.edu.au> |
| 15 | (c) 2004 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs] |
| 16 | |
| 17 | This program is free software; you can redistribute it and/or modify |
| 18 | it under the terms of the GNU General Public License as published by |
| 19 | the Free Software Foundation; either version 2 of the License. |
| 20 | */ |
| 21 | |
| 22 | #include <linux/kernel.h> |
Tejun Heo | 5a0e3ad | 2010-03-24 17:04:11 +0900 | [diff] [blame] | 23 | #include <linux/slab.h> |
Mauro Carvalho Chehab | 3aefb79 | 2008-04-17 21:36:41 -0300 | [diff] [blame] | 24 | #include <linux/usb.h> |
| 25 | |
| 26 | #include "em28xx.h" |
| 27 | #include <media/v4l2-common.h> |
| 28 | #include <media/videobuf-vmalloc.h> |
Franklin Meng | d7de5d8 | 2009-06-06 17:05:02 -0300 | [diff] [blame] | 29 | #include <media/tuner.h> |
| 30 | #include "tuner-simple.h" |
Antti Palosaari | 1e8f31f | 2012-07-19 21:10:36 -0300 | [diff] [blame^] | 31 | #include <linux/gpio.h> |
Mauro Carvalho Chehab | 3aefb79 | 2008-04-17 21:36:41 -0300 | [diff] [blame] | 32 | |
| 33 | #include "lgdt330x.h" |
Jarod Wilson | 7e48b30 | 2010-03-07 17:55:43 -0300 | [diff] [blame] | 34 | #include "lgdt3305.h" |
Aidan Thornton | 7e6388a | 2008-04-17 21:40:03 -0300 | [diff] [blame] | 35 | #include "zl10353.h" |
Robert Krakora | 6e7b9ea | 2009-01-18 21:59:34 -0300 | [diff] [blame] | 36 | #include "s5h1409.h" |
Devin Heitmueller | 4fb202a | 2009-07-12 17:51:12 -0300 | [diff] [blame] | 37 | #include "mt352.h" |
| 38 | #include "mt352_priv.h" /* FIXME */ |
Antti Palosaari | 285eb1a | 2009-09-15 14:42:13 -0300 | [diff] [blame] | 39 | #include "tda1002x.h" |
Jarod Wilson | 7e48b30 | 2010-03-07 17:55:43 -0300 | [diff] [blame] | 40 | #include "tda18271.h" |
Mauro Carvalho Chehab | ca3dfd6 | 2010-09-10 17:29:14 -0300 | [diff] [blame] | 41 | #include "s921.h" |
Devin Heitmueller | 75e2b86 | 2011-03-13 02:01:02 -0300 | [diff] [blame] | 42 | #include "drxd.h" |
Antti Palosaari | d6a5f92 | 2011-04-07 16:34:44 -0300 | [diff] [blame] | 43 | #include "cxd2820r.h" |
Mauro Carvalho Chehab | fec528b | 2011-07-03 21:05:06 -0300 | [diff] [blame] | 44 | #include "tda18271c2dd.h" |
| 45 | #include "drxk.h" |
Antti Palosaari | 3658871 | 2011-08-01 01:15:30 -0300 | [diff] [blame] | 46 | #include "tda10071.h" |
| 47 | #include "a8293.h" |
Aivar Päkk | 1985f6f | 2011-12-11 18:15:00 -0300 | [diff] [blame] | 48 | #include "qt1010.h" |
Mauro Carvalho Chehab | 3aefb79 | 2008-04-17 21:36:41 -0300 | [diff] [blame] | 49 | |
| 50 | MODULE_DESCRIPTION("driver for em28xx based DVB cards"); |
| 51 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@infradead.org>"); |
| 52 | MODULE_LICENSE("GPL"); |
| 53 | |
| 54 | static unsigned int debug; |
| 55 | module_param(debug, int, 0644); |
| 56 | MODULE_PARM_DESC(debug, "enable debug messages [dvb]"); |
| 57 | |
| 58 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); |
| 59 | |
| 60 | #define dprintk(level, fmt, arg...) do { \ |
| 61 | if (debug >= level) \ |
Aidan Thornton | 3421b77 | 2008-04-17 21:40:36 -0300 | [diff] [blame] | 62 | printk(KERN_DEBUG "%s/2-dvb: " fmt, dev->name, ## arg); \ |
Mauro Carvalho Chehab | 3aefb79 | 2008-04-17 21:36:41 -0300 | [diff] [blame] | 63 | } while (0) |
| 64 | |
Aidan Thornton | 3421b77 | 2008-04-17 21:40:36 -0300 | [diff] [blame] | 65 | struct em28xx_dvb { |
Antti Palosaari | f71095b | 2011-04-07 15:51:52 -0300 | [diff] [blame] | 66 | struct dvb_frontend *fe[2]; |
Aidan Thornton | 3421b77 | 2008-04-17 21:40:36 -0300 | [diff] [blame] | 67 | |
| 68 | /* feed count management */ |
| 69 | struct mutex lock; |
| 70 | int nfeeds; |
| 71 | |
| 72 | /* general boilerplate stuff */ |
| 73 | struct dvb_adapter adapter; |
| 74 | struct dvb_demux demux; |
| 75 | struct dmxdev dmxdev; |
| 76 | struct dmx_frontend fe_hw; |
| 77 | struct dmx_frontend fe_mem; |
| 78 | struct dvb_net net; |
Mauro Carvalho Chehab | fec528b | 2011-07-03 21:05:06 -0300 | [diff] [blame] | 79 | |
Mauro Carvalho Chehab | c4c3a3d | 2011-07-14 22:23:18 -0300 | [diff] [blame] | 80 | /* Due to DRX-K - probably need changes */ |
Mauro Carvalho Chehab | fec528b | 2011-07-03 21:05:06 -0300 | [diff] [blame] | 81 | int (*gate_ctrl)(struct dvb_frontend *, int); |
| 82 | struct semaphore pll_mutex; |
Mauro Carvalho Chehab | c4c3a3d | 2011-07-14 22:23:18 -0300 | [diff] [blame] | 83 | bool dont_attach_fe1; |
Aidan Thornton | 3421b77 | 2008-04-17 21:40:36 -0300 | [diff] [blame] | 84 | }; |
| 85 | |
| 86 | |
| 87 | static inline void print_err_status(struct em28xx *dev, |
| 88 | int packet, int status) |
Mauro Carvalho Chehab | 3aefb79 | 2008-04-17 21:36:41 -0300 | [diff] [blame] | 89 | { |
Aidan Thornton | 3421b77 | 2008-04-17 21:40:36 -0300 | [diff] [blame] | 90 | char *errmsg = "Unknown"; |
Mauro Carvalho Chehab | 3aefb79 | 2008-04-17 21:36:41 -0300 | [diff] [blame] | 91 | |
Aidan Thornton | 3421b77 | 2008-04-17 21:40:36 -0300 | [diff] [blame] | 92 | switch (status) { |
| 93 | case -ENOENT: |
| 94 | errmsg = "unlinked synchronuously"; |
| 95 | break; |
| 96 | case -ECONNRESET: |
| 97 | errmsg = "unlinked asynchronuously"; |
| 98 | break; |
| 99 | case -ENOSR: |
| 100 | errmsg = "Buffer error (overrun)"; |
| 101 | break; |
| 102 | case -EPIPE: |
| 103 | errmsg = "Stalled (device not responding)"; |
| 104 | break; |
| 105 | case -EOVERFLOW: |
| 106 | errmsg = "Babble (bad cable?)"; |
| 107 | break; |
| 108 | case -EPROTO: |
| 109 | errmsg = "Bit-stuff error (bad cable?)"; |
| 110 | break; |
| 111 | case -EILSEQ: |
| 112 | errmsg = "CRC/Timeout (could be anything)"; |
| 113 | break; |
| 114 | case -ETIME: |
| 115 | errmsg = "Device does not respond"; |
| 116 | break; |
| 117 | } |
| 118 | if (packet < 0) { |
| 119 | dprintk(1, "URB status %d [%s].\n", status, errmsg); |
| 120 | } else { |
Douglas Schilling Landgraf | 6ea54d9 | 2008-04-17 21:41:10 -0300 | [diff] [blame] | 121 | dprintk(1, "URB packet %d, status %d [%s].\n", |
| 122 | packet, status, errmsg); |
Aidan Thornton | 3421b77 | 2008-04-17 21:40:36 -0300 | [diff] [blame] | 123 | } |
| 124 | } |
Mauro Carvalho Chehab | 3aefb79 | 2008-04-17 21:36:41 -0300 | [diff] [blame] | 125 | |
Jarod Wilson | f2d0c1c | 2011-07-14 19:06:08 -0300 | [diff] [blame] | 126 | static inline int em28xx_dvb_isoc_copy(struct em28xx *dev, struct urb *urb) |
Aidan Thornton | 3421b77 | 2008-04-17 21:40:36 -0300 | [diff] [blame] | 127 | { |
| 128 | int i; |
Mauro Carvalho Chehab | 3aefb79 | 2008-04-17 21:36:41 -0300 | [diff] [blame] | 129 | |
Aidan Thornton | 3421b77 | 2008-04-17 21:40:36 -0300 | [diff] [blame] | 130 | if (!dev) |
| 131 | return 0; |
| 132 | |
| 133 | if ((dev->state & DEV_DISCONNECTED) || (dev->state & DEV_MISCONFIGURED)) |
| 134 | return 0; |
| 135 | |
| 136 | if (urb->status < 0) { |
| 137 | print_err_status(dev, -1, urb->status); |
| 138 | if (urb->status == -ENOENT) |
| 139 | return 0; |
| 140 | } |
| 141 | |
| 142 | for (i = 0; i < urb->number_of_packets; i++) { |
| 143 | int status = urb->iso_frame_desc[i].status; |
| 144 | |
| 145 | if (status < 0) { |
| 146 | print_err_status(dev, i, status); |
| 147 | if (urb->iso_frame_desc[i].status != -EPROTO) |
| 148 | continue; |
| 149 | } |
| 150 | |
| 151 | dvb_dmx_swfilter(&dev->dvb->demux, urb->transfer_buffer + |
| 152 | urb->iso_frame_desc[i].offset, |
| 153 | urb->iso_frame_desc[i].actual_length); |
| 154 | } |
Mauro Carvalho Chehab | 3aefb79 | 2008-04-17 21:36:41 -0300 | [diff] [blame] | 155 | |
| 156 | return 0; |
| 157 | } |
| 158 | |
Jarod Wilson | f2d0c1c | 2011-07-14 19:06:08 -0300 | [diff] [blame] | 159 | static int em28xx_start_streaming(struct em28xx_dvb *dvb) |
Douglas Schilling Landgraf | 6ea54d9 | 2008-04-17 21:41:10 -0300 | [diff] [blame] | 160 | { |
Mauro Carvalho Chehab | c67ec53 | 2008-04-17 21:48:00 -0300 | [diff] [blame] | 161 | int rc; |
Aidan Thornton | 3421b77 | 2008-04-17 21:40:36 -0300 | [diff] [blame] | 162 | struct em28xx *dev = dvb->adapter.priv; |
Devin Heitmueller | d18e2fd | 2009-05-16 17:09:28 -0300 | [diff] [blame] | 163 | int max_dvb_packet_size; |
Aidan Thornton | 3421b77 | 2008-04-17 21:40:36 -0300 | [diff] [blame] | 164 | |
Holger Nelson | 8ab3362 | 2011-12-28 18:55:41 -0300 | [diff] [blame] | 165 | usb_set_interface(dev->udev, 0, dev->dvb_alt); |
Mauro Carvalho Chehab | c67ec53 | 2008-04-17 21:48:00 -0300 | [diff] [blame] | 166 | rc = em28xx_set_mode(dev, EM28XX_DIGITAL_MODE); |
| 167 | if (rc < 0) |
| 168 | return rc; |
Aidan Thornton | 3421b77 | 2008-04-17 21:40:36 -0300 | [diff] [blame] | 169 | |
Holger Nelson | 8ab3362 | 2011-12-28 18:55:41 -0300 | [diff] [blame] | 170 | max_dvb_packet_size = dev->dvb_max_pkt_size; |
Mauro Carvalho Chehab | f7acc4b | 2011-07-28 15:42:00 -0300 | [diff] [blame] | 171 | if (max_dvb_packet_size < 0) |
| 172 | return max_dvb_packet_size; |
Gianluca Gennari | 86d38d1 | 2012-02-13 13:59:22 -0300 | [diff] [blame] | 173 | dprintk(1, "Using %d buffers each with %d x %d bytes\n", |
Mauro Carvalho Chehab | f7acc4b | 2011-07-28 15:42:00 -0300 | [diff] [blame] | 174 | EM28XX_DVB_NUM_BUFS, |
Gianluca Gennari | 86d38d1 | 2012-02-13 13:59:22 -0300 | [diff] [blame] | 175 | EM28XX_DVB_MAX_PACKETS, |
Mauro Carvalho Chehab | f7acc4b | 2011-07-28 15:42:00 -0300 | [diff] [blame] | 176 | max_dvb_packet_size); |
Devin Heitmueller | d18e2fd | 2009-05-16 17:09:28 -0300 | [diff] [blame] | 177 | |
Gianluca Gennari | 86d38d1 | 2012-02-13 13:59:22 -0300 | [diff] [blame] | 178 | return em28xx_init_isoc(dev, EM28XX_DIGITAL_MODE, |
| 179 | EM28XX_DVB_MAX_PACKETS, EM28XX_DVB_NUM_BUFS, |
| 180 | max_dvb_packet_size, em28xx_dvb_isoc_copy); |
Aidan Thornton | 3421b77 | 2008-04-17 21:40:36 -0300 | [diff] [blame] | 181 | } |
| 182 | |
Jarod Wilson | f2d0c1c | 2011-07-14 19:06:08 -0300 | [diff] [blame] | 183 | static int em28xx_stop_streaming(struct em28xx_dvb *dvb) |
Douglas Schilling Landgraf | 6ea54d9 | 2008-04-17 21:41:10 -0300 | [diff] [blame] | 184 | { |
Aidan Thornton | 3421b77 | 2008-04-17 21:40:36 -0300 | [diff] [blame] | 185 | struct em28xx *dev = dvb->adapter.priv; |
| 186 | |
Gianluca Gennari | 5f5f147 | 2012-03-22 08:48:17 -0300 | [diff] [blame] | 187 | em28xx_stop_urbs(dev); |
Mauro Carvalho Chehab | c67ec53 | 2008-04-17 21:48:00 -0300 | [diff] [blame] | 188 | |
Mauro Carvalho Chehab | 2fe3e2e | 2008-11-27 09:10:40 -0300 | [diff] [blame] | 189 | em28xx_set_mode(dev, EM28XX_SUSPEND); |
Mauro Carvalho Chehab | c67ec53 | 2008-04-17 21:48:00 -0300 | [diff] [blame] | 190 | |
Aidan Thornton | 3421b77 | 2008-04-17 21:40:36 -0300 | [diff] [blame] | 191 | return 0; |
| 192 | } |
| 193 | |
Jarod Wilson | f2d0c1c | 2011-07-14 19:06:08 -0300 | [diff] [blame] | 194 | static int em28xx_start_feed(struct dvb_demux_feed *feed) |
Aidan Thornton | 3421b77 | 2008-04-17 21:40:36 -0300 | [diff] [blame] | 195 | { |
| 196 | struct dvb_demux *demux = feed->demux; |
| 197 | struct em28xx_dvb *dvb = demux->priv; |
| 198 | int rc, ret; |
| 199 | |
| 200 | if (!demux->dmx.frontend) |
| 201 | return -EINVAL; |
| 202 | |
| 203 | mutex_lock(&dvb->lock); |
| 204 | dvb->nfeeds++; |
| 205 | rc = dvb->nfeeds; |
| 206 | |
| 207 | if (dvb->nfeeds == 1) { |
Jarod Wilson | f2d0c1c | 2011-07-14 19:06:08 -0300 | [diff] [blame] | 208 | ret = em28xx_start_streaming(dvb); |
Douglas Schilling Landgraf | 6ea54d9 | 2008-04-17 21:41:10 -0300 | [diff] [blame] | 209 | if (ret < 0) |
| 210 | rc = ret; |
Aidan Thornton | 3421b77 | 2008-04-17 21:40:36 -0300 | [diff] [blame] | 211 | } |
| 212 | |
| 213 | mutex_unlock(&dvb->lock); |
| 214 | return rc; |
| 215 | } |
| 216 | |
Jarod Wilson | f2d0c1c | 2011-07-14 19:06:08 -0300 | [diff] [blame] | 217 | static int em28xx_stop_feed(struct dvb_demux_feed *feed) |
Aidan Thornton | 3421b77 | 2008-04-17 21:40:36 -0300 | [diff] [blame] | 218 | { |
| 219 | struct dvb_demux *demux = feed->demux; |
| 220 | struct em28xx_dvb *dvb = demux->priv; |
| 221 | int err = 0; |
| 222 | |
| 223 | mutex_lock(&dvb->lock); |
| 224 | dvb->nfeeds--; |
Douglas Schilling Landgraf | 6ea54d9 | 2008-04-17 21:41:10 -0300 | [diff] [blame] | 225 | |
| 226 | if (0 == dvb->nfeeds) |
Jarod Wilson | f2d0c1c | 2011-07-14 19:06:08 -0300 | [diff] [blame] | 227 | err = em28xx_stop_streaming(dvb); |
Douglas Schilling Landgraf | 6ea54d9 | 2008-04-17 21:41:10 -0300 | [diff] [blame] | 228 | |
Aidan Thornton | 3421b77 | 2008-04-17 21:40:36 -0300 | [diff] [blame] | 229 | mutex_unlock(&dvb->lock); |
| 230 | return err; |
| 231 | } |
| 232 | |
| 233 | |
Mauro Carvalho Chehab | e3569ab | 2008-04-17 21:49:20 -0300 | [diff] [blame] | 234 | |
| 235 | /* ------------------------------------------------------------------ */ |
| 236 | static int em28xx_dvb_bus_ctrl(struct dvb_frontend *fe, int acquire) |
| 237 | { |
| 238 | struct em28xx *dev = fe->dvb->priv; |
| 239 | |
| 240 | if (acquire) |
| 241 | return em28xx_set_mode(dev, EM28XX_DIGITAL_MODE); |
| 242 | else |
Mauro Carvalho Chehab | 2fe3e2e | 2008-11-27 09:10:40 -0300 | [diff] [blame] | 243 | return em28xx_set_mode(dev, EM28XX_SUSPEND); |
Mauro Carvalho Chehab | e3569ab | 2008-04-17 21:49:20 -0300 | [diff] [blame] | 244 | } |
| 245 | |
Mauro Carvalho Chehab | 3aefb79 | 2008-04-17 21:36:41 -0300 | [diff] [blame] | 246 | /* ------------------------------------------------------------------ */ |
| 247 | |
Mauro Carvalho Chehab | 227ad4a | 2008-04-17 21:37:40 -0300 | [diff] [blame] | 248 | static struct lgdt330x_config em2880_lgdt3303_dev = { |
| 249 | .demod_address = 0x0e, |
| 250 | .demod_chip = LGDT3303, |
| 251 | }; |
Mauro Carvalho Chehab | 3aefb79 | 2008-04-17 21:36:41 -0300 | [diff] [blame] | 252 | |
Jarod Wilson | 7e48b30 | 2010-03-07 17:55:43 -0300 | [diff] [blame] | 253 | static struct lgdt3305_config em2870_lgdt3304_dev = { |
| 254 | .i2c_addr = 0x0e, |
| 255 | .demod_chip = LGDT3304, |
| 256 | .spectral_inversion = 1, |
| 257 | .deny_i2c_rptr = 1, |
| 258 | .mpeg_mode = LGDT3305_MPEG_PARALLEL, |
| 259 | .tpclk_edge = LGDT3305_TPCLK_FALLING_EDGE, |
| 260 | .tpvalid_polarity = LGDT3305_TP_VALID_HIGH, |
| 261 | .vsb_if_khz = 3250, |
| 262 | .qam_if_khz = 4000, |
| 263 | }; |
| 264 | |
Mauro Carvalho Chehab | ca3dfd6 | 2010-09-10 17:29:14 -0300 | [diff] [blame] | 265 | static struct s921_config sharp_isdbt = { |
| 266 | .demod_address = 0x30 >> 1 |
| 267 | }; |
| 268 | |
Aidan Thornton | 7e6388a | 2008-04-17 21:40:03 -0300 | [diff] [blame] | 269 | static struct zl10353_config em28xx_zl10353_with_xc3028 = { |
| 270 | .demod_address = (0x1e >> 1), |
| 271 | .no_tuner = 1, |
| 272 | .parallel_ts = 1, |
| 273 | .if2 = 45600, |
| 274 | }; |
| 275 | |
Robert Krakora | 6e7b9ea | 2009-01-18 21:59:34 -0300 | [diff] [blame] | 276 | static struct s5h1409_config em28xx_s5h1409_with_xc3028 = { |
| 277 | .demod_address = 0x32 >> 1, |
| 278 | .output_mode = S5H1409_PARALLEL_OUTPUT, |
| 279 | .gpio = S5H1409_GPIO_OFF, |
| 280 | .inversion = S5H1409_INVERSION_OFF, |
| 281 | .status_mode = S5H1409_DEMODLOCKING, |
| 282 | .mpeg_timing = S5H1409_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK |
| 283 | }; |
| 284 | |
Jarod Wilson | 7e48b30 | 2010-03-07 17:55:43 -0300 | [diff] [blame] | 285 | static struct tda18271_std_map kworld_a340_std_map = { |
| 286 | .atsc_6 = { .if_freq = 3250, .agc_mode = 3, .std = 0, |
| 287 | .if_lvl = 1, .rfagc_top = 0x37, }, |
| 288 | .qam_6 = { .if_freq = 4000, .agc_mode = 3, .std = 1, |
| 289 | .if_lvl = 1, .rfagc_top = 0x37, }, |
| 290 | }; |
| 291 | |
| 292 | static struct tda18271_config kworld_a340_config = { |
| 293 | .std_map = &kworld_a340_std_map, |
| 294 | }; |
| 295 | |
Devin Heitmueller | a84f79a | 2009-07-12 17:05:02 -0300 | [diff] [blame] | 296 | static struct zl10353_config em28xx_zl10353_xc3028_no_i2c_gate = { |
Devin Heitmueller | f797608 | 2009-06-22 22:32:32 -0300 | [diff] [blame] | 297 | .demod_address = (0x1e >> 1), |
| 298 | .no_tuner = 1, |
| 299 | .disable_i2c_gate_ctrl = 1, |
| 300 | .parallel_ts = 1, |
| 301 | .if2 = 45600, |
| 302 | }; |
| 303 | |
Devin Heitmueller | 75e2b86 | 2011-03-13 02:01:02 -0300 | [diff] [blame] | 304 | static struct drxd_config em28xx_drxd = { |
Mauro Carvalho Chehab | aac865f | 2011-12-26 09:41:14 -0300 | [diff] [blame] | 305 | .demod_address = 0x70, |
| 306 | .demod_revision = 0xa2, |
| 307 | .pll_type = DRXD_PLL_NONE, |
| 308 | .clock = 12000, |
| 309 | .insert_rs_byte = 1, |
| 310 | .IF = 42800000, |
Devin Heitmueller | 6b142b3 | 2011-03-13 02:02:01 -0300 | [diff] [blame] | 311 | .disable_i2c_gate_ctrl = 1, |
Devin Heitmueller | 17d9d55 | 2008-06-08 10:22:03 -0300 | [diff] [blame] | 312 | }; |
Devin Heitmueller | 17d9d55 | 2008-06-08 10:22:03 -0300 | [diff] [blame] | 313 | |
Ezequiel García | 61bdbef | 2012-06-12 09:53:41 -0300 | [diff] [blame] | 314 | static struct drxk_config terratec_h5_drxk = { |
Mauro Carvalho Chehab | fec528b | 2011-07-03 21:05:06 -0300 | [diff] [blame] | 315 | .adr = 0x29, |
Mauro Carvalho Chehab | e4f4f87 | 2011-07-09 17:35:26 -0300 | [diff] [blame] | 316 | .single_master = 1, |
Mauro Carvalho Chehab | f1fe1b7 | 2011-07-09 21:59:33 -0300 | [diff] [blame] | 317 | .no_i2c_bridge = 1, |
Mauro Carvalho Chehab | 8b9456a | 2011-07-11 14:33:51 -0300 | [diff] [blame] | 318 | .microcode_name = "dvb-usb-terratec-h5-drxk.fw", |
Martin Blumenstingl | 9e23f50a | 2012-07-04 17:36:55 -0300 | [diff] [blame] | 319 | .qam_demod_parameter_count = 2, |
Mauro Carvalho Chehab | fec528b | 2011-07-03 21:05:06 -0300 | [diff] [blame] | 320 | }; |
| 321 | |
Ezequiel García | 61bdbef | 2012-06-12 09:53:41 -0300 | [diff] [blame] | 322 | static struct drxk_config hauppauge_930c_drxk = { |
Eddi De Pieri | 82e7dbb | 2011-11-19 11:37:14 -0300 | [diff] [blame] | 323 | .adr = 0x29, |
| 324 | .single_master = 1, |
| 325 | .no_i2c_bridge = 1, |
| 326 | .microcode_name = "dvb-usb-hauppauge-hvr930c-drxk.fw", |
| 327 | .chunk_size = 56, |
Martin Blumenstingl | 9e23f50a | 2012-07-04 17:36:55 -0300 | [diff] [blame] | 328 | .qam_demod_parameter_count = 2, |
Eddi De Pieri | 82e7dbb | 2011-11-19 11:37:14 -0300 | [diff] [blame] | 329 | }; |
| 330 | |
Martin Blumenstingl | c8dce00 | 2012-06-12 18:19:28 -0300 | [diff] [blame] | 331 | struct drxk_config terratec_htc_stick_drxk = { |
| 332 | .adr = 0x29, |
| 333 | .single_master = 1, |
| 334 | .no_i2c_bridge = 1, |
| 335 | .microcode_name = "dvb-usb-terratec-htc-stick-drxk.fw", |
| 336 | .chunk_size = 54, |
Martin Blumenstingl | 9e23f50a | 2012-07-04 17:36:55 -0300 | [diff] [blame] | 337 | .qam_demod_parameter_count = 2, |
Martin Blumenstingl | c8dce00 | 2012-06-12 18:19:28 -0300 | [diff] [blame] | 338 | /* Required for the antenna_gpio to disable LNA. */ |
| 339 | .antenna_dvbt = true, |
| 340 | /* The windows driver uses the same. This will disable LNA. */ |
| 341 | .antenna_gpio = 0x6, |
| 342 | }; |
| 343 | |
Ezequiel García | 61bdbef | 2012-06-12 09:53:41 -0300 | [diff] [blame] | 344 | static struct drxk_config maxmedia_ub425_tc_drxk = { |
Antti Palosaari | 3553085 | 2012-03-18 18:09:01 -0300 | [diff] [blame] | 345 | .adr = 0x29, |
| 346 | .single_master = 1, |
| 347 | .no_i2c_bridge = 1, |
| 348 | }; |
| 349 | |
Ezequiel García | 61bdbef | 2012-06-12 09:53:41 -0300 | [diff] [blame] | 350 | static struct drxk_config pctv_520e_drxk = { |
Antti Palosaari | c247d7b | 2012-03-19 11:48:19 -0300 | [diff] [blame] | 351 | .adr = 0x29, |
| 352 | .single_master = 1, |
| 353 | .microcode_name = "dvb-demod-drxk-pctv.fw", |
Martin Blumenstingl | 9e23f50a | 2012-07-04 17:36:55 -0300 | [diff] [blame] | 354 | .qam_demod_parameter_count = 2, |
Antti Palosaari | c247d7b | 2012-03-19 11:48:19 -0300 | [diff] [blame] | 355 | .chunk_size = 58, |
Antti Palosaari | f6f379d | 2012-05-17 19:09:06 -0300 | [diff] [blame] | 356 | .antenna_dvbt = true, /* disable LNA */ |
| 357 | .antenna_gpio = (1 << 2), /* disable LNA */ |
Antti Palosaari | c247d7b | 2012-03-19 11:48:19 -0300 | [diff] [blame] | 358 | }; |
| 359 | |
Mauro Carvalho Chehab | fec528b | 2011-07-03 21:05:06 -0300 | [diff] [blame] | 360 | static int drxk_gate_ctrl(struct dvb_frontend *fe, int enable) |
| 361 | { |
| 362 | struct em28xx_dvb *dvb = fe->sec_priv; |
| 363 | int status; |
| 364 | |
| 365 | if (!dvb) |
| 366 | return -EINVAL; |
| 367 | |
| 368 | if (enable) { |
| 369 | down(&dvb->pll_mutex); |
| 370 | status = dvb->gate_ctrl(fe, 1); |
| 371 | } else { |
| 372 | status = dvb->gate_ctrl(fe, 0); |
| 373 | up(&dvb->pll_mutex); |
| 374 | } |
| 375 | return status; |
| 376 | } |
| 377 | |
Eddi De Pieri | 82e7dbb | 2011-11-19 11:37:14 -0300 | [diff] [blame] | 378 | static void hauppauge_hvr930c_init(struct em28xx *dev) |
| 379 | { |
| 380 | int i; |
| 381 | |
| 382 | struct em28xx_reg_seq hauppauge_hvr930c_init[] = { |
Mauro Carvalho Chehab | de72405 | 2011-11-20 11:23:24 -0200 | [diff] [blame] | 383 | {EM2874_R80_GPIO, 0xff, 0xff, 0x65}, |
| 384 | {EM2874_R80_GPIO, 0xfb, 0xff, 0x32}, |
| 385 | {EM2874_R80_GPIO, 0xff, 0xff, 0xb8}, |
Eddi De Pieri | 82e7dbb | 2011-11-19 11:37:14 -0300 | [diff] [blame] | 386 | { -1, -1, -1, -1}, |
| 387 | }; |
| 388 | struct em28xx_reg_seq hauppauge_hvr930c_end[] = { |
Mauro Carvalho Chehab | de72405 | 2011-11-20 11:23:24 -0200 | [diff] [blame] | 389 | {EM2874_R80_GPIO, 0xef, 0xff, 0x01}, |
| 390 | {EM2874_R80_GPIO, 0xaf, 0xff, 0x65}, |
| 391 | {EM2874_R80_GPIO, 0xef, 0xff, 0x76}, |
| 392 | {EM2874_R80_GPIO, 0xef, 0xff, 0x01}, |
| 393 | {EM2874_R80_GPIO, 0xcf, 0xff, 0x0b}, |
| 394 | {EM2874_R80_GPIO, 0xef, 0xff, 0x40}, |
Eddi De Pieri | 82e7dbb | 2011-11-19 11:37:14 -0300 | [diff] [blame] | 395 | |
Mauro Carvalho Chehab | de72405 | 2011-11-20 11:23:24 -0200 | [diff] [blame] | 396 | {EM2874_R80_GPIO, 0xcf, 0xff, 0x65}, |
| 397 | {EM2874_R80_GPIO, 0xef, 0xff, 0x65}, |
| 398 | {EM2874_R80_GPIO, 0xcf, 0xff, 0x0b}, |
| 399 | {EM2874_R80_GPIO, 0xef, 0xff, 0x65}, |
Eddi De Pieri | 82e7dbb | 2011-11-19 11:37:14 -0300 | [diff] [blame] | 400 | |
Eddi De Pieri | 82e7dbb | 2011-11-19 11:37:14 -0300 | [diff] [blame] | 401 | { -1, -1, -1, -1}, |
| 402 | }; |
| 403 | |
Eddi De Pieri | 82e7dbb | 2011-11-19 11:37:14 -0300 | [diff] [blame] | 404 | struct { |
| 405 | unsigned char r[4]; |
| 406 | int len; |
| 407 | } regs[] = { |
| 408 | {{ 0x06, 0x02, 0x00, 0x31 }, 4}, |
| 409 | {{ 0x01, 0x02 }, 2}, |
| 410 | {{ 0x01, 0x02, 0x00, 0xc6 }, 4}, |
| 411 | {{ 0x01, 0x00 }, 2}, |
| 412 | {{ 0x01, 0x00, 0xff, 0xaf }, 4}, |
| 413 | {{ 0x01, 0x00, 0x03, 0xa0 }, 4}, |
| 414 | {{ 0x01, 0x00 }, 2}, |
| 415 | {{ 0x01, 0x00, 0x73, 0xaf }, 4}, |
| 416 | {{ 0x04, 0x00 }, 2}, |
| 417 | {{ 0x00, 0x04 }, 2}, |
| 418 | {{ 0x00, 0x04, 0x00, 0x0a }, 4}, |
| 419 | {{ 0x04, 0x14 }, 2}, |
| 420 | {{ 0x04, 0x14, 0x00, 0x00 }, 4}, |
| 421 | }; |
| 422 | |
| 423 | em28xx_gpio_set(dev, hauppauge_hvr930c_init); |
| 424 | em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x40); |
| 425 | msleep(10); |
| 426 | em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x44); |
| 427 | msleep(10); |
| 428 | |
| 429 | dev->i2c_client.addr = 0x82 >> 1; |
| 430 | |
| 431 | for (i = 0; i < ARRAY_SIZE(regs); i++) |
| 432 | i2c_master_send(&dev->i2c_client, regs[i].r, regs[i].len); |
| 433 | em28xx_gpio_set(dev, hauppauge_hvr930c_end); |
| 434 | |
| 435 | msleep(100); |
| 436 | |
| 437 | em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x44); |
| 438 | msleep(30); |
| 439 | |
Eddi De Pieri | 82e7dbb | 2011-11-19 11:37:14 -0300 | [diff] [blame] | 440 | em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x45); |
| 441 | msleep(10); |
| 442 | |
| 443 | } |
| 444 | |
Mauro Carvalho Chehab | fec528b | 2011-07-03 21:05:06 -0300 | [diff] [blame] | 445 | static void terratec_h5_init(struct em28xx *dev) |
| 446 | { |
| 447 | int i; |
| 448 | struct em28xx_reg_seq terratec_h5_init[] = { |
| 449 | {EM28XX_R08_GPIO, 0xff, 0xff, 10}, |
| 450 | {EM2874_R80_GPIO, 0xf6, 0xff, 100}, |
| 451 | {EM2874_R80_GPIO, 0xf2, 0xff, 50}, |
| 452 | {EM2874_R80_GPIO, 0xf6, 0xff, 100}, |
| 453 | { -1, -1, -1, -1}, |
| 454 | }; |
| 455 | struct em28xx_reg_seq terratec_h5_end[] = { |
| 456 | {EM2874_R80_GPIO, 0xe6, 0xff, 100}, |
| 457 | {EM2874_R80_GPIO, 0xa6, 0xff, 50}, |
| 458 | {EM2874_R80_GPIO, 0xe6, 0xff, 100}, |
| 459 | { -1, -1, -1, -1}, |
| 460 | }; |
| 461 | struct { |
| 462 | unsigned char r[4]; |
| 463 | int len; |
| 464 | } regs[] = { |
| 465 | {{ 0x06, 0x02, 0x00, 0x31 }, 4}, |
| 466 | {{ 0x01, 0x02 }, 2}, |
| 467 | {{ 0x01, 0x02, 0x00, 0xc6 }, 4}, |
| 468 | {{ 0x01, 0x00 }, 2}, |
| 469 | {{ 0x01, 0x00, 0xff, 0xaf }, 4}, |
| 470 | {{ 0x01, 0x00, 0x03, 0xa0 }, 4}, |
| 471 | {{ 0x01, 0x00 }, 2}, |
| 472 | {{ 0x01, 0x00, 0x73, 0xaf }, 4}, |
| 473 | {{ 0x04, 0x00 }, 2}, |
| 474 | {{ 0x00, 0x04 }, 2}, |
| 475 | {{ 0x00, 0x04, 0x00, 0x0a }, 4}, |
| 476 | {{ 0x04, 0x14 }, 2}, |
| 477 | {{ 0x04, 0x14, 0x00, 0x00 }, 4}, |
| 478 | }; |
| 479 | |
| 480 | em28xx_gpio_set(dev, terratec_h5_init); |
| 481 | em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x40); |
| 482 | msleep(10); |
| 483 | em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x45); |
| 484 | msleep(10); |
| 485 | |
| 486 | dev->i2c_client.addr = 0x82 >> 1; |
| 487 | |
| 488 | for (i = 0; i < ARRAY_SIZE(regs); i++) |
| 489 | i2c_master_send(&dev->i2c_client, regs[i].r, regs[i].len); |
| 490 | em28xx_gpio_set(dev, terratec_h5_end); |
| 491 | }; |
| 492 | |
Martin Blumenstingl | c8dce00 | 2012-06-12 18:19:28 -0300 | [diff] [blame] | 493 | static void terratec_htc_stick_init(struct em28xx *dev) |
| 494 | { |
| 495 | int i; |
| 496 | |
| 497 | /* |
| 498 | * GPIO configuration: |
| 499 | * 0xff: unknown (does not affect DVB-T). |
| 500 | * 0xf6: DRX-K (demodulator). |
| 501 | * 0xe6: unknown (does not affect DVB-T). |
| 502 | * 0xb6: unknown (does not affect DVB-T). |
| 503 | */ |
| 504 | struct em28xx_reg_seq terratec_htc_stick_init[] = { |
| 505 | {EM28XX_R08_GPIO, 0xff, 0xff, 10}, |
| 506 | {EM2874_R80_GPIO, 0xf6, 0xff, 100}, |
| 507 | {EM2874_R80_GPIO, 0xe6, 0xff, 50}, |
| 508 | {EM2874_R80_GPIO, 0xf6, 0xff, 100}, |
| 509 | { -1, -1, -1, -1}, |
| 510 | }; |
| 511 | struct em28xx_reg_seq terratec_htc_stick_end[] = { |
| 512 | {EM2874_R80_GPIO, 0xb6, 0xff, 100}, |
| 513 | {EM2874_R80_GPIO, 0xf6, 0xff, 50}, |
| 514 | { -1, -1, -1, -1}, |
| 515 | }; |
| 516 | |
| 517 | /* Init the analog decoder? */ |
| 518 | struct { |
| 519 | unsigned char r[4]; |
| 520 | int len; |
| 521 | } regs[] = { |
| 522 | {{ 0x06, 0x02, 0x00, 0x31 }, 4}, |
| 523 | {{ 0x01, 0x02 }, 2}, |
| 524 | {{ 0x01, 0x02, 0x00, 0xc6 }, 4}, |
| 525 | {{ 0x01, 0x00 }, 2}, |
| 526 | {{ 0x01, 0x00, 0xff, 0xaf }, 4}, |
| 527 | }; |
| 528 | |
| 529 | em28xx_gpio_set(dev, terratec_htc_stick_init); |
| 530 | |
| 531 | em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x40); |
| 532 | msleep(10); |
| 533 | em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x44); |
| 534 | msleep(10); |
| 535 | |
| 536 | dev->i2c_client.addr = 0x82 >> 1; |
| 537 | |
| 538 | for (i = 0; i < ARRAY_SIZE(regs); i++) |
| 539 | i2c_master_send(&dev->i2c_client, regs[i].r, regs[i].len); |
| 540 | |
| 541 | em28xx_gpio_set(dev, terratec_htc_stick_end); |
| 542 | }; |
| 543 | |
Antti Palosaari | c247d7b | 2012-03-19 11:48:19 -0300 | [diff] [blame] | 544 | static void pctv_520e_init(struct em28xx *dev) |
| 545 | { |
| 546 | /* |
Antti Palosaari | 26c8a72 | 2012-05-17 18:22:02 -0300 | [diff] [blame] | 547 | * Init AVF4910B analog decoder. Looks like I2C traffic to |
| 548 | * digital demodulator and tuner are routed via AVF4910B. |
Antti Palosaari | c247d7b | 2012-03-19 11:48:19 -0300 | [diff] [blame] | 549 | */ |
| 550 | int i; |
| 551 | struct { |
| 552 | unsigned char r[4]; |
| 553 | int len; |
| 554 | } regs[] = { |
| 555 | {{ 0x06, 0x02, 0x00, 0x31 }, 4}, |
| 556 | {{ 0x01, 0x02 }, 2}, |
| 557 | {{ 0x01, 0x02, 0x00, 0xc6 }, 4}, |
| 558 | {{ 0x01, 0x00 }, 2}, |
| 559 | {{ 0x01, 0x00, 0xff, 0xaf }, 4}, |
| 560 | {{ 0x01, 0x00, 0x03, 0xa0 }, 4}, |
| 561 | {{ 0x01, 0x00 }, 2}, |
| 562 | {{ 0x01, 0x00, 0x73, 0xaf }, 4}, |
| 563 | }; |
| 564 | |
| 565 | dev->i2c_client.addr = 0x82 >> 1; /* 0x41 */ |
| 566 | |
| 567 | for (i = 0; i < ARRAY_SIZE(regs); i++) |
| 568 | i2c_master_send(&dev->i2c_client, regs[i].r, regs[i].len); |
| 569 | }; |
| 570 | |
Jarod Wilson | f2d0c1c | 2011-07-14 19:06:08 -0300 | [diff] [blame] | 571 | static int em28xx_mt352_terratec_xs_init(struct dvb_frontend *fe) |
Devin Heitmueller | 4fb202a | 2009-07-12 17:51:12 -0300 | [diff] [blame] | 572 | { |
| 573 | /* Values extracted from a USB trace of the Terratec Windows driver */ |
| 574 | static u8 clock_config[] = { CLOCK_CTL, 0x38, 0x2c }; |
| 575 | static u8 reset[] = { RESET, 0x80 }; |
| 576 | static u8 adc_ctl_1_cfg[] = { ADC_CTL_1, 0x40 }; |
| 577 | static u8 agc_cfg[] = { AGC_TARGET, 0x28, 0xa0 }; |
| 578 | static u8 input_freq_cfg[] = { INPUT_FREQ_1, 0x31, 0xb8 }; |
| 579 | static u8 rs_err_cfg[] = { RS_ERR_PER_1, 0x00, 0x4d }; |
| 580 | static u8 capt_range_cfg[] = { CAPT_RANGE, 0x32 }; |
| 581 | static u8 trl_nom_cfg[] = { TRL_NOMINAL_RATE_1, 0x64, 0x00 }; |
| 582 | static u8 tps_given_cfg[] = { TPS_GIVEN_1, 0x40, 0x80, 0x50 }; |
Devin Heitmueller | ff69786 | 2009-07-12 18:44:19 -0300 | [diff] [blame] | 583 | static u8 tuner_go[] = { TUNER_GO, 0x01}; |
Devin Heitmueller | 4fb202a | 2009-07-12 17:51:12 -0300 | [diff] [blame] | 584 | |
| 585 | mt352_write(fe, clock_config, sizeof(clock_config)); |
| 586 | udelay(200); |
| 587 | mt352_write(fe, reset, sizeof(reset)); |
| 588 | mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg)); |
| 589 | mt352_write(fe, agc_cfg, sizeof(agc_cfg)); |
| 590 | mt352_write(fe, input_freq_cfg, sizeof(input_freq_cfg)); |
| 591 | mt352_write(fe, rs_err_cfg, sizeof(rs_err_cfg)); |
| 592 | mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg)); |
| 593 | mt352_write(fe, trl_nom_cfg, sizeof(trl_nom_cfg)); |
| 594 | mt352_write(fe, tps_given_cfg, sizeof(tps_given_cfg)); |
| 595 | mt352_write(fe, tuner_go, sizeof(tuner_go)); |
| 596 | return 0; |
| 597 | } |
| 598 | |
| 599 | static struct mt352_config terratec_xs_mt352_cfg = { |
| 600 | .demod_address = (0x1e >> 1), |
| 601 | .no_tuner = 1, |
| 602 | .if2 = 45600, |
Jarod Wilson | f2d0c1c | 2011-07-14 19:06:08 -0300 | [diff] [blame] | 603 | .demod_init = em28xx_mt352_terratec_xs_init, |
Devin Heitmueller | 4fb202a | 2009-07-12 17:51:12 -0300 | [diff] [blame] | 604 | }; |
| 605 | |
Antti Palosaari | 285eb1a | 2009-09-15 14:42:13 -0300 | [diff] [blame] | 606 | static struct tda10023_config em28xx_tda10023_config = { |
| 607 | .demod_address = 0x0c, |
| 608 | .invert = 1, |
| 609 | }; |
| 610 | |
Antti Palosaari | d6a5f92 | 2011-04-07 16:34:44 -0300 | [diff] [blame] | 611 | static struct cxd2820r_config em28xx_cxd2820r_config = { |
| 612 | .i2c_address = (0xd8 >> 1), |
| 613 | .ts_mode = CXD2820R_TS_SERIAL, |
Antti Palosaari | d6a5f92 | 2011-04-07 16:34:44 -0300 | [diff] [blame] | 614 | }; |
| 615 | |
| 616 | static struct tda18271_config em28xx_cxd2820r_tda18271_config = { |
| 617 | .output_opt = TDA18271_OUTPUT_LT_OFF, |
Steve Kerrison | 0db4bf4 | 2011-08-09 07:16:21 -0300 | [diff] [blame] | 618 | .gate = TDA18271_GATE_DIGITAL, |
Antti Palosaari | d6a5f92 | 2011-04-07 16:34:44 -0300 | [diff] [blame] | 619 | }; |
| 620 | |
Antti Palosaari | 3658871 | 2011-08-01 01:15:30 -0300 | [diff] [blame] | 621 | static const struct tda10071_config em28xx_tda10071_config = { |
| 622 | .i2c_address = 0x55, /* (0xaa >> 1) */ |
| 623 | .i2c_wr_max = 64, |
| 624 | .ts_mode = TDA10071_TS_SERIAL, |
| 625 | .spec_inv = 0, |
| 626 | .xtal = 40444000, /* 40.444 MHz */ |
| 627 | .pll_multiplier = 20, |
| 628 | }; |
| 629 | |
| 630 | static const struct a8293_config em28xx_a8293_config = { |
| 631 | .i2c_addr = 0x08, /* (0x10 >> 1) */ |
| 632 | }; |
| 633 | |
Aivar Päkk | 1985f6f | 2011-12-11 18:15:00 -0300 | [diff] [blame] | 634 | static struct zl10353_config em28xx_zl10353_no_i2c_gate_dev = { |
| 635 | .demod_address = (0x1e >> 1), |
| 636 | .disable_i2c_gate_ctrl = 1, |
| 637 | .no_tuner = 1, |
| 638 | .parallel_ts = 1, |
| 639 | }; |
| 640 | static struct qt1010_config em28xx_qt1010_config = { |
| 641 | .i2c_address = 0x62 |
| 642 | |
| 643 | }; |
| 644 | |
Mauro Carvalho Chehab | 3aefb79 | 2008-04-17 21:36:41 -0300 | [diff] [blame] | 645 | /* ------------------------------------------------------------------ */ |
| 646 | |
Jarod Wilson | f2d0c1c | 2011-07-14 19:06:08 -0300 | [diff] [blame] | 647 | static int em28xx_attach_xc3028(u8 addr, struct em28xx *dev) |
Mauro Carvalho Chehab | 3aefb79 | 2008-04-17 21:36:41 -0300 | [diff] [blame] | 648 | { |
| 649 | struct dvb_frontend *fe; |
Mauro Carvalho Chehab | 3ca9c09 | 2008-04-17 21:37:53 -0300 | [diff] [blame] | 650 | struct xc2028_config cfg; |
| 651 | |
Douglas Schilling Landgraf | 6ea54d9 | 2008-04-17 21:41:10 -0300 | [diff] [blame] | 652 | memset(&cfg, 0, sizeof(cfg)); |
Mauro Carvalho Chehab | 3ca9c09 | 2008-04-17 21:37:53 -0300 | [diff] [blame] | 653 | cfg.i2c_adap = &dev->i2c_adap; |
| 654 | cfg.i2c_addr = addr; |
Mauro Carvalho Chehab | 3ca9c09 | 2008-04-17 21:37:53 -0300 | [diff] [blame] | 655 | |
Antti Palosaari | f71095b | 2011-04-07 15:51:52 -0300 | [diff] [blame] | 656 | if (!dev->dvb->fe[0]) { |
Filipe Rosset | 480be18 | 2009-11-04 15:32:37 -0300 | [diff] [blame] | 657 | em28xx_errdev("/2: dvb frontend not attached. " |
| 658 | "Can't attach xc3028\n"); |
Mauro Carvalho Chehab | 3aefb79 | 2008-04-17 21:36:41 -0300 | [diff] [blame] | 659 | return -EINVAL; |
| 660 | } |
| 661 | |
Antti Palosaari | f71095b | 2011-04-07 15:51:52 -0300 | [diff] [blame] | 662 | fe = dvb_attach(xc2028_attach, dev->dvb->fe[0], &cfg); |
Mauro Carvalho Chehab | 3aefb79 | 2008-04-17 21:36:41 -0300 | [diff] [blame] | 663 | if (!fe) { |
Filipe Rosset | 480be18 | 2009-11-04 15:32:37 -0300 | [diff] [blame] | 664 | em28xx_errdev("/2: xc3028 attach failed\n"); |
Antti Palosaari | f71095b | 2011-04-07 15:51:52 -0300 | [diff] [blame] | 665 | dvb_frontend_detach(dev->dvb->fe[0]); |
| 666 | dev->dvb->fe[0] = NULL; |
Mauro Carvalho Chehab | 3aefb79 | 2008-04-17 21:36:41 -0300 | [diff] [blame] | 667 | return -EINVAL; |
| 668 | } |
| 669 | |
Filipe Rosset | 480be18 | 2009-11-04 15:32:37 -0300 | [diff] [blame] | 670 | em28xx_info("%s/2: xc3028 attached\n", dev->name); |
Mauro Carvalho Chehab | 3aefb79 | 2008-04-17 21:36:41 -0300 | [diff] [blame] | 671 | |
| 672 | return 0; |
| 673 | } |
| 674 | |
Aidan Thornton | 3421b77 | 2008-04-17 21:40:36 -0300 | [diff] [blame] | 675 | /* ------------------------------------------------------------------ */ |
| 676 | |
Jarod Wilson | f2d0c1c | 2011-07-14 19:06:08 -0300 | [diff] [blame] | 677 | static int em28xx_register_dvb(struct em28xx_dvb *dvb, struct module *module, |
| 678 | struct em28xx *dev, struct device *device) |
Aidan Thornton | 3421b77 | 2008-04-17 21:40:36 -0300 | [diff] [blame] | 679 | { |
| 680 | int result; |
| 681 | |
| 682 | mutex_init(&dvb->lock); |
| 683 | |
| 684 | /* register adapter */ |
| 685 | result = dvb_register_adapter(&dvb->adapter, dev->name, module, device, |
| 686 | adapter_nr); |
| 687 | if (result < 0) { |
| 688 | printk(KERN_WARNING "%s: dvb_register_adapter failed (errno = %d)\n", |
| 689 | dev->name, result); |
| 690 | goto fail_adapter; |
| 691 | } |
Mauro Carvalho Chehab | e3569ab | 2008-04-17 21:49:20 -0300 | [diff] [blame] | 692 | |
| 693 | /* Ensure all frontends negotiate bus access */ |
Antti Palosaari | f71095b | 2011-04-07 15:51:52 -0300 | [diff] [blame] | 694 | dvb->fe[0]->ops.ts_bus_ctrl = em28xx_dvb_bus_ctrl; |
| 695 | if (dvb->fe[1]) |
| 696 | dvb->fe[1]->ops.ts_bus_ctrl = em28xx_dvb_bus_ctrl; |
Mauro Carvalho Chehab | e3569ab | 2008-04-17 21:49:20 -0300 | [diff] [blame] | 697 | |
Aidan Thornton | 3421b77 | 2008-04-17 21:40:36 -0300 | [diff] [blame] | 698 | dvb->adapter.priv = dev; |
| 699 | |
| 700 | /* register frontend */ |
Antti Palosaari | f71095b | 2011-04-07 15:51:52 -0300 | [diff] [blame] | 701 | result = dvb_register_frontend(&dvb->adapter, dvb->fe[0]); |
Aidan Thornton | 3421b77 | 2008-04-17 21:40:36 -0300 | [diff] [blame] | 702 | if (result < 0) { |
| 703 | printk(KERN_WARNING "%s: dvb_register_frontend failed (errno = %d)\n", |
| 704 | dev->name, result); |
Antti Palosaari | f71095b | 2011-04-07 15:51:52 -0300 | [diff] [blame] | 705 | goto fail_frontend0; |
| 706 | } |
| 707 | |
| 708 | /* register 2nd frontend */ |
| 709 | if (dvb->fe[1]) { |
| 710 | result = dvb_register_frontend(&dvb->adapter, dvb->fe[1]); |
| 711 | if (result < 0) { |
| 712 | printk(KERN_WARNING "%s: 2nd dvb_register_frontend failed (errno = %d)\n", |
| 713 | dev->name, result); |
| 714 | goto fail_frontend1; |
| 715 | } |
Aidan Thornton | 3421b77 | 2008-04-17 21:40:36 -0300 | [diff] [blame] | 716 | } |
| 717 | |
| 718 | /* register demux stuff */ |
| 719 | dvb->demux.dmx.capabilities = |
| 720 | DMX_TS_FILTERING | DMX_SECTION_FILTERING | |
| 721 | DMX_MEMORY_BASED_FILTERING; |
| 722 | dvb->demux.priv = dvb; |
| 723 | dvb->demux.filternum = 256; |
| 724 | dvb->demux.feednum = 256; |
Jarod Wilson | f2d0c1c | 2011-07-14 19:06:08 -0300 | [diff] [blame] | 725 | dvb->demux.start_feed = em28xx_start_feed; |
| 726 | dvb->demux.stop_feed = em28xx_stop_feed; |
Mauro Carvalho Chehab | e3569ab | 2008-04-17 21:49:20 -0300 | [diff] [blame] | 727 | |
Aidan Thornton | 3421b77 | 2008-04-17 21:40:36 -0300 | [diff] [blame] | 728 | result = dvb_dmx_init(&dvb->demux); |
| 729 | if (result < 0) { |
| 730 | printk(KERN_WARNING "%s: dvb_dmx_init failed (errno = %d)\n", |
| 731 | dev->name, result); |
| 732 | goto fail_dmx; |
| 733 | } |
| 734 | |
| 735 | dvb->dmxdev.filternum = 256; |
| 736 | dvb->dmxdev.demux = &dvb->demux.dmx; |
| 737 | dvb->dmxdev.capabilities = 0; |
| 738 | result = dvb_dmxdev_init(&dvb->dmxdev, &dvb->adapter); |
| 739 | if (result < 0) { |
| 740 | printk(KERN_WARNING "%s: dvb_dmxdev_init failed (errno = %d)\n", |
| 741 | dev->name, result); |
| 742 | goto fail_dmxdev; |
| 743 | } |
| 744 | |
| 745 | dvb->fe_hw.source = DMX_FRONTEND_0; |
| 746 | result = dvb->demux.dmx.add_frontend(&dvb->demux.dmx, &dvb->fe_hw); |
| 747 | if (result < 0) { |
| 748 | printk(KERN_WARNING "%s: add_frontend failed (DMX_FRONTEND_0, errno = %d)\n", |
| 749 | dev->name, result); |
| 750 | goto fail_fe_hw; |
| 751 | } |
| 752 | |
| 753 | dvb->fe_mem.source = DMX_MEMORY_FE; |
| 754 | result = dvb->demux.dmx.add_frontend(&dvb->demux.dmx, &dvb->fe_mem); |
| 755 | if (result < 0) { |
| 756 | printk(KERN_WARNING "%s: add_frontend failed (DMX_MEMORY_FE, errno = %d)\n", |
| 757 | dev->name, result); |
| 758 | goto fail_fe_mem; |
| 759 | } |
| 760 | |
| 761 | result = dvb->demux.dmx.connect_frontend(&dvb->demux.dmx, &dvb->fe_hw); |
| 762 | if (result < 0) { |
| 763 | printk(KERN_WARNING "%s: connect_frontend failed (errno = %d)\n", |
| 764 | dev->name, result); |
| 765 | goto fail_fe_conn; |
| 766 | } |
| 767 | |
| 768 | /* register network adapter */ |
| 769 | dvb_net_init(&dvb->adapter, &dvb->net, &dvb->demux.dmx); |
| 770 | return 0; |
| 771 | |
| 772 | fail_fe_conn: |
| 773 | dvb->demux.dmx.remove_frontend(&dvb->demux.dmx, &dvb->fe_mem); |
| 774 | fail_fe_mem: |
| 775 | dvb->demux.dmx.remove_frontend(&dvb->demux.dmx, &dvb->fe_hw); |
| 776 | fail_fe_hw: |
| 777 | dvb_dmxdev_release(&dvb->dmxdev); |
| 778 | fail_dmxdev: |
| 779 | dvb_dmx_release(&dvb->demux); |
| 780 | fail_dmx: |
Antti Palosaari | f71095b | 2011-04-07 15:51:52 -0300 | [diff] [blame] | 781 | if (dvb->fe[1]) |
| 782 | dvb_unregister_frontend(dvb->fe[1]); |
| 783 | dvb_unregister_frontend(dvb->fe[0]); |
| 784 | fail_frontend1: |
| 785 | if (dvb->fe[1]) |
| 786 | dvb_frontend_detach(dvb->fe[1]); |
| 787 | fail_frontend0: |
| 788 | dvb_frontend_detach(dvb->fe[0]); |
Aidan Thornton | 3421b77 | 2008-04-17 21:40:36 -0300 | [diff] [blame] | 789 | dvb_unregister_adapter(&dvb->adapter); |
| 790 | fail_adapter: |
| 791 | return result; |
| 792 | } |
| 793 | |
Jarod Wilson | f2d0c1c | 2011-07-14 19:06:08 -0300 | [diff] [blame] | 794 | static void em28xx_unregister_dvb(struct em28xx_dvb *dvb) |
Aidan Thornton | 3421b77 | 2008-04-17 21:40:36 -0300 | [diff] [blame] | 795 | { |
| 796 | dvb_net_release(&dvb->net); |
| 797 | dvb->demux.dmx.remove_frontend(&dvb->demux.dmx, &dvb->fe_mem); |
| 798 | dvb->demux.dmx.remove_frontend(&dvb->demux.dmx, &dvb->fe_hw); |
| 799 | dvb_dmxdev_release(&dvb->dmxdev); |
| 800 | dvb_dmx_release(&dvb->demux); |
Antti Palosaari | f71095b | 2011-04-07 15:51:52 -0300 | [diff] [blame] | 801 | if (dvb->fe[1]) |
| 802 | dvb_unregister_frontend(dvb->fe[1]); |
| 803 | dvb_unregister_frontend(dvb->fe[0]); |
Mauro Carvalho Chehab | c4c3a3d | 2011-07-14 22:23:18 -0300 | [diff] [blame] | 804 | if (dvb->fe[1] && !dvb->dont_attach_fe1) |
Antti Palosaari | f71095b | 2011-04-07 15:51:52 -0300 | [diff] [blame] | 805 | dvb_frontend_detach(dvb->fe[1]); |
| 806 | dvb_frontend_detach(dvb->fe[0]); |
Aidan Thornton | 3421b77 | 2008-04-17 21:40:36 -0300 | [diff] [blame] | 807 | dvb_unregister_adapter(&dvb->adapter); |
| 808 | } |
| 809 | |
Jarod Wilson | f2d0c1c | 2011-07-14 19:06:08 -0300 | [diff] [blame] | 810 | static int em28xx_dvb_init(struct em28xx *dev) |
Mauro Carvalho Chehab | 3aefb79 | 2008-04-17 21:36:41 -0300 | [diff] [blame] | 811 | { |
Antti Palosaari | 1e8f31f | 2012-07-19 21:10:36 -0300 | [diff] [blame^] | 812 | int result = 0, mfe_shared = 0, gpio_chip_base; |
Aidan Thornton | 3421b77 | 2008-04-17 21:40:36 -0300 | [diff] [blame] | 813 | struct em28xx_dvb *dvb; |
Mauro Carvalho Chehab | 3aefb79 | 2008-04-17 21:36:41 -0300 | [diff] [blame] | 814 | |
Mauro Carvalho Chehab | 505b6d0 | 2008-11-25 09:39:50 -0300 | [diff] [blame] | 815 | if (!dev->board.has_dvb) { |
Devin Heitmueller | df61918 | 2008-06-10 12:34:35 -0300 | [diff] [blame] | 816 | /* This device does not support the extension */ |
Mauro Carvalho Chehab | ca3dfd6 | 2010-09-10 17:29:14 -0300 | [diff] [blame] | 817 | printk(KERN_INFO "em28xx_dvb: This device does not support the extension\n"); |
Devin Heitmueller | df61918 | 2008-06-10 12:34:35 -0300 | [diff] [blame] | 818 | return 0; |
| 819 | } |
| 820 | |
Aidan Thornton | 3421b77 | 2008-04-17 21:40:36 -0300 | [diff] [blame] | 821 | dvb = kzalloc(sizeof(struct em28xx_dvb), GFP_KERNEL); |
Douglas Schilling Landgraf | 6ea54d9 | 2008-04-17 21:41:10 -0300 | [diff] [blame] | 822 | |
| 823 | if (dvb == NULL) { |
Filipe Rosset | 480be18 | 2009-11-04 15:32:37 -0300 | [diff] [blame] | 824 | em28xx_info("em28xx_dvb: memory allocation failed\n"); |
Aidan Thornton | 3421b77 | 2008-04-17 21:40:36 -0300 | [diff] [blame] | 825 | return -ENOMEM; |
| 826 | } |
| 827 | dev->dvb = dvb; |
Antti Palosaari | f71095b | 2011-04-07 15:51:52 -0300 | [diff] [blame] | 828 | dvb->fe[0] = dvb->fe[1] = NULL; |
Mauro Carvalho Chehab | 3aefb79 | 2008-04-17 21:36:41 -0300 | [diff] [blame] | 829 | |
Mauro Carvalho Chehab | 5013318 | 2010-04-07 17:07:58 -0300 | [diff] [blame] | 830 | mutex_lock(&dev->lock); |
Mauro Carvalho Chehab | c67ec53 | 2008-04-17 21:48:00 -0300 | [diff] [blame] | 831 | em28xx_set_mode(dev, EM28XX_DIGITAL_MODE); |
Mauro Carvalho Chehab | 3aefb79 | 2008-04-17 21:36:41 -0300 | [diff] [blame] | 832 | /* init frontend */ |
| 833 | switch (dev->model) { |
Mauro Carvalho Chehab | ebaefdb | 2011-06-01 10:16:25 -0300 | [diff] [blame] | 834 | case EM2874_BOARD_LEADERSHIP_ISDBT: |
Antti Palosaari | f71095b | 2011-04-07 15:51:52 -0300 | [diff] [blame] | 835 | dvb->fe[0] = dvb_attach(s921_attach, |
Mauro Carvalho Chehab | ca3dfd6 | 2010-09-10 17:29:14 -0300 | [diff] [blame] | 836 | &sharp_isdbt, &dev->i2c_adap); |
| 837 | |
Antti Palosaari | f71095b | 2011-04-07 15:51:52 -0300 | [diff] [blame] | 838 | if (!dvb->fe[0]) { |
Mauro Carvalho Chehab | ca3dfd6 | 2010-09-10 17:29:14 -0300 | [diff] [blame] | 839 | result = -EINVAL; |
| 840 | goto out_free; |
| 841 | } |
| 842 | |
| 843 | break; |
Douglas Schilling Landgraf | f89bc32 | 2008-12-01 21:01:04 -0300 | [diff] [blame] | 844 | case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_850: |
Mauro Carvalho Chehab | 10ac660 | 2008-07-27 14:58:58 -0300 | [diff] [blame] | 845 | case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950: |
Devin Heitmueller | 4fd305b | 2008-06-04 13:43:46 -0300 | [diff] [blame] | 846 | case EM2880_BOARD_PINNACLE_PCTV_HD_PRO: |
Devin Heitmueller | e14b365 | 2008-07-26 11:04:33 -0300 | [diff] [blame] | 847 | case EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600: |
Antti Palosaari | f71095b | 2011-04-07 15:51:52 -0300 | [diff] [blame] | 848 | dvb->fe[0] = dvb_attach(lgdt330x_attach, |
Aidan Thornton | 3421b77 | 2008-04-17 21:40:36 -0300 | [diff] [blame] | 849 | &em2880_lgdt3303_dev, |
| 850 | &dev->i2c_adap); |
Jarod Wilson | f2d0c1c | 2011-07-14 19:06:08 -0300 | [diff] [blame] | 851 | if (em28xx_attach_xc3028(0x61, dev) < 0) { |
Aidan Thornton | 3421b77 | 2008-04-17 21:40:36 -0300 | [diff] [blame] | 852 | result = -EINVAL; |
| 853 | goto out_free; |
| 854 | } |
Mauro Carvalho Chehab | 227ad4a | 2008-04-17 21:37:40 -0300 | [diff] [blame] | 855 | break; |
Thierry MERLE | 46510b5 | 2008-10-11 16:56:13 -0300 | [diff] [blame] | 856 | case EM2880_BOARD_KWORLD_DVB_310U: |
Antti Palosaari | f71095b | 2011-04-07 15:51:52 -0300 | [diff] [blame] | 857 | dvb->fe[0] = dvb_attach(zl10353_attach, |
Aidan Thornton | 3421b77 | 2008-04-17 21:40:36 -0300 | [diff] [blame] | 858 | &em28xx_zl10353_with_xc3028, |
| 859 | &dev->i2c_adap); |
Jarod Wilson | f2d0c1c | 2011-07-14 19:06:08 -0300 | [diff] [blame] | 860 | if (em28xx_attach_xc3028(0x61, dev) < 0) { |
Aidan Thornton | 3421b77 | 2008-04-17 21:40:36 -0300 | [diff] [blame] | 861 | result = -EINVAL; |
| 862 | goto out_free; |
| 863 | } |
Aidan Thornton | 7e6388a | 2008-04-17 21:40:03 -0300 | [diff] [blame] | 864 | break; |
Devin Heitmueller | a84f79a | 2009-07-12 17:05:02 -0300 | [diff] [blame] | 865 | case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900: |
Uroš Vampl | ec994d0 | 2009-09-30 22:53:37 -0300 | [diff] [blame] | 866 | case EM2882_BOARD_TERRATEC_HYBRID_XS: |
Devin Heitmueller | 01a5fd6 | 2009-08-07 09:25:06 -0300 | [diff] [blame] | 867 | case EM2880_BOARD_EMPIRE_DUAL_TV: |
Antti Palosaari | f71095b | 2011-04-07 15:51:52 -0300 | [diff] [blame] | 868 | dvb->fe[0] = dvb_attach(zl10353_attach, |
Devin Heitmueller | a84f79a | 2009-07-12 17:05:02 -0300 | [diff] [blame] | 869 | &em28xx_zl10353_xc3028_no_i2c_gate, |
| 870 | &dev->i2c_adap); |
Jarod Wilson | f2d0c1c | 2011-07-14 19:06:08 -0300 | [diff] [blame] | 871 | if (em28xx_attach_xc3028(0x61, dev) < 0) { |
Devin Heitmueller | a84f79a | 2009-07-12 17:05:02 -0300 | [diff] [blame] | 872 | result = -EINVAL; |
| 873 | goto out_free; |
| 874 | } |
| 875 | break; |
Devin Heitmueller | f797608 | 2009-06-22 22:32:32 -0300 | [diff] [blame] | 876 | case EM2880_BOARD_TERRATEC_HYBRID_XS: |
Catimimi | 6563801 | 2010-02-18 18:06:32 -0300 | [diff] [blame] | 877 | case EM2880_BOARD_TERRATEC_HYBRID_XS_FR: |
Devin Heitmueller | d5b3ba9 | 2009-07-08 21:51:35 -0300 | [diff] [blame] | 878 | case EM2881_BOARD_PINNACLE_HYBRID_PRO: |
Andrea.Amorosi76@gmail.com | 7ca7ef6 | 2010-02-09 17:53:38 -0300 | [diff] [blame] | 879 | case EM2882_BOARD_DIKOM_DK300: |
Antonio Larrosa | 811fab6 | 2010-03-04 22:19:48 -0300 | [diff] [blame] | 880 | case EM2882_BOARD_KWORLD_VS_DVBT: |
Antti Palosaari | f71095b | 2011-04-07 15:51:52 -0300 | [diff] [blame] | 881 | dvb->fe[0] = dvb_attach(zl10353_attach, |
Devin Heitmueller | a84f79a | 2009-07-12 17:05:02 -0300 | [diff] [blame] | 882 | &em28xx_zl10353_xc3028_no_i2c_gate, |
Devin Heitmueller | f797608 | 2009-06-22 22:32:32 -0300 | [diff] [blame] | 883 | &dev->i2c_adap); |
Antti Palosaari | f71095b | 2011-04-07 15:51:52 -0300 | [diff] [blame] | 884 | if (dvb->fe[0] == NULL) { |
Devin Heitmueller | f797608 | 2009-06-22 22:32:32 -0300 | [diff] [blame] | 885 | /* This board could have either a zl10353 or a mt352. |
| 886 | If the chip id isn't for zl10353, try mt352 */ |
Antti Palosaari | f71095b | 2011-04-07 15:51:52 -0300 | [diff] [blame] | 887 | dvb->fe[0] = dvb_attach(mt352_attach, |
Devin Heitmueller | 4fb202a | 2009-07-12 17:51:12 -0300 | [diff] [blame] | 888 | &terratec_xs_mt352_cfg, |
| 889 | &dev->i2c_adap); |
Devin Heitmueller | f797608 | 2009-06-22 22:32:32 -0300 | [diff] [blame] | 890 | } |
Devin Heitmueller | 4fb202a | 2009-07-12 17:51:12 -0300 | [diff] [blame] | 891 | |
Jarod Wilson | f2d0c1c | 2011-07-14 19:06:08 -0300 | [diff] [blame] | 892 | if (em28xx_attach_xc3028(0x61, dev) < 0) { |
Devin Heitmueller | f797608 | 2009-06-22 22:32:32 -0300 | [diff] [blame] | 893 | result = -EINVAL; |
| 894 | goto out_free; |
| 895 | } |
| 896 | break; |
Aivar Päkk | 1985f6f | 2011-12-11 18:15:00 -0300 | [diff] [blame] | 897 | case EM2870_BOARD_KWORLD_355U: |
| 898 | dvb->fe[0] = dvb_attach(zl10353_attach, |
| 899 | &em28xx_zl10353_no_i2c_gate_dev, |
| 900 | &dev->i2c_adap); |
| 901 | if (dvb->fe[0] != NULL) |
| 902 | dvb_attach(qt1010_attach, dvb->fe[0], |
| 903 | &dev->i2c_adap, &em28xx_qt1010_config); |
| 904 | break; |
Robert Krakora | 6e7b9ea | 2009-01-18 21:59:34 -0300 | [diff] [blame] | 905 | case EM2883_BOARD_KWORLD_HYBRID_330U: |
Devin Heitmueller | 1985922 | 2009-06-19 00:33:54 -0300 | [diff] [blame] | 906 | case EM2882_BOARD_EVGA_INDTUBE: |
Antti Palosaari | f71095b | 2011-04-07 15:51:52 -0300 | [diff] [blame] | 907 | dvb->fe[0] = dvb_attach(s5h1409_attach, |
Robert Krakora | 6e7b9ea | 2009-01-18 21:59:34 -0300 | [diff] [blame] | 908 | &em28xx_s5h1409_with_xc3028, |
| 909 | &dev->i2c_adap); |
Jarod Wilson | f2d0c1c | 2011-07-14 19:06:08 -0300 | [diff] [blame] | 910 | if (em28xx_attach_xc3028(0x61, dev) < 0) { |
Robert Krakora | 6e7b9ea | 2009-01-18 21:59:34 -0300 | [diff] [blame] | 911 | result = -EINVAL; |
| 912 | goto out_free; |
| 913 | } |
| 914 | break; |
Franklin Meng | d7de5d8 | 2009-06-06 17:05:02 -0300 | [diff] [blame] | 915 | case EM2882_BOARD_KWORLD_ATSC_315U: |
Antti Palosaari | f71095b | 2011-04-07 15:51:52 -0300 | [diff] [blame] | 916 | dvb->fe[0] = dvb_attach(lgdt330x_attach, |
Franklin Meng | d7de5d8 | 2009-06-06 17:05:02 -0300 | [diff] [blame] | 917 | &em2880_lgdt3303_dev, |
| 918 | &dev->i2c_adap); |
Antti Palosaari | f71095b | 2011-04-07 15:51:52 -0300 | [diff] [blame] | 919 | if (dvb->fe[0] != NULL) { |
| 920 | if (!dvb_attach(simple_tuner_attach, dvb->fe[0], |
Franklin Meng | d7de5d8 | 2009-06-06 17:05:02 -0300 | [diff] [blame] | 921 | &dev->i2c_adap, 0x61, TUNER_THOMSON_DTT761X)) { |
| 922 | result = -EINVAL; |
| 923 | goto out_free; |
| 924 | } |
| 925 | } |
| 926 | break; |
Devin Heitmueller | 17d9d55 | 2008-06-08 10:22:03 -0300 | [diff] [blame] | 927 | case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2: |
Devin Heitmueller | ad9b4bb | 2011-03-13 02:09:59 -0300 | [diff] [blame] | 928 | case EM2882_BOARD_PINNACLE_HYBRID_PRO_330E: |
Antti Palosaari | f71095b | 2011-04-07 15:51:52 -0300 | [diff] [blame] | 929 | dvb->fe[0] = dvb_attach(drxd_attach, &em28xx_drxd, NULL, |
Devin Heitmueller | 75e2b86 | 2011-03-13 02:01:02 -0300 | [diff] [blame] | 930 | &dev->i2c_adap, &dev->udev->dev); |
Jarod Wilson | f2d0c1c | 2011-07-14 19:06:08 -0300 | [diff] [blame] | 931 | if (em28xx_attach_xc3028(0x61, dev) < 0) { |
Devin Heitmueller | 17d9d55 | 2008-06-08 10:22:03 -0300 | [diff] [blame] | 932 | result = -EINVAL; |
| 933 | goto out_free; |
| 934 | } |
| 935 | break; |
Antti Palosaari | 285eb1a | 2009-09-15 14:42:13 -0300 | [diff] [blame] | 936 | case EM2870_BOARD_REDDO_DVB_C_USB_BOX: |
| 937 | /* Philips CU1216L NIM (Philips TDA10023 + Infineon TUA6034) */ |
Antti Palosaari | f71095b | 2011-04-07 15:51:52 -0300 | [diff] [blame] | 938 | dvb->fe[0] = dvb_attach(tda10023_attach, |
Antti Palosaari | 285eb1a | 2009-09-15 14:42:13 -0300 | [diff] [blame] | 939 | &em28xx_tda10023_config, |
| 940 | &dev->i2c_adap, 0x48); |
Antti Palosaari | f71095b | 2011-04-07 15:51:52 -0300 | [diff] [blame] | 941 | if (dvb->fe[0]) { |
| 942 | if (!dvb_attach(simple_tuner_attach, dvb->fe[0], |
Antti Palosaari | 285eb1a | 2009-09-15 14:42:13 -0300 | [diff] [blame] | 943 | &dev->i2c_adap, 0x60, TUNER_PHILIPS_CU1216L)) { |
| 944 | result = -EINVAL; |
| 945 | goto out_free; |
| 946 | } |
| 947 | } |
| 948 | break; |
Jarod Wilson | 7e48b30 | 2010-03-07 17:55:43 -0300 | [diff] [blame] | 949 | case EM2870_BOARD_KWORLD_A340: |
Antti Palosaari | f71095b | 2011-04-07 15:51:52 -0300 | [diff] [blame] | 950 | dvb->fe[0] = dvb_attach(lgdt3305_attach, |
Jarod Wilson | 7e48b30 | 2010-03-07 17:55:43 -0300 | [diff] [blame] | 951 | &em2870_lgdt3304_dev, |
| 952 | &dev->i2c_adap); |
Antti Palosaari | f71095b | 2011-04-07 15:51:52 -0300 | [diff] [blame] | 953 | if (dvb->fe[0] != NULL) |
| 954 | dvb_attach(tda18271_attach, dvb->fe[0], 0x60, |
Jarod Wilson | 7e48b30 | 2010-03-07 17:55:43 -0300 | [diff] [blame] | 955 | &dev->i2c_adap, &kworld_a340_config); |
| 956 | break; |
Antti Palosaari | d6a5f92 | 2011-04-07 16:34:44 -0300 | [diff] [blame] | 957 | case EM28174_BOARD_PCTV_290E: |
Antti Palosaari | d6a5f92 | 2011-04-07 16:34:44 -0300 | [diff] [blame] | 958 | dvb->fe[0] = dvb_attach(cxd2820r_attach, |
Manu Abraham | 7e7b828 | 2011-12-10 00:44:24 -0300 | [diff] [blame] | 959 | &em28xx_cxd2820r_config, |
Antti Palosaari | 1e8f31f | 2012-07-19 21:10:36 -0300 | [diff] [blame^] | 960 | &dev->i2c_adap, |
| 961 | &gpio_chip_base); |
Antti Palosaari | d6a5f92 | 2011-04-07 16:34:44 -0300 | [diff] [blame] | 962 | if (dvb->fe[0]) { |
Antti Palosaari | d6a5f92 | 2011-04-07 16:34:44 -0300 | [diff] [blame] | 963 | /* FE 0 attach tuner */ |
Manu Abraham | 7e7b828 | 2011-12-10 00:44:24 -0300 | [diff] [blame] | 964 | if (!dvb_attach(tda18271_attach, |
| 965 | dvb->fe[0], |
| 966 | 0x60, |
| 967 | &dev->i2c_adap, |
| 968 | &em28xx_cxd2820r_tda18271_config)) { |
| 969 | |
Antti Palosaari | d6a5f92 | 2011-04-07 16:34:44 -0300 | [diff] [blame] | 970 | dvb_frontend_detach(dvb->fe[0]); |
| 971 | result = -EINVAL; |
| 972 | goto out_free; |
| 973 | } |
Antti Palosaari | d6a5f92 | 2011-04-07 16:34:44 -0300 | [diff] [blame] | 974 | } |
Antti Palosaari | 1e8f31f | 2012-07-19 21:10:36 -0300 | [diff] [blame^] | 975 | |
| 976 | /* enable LNA for DVB-T, DVB-T2 and DVB-C */ |
| 977 | result = gpio_request_one(gpio_chip_base, GPIOF_INIT_LOW, |
| 978 | "LNA"); |
| 979 | if (result) |
| 980 | em28xx_errdev("gpio request failed %d\n", result); |
| 981 | else |
| 982 | gpio_free(gpio_chip_base); |
| 983 | |
| 984 | result = 0; /* continue even set LNA fails */ |
Antti Palosaari | d6a5f92 | 2011-04-07 16:34:44 -0300 | [diff] [blame] | 985 | break; |
Eddi De Pieri | 82e7dbb | 2011-11-19 11:37:14 -0300 | [diff] [blame] | 986 | case EM2884_BOARD_HAUPPAUGE_WINTV_HVR_930C: |
Mauro Carvalho Chehab | 8503232 | 2011-11-24 15:01:45 -0200 | [diff] [blame] | 987 | { |
| 988 | struct xc5000_config cfg; |
Eddi De Pieri | 82e7dbb | 2011-11-19 11:37:14 -0300 | [diff] [blame] | 989 | hauppauge_hvr930c_init(dev); |
| 990 | |
Mauro Carvalho Chehab | de72405 | 2011-11-20 11:23:24 -0200 | [diff] [blame] | 991 | dvb->fe[0] = dvb_attach(drxk_attach, |
Mauro Carvalho Chehab | fa4b2a1 | 2012-01-05 08:07:32 -0200 | [diff] [blame] | 992 | &hauppauge_930c_drxk, &dev->i2c_adap); |
Eddi De Pieri | 82e7dbb | 2011-11-19 11:37:14 -0300 | [diff] [blame] | 993 | if (!dvb->fe[0]) { |
| 994 | result = -EINVAL; |
| 995 | goto out_free; |
| 996 | } |
| 997 | /* FIXME: do we need a pll semaphore? */ |
| 998 | dvb->fe[0]->sec_priv = dvb; |
| 999 | sema_init(&dvb->pll_mutex, 1); |
| 1000 | dvb->gate_ctrl = dvb->fe[0]->ops.i2c_gate_ctrl; |
| 1001 | dvb->fe[0]->ops.i2c_gate_ctrl = drxk_gate_ctrl; |
Eddi De Pieri | 82e7dbb | 2011-11-19 11:37:14 -0300 | [diff] [blame] | 1002 | |
| 1003 | /* Attach xc5000 */ |
Eddi De Pieri | 82e7dbb | 2011-11-19 11:37:14 -0300 | [diff] [blame] | 1004 | memset(&cfg, 0, sizeof(cfg)); |
| 1005 | cfg.i2c_address = 0x61; |
Mauro Carvalho Chehab | de72405 | 2011-11-20 11:23:24 -0200 | [diff] [blame] | 1006 | cfg.if_khz = 4000; |
Eddi De Pieri | 82e7dbb | 2011-11-19 11:37:14 -0300 | [diff] [blame] | 1007 | |
| 1008 | if (dvb->fe[0]->ops.i2c_gate_ctrl) |
| 1009 | dvb->fe[0]->ops.i2c_gate_ctrl(dvb->fe[0], 1); |
Mauro Carvalho Chehab | de72405 | 2011-11-20 11:23:24 -0200 | [diff] [blame] | 1010 | if (!dvb_attach(xc5000_attach, dvb->fe[0], &dev->i2c_adap, |
| 1011 | &cfg)) { |
Eddi De Pieri | 82e7dbb | 2011-11-19 11:37:14 -0300 | [diff] [blame] | 1012 | result = -EINVAL; |
| 1013 | goto out_free; |
| 1014 | } |
Eddi De Pieri | 82e7dbb | 2011-11-19 11:37:14 -0300 | [diff] [blame] | 1015 | if (dvb->fe[0]->ops.i2c_gate_ctrl) |
| 1016 | dvb->fe[0]->ops.i2c_gate_ctrl(dvb->fe[0], 0); |
| 1017 | |
Eddi De Pieri | 82e7dbb | 2011-11-19 11:37:14 -0300 | [diff] [blame] | 1018 | break; |
Mauro Carvalho Chehab | 8503232 | 2011-11-24 15:01:45 -0200 | [diff] [blame] | 1019 | } |
Mauro Carvalho Chehab | fec528b | 2011-07-03 21:05:06 -0300 | [diff] [blame] | 1020 | case EM2884_BOARD_TERRATEC_H5: |
| 1021 | terratec_h5_init(dev); |
| 1022 | |
Mauro Carvalho Chehab | fa4b2a1 | 2012-01-05 08:07:32 -0200 | [diff] [blame] | 1023 | dvb->fe[0] = dvb_attach(drxk_attach, &terratec_h5_drxk, &dev->i2c_adap); |
Mauro Carvalho Chehab | c4c3a3d | 2011-07-14 22:23:18 -0300 | [diff] [blame] | 1024 | if (!dvb->fe[0]) { |
Mauro Carvalho Chehab | fec528b | 2011-07-03 21:05:06 -0300 | [diff] [blame] | 1025 | result = -EINVAL; |
| 1026 | goto out_free; |
| 1027 | } |
| 1028 | /* FIXME: do we need a pll semaphore? */ |
| 1029 | dvb->fe[0]->sec_priv = dvb; |
| 1030 | sema_init(&dvb->pll_mutex, 1); |
| 1031 | dvb->gate_ctrl = dvb->fe[0]->ops.i2c_gate_ctrl; |
| 1032 | dvb->fe[0]->ops.i2c_gate_ctrl = drxk_gate_ctrl; |
Mauro Carvalho Chehab | fec528b | 2011-07-03 21:05:06 -0300 | [diff] [blame] | 1033 | |
Mauro Carvalho Chehab | c4c3a3d | 2011-07-14 22:23:18 -0300 | [diff] [blame] | 1034 | /* Attach tda18271 to DVB-C frontend */ |
Mauro Carvalho Chehab | fec528b | 2011-07-03 21:05:06 -0300 | [diff] [blame] | 1035 | if (dvb->fe[0]->ops.i2c_gate_ctrl) |
| 1036 | dvb->fe[0]->ops.i2c_gate_ctrl(dvb->fe[0], 1); |
| 1037 | if (!dvb_attach(tda18271c2dd_attach, dvb->fe[0], &dev->i2c_adap, 0x60)) { |
| 1038 | result = -EINVAL; |
| 1039 | goto out_free; |
| 1040 | } |
| 1041 | if (dvb->fe[0]->ops.i2c_gate_ctrl) |
| 1042 | dvb->fe[0]->ops.i2c_gate_ctrl(dvb->fe[0], 0); |
Mauro Carvalho Chehab | c4c3a3d | 2011-07-14 22:23:18 -0300 | [diff] [blame] | 1043 | |
Mauro Carvalho Chehab | fec528b | 2011-07-03 21:05:06 -0300 | [diff] [blame] | 1044 | break; |
Antti Palosaari | 3658871 | 2011-08-01 01:15:30 -0300 | [diff] [blame] | 1045 | case EM28174_BOARD_PCTV_460E: |
| 1046 | /* attach demod */ |
| 1047 | dvb->fe[0] = dvb_attach(tda10071_attach, |
| 1048 | &em28xx_tda10071_config, &dev->i2c_adap); |
| 1049 | |
| 1050 | /* attach SEC */ |
| 1051 | if (dvb->fe[0]) |
| 1052 | dvb_attach(a8293_attach, dvb->fe[0], &dev->i2c_adap, |
| 1053 | &em28xx_a8293_config); |
| 1054 | break; |
Antti Palosaari | 3553085 | 2012-03-18 18:09:01 -0300 | [diff] [blame] | 1055 | case EM2874_BOARD_MAXMEDIA_UB425_TC: |
| 1056 | /* attach demodulator */ |
| 1057 | dvb->fe[0] = dvb_attach(drxk_attach, &maxmedia_ub425_tc_drxk, |
| 1058 | &dev->i2c_adap); |
| 1059 | |
| 1060 | if (dvb->fe[0]) { |
| 1061 | /* disable I2C-gate */ |
| 1062 | dvb->fe[0]->ops.i2c_gate_ctrl = NULL; |
| 1063 | |
| 1064 | /* attach tuner */ |
| 1065 | if (!dvb_attach(tda18271c2dd_attach, dvb->fe[0], |
| 1066 | &dev->i2c_adap, 0x60)) { |
| 1067 | dvb_frontend_detach(dvb->fe[0]); |
| 1068 | result = -EINVAL; |
| 1069 | goto out_free; |
| 1070 | } |
| 1071 | } |
| 1072 | |
| 1073 | /* TODO: we need drx-3913k firmware in order to support DVB-T */ |
| 1074 | em28xx_info("MaxMedia UB425-TC: only DVB-C supported by that " \ |
| 1075 | "driver version\n"); |
| 1076 | |
| 1077 | break; |
Ivan Kalvachev | fa5527c | 2012-03-19 20:09:55 -0300 | [diff] [blame] | 1078 | case EM2884_BOARD_PCTV_510E: |
| 1079 | case EM2884_BOARD_PCTV_520E: |
| 1080 | pctv_520e_init(dev); |
| 1081 | |
| 1082 | /* attach demodulator */ |
| 1083 | dvb->fe[0] = dvb_attach(drxk_attach, &pctv_520e_drxk, |
| 1084 | &dev->i2c_adap); |
| 1085 | |
| 1086 | if (dvb->fe[0]) { |
| 1087 | /* attach tuner */ |
| 1088 | if (!dvb_attach(tda18271_attach, dvb->fe[0], 0x60, |
| 1089 | &dev->i2c_adap, |
| 1090 | &em28xx_cxd2820r_tda18271_config)) { |
| 1091 | dvb_frontend_detach(dvb->fe[0]); |
| 1092 | result = -EINVAL; |
| 1093 | goto out_free; |
| 1094 | } |
| 1095 | } |
| 1096 | break; |
Martin Blumenstingl | c8dce00 | 2012-06-12 18:19:28 -0300 | [diff] [blame] | 1097 | case EM2884_BOARD_CINERGY_HTC_STICK: |
| 1098 | terratec_htc_stick_init(dev); |
| 1099 | |
| 1100 | /* attach demodulator */ |
| 1101 | dvb->fe[0] = dvb_attach(drxk_attach, &terratec_htc_stick_drxk, |
| 1102 | &dev->i2c_adap); |
| 1103 | if (!dvb->fe[0]) { |
| 1104 | result = -EINVAL; |
| 1105 | goto out_free; |
| 1106 | } |
| 1107 | |
| 1108 | /* Attach the demodulator. */ |
| 1109 | if (!dvb_attach(tda18271_attach, dvb->fe[0], 0x60, |
| 1110 | &dev->i2c_adap, |
| 1111 | &em28xx_cxd2820r_tda18271_config)) { |
| 1112 | result = -EINVAL; |
| 1113 | goto out_free; |
| 1114 | } |
| 1115 | break; |
Mauro Carvalho Chehab | 3aefb79 | 2008-04-17 21:36:41 -0300 | [diff] [blame] | 1116 | default: |
Filipe Rosset | 480be18 | 2009-11-04 15:32:37 -0300 | [diff] [blame] | 1117 | em28xx_errdev("/2: The frontend of your DVB/ATSC card" |
| 1118 | " isn't supported yet\n"); |
Mauro Carvalho Chehab | 3aefb79 | 2008-04-17 21:36:41 -0300 | [diff] [blame] | 1119 | break; |
| 1120 | } |
Antti Palosaari | f71095b | 2011-04-07 15:51:52 -0300 | [diff] [blame] | 1121 | if (NULL == dvb->fe[0]) { |
Filipe Rosset | 480be18 | 2009-11-04 15:32:37 -0300 | [diff] [blame] | 1122 | em28xx_errdev("/2: frontend initialization failed\n"); |
Aidan Thornton | 3421b77 | 2008-04-17 21:40:36 -0300 | [diff] [blame] | 1123 | result = -EINVAL; |
| 1124 | goto out_free; |
Mauro Carvalho Chehab | 3aefb79 | 2008-04-17 21:36:41 -0300 | [diff] [blame] | 1125 | } |
Michael Krufky | d7cba04 | 2008-09-12 13:31:45 -0300 | [diff] [blame] | 1126 | /* define general-purpose callback pointer */ |
Antti Palosaari | f71095b | 2011-04-07 15:51:52 -0300 | [diff] [blame] | 1127 | dvb->fe[0]->callback = em28xx_tuner_callback; |
Eddi De Pieri | 82e7dbb | 2011-11-19 11:37:14 -0300 | [diff] [blame] | 1128 | if (dvb->fe[1]) |
Mauro Carvalho Chehab | de72405 | 2011-11-20 11:23:24 -0200 | [diff] [blame] | 1129 | dvb->fe[1]->callback = em28xx_tuner_callback; |
Mauro Carvalho Chehab | 3aefb79 | 2008-04-17 21:36:41 -0300 | [diff] [blame] | 1130 | |
| 1131 | /* register everything */ |
Jarod Wilson | f2d0c1c | 2011-07-14 19:06:08 -0300 | [diff] [blame] | 1132 | result = em28xx_register_dvb(dvb, THIS_MODULE, dev, &dev->udev->dev); |
Aidan Thornton | 3421b77 | 2008-04-17 21:40:36 -0300 | [diff] [blame] | 1133 | |
Douglas Schilling Landgraf | 6ea54d9 | 2008-04-17 21:41:10 -0300 | [diff] [blame] | 1134 | if (result < 0) |
Aidan Thornton | 3421b77 | 2008-04-17 21:40:36 -0300 | [diff] [blame] | 1135 | goto out_free; |
Aidan Thornton | 3421b77 | 2008-04-17 21:40:36 -0300 | [diff] [blame] | 1136 | |
Antti Palosaari | e364543 | 2011-07-28 18:59:30 -0300 | [diff] [blame] | 1137 | /* MFE lock */ |
| 1138 | dvb->adapter.mfe_shared = mfe_shared; |
| 1139 | |
Filipe Rosset | 480be18 | 2009-11-04 15:32:37 -0300 | [diff] [blame] | 1140 | em28xx_info("Successfully loaded em28xx-dvb\n"); |
Mauro Carvalho Chehab | 5013318 | 2010-04-07 17:07:58 -0300 | [diff] [blame] | 1141 | ret: |
| 1142 | em28xx_set_mode(dev, EM28XX_SUSPEND); |
| 1143 | mutex_unlock(&dev->lock); |
| 1144 | return result; |
Aidan Thornton | 3421b77 | 2008-04-17 21:40:36 -0300 | [diff] [blame] | 1145 | |
| 1146 | out_free: |
| 1147 | kfree(dvb); |
| 1148 | dev->dvb = NULL; |
Mauro Carvalho Chehab | 5013318 | 2010-04-07 17:07:58 -0300 | [diff] [blame] | 1149 | goto ret; |
Mauro Carvalho Chehab | 3aefb79 | 2008-04-17 21:36:41 -0300 | [diff] [blame] | 1150 | } |
| 1151 | |
Chris Rankin | 0b8bd83 | 2011-08-20 16:01:26 -0300 | [diff] [blame] | 1152 | static inline void prevent_sleep(struct dvb_frontend_ops *ops) |
| 1153 | { |
| 1154 | ops->set_voltage = NULL; |
| 1155 | ops->sleep = NULL; |
| 1156 | ops->tuner_ops.sleep = NULL; |
| 1157 | } |
| 1158 | |
Jarod Wilson | f2d0c1c | 2011-07-14 19:06:08 -0300 | [diff] [blame] | 1159 | static int em28xx_dvb_fini(struct em28xx *dev) |
Mauro Carvalho Chehab | 3aefb79 | 2008-04-17 21:36:41 -0300 | [diff] [blame] | 1160 | { |
Mauro Carvalho Chehab | 505b6d0 | 2008-11-25 09:39:50 -0300 | [diff] [blame] | 1161 | if (!dev->board.has_dvb) { |
Devin Heitmueller | df61918 | 2008-06-10 12:34:35 -0300 | [diff] [blame] | 1162 | /* This device does not support the extension */ |
| 1163 | return 0; |
| 1164 | } |
| 1165 | |
Aidan Thornton | 3421b77 | 2008-04-17 21:40:36 -0300 | [diff] [blame] | 1166 | if (dev->dvb) { |
Chris Rankin | 0b8bd83 | 2011-08-20 16:01:26 -0300 | [diff] [blame] | 1167 | struct em28xx_dvb *dvb = dev->dvb; |
| 1168 | |
| 1169 | if (dev->state & DEV_DISCONNECTED) { |
| 1170 | /* We cannot tell the device to sleep |
| 1171 | * once it has been unplugged. */ |
| 1172 | if (dvb->fe[0]) |
| 1173 | prevent_sleep(&dvb->fe[0]->ops); |
| 1174 | if (dvb->fe[1]) |
| 1175 | prevent_sleep(&dvb->fe[1]->ops); |
| 1176 | } |
| 1177 | |
| 1178 | em28xx_unregister_dvb(dvb); |
| 1179 | kfree(dvb); |
Aidan Thornton | 3421b77 | 2008-04-17 21:40:36 -0300 | [diff] [blame] | 1180 | dev->dvb = NULL; |
| 1181 | } |
Mauro Carvalho Chehab | 3aefb79 | 2008-04-17 21:36:41 -0300 | [diff] [blame] | 1182 | |
| 1183 | return 0; |
| 1184 | } |
| 1185 | |
| 1186 | static struct em28xx_ops dvb_ops = { |
| 1187 | .id = EM28XX_DVB, |
| 1188 | .name = "Em28xx dvb Extension", |
Jarod Wilson | f2d0c1c | 2011-07-14 19:06:08 -0300 | [diff] [blame] | 1189 | .init = em28xx_dvb_init, |
| 1190 | .fini = em28xx_dvb_fini, |
Mauro Carvalho Chehab | 3aefb79 | 2008-04-17 21:36:41 -0300 | [diff] [blame] | 1191 | }; |
| 1192 | |
| 1193 | static int __init em28xx_dvb_register(void) |
| 1194 | { |
| 1195 | return em28xx_register_extension(&dvb_ops); |
| 1196 | } |
| 1197 | |
| 1198 | static void __exit em28xx_dvb_unregister(void) |
| 1199 | { |
| 1200 | em28xx_unregister_extension(&dvb_ops); |
| 1201 | } |
| 1202 | |
| 1203 | module_init(em28xx_dvb_register); |
| 1204 | module_exit(em28xx_dvb_unregister); |