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 | */ |
| 26 | #include "cxusb.h" |
| 27 | |
| 28 | #include "cx22702.h" |
Michael Krufky | effee03 | 2006-01-09 15:25:47 -0200 | [diff] [blame] | 29 | #include "lgdt330x.h" |
Chris Pascoe | 0029ee1 | 2006-01-09 18:21:28 -0200 | [diff] [blame] | 30 | #include "mt352.h" |
| 31 | #include "mt352_priv.h" |
Michael Krufky | c9ce394 | 2006-06-11 04:24:31 -0300 | [diff] [blame] | 32 | #include "zl10353.h" |
Chris Pascoe | aeb012b | 2007-11-19 21:57:10 -0300 | [diff] [blame] | 33 | #include "tuner-xc2028.h" |
| 34 | #include "tuner-xc2028-types.h" |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 35 | |
| 36 | /* debug */ |
Adrian Bunk | 53133af | 2007-11-05 14:07:06 -0300 | [diff] [blame] | 37 | static int dvb_usb_cxusb_debug; |
Michael Krufky | f35db23 | 2006-12-05 14:53:39 -0300 | [diff] [blame] | 38 | module_param_named(debug, dvb_usb_cxusb_debug, int, 0644); |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 39 | MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS); |
Adrian Bunk | 53133af | 2007-11-05 14:07:06 -0300 | [diff] [blame] | 40 | #define deb_info(args...) dprintk(dvb_usb_cxusb_debug,0x01,args) |
| 41 | #define deb_i2c(args...) if (d->udev->descriptor.idVendor == USB_VID_MEDION) \ |
| 42 | dprintk(dvb_usb_cxusb_debug,0x01,args) |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 43 | |
| 44 | static int cxusb_ctrl_msg(struct dvb_usb_device *d, |
Michael Krufky | f35db23 | 2006-12-05 14:53:39 -0300 | [diff] [blame] | 45 | u8 cmd, u8 *wbuf, int wlen, u8 *rbuf, int rlen) |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 46 | { |
| 47 | int wo = (rbuf == NULL || rlen == 0); /* write-only */ |
| 48 | u8 sndbuf[1+wlen]; |
Michael Krufky | f35db23 | 2006-12-05 14:53:39 -0300 | [diff] [blame] | 49 | memset(sndbuf, 0, 1+wlen); |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 50 | |
| 51 | sndbuf[0] = cmd; |
Michael Krufky | f35db23 | 2006-12-05 14:53:39 -0300 | [diff] [blame] | 52 | memcpy(&sndbuf[1], wbuf, wlen); |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 53 | if (wo) |
Chris Pascoe | b17f109 | 2007-11-19 02:42:44 -0300 | [diff] [blame] | 54 | return dvb_usb_generic_write(d, sndbuf, 1+wlen); |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 55 | else |
Chris Pascoe | b17f109 | 2007-11-19 02:42:44 -0300 | [diff] [blame] | 56 | return dvb_usb_generic_rw(d, sndbuf, 1+wlen, rbuf, rlen, 0); |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 57 | } |
| 58 | |
Patrick Boettcher | e2efeab | 2005-09-09 13:02:51 -0700 | [diff] [blame] | 59 | /* GPIO */ |
| 60 | static void cxusb_gpio_tuner(struct dvb_usb_device *d, int onoff) |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 61 | { |
| 62 | struct cxusb_state *st = d->priv; |
Michael Krufky | f35db23 | 2006-12-05 14:53:39 -0300 | [diff] [blame] | 63 | u8 o[2], i; |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 64 | |
Patrick Boettcher | e2efeab | 2005-09-09 13:02:51 -0700 | [diff] [blame] | 65 | if (st->gpio_write_state[GPIO_TUNER] == onoff) |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 66 | return; |
| 67 | |
Patrick Boettcher | e2efeab | 2005-09-09 13:02:51 -0700 | [diff] [blame] | 68 | o[0] = GPIO_TUNER; |
| 69 | o[1] = onoff; |
Michael Krufky | f35db23 | 2006-12-05 14:53:39 -0300 | [diff] [blame] | 70 | cxusb_ctrl_msg(d, CMD_GPIO_WRITE, o, 2, &i, 1); |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 71 | |
| 72 | if (i != 0x01) |
Patrick Boettcher | e2efeab | 2005-09-09 13:02:51 -0700 | [diff] [blame] | 73 | deb_info("gpio_write failed.\n"); |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 74 | |
Patrick Boettcher | e2efeab | 2005-09-09 13:02:51 -0700 | [diff] [blame] | 75 | st->gpio_write_state[GPIO_TUNER] = onoff; |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 76 | } |
| 77 | |
Chris Pascoe | aeb012b | 2007-11-19 21:57:10 -0300 | [diff] [blame] | 78 | static int cxusb_bluebird_gpio_rw(struct dvb_usb_device *d, u8 changemask, |
| 79 | u8 newval) |
| 80 | { |
| 81 | u8 o[2], gpio_state; |
| 82 | int rc; |
| 83 | |
| 84 | o[0] = 0xff & ~changemask; /* mask of bits to keep */ |
| 85 | o[1] = newval & changemask; /* new values for bits */ |
| 86 | |
| 87 | rc = cxusb_ctrl_msg(d, CMD_BLUEBIRD_GPIO_RW, o, 2, &gpio_state, 1); |
| 88 | if (rc < 0 || (gpio_state & changemask) != (newval & changemask)) |
| 89 | deb_info("bluebird_gpio_write failed.\n"); |
| 90 | |
| 91 | return rc < 0 ? rc : gpio_state; |
| 92 | } |
| 93 | |
| 94 | static void cxusb_bluebird_gpio_pulse(struct dvb_usb_device *d, u8 pin, int low) |
| 95 | { |
| 96 | cxusb_bluebird_gpio_rw(d, pin, low ? 0 : pin); |
| 97 | msleep(5); |
| 98 | cxusb_bluebird_gpio_rw(d, pin, low ? pin : 0); |
| 99 | } |
| 100 | |
Chris Pascoe | 5ccaf90 | 2007-11-20 01:53:31 -0300 | [diff] [blame] | 101 | static void cxusb_nano2_led(struct dvb_usb_device *d, int onoff) |
| 102 | { |
| 103 | cxusb_bluebird_gpio_rw(d, 0x40, onoff ? 0 : 0x40); |
| 104 | } |
| 105 | |
Patrick Boettcher | e2efeab | 2005-09-09 13:02:51 -0700 | [diff] [blame] | 106 | /* I2C */ |
Michael Krufky | f35db23 | 2006-12-05 14:53:39 -0300 | [diff] [blame] | 107 | static int cxusb_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], |
| 108 | int num) |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 109 | { |
| 110 | struct dvb_usb_device *d = i2c_get_adapdata(adap); |
| 111 | int i; |
| 112 | |
Ingo Molnar | 3593cab | 2006-02-07 06:49:14 -0200 | [diff] [blame] | 113 | if (mutex_lock_interruptible(&d->i2c_mutex) < 0) |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 114 | return -EAGAIN; |
| 115 | |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 116 | for (i = 0; i < num; i++) { |
| 117 | |
Michael Krufky | 5e805ef | 2006-03-23 00:01:34 -0300 | [diff] [blame] | 118 | if (d->udev->descriptor.idVendor == USB_VID_MEDION) |
| 119 | switch (msg[i].addr) { |
Michael Krufky | f35db23 | 2006-12-05 14:53:39 -0300 | [diff] [blame] | 120 | case 0x63: |
| 121 | cxusb_gpio_tuner(d, 0); |
| 122 | break; |
| 123 | default: |
| 124 | cxusb_gpio_tuner(d, 1); |
| 125 | break; |
Michael Krufky | 5e805ef | 2006-03-23 00:01:34 -0300 | [diff] [blame] | 126 | } |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 127 | |
Chris Pascoe | 272479d7 | 2007-11-19 03:01:22 -0300 | [diff] [blame] | 128 | if (msg[i].flags & I2C_M_RD) { |
| 129 | /* read only */ |
| 130 | u8 obuf[3], ibuf[1+msg[i].len]; |
| 131 | obuf[0] = 0; |
| 132 | obuf[1] = msg[i].len; |
| 133 | obuf[2] = msg[i].addr; |
| 134 | if (cxusb_ctrl_msg(d, CMD_I2C_READ, |
| 135 | obuf, 3, |
| 136 | ibuf, 1+msg[i].len) < 0) { |
| 137 | warn("i2c read failed"); |
| 138 | break; |
| 139 | } |
| 140 | memcpy(msg[i].buf, &ibuf[1], msg[i].len); |
Chris Pascoe | a644e4a | 2007-11-19 03:05:09 -0300 | [diff] [blame] | 141 | } else if (i+1 < num && (msg[i+1].flags & I2C_M_RD) && |
| 142 | msg[i].addr == msg[i+1].addr) { |
| 143 | /* write to then read from same address */ |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 144 | u8 obuf[3+msg[i].len], ibuf[1+msg[i+1].len]; |
| 145 | obuf[0] = msg[i].len; |
| 146 | obuf[1] = msg[i+1].len; |
| 147 | obuf[2] = msg[i].addr; |
Michael Krufky | f35db23 | 2006-12-05 14:53:39 -0300 | [diff] [blame] | 148 | memcpy(&obuf[3], msg[i].buf, msg[i].len); |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 149 | |
| 150 | if (cxusb_ctrl_msg(d, CMD_I2C_READ, |
Michael Krufky | f35db23 | 2006-12-05 14:53:39 -0300 | [diff] [blame] | 151 | obuf, 3+msg[i].len, |
| 152 | ibuf, 1+msg[i+1].len) < 0) |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 153 | break; |
| 154 | |
| 155 | if (ibuf[0] != 0x08) |
Michael Krufky | ae62e3d | 2006-03-23 01:11:18 -0300 | [diff] [blame] | 156 | deb_i2c("i2c read may have failed\n"); |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 157 | |
Michael Krufky | f35db23 | 2006-12-05 14:53:39 -0300 | [diff] [blame] | 158 | memcpy(msg[i+1].buf, &ibuf[1], msg[i+1].len); |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 159 | |
| 160 | i++; |
Chris Pascoe | 272479d7 | 2007-11-19 03:01:22 -0300 | [diff] [blame] | 161 | } else { |
| 162 | /* write only */ |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 163 | u8 obuf[2+msg[i].len], ibuf; |
| 164 | obuf[0] = msg[i].addr; |
| 165 | obuf[1] = msg[i].len; |
Michael Krufky | f35db23 | 2006-12-05 14:53:39 -0300 | [diff] [blame] | 166 | memcpy(&obuf[2], msg[i].buf, msg[i].len); |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 167 | |
Michael Krufky | f35db23 | 2006-12-05 14:53:39 -0300 | [diff] [blame] | 168 | if (cxusb_ctrl_msg(d, CMD_I2C_WRITE, obuf, |
| 169 | 2+msg[i].len, &ibuf,1) < 0) |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 170 | break; |
| 171 | if (ibuf != 0x08) |
Michael Krufky | ae62e3d | 2006-03-23 01:11:18 -0300 | [diff] [blame] | 172 | deb_i2c("i2c write may have failed\n"); |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 173 | } |
| 174 | } |
| 175 | |
Ingo Molnar | 3593cab | 2006-02-07 06:49:14 -0200 | [diff] [blame] | 176 | mutex_unlock(&d->i2c_mutex); |
Chris Pascoe | 13e001d | 2007-11-19 02:48:27 -0300 | [diff] [blame] | 177 | return i == num ? num : -EREMOTEIO; |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 178 | } |
| 179 | |
| 180 | static u32 cxusb_i2c_func(struct i2c_adapter *adapter) |
| 181 | { |
| 182 | return I2C_FUNC_I2C; |
| 183 | } |
| 184 | |
| 185 | static struct i2c_algorithm cxusb_i2c_algo = { |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 186 | .master_xfer = cxusb_i2c_xfer, |
| 187 | .functionality = cxusb_i2c_func, |
| 188 | }; |
| 189 | |
| 190 | static int cxusb_power_ctrl(struct dvb_usb_device *d, int onoff) |
| 191 | { |
Patrick Boettcher | e2efeab | 2005-09-09 13:02:51 -0700 | [diff] [blame] | 192 | u8 b = 0; |
| 193 | if (onoff) |
| 194 | return cxusb_ctrl_msg(d, CMD_POWER_ON, &b, 1, NULL, 0); |
| 195 | else |
| 196 | return cxusb_ctrl_msg(d, CMD_POWER_OFF, &b, 1, NULL, 0); |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 197 | } |
| 198 | |
Michael Krufky | 5691c84 | 2006-04-19 20:40:01 -0300 | [diff] [blame] | 199 | static int cxusb_bluebird_power_ctrl(struct dvb_usb_device *d, int onoff) |
| 200 | { |
| 201 | u8 b = 0; |
| 202 | if (onoff) |
| 203 | return cxusb_ctrl_msg(d, CMD_POWER_ON, &b, 1, NULL, 0); |
| 204 | else |
| 205 | return 0; |
| 206 | } |
| 207 | |
Chris Pascoe | 5ccaf90 | 2007-11-20 01:53:31 -0300 | [diff] [blame] | 208 | static int cxusb_nano2_power_ctrl(struct dvb_usb_device *d, int onoff) |
| 209 | { |
| 210 | int rc = 0; |
| 211 | |
| 212 | rc = cxusb_power_ctrl(d, onoff); |
| 213 | if (!onoff) |
| 214 | cxusb_nano2_led(d, 0); |
| 215 | |
| 216 | return rc; |
| 217 | } |
| 218 | |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 219 | static int cxusb_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 220 | { |
Patrick Boettcher | 8257e8a | 2005-07-07 17:58:15 -0700 | [diff] [blame] | 221 | u8 buf[2] = { 0x03, 0x00 }; |
| 222 | if (onoff) |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 223 | cxusb_ctrl_msg(adap->dev, CMD_STREAMING_ON, buf, 2, NULL, 0); |
Patrick Boettcher | 8257e8a | 2005-07-07 17:58:15 -0700 | [diff] [blame] | 224 | else |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 225 | cxusb_ctrl_msg(adap->dev, CMD_STREAMING_OFF, NULL, 0, NULL, 0); |
Patrick Boettcher | 8257e8a | 2005-07-07 17:58:15 -0700 | [diff] [blame] | 226 | |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 227 | return 0; |
| 228 | } |
| 229 | |
Chris Pascoe | 7c23970 | 2006-01-09 18:21:29 -0200 | [diff] [blame] | 230 | static int cxusb_rc_query(struct dvb_usb_device *d, u32 *event, int *state) |
| 231 | { |
| 232 | struct dvb_usb_rc_key *keymap = d->props.rc_key_map; |
Michael Krufky | a07e609 | 2006-01-09 18:21:31 -0200 | [diff] [blame] | 233 | u8 ircode[4]; |
Chris Pascoe | 7c23970 | 2006-01-09 18:21:29 -0200 | [diff] [blame] | 234 | int i; |
| 235 | |
Michael Krufky | a07e609 | 2006-01-09 18:21:31 -0200 | [diff] [blame] | 236 | cxusb_ctrl_msg(d, CMD_GET_IR_CODE, NULL, 0, ircode, 4); |
Chris Pascoe | 7c23970 | 2006-01-09 18:21:29 -0200 | [diff] [blame] | 237 | |
| 238 | *event = 0; |
| 239 | *state = REMOTE_NO_KEY_PRESSED; |
| 240 | |
| 241 | for (i = 0; i < d->props.rc_key_map_size; i++) { |
Michael Krufky | a07e609 | 2006-01-09 18:21:31 -0200 | [diff] [blame] | 242 | if (keymap[i].custom == ircode[2] && |
| 243 | keymap[i].data == ircode[3]) { |
Chris Pascoe | 7c23970 | 2006-01-09 18:21:29 -0200 | [diff] [blame] | 244 | *event = keymap[i].event; |
| 245 | *state = REMOTE_KEY_PRESSED; |
| 246 | |
| 247 | return 0; |
| 248 | } |
| 249 | } |
| 250 | |
| 251 | return 0; |
| 252 | } |
| 253 | |
Chris Pascoe | aeb012b | 2007-11-19 21:57:10 -0300 | [diff] [blame] | 254 | static int cxusb_bluebird2_rc_query(struct dvb_usb_device *d, u32 *event, |
| 255 | int *state) |
| 256 | { |
| 257 | struct dvb_usb_rc_key *keymap = d->props.rc_key_map; |
| 258 | u8 ircode[4]; |
| 259 | int i; |
| 260 | struct i2c_msg msg = { .addr = 0x6b, .flags = I2C_M_RD, |
| 261 | .buf = ircode, .len = 4 }; |
| 262 | |
| 263 | *event = 0; |
| 264 | *state = REMOTE_NO_KEY_PRESSED; |
| 265 | |
| 266 | if (cxusb_i2c_xfer(&d->i2c_adap, &msg, 1) != 1) |
| 267 | return 0; |
| 268 | |
| 269 | for (i = 0; i < d->props.rc_key_map_size; i++) { |
| 270 | if (keymap[i].custom == ircode[1] && |
| 271 | keymap[i].data == ircode[2]) { |
| 272 | *event = keymap[i].event; |
| 273 | *state = REMOTE_KEY_PRESSED; |
| 274 | |
| 275 | return 0; |
| 276 | } |
| 277 | } |
| 278 | |
| 279 | return 0; |
| 280 | } |
| 281 | |
Adrian Bunk | 703cb2c | 2006-01-23 17:11:09 -0200 | [diff] [blame] | 282 | static struct dvb_usb_rc_key dvico_mce_rc_keys[] = { |
Michael Krufky | a07e609 | 2006-01-09 18:21:31 -0200 | [diff] [blame] | 283 | { 0xfe, 0x02, KEY_TV }, |
| 284 | { 0xfe, 0x0e, KEY_MP3 }, |
| 285 | { 0xfe, 0x1a, KEY_DVD }, |
| 286 | { 0xfe, 0x1e, KEY_FAVORITES }, |
| 287 | { 0xfe, 0x16, KEY_SETUP }, |
| 288 | { 0xfe, 0x46, KEY_POWER2 }, |
| 289 | { 0xfe, 0x0a, KEY_EPG }, |
| 290 | { 0xfe, 0x49, KEY_BACK }, |
| 291 | { 0xfe, 0x4d, KEY_MENU }, |
| 292 | { 0xfe, 0x51, KEY_UP }, |
| 293 | { 0xfe, 0x5b, KEY_LEFT }, |
| 294 | { 0xfe, 0x5f, KEY_RIGHT }, |
| 295 | { 0xfe, 0x53, KEY_DOWN }, |
| 296 | { 0xfe, 0x5e, KEY_OK }, |
| 297 | { 0xfe, 0x59, KEY_INFO }, |
| 298 | { 0xfe, 0x55, KEY_TAB }, |
| 299 | { 0xfe, 0x0f, KEY_PREVIOUSSONG },/* Replay */ |
| 300 | { 0xfe, 0x12, KEY_NEXTSONG }, /* Skip */ |
| 301 | { 0xfe, 0x42, KEY_ENTER }, /* Windows/Start */ |
| 302 | { 0xfe, 0x15, KEY_VOLUMEUP }, |
| 303 | { 0xfe, 0x05, KEY_VOLUMEDOWN }, |
| 304 | { 0xfe, 0x11, KEY_CHANNELUP }, |
| 305 | { 0xfe, 0x09, KEY_CHANNELDOWN }, |
| 306 | { 0xfe, 0x52, KEY_CAMERA }, |
| 307 | { 0xfe, 0x5a, KEY_TUNER }, /* Live */ |
| 308 | { 0xfe, 0x19, KEY_OPEN }, |
| 309 | { 0xfe, 0x0b, KEY_1 }, |
| 310 | { 0xfe, 0x17, KEY_2 }, |
| 311 | { 0xfe, 0x1b, KEY_3 }, |
| 312 | { 0xfe, 0x07, KEY_4 }, |
| 313 | { 0xfe, 0x50, KEY_5 }, |
| 314 | { 0xfe, 0x54, KEY_6 }, |
| 315 | { 0xfe, 0x48, KEY_7 }, |
| 316 | { 0xfe, 0x4c, KEY_8 }, |
| 317 | { 0xfe, 0x58, KEY_9 }, |
| 318 | { 0xfe, 0x13, KEY_ANGLE }, /* Aspect */ |
| 319 | { 0xfe, 0x03, KEY_0 }, |
| 320 | { 0xfe, 0x1f, KEY_ZOOM }, |
| 321 | { 0xfe, 0x43, KEY_REWIND }, |
| 322 | { 0xfe, 0x47, KEY_PLAYPAUSE }, |
| 323 | { 0xfe, 0x4f, KEY_FASTFORWARD }, |
| 324 | { 0xfe, 0x57, KEY_MUTE }, |
| 325 | { 0xfe, 0x0d, KEY_STOP }, |
| 326 | { 0xfe, 0x01, KEY_RECORD }, |
| 327 | { 0xfe, 0x4e, KEY_POWER }, |
| 328 | }; |
| 329 | |
Michael Krufky | c150178 | 2006-03-26 05:43:36 -0300 | [diff] [blame] | 330 | static struct dvb_usb_rc_key dvico_portable_rc_keys[] = { |
| 331 | { 0xfc, 0x02, KEY_SETUP }, /* Profile */ |
| 332 | { 0xfc, 0x43, KEY_POWER2 }, |
| 333 | { 0xfc, 0x06, KEY_EPG }, |
| 334 | { 0xfc, 0x5a, KEY_BACK }, |
| 335 | { 0xfc, 0x05, KEY_MENU }, |
| 336 | { 0xfc, 0x47, KEY_INFO }, |
| 337 | { 0xfc, 0x01, KEY_TAB }, |
| 338 | { 0xfc, 0x42, KEY_PREVIOUSSONG },/* Replay */ |
| 339 | { 0xfc, 0x49, KEY_VOLUMEUP }, |
| 340 | { 0xfc, 0x09, KEY_VOLUMEDOWN }, |
| 341 | { 0xfc, 0x54, KEY_CHANNELUP }, |
| 342 | { 0xfc, 0x0b, KEY_CHANNELDOWN }, |
Michael Krufky | dbcb86e | 2006-03-26 18:59:45 -0300 | [diff] [blame] | 343 | { 0xfc, 0x16, KEY_CAMERA }, |
Michael Krufky | c150178 | 2006-03-26 05:43:36 -0300 | [diff] [blame] | 344 | { 0xfc, 0x40, KEY_TUNER }, /* ATV/DTV */ |
| 345 | { 0xfc, 0x45, KEY_OPEN }, |
| 346 | { 0xfc, 0x19, KEY_1 }, |
| 347 | { 0xfc, 0x18, KEY_2 }, |
| 348 | { 0xfc, 0x1b, KEY_3 }, |
| 349 | { 0xfc, 0x1a, KEY_4 }, |
| 350 | { 0xfc, 0x58, KEY_5 }, |
| 351 | { 0xfc, 0x59, KEY_6 }, |
| 352 | { 0xfc, 0x15, KEY_7 }, |
| 353 | { 0xfc, 0x14, KEY_8 }, |
| 354 | { 0xfc, 0x17, KEY_9 }, |
| 355 | { 0xfc, 0x44, KEY_ANGLE }, /* Aspect */ |
| 356 | { 0xfc, 0x55, KEY_0 }, |
| 357 | { 0xfc, 0x07, KEY_ZOOM }, |
| 358 | { 0xfc, 0x0a, KEY_REWIND }, |
| 359 | { 0xfc, 0x08, KEY_PLAYPAUSE }, |
| 360 | { 0xfc, 0x4b, KEY_FASTFORWARD }, |
| 361 | { 0xfc, 0x5b, KEY_MUTE }, |
| 362 | { 0xfc, 0x04, KEY_STOP }, |
| 363 | { 0xfc, 0x56, KEY_RECORD }, |
| 364 | { 0xfc, 0x57, KEY_POWER }, |
| 365 | { 0xfc, 0x41, KEY_UNKNOWN }, /* INPUT */ |
| 366 | { 0xfc, 0x00, KEY_UNKNOWN }, /* HD */ |
| 367 | }; |
| 368 | |
Chris Pascoe | 0029ee1 | 2006-01-09 18:21:28 -0200 | [diff] [blame] | 369 | static int cxusb_dee1601_demod_init(struct dvb_frontend* fe) |
| 370 | { |
Chris Pascoe | d9ed881 | 2006-02-07 06:49:11 -0200 | [diff] [blame] | 371 | static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x28 }; |
Chris Pascoe | 0029ee1 | 2006-01-09 18:21:28 -0200 | [diff] [blame] | 372 | static u8 reset [] = { RESET, 0x80 }; |
| 373 | static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 }; |
| 374 | static u8 agc_cfg [] = { AGC_TARGET, 0x28, 0x20 }; |
| 375 | static u8 gpp_ctl_cfg [] = { GPP_CTL, 0x33 }; |
| 376 | static u8 capt_range_cfg[] = { CAPT_RANGE, 0x32 }; |
| 377 | |
| 378 | mt352_write(fe, clock_config, sizeof(clock_config)); |
| 379 | udelay(200); |
| 380 | mt352_write(fe, reset, sizeof(reset)); |
| 381 | mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg)); |
| 382 | |
| 383 | mt352_write(fe, agc_cfg, sizeof(agc_cfg)); |
| 384 | mt352_write(fe, gpp_ctl_cfg, sizeof(gpp_ctl_cfg)); |
| 385 | mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg)); |
| 386 | |
| 387 | return 0; |
| 388 | } |
| 389 | |
Michael Krufky | 6f44725 | 2006-01-11 19:40:33 -0200 | [diff] [blame] | 390 | static int cxusb_mt352_demod_init(struct dvb_frontend* fe) |
| 391 | { /* used in both lgz201 and th7579 */ |
Michael Krufky | fb51fd2 | 2006-02-07 06:49:12 -0200 | [diff] [blame] | 392 | static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x29 }; |
Michael Krufky | 6f44725 | 2006-01-11 19:40:33 -0200 | [diff] [blame] | 393 | static u8 reset [] = { RESET, 0x80 }; |
| 394 | static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 }; |
| 395 | static u8 agc_cfg [] = { AGC_TARGET, 0x24, 0x20 }; |
| 396 | static u8 gpp_ctl_cfg [] = { GPP_CTL, 0x33 }; |
| 397 | static u8 capt_range_cfg[] = { CAPT_RANGE, 0x32 }; |
| 398 | |
| 399 | mt352_write(fe, clock_config, sizeof(clock_config)); |
| 400 | udelay(200); |
| 401 | mt352_write(fe, reset, sizeof(reset)); |
| 402 | mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg)); |
| 403 | |
| 404 | mt352_write(fe, agc_cfg, sizeof(agc_cfg)); |
| 405 | mt352_write(fe, gpp_ctl_cfg, sizeof(gpp_ctl_cfg)); |
| 406 | mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg)); |
| 407 | return 0; |
| 408 | } |
| 409 | |
Adrian Bunk | 703cb2c | 2006-01-23 17:11:09 -0200 | [diff] [blame] | 410 | static struct cx22702_config cxusb_cx22702_config = { |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 411 | .demod_address = 0x63, |
Patrick Boettcher | 8257e8a | 2005-07-07 17:58:15 -0700 | [diff] [blame] | 412 | .output_mode = CX22702_PARALLEL_OUTPUT, |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 413 | }; |
| 414 | |
Michael Krufky | fddd632 | 2006-02-27 00:08:17 -0300 | [diff] [blame] | 415 | static struct lgdt330x_config cxusb_lgdt3303_config = { |
Michael Krufky | effee03 | 2006-01-09 15:25:47 -0200 | [diff] [blame] | 416 | .demod_address = 0x0e, |
| 417 | .demod_chip = LGDT3303, |
Michael Krufky | effee03 | 2006-01-09 15:25:47 -0200 | [diff] [blame] | 418 | }; |
| 419 | |
Adrian Bunk | 703cb2c | 2006-01-23 17:11:09 -0200 | [diff] [blame] | 420 | static struct mt352_config cxusb_dee1601_config = { |
Chris Pascoe | 0029ee1 | 2006-01-09 18:21:28 -0200 | [diff] [blame] | 421 | .demod_address = 0x0f, |
| 422 | .demod_init = cxusb_dee1601_demod_init, |
Chris Pascoe | 0029ee1 | 2006-01-09 18:21:28 -0200 | [diff] [blame] | 423 | }; |
| 424 | |
Michael Krufky | c9ce394 | 2006-06-11 04:24:31 -0300 | [diff] [blame] | 425 | static struct zl10353_config cxusb_zl10353_dee1601_config = { |
| 426 | .demod_address = 0x0f, |
Chris Pascoe | 8fb9578 | 2006-08-10 03:17:16 -0300 | [diff] [blame] | 427 | .parallel_ts = 1, |
Michael Krufky | c9ce394 | 2006-06-11 04:24:31 -0300 | [diff] [blame] | 428 | }; |
| 429 | |
Adrian Bunk | 6fe00b0 | 2006-04-19 20:49:28 -0300 | [diff] [blame] | 430 | static struct mt352_config cxusb_mt352_config = { |
Michael Krufky | 6f44725 | 2006-01-11 19:40:33 -0200 | [diff] [blame] | 431 | /* used in both lgz201 and th7579 */ |
| 432 | .demod_address = 0x0f, |
| 433 | .demod_init = cxusb_mt352_demod_init, |
Michael Krufky | 6f44725 | 2006-01-11 19:40:33 -0200 | [diff] [blame] | 434 | }; |
| 435 | |
Chris Pascoe | aeb012b | 2007-11-19 21:57:10 -0300 | [diff] [blame] | 436 | static struct zl10353_config cxusb_zl10353_xc3028_config = { |
| 437 | .demod_address = 0x0f, |
Chris Pascoe | a1dcd9d | 2007-11-20 08:17:54 -0300 | [diff] [blame] | 438 | .if2 = 45600, |
Chris Pascoe | aeb012b | 2007-11-19 21:57:10 -0300 | [diff] [blame] | 439 | .no_tuner = 1, |
| 440 | .parallel_ts = 1, |
| 441 | }; |
| 442 | |
Chris Pascoe | 702a676 | 2007-11-20 03:34:11 -0300 | [diff] [blame] | 443 | static struct mt352_config cxusb_mt352_xc3028_config = { |
| 444 | .demod_address = 0x0f, |
| 445 | .if2 = 4560, |
| 446 | .no_tuner = 1, |
| 447 | .demod_init = cxusb_mt352_demod_init, |
| 448 | }; |
| 449 | |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 450 | /* Callbacks for DVB USB */ |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 451 | static int cxusb_fmd1216me_tuner_attach(struct dvb_usb_adapter *adap) |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 452 | { |
Trent Piepho | b7754d7 | 2007-05-08 18:05:16 -0300 | [diff] [blame] | 453 | dvb_attach(dvb_pll_attach, adap->fe, 0x61, &adap->dev->i2c_adap, |
Michael Krufky | 47a9991 | 2007-06-12 16:10:51 -0300 | [diff] [blame] | 454 | DVB_PLL_FMD1216ME); |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 455 | return 0; |
| 456 | } |
| 457 | |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 458 | static int cxusb_dee1601_tuner_attach(struct dvb_usb_adapter *adap) |
Chris Pascoe | 0029ee1 | 2006-01-09 18:21:28 -0200 | [diff] [blame] | 459 | { |
Michael Krufky | 79a54cb | 2006-12-05 14:20:06 -0300 | [diff] [blame] | 460 | dvb_attach(dvb_pll_attach, adap->fe, 0x61, |
Michael Krufky | 47a9991 | 2007-06-12 16:10:51 -0300 | [diff] [blame] | 461 | NULL, DVB_PLL_THOMSON_DTT7579); |
Chris Pascoe | 0029ee1 | 2006-01-09 18:21:28 -0200 | [diff] [blame] | 462 | return 0; |
| 463 | } |
| 464 | |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 465 | static int cxusb_lgz201_tuner_attach(struct dvb_usb_adapter *adap) |
Michael Krufky | 6f44725 | 2006-01-11 19:40:33 -0200 | [diff] [blame] | 466 | { |
Michael Krufky | 47a9991 | 2007-06-12 16:10:51 -0300 | [diff] [blame] | 467 | dvb_attach(dvb_pll_attach, adap->fe, 0x61, NULL, DVB_PLL_LG_Z201); |
Michael Krufky | 6f44725 | 2006-01-11 19:40:33 -0200 | [diff] [blame] | 468 | return 0; |
| 469 | } |
| 470 | |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 471 | static int cxusb_dtt7579_tuner_attach(struct dvb_usb_adapter *adap) |
Michael Krufky | 6f44725 | 2006-01-11 19:40:33 -0200 | [diff] [blame] | 472 | { |
Michael Krufky | 79a54cb | 2006-12-05 14:20:06 -0300 | [diff] [blame] | 473 | dvb_attach(dvb_pll_attach, adap->fe, 0x60, |
Michael Krufky | 47a9991 | 2007-06-12 16:10:51 -0300 | [diff] [blame] | 474 | NULL, DVB_PLL_THOMSON_DTT7579); |
Patrick Boettcher | 332bed5 | 2006-05-14 04:49:00 -0300 | [diff] [blame] | 475 | return 0; |
| 476 | } |
| 477 | |
Michael Krufky | f71a56c | 2006-10-13 21:55:57 -0300 | [diff] [blame] | 478 | static int cxusb_lgh064f_tuner_attach(struct dvb_usb_adapter *adap) |
Patrick Boettcher | 332bed5 | 2006-05-14 04:49:00 -0300 | [diff] [blame] | 479 | { |
Trent Piepho | 6bdcc6e | 2007-04-27 12:31:30 -0300 | [diff] [blame] | 480 | dvb_attach(dvb_pll_attach, adap->fe, 0x61, &adap->dev->i2c_adap, |
Michael Krufky | 47a9991 | 2007-06-12 16:10:51 -0300 | [diff] [blame] | 481 | DVB_PLL_LG_TDVS_H06XF); |
Michael Krufky | 6f44725 | 2006-01-11 19:40:33 -0200 | [diff] [blame] | 482 | return 0; |
| 483 | } |
| 484 | |
Chris Pascoe | aeb012b | 2007-11-19 21:57:10 -0300 | [diff] [blame] | 485 | static int dvico_bluebird_xc2028_callback(void *ptr, int command, int arg) |
| 486 | { |
| 487 | struct dvb_usb_device *d = ptr; |
| 488 | |
| 489 | switch (command) { |
| 490 | case XC2028_TUNER_RESET: |
| 491 | deb_info("%s: XC2028_TUNER_RESET %d\n", __FUNCTION__, arg); |
| 492 | cxusb_bluebird_gpio_pulse(d, 0x01, 1); |
| 493 | break; |
| 494 | case XC2028_RESET_CLK: |
| 495 | deb_info("%s: XC2028_RESET_CLK %d\n", __FUNCTION__, arg); |
| 496 | break; |
| 497 | default: |
| 498 | deb_info("%s: unknown command %d, arg %d\n", __FUNCTION__, |
| 499 | command, arg); |
| 500 | return -EINVAL; |
| 501 | } |
| 502 | |
| 503 | return 0; |
| 504 | } |
| 505 | |
| 506 | static int cxusb_dvico_xc3028_tuner_attach(struct dvb_usb_adapter *adap) |
| 507 | { |
| 508 | struct dvb_frontend *fe; |
| 509 | struct xc2028_config cfg = { |
| 510 | .i2c_adap = &adap->dev->i2c_adap, |
| 511 | .i2c_addr = 0x61, |
| 512 | .video_dev = adap->dev, |
| 513 | .callback = dvico_bluebird_xc2028_callback, |
| 514 | }; |
| 515 | static struct xc2028_ctrl ctl = { |
Chris Pascoe | aeb012b | 2007-11-19 21:57:10 -0300 | [diff] [blame] | 516 | .fname = "xc3028-dvico-au-01.fw", |
| 517 | .max_len = 64, |
| 518 | .scode_table = ZARLINK456, |
| 519 | }; |
| 520 | |
| 521 | fe = dvb_attach(xc2028_attach, adap->fe, &cfg); |
| 522 | if (fe == NULL || fe->ops.tuner_ops.set_config == NULL) |
| 523 | return -EIO; |
| 524 | |
| 525 | fe->ops.tuner_ops.set_config(fe, &ctl); |
| 526 | |
| 527 | return 0; |
| 528 | } |
| 529 | |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 530 | static int cxusb_cx22702_frontend_attach(struct dvb_usb_adapter *adap) |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 531 | { |
Patrick Boettcher | e2efeab | 2005-09-09 13:02:51 -0700 | [diff] [blame] | 532 | u8 b; |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 533 | if (usb_set_interface(adap->dev->udev, 0, 6) < 0) |
Patrick Boettcher | 8257e8a | 2005-07-07 17:58:15 -0700 | [diff] [blame] | 534 | err("set interface failed"); |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 535 | |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 536 | cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, &b, 1); |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 537 | |
Michael Krufky | f35db23 | 2006-12-05 14:53:39 -0300 | [diff] [blame] | 538 | if ((adap->fe = dvb_attach(cx22702_attach, &cxusb_cx22702_config, |
| 539 | &adap->dev->i2c_adap)) != NULL) |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 540 | return 0; |
| 541 | |
| 542 | return -EIO; |
| 543 | } |
| 544 | |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 545 | static int cxusb_lgdt3303_frontend_attach(struct dvb_usb_adapter *adap) |
Michael Krufky | effee03 | 2006-01-09 15:25:47 -0200 | [diff] [blame] | 546 | { |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 547 | if (usb_set_interface(adap->dev->udev, 0, 7) < 0) |
Michael Krufky | effee03 | 2006-01-09 15:25:47 -0200 | [diff] [blame] | 548 | err("set interface failed"); |
| 549 | |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 550 | cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0); |
Michael Krufky | effee03 | 2006-01-09 15:25:47 -0200 | [diff] [blame] | 551 | |
Michael Krufky | f35db23 | 2006-12-05 14:53:39 -0300 | [diff] [blame] | 552 | if ((adap->fe = dvb_attach(lgdt330x_attach, &cxusb_lgdt3303_config, |
| 553 | &adap->dev->i2c_adap)) != NULL) |
Michael Krufky | effee03 | 2006-01-09 15:25:47 -0200 | [diff] [blame] | 554 | return 0; |
| 555 | |
| 556 | return -EIO; |
| 557 | } |
| 558 | |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 559 | static int cxusb_mt352_frontend_attach(struct dvb_usb_adapter *adap) |
Chris Pascoe | 0029ee1 | 2006-01-09 18:21:28 -0200 | [diff] [blame] | 560 | { |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 561 | /* used in both lgz201 and th7579 */ |
| 562 | if (usb_set_interface(adap->dev->udev, 0, 0) < 0) |
Chris Pascoe | 0029ee1 | 2006-01-09 18:21:28 -0200 | [diff] [blame] | 563 | err("set interface failed"); |
| 564 | |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 565 | cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0); |
Chris Pascoe | 0029ee1 | 2006-01-09 18:21:28 -0200 | [diff] [blame] | 566 | |
Michael Krufky | f35db23 | 2006-12-05 14:53:39 -0300 | [diff] [blame] | 567 | if ((adap->fe = dvb_attach(mt352_attach, &cxusb_mt352_config, |
| 568 | &adap->dev->i2c_adap)) != NULL) |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 569 | return 0; |
| 570 | |
| 571 | return -EIO; |
| 572 | } |
| 573 | |
| 574 | static int cxusb_dee1601_frontend_attach(struct dvb_usb_adapter *adap) |
| 575 | { |
| 576 | if (usb_set_interface(adap->dev->udev, 0, 0) < 0) |
| 577 | err("set interface failed"); |
| 578 | |
| 579 | cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0); |
| 580 | |
Michael Krufky | f35db23 | 2006-12-05 14:53:39 -0300 | [diff] [blame] | 581 | if (((adap->fe = dvb_attach(mt352_attach, &cxusb_dee1601_config, |
| 582 | &adap->dev->i2c_adap)) != NULL) || |
| 583 | ((adap->fe = dvb_attach(zl10353_attach, |
| 584 | &cxusb_zl10353_dee1601_config, |
| 585 | &adap->dev->i2c_adap)) != NULL)) |
Chris Pascoe | 0029ee1 | 2006-01-09 18:21:28 -0200 | [diff] [blame] | 586 | return 0; |
| 587 | |
| 588 | return -EIO; |
| 589 | } |
| 590 | |
Chris Pascoe | aeb012b | 2007-11-19 21:57:10 -0300 | [diff] [blame] | 591 | static int cxusb_dualdig4_frontend_attach(struct dvb_usb_adapter *adap) |
| 592 | { |
| 593 | u8 ircode[4]; |
| 594 | int i; |
| 595 | struct i2c_msg msg = { .addr = 0x6b, .flags = I2C_M_RD, |
| 596 | .buf = ircode, .len = 4 }; |
| 597 | |
| 598 | if (usb_set_interface(adap->dev->udev, 0, 1) < 0) |
| 599 | err("set interface failed"); |
| 600 | |
| 601 | cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0); |
| 602 | |
| 603 | /* reset the tuner and demodulator */ |
| 604 | cxusb_bluebird_gpio_rw(adap->dev, 0x04, 0); |
| 605 | cxusb_bluebird_gpio_pulse(adap->dev, 0x01, 1); |
| 606 | cxusb_bluebird_gpio_pulse(adap->dev, 0x02, 1); |
| 607 | |
| 608 | if ((adap->fe = dvb_attach(zl10353_attach, |
| 609 | &cxusb_zl10353_xc3028_config, |
| 610 | &adap->dev->i2c_adap)) == NULL) |
| 611 | return -EIO; |
| 612 | |
| 613 | /* try to determine if there is no IR decoder on the I2C bus */ |
| 614 | for (i = 0; adap->dev->props.rc_key_map != NULL && i < 5; i++) { |
| 615 | msleep(20); |
| 616 | if (cxusb_i2c_xfer(&adap->dev->i2c_adap, &msg, 1) != 1) |
| 617 | goto no_IR; |
| 618 | if (ircode[0] == 0 && ircode[1] == 0) |
| 619 | continue; |
| 620 | if (ircode[2] + ircode[3] != 0xff) { |
| 621 | no_IR: |
| 622 | adap->dev->props.rc_key_map = NULL; |
| 623 | info("No IR receiver detected on this device."); |
| 624 | break; |
| 625 | } |
| 626 | } |
| 627 | |
| 628 | return 0; |
| 629 | } |
| 630 | |
Chris Pascoe | 5ccaf90 | 2007-11-20 01:53:31 -0300 | [diff] [blame] | 631 | static int cxusb_nano2_frontend_attach(struct dvb_usb_adapter *adap) |
| 632 | { |
| 633 | if (usb_set_interface(adap->dev->udev, 0, 1) < 0) |
| 634 | err("set interface failed"); |
| 635 | |
| 636 | cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0); |
| 637 | |
| 638 | /* reset the tuner and demodulator */ |
| 639 | cxusb_bluebird_gpio_rw(adap->dev, 0x04, 0); |
| 640 | cxusb_bluebird_gpio_pulse(adap->dev, 0x01, 1); |
| 641 | cxusb_bluebird_gpio_pulse(adap->dev, 0x02, 1); |
| 642 | |
| 643 | if ((adap->fe = dvb_attach(zl10353_attach, |
| 644 | &cxusb_zl10353_xc3028_config, |
| 645 | &adap->dev->i2c_adap)) != NULL) |
| 646 | return 0; |
| 647 | |
Chris Pascoe | 702a676 | 2007-11-20 03:34:11 -0300 | [diff] [blame] | 648 | if ((adap->fe = dvb_attach(mt352_attach, |
| 649 | &cxusb_mt352_xc3028_config, |
| 650 | &adap->dev->i2c_adap)) != NULL) |
| 651 | return 0; |
| 652 | |
Chris Pascoe | 5ccaf90 | 2007-11-20 01:53:31 -0300 | [diff] [blame] | 653 | return -EIO; |
| 654 | } |
| 655 | |
Patrick Boettcher | f537378 | 2006-01-09 18:21:38 -0200 | [diff] [blame] | 656 | /* |
Chris Pascoe | 702a676 | 2007-11-20 03:34:11 -0300 | [diff] [blame] | 657 | * DViCO has shipped two devices with the same USB ID, but only one of them |
| 658 | * needs a firmware download. Check the device class details to see if they |
| 659 | * have non-default values to decide whether the device is actually cold or |
| 660 | * not, and forget a match if it turns out we selected the wrong device. |
| 661 | */ |
| 662 | static int bluebird_fx2_identify_state(struct usb_device *udev, |
| 663 | struct dvb_usb_device_properties *props, |
| 664 | struct dvb_usb_device_description **desc, |
| 665 | int *cold) |
| 666 | { |
| 667 | int wascold = *cold; |
| 668 | |
| 669 | *cold = udev->descriptor.bDeviceClass == 0xff && |
| 670 | udev->descriptor.bDeviceSubClass == 0xff && |
| 671 | udev->descriptor.bDeviceProtocol == 0xff; |
| 672 | |
| 673 | if (*cold && !wascold) |
| 674 | *desc = NULL; |
| 675 | |
| 676 | return 0; |
| 677 | } |
| 678 | |
| 679 | /* |
Patrick Boettcher | f537378 | 2006-01-09 18:21:38 -0200 | [diff] [blame] | 680 | * DViCO bluebird firmware needs the "warm" product ID to be patched into the |
| 681 | * firmware file before download. |
| 682 | */ |
| 683 | |
Chris Pascoe | 702a676 | 2007-11-20 03:34:11 -0300 | [diff] [blame] | 684 | static const int dvico_firmware_id_offsets[] = { 6638, 3204 }; |
Michael Krufky | f35db23 | 2006-12-05 14:53:39 -0300 | [diff] [blame] | 685 | static int bluebird_patch_dvico_firmware_download(struct usb_device *udev, |
| 686 | const struct firmware *fw) |
Patrick Boettcher | f537378 | 2006-01-09 18:21:38 -0200 | [diff] [blame] | 687 | { |
Chris Pascoe | 702a676 | 2007-11-20 03:34:11 -0300 | [diff] [blame] | 688 | int pos; |
Patrick Boettcher | f537378 | 2006-01-09 18:21:38 -0200 | [diff] [blame] | 689 | |
Chris Pascoe | 702a676 | 2007-11-20 03:34:11 -0300 | [diff] [blame] | 690 | for (pos = 0; pos < ARRAY_SIZE(dvico_firmware_id_offsets); pos++) { |
| 691 | int idoff = dvico_firmware_id_offsets[pos]; |
Patrick Boettcher | f537378 | 2006-01-09 18:21:38 -0200 | [diff] [blame] | 692 | |
Chris Pascoe | 702a676 | 2007-11-20 03:34:11 -0300 | [diff] [blame] | 693 | if (fw->size < idoff + 4) |
| 694 | continue; |
Patrick Boettcher | f537378 | 2006-01-09 18:21:38 -0200 | [diff] [blame] | 695 | |
Chris Pascoe | 702a676 | 2007-11-20 03:34:11 -0300 | [diff] [blame] | 696 | if (fw->data[idoff] == (USB_VID_DVICO & 0xff) && |
| 697 | fw->data[idoff + 1] == USB_VID_DVICO >> 8) { |
| 698 | fw->data[idoff + 2] = |
| 699 | le16_to_cpu(udev->descriptor.idProduct) + 1; |
| 700 | fw->data[idoff + 3] = |
| 701 | le16_to_cpu(udev->descriptor.idProduct) >> 8; |
| 702 | |
| 703 | return usb_cypress_load_firmware(udev, fw, CYPRESS_FX2); |
| 704 | } |
Patrick Boettcher | f537378 | 2006-01-09 18:21:38 -0200 | [diff] [blame] | 705 | } |
| 706 | |
| 707 | return -EINVAL; |
| 708 | } |
| 709 | |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 710 | /* DVB USB Driver stuff */ |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 711 | static struct dvb_usb_device_properties cxusb_medion_properties; |
| 712 | static struct dvb_usb_device_properties cxusb_bluebird_lgh064f_properties; |
| 713 | static struct dvb_usb_device_properties cxusb_bluebird_dee1601_properties; |
| 714 | static struct dvb_usb_device_properties cxusb_bluebird_lgz201_properties; |
| 715 | static struct dvb_usb_device_properties cxusb_bluebird_dtt7579_properties; |
Chris Pascoe | aeb012b | 2007-11-19 21:57:10 -0300 | [diff] [blame] | 716 | static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_properties; |
Chris Pascoe | 5ccaf90 | 2007-11-20 01:53:31 -0300 | [diff] [blame] | 717 | static struct dvb_usb_device_properties cxusb_bluebird_nano2_properties; |
Chris Pascoe | 702a676 | 2007-11-20 03:34:11 -0300 | [diff] [blame] | 718 | static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_properties; |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 719 | |
| 720 | static int cxusb_probe(struct usb_interface *intf, |
Michael Krufky | f35db23 | 2006-12-05 14:53:39 -0300 | [diff] [blame] | 721 | const struct usb_device_id *id) |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 722 | { |
Michael Krufky | effee03 | 2006-01-09 15:25:47 -0200 | [diff] [blame] | 723 | if (dvb_usb_device_init(intf,&cxusb_medion_properties,THIS_MODULE,NULL) == 0 || |
Chris Pascoe | 0029ee1 | 2006-01-09 18:21:28 -0200 | [diff] [blame] | 724 | dvb_usb_device_init(intf,&cxusb_bluebird_lgh064f_properties,THIS_MODULE,NULL) == 0 || |
Michael Krufky | 6f44725 | 2006-01-11 19:40:33 -0200 | [diff] [blame] | 725 | dvb_usb_device_init(intf,&cxusb_bluebird_dee1601_properties,THIS_MODULE,NULL) == 0 || |
| 726 | dvb_usb_device_init(intf,&cxusb_bluebird_lgz201_properties,THIS_MODULE,NULL) == 0 || |
Chris Pascoe | aeb012b | 2007-11-19 21:57:10 -0300 | [diff] [blame] | 727 | dvb_usb_device_init(intf,&cxusb_bluebird_dtt7579_properties,THIS_MODULE,NULL) == 0 || |
Chris Pascoe | 5ccaf90 | 2007-11-20 01:53:31 -0300 | [diff] [blame] | 728 | dvb_usb_device_init(intf,&cxusb_bluebird_dualdig4_properties,THIS_MODULE,NULL) == 0 || |
Chris Pascoe | 702a676 | 2007-11-20 03:34:11 -0300 | [diff] [blame] | 729 | dvb_usb_device_init(intf,&cxusb_bluebird_nano2_properties,THIS_MODULE,NULL) == 0 || |
| 730 | dvb_usb_device_init(intf,&cxusb_bluebird_nano2_needsfirmware_properties,THIS_MODULE,NULL) == 0) { |
Michael Krufky | effee03 | 2006-01-09 15:25:47 -0200 | [diff] [blame] | 731 | return 0; |
| 732 | } |
| 733 | |
| 734 | return -EINVAL; |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 735 | } |
| 736 | |
| 737 | static struct usb_device_id cxusb_table [] = { |
Michael Krufky | f35db23 | 2006-12-05 14:53:39 -0300 | [diff] [blame] | 738 | { USB_DEVICE(USB_VID_MEDION, USB_PID_MEDION_MD95700) }, |
| 739 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LG064F_COLD) }, |
| 740 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LG064F_WARM) }, |
| 741 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_1_COLD) }, |
| 742 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_1_WARM) }, |
| 743 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LGZ201_COLD) }, |
| 744 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LGZ201_WARM) }, |
| 745 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_TH7579_COLD) }, |
| 746 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_TH7579_WARM) }, |
| 747 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DIGITALNOW_BLUEBIRD_DUAL_1_COLD) }, |
| 748 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DIGITALNOW_BLUEBIRD_DUAL_1_WARM) }, |
| 749 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_2_COLD) }, |
| 750 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_2_WARM) }, |
Chris Pascoe | aeb012b | 2007-11-19 21:57:10 -0300 | [diff] [blame] | 751 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_4) }, |
Chris Pascoe | 5ccaf90 | 2007-11-20 01:53:31 -0300 | [diff] [blame] | 752 | { 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] | 753 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DVB_T_NANO_2_NFW_WARM) }, |
Michael Krufky | f35db23 | 2006-12-05 14:53:39 -0300 | [diff] [blame] | 754 | {} /* Terminating entry */ |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 755 | }; |
| 756 | MODULE_DEVICE_TABLE (usb, cxusb_table); |
| 757 | |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 758 | static struct dvb_usb_device_properties cxusb_medion_properties = { |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 759 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
| 760 | |
| 761 | .usb_ctrl = CYPRESS_FX2, |
| 762 | |
| 763 | .size_of_priv = sizeof(struct cxusb_state), |
| 764 | |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 765 | .num_adapters = 1, |
| 766 | .adapter = { |
| 767 | { |
Patrick Boettcher | 01451e7 | 2006-10-13 11:34:46 -0300 | [diff] [blame] | 768 | .streaming_ctrl = cxusb_streaming_ctrl, |
| 769 | .frontend_attach = cxusb_cx22702_frontend_attach, |
| 770 | .tuner_attach = cxusb_fmd1216me_tuner_attach, |
| 771 | /* parameter for the MPEG2-data transfer */ |
| 772 | .stream = { |
| 773 | .type = USB_BULK, |
| 774 | .count = 5, |
| 775 | .endpoint = 0x02, |
| 776 | .u = { |
| 777 | .bulk = { |
| 778 | .buffersize = 8192, |
| 779 | } |
| 780 | } |
| 781 | }, |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 782 | |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 783 | }, |
| 784 | }, |
| 785 | .power_ctrl = cxusb_power_ctrl, |
| 786 | |
| 787 | .i2c_algo = &cxusb_i2c_algo, |
| 788 | |
| 789 | .generic_bulk_ctrl_endpoint = 0x01, |
| 790 | |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 791 | .num_device_descs = 1, |
| 792 | .devices = { |
| 793 | { "Medion MD95700 (MDUSBTV-HYBRID)", |
| 794 | { NULL }, |
| 795 | { &cxusb_table[0], NULL }, |
| 796 | }, |
| 797 | } |
| 798 | }; |
| 799 | |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 800 | static struct dvb_usb_device_properties cxusb_bluebird_lgh064f_properties = { |
Michael Krufky | effee03 | 2006-01-09 15:25:47 -0200 | [diff] [blame] | 801 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
| 802 | |
Patrick Boettcher | f537378 | 2006-01-09 18:21:38 -0200 | [diff] [blame] | 803 | .usb_ctrl = DEVICE_SPECIFIC, |
| 804 | .firmware = "dvb-usb-bluebird-01.fw", |
| 805 | .download_firmware = bluebird_patch_dvico_firmware_download, |
Michael Krufky | 37bdfa0 | 2006-01-09 15:25:47 -0200 | [diff] [blame] | 806 | /* use usb alt setting 0 for EP4 transfer (dvb-t), |
| 807 | use usb alt setting 7 for EP2 transfer (atsc) */ |
Michael Krufky | effee03 | 2006-01-09 15:25:47 -0200 | [diff] [blame] | 808 | |
| 809 | .size_of_priv = sizeof(struct cxusb_state), |
| 810 | |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 811 | .num_adapters = 1, |
| 812 | .adapter = { |
| 813 | { |
Patrick Boettcher | 01451e7 | 2006-10-13 11:34:46 -0300 | [diff] [blame] | 814 | .streaming_ctrl = cxusb_streaming_ctrl, |
| 815 | .frontend_attach = cxusb_lgdt3303_frontend_attach, |
Michael Krufky | f71a56c | 2006-10-13 21:55:57 -0300 | [diff] [blame] | 816 | .tuner_attach = cxusb_lgh064f_tuner_attach, |
Michael Krufky | effee03 | 2006-01-09 15:25:47 -0200 | [diff] [blame] | 817 | |
Patrick Boettcher | 01451e7 | 2006-10-13 11:34:46 -0300 | [diff] [blame] | 818 | /* parameter for the MPEG2-data transfer */ |
| 819 | .stream = { |
| 820 | .type = USB_BULK, |
| 821 | .count = 5, |
| 822 | .endpoint = 0x02, |
| 823 | .u = { |
| 824 | .bulk = { |
| 825 | .buffersize = 8192, |
| 826 | } |
| 827 | } |
| 828 | }, |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 829 | }, |
| 830 | }, |
| 831 | |
| 832 | .power_ctrl = cxusb_bluebird_power_ctrl, |
| 833 | |
Michael Krufky | effee03 | 2006-01-09 15:25:47 -0200 | [diff] [blame] | 834 | .i2c_algo = &cxusb_i2c_algo, |
| 835 | |
Michael Krufky | c150178 | 2006-03-26 05:43:36 -0300 | [diff] [blame] | 836 | .rc_interval = 100, |
| 837 | .rc_key_map = dvico_portable_rc_keys, |
| 838 | .rc_key_map_size = ARRAY_SIZE(dvico_portable_rc_keys), |
| 839 | .rc_query = cxusb_rc_query, |
| 840 | |
Michael Krufky | effee03 | 2006-01-09 15:25:47 -0200 | [diff] [blame] | 841 | .generic_bulk_ctrl_endpoint = 0x01, |
Michael Krufky | effee03 | 2006-01-09 15:25:47 -0200 | [diff] [blame] | 842 | |
| 843 | .num_device_descs = 1, |
| 844 | .devices = { |
| 845 | { "DViCO FusionHDTV5 USB Gold", |
| 846 | { &cxusb_table[1], NULL }, |
| 847 | { &cxusb_table[2], NULL }, |
| 848 | }, |
| 849 | } |
| 850 | }; |
| 851 | |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 852 | static struct dvb_usb_device_properties cxusb_bluebird_dee1601_properties = { |
Chris Pascoe | 0029ee1 | 2006-01-09 18:21:28 -0200 | [diff] [blame] | 853 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
| 854 | |
Patrick Boettcher | f537378 | 2006-01-09 18:21:38 -0200 | [diff] [blame] | 855 | .usb_ctrl = DEVICE_SPECIFIC, |
| 856 | .firmware = "dvb-usb-bluebird-01.fw", |
| 857 | .download_firmware = bluebird_patch_dvico_firmware_download, |
Chris Pascoe | 0029ee1 | 2006-01-09 18:21:28 -0200 | [diff] [blame] | 858 | /* use usb alt setting 0 for EP4 transfer (dvb-t), |
| 859 | use usb alt setting 7 for EP2 transfer (atsc) */ |
| 860 | |
| 861 | .size_of_priv = sizeof(struct cxusb_state), |
| 862 | |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 863 | .num_adapters = 1, |
| 864 | .adapter = { |
| 865 | { |
Patrick Boettcher | 01451e7 | 2006-10-13 11:34:46 -0300 | [diff] [blame] | 866 | .streaming_ctrl = cxusb_streaming_ctrl, |
| 867 | .frontend_attach = cxusb_dee1601_frontend_attach, |
| 868 | .tuner_attach = cxusb_dee1601_tuner_attach, |
| 869 | /* parameter for the MPEG2-data transfer */ |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 870 | .stream = { |
| 871 | .type = USB_BULK, |
Patrick Boettcher | 01451e7 | 2006-10-13 11:34:46 -0300 | [diff] [blame] | 872 | .count = 5, |
| 873 | .endpoint = 0x04, |
| 874 | .u = { |
| 875 | .bulk = { |
| 876 | .buffersize = 8192, |
| 877 | } |
| 878 | } |
| 879 | }, |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 880 | }, |
| 881 | }, |
| 882 | |
| 883 | .power_ctrl = cxusb_bluebird_power_ctrl, |
Chris Pascoe | 0029ee1 | 2006-01-09 18:21:28 -0200 | [diff] [blame] | 884 | |
| 885 | .i2c_algo = &cxusb_i2c_algo, |
| 886 | |
Chris Pascoe | 7c23970 | 2006-01-09 18:21:29 -0200 | [diff] [blame] | 887 | .rc_interval = 150, |
| 888 | .rc_key_map = dvico_mce_rc_keys, |
| 889 | .rc_key_map_size = ARRAY_SIZE(dvico_mce_rc_keys), |
| 890 | .rc_query = cxusb_rc_query, |
| 891 | |
Chris Pascoe | 0029ee1 | 2006-01-09 18:21:28 -0200 | [diff] [blame] | 892 | .generic_bulk_ctrl_endpoint = 0x01, |
Chris Pascoe | 0029ee1 | 2006-01-09 18:21:28 -0200 | [diff] [blame] | 893 | |
Michael Krufky | 587c03d | 2006-09-28 02:16:01 -0300 | [diff] [blame] | 894 | .num_device_descs = 3, |
Chris Pascoe | 0029ee1 | 2006-01-09 18:21:28 -0200 | [diff] [blame] | 895 | .devices = { |
| 896 | { "DViCO FusionHDTV DVB-T Dual USB", |
| 897 | { &cxusb_table[3], NULL }, |
| 898 | { &cxusb_table[4], NULL }, |
| 899 | }, |
Michael Krufky | ac9ffb9 | 2006-01-11 23:21:00 -0200 | [diff] [blame] | 900 | { "DigitalNow DVB-T Dual USB", |
| 901 | { &cxusb_table[9], NULL }, |
| 902 | { &cxusb_table[10], NULL }, |
| 903 | }, |
Michael Krufky | 587c03d | 2006-09-28 02:16:01 -0300 | [diff] [blame] | 904 | { "DViCO FusionHDTV DVB-T Dual Digital 2", |
| 905 | { &cxusb_table[11], NULL }, |
| 906 | { &cxusb_table[12], NULL }, |
| 907 | }, |
Chris Pascoe | 0029ee1 | 2006-01-09 18:21:28 -0200 | [diff] [blame] | 908 | } |
| 909 | }; |
| 910 | |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 911 | static struct dvb_usb_device_properties cxusb_bluebird_lgz201_properties = { |
Michael Krufky | 6f44725 | 2006-01-11 19:40:33 -0200 | [diff] [blame] | 912 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
| 913 | |
| 914 | .usb_ctrl = DEVICE_SPECIFIC, |
| 915 | .firmware = "dvb-usb-bluebird-01.fw", |
| 916 | .download_firmware = bluebird_patch_dvico_firmware_download, |
| 917 | /* use usb alt setting 0 for EP4 transfer (dvb-t), |
| 918 | use usb alt setting 7 for EP2 transfer (atsc) */ |
| 919 | |
| 920 | .size_of_priv = sizeof(struct cxusb_state), |
| 921 | |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 922 | .num_adapters = 2, |
| 923 | .adapter = { |
| 924 | { |
Patrick Boettcher | 01451e7 | 2006-10-13 11:34:46 -0300 | [diff] [blame] | 925 | .streaming_ctrl = cxusb_streaming_ctrl, |
| 926 | .frontend_attach = cxusb_mt352_frontend_attach, |
| 927 | .tuner_attach = cxusb_lgz201_tuner_attach, |
Michael Krufky | 6f44725 | 2006-01-11 19:40:33 -0200 | [diff] [blame] | 928 | |
Patrick Boettcher | 01451e7 | 2006-10-13 11:34:46 -0300 | [diff] [blame] | 929 | /* parameter for the MPEG2-data transfer */ |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 930 | .stream = { |
| 931 | .type = USB_BULK, |
Patrick Boettcher | 01451e7 | 2006-10-13 11:34:46 -0300 | [diff] [blame] | 932 | .count = 5, |
| 933 | .endpoint = 0x04, |
| 934 | .u = { |
| 935 | .bulk = { |
| 936 | .buffersize = 8192, |
| 937 | } |
| 938 | } |
| 939 | }, |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 940 | }, |
| 941 | }, |
| 942 | .power_ctrl = cxusb_bluebird_power_ctrl, |
| 943 | |
Michael Krufky | 6f44725 | 2006-01-11 19:40:33 -0200 | [diff] [blame] | 944 | .i2c_algo = &cxusb_i2c_algo, |
| 945 | |
Michael Krufky | c150178 | 2006-03-26 05:43:36 -0300 | [diff] [blame] | 946 | .rc_interval = 100, |
| 947 | .rc_key_map = dvico_portable_rc_keys, |
| 948 | .rc_key_map_size = ARRAY_SIZE(dvico_portable_rc_keys), |
| 949 | .rc_query = cxusb_rc_query, |
| 950 | |
Michael Krufky | 6f44725 | 2006-01-11 19:40:33 -0200 | [diff] [blame] | 951 | .generic_bulk_ctrl_endpoint = 0x01, |
Michael Krufky | 6f44725 | 2006-01-11 19:40:33 -0200 | [diff] [blame] | 952 | .num_device_descs = 1, |
| 953 | .devices = { |
| 954 | { "DViCO FusionHDTV DVB-T USB (LGZ201)", |
| 955 | { &cxusb_table[5], NULL }, |
| 956 | { &cxusb_table[6], NULL }, |
| 957 | }, |
| 958 | } |
| 959 | }; |
| 960 | |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 961 | static struct dvb_usb_device_properties cxusb_bluebird_dtt7579_properties = { |
Michael Krufky | 6f44725 | 2006-01-11 19:40:33 -0200 | [diff] [blame] | 962 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
| 963 | |
| 964 | .usb_ctrl = DEVICE_SPECIFIC, |
| 965 | .firmware = "dvb-usb-bluebird-01.fw", |
| 966 | .download_firmware = bluebird_patch_dvico_firmware_download, |
| 967 | /* use usb alt setting 0 for EP4 transfer (dvb-t), |
| 968 | use usb alt setting 7 for EP2 transfer (atsc) */ |
| 969 | |
| 970 | .size_of_priv = sizeof(struct cxusb_state), |
| 971 | |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 972 | .num_adapters = 1, |
| 973 | .adapter = { |
| 974 | { |
Patrick Boettcher | 01451e7 | 2006-10-13 11:34:46 -0300 | [diff] [blame] | 975 | .streaming_ctrl = cxusb_streaming_ctrl, |
| 976 | .frontend_attach = cxusb_mt352_frontend_attach, |
| 977 | .tuner_attach = cxusb_dtt7579_tuner_attach, |
Michael Krufky | 6f44725 | 2006-01-11 19:40:33 -0200 | [diff] [blame] | 978 | |
Patrick Boettcher | 01451e7 | 2006-10-13 11:34:46 -0300 | [diff] [blame] | 979 | /* parameter for the MPEG2-data transfer */ |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 980 | .stream = { |
| 981 | .type = USB_BULK, |
Patrick Boettcher | 01451e7 | 2006-10-13 11:34:46 -0300 | [diff] [blame] | 982 | .count = 5, |
| 983 | .endpoint = 0x04, |
| 984 | .u = { |
| 985 | .bulk = { |
| 986 | .buffersize = 8192, |
| 987 | } |
| 988 | } |
| 989 | }, |
Patrick Boettcher | 4d43e13 | 2006-09-30 06:53:48 -0300 | [diff] [blame] | 990 | }, |
| 991 | }, |
| 992 | .power_ctrl = cxusb_bluebird_power_ctrl, |
| 993 | |
Michael Krufky | 6f44725 | 2006-01-11 19:40:33 -0200 | [diff] [blame] | 994 | .i2c_algo = &cxusb_i2c_algo, |
| 995 | |
Michael Krufky | c150178 | 2006-03-26 05:43:36 -0300 | [diff] [blame] | 996 | .rc_interval = 100, |
| 997 | .rc_key_map = dvico_portable_rc_keys, |
| 998 | .rc_key_map_size = ARRAY_SIZE(dvico_portable_rc_keys), |
| 999 | .rc_query = cxusb_rc_query, |
| 1000 | |
Michael Krufky | 6f44725 | 2006-01-11 19:40:33 -0200 | [diff] [blame] | 1001 | .generic_bulk_ctrl_endpoint = 0x01, |
Michael Krufky | 6f44725 | 2006-01-11 19:40:33 -0200 | [diff] [blame] | 1002 | |
| 1003 | .num_device_descs = 1, |
| 1004 | .devices = { |
| 1005 | { "DViCO FusionHDTV DVB-T USB (TH7579)", |
| 1006 | { &cxusb_table[7], NULL }, |
| 1007 | { &cxusb_table[8], NULL }, |
| 1008 | }, |
| 1009 | } |
| 1010 | }; |
| 1011 | |
Chris Pascoe | aeb012b | 2007-11-19 21:57:10 -0300 | [diff] [blame] | 1012 | static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_properties = { |
| 1013 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
| 1014 | |
| 1015 | .usb_ctrl = CYPRESS_FX2, |
| 1016 | |
| 1017 | .size_of_priv = sizeof(struct cxusb_state), |
| 1018 | |
| 1019 | .num_adapters = 1, |
| 1020 | .adapter = { |
| 1021 | { |
| 1022 | .streaming_ctrl = cxusb_streaming_ctrl, |
| 1023 | .frontend_attach = cxusb_dualdig4_frontend_attach, |
| 1024 | .tuner_attach = cxusb_dvico_xc3028_tuner_attach, |
| 1025 | /* parameter for the MPEG2-data transfer */ |
| 1026 | .stream = { |
| 1027 | .type = USB_BULK, |
| 1028 | .count = 5, |
| 1029 | .endpoint = 0x02, |
| 1030 | .u = { |
| 1031 | .bulk = { |
| 1032 | .buffersize = 8192, |
| 1033 | } |
| 1034 | } |
| 1035 | }, |
| 1036 | }, |
| 1037 | }, |
| 1038 | |
| 1039 | .power_ctrl = cxusb_power_ctrl, |
| 1040 | |
| 1041 | .i2c_algo = &cxusb_i2c_algo, |
| 1042 | |
| 1043 | .generic_bulk_ctrl_endpoint = 0x01, |
| 1044 | |
| 1045 | .rc_interval = 100, |
| 1046 | .rc_key_map = dvico_mce_rc_keys, |
| 1047 | .rc_key_map_size = ARRAY_SIZE(dvico_mce_rc_keys), |
| 1048 | .rc_query = cxusb_bluebird2_rc_query, |
| 1049 | |
| 1050 | .num_device_descs = 1, |
| 1051 | .devices = { |
| 1052 | { "DViCO FusionHDTV DVB-T Dual Digital 4", |
| 1053 | { NULL }, |
| 1054 | { &cxusb_table[13], NULL }, |
| 1055 | }, |
| 1056 | } |
| 1057 | }; |
| 1058 | |
Chris Pascoe | 5ccaf90 | 2007-11-20 01:53:31 -0300 | [diff] [blame] | 1059 | static struct dvb_usb_device_properties cxusb_bluebird_nano2_properties = { |
| 1060 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
| 1061 | |
| 1062 | .usb_ctrl = CYPRESS_FX2, |
Chris Pascoe | 702a676 | 2007-11-20 03:34:11 -0300 | [diff] [blame] | 1063 | .identify_state = bluebird_fx2_identify_state, |
Chris Pascoe | 5ccaf90 | 2007-11-20 01:53:31 -0300 | [diff] [blame] | 1064 | |
| 1065 | .size_of_priv = sizeof(struct cxusb_state), |
| 1066 | |
| 1067 | .num_adapters = 1, |
| 1068 | .adapter = { |
| 1069 | { |
| 1070 | .streaming_ctrl = cxusb_streaming_ctrl, |
| 1071 | .frontend_attach = cxusb_nano2_frontend_attach, |
| 1072 | .tuner_attach = cxusb_dvico_xc3028_tuner_attach, |
| 1073 | /* parameter for the MPEG2-data transfer */ |
| 1074 | .stream = { |
| 1075 | .type = USB_BULK, |
| 1076 | .count = 5, |
| 1077 | .endpoint = 0x02, |
| 1078 | .u = { |
| 1079 | .bulk = { |
| 1080 | .buffersize = 8192, |
| 1081 | } |
| 1082 | } |
| 1083 | }, |
| 1084 | }, |
| 1085 | }, |
| 1086 | |
| 1087 | .power_ctrl = cxusb_nano2_power_ctrl, |
| 1088 | |
| 1089 | .i2c_algo = &cxusb_i2c_algo, |
| 1090 | |
| 1091 | .generic_bulk_ctrl_endpoint = 0x01, |
| 1092 | |
| 1093 | .rc_interval = 100, |
| 1094 | .rc_key_map = dvico_portable_rc_keys, |
| 1095 | .rc_key_map_size = ARRAY_SIZE(dvico_portable_rc_keys), |
| 1096 | .rc_query = cxusb_bluebird2_rc_query, |
| 1097 | |
| 1098 | .num_device_descs = 1, |
| 1099 | .devices = { |
| 1100 | { "DViCO FusionHDTV DVB-T NANO2", |
| 1101 | { NULL }, |
| 1102 | { &cxusb_table[14], NULL }, |
| 1103 | }, |
| 1104 | } |
| 1105 | }; |
| 1106 | |
Chris Pascoe | 702a676 | 2007-11-20 03:34:11 -0300 | [diff] [blame] | 1107 | static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_properties = { |
| 1108 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
| 1109 | |
| 1110 | .usb_ctrl = DEVICE_SPECIFIC, |
| 1111 | .firmware = "dvb-usb-bluebird-02.fw", |
| 1112 | .download_firmware = bluebird_patch_dvico_firmware_download, |
| 1113 | .identify_state = bluebird_fx2_identify_state, |
| 1114 | |
| 1115 | .size_of_priv = sizeof(struct cxusb_state), |
| 1116 | |
| 1117 | .num_adapters = 1, |
| 1118 | .adapter = { |
| 1119 | { |
| 1120 | .streaming_ctrl = cxusb_streaming_ctrl, |
| 1121 | .frontend_attach = cxusb_nano2_frontend_attach, |
| 1122 | .tuner_attach = cxusb_dvico_xc3028_tuner_attach, |
| 1123 | /* parameter for the MPEG2-data transfer */ |
| 1124 | .stream = { |
| 1125 | .type = USB_BULK, |
| 1126 | .count = 5, |
| 1127 | .endpoint = 0x02, |
| 1128 | .u = { |
| 1129 | .bulk = { |
| 1130 | .buffersize = 8192, |
| 1131 | } |
| 1132 | } |
| 1133 | }, |
| 1134 | }, |
| 1135 | }, |
| 1136 | |
| 1137 | .power_ctrl = cxusb_nano2_power_ctrl, |
| 1138 | |
| 1139 | .i2c_algo = &cxusb_i2c_algo, |
| 1140 | |
| 1141 | .generic_bulk_ctrl_endpoint = 0x01, |
| 1142 | |
| 1143 | .rc_interval = 100, |
| 1144 | .rc_key_map = dvico_portable_rc_keys, |
| 1145 | .rc_key_map_size = ARRAY_SIZE(dvico_portable_rc_keys), |
| 1146 | .rc_query = cxusb_rc_query, |
| 1147 | |
| 1148 | .num_device_descs = 1, |
| 1149 | .devices = { |
| 1150 | { "DViCO FusionHDTV DVB-T NANO2 w/o firmware", |
| 1151 | { &cxusb_table[14], NULL }, |
| 1152 | { &cxusb_table[15], NULL }, |
| 1153 | }, |
| 1154 | } |
| 1155 | }; |
| 1156 | |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 1157 | static struct usb_driver cxusb_driver = { |
Patrick Boettcher | 63b5c1c | 2005-07-07 17:58:30 -0700 | [diff] [blame] | 1158 | .name = "dvb_usb_cxusb", |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 1159 | .probe = cxusb_probe, |
Michael Krufky | f35db23 | 2006-12-05 14:53:39 -0300 | [diff] [blame] | 1160 | .disconnect = dvb_usb_device_exit, |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 1161 | .id_table = cxusb_table, |
| 1162 | }; |
| 1163 | |
| 1164 | /* module stuff */ |
| 1165 | static int __init cxusb_module_init(void) |
| 1166 | { |
| 1167 | int result; |
| 1168 | if ((result = usb_register(&cxusb_driver))) { |
| 1169 | err("usb_register failed. Error number %d",result); |
| 1170 | return result; |
| 1171 | } |
| 1172 | |
| 1173 | return 0; |
| 1174 | } |
| 1175 | |
| 1176 | static void __exit cxusb_module_exit(void) |
| 1177 | { |
| 1178 | /* deregister this driver from the USB subsystem */ |
| 1179 | usb_deregister(&cxusb_driver); |
| 1180 | } |
| 1181 | |
| 1182 | module_init (cxusb_module_init); |
| 1183 | module_exit (cxusb_module_exit); |
| 1184 | |
| 1185 | MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); |
Michael Krufky | 5b9ed28 | 2006-10-15 14:51:08 -0300 | [diff] [blame] | 1186 | MODULE_AUTHOR("Michael Krufky <mkrufky@linuxtv.org>"); |
Michael Krufky | f4efb4d | 2006-01-13 14:10:25 -0200 | [diff] [blame] | 1187 | MODULE_AUTHOR("Chris Pascoe <c.pascoe@itee.uq.edu.au>"); |
Patrick Boettcher | 22c6d93 | 2005-07-07 17:58:10 -0700 | [diff] [blame] | 1188 | MODULE_DESCRIPTION("Driver for Conexant USB2.0 hybrid reference design"); |
| 1189 | MODULE_VERSION("1.0-alpha"); |
| 1190 | MODULE_LICENSE("GPL"); |