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