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