Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 1 | /* DVB USB compliant linux driver for Conexant USB reference design. |
| 2 | * |
| 3 | * The Conexant reference design I saw on their website was only for analogue |
| 4 | * capturing (using the cx25842). The box I took to write this driver (reverse |
| 5 | * engineered) is the one labeled Medion MD95700. In addition to the cx25842 |
| 6 | * for analogue capturing it also has a cx22702 DVB-T demodulator on the main |
| 7 | * board. Besides it has a atiremote (X10) and a USB2.0 hub onboard. |
| 8 | * |
| 9 | * Maybe it is a little bit premature to call this driver cxusb, but I assume |
| 10 | * the USB protocol is identical or at least inherited from the reference |
| 11 | * design, so it can be reused for the "analogue-only" device (if it will |
| 12 | * appear at all). |
| 13 | * |
Michael Krufky | 81481e9 | 2006-01-09 18:21:38 -0200 | [diff] [blame] | 14 | * TODO: Use the cx25840-driver for the analogue part |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 15 | * |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 16 | * Copyright (C) 2005 Patrick Boettcher (patrick.boettcher@desy.de) |
Michael Krufky | 5b9ed28 | 2006-10-15 14:51:08 -0300 | [diff] [blame] | 17 | * Copyright (C) 2006 Michael Krufky (mkrufky@linuxtv.org) |
Chris Pascoe | aeb012b | 2007-11-19 21:57:10 -0300 | [diff] [blame] | 18 | * Copyright (C) 2006, 2007 Chris Pascoe (c.pascoe@itee.uq.edu.au) |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 19 | * |
Michael Krufky | f35db23 | 2006-12-05 14:53:39 -0300 | [diff] [blame] | 20 | * This program is free software; you can redistribute it and/or modify it |
| 21 | * under the terms of the GNU General Public License as published by the Free |
| 22 | * Software Foundation, version 2. |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 23 | * |
| 24 | * see Documentation/dvb/README.dvb-usb for more information |
| 25 | */ |
Michael Krufky | 827855d | 2008-04-22 14:46:16 -0300 | [diff] [blame] | 26 | #include <media/tuner.h> |
David Woodhouse | e62f89f | 2008-05-24 00:12:42 +0100 | [diff] [blame] | 27 | #include <linux/vmalloc.h> |
Tejun Heo | 5a0e3ad | 2010-03-24 17:04:11 +0900 | [diff] [blame] | 28 | #include <linux/slab.h> |
Michael Krufky | 827855d | 2008-04-22 14:46:16 -0300 | [diff] [blame] | 29 | |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 30 | #include "cxusb.h" |
| 31 | |
| 32 | #include "cx22702.h" |
Michael Krufky | effee03 | 2006-01-09 15:25:47 -0200 | [diff] [blame] | 33 | #include "lgdt330x.h" |
Chris Pascoe | 0029ee1 | 2006-01-09 18:21:28 -0200 | [diff] [blame] | 34 | #include "mt352.h" |
| 35 | #include "mt352_priv.h" |
Michael Krufky | c9ce394 | 2006-06-11 04:24:31 -0300 | [diff] [blame] | 36 | #include "zl10353.h" |
Chris Pascoe | aeb012b | 2007-11-19 21:57:10 -0300 | [diff] [blame] | 37 | #include "tuner-xc2028.h" |
Michael Krufky | 827855d | 2008-04-22 14:46:16 -0300 | [diff] [blame] | 38 | #include "tuner-simple.h" |
Daniel Gimpelevich | f5376ad | 2008-06-28 05:01:30 -0300 | [diff] [blame] | 39 | #include "mxl5005s.h" |
David Wong | b18bd1d | 2009-10-26 09:41:22 -0300 | [diff] [blame] | 40 | #include "max2165.h" |
Anton Blanchard | 8d79898 | 2008-08-09 12:23:15 -0300 | [diff] [blame] | 41 | #include "dib7000p.h" |
| 42 | #include "dib0070.h" |
David T.L. Wong | 6bf1a99 | 2009-08-05 13:07:10 -0300 | [diff] [blame] | 43 | #include "lgs8gxx.h" |
David Wong | b18bd1d | 2009-10-26 09:41:22 -0300 | [diff] [blame] | 44 | #include "atbm8830.h" |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 45 | |
| 46 | /* debug */ |
Adrian Bunk | 53133af | 2007-11-05 14:07:06 -0300 | [diff] [blame] | 47 | static int dvb_usb_cxusb_debug; |
Michael Krufky | f35db23 | 2006-12-05 14:53:39 -0300 | [diff] [blame] | 48 | module_param_named(debug, dvb_usb_cxusb_debug, int, 0644); |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 49 | MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS); |
Janne Grunau | 78e9200 | 2008-04-09 19:13:13 -0300 | [diff] [blame] | 50 | |
| 51 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); |
| 52 | |
Daniel Gimpelevich | f5376ad | 2008-06-28 05:01:30 -0300 | [diff] [blame] | 53 | #define deb_info(args...) dprintk(dvb_usb_cxusb_debug, 0x03, args) |
| 54 | #define deb_i2c(args...) dprintk(dvb_usb_cxusb_debug, 0x02, args) |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 55 | |
| 56 | static int cxusb_ctrl_msg(struct dvb_usb_device *d, |
Michael Krufky | f35db23 | 2006-12-05 14:53:39 -0300 | [diff] [blame] | 57 | u8 cmd, u8 *wbuf, int wlen, u8 *rbuf, int rlen) |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 58 | { |
| 59 | int wo = (rbuf == NULL || rlen == 0); /* write-only */ |
| 60 | u8 sndbuf[1+wlen]; |
Michael Krufky | f35db23 | 2006-12-05 14:53:39 -0300 | [diff] [blame] | 61 | memset(sndbuf, 0, 1+wlen); |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 62 | |
| 63 | sndbuf[0] = cmd; |
Michael Krufky | f35db23 | 2006-12-05 14:53:39 -0300 | [diff] [blame] | 64 | memcpy(&sndbuf[1], wbuf, wlen); |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 65 | if (wo) |
Chris Pascoe | b17f109 | 2007-11-19 02:42:44 -0300 | [diff] [blame] | 66 | return dvb_usb_generic_write(d, sndbuf, 1+wlen); |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 67 | else |
Chris Pascoe | b17f109 | 2007-11-19 02:42:44 -0300 | [diff] [blame] | 68 | return dvb_usb_generic_rw(d, sndbuf, 1+wlen, rbuf, rlen, 0); |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 69 | } |
| 70 | |
Patrick Boettcher | e2efeab | 2005-09-09 13:02:51 -0700 | [diff] [blame] | 71 | /* GPIO */ |
| 72 | static void cxusb_gpio_tuner(struct dvb_usb_device *d, int onoff) |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 73 | { |
| 74 | struct cxusb_state *st = d->priv; |
Michael Krufky | f35db23 | 2006-12-05 14:53:39 -0300 | [diff] [blame] | 75 | u8 o[2], i; |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 76 | |
Patrick Boettcher | e2efeab | 2005-09-09 13:02:51 -0700 | [diff] [blame] | 77 | if (st->gpio_write_state[GPIO_TUNER] == onoff) |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 78 | return; |
| 79 | |
Patrick Boettcher | e2efeab | 2005-09-09 13:02:51 -0700 | [diff] [blame] | 80 | o[0] = GPIO_TUNER; |
| 81 | o[1] = onoff; |
Michael Krufky | f35db23 | 2006-12-05 14:53:39 -0300 | [diff] [blame] | 82 | cxusb_ctrl_msg(d, CMD_GPIO_WRITE, o, 2, &i, 1); |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 83 | |
| 84 | if (i != 0x01) |
Patrick Boettcher | e2efeab | 2005-09-09 13:02:51 -0700 | [diff] [blame] | 85 | deb_info("gpio_write failed.\n"); |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 86 | |
Patrick Boettcher | e2efeab | 2005-09-09 13:02:51 -0700 | [diff] [blame] | 87 | st->gpio_write_state[GPIO_TUNER] = onoff; |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 88 | } |
| 89 | |
Chris Pascoe | aeb012b | 2007-11-19 21:57:10 -0300 | [diff] [blame] | 90 | static int cxusb_bluebird_gpio_rw(struct dvb_usb_device *d, u8 changemask, |
| 91 | u8 newval) |
| 92 | { |
| 93 | u8 o[2], gpio_state; |
| 94 | int rc; |
| 95 | |
| 96 | o[0] = 0xff & ~changemask; /* mask of bits to keep */ |
| 97 | o[1] = newval & changemask; /* new values for bits */ |
| 98 | |
| 99 | rc = cxusb_ctrl_msg(d, CMD_BLUEBIRD_GPIO_RW, o, 2, &gpio_state, 1); |
| 100 | if (rc < 0 || (gpio_state & changemask) != (newval & changemask)) |
| 101 | deb_info("bluebird_gpio_write failed.\n"); |
| 102 | |
| 103 | return rc < 0 ? rc : gpio_state; |
| 104 | } |
| 105 | |
| 106 | static void cxusb_bluebird_gpio_pulse(struct dvb_usb_device *d, u8 pin, int low) |
| 107 | { |
| 108 | cxusb_bluebird_gpio_rw(d, pin, low ? 0 : pin); |
| 109 | msleep(5); |
| 110 | cxusb_bluebird_gpio_rw(d, pin, low ? pin : 0); |
| 111 | } |
| 112 | |
Chris Pascoe | 5ccaf90 | 2007-11-20 01:53:31 -0300 | [diff] [blame] | 113 | static void cxusb_nano2_led(struct dvb_usb_device *d, int onoff) |
| 114 | { |
| 115 | cxusb_bluebird_gpio_rw(d, 0x40, onoff ? 0 : 0x40); |
| 116 | } |
| 117 | |
Timothy Lee | dfbdce0 | 2008-08-09 13:36:51 -0300 | [diff] [blame] | 118 | static int cxusb_d680_dmb_gpio_tuner(struct dvb_usb_device *d, |
| 119 | u8 addr, int onoff) |
| 120 | { |
| 121 | u8 o[2] = {addr, onoff}; |
| 122 | u8 i; |
| 123 | int rc; |
| 124 | |
| 125 | rc = cxusb_ctrl_msg(d, CMD_GPIO_WRITE, o, 2, &i, 1); |
| 126 | |
| 127 | if (rc < 0) |
| 128 | return rc; |
| 129 | if (i == 0x01) |
| 130 | return 0; |
| 131 | else { |
| 132 | deb_info("gpio_write failed.\n"); |
| 133 | return -EIO; |
| 134 | } |
| 135 | } |
| 136 | |
Patrick Boettcher | e2efeab | 2005-09-09 13:02:51 -0700 | [diff] [blame] | 137 | /* I2C */ |
Michael Krufky | f35db23 | 2006-12-05 14:53:39 -0300 | [diff] [blame] | 138 | static int cxusb_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], |
| 139 | int num) |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 140 | { |
| 141 | struct dvb_usb_device *d = i2c_get_adapdata(adap); |
| 142 | int i; |
| 143 | |
Ingo Molnar | 3593cab | 2006-02-07 06:49:14 -0200 | [diff] [blame] | 144 | if (mutex_lock_interruptible(&d->i2c_mutex) < 0) |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 145 | return -EAGAIN; |
| 146 | |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 147 | for (i = 0; i < num; i++) { |
| 148 | |
Michael Krufky | 5e805ef | 2006-03-23 00:01:34 -0300 | [diff] [blame] | 149 | if (d->udev->descriptor.idVendor == USB_VID_MEDION) |
| 150 | switch (msg[i].addr) { |
Michael Krufky | f35db23 | 2006-12-05 14:53:39 -0300 | [diff] [blame] | 151 | case 0x63: |
| 152 | cxusb_gpio_tuner(d, 0); |
| 153 | break; |
| 154 | default: |
| 155 | cxusb_gpio_tuner(d, 1); |
| 156 | break; |
Michael Krufky | 5e805ef | 2006-03-23 00:01:34 -0300 | [diff] [blame] | 157 | } |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 158 | |
Chris Pascoe | 272479d7 | 2007-11-19 03:01:22 -0300 | [diff] [blame] | 159 | if (msg[i].flags & I2C_M_RD) { |
| 160 | /* read only */ |
| 161 | u8 obuf[3], ibuf[1+msg[i].len]; |
| 162 | obuf[0] = 0; |
| 163 | obuf[1] = msg[i].len; |
| 164 | obuf[2] = msg[i].addr; |
| 165 | if (cxusb_ctrl_msg(d, CMD_I2C_READ, |
| 166 | obuf, 3, |
| 167 | ibuf, 1+msg[i].len) < 0) { |
| 168 | warn("i2c read failed"); |
| 169 | break; |
| 170 | } |
| 171 | memcpy(msg[i].buf, &ibuf[1], msg[i].len); |
Chris Pascoe | a644e4a | 2007-11-19 03:05:09 -0300 | [diff] [blame] | 172 | } else if (i+1 < num && (msg[i+1].flags & I2C_M_RD) && |
| 173 | msg[i].addr == msg[i+1].addr) { |
| 174 | /* write to then read from same address */ |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 175 | u8 obuf[3+msg[i].len], ibuf[1+msg[i+1].len]; |
| 176 | obuf[0] = msg[i].len; |
| 177 | obuf[1] = msg[i+1].len; |
| 178 | obuf[2] = msg[i].addr; |
Michael Krufky | f35db23 | 2006-12-05 14:53:39 -0300 | [diff] [blame] | 179 | memcpy(&obuf[3], msg[i].buf, msg[i].len); |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 180 | |
| 181 | if (cxusb_ctrl_msg(d, CMD_I2C_READ, |
Michael Krufky | f35db23 | 2006-12-05 14:53:39 -0300 | [diff] [blame] | 182 | obuf, 3+msg[i].len, |
| 183 | ibuf, 1+msg[i+1].len) < 0) |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 184 | break; |
| 185 | |
| 186 | if (ibuf[0] != 0x08) |
Michael Krufky | ae62e3d | 2006-03-23 01:11:18 -0300 | [diff] [blame] | 187 | deb_i2c("i2c read may have failed\n"); |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 188 | |
Michael Krufky | f35db23 | 2006-12-05 14:53:39 -0300 | [diff] [blame] | 189 | memcpy(msg[i+1].buf, &ibuf[1], msg[i+1].len); |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 190 | |
| 191 | i++; |
Chris Pascoe | 272479d7 | 2007-11-19 03:01:22 -0300 | [diff] [blame] | 192 | } else { |
| 193 | /* write only */ |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 194 | u8 obuf[2+msg[i].len], ibuf; |
| 195 | obuf[0] = msg[i].addr; |
| 196 | obuf[1] = msg[i].len; |
Michael Krufky | f35db23 | 2006-12-05 14:53:39 -0300 | [diff] [blame] | 197 | memcpy(&obuf[2], msg[i].buf, msg[i].len); |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 198 | |
Michael Krufky | f35db23 | 2006-12-05 14:53:39 -0300 | [diff] [blame] | 199 | if (cxusb_ctrl_msg(d, CMD_I2C_WRITE, obuf, |
| 200 | 2+msg[i].len, &ibuf,1) < 0) |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 201 | break; |
| 202 | if (ibuf != 0x08) |
Michael Krufky | ae62e3d | 2006-03-23 01:11:18 -0300 | [diff] [blame] | 203 | deb_i2c("i2c write may have failed\n"); |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 204 | } |
| 205 | } |
| 206 | |
Ingo Molnar | 3593cab | 2006-02-07 06:49:14 -0200 | [diff] [blame] | 207 | mutex_unlock(&d->i2c_mutex); |
Chris Pascoe | 13e001d | 2007-11-19 02:48:27 -0300 | [diff] [blame] | 208 | return i == num ? num : -EREMOTEIO; |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 209 | } |
| 210 | |
| 211 | static u32 cxusb_i2c_func(struct i2c_adapter *adapter) |
| 212 | { |
| 213 | return I2C_FUNC_I2C; |
| 214 | } |
| 215 | |
| 216 | static struct i2c_algorithm cxusb_i2c_algo = { |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 217 | .master_xfer = cxusb_i2c_xfer, |
| 218 | .functionality = cxusb_i2c_func, |
| 219 | }; |
| 220 | |
| 221 | static int cxusb_power_ctrl(struct dvb_usb_device *d, int onoff) |
| 222 | { |
Patrick Boettcher | e2efeab | 2005-09-09 13:02:51 -0700 | [diff] [blame] | 223 | u8 b = 0; |
| 224 | if (onoff) |
| 225 | return cxusb_ctrl_msg(d, CMD_POWER_ON, &b, 1, NULL, 0); |
| 226 | else |
| 227 | return cxusb_ctrl_msg(d, CMD_POWER_OFF, &b, 1, NULL, 0); |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 228 | } |
| 229 | |
Daniel Gimpelevich | f5376ad | 2008-06-28 05:01:30 -0300 | [diff] [blame] | 230 | static int cxusb_aver_power_ctrl(struct dvb_usb_device *d, int onoff) |
| 231 | { |
| 232 | int ret; |
| 233 | if (!onoff) |
| 234 | return cxusb_ctrl_msg(d, CMD_POWER_OFF, NULL, 0, NULL, 0); |
| 235 | if (d->state == DVB_USB_STATE_INIT && |
| 236 | usb_set_interface(d->udev, 0, 0) < 0) |
| 237 | err("set interface failed"); |
Hans Verkuil | c6eb8ea | 2008-09-03 17:11:54 -0300 | [diff] [blame] | 238 | do {} while (!(ret = cxusb_ctrl_msg(d, CMD_POWER_ON, NULL, 0, NULL, 0)) && |
Daniel Gimpelevich | f5376ad | 2008-06-28 05:01:30 -0300 | [diff] [blame] | 239 | !(ret = cxusb_ctrl_msg(d, 0x15, NULL, 0, NULL, 0)) && |
| 240 | !(ret = cxusb_ctrl_msg(d, 0x17, NULL, 0, NULL, 0)) && 0); |
| 241 | if (!ret) { |
| 242 | /* FIXME: We don't know why, but we need to configure the |
| 243 | * lgdt3303 with the register settings below on resume */ |
| 244 | int i; |
| 245 | u8 buf, bufs[] = { |
| 246 | 0x0e, 0x2, 0x00, 0x7f, |
| 247 | 0x0e, 0x2, 0x02, 0xfe, |
| 248 | 0x0e, 0x2, 0x02, 0x01, |
| 249 | 0x0e, 0x2, 0x00, 0x03, |
| 250 | 0x0e, 0x2, 0x0d, 0x40, |
| 251 | 0x0e, 0x2, 0x0e, 0x87, |
| 252 | 0x0e, 0x2, 0x0f, 0x8e, |
| 253 | 0x0e, 0x2, 0x10, 0x01, |
| 254 | 0x0e, 0x2, 0x14, 0xd7, |
| 255 | 0x0e, 0x2, 0x47, 0x88, |
| 256 | }; |
| 257 | msleep(20); |
| 258 | for (i = 0; i < sizeof(bufs)/sizeof(u8); i += 4/sizeof(u8)) { |
| 259 | ret = cxusb_ctrl_msg(d, CMD_I2C_WRITE, |
| 260 | bufs+i, 4, &buf, 1); |
| 261 | if (ret) |
| 262 | break; |
| 263 | if (buf != 0x8) |
| 264 | return -EREMOTEIO; |
| 265 | } |
| 266 | } |
| 267 | return ret; |
| 268 | } |
| 269 | |
Michael Krufky | 5691c84 | 2006-04-19 20:40:01 -0300 | [diff] [blame] | 270 | static int cxusb_bluebird_power_ctrl(struct dvb_usb_device *d, int onoff) |
| 271 | { |
| 272 | u8 b = 0; |
| 273 | if (onoff) |
| 274 | return cxusb_ctrl_msg(d, CMD_POWER_ON, &b, 1, NULL, 0); |
| 275 | else |
| 276 | return 0; |
| 277 | } |
| 278 | |
Chris Pascoe | 5ccaf90 | 2007-11-20 01:53:31 -0300 | [diff] [blame] | 279 | static int cxusb_nano2_power_ctrl(struct dvb_usb_device *d, int onoff) |
| 280 | { |
| 281 | int rc = 0; |
| 282 | |
| 283 | rc = cxusb_power_ctrl(d, onoff); |
| 284 | if (!onoff) |
| 285 | cxusb_nano2_led(d, 0); |
| 286 | |
| 287 | return rc; |
| 288 | } |
| 289 | |
Timothy Lee | dfbdce0 | 2008-08-09 13:36:51 -0300 | [diff] [blame] | 290 | static int cxusb_d680_dmb_power_ctrl(struct dvb_usb_device *d, int onoff) |
| 291 | { |
| 292 | int ret; |
| 293 | u8 b; |
| 294 | ret = cxusb_power_ctrl(d, onoff); |
| 295 | if (!onoff) |
| 296 | return ret; |
| 297 | |
| 298 | msleep(128); |
| 299 | cxusb_ctrl_msg(d, CMD_DIGITAL, NULL, 0, &b, 1); |
| 300 | msleep(100); |
| 301 | return ret; |
| 302 | } |
| 303 | |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 304 | static int cxusb_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 305 | { |
Patrick Boettcher | 8257e8a | 2005-07-07 17:58:15 -0700 | [diff] [blame] | 306 | u8 buf[2] = { 0x03, 0x00 }; |
| 307 | if (onoff) |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 308 | cxusb_ctrl_msg(adap->dev, CMD_STREAMING_ON, buf, 2, NULL, 0); |
Patrick Boettcher | 8257e8a | 2005-07-07 17:58:15 -0700 | [diff] [blame] | 309 | else |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 310 | cxusb_ctrl_msg(adap->dev, CMD_STREAMING_OFF, NULL, 0, NULL, 0); |
Patrick Boettcher | 8257e8a | 2005-07-07 17:58:15 -0700 | [diff] [blame] | 311 | |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 312 | return 0; |
| 313 | } |
| 314 | |
Daniel Gimpelevich | f5376ad | 2008-06-28 05:01:30 -0300 | [diff] [blame] | 315 | static int cxusb_aver_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) |
| 316 | { |
| 317 | if (onoff) |
| 318 | cxusb_ctrl_msg(adap->dev, CMD_AVER_STREAM_ON, NULL, 0, NULL, 0); |
| 319 | else |
| 320 | cxusb_ctrl_msg(adap->dev, CMD_AVER_STREAM_OFF, |
| 321 | NULL, 0, NULL, 0); |
| 322 | return 0; |
| 323 | } |
| 324 | |
Timothy Lee | dfbdce0 | 2008-08-09 13:36:51 -0300 | [diff] [blame] | 325 | static void cxusb_d680_dmb_drain_message(struct dvb_usb_device *d) |
| 326 | { |
| 327 | int ep = d->props.generic_bulk_ctrl_endpoint; |
| 328 | const int timeout = 100; |
| 329 | const int junk_len = 32; |
| 330 | u8 *junk; |
| 331 | int rd_count; |
| 332 | |
| 333 | /* Discard remaining data in video pipe */ |
| 334 | junk = kmalloc(junk_len, GFP_KERNEL); |
| 335 | if (!junk) |
| 336 | return; |
| 337 | while (1) { |
| 338 | if (usb_bulk_msg(d->udev, |
| 339 | usb_rcvbulkpipe(d->udev, ep), |
| 340 | junk, junk_len, &rd_count, timeout) < 0) |
| 341 | break; |
| 342 | if (!rd_count) |
| 343 | break; |
| 344 | } |
| 345 | kfree(junk); |
| 346 | } |
| 347 | |
| 348 | static void cxusb_d680_dmb_drain_video(struct dvb_usb_device *d) |
| 349 | { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 350 | struct usb_data_stream_properties *p = &d->props.adapter[0].fe[0].stream; |
Timothy Lee | dfbdce0 | 2008-08-09 13:36:51 -0300 | [diff] [blame] | 351 | const int timeout = 100; |
| 352 | const int junk_len = p->u.bulk.buffersize; |
| 353 | u8 *junk; |
| 354 | int rd_count; |
| 355 | |
| 356 | /* Discard remaining data in video pipe */ |
| 357 | junk = kmalloc(junk_len, GFP_KERNEL); |
| 358 | if (!junk) |
| 359 | return; |
| 360 | while (1) { |
| 361 | if (usb_bulk_msg(d->udev, |
| 362 | usb_rcvbulkpipe(d->udev, p->endpoint), |
| 363 | junk, junk_len, &rd_count, timeout) < 0) |
| 364 | break; |
| 365 | if (!rd_count) |
| 366 | break; |
| 367 | } |
| 368 | kfree(junk); |
| 369 | } |
| 370 | |
| 371 | static int cxusb_d680_dmb_streaming_ctrl( |
| 372 | struct dvb_usb_adapter *adap, int onoff) |
| 373 | { |
| 374 | if (onoff) { |
| 375 | u8 buf[2] = { 0x03, 0x00 }; |
| 376 | cxusb_d680_dmb_drain_video(adap->dev); |
| 377 | return cxusb_ctrl_msg(adap->dev, CMD_STREAMING_ON, |
| 378 | buf, sizeof(buf), NULL, 0); |
| 379 | } else { |
| 380 | int ret = cxusb_ctrl_msg(adap->dev, |
| 381 | CMD_STREAMING_OFF, NULL, 0, NULL, 0); |
| 382 | return ret; |
| 383 | } |
| 384 | } |
| 385 | |
Chris Pascoe | 7c23970 | 2006-01-09 18:21:29 -0200 | [diff] [blame] | 386 | static int cxusb_rc_query(struct dvb_usb_device *d, u32 *event, int *state) |
| 387 | { |
Mauro Carvalho Chehab | 2f4f58d | 2010-11-17 15:46:09 -0300 | [diff] [blame] | 388 | struct rc_map_table *keymap = d->props.rc.legacy.rc_map_table; |
Michael Krufky | a07e609 | 2006-01-09 18:21:31 -0200 | [diff] [blame] | 389 | u8 ircode[4]; |
Chris Pascoe | 7c23970 | 2006-01-09 18:21:29 -0200 | [diff] [blame] | 390 | int i; |
| 391 | |
Michael Krufky | a07e609 | 2006-01-09 18:21:31 -0200 | [diff] [blame] | 392 | cxusb_ctrl_msg(d, CMD_GET_IR_CODE, NULL, 0, ircode, 4); |
Chris Pascoe | 7c23970 | 2006-01-09 18:21:29 -0200 | [diff] [blame] | 393 | |
| 394 | *event = 0; |
| 395 | *state = REMOTE_NO_KEY_PRESSED; |
| 396 | |
Mauro Carvalho Chehab | 2f4f58d | 2010-11-17 15:46:09 -0300 | [diff] [blame] | 397 | for (i = 0; i < d->props.rc.legacy.rc_map_size; i++) { |
Mauro Carvalho Chehab | 2e36588 | 2009-08-29 15:19:31 -0300 | [diff] [blame] | 398 | if (rc5_custom(&keymap[i]) == ircode[2] && |
| 399 | rc5_data(&keymap[i]) == ircode[3]) { |
Mauro Carvalho Chehab | 34abf21 | 2010-07-31 11:24:57 -0300 | [diff] [blame] | 400 | *event = keymap[i].keycode; |
Chris Pascoe | 7c23970 | 2006-01-09 18:21:29 -0200 | [diff] [blame] | 401 | *state = REMOTE_KEY_PRESSED; |
| 402 | |
| 403 | return 0; |
| 404 | } |
| 405 | } |
| 406 | |
| 407 | return 0; |
| 408 | } |
| 409 | |
Chris Pascoe | aeb012b | 2007-11-19 21:57:10 -0300 | [diff] [blame] | 410 | static int cxusb_bluebird2_rc_query(struct dvb_usb_device *d, u32 *event, |
| 411 | int *state) |
| 412 | { |
Mauro Carvalho Chehab | 2f4f58d | 2010-11-17 15:46:09 -0300 | [diff] [blame] | 413 | struct rc_map_table *keymap = d->props.rc.legacy.rc_map_table; |
Chris Pascoe | aeb012b | 2007-11-19 21:57:10 -0300 | [diff] [blame] | 414 | u8 ircode[4]; |
| 415 | int i; |
| 416 | struct i2c_msg msg = { .addr = 0x6b, .flags = I2C_M_RD, |
| 417 | .buf = ircode, .len = 4 }; |
| 418 | |
| 419 | *event = 0; |
| 420 | *state = REMOTE_NO_KEY_PRESSED; |
| 421 | |
| 422 | if (cxusb_i2c_xfer(&d->i2c_adap, &msg, 1) != 1) |
| 423 | return 0; |
| 424 | |
Mauro Carvalho Chehab | 2f4f58d | 2010-11-17 15:46:09 -0300 | [diff] [blame] | 425 | for (i = 0; i < d->props.rc.legacy.rc_map_size; i++) { |
Mauro Carvalho Chehab | 2e36588 | 2009-08-29 15:19:31 -0300 | [diff] [blame] | 426 | if (rc5_custom(&keymap[i]) == ircode[1] && |
| 427 | rc5_data(&keymap[i]) == ircode[2]) { |
Mauro Carvalho Chehab | 34abf21 | 2010-07-31 11:24:57 -0300 | [diff] [blame] | 428 | *event = keymap[i].keycode; |
Chris Pascoe | aeb012b | 2007-11-19 21:57:10 -0300 | [diff] [blame] | 429 | *state = REMOTE_KEY_PRESSED; |
| 430 | |
| 431 | return 0; |
| 432 | } |
| 433 | } |
| 434 | |
| 435 | return 0; |
| 436 | } |
| 437 | |
Timothy Lee | dfbdce0 | 2008-08-09 13:36:51 -0300 | [diff] [blame] | 438 | static int cxusb_d680_dmb_rc_query(struct dvb_usb_device *d, u32 *event, |
| 439 | int *state) |
| 440 | { |
Mauro Carvalho Chehab | 2f4f58d | 2010-11-17 15:46:09 -0300 | [diff] [blame] | 441 | struct rc_map_table *keymap = d->props.rc.legacy.rc_map_table; |
Timothy Lee | dfbdce0 | 2008-08-09 13:36:51 -0300 | [diff] [blame] | 442 | u8 ircode[2]; |
| 443 | int i; |
| 444 | |
| 445 | *event = 0; |
| 446 | *state = REMOTE_NO_KEY_PRESSED; |
| 447 | |
| 448 | if (cxusb_ctrl_msg(d, 0x10, NULL, 0, ircode, 2) < 0) |
| 449 | return 0; |
| 450 | |
Mauro Carvalho Chehab | 2f4f58d | 2010-11-17 15:46:09 -0300 | [diff] [blame] | 451 | for (i = 0; i < d->props.rc.legacy.rc_map_size; i++) { |
Mauro Carvalho Chehab | 2e36588 | 2009-08-29 15:19:31 -0300 | [diff] [blame] | 452 | if (rc5_custom(&keymap[i]) == ircode[0] && |
| 453 | rc5_data(&keymap[i]) == ircode[1]) { |
Mauro Carvalho Chehab | 34abf21 | 2010-07-31 11:24:57 -0300 | [diff] [blame] | 454 | *event = keymap[i].keycode; |
Timothy Lee | dfbdce0 | 2008-08-09 13:36:51 -0300 | [diff] [blame] | 455 | *state = REMOTE_KEY_PRESSED; |
| 456 | |
| 457 | return 0; |
| 458 | } |
| 459 | } |
| 460 | |
| 461 | return 0; |
| 462 | } |
| 463 | |
Mauro Carvalho Chehab | 2f4f58d | 2010-11-17 15:46:09 -0300 | [diff] [blame] | 464 | static struct rc_map_table rc_map_dvico_mce_table[] = { |
Mauro Carvalho Chehab | 2e36588 | 2009-08-29 15:19:31 -0300 | [diff] [blame] | 465 | { 0xfe02, KEY_TV }, |
| 466 | { 0xfe0e, KEY_MP3 }, |
| 467 | { 0xfe1a, KEY_DVD }, |
| 468 | { 0xfe1e, KEY_FAVORITES }, |
| 469 | { 0xfe16, KEY_SETUP }, |
| 470 | { 0xfe46, KEY_POWER2 }, |
| 471 | { 0xfe0a, KEY_EPG }, |
| 472 | { 0xfe49, KEY_BACK }, |
| 473 | { 0xfe4d, KEY_MENU }, |
| 474 | { 0xfe51, KEY_UP }, |
| 475 | { 0xfe5b, KEY_LEFT }, |
| 476 | { 0xfe5f, KEY_RIGHT }, |
| 477 | { 0xfe53, KEY_DOWN }, |
| 478 | { 0xfe5e, KEY_OK }, |
| 479 | { 0xfe59, KEY_INFO }, |
| 480 | { 0xfe55, KEY_TAB }, |
| 481 | { 0xfe0f, KEY_PREVIOUSSONG },/* Replay */ |
| 482 | { 0xfe12, KEY_NEXTSONG }, /* Skip */ |
| 483 | { 0xfe42, KEY_ENTER }, /* Windows/Start */ |
| 484 | { 0xfe15, KEY_VOLUMEUP }, |
| 485 | { 0xfe05, KEY_VOLUMEDOWN }, |
| 486 | { 0xfe11, KEY_CHANNELUP }, |
| 487 | { 0xfe09, KEY_CHANNELDOWN }, |
| 488 | { 0xfe52, KEY_CAMERA }, |
| 489 | { 0xfe5a, KEY_TUNER }, /* Live */ |
| 490 | { 0xfe19, KEY_OPEN }, |
| 491 | { 0xfe0b, KEY_1 }, |
| 492 | { 0xfe17, KEY_2 }, |
| 493 | { 0xfe1b, KEY_3 }, |
| 494 | { 0xfe07, KEY_4 }, |
| 495 | { 0xfe50, KEY_5 }, |
| 496 | { 0xfe54, KEY_6 }, |
| 497 | { 0xfe48, KEY_7 }, |
| 498 | { 0xfe4c, KEY_8 }, |
| 499 | { 0xfe58, KEY_9 }, |
| 500 | { 0xfe13, KEY_ANGLE }, /* Aspect */ |
| 501 | { 0xfe03, KEY_0 }, |
| 502 | { 0xfe1f, KEY_ZOOM }, |
| 503 | { 0xfe43, KEY_REWIND }, |
| 504 | { 0xfe47, KEY_PLAYPAUSE }, |
| 505 | { 0xfe4f, KEY_FASTFORWARD }, |
| 506 | { 0xfe57, KEY_MUTE }, |
| 507 | { 0xfe0d, KEY_STOP }, |
| 508 | { 0xfe01, KEY_RECORD }, |
| 509 | { 0xfe4e, KEY_POWER }, |
Michael Krufky | a07e609 | 2006-01-09 18:21:31 -0200 | [diff] [blame] | 510 | }; |
| 511 | |
Mauro Carvalho Chehab | 2f4f58d | 2010-11-17 15:46:09 -0300 | [diff] [blame] | 512 | static struct rc_map_table rc_map_dvico_portable_table[] = { |
Mauro Carvalho Chehab | 2e36588 | 2009-08-29 15:19:31 -0300 | [diff] [blame] | 513 | { 0xfc02, KEY_SETUP }, /* Profile */ |
| 514 | { 0xfc43, KEY_POWER2 }, |
| 515 | { 0xfc06, KEY_EPG }, |
| 516 | { 0xfc5a, KEY_BACK }, |
| 517 | { 0xfc05, KEY_MENU }, |
| 518 | { 0xfc47, KEY_INFO }, |
| 519 | { 0xfc01, KEY_TAB }, |
| 520 | { 0xfc42, KEY_PREVIOUSSONG },/* Replay */ |
| 521 | { 0xfc49, KEY_VOLUMEUP }, |
| 522 | { 0xfc09, KEY_VOLUMEDOWN }, |
| 523 | { 0xfc54, KEY_CHANNELUP }, |
| 524 | { 0xfc0b, KEY_CHANNELDOWN }, |
| 525 | { 0xfc16, KEY_CAMERA }, |
| 526 | { 0xfc40, KEY_TUNER }, /* ATV/DTV */ |
| 527 | { 0xfc45, KEY_OPEN }, |
| 528 | { 0xfc19, KEY_1 }, |
| 529 | { 0xfc18, KEY_2 }, |
| 530 | { 0xfc1b, KEY_3 }, |
| 531 | { 0xfc1a, KEY_4 }, |
| 532 | { 0xfc58, KEY_5 }, |
| 533 | { 0xfc59, KEY_6 }, |
| 534 | { 0xfc15, KEY_7 }, |
| 535 | { 0xfc14, KEY_8 }, |
| 536 | { 0xfc17, KEY_9 }, |
| 537 | { 0xfc44, KEY_ANGLE }, /* Aspect */ |
| 538 | { 0xfc55, KEY_0 }, |
| 539 | { 0xfc07, KEY_ZOOM }, |
| 540 | { 0xfc0a, KEY_REWIND }, |
| 541 | { 0xfc08, KEY_PLAYPAUSE }, |
| 542 | { 0xfc4b, KEY_FASTFORWARD }, |
| 543 | { 0xfc5b, KEY_MUTE }, |
| 544 | { 0xfc04, KEY_STOP }, |
| 545 | { 0xfc56, KEY_RECORD }, |
| 546 | { 0xfc57, KEY_POWER }, |
| 547 | { 0xfc41, KEY_UNKNOWN }, /* INPUT */ |
| 548 | { 0xfc00, KEY_UNKNOWN }, /* HD */ |
Michael Krufky | c150178 | 2006-03-26 05:43:36 -0300 | [diff] [blame] | 549 | }; |
| 550 | |
Mauro Carvalho Chehab | 2f4f58d | 2010-11-17 15:46:09 -0300 | [diff] [blame] | 551 | static struct rc_map_table rc_map_d680_dmb_table[] = { |
Mauro Carvalho Chehab | 2e36588 | 2009-08-29 15:19:31 -0300 | [diff] [blame] | 552 | { 0x0038, KEY_UNKNOWN }, /* TV/AV */ |
| 553 | { 0x080c, KEY_ZOOM }, |
| 554 | { 0x0800, KEY_0 }, |
| 555 | { 0x0001, KEY_1 }, |
| 556 | { 0x0802, KEY_2 }, |
| 557 | { 0x0003, KEY_3 }, |
| 558 | { 0x0804, KEY_4 }, |
| 559 | { 0x0005, KEY_5 }, |
| 560 | { 0x0806, KEY_6 }, |
| 561 | { 0x0007, KEY_7 }, |
| 562 | { 0x0808, KEY_8 }, |
| 563 | { 0x0009, KEY_9 }, |
| 564 | { 0x000a, KEY_MUTE }, |
| 565 | { 0x0829, KEY_BACK }, |
| 566 | { 0x0012, KEY_CHANNELUP }, |
| 567 | { 0x0813, KEY_CHANNELDOWN }, |
| 568 | { 0x002b, KEY_VOLUMEUP }, |
| 569 | { 0x082c, KEY_VOLUMEDOWN }, |
| 570 | { 0x0020, KEY_UP }, |
| 571 | { 0x0821, KEY_DOWN }, |
| 572 | { 0x0011, KEY_LEFT }, |
| 573 | { 0x0810, KEY_RIGHT }, |
| 574 | { 0x000d, KEY_OK }, |
| 575 | { 0x081f, KEY_RECORD }, |
| 576 | { 0x0017, KEY_PLAYPAUSE }, |
| 577 | { 0x0816, KEY_PLAYPAUSE }, |
| 578 | { 0x000b, KEY_STOP }, |
| 579 | { 0x0827, KEY_FASTFORWARD }, |
| 580 | { 0x0026, KEY_REWIND }, |
| 581 | { 0x081e, KEY_UNKNOWN }, /* Time Shift */ |
| 582 | { 0x000e, KEY_UNKNOWN }, /* Snapshot */ |
| 583 | { 0x082d, KEY_UNKNOWN }, /* Mouse Cursor */ |
| 584 | { 0x000f, KEY_UNKNOWN }, /* Minimize/Maximize */ |
| 585 | { 0x0814, KEY_UNKNOWN }, /* Shuffle */ |
| 586 | { 0x0025, KEY_POWER }, |
Timothy Lee | dfbdce0 | 2008-08-09 13:36:51 -0300 | [diff] [blame] | 587 | }; |
| 588 | |
Chris Pascoe | 0029ee1 | 2006-01-09 18:21:28 -0200 | [diff] [blame] | 589 | static int cxusb_dee1601_demod_init(struct dvb_frontend* fe) |
| 590 | { |
Chris Pascoe | d9ed881 | 2006-02-07 06:49:11 -0200 | [diff] [blame] | 591 | static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x28 }; |
Chris Pascoe | 0029ee1 | 2006-01-09 18:21:28 -0200 | [diff] [blame] | 592 | static u8 reset [] = { RESET, 0x80 }; |
| 593 | static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 }; |
| 594 | static u8 agc_cfg [] = { AGC_TARGET, 0x28, 0x20 }; |
| 595 | static u8 gpp_ctl_cfg [] = { GPP_CTL, 0x33 }; |
| 596 | static u8 capt_range_cfg[] = { CAPT_RANGE, 0x32 }; |
| 597 | |
| 598 | mt352_write(fe, clock_config, sizeof(clock_config)); |
| 599 | udelay(200); |
| 600 | mt352_write(fe, reset, sizeof(reset)); |
| 601 | mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg)); |
| 602 | |
| 603 | mt352_write(fe, agc_cfg, sizeof(agc_cfg)); |
| 604 | mt352_write(fe, gpp_ctl_cfg, sizeof(gpp_ctl_cfg)); |
| 605 | mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg)); |
| 606 | |
| 607 | return 0; |
| 608 | } |
| 609 | |
Michael Krufky | 6f44725 | 2006-01-11 19:40:33 -0200 | [diff] [blame] | 610 | static int cxusb_mt352_demod_init(struct dvb_frontend* fe) |
| 611 | { /* used in both lgz201 and th7579 */ |
Michael Krufky | fb51fd2 | 2006-02-07 06:49:12 -0200 | [diff] [blame] | 612 | static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x29 }; |
Michael Krufky | 6f44725 | 2006-01-11 19:40:33 -0200 | [diff] [blame] | 613 | static u8 reset [] = { RESET, 0x80 }; |
| 614 | static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 }; |
| 615 | static u8 agc_cfg [] = { AGC_TARGET, 0x24, 0x20 }; |
| 616 | static u8 gpp_ctl_cfg [] = { GPP_CTL, 0x33 }; |
| 617 | static u8 capt_range_cfg[] = { CAPT_RANGE, 0x32 }; |
| 618 | |
| 619 | mt352_write(fe, clock_config, sizeof(clock_config)); |
| 620 | udelay(200); |
| 621 | mt352_write(fe, reset, sizeof(reset)); |
| 622 | mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg)); |
| 623 | |
| 624 | mt352_write(fe, agc_cfg, sizeof(agc_cfg)); |
| 625 | mt352_write(fe, gpp_ctl_cfg, sizeof(gpp_ctl_cfg)); |
| 626 | mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg)); |
| 627 | return 0; |
| 628 | } |
| 629 | |
Adrian Bunk | 703cb2c | 2006-01-23 17:11:09 -0200 | [diff] [blame] | 630 | static struct cx22702_config cxusb_cx22702_config = { |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 631 | .demod_address = 0x63, |
Patrick Boettcher | 8257e8a | 2005-07-07 17:58:15 -0700 | [diff] [blame] | 632 | .output_mode = CX22702_PARALLEL_OUTPUT, |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 633 | }; |
| 634 | |
Michael Krufky | fddd632 | 2006-02-27 00:08:17 -0300 | [diff] [blame] | 635 | static struct lgdt330x_config cxusb_lgdt3303_config = { |
Michael Krufky | effee03 | 2006-01-09 15:25:47 -0200 | [diff] [blame] | 636 | .demod_address = 0x0e, |
| 637 | .demod_chip = LGDT3303, |
Michael Krufky | effee03 | 2006-01-09 15:25:47 -0200 | [diff] [blame] | 638 | }; |
| 639 | |
Daniel Gimpelevich | f5376ad | 2008-06-28 05:01:30 -0300 | [diff] [blame] | 640 | static struct lgdt330x_config cxusb_aver_lgdt3303_config = { |
| 641 | .demod_address = 0x0e, |
| 642 | .demod_chip = LGDT3303, |
| 643 | .clock_polarity_flip = 2, |
| 644 | }; |
| 645 | |
Adrian Bunk | 703cb2c | 2006-01-23 17:11:09 -0200 | [diff] [blame] | 646 | static struct mt352_config cxusb_dee1601_config = { |
Chris Pascoe | 0029ee1 | 2006-01-09 18:21:28 -0200 | [diff] [blame] | 647 | .demod_address = 0x0f, |
| 648 | .demod_init = cxusb_dee1601_demod_init, |
Chris Pascoe | 0029ee1 | 2006-01-09 18:21:28 -0200 | [diff] [blame] | 649 | }; |
| 650 | |
Michael Krufky | c9ce394 | 2006-06-11 04:24:31 -0300 | [diff] [blame] | 651 | static struct zl10353_config cxusb_zl10353_dee1601_config = { |
| 652 | .demod_address = 0x0f, |
Chris Pascoe | 8fb9578 | 2006-08-10 03:17:16 -0300 | [diff] [blame] | 653 | .parallel_ts = 1, |
Michael Krufky | c9ce394 | 2006-06-11 04:24:31 -0300 | [diff] [blame] | 654 | }; |
| 655 | |
Adrian Bunk | 6fe00b0 | 2006-04-19 20:49:28 -0300 | [diff] [blame] | 656 | static struct mt352_config cxusb_mt352_config = { |
Michael Krufky | 6f44725 | 2006-01-11 19:40:33 -0200 | [diff] [blame] | 657 | /* used in both lgz201 and th7579 */ |
| 658 | .demod_address = 0x0f, |
| 659 | .demod_init = cxusb_mt352_demod_init, |
Michael Krufky | 6f44725 | 2006-01-11 19:40:33 -0200 | [diff] [blame] | 660 | }; |
| 661 | |
Chris Pascoe | aeb012b | 2007-11-19 21:57:10 -0300 | [diff] [blame] | 662 | static struct zl10353_config cxusb_zl10353_xc3028_config = { |
| 663 | .demod_address = 0x0f, |
Chris Pascoe | a1dcd9d | 2007-11-20 08:17:54 -0300 | [diff] [blame] | 664 | .if2 = 45600, |
Chris Pascoe | aeb012b | 2007-11-19 21:57:10 -0300 | [diff] [blame] | 665 | .no_tuner = 1, |
| 666 | .parallel_ts = 1, |
| 667 | }; |
| 668 | |
Robert Lowery | 0bc3518 | 2009-11-08 00:00:11 -0300 | [diff] [blame] | 669 | static struct zl10353_config cxusb_zl10353_xc3028_config_no_i2c_gate = { |
| 670 | .demod_address = 0x0f, |
| 671 | .if2 = 45600, |
| 672 | .no_tuner = 1, |
| 673 | .parallel_ts = 1, |
| 674 | .disable_i2c_gate_ctrl = 1, |
| 675 | }; |
| 676 | |
Chris Pascoe | 702a676 | 2007-11-20 03:34:11 -0300 | [diff] [blame] | 677 | static struct mt352_config cxusb_mt352_xc3028_config = { |
| 678 | .demod_address = 0x0f, |
| 679 | .if2 = 4560, |
| 680 | .no_tuner = 1, |
| 681 | .demod_init = cxusb_mt352_demod_init, |
| 682 | }; |
| 683 | |
Daniel Gimpelevich | f5376ad | 2008-06-28 05:01:30 -0300 | [diff] [blame] | 684 | /* FIXME: needs tweaking */ |
| 685 | static struct mxl5005s_config aver_a868r_tuner = { |
| 686 | .i2c_address = 0x63, |
| 687 | .if_freq = 6000000UL, |
| 688 | .xtal_freq = CRYSTAL_FREQ_16000000HZ, |
| 689 | .agc_mode = MXL_SINGLE_AGC, |
| 690 | .tracking_filter = MXL_TF_C, |
| 691 | .rssi_enable = MXL_RSSI_ENABLE, |
| 692 | .cap_select = MXL_CAP_SEL_ENABLE, |
| 693 | .div_out = MXL_DIV_OUT_4, |
| 694 | .clock_out = MXL_CLOCK_OUT_DISABLE, |
| 695 | .output_load = MXL5005S_IF_OUTPUT_LOAD_200_OHM, |
| 696 | .top = MXL5005S_TOP_25P2, |
| 697 | .mod_mode = MXL_DIGITAL_MODE, |
| 698 | .if_mode = MXL_ZERO_IF, |
| 699 | .AgcMasterByte = 0x00, |
| 700 | }; |
| 701 | |
Timothy Lee | dfbdce0 | 2008-08-09 13:36:51 -0300 | [diff] [blame] | 702 | /* FIXME: needs tweaking */ |
| 703 | static struct mxl5005s_config d680_dmb_tuner = { |
| 704 | .i2c_address = 0x63, |
| 705 | .if_freq = 36125000UL, |
| 706 | .xtal_freq = CRYSTAL_FREQ_16000000HZ, |
| 707 | .agc_mode = MXL_SINGLE_AGC, |
| 708 | .tracking_filter = MXL_TF_C, |
| 709 | .rssi_enable = MXL_RSSI_ENABLE, |
| 710 | .cap_select = MXL_CAP_SEL_ENABLE, |
| 711 | .div_out = MXL_DIV_OUT_4, |
| 712 | .clock_out = MXL_CLOCK_OUT_DISABLE, |
| 713 | .output_load = MXL5005S_IF_OUTPUT_LOAD_200_OHM, |
| 714 | .top = MXL5005S_TOP_25P2, |
| 715 | .mod_mode = MXL_DIGITAL_MODE, |
| 716 | .if_mode = MXL_ZERO_IF, |
| 717 | .AgcMasterByte = 0x00, |
| 718 | }; |
| 719 | |
David Wong | b18bd1d | 2009-10-26 09:41:22 -0300 | [diff] [blame] | 720 | static struct max2165_config mygica_d689_max2165_cfg = { |
| 721 | .i2c_address = 0x60, |
| 722 | .osc_clk = 20 |
| 723 | }; |
| 724 | |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 725 | /* Callbacks for DVB USB */ |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 726 | static int cxusb_fmd1216me_tuner_attach(struct dvb_usb_adapter *adap) |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 727 | { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 728 | dvb_attach(simple_tuner_attach, adap->fe_adap[0].fe, |
Michael Krufky | cb89cd33 | 2008-04-22 14:46:16 -0300 | [diff] [blame] | 729 | &adap->dev->i2c_adap, 0x61, |
| 730 | TUNER_PHILIPS_FMD1216ME_MK3); |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 731 | return 0; |
| 732 | } |
| 733 | |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 734 | static int cxusb_dee1601_tuner_attach(struct dvb_usb_adapter *adap) |
Chris Pascoe | 0029ee1 | 2006-01-09 18:21:28 -0200 | [diff] [blame] | 735 | { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 736 | dvb_attach(dvb_pll_attach, adap->fe_adap[0].fe, 0x61, |
Michael Krufky | 47a9991 | 2007-06-12 16:10:51 -0300 | [diff] [blame] | 737 | NULL, DVB_PLL_THOMSON_DTT7579); |
Chris Pascoe | 0029ee1 | 2006-01-09 18:21:28 -0200 | [diff] [blame] | 738 | return 0; |
| 739 | } |
| 740 | |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 741 | static int cxusb_lgz201_tuner_attach(struct dvb_usb_adapter *adap) |
Michael Krufky | 6f44725 | 2006-01-11 19:40:33 -0200 | [diff] [blame] | 742 | { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 743 | dvb_attach(dvb_pll_attach, adap->fe_adap[0].fe, 0x61, NULL, DVB_PLL_LG_Z201); |
Michael Krufky | 6f44725 | 2006-01-11 19:40:33 -0200 | [diff] [blame] | 744 | return 0; |
| 745 | } |
| 746 | |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 747 | static int cxusb_dtt7579_tuner_attach(struct dvb_usb_adapter *adap) |
Michael Krufky | 6f44725 | 2006-01-11 19:40:33 -0200 | [diff] [blame] | 748 | { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 749 | dvb_attach(dvb_pll_attach, adap->fe_adap[0].fe, 0x60, |
Michael Krufky | 47a9991 | 2007-06-12 16:10:51 -0300 | [diff] [blame] | 750 | NULL, DVB_PLL_THOMSON_DTT7579); |
Patrick Boettcher | 332bed5 | 2006-05-14 04:49:00 -0300 | [diff] [blame] | 751 | return 0; |
| 752 | } |
| 753 | |
Michael Krufky | f71a56c | 2006-10-13 21:55:57 -0300 | [diff] [blame] | 754 | static int cxusb_lgh064f_tuner_attach(struct dvb_usb_adapter *adap) |
Patrick Boettcher | 332bed5 | 2006-05-14 04:49:00 -0300 | [diff] [blame] | 755 | { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 756 | dvb_attach(simple_tuner_attach, adap->fe_adap[0].fe, |
Michael Krufky | 827855d | 2008-04-22 14:46:16 -0300 | [diff] [blame] | 757 | &adap->dev->i2c_adap, 0x61, TUNER_LG_TDVS_H06XF); |
Michael Krufky | 6f44725 | 2006-01-11 19:40:33 -0200 | [diff] [blame] | 758 | return 0; |
| 759 | } |
| 760 | |
Michael Krufky | d7cba04 | 2008-09-12 13:31:45 -0300 | [diff] [blame] | 761 | static int dvico_bluebird_xc2028_callback(void *ptr, int component, |
| 762 | int command, int arg) |
Chris Pascoe | aeb012b | 2007-11-19 21:57:10 -0300 | [diff] [blame] | 763 | { |
Robert Lowery | d483b73 | 2008-07-30 19:43:11 -0300 | [diff] [blame] | 764 | struct dvb_usb_adapter *adap = ptr; |
| 765 | struct dvb_usb_device *d = adap->dev; |
Chris Pascoe | aeb012b | 2007-11-19 21:57:10 -0300 | [diff] [blame] | 766 | |
| 767 | switch (command) { |
| 768 | case XC2028_TUNER_RESET: |
Harvey Harrison | 708bebd | 2008-04-08 23:20:00 -0300 | [diff] [blame] | 769 | deb_info("%s: XC2028_TUNER_RESET %d\n", __func__, arg); |
Chris Pascoe | aeb012b | 2007-11-19 21:57:10 -0300 | [diff] [blame] | 770 | cxusb_bluebird_gpio_pulse(d, 0x01, 1); |
| 771 | break; |
| 772 | case XC2028_RESET_CLK: |
Harvey Harrison | 708bebd | 2008-04-08 23:20:00 -0300 | [diff] [blame] | 773 | deb_info("%s: XC2028_RESET_CLK %d\n", __func__, arg); |
Chris Pascoe | aeb012b | 2007-11-19 21:57:10 -0300 | [diff] [blame] | 774 | break; |
| 775 | default: |
Harvey Harrison | 708bebd | 2008-04-08 23:20:00 -0300 | [diff] [blame] | 776 | deb_info("%s: unknown command %d, arg %d\n", __func__, |
Chris Pascoe | aeb012b | 2007-11-19 21:57:10 -0300 | [diff] [blame] | 777 | command, arg); |
| 778 | return -EINVAL; |
| 779 | } |
| 780 | |
| 781 | return 0; |
| 782 | } |
| 783 | |
| 784 | static int cxusb_dvico_xc3028_tuner_attach(struct dvb_usb_adapter *adap) |
| 785 | { |
| 786 | struct dvb_frontend *fe; |
| 787 | struct xc2028_config cfg = { |
| 788 | .i2c_adap = &adap->dev->i2c_adap, |
| 789 | .i2c_addr = 0x61, |
Chris Pascoe | aeb012b | 2007-11-19 21:57:10 -0300 | [diff] [blame] | 790 | }; |
| 791 | static struct xc2028_ctrl ctl = { |
Michael Krufky | ef80bfe | 2008-09-16 02:15:30 -0300 | [diff] [blame] | 792 | .fname = XC2028_DEFAULT_FIRMWARE, |
Chris Pascoe | aeb012b | 2007-11-19 21:57:10 -0300 | [diff] [blame] | 793 | .max_len = 64, |
Robert Lowery | d483b73 | 2008-07-30 19:43:11 -0300 | [diff] [blame] | 794 | .demod = XC3028_FE_ZARLINK456, |
Chris Pascoe | aeb012b | 2007-11-19 21:57:10 -0300 | [diff] [blame] | 795 | }; |
| 796 | |
Michael Krufky | d7cba04 | 2008-09-12 13:31:45 -0300 | [diff] [blame] | 797 | /* FIXME: generalize & move to common area */ |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 798 | adap->fe_adap[0].fe->callback = dvico_bluebird_xc2028_callback; |
Michael Krufky | d7cba04 | 2008-09-12 13:31:45 -0300 | [diff] [blame] | 799 | |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 800 | fe = dvb_attach(xc2028_attach, adap->fe_adap[0].fe, &cfg); |
Chris Pascoe | aeb012b | 2007-11-19 21:57:10 -0300 | [diff] [blame] | 801 | if (fe == NULL || fe->ops.tuner_ops.set_config == NULL) |
| 802 | return -EIO; |
| 803 | |
| 804 | fe->ops.tuner_ops.set_config(fe, &ctl); |
| 805 | |
| 806 | return 0; |
| 807 | } |
| 808 | |
Daniel Gimpelevich | f5376ad | 2008-06-28 05:01:30 -0300 | [diff] [blame] | 809 | static int cxusb_mxl5003s_tuner_attach(struct dvb_usb_adapter *adap) |
| 810 | { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 811 | dvb_attach(mxl5005s_attach, adap->fe_adap[0].fe, |
Daniel Gimpelevich | f5376ad | 2008-06-28 05:01:30 -0300 | [diff] [blame] | 812 | &adap->dev->i2c_adap, &aver_a868r_tuner); |
| 813 | return 0; |
| 814 | } |
| 815 | |
Timothy Lee | dfbdce0 | 2008-08-09 13:36:51 -0300 | [diff] [blame] | 816 | static int cxusb_d680_dmb_tuner_attach(struct dvb_usb_adapter *adap) |
| 817 | { |
| 818 | struct dvb_frontend *fe; |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 819 | fe = dvb_attach(mxl5005s_attach, adap->fe_adap[0].fe, |
Timothy Lee | dfbdce0 | 2008-08-09 13:36:51 -0300 | [diff] [blame] | 820 | &adap->dev->i2c_adap, &d680_dmb_tuner); |
| 821 | return (fe == NULL) ? -EIO : 0; |
| 822 | } |
| 823 | |
David Wong | b18bd1d | 2009-10-26 09:41:22 -0300 | [diff] [blame] | 824 | static int cxusb_mygica_d689_tuner_attach(struct dvb_usb_adapter *adap) |
| 825 | { |
| 826 | struct dvb_frontend *fe; |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 827 | fe = dvb_attach(max2165_attach, adap->fe_adap[0].fe, |
David Wong | b18bd1d | 2009-10-26 09:41:22 -0300 | [diff] [blame] | 828 | &adap->dev->i2c_adap, &mygica_d689_max2165_cfg); |
| 829 | return (fe == NULL) ? -EIO : 0; |
| 830 | } |
| 831 | |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 832 | static int cxusb_cx22702_frontend_attach(struct dvb_usb_adapter *adap) |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 833 | { |
Patrick Boettcher | e2efeab | 2005-09-09 13:02:51 -0700 | [diff] [blame] | 834 | u8 b; |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 835 | if (usb_set_interface(adap->dev->udev, 0, 6) < 0) |
Patrick Boettcher | 8257e8a | 2005-07-07 17:58:15 -0700 | [diff] [blame] | 836 | err("set interface failed"); |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 837 | |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 838 | cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, &b, 1); |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 839 | |
Michael Krufky | 310df36 | 2011-09-17 14:22:59 -0300 | [diff] [blame^] | 840 | adap->fe_adap[0].fe = dvb_attach(cx22702_attach, &cxusb_cx22702_config, |
| 841 | &adap->dev->i2c_adap); |
| 842 | if ((adap->fe_adap[0].fe) != NULL) |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 843 | return 0; |
| 844 | |
| 845 | return -EIO; |
| 846 | } |
| 847 | |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 848 | static int cxusb_lgdt3303_frontend_attach(struct dvb_usb_adapter *adap) |
Michael Krufky | effee03 | 2006-01-09 15:25:47 -0200 | [diff] [blame] | 849 | { |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 850 | if (usb_set_interface(adap->dev->udev, 0, 7) < 0) |
Michael Krufky | effee03 | 2006-01-09 15:25:47 -0200 | [diff] [blame] | 851 | err("set interface failed"); |
| 852 | |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 853 | cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0); |
Michael Krufky | effee03 | 2006-01-09 15:25:47 -0200 | [diff] [blame] | 854 | |
Michael Krufky | 310df36 | 2011-09-17 14:22:59 -0300 | [diff] [blame^] | 855 | adap->fe_adap[0].fe = dvb_attach(lgdt330x_attach, |
| 856 | &cxusb_lgdt3303_config, |
| 857 | &adap->dev->i2c_adap); |
| 858 | if ((adap->fe_adap[0].fe) != NULL) |
Michael Krufky | effee03 | 2006-01-09 15:25:47 -0200 | [diff] [blame] | 859 | return 0; |
| 860 | |
| 861 | return -EIO; |
| 862 | } |
| 863 | |
Daniel Gimpelevich | f5376ad | 2008-06-28 05:01:30 -0300 | [diff] [blame] | 864 | static int cxusb_aver_lgdt3303_frontend_attach(struct dvb_usb_adapter *adap) |
| 865 | { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 866 | adap->fe_adap[0].fe = dvb_attach(lgdt330x_attach, &cxusb_aver_lgdt3303_config, |
Daniel Gimpelevich | f5376ad | 2008-06-28 05:01:30 -0300 | [diff] [blame] | 867 | &adap->dev->i2c_adap); |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 868 | if (adap->fe_adap[0].fe != NULL) |
Daniel Gimpelevich | f5376ad | 2008-06-28 05:01:30 -0300 | [diff] [blame] | 869 | return 0; |
| 870 | |
| 871 | return -EIO; |
| 872 | } |
| 873 | |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 874 | static int cxusb_mt352_frontend_attach(struct dvb_usb_adapter *adap) |
Chris Pascoe | 0029ee1 | 2006-01-09 18:21:28 -0200 | [diff] [blame] | 875 | { |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 876 | /* used in both lgz201 and th7579 */ |
| 877 | if (usb_set_interface(adap->dev->udev, 0, 0) < 0) |
Chris Pascoe | 0029ee1 | 2006-01-09 18:21:28 -0200 | [diff] [blame] | 878 | err("set interface failed"); |
| 879 | |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 880 | cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0); |
Chris Pascoe | 0029ee1 | 2006-01-09 18:21:28 -0200 | [diff] [blame] | 881 | |
Michael Krufky | 310df36 | 2011-09-17 14:22:59 -0300 | [diff] [blame^] | 882 | adap->fe_adap[0].fe = dvb_attach(mt352_attach, &cxusb_mt352_config, |
| 883 | &adap->dev->i2c_adap); |
| 884 | if ((adap->fe_adap[0].fe) != NULL) |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 885 | return 0; |
| 886 | |
| 887 | return -EIO; |
| 888 | } |
| 889 | |
| 890 | static int cxusb_dee1601_frontend_attach(struct dvb_usb_adapter *adap) |
| 891 | { |
| 892 | if (usb_set_interface(adap->dev->udev, 0, 0) < 0) |
| 893 | err("set interface failed"); |
| 894 | |
| 895 | cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0); |
| 896 | |
Michael Krufky | 310df36 | 2011-09-17 14:22:59 -0300 | [diff] [blame^] | 897 | adap->fe_adap[0].fe = dvb_attach(mt352_attach, &cxusb_dee1601_config, |
| 898 | &adap->dev->i2c_adap); |
| 899 | if ((adap->fe_adap[0].fe) != NULL) |
| 900 | return 0; |
| 901 | |
| 902 | adap->fe_adap[0].fe = dvb_attach(zl10353_attach, |
| 903 | &cxusb_zl10353_dee1601_config, |
| 904 | &adap->dev->i2c_adap); |
| 905 | if ((adap->fe_adap[0].fe) != NULL) |
Chris Pascoe | 0029ee1 | 2006-01-09 18:21:28 -0200 | [diff] [blame] | 906 | return 0; |
| 907 | |
| 908 | return -EIO; |
| 909 | } |
| 910 | |
Chris Pascoe | aeb012b | 2007-11-19 21:57:10 -0300 | [diff] [blame] | 911 | static int cxusb_dualdig4_frontend_attach(struct dvb_usb_adapter *adap) |
| 912 | { |
| 913 | u8 ircode[4]; |
| 914 | int i; |
| 915 | struct i2c_msg msg = { .addr = 0x6b, .flags = I2C_M_RD, |
| 916 | .buf = ircode, .len = 4 }; |
| 917 | |
| 918 | if (usb_set_interface(adap->dev->udev, 0, 1) < 0) |
| 919 | err("set interface failed"); |
| 920 | |
| 921 | cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0); |
| 922 | |
| 923 | /* reset the tuner and demodulator */ |
| 924 | cxusb_bluebird_gpio_rw(adap->dev, 0x04, 0); |
| 925 | cxusb_bluebird_gpio_pulse(adap->dev, 0x01, 1); |
| 926 | cxusb_bluebird_gpio_pulse(adap->dev, 0x02, 1); |
| 927 | |
Michael Krufky | 310df36 | 2011-09-17 14:22:59 -0300 | [diff] [blame^] | 928 | adap->fe_adap[0].fe = |
| 929 | dvb_attach(zl10353_attach, |
| 930 | &cxusb_zl10353_xc3028_config_no_i2c_gate, |
| 931 | &adap->dev->i2c_adap); |
| 932 | if ((adap->fe_adap[0].fe) == NULL) |
Chris Pascoe | aeb012b | 2007-11-19 21:57:10 -0300 | [diff] [blame] | 933 | return -EIO; |
| 934 | |
| 935 | /* try to determine if there is no IR decoder on the I2C bus */ |
Mauro Carvalho Chehab | 2f4f58d | 2010-11-17 15:46:09 -0300 | [diff] [blame] | 936 | for (i = 0; adap->dev->props.rc.legacy.rc_map_table != NULL && i < 5; i++) { |
Chris Pascoe | aeb012b | 2007-11-19 21:57:10 -0300 | [diff] [blame] | 937 | msleep(20); |
| 938 | if (cxusb_i2c_xfer(&adap->dev->i2c_adap, &msg, 1) != 1) |
| 939 | goto no_IR; |
| 940 | if (ircode[0] == 0 && ircode[1] == 0) |
| 941 | continue; |
| 942 | if (ircode[2] + ircode[3] != 0xff) { |
| 943 | no_IR: |
Mauro Carvalho Chehab | 2f4f58d | 2010-11-17 15:46:09 -0300 | [diff] [blame] | 944 | adap->dev->props.rc.legacy.rc_map_table = NULL; |
Chris Pascoe | aeb012b | 2007-11-19 21:57:10 -0300 | [diff] [blame] | 945 | info("No IR receiver detected on this device."); |
| 946 | break; |
| 947 | } |
| 948 | } |
| 949 | |
| 950 | return 0; |
| 951 | } |
| 952 | |
Anton Blanchard | 8d79898 | 2008-08-09 12:23:15 -0300 | [diff] [blame] | 953 | static struct dibx000_agc_config dib7070_agc_config = { |
| 954 | .band_caps = BAND_UHF | BAND_VHF | BAND_LBAND | BAND_SBAND, |
| 955 | |
| 956 | /* |
| 957 | * P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=5, |
| 958 | * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0, |
| 959 | * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 |
| 960 | */ |
| 961 | .setup = (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | |
| 962 | (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0), |
| 963 | .inv_gain = 600, |
| 964 | .time_stabiliz = 10, |
| 965 | .alpha_level = 0, |
| 966 | .thlock = 118, |
| 967 | .wbd_inv = 0, |
| 968 | .wbd_ref = 3530, |
| 969 | .wbd_sel = 1, |
| 970 | .wbd_alpha = 5, |
| 971 | .agc1_max = 65535, |
| 972 | .agc1_min = 0, |
| 973 | .agc2_max = 65535, |
| 974 | .agc2_min = 0, |
| 975 | .agc1_pt1 = 0, |
| 976 | .agc1_pt2 = 40, |
| 977 | .agc1_pt3 = 183, |
| 978 | .agc1_slope1 = 206, |
| 979 | .agc1_slope2 = 255, |
| 980 | .agc2_pt1 = 72, |
| 981 | .agc2_pt2 = 152, |
| 982 | .agc2_slope1 = 88, |
| 983 | .agc2_slope2 = 90, |
| 984 | .alpha_mant = 17, |
| 985 | .alpha_exp = 27, |
| 986 | .beta_mant = 23, |
| 987 | .beta_exp = 51, |
| 988 | .perform_agc_softsplit = 0, |
| 989 | }; |
| 990 | |
| 991 | static struct dibx000_bandwidth_config dib7070_bw_config_12_mhz = { |
| 992 | .internal = 60000, |
| 993 | .sampling = 15000, |
| 994 | .pll_prediv = 1, |
| 995 | .pll_ratio = 20, |
| 996 | .pll_range = 3, |
| 997 | .pll_reset = 1, |
| 998 | .pll_bypass = 0, |
| 999 | .enable_refdiv = 0, |
| 1000 | .bypclk_div = 0, |
| 1001 | .IO_CLK_en_core = 1, |
| 1002 | .ADClkSrc = 1, |
| 1003 | .modulo = 2, |
| 1004 | /* refsel, sel, freq_15k */ |
| 1005 | .sad_cfg = (3 << 14) | (1 << 12) | (524 << 0), |
| 1006 | .ifreq = (0 << 25) | 0, |
| 1007 | .timf = 20452225, |
| 1008 | .xtal_hz = 12000000, |
| 1009 | }; |
| 1010 | |
| 1011 | static struct dib7000p_config cxusb_dualdig4_rev2_config = { |
| 1012 | .output_mode = OUTMODE_MPEG2_PAR_GATED_CLK, |
| 1013 | .output_mpeg2_in_188_bytes = 1, |
| 1014 | |
| 1015 | .agc_config_count = 1, |
| 1016 | .agc = &dib7070_agc_config, |
| 1017 | .bw = &dib7070_bw_config_12_mhz, |
| 1018 | .tuner_is_baseband = 1, |
| 1019 | .spur_protect = 1, |
| 1020 | |
| 1021 | .gpio_dir = 0xfcef, |
| 1022 | .gpio_val = 0x0110, |
| 1023 | |
| 1024 | .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS, |
| 1025 | |
| 1026 | .hostbus_diversity = 1, |
| 1027 | }; |
| 1028 | |
| 1029 | static int cxusb_dualdig4_rev2_frontend_attach(struct dvb_usb_adapter *adap) |
| 1030 | { |
| 1031 | if (usb_set_interface(adap->dev->udev, 0, 1) < 0) |
| 1032 | err("set interface failed"); |
| 1033 | |
| 1034 | cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0); |
| 1035 | |
| 1036 | cxusb_bluebird_gpio_pulse(adap->dev, 0x02, 1); |
| 1037 | |
Randy Dunlap | 30d81bb | 2010-02-08 20:30:44 -0300 | [diff] [blame] | 1038 | if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18, |
Prarit Bhargava | a49ba16 | 2010-05-12 19:30:02 -0300 | [diff] [blame] | 1039 | &cxusb_dualdig4_rev2_config) < 0) { |
| 1040 | printk(KERN_WARNING "Unable to enumerate dib7000p\n"); |
Randy Dunlap | 30d81bb | 2010-02-08 20:30:44 -0300 | [diff] [blame] | 1041 | return -ENODEV; |
Prarit Bhargava | a49ba16 | 2010-05-12 19:30:02 -0300 | [diff] [blame] | 1042 | } |
Anton Blanchard | 8d79898 | 2008-08-09 12:23:15 -0300 | [diff] [blame] | 1043 | |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 1044 | adap->fe_adap[0].fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80, |
Michael Krufky | a2dc86b | 2008-08-09 13:06:26 -0300 | [diff] [blame] | 1045 | &cxusb_dualdig4_rev2_config); |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 1046 | if (adap->fe_adap[0].fe == NULL) |
Anton Blanchard | 8d79898 | 2008-08-09 12:23:15 -0300 | [diff] [blame] | 1047 | return -EIO; |
| 1048 | |
| 1049 | return 0; |
| 1050 | } |
| 1051 | |
| 1052 | static int dib7070_tuner_reset(struct dvb_frontend *fe, int onoff) |
| 1053 | { |
| 1054 | return dib7000p_set_gpio(fe, 8, 0, !onoff); |
| 1055 | } |
| 1056 | |
| 1057 | static int dib7070_tuner_sleep(struct dvb_frontend *fe, int onoff) |
| 1058 | { |
| 1059 | return 0; |
| 1060 | } |
| 1061 | |
| 1062 | static struct dib0070_config dib7070p_dib0070_config = { |
| 1063 | .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS, |
| 1064 | .reset = dib7070_tuner_reset, |
| 1065 | .sleep = dib7070_tuner_sleep, |
| 1066 | .clock_khz = 12000, |
| 1067 | }; |
| 1068 | |
| 1069 | struct dib0700_adapter_state { |
| 1070 | int (*set_param_save) (struct dvb_frontend *, |
| 1071 | struct dvb_frontend_parameters *); |
| 1072 | }; |
| 1073 | |
| 1074 | static int dib7070_set_param_override(struct dvb_frontend *fe, |
| 1075 | struct dvb_frontend_parameters *fep) |
| 1076 | { |
| 1077 | struct dvb_usb_adapter *adap = fe->dvb->priv; |
| 1078 | struct dib0700_adapter_state *state = adap->priv; |
| 1079 | |
| 1080 | u16 offset; |
| 1081 | u8 band = BAND_OF_FREQUENCY(fep->frequency/1000); |
| 1082 | switch (band) { |
Michael Krufky | a2dc86b | 2008-08-09 13:06:26 -0300 | [diff] [blame] | 1083 | case BAND_VHF: offset = 950; break; |
| 1084 | default: |
| 1085 | case BAND_UHF: offset = 550; break; |
Anton Blanchard | 8d79898 | 2008-08-09 12:23:15 -0300 | [diff] [blame] | 1086 | } |
| 1087 | |
| 1088 | dib7000p_set_wbd_ref(fe, offset + dib0070_wbd_offset(fe)); |
| 1089 | |
| 1090 | return state->set_param_save(fe, fep); |
| 1091 | } |
| 1092 | |
| 1093 | static int cxusb_dualdig4_rev2_tuner_attach(struct dvb_usb_adapter *adap) |
| 1094 | { |
| 1095 | struct dib0700_adapter_state *st = adap->priv; |
Michael Krufky | a2dc86b | 2008-08-09 13:06:26 -0300 | [diff] [blame] | 1096 | struct i2c_adapter *tun_i2c = |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 1097 | dib7000p_get_i2c_master(adap->fe_adap[0].fe, |
Michael Krufky | a2dc86b | 2008-08-09 13:06:26 -0300 | [diff] [blame] | 1098 | DIBX000_I2C_INTERFACE_TUNER, 1); |
Anton Blanchard | 8d79898 | 2008-08-09 12:23:15 -0300 | [diff] [blame] | 1099 | |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 1100 | if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c, |
Anton Blanchard | 8d79898 | 2008-08-09 12:23:15 -0300 | [diff] [blame] | 1101 | &dib7070p_dib0070_config) == NULL) |
| 1102 | return -ENODEV; |
| 1103 | |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 1104 | st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params; |
| 1105 | adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7070_set_param_override; |
Anton Blanchard | 8d79898 | 2008-08-09 12:23:15 -0300 | [diff] [blame] | 1106 | return 0; |
| 1107 | } |
| 1108 | |
Chris Pascoe | 5ccaf90 | 2007-11-20 01:53:31 -0300 | [diff] [blame] | 1109 | static int cxusb_nano2_frontend_attach(struct dvb_usb_adapter *adap) |
| 1110 | { |
| 1111 | if (usb_set_interface(adap->dev->udev, 0, 1) < 0) |
| 1112 | err("set interface failed"); |
| 1113 | |
| 1114 | cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0); |
| 1115 | |
| 1116 | /* reset the tuner and demodulator */ |
| 1117 | cxusb_bluebird_gpio_rw(adap->dev, 0x04, 0); |
| 1118 | cxusb_bluebird_gpio_pulse(adap->dev, 0x01, 1); |
| 1119 | cxusb_bluebird_gpio_pulse(adap->dev, 0x02, 1); |
| 1120 | |
Michael Krufky | 310df36 | 2011-09-17 14:22:59 -0300 | [diff] [blame^] | 1121 | adap->fe_adap[0].fe = dvb_attach(zl10353_attach, |
| 1122 | &cxusb_zl10353_xc3028_config, |
| 1123 | &adap->dev->i2c_adap); |
| 1124 | if ((adap->fe_adap[0].fe) != NULL) |
Chris Pascoe | 5ccaf90 | 2007-11-20 01:53:31 -0300 | [diff] [blame] | 1125 | return 0; |
| 1126 | |
Michael Krufky | 310df36 | 2011-09-17 14:22:59 -0300 | [diff] [blame^] | 1127 | adap->fe_adap[0].fe = dvb_attach(mt352_attach, |
| 1128 | &cxusb_mt352_xc3028_config, |
| 1129 | &adap->dev->i2c_adap); |
| 1130 | if ((adap->fe_adap[0].fe) != NULL) |
Chris Pascoe | 702a676 | 2007-11-20 03:34:11 -0300 | [diff] [blame] | 1131 | return 0; |
| 1132 | |
Chris Pascoe | 5ccaf90 | 2007-11-20 01:53:31 -0300 | [diff] [blame] | 1133 | return -EIO; |
| 1134 | } |
| 1135 | |
David T.L. Wong | 6bf1a99 | 2009-08-05 13:07:10 -0300 | [diff] [blame] | 1136 | static struct lgs8gxx_config d680_lgs8gl5_cfg = { |
| 1137 | .prod = LGS8GXX_PROD_LGS8GL5, |
Timothy Lee | dfbdce0 | 2008-08-09 13:36:51 -0300 | [diff] [blame] | 1138 | .demod_address = 0x19, |
David T.L. Wong | 6bf1a99 | 2009-08-05 13:07:10 -0300 | [diff] [blame] | 1139 | .serial_ts = 0, |
| 1140 | .ts_clk_pol = 0, |
| 1141 | .ts_clk_gated = 1, |
| 1142 | .if_clk_freq = 30400, /* 30.4 MHz */ |
| 1143 | .if_freq = 5725, /* 5.725 MHz */ |
| 1144 | .if_neg_center = 0, |
| 1145 | .ext_adc = 0, |
| 1146 | .adc_signed = 0, |
| 1147 | .if_neg_edge = 0, |
Timothy Lee | dfbdce0 | 2008-08-09 13:36:51 -0300 | [diff] [blame] | 1148 | }; |
| 1149 | |
| 1150 | static int cxusb_d680_dmb_frontend_attach(struct dvb_usb_adapter *adap) |
| 1151 | { |
| 1152 | struct dvb_usb_device *d = adap->dev; |
| 1153 | int n; |
| 1154 | |
| 1155 | /* Select required USB configuration */ |
| 1156 | if (usb_set_interface(d->udev, 0, 0) < 0) |
| 1157 | err("set interface failed"); |
| 1158 | |
| 1159 | /* Unblock all USB pipes */ |
| 1160 | usb_clear_halt(d->udev, |
| 1161 | usb_sndbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint)); |
| 1162 | usb_clear_halt(d->udev, |
| 1163 | usb_rcvbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint)); |
| 1164 | usb_clear_halt(d->udev, |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 1165 | usb_rcvbulkpipe(d->udev, d->props.adapter[0].fe[0].stream.endpoint)); |
Timothy Lee | dfbdce0 | 2008-08-09 13:36:51 -0300 | [diff] [blame] | 1166 | |
| 1167 | /* Drain USB pipes to avoid hang after reboot */ |
| 1168 | for (n = 0; n < 5; n++) { |
| 1169 | cxusb_d680_dmb_drain_message(d); |
| 1170 | cxusb_d680_dmb_drain_video(d); |
| 1171 | msleep(200); |
| 1172 | } |
| 1173 | |
| 1174 | /* Reset the tuner */ |
| 1175 | if (cxusb_d680_dmb_gpio_tuner(d, 0x07, 0) < 0) { |
| 1176 | err("clear tuner gpio failed"); |
| 1177 | return -EIO; |
| 1178 | } |
| 1179 | msleep(100); |
| 1180 | if (cxusb_d680_dmb_gpio_tuner(d, 0x07, 1) < 0) { |
| 1181 | err("set tuner gpio failed"); |
| 1182 | return -EIO; |
| 1183 | } |
| 1184 | msleep(100); |
| 1185 | |
| 1186 | /* Attach frontend */ |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 1187 | adap->fe_adap[0].fe = dvb_attach(lgs8gxx_attach, &d680_lgs8gl5_cfg, &d->i2c_adap); |
| 1188 | if (adap->fe_adap[0].fe == NULL) |
Timothy Lee | dfbdce0 | 2008-08-09 13:36:51 -0300 | [diff] [blame] | 1189 | return -EIO; |
| 1190 | |
| 1191 | return 0; |
| 1192 | } |
| 1193 | |
David Wong | b18bd1d | 2009-10-26 09:41:22 -0300 | [diff] [blame] | 1194 | static struct atbm8830_config mygica_d689_atbm8830_cfg = { |
| 1195 | .prod = ATBM8830_PROD_8830, |
| 1196 | .demod_address = 0x40, |
| 1197 | .serial_ts = 0, |
| 1198 | .ts_sampling_edge = 1, |
| 1199 | .ts_clk_gated = 0, |
| 1200 | .osc_clk_freq = 30400, /* in kHz */ |
| 1201 | .if_freq = 0, /* zero IF */ |
| 1202 | .zif_swap_iq = 1, |
David Wong | c245c75 | 2009-11-28 08:36:31 -0300 | [diff] [blame] | 1203 | .agc_min = 0x2E, |
| 1204 | .agc_max = 0x90, |
| 1205 | .agc_hold_loop = 0, |
David Wong | b18bd1d | 2009-10-26 09:41:22 -0300 | [diff] [blame] | 1206 | }; |
| 1207 | |
| 1208 | static int cxusb_mygica_d689_frontend_attach(struct dvb_usb_adapter *adap) |
| 1209 | { |
| 1210 | struct dvb_usb_device *d = adap->dev; |
David Wong | b18bd1d | 2009-10-26 09:41:22 -0300 | [diff] [blame] | 1211 | |
| 1212 | /* Select required USB configuration */ |
| 1213 | if (usb_set_interface(d->udev, 0, 0) < 0) |
| 1214 | err("set interface failed"); |
| 1215 | |
| 1216 | /* Unblock all USB pipes */ |
| 1217 | usb_clear_halt(d->udev, |
| 1218 | usb_sndbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint)); |
| 1219 | usb_clear_halt(d->udev, |
| 1220 | usb_rcvbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint)); |
| 1221 | usb_clear_halt(d->udev, |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 1222 | usb_rcvbulkpipe(d->udev, d->props.adapter[0].fe[0].stream.endpoint)); |
David Wong | b18bd1d | 2009-10-26 09:41:22 -0300 | [diff] [blame] | 1223 | |
| 1224 | |
| 1225 | /* Reset the tuner */ |
| 1226 | if (cxusb_d680_dmb_gpio_tuner(d, 0x07, 0) < 0) { |
| 1227 | err("clear tuner gpio failed"); |
| 1228 | return -EIO; |
| 1229 | } |
| 1230 | msleep(100); |
| 1231 | if (cxusb_d680_dmb_gpio_tuner(d, 0x07, 1) < 0) { |
| 1232 | err("set tuner gpio failed"); |
| 1233 | return -EIO; |
| 1234 | } |
| 1235 | msleep(100); |
| 1236 | |
| 1237 | /* Attach frontend */ |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 1238 | adap->fe_adap[0].fe = dvb_attach(atbm8830_attach, &mygica_d689_atbm8830_cfg, |
David Wong | b18bd1d | 2009-10-26 09:41:22 -0300 | [diff] [blame] | 1239 | &d->i2c_adap); |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 1240 | if (adap->fe_adap[0].fe == NULL) |
David Wong | b18bd1d | 2009-10-26 09:41:22 -0300 | [diff] [blame] | 1241 | return -EIO; |
| 1242 | |
| 1243 | return 0; |
| 1244 | } |
| 1245 | |
Patrick Boettcher | f537378 | 2006-01-09 18:21:38 -0200 | [diff] [blame] | 1246 | /* |
Chris Pascoe | 702a676 | 2007-11-20 03:34:11 -0300 | [diff] [blame] | 1247 | * DViCO has shipped two devices with the same USB ID, but only one of them |
| 1248 | * needs a firmware download. Check the device class details to see if they |
| 1249 | * have non-default values to decide whether the device is actually cold or |
| 1250 | * not, and forget a match if it turns out we selected the wrong device. |
| 1251 | */ |
| 1252 | static int bluebird_fx2_identify_state(struct usb_device *udev, |
| 1253 | struct dvb_usb_device_properties *props, |
| 1254 | struct dvb_usb_device_description **desc, |
| 1255 | int *cold) |
| 1256 | { |
| 1257 | int wascold = *cold; |
| 1258 | |
| 1259 | *cold = udev->descriptor.bDeviceClass == 0xff && |
| 1260 | udev->descriptor.bDeviceSubClass == 0xff && |
| 1261 | udev->descriptor.bDeviceProtocol == 0xff; |
| 1262 | |
| 1263 | if (*cold && !wascold) |
| 1264 | *desc = NULL; |
| 1265 | |
| 1266 | return 0; |
| 1267 | } |
| 1268 | |
| 1269 | /* |
Patrick Boettcher | f537378 | 2006-01-09 18:21:38 -0200 | [diff] [blame] | 1270 | * DViCO bluebird firmware needs the "warm" product ID to be patched into the |
| 1271 | * firmware file before download. |
| 1272 | */ |
| 1273 | |
Chris Pascoe | 702a676 | 2007-11-20 03:34:11 -0300 | [diff] [blame] | 1274 | static const int dvico_firmware_id_offsets[] = { 6638, 3204 }; |
Michael Krufky | f35db23 | 2006-12-05 14:53:39 -0300 | [diff] [blame] | 1275 | static int bluebird_patch_dvico_firmware_download(struct usb_device *udev, |
| 1276 | const struct firmware *fw) |
Patrick Boettcher | f537378 | 2006-01-09 18:21:38 -0200 | [diff] [blame] | 1277 | { |
Chris Pascoe | 702a676 | 2007-11-20 03:34:11 -0300 | [diff] [blame] | 1278 | int pos; |
Patrick Boettcher | f537378 | 2006-01-09 18:21:38 -0200 | [diff] [blame] | 1279 | |
Chris Pascoe | 702a676 | 2007-11-20 03:34:11 -0300 | [diff] [blame] | 1280 | for (pos = 0; pos < ARRAY_SIZE(dvico_firmware_id_offsets); pos++) { |
| 1281 | int idoff = dvico_firmware_id_offsets[pos]; |
Patrick Boettcher | f537378 | 2006-01-09 18:21:38 -0200 | [diff] [blame] | 1282 | |
Chris Pascoe | 702a676 | 2007-11-20 03:34:11 -0300 | [diff] [blame] | 1283 | if (fw->size < idoff + 4) |
| 1284 | continue; |
Patrick Boettcher | f537378 | 2006-01-09 18:21:38 -0200 | [diff] [blame] | 1285 | |
Chris Pascoe | 702a676 | 2007-11-20 03:34:11 -0300 | [diff] [blame] | 1286 | if (fw->data[idoff] == (USB_VID_DVICO & 0xff) && |
| 1287 | fw->data[idoff + 1] == USB_VID_DVICO >> 8) { |
David Woodhouse | e62f89f | 2008-05-24 00:12:42 +0100 | [diff] [blame] | 1288 | struct firmware new_fw; |
| 1289 | u8 *new_fw_data = vmalloc(fw->size); |
| 1290 | int ret; |
| 1291 | |
| 1292 | if (!new_fw_data) |
| 1293 | return -ENOMEM; |
| 1294 | |
| 1295 | memcpy(new_fw_data, fw->data, fw->size); |
| 1296 | new_fw.size = fw->size; |
| 1297 | new_fw.data = new_fw_data; |
| 1298 | |
| 1299 | new_fw_data[idoff + 2] = |
Chris Pascoe | 702a676 | 2007-11-20 03:34:11 -0300 | [diff] [blame] | 1300 | le16_to_cpu(udev->descriptor.idProduct) + 1; |
David Woodhouse | e62f89f | 2008-05-24 00:12:42 +0100 | [diff] [blame] | 1301 | new_fw_data[idoff + 3] = |
Chris Pascoe | 702a676 | 2007-11-20 03:34:11 -0300 | [diff] [blame] | 1302 | le16_to_cpu(udev->descriptor.idProduct) >> 8; |
| 1303 | |
David Woodhouse | e62f89f | 2008-05-24 00:12:42 +0100 | [diff] [blame] | 1304 | ret = usb_cypress_load_firmware(udev, &new_fw, |
| 1305 | CYPRESS_FX2); |
| 1306 | vfree(new_fw_data); |
| 1307 | return ret; |
Chris Pascoe | 702a676 | 2007-11-20 03:34:11 -0300 | [diff] [blame] | 1308 | } |
Patrick Boettcher | f537378 | 2006-01-09 18:21:38 -0200 | [diff] [blame] | 1309 | } |
| 1310 | |
| 1311 | return -EINVAL; |
| 1312 | } |
| 1313 | |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 1314 | /* DVB USB Driver stuff */ |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 1315 | static struct dvb_usb_device_properties cxusb_medion_properties; |
| 1316 | static struct dvb_usb_device_properties cxusb_bluebird_lgh064f_properties; |
| 1317 | static struct dvb_usb_device_properties cxusb_bluebird_dee1601_properties; |
| 1318 | static struct dvb_usb_device_properties cxusb_bluebird_lgz201_properties; |
| 1319 | static struct dvb_usb_device_properties cxusb_bluebird_dtt7579_properties; |
Chris Pascoe | aeb012b | 2007-11-19 21:57:10 -0300 | [diff] [blame] | 1320 | static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_properties; |
Anton Blanchard | 8d79898 | 2008-08-09 12:23:15 -0300 | [diff] [blame] | 1321 | static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_rev2_properties; |
Chris Pascoe | 5ccaf90 | 2007-11-20 01:53:31 -0300 | [diff] [blame] | 1322 | static struct dvb_usb_device_properties cxusb_bluebird_nano2_properties; |
Chris Pascoe | 702a676 | 2007-11-20 03:34:11 -0300 | [diff] [blame] | 1323 | static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_properties; |
Daniel Gimpelevich | f5376ad | 2008-06-28 05:01:30 -0300 | [diff] [blame] | 1324 | static struct dvb_usb_device_properties cxusb_aver_a868r_properties; |
Timothy Lee | dfbdce0 | 2008-08-09 13:36:51 -0300 | [diff] [blame] | 1325 | static struct dvb_usb_device_properties cxusb_d680_dmb_properties; |
David Wong | b18bd1d | 2009-10-26 09:41:22 -0300 | [diff] [blame] | 1326 | static struct dvb_usb_device_properties cxusb_mygica_d689_properties; |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 1327 | |
| 1328 | static int cxusb_probe(struct usb_interface *intf, |
Michael Krufky | f35db23 | 2006-12-05 14:53:39 -0300 | [diff] [blame] | 1329 | const struct usb_device_id *id) |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 1330 | { |
Janne Grunau | 78e9200 | 2008-04-09 19:13:13 -0300 | [diff] [blame] | 1331 | if (0 == dvb_usb_device_init(intf, &cxusb_medion_properties, |
| 1332 | THIS_MODULE, NULL, adapter_nr) || |
| 1333 | 0 == dvb_usb_device_init(intf, &cxusb_bluebird_lgh064f_properties, |
| 1334 | THIS_MODULE, NULL, adapter_nr) || |
| 1335 | 0 == dvb_usb_device_init(intf, &cxusb_bluebird_dee1601_properties, |
| 1336 | THIS_MODULE, NULL, adapter_nr) || |
| 1337 | 0 == dvb_usb_device_init(intf, &cxusb_bluebird_lgz201_properties, |
| 1338 | THIS_MODULE, NULL, adapter_nr) || |
| 1339 | 0 == dvb_usb_device_init(intf, &cxusb_bluebird_dtt7579_properties, |
| 1340 | THIS_MODULE, NULL, adapter_nr) || |
| 1341 | 0 == dvb_usb_device_init(intf, &cxusb_bluebird_dualdig4_properties, |
| 1342 | THIS_MODULE, NULL, adapter_nr) || |
| 1343 | 0 == dvb_usb_device_init(intf, &cxusb_bluebird_nano2_properties, |
| 1344 | THIS_MODULE, NULL, adapter_nr) || |
| 1345 | 0 == dvb_usb_device_init(intf, |
| 1346 | &cxusb_bluebird_nano2_needsfirmware_properties, |
Daniel Gimpelevich | f5376ad | 2008-06-28 05:01:30 -0300 | [diff] [blame] | 1347 | THIS_MODULE, NULL, adapter_nr) || |
| 1348 | 0 == dvb_usb_device_init(intf, &cxusb_aver_a868r_properties, |
| 1349 | THIS_MODULE, NULL, adapter_nr) || |
Anton Blanchard | 8d79898 | 2008-08-09 12:23:15 -0300 | [diff] [blame] | 1350 | 0 == dvb_usb_device_init(intf, |
| 1351 | &cxusb_bluebird_dualdig4_rev2_properties, |
| 1352 | THIS_MODULE, NULL, adapter_nr) || |
Timothy Lee | dfbdce0 | 2008-08-09 13:36:51 -0300 | [diff] [blame] | 1353 | 0 == dvb_usb_device_init(intf, &cxusb_d680_dmb_properties, |
| 1354 | THIS_MODULE, NULL, adapter_nr) || |
David Wong | b18bd1d | 2009-10-26 09:41:22 -0300 | [diff] [blame] | 1355 | 0 == dvb_usb_device_init(intf, &cxusb_mygica_d689_properties, |
| 1356 | THIS_MODULE, NULL, adapter_nr) || |
Daniel Gimpelevich | f5376ad | 2008-06-28 05:01:30 -0300 | [diff] [blame] | 1357 | 0) |
Michael Krufky | effee03 | 2006-01-09 15:25:47 -0200 | [diff] [blame] | 1358 | return 0; |
Michael Krufky | effee03 | 2006-01-09 15:25:47 -0200 | [diff] [blame] | 1359 | |
| 1360 | return -EINVAL; |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 1361 | } |
| 1362 | |
| 1363 | static struct usb_device_id cxusb_table [] = { |
Michael Krufky | f35db23 | 2006-12-05 14:53:39 -0300 | [diff] [blame] | 1364 | { USB_DEVICE(USB_VID_MEDION, USB_PID_MEDION_MD95700) }, |
| 1365 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LG064F_COLD) }, |
| 1366 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LG064F_WARM) }, |
| 1367 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_1_COLD) }, |
| 1368 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_1_WARM) }, |
| 1369 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LGZ201_COLD) }, |
| 1370 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LGZ201_WARM) }, |
| 1371 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_TH7579_COLD) }, |
| 1372 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_TH7579_WARM) }, |
| 1373 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DIGITALNOW_BLUEBIRD_DUAL_1_COLD) }, |
| 1374 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DIGITALNOW_BLUEBIRD_DUAL_1_WARM) }, |
| 1375 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_2_COLD) }, |
| 1376 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_2_WARM) }, |
Chris Pascoe | aeb012b | 2007-11-19 21:57:10 -0300 | [diff] [blame] | 1377 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_4) }, |
Chris Pascoe | 5ccaf90 | 2007-11-20 01:53:31 -0300 | [diff] [blame] | 1378 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DVB_T_NANO_2) }, |
Chris Pascoe | 702a676 | 2007-11-20 03:34:11 -0300 | [diff] [blame] | 1379 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DVB_T_NANO_2_NFW_WARM) }, |
Daniel Gimpelevich | f5376ad | 2008-06-28 05:01:30 -0300 | [diff] [blame] | 1380 | { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR_A868R) }, |
Anton Blanchard | 8d79898 | 2008-08-09 12:23:15 -0300 | [diff] [blame] | 1381 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_4_REV_2) }, |
Timothy Lee | dfbdce0 | 2008-08-09 13:36:51 -0300 | [diff] [blame] | 1382 | { USB_DEVICE(USB_VID_CONEXANT, USB_PID_CONEXANT_D680_DMB) }, |
David Wong | b18bd1d | 2009-10-26 09:41:22 -0300 | [diff] [blame] | 1383 | { USB_DEVICE(USB_VID_CONEXANT, USB_PID_MYGICA_D689) }, |
Michael Krufky | f35db23 | 2006-12-05 14:53:39 -0300 | [diff] [blame] | 1384 | {} /* Terminating entry */ |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 1385 | }; |
| 1386 | MODULE_DEVICE_TABLE (usb, cxusb_table); |
| 1387 | |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 1388 | static struct dvb_usb_device_properties cxusb_medion_properties = { |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 1389 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
| 1390 | |
| 1391 | .usb_ctrl = CYPRESS_FX2, |
| 1392 | |
| 1393 | .size_of_priv = sizeof(struct cxusb_state), |
| 1394 | |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 1395 | .num_adapters = 1, |
| 1396 | .adapter = { |
| 1397 | { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 1398 | .num_frontends = 1, |
| 1399 | .fe = {{ |
Patrick Boettcher | 01451e7 | 2006-10-13 11:34:46 -0300 | [diff] [blame] | 1400 | .streaming_ctrl = cxusb_streaming_ctrl, |
| 1401 | .frontend_attach = cxusb_cx22702_frontend_attach, |
| 1402 | .tuner_attach = cxusb_fmd1216me_tuner_attach, |
| 1403 | /* parameter for the MPEG2-data transfer */ |
| 1404 | .stream = { |
| 1405 | .type = USB_BULK, |
| 1406 | .count = 5, |
| 1407 | .endpoint = 0x02, |
| 1408 | .u = { |
| 1409 | .bulk = { |
| 1410 | .buffersize = 8192, |
| 1411 | } |
| 1412 | } |
| 1413 | }, |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 1414 | }}, |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 1415 | }, |
| 1416 | }, |
| 1417 | .power_ctrl = cxusb_power_ctrl, |
| 1418 | |
| 1419 | .i2c_algo = &cxusb_i2c_algo, |
| 1420 | |
| 1421 | .generic_bulk_ctrl_endpoint = 0x01, |
| 1422 | |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 1423 | .num_device_descs = 1, |
| 1424 | .devices = { |
| 1425 | { "Medion MD95700 (MDUSBTV-HYBRID)", |
| 1426 | { NULL }, |
| 1427 | { &cxusb_table[0], NULL }, |
| 1428 | }, |
| 1429 | } |
| 1430 | }; |
| 1431 | |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 1432 | static struct dvb_usb_device_properties cxusb_bluebird_lgh064f_properties = { |
Michael Krufky | effee03 | 2006-01-09 15:25:47 -0200 | [diff] [blame] | 1433 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
| 1434 | |
Patrick Boettcher | f537378 | 2006-01-09 18:21:38 -0200 | [diff] [blame] | 1435 | .usb_ctrl = DEVICE_SPECIFIC, |
| 1436 | .firmware = "dvb-usb-bluebird-01.fw", |
| 1437 | .download_firmware = bluebird_patch_dvico_firmware_download, |
Michael Krufky | 37bdfa0 | 2006-01-09 15:25:47 -0200 | [diff] [blame] | 1438 | /* use usb alt setting 0 for EP4 transfer (dvb-t), |
| 1439 | use usb alt setting 7 for EP2 transfer (atsc) */ |
Michael Krufky | effee03 | 2006-01-09 15:25:47 -0200 | [diff] [blame] | 1440 | |
| 1441 | .size_of_priv = sizeof(struct cxusb_state), |
| 1442 | |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 1443 | .num_adapters = 1, |
| 1444 | .adapter = { |
| 1445 | { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 1446 | .num_frontends = 1, |
| 1447 | .fe = {{ |
Patrick Boettcher | 01451e7 | 2006-10-13 11:34:46 -0300 | [diff] [blame] | 1448 | .streaming_ctrl = cxusb_streaming_ctrl, |
| 1449 | .frontend_attach = cxusb_lgdt3303_frontend_attach, |
Michael Krufky | f71a56c | 2006-10-13 21:55:57 -0300 | [diff] [blame] | 1450 | .tuner_attach = cxusb_lgh064f_tuner_attach, |
Michael Krufky | effee03 | 2006-01-09 15:25:47 -0200 | [diff] [blame] | 1451 | |
Patrick Boettcher | 01451e7 | 2006-10-13 11:34:46 -0300 | [diff] [blame] | 1452 | /* parameter for the MPEG2-data transfer */ |
| 1453 | .stream = { |
| 1454 | .type = USB_BULK, |
| 1455 | .count = 5, |
| 1456 | .endpoint = 0x02, |
| 1457 | .u = { |
| 1458 | .bulk = { |
| 1459 | .buffersize = 8192, |
| 1460 | } |
| 1461 | } |
| 1462 | }, |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 1463 | }}, |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 1464 | }, |
| 1465 | }, |
| 1466 | |
| 1467 | .power_ctrl = cxusb_bluebird_power_ctrl, |
| 1468 | |
Michael Krufky | effee03 | 2006-01-09 15:25:47 -0200 | [diff] [blame] | 1469 | .i2c_algo = &cxusb_i2c_algo, |
| 1470 | |
Mauro Carvalho Chehab | f72a27b | 2010-07-31 18:04:09 -0300 | [diff] [blame] | 1471 | .rc.legacy = { |
| 1472 | .rc_interval = 100, |
Mauro Carvalho Chehab | 2f4f58d | 2010-11-17 15:46:09 -0300 | [diff] [blame] | 1473 | .rc_map_table = rc_map_dvico_portable_table, |
| 1474 | .rc_map_size = ARRAY_SIZE(rc_map_dvico_portable_table), |
Mauro Carvalho Chehab | f72a27b | 2010-07-31 18:04:09 -0300 | [diff] [blame] | 1475 | .rc_query = cxusb_rc_query, |
| 1476 | }, |
Michael Krufky | c150178 | 2006-03-26 05:43:36 -0300 | [diff] [blame] | 1477 | |
Michael Krufky | effee03 | 2006-01-09 15:25:47 -0200 | [diff] [blame] | 1478 | .generic_bulk_ctrl_endpoint = 0x01, |
Michael Krufky | effee03 | 2006-01-09 15:25:47 -0200 | [diff] [blame] | 1479 | |
| 1480 | .num_device_descs = 1, |
| 1481 | .devices = { |
| 1482 | { "DViCO FusionHDTV5 USB Gold", |
| 1483 | { &cxusb_table[1], NULL }, |
| 1484 | { &cxusb_table[2], NULL }, |
| 1485 | }, |
| 1486 | } |
| 1487 | }; |
| 1488 | |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 1489 | static struct dvb_usb_device_properties cxusb_bluebird_dee1601_properties = { |
Chris Pascoe | 0029ee1 | 2006-01-09 18:21:28 -0200 | [diff] [blame] | 1490 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
| 1491 | |
Patrick Boettcher | f537378 | 2006-01-09 18:21:38 -0200 | [diff] [blame] | 1492 | .usb_ctrl = DEVICE_SPECIFIC, |
| 1493 | .firmware = "dvb-usb-bluebird-01.fw", |
| 1494 | .download_firmware = bluebird_patch_dvico_firmware_download, |
Chris Pascoe | 0029ee1 | 2006-01-09 18:21:28 -0200 | [diff] [blame] | 1495 | /* use usb alt setting 0 for EP4 transfer (dvb-t), |
| 1496 | use usb alt setting 7 for EP2 transfer (atsc) */ |
| 1497 | |
| 1498 | .size_of_priv = sizeof(struct cxusb_state), |
| 1499 | |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 1500 | .num_adapters = 1, |
| 1501 | .adapter = { |
| 1502 | { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 1503 | .num_frontends = 1, |
| 1504 | .fe = {{ |
Patrick Boettcher | 01451e7 | 2006-10-13 11:34:46 -0300 | [diff] [blame] | 1505 | .streaming_ctrl = cxusb_streaming_ctrl, |
| 1506 | .frontend_attach = cxusb_dee1601_frontend_attach, |
| 1507 | .tuner_attach = cxusb_dee1601_tuner_attach, |
| 1508 | /* parameter for the MPEG2-data transfer */ |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 1509 | .stream = { |
| 1510 | .type = USB_BULK, |
Patrick Boettcher | 01451e7 | 2006-10-13 11:34:46 -0300 | [diff] [blame] | 1511 | .count = 5, |
| 1512 | .endpoint = 0x04, |
| 1513 | .u = { |
| 1514 | .bulk = { |
| 1515 | .buffersize = 8192, |
| 1516 | } |
| 1517 | } |
| 1518 | }, |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 1519 | }}, |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 1520 | }, |
| 1521 | }, |
| 1522 | |
| 1523 | .power_ctrl = cxusb_bluebird_power_ctrl, |
Chris Pascoe | 0029ee1 | 2006-01-09 18:21:28 -0200 | [diff] [blame] | 1524 | |
| 1525 | .i2c_algo = &cxusb_i2c_algo, |
| 1526 | |
Mauro Carvalho Chehab | f72a27b | 2010-07-31 18:04:09 -0300 | [diff] [blame] | 1527 | .rc.legacy = { |
| 1528 | .rc_interval = 150, |
Mauro Carvalho Chehab | 2f4f58d | 2010-11-17 15:46:09 -0300 | [diff] [blame] | 1529 | .rc_map_table = rc_map_dvico_mce_table, |
| 1530 | .rc_map_size = ARRAY_SIZE(rc_map_dvico_mce_table), |
Mauro Carvalho Chehab | f72a27b | 2010-07-31 18:04:09 -0300 | [diff] [blame] | 1531 | .rc_query = cxusb_rc_query, |
| 1532 | }, |
Chris Pascoe | 7c23970 | 2006-01-09 18:21:29 -0200 | [diff] [blame] | 1533 | |
Chris Pascoe | 0029ee1 | 2006-01-09 18:21:28 -0200 | [diff] [blame] | 1534 | .generic_bulk_ctrl_endpoint = 0x01, |
Chris Pascoe | 0029ee1 | 2006-01-09 18:21:28 -0200 | [diff] [blame] | 1535 | |
Michael Krufky | 587c03d | 2006-09-28 02:16:01 -0300 | [diff] [blame] | 1536 | .num_device_descs = 3, |
Chris Pascoe | 0029ee1 | 2006-01-09 18:21:28 -0200 | [diff] [blame] | 1537 | .devices = { |
| 1538 | { "DViCO FusionHDTV DVB-T Dual USB", |
| 1539 | { &cxusb_table[3], NULL }, |
| 1540 | { &cxusb_table[4], NULL }, |
| 1541 | }, |
Michael Krufky | ac9ffb9 | 2006-01-11 23:21:00 -0200 | [diff] [blame] | 1542 | { "DigitalNow DVB-T Dual USB", |
| 1543 | { &cxusb_table[9], NULL }, |
| 1544 | { &cxusb_table[10], NULL }, |
| 1545 | }, |
Michael Krufky | 587c03d | 2006-09-28 02:16:01 -0300 | [diff] [blame] | 1546 | { "DViCO FusionHDTV DVB-T Dual Digital 2", |
| 1547 | { &cxusb_table[11], NULL }, |
| 1548 | { &cxusb_table[12], NULL }, |
| 1549 | }, |
Chris Pascoe | 0029ee1 | 2006-01-09 18:21:28 -0200 | [diff] [blame] | 1550 | } |
| 1551 | }; |
| 1552 | |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 1553 | static struct dvb_usb_device_properties cxusb_bluebird_lgz201_properties = { |
Michael Krufky | 6f44725 | 2006-01-11 19:40:33 -0200 | [diff] [blame] | 1554 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
| 1555 | |
| 1556 | .usb_ctrl = DEVICE_SPECIFIC, |
| 1557 | .firmware = "dvb-usb-bluebird-01.fw", |
| 1558 | .download_firmware = bluebird_patch_dvico_firmware_download, |
| 1559 | /* use usb alt setting 0 for EP4 transfer (dvb-t), |
| 1560 | use usb alt setting 7 for EP2 transfer (atsc) */ |
| 1561 | |
| 1562 | .size_of_priv = sizeof(struct cxusb_state), |
| 1563 | |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 1564 | .num_adapters = 2, |
| 1565 | .adapter = { |
| 1566 | { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 1567 | .num_frontends = 1, |
| 1568 | .fe = {{ |
Patrick Boettcher | 01451e7 | 2006-10-13 11:34:46 -0300 | [diff] [blame] | 1569 | .streaming_ctrl = cxusb_streaming_ctrl, |
| 1570 | .frontend_attach = cxusb_mt352_frontend_attach, |
| 1571 | .tuner_attach = cxusb_lgz201_tuner_attach, |
Michael Krufky | 6f44725 | 2006-01-11 19:40:33 -0200 | [diff] [blame] | 1572 | |
Patrick Boettcher | 01451e7 | 2006-10-13 11:34:46 -0300 | [diff] [blame] | 1573 | /* parameter for the MPEG2-data transfer */ |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 1574 | .stream = { |
| 1575 | .type = USB_BULK, |
Patrick Boettcher | 01451e7 | 2006-10-13 11:34:46 -0300 | [diff] [blame] | 1576 | .count = 5, |
| 1577 | .endpoint = 0x04, |
| 1578 | .u = { |
| 1579 | .bulk = { |
| 1580 | .buffersize = 8192, |
| 1581 | } |
| 1582 | } |
| 1583 | }, |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 1584 | }}, |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 1585 | }, |
| 1586 | }, |
| 1587 | .power_ctrl = cxusb_bluebird_power_ctrl, |
| 1588 | |
Michael Krufky | 6f44725 | 2006-01-11 19:40:33 -0200 | [diff] [blame] | 1589 | .i2c_algo = &cxusb_i2c_algo, |
| 1590 | |
Mauro Carvalho Chehab | f72a27b | 2010-07-31 18:04:09 -0300 | [diff] [blame] | 1591 | .rc.legacy = { |
| 1592 | .rc_interval = 100, |
Mauro Carvalho Chehab | 2f4f58d | 2010-11-17 15:46:09 -0300 | [diff] [blame] | 1593 | .rc_map_table = rc_map_dvico_portable_table, |
| 1594 | .rc_map_size = ARRAY_SIZE(rc_map_dvico_portable_table), |
Mauro Carvalho Chehab | f72a27b | 2010-07-31 18:04:09 -0300 | [diff] [blame] | 1595 | .rc_query = cxusb_rc_query, |
| 1596 | }, |
Michael Krufky | c150178 | 2006-03-26 05:43:36 -0300 | [diff] [blame] | 1597 | |
Michael Krufky | 6f44725 | 2006-01-11 19:40:33 -0200 | [diff] [blame] | 1598 | .generic_bulk_ctrl_endpoint = 0x01, |
Michael Krufky | 6f44725 | 2006-01-11 19:40:33 -0200 | [diff] [blame] | 1599 | .num_device_descs = 1, |
| 1600 | .devices = { |
| 1601 | { "DViCO FusionHDTV DVB-T USB (LGZ201)", |
| 1602 | { &cxusb_table[5], NULL }, |
| 1603 | { &cxusb_table[6], NULL }, |
| 1604 | }, |
| 1605 | } |
| 1606 | }; |
| 1607 | |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 1608 | static struct dvb_usb_device_properties cxusb_bluebird_dtt7579_properties = { |
Michael Krufky | 6f44725 | 2006-01-11 19:40:33 -0200 | [diff] [blame] | 1609 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
| 1610 | |
| 1611 | .usb_ctrl = DEVICE_SPECIFIC, |
| 1612 | .firmware = "dvb-usb-bluebird-01.fw", |
| 1613 | .download_firmware = bluebird_patch_dvico_firmware_download, |
| 1614 | /* use usb alt setting 0 for EP4 transfer (dvb-t), |
| 1615 | use usb alt setting 7 for EP2 transfer (atsc) */ |
| 1616 | |
| 1617 | .size_of_priv = sizeof(struct cxusb_state), |
| 1618 | |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 1619 | .num_adapters = 1, |
| 1620 | .adapter = { |
| 1621 | { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 1622 | .num_frontends = 1, |
| 1623 | .fe = {{ |
Patrick Boettcher | 01451e7 | 2006-10-13 11:34:46 -0300 | [diff] [blame] | 1624 | .streaming_ctrl = cxusb_streaming_ctrl, |
| 1625 | .frontend_attach = cxusb_mt352_frontend_attach, |
| 1626 | .tuner_attach = cxusb_dtt7579_tuner_attach, |
Michael Krufky | 6f44725 | 2006-01-11 19:40:33 -0200 | [diff] [blame] | 1627 | |
Patrick Boettcher | 01451e7 | 2006-10-13 11:34:46 -0300 | [diff] [blame] | 1628 | /* parameter for the MPEG2-data transfer */ |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 1629 | .stream = { |
| 1630 | .type = USB_BULK, |
Patrick Boettcher | 01451e7 | 2006-10-13 11:34:46 -0300 | [diff] [blame] | 1631 | .count = 5, |
| 1632 | .endpoint = 0x04, |
| 1633 | .u = { |
| 1634 | .bulk = { |
| 1635 | .buffersize = 8192, |
| 1636 | } |
| 1637 | } |
| 1638 | }, |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 1639 | }}, |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 1640 | }, |
| 1641 | }, |
| 1642 | .power_ctrl = cxusb_bluebird_power_ctrl, |
| 1643 | |
Michael Krufky | 6f44725 | 2006-01-11 19:40:33 -0200 | [diff] [blame] | 1644 | .i2c_algo = &cxusb_i2c_algo, |
| 1645 | |
Mauro Carvalho Chehab | f72a27b | 2010-07-31 18:04:09 -0300 | [diff] [blame] | 1646 | .rc.legacy = { |
| 1647 | .rc_interval = 100, |
Mauro Carvalho Chehab | 2f4f58d | 2010-11-17 15:46:09 -0300 | [diff] [blame] | 1648 | .rc_map_table = rc_map_dvico_portable_table, |
| 1649 | .rc_map_size = ARRAY_SIZE(rc_map_dvico_portable_table), |
Mauro Carvalho Chehab | f72a27b | 2010-07-31 18:04:09 -0300 | [diff] [blame] | 1650 | .rc_query = cxusb_rc_query, |
| 1651 | }, |
Michael Krufky | c150178 | 2006-03-26 05:43:36 -0300 | [diff] [blame] | 1652 | |
Michael Krufky | 6f44725 | 2006-01-11 19:40:33 -0200 | [diff] [blame] | 1653 | .generic_bulk_ctrl_endpoint = 0x01, |
Michael Krufky | 6f44725 | 2006-01-11 19:40:33 -0200 | [diff] [blame] | 1654 | |
| 1655 | .num_device_descs = 1, |
| 1656 | .devices = { |
| 1657 | { "DViCO FusionHDTV DVB-T USB (TH7579)", |
| 1658 | { &cxusb_table[7], NULL }, |
| 1659 | { &cxusb_table[8], NULL }, |
| 1660 | }, |
| 1661 | } |
| 1662 | }; |
| 1663 | |
Chris Pascoe | aeb012b | 2007-11-19 21:57:10 -0300 | [diff] [blame] | 1664 | static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_properties = { |
| 1665 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
| 1666 | |
| 1667 | .usb_ctrl = CYPRESS_FX2, |
| 1668 | |
| 1669 | .size_of_priv = sizeof(struct cxusb_state), |
| 1670 | |
| 1671 | .num_adapters = 1, |
| 1672 | .adapter = { |
| 1673 | { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 1674 | .num_frontends = 1, |
| 1675 | .fe = {{ |
Chris Pascoe | aeb012b | 2007-11-19 21:57:10 -0300 | [diff] [blame] | 1676 | .streaming_ctrl = cxusb_streaming_ctrl, |
| 1677 | .frontend_attach = cxusb_dualdig4_frontend_attach, |
| 1678 | .tuner_attach = cxusb_dvico_xc3028_tuner_attach, |
| 1679 | /* parameter for the MPEG2-data transfer */ |
| 1680 | .stream = { |
| 1681 | .type = USB_BULK, |
| 1682 | .count = 5, |
| 1683 | .endpoint = 0x02, |
| 1684 | .u = { |
| 1685 | .bulk = { |
| 1686 | .buffersize = 8192, |
| 1687 | } |
| 1688 | } |
| 1689 | }, |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 1690 | }}, |
Chris Pascoe | aeb012b | 2007-11-19 21:57:10 -0300 | [diff] [blame] | 1691 | }, |
| 1692 | }, |
| 1693 | |
| 1694 | .power_ctrl = cxusb_power_ctrl, |
| 1695 | |
| 1696 | .i2c_algo = &cxusb_i2c_algo, |
| 1697 | |
| 1698 | .generic_bulk_ctrl_endpoint = 0x01, |
| 1699 | |
Mauro Carvalho Chehab | f72a27b | 2010-07-31 18:04:09 -0300 | [diff] [blame] | 1700 | .rc.legacy = { |
| 1701 | .rc_interval = 100, |
Mauro Carvalho Chehab | 2f4f58d | 2010-11-17 15:46:09 -0300 | [diff] [blame] | 1702 | .rc_map_table = rc_map_dvico_mce_table, |
| 1703 | .rc_map_size = ARRAY_SIZE(rc_map_dvico_mce_table), |
Mauro Carvalho Chehab | f72a27b | 2010-07-31 18:04:09 -0300 | [diff] [blame] | 1704 | .rc_query = cxusb_bluebird2_rc_query, |
| 1705 | }, |
Chris Pascoe | aeb012b | 2007-11-19 21:57:10 -0300 | [diff] [blame] | 1706 | |
| 1707 | .num_device_descs = 1, |
| 1708 | .devices = { |
| 1709 | { "DViCO FusionHDTV DVB-T Dual Digital 4", |
| 1710 | { NULL }, |
| 1711 | { &cxusb_table[13], NULL }, |
| 1712 | }, |
| 1713 | } |
| 1714 | }; |
| 1715 | |
Chris Pascoe | 5ccaf90 | 2007-11-20 01:53:31 -0300 | [diff] [blame] | 1716 | static struct dvb_usb_device_properties cxusb_bluebird_nano2_properties = { |
| 1717 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
| 1718 | |
| 1719 | .usb_ctrl = CYPRESS_FX2, |
Chris Pascoe | 702a676 | 2007-11-20 03:34:11 -0300 | [diff] [blame] | 1720 | .identify_state = bluebird_fx2_identify_state, |
Chris Pascoe | 5ccaf90 | 2007-11-20 01:53:31 -0300 | [diff] [blame] | 1721 | |
| 1722 | .size_of_priv = sizeof(struct cxusb_state), |
| 1723 | |
| 1724 | .num_adapters = 1, |
| 1725 | .adapter = { |
| 1726 | { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 1727 | .num_frontends = 1, |
| 1728 | .fe = {{ |
Chris Pascoe | 5ccaf90 | 2007-11-20 01:53:31 -0300 | [diff] [blame] | 1729 | .streaming_ctrl = cxusb_streaming_ctrl, |
| 1730 | .frontend_attach = cxusb_nano2_frontend_attach, |
| 1731 | .tuner_attach = cxusb_dvico_xc3028_tuner_attach, |
| 1732 | /* parameter for the MPEG2-data transfer */ |
| 1733 | .stream = { |
| 1734 | .type = USB_BULK, |
| 1735 | .count = 5, |
| 1736 | .endpoint = 0x02, |
| 1737 | .u = { |
| 1738 | .bulk = { |
| 1739 | .buffersize = 8192, |
| 1740 | } |
| 1741 | } |
| 1742 | }, |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 1743 | }}, |
Chris Pascoe | 5ccaf90 | 2007-11-20 01:53:31 -0300 | [diff] [blame] | 1744 | }, |
| 1745 | }, |
| 1746 | |
| 1747 | .power_ctrl = cxusb_nano2_power_ctrl, |
| 1748 | |
| 1749 | .i2c_algo = &cxusb_i2c_algo, |
| 1750 | |
| 1751 | .generic_bulk_ctrl_endpoint = 0x01, |
| 1752 | |
Mauro Carvalho Chehab | f72a27b | 2010-07-31 18:04:09 -0300 | [diff] [blame] | 1753 | .rc.legacy = { |
| 1754 | .rc_interval = 100, |
Mauro Carvalho Chehab | 2f4f58d | 2010-11-17 15:46:09 -0300 | [diff] [blame] | 1755 | .rc_map_table = rc_map_dvico_portable_table, |
| 1756 | .rc_map_size = ARRAY_SIZE(rc_map_dvico_portable_table), |
Mauro Carvalho Chehab | f72a27b | 2010-07-31 18:04:09 -0300 | [diff] [blame] | 1757 | .rc_query = cxusb_bluebird2_rc_query, |
| 1758 | }, |
Chris Pascoe | 5ccaf90 | 2007-11-20 01:53:31 -0300 | [diff] [blame] | 1759 | |
| 1760 | .num_device_descs = 1, |
| 1761 | .devices = { |
| 1762 | { "DViCO FusionHDTV DVB-T NANO2", |
| 1763 | { NULL }, |
| 1764 | { &cxusb_table[14], NULL }, |
| 1765 | }, |
| 1766 | } |
| 1767 | }; |
| 1768 | |
Chris Pascoe | 702a676 | 2007-11-20 03:34:11 -0300 | [diff] [blame] | 1769 | static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_properties = { |
| 1770 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
| 1771 | |
| 1772 | .usb_ctrl = DEVICE_SPECIFIC, |
| 1773 | .firmware = "dvb-usb-bluebird-02.fw", |
| 1774 | .download_firmware = bluebird_patch_dvico_firmware_download, |
| 1775 | .identify_state = bluebird_fx2_identify_state, |
| 1776 | |
| 1777 | .size_of_priv = sizeof(struct cxusb_state), |
| 1778 | |
| 1779 | .num_adapters = 1, |
| 1780 | .adapter = { |
| 1781 | { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 1782 | .num_frontends = 1, |
| 1783 | .fe = {{ |
Chris Pascoe | 702a676 | 2007-11-20 03:34:11 -0300 | [diff] [blame] | 1784 | .streaming_ctrl = cxusb_streaming_ctrl, |
| 1785 | .frontend_attach = cxusb_nano2_frontend_attach, |
| 1786 | .tuner_attach = cxusb_dvico_xc3028_tuner_attach, |
| 1787 | /* parameter for the MPEG2-data transfer */ |
| 1788 | .stream = { |
| 1789 | .type = USB_BULK, |
| 1790 | .count = 5, |
| 1791 | .endpoint = 0x02, |
| 1792 | .u = { |
| 1793 | .bulk = { |
| 1794 | .buffersize = 8192, |
| 1795 | } |
| 1796 | } |
| 1797 | }, |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 1798 | }}, |
Chris Pascoe | 702a676 | 2007-11-20 03:34:11 -0300 | [diff] [blame] | 1799 | }, |
| 1800 | }, |
| 1801 | |
| 1802 | .power_ctrl = cxusb_nano2_power_ctrl, |
| 1803 | |
| 1804 | .i2c_algo = &cxusb_i2c_algo, |
| 1805 | |
| 1806 | .generic_bulk_ctrl_endpoint = 0x01, |
| 1807 | |
Mauro Carvalho Chehab | f72a27b | 2010-07-31 18:04:09 -0300 | [diff] [blame] | 1808 | .rc.legacy = { |
| 1809 | .rc_interval = 100, |
Mauro Carvalho Chehab | 2f4f58d | 2010-11-17 15:46:09 -0300 | [diff] [blame] | 1810 | .rc_map_table = rc_map_dvico_portable_table, |
| 1811 | .rc_map_size = ARRAY_SIZE(rc_map_dvico_portable_table), |
Mauro Carvalho Chehab | f72a27b | 2010-07-31 18:04:09 -0300 | [diff] [blame] | 1812 | .rc_query = cxusb_rc_query, |
| 1813 | }, |
Chris Pascoe | 702a676 | 2007-11-20 03:34:11 -0300 | [diff] [blame] | 1814 | |
| 1815 | .num_device_descs = 1, |
| 1816 | .devices = { |
| 1817 | { "DViCO FusionHDTV DVB-T NANO2 w/o firmware", |
| 1818 | { &cxusb_table[14], NULL }, |
| 1819 | { &cxusb_table[15], NULL }, |
| 1820 | }, |
| 1821 | } |
| 1822 | }; |
| 1823 | |
Daniel Gimpelevich | f5376ad | 2008-06-28 05:01:30 -0300 | [diff] [blame] | 1824 | static struct dvb_usb_device_properties cxusb_aver_a868r_properties = { |
| 1825 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
| 1826 | |
| 1827 | .usb_ctrl = CYPRESS_FX2, |
| 1828 | |
| 1829 | .size_of_priv = sizeof(struct cxusb_state), |
| 1830 | |
| 1831 | .num_adapters = 1, |
| 1832 | .adapter = { |
| 1833 | { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 1834 | .num_frontends = 1, |
| 1835 | .fe = {{ |
Daniel Gimpelevich | f5376ad | 2008-06-28 05:01:30 -0300 | [diff] [blame] | 1836 | .streaming_ctrl = cxusb_aver_streaming_ctrl, |
| 1837 | .frontend_attach = cxusb_aver_lgdt3303_frontend_attach, |
| 1838 | .tuner_attach = cxusb_mxl5003s_tuner_attach, |
| 1839 | /* parameter for the MPEG2-data transfer */ |
| 1840 | .stream = { |
| 1841 | .type = USB_BULK, |
| 1842 | .count = 5, |
| 1843 | .endpoint = 0x04, |
| 1844 | .u = { |
| 1845 | .bulk = { |
| 1846 | .buffersize = 8192, |
| 1847 | } |
| 1848 | } |
| 1849 | }, |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 1850 | }}, |
Daniel Gimpelevich | f5376ad | 2008-06-28 05:01:30 -0300 | [diff] [blame] | 1851 | }, |
| 1852 | }, |
| 1853 | .power_ctrl = cxusb_aver_power_ctrl, |
| 1854 | |
| 1855 | .i2c_algo = &cxusb_i2c_algo, |
| 1856 | |
| 1857 | .generic_bulk_ctrl_endpoint = 0x01, |
| 1858 | |
| 1859 | .num_device_descs = 1, |
| 1860 | .devices = { |
| 1861 | { "AVerMedia AVerTVHD Volar (A868R)", |
| 1862 | { NULL }, |
| 1863 | { &cxusb_table[16], NULL }, |
| 1864 | }, |
| 1865 | } |
| 1866 | }; |
| 1867 | |
Michael Krufky | a2dc86b | 2008-08-09 13:06:26 -0300 | [diff] [blame] | 1868 | static |
| 1869 | struct dvb_usb_device_properties cxusb_bluebird_dualdig4_rev2_properties = { |
Anton Blanchard | 8d79898 | 2008-08-09 12:23:15 -0300 | [diff] [blame] | 1870 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
| 1871 | |
| 1872 | .usb_ctrl = CYPRESS_FX2, |
| 1873 | |
| 1874 | .size_of_priv = sizeof(struct cxusb_state), |
| 1875 | |
| 1876 | .num_adapters = 1, |
| 1877 | .adapter = { |
| 1878 | { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 1879 | .size_of_priv = sizeof(struct dib0700_adapter_state), |
| 1880 | .num_frontends = 1, |
| 1881 | .fe = {{ |
Michael Krufky | a2dc86b | 2008-08-09 13:06:26 -0300 | [diff] [blame] | 1882 | .streaming_ctrl = cxusb_streaming_ctrl, |
| 1883 | .frontend_attach = cxusb_dualdig4_rev2_frontend_attach, |
| 1884 | .tuner_attach = cxusb_dualdig4_rev2_tuner_attach, |
Anton Blanchard | 8d79898 | 2008-08-09 12:23:15 -0300 | [diff] [blame] | 1885 | /* parameter for the MPEG2-data transfer */ |
| 1886 | .stream = { |
| 1887 | .type = USB_BULK, |
| 1888 | .count = 7, |
| 1889 | .endpoint = 0x02, |
| 1890 | .u = { |
| 1891 | .bulk = { |
| 1892 | .buffersize = 4096, |
| 1893 | } |
| 1894 | } |
| 1895 | }, |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 1896 | }}, |
Anton Blanchard | 8d79898 | 2008-08-09 12:23:15 -0300 | [diff] [blame] | 1897 | }, |
| 1898 | }, |
| 1899 | |
| 1900 | .power_ctrl = cxusb_bluebird_power_ctrl, |
| 1901 | |
| 1902 | .i2c_algo = &cxusb_i2c_algo, |
| 1903 | |
| 1904 | .generic_bulk_ctrl_endpoint = 0x01, |
| 1905 | |
Mauro Carvalho Chehab | f72a27b | 2010-07-31 18:04:09 -0300 | [diff] [blame] | 1906 | .rc.legacy = { |
| 1907 | .rc_interval = 100, |
Mauro Carvalho Chehab | 2f4f58d | 2010-11-17 15:46:09 -0300 | [diff] [blame] | 1908 | .rc_map_table = rc_map_dvico_mce_table, |
| 1909 | .rc_map_size = ARRAY_SIZE(rc_map_dvico_mce_table), |
Mauro Carvalho Chehab | f72a27b | 2010-07-31 18:04:09 -0300 | [diff] [blame] | 1910 | .rc_query = cxusb_rc_query, |
| 1911 | }, |
Anton Blanchard | 8d79898 | 2008-08-09 12:23:15 -0300 | [diff] [blame] | 1912 | |
| 1913 | .num_device_descs = 1, |
| 1914 | .devices = { |
| 1915 | { "DViCO FusionHDTV DVB-T Dual Digital 4 (rev 2)", |
| 1916 | { NULL }, |
| 1917 | { &cxusb_table[17], NULL }, |
| 1918 | }, |
| 1919 | } |
| 1920 | }; |
| 1921 | |
Timothy Lee | dfbdce0 | 2008-08-09 13:36:51 -0300 | [diff] [blame] | 1922 | static struct dvb_usb_device_properties cxusb_d680_dmb_properties = { |
| 1923 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
| 1924 | |
| 1925 | .usb_ctrl = CYPRESS_FX2, |
| 1926 | |
| 1927 | .size_of_priv = sizeof(struct cxusb_state), |
| 1928 | |
| 1929 | .num_adapters = 1, |
| 1930 | .adapter = { |
| 1931 | { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 1932 | .num_frontends = 1, |
| 1933 | .fe = {{ |
Timothy Lee | dfbdce0 | 2008-08-09 13:36:51 -0300 | [diff] [blame] | 1934 | .streaming_ctrl = cxusb_d680_dmb_streaming_ctrl, |
| 1935 | .frontend_attach = cxusb_d680_dmb_frontend_attach, |
| 1936 | .tuner_attach = cxusb_d680_dmb_tuner_attach, |
| 1937 | |
| 1938 | /* parameter for the MPEG2-data transfer */ |
| 1939 | .stream = { |
| 1940 | .type = USB_BULK, |
| 1941 | .count = 5, |
| 1942 | .endpoint = 0x02, |
| 1943 | .u = { |
| 1944 | .bulk = { |
| 1945 | .buffersize = 8192, |
| 1946 | } |
| 1947 | } |
| 1948 | }, |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 1949 | }}, |
Timothy Lee | dfbdce0 | 2008-08-09 13:36:51 -0300 | [diff] [blame] | 1950 | }, |
| 1951 | }, |
| 1952 | |
| 1953 | .power_ctrl = cxusb_d680_dmb_power_ctrl, |
| 1954 | |
| 1955 | .i2c_algo = &cxusb_i2c_algo, |
| 1956 | |
| 1957 | .generic_bulk_ctrl_endpoint = 0x01, |
| 1958 | |
Mauro Carvalho Chehab | f72a27b | 2010-07-31 18:04:09 -0300 | [diff] [blame] | 1959 | .rc.legacy = { |
| 1960 | .rc_interval = 100, |
Mauro Carvalho Chehab | 2f4f58d | 2010-11-17 15:46:09 -0300 | [diff] [blame] | 1961 | .rc_map_table = rc_map_d680_dmb_table, |
| 1962 | .rc_map_size = ARRAY_SIZE(rc_map_d680_dmb_table), |
Mauro Carvalho Chehab | f72a27b | 2010-07-31 18:04:09 -0300 | [diff] [blame] | 1963 | .rc_query = cxusb_d680_dmb_rc_query, |
| 1964 | }, |
Timothy Lee | dfbdce0 | 2008-08-09 13:36:51 -0300 | [diff] [blame] | 1965 | |
| 1966 | .num_device_descs = 1, |
| 1967 | .devices = { |
| 1968 | { |
| 1969 | "Conexant DMB-TH Stick", |
| 1970 | { NULL }, |
| 1971 | { &cxusb_table[18], NULL }, |
| 1972 | }, |
| 1973 | } |
| 1974 | }; |
| 1975 | |
David Wong | b18bd1d | 2009-10-26 09:41:22 -0300 | [diff] [blame] | 1976 | static struct dvb_usb_device_properties cxusb_mygica_d689_properties = { |
| 1977 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
| 1978 | |
| 1979 | .usb_ctrl = CYPRESS_FX2, |
| 1980 | |
| 1981 | .size_of_priv = sizeof(struct cxusb_state), |
| 1982 | |
| 1983 | .num_adapters = 1, |
| 1984 | .adapter = { |
| 1985 | { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 1986 | .num_frontends = 1, |
| 1987 | .fe = {{ |
David Wong | b18bd1d | 2009-10-26 09:41:22 -0300 | [diff] [blame] | 1988 | .streaming_ctrl = cxusb_d680_dmb_streaming_ctrl, |
| 1989 | .frontend_attach = cxusb_mygica_d689_frontend_attach, |
| 1990 | .tuner_attach = cxusb_mygica_d689_tuner_attach, |
| 1991 | |
| 1992 | /* parameter for the MPEG2-data transfer */ |
| 1993 | .stream = { |
| 1994 | .type = USB_BULK, |
| 1995 | .count = 5, |
| 1996 | .endpoint = 0x02, |
| 1997 | .u = { |
| 1998 | .bulk = { |
| 1999 | .buffersize = 8192, |
| 2000 | } |
| 2001 | } |
| 2002 | }, |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 2003 | }}, |
David Wong | b18bd1d | 2009-10-26 09:41:22 -0300 | [diff] [blame] | 2004 | }, |
| 2005 | }, |
| 2006 | |
| 2007 | .power_ctrl = cxusb_d680_dmb_power_ctrl, |
| 2008 | |
| 2009 | .i2c_algo = &cxusb_i2c_algo, |
| 2010 | |
| 2011 | .generic_bulk_ctrl_endpoint = 0x01, |
| 2012 | |
Mauro Carvalho Chehab | f72a27b | 2010-07-31 18:04:09 -0300 | [diff] [blame] | 2013 | .rc.legacy = { |
| 2014 | .rc_interval = 100, |
Mauro Carvalho Chehab | 2f4f58d | 2010-11-17 15:46:09 -0300 | [diff] [blame] | 2015 | .rc_map_table = rc_map_d680_dmb_table, |
| 2016 | .rc_map_size = ARRAY_SIZE(rc_map_d680_dmb_table), |
Mauro Carvalho Chehab | f72a27b | 2010-07-31 18:04:09 -0300 | [diff] [blame] | 2017 | .rc_query = cxusb_d680_dmb_rc_query, |
| 2018 | }, |
David Wong | b18bd1d | 2009-10-26 09:41:22 -0300 | [diff] [blame] | 2019 | |
| 2020 | .num_device_descs = 1, |
| 2021 | .devices = { |
| 2022 | { |
| 2023 | "Mygica D689 DMB-TH", |
| 2024 | { NULL }, |
| 2025 | { &cxusb_table[19], NULL }, |
| 2026 | }, |
| 2027 | } |
| 2028 | }; |
| 2029 | |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 2030 | static struct usb_driver cxusb_driver = { |
Patrick Boettcher | 63b5c1c | 2005-07-07 17:58:30 -0700 | [diff] [blame] | 2031 | .name = "dvb_usb_cxusb", |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 2032 | .probe = cxusb_probe, |
Michael Krufky | f35db23 | 2006-12-05 14:53:39 -0300 | [diff] [blame] | 2033 | .disconnect = dvb_usb_device_exit, |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 2034 | .id_table = cxusb_table, |
| 2035 | }; |
| 2036 | |
| 2037 | /* module stuff */ |
| 2038 | static int __init cxusb_module_init(void) |
| 2039 | { |
| 2040 | int result; |
| 2041 | if ((result = usb_register(&cxusb_driver))) { |
| 2042 | err("usb_register failed. Error number %d",result); |
| 2043 | return result; |
| 2044 | } |
| 2045 | |
| 2046 | return 0; |
| 2047 | } |
| 2048 | |
| 2049 | static void __exit cxusb_module_exit(void) |
| 2050 | { |
| 2051 | /* deregister this driver from the USB subsystem */ |
| 2052 | usb_deregister(&cxusb_driver); |
| 2053 | } |
| 2054 | |
| 2055 | module_init (cxusb_module_init); |
| 2056 | module_exit (cxusb_module_exit); |
| 2057 | |
| 2058 | MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); |
Michael Krufky | 5b9ed28 | 2006-10-15 14:51:08 -0300 | [diff] [blame] | 2059 | MODULE_AUTHOR("Michael Krufky <mkrufky@linuxtv.org>"); |
Michael Krufky | f4efb4d | 2006-01-13 14:10:25 -0200 | [diff] [blame] | 2060 | MODULE_AUTHOR("Chris Pascoe <c.pascoe@itee.uq.edu.au>"); |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 2061 | MODULE_DESCRIPTION("Driver for Conexant USB2.0 hybrid reference design"); |
| 2062 | MODULE_VERSION("1.0-alpha"); |
| 2063 | MODULE_LICENSE("GPL"); |