Malcolm Priestley | f6d8735 | 2011-07-25 15:35:03 -0300 | [diff] [blame] | 1 | /* DVB USB compliant linux driver for IT9137 |
| 2 | * |
| 3 | * Copyright (C) 2011 Malcolm Priestley (tvboxspy@gmail.com) |
| 4 | * IT9137 (C) ITE Tech Inc. |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License Version 2, as |
| 8 | * published by the Free Software Foundation. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 18 | * |
| 19 | * |
| 20 | * see Documentation/dvb/README.dvb-usb for more information |
| 21 | * see Documentation/dvb/it9137.txt for firmware information |
| 22 | * |
| 23 | */ |
| 24 | #define DVB_USB_LOG_PREFIX "it913x" |
| 25 | |
| 26 | #include <linux/usb.h> |
| 27 | #include <linux/usb/input.h> |
| 28 | #include <media/rc-core.h> |
| 29 | |
| 30 | #include "dvb-usb.h" |
| 31 | #include "it913x-fe.h" |
| 32 | |
| 33 | /* debug */ |
| 34 | static int dvb_usb_it913x_debug; |
| 35 | #define l_dprintk(var, level, args...) do { \ |
| 36 | if ((var >= level)) \ |
| 37 | printk(KERN_DEBUG DVB_USB_LOG_PREFIX ": " args); \ |
| 38 | } while (0) |
| 39 | |
| 40 | #define deb_info(level, args...) l_dprintk(dvb_usb_it913x_debug, level, args) |
| 41 | #define debug_data_snipet(level, name, p) \ |
| 42 | deb_info(level, name" (%02x%02x%02x%02x%02x%02x%02x%02x)", \ |
| 43 | *p, *(p+1), *(p+2), *(p+3), *(p+4), \ |
| 44 | *(p+5), *(p+6), *(p+7)); |
| 45 | |
| 46 | |
| 47 | module_param_named(debug, dvb_usb_it913x_debug, int, 0644); |
| 48 | MODULE_PARM_DESC(debug, "set debugging level (1=info (or-able))." |
| 49 | DVB_USB_DEBUG_STATUS); |
| 50 | |
| 51 | static int pid_filter; |
| 52 | module_param_named(pid, pid_filter, int, 0644); |
| 53 | MODULE_PARM_DESC(pid, "set default 0=on 1=off"); |
| 54 | |
Malcolm Priestley | 5e642c0 | 2011-11-30 17:16:09 -0300 | [diff] [blame^] | 55 | static int dvb_usb_it913x_firmware; |
| 56 | module_param_named(firmware, dvb_usb_it913x_firmware, int, 0644); |
| 57 | MODULE_PARM_DESC(firmware, "set firmware 0=auto 1=IT9137 2=IT9135V1"); |
| 58 | |
| 59 | |
Malcolm Priestley | f6d8735 | 2011-07-25 15:35:03 -0300 | [diff] [blame] | 60 | int cmd_counter; |
| 61 | |
| 62 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); |
| 63 | |
| 64 | struct it913x_state { |
| 65 | u8 id; |
| 66 | }; |
| 67 | |
Malcolm Priestley | bc54919 | 2011-10-14 19:54:11 -0300 | [diff] [blame] | 68 | struct ite_config it913x_config; |
| 69 | |
Malcolm Priestley | f6d8735 | 2011-07-25 15:35:03 -0300 | [diff] [blame] | 70 | static int it913x_bulk_write(struct usb_device *dev, |
| 71 | u8 *snd, int len, u8 pipe) |
| 72 | { |
| 73 | int ret, actual_l; |
| 74 | |
| 75 | ret = usb_bulk_msg(dev, usb_sndbulkpipe(dev, pipe), |
| 76 | snd, len , &actual_l, 100); |
| 77 | return ret; |
| 78 | } |
| 79 | |
| 80 | static int it913x_bulk_read(struct usb_device *dev, |
| 81 | u8 *rev, int len, u8 pipe) |
| 82 | { |
| 83 | int ret, actual_l; |
| 84 | |
| 85 | ret = usb_bulk_msg(dev, usb_rcvbulkpipe(dev, pipe), |
| 86 | rev, len , &actual_l, 200); |
| 87 | return ret; |
| 88 | } |
| 89 | |
| 90 | static u16 check_sum(u8 *p, u8 len) |
| 91 | { |
| 92 | u16 sum = 0; |
| 93 | u8 i = 1; |
| 94 | while (i < len) |
| 95 | sum += (i++ & 1) ? (*p++) << 8 : *p++; |
| 96 | return ~sum; |
| 97 | } |
| 98 | |
| 99 | static int it913x_io(struct usb_device *udev, u8 mode, u8 pro, |
| 100 | u8 cmd, u32 reg, u8 addr, u8 *data, u8 len) |
| 101 | { |
| 102 | int ret = 0, i, buf_size = 1; |
| 103 | u8 *buff; |
| 104 | u8 rlen; |
| 105 | u16 chk_sum; |
| 106 | |
| 107 | buff = kzalloc(256, GFP_KERNEL); |
| 108 | if (!buff) { |
| 109 | info("USB Buffer Failed"); |
| 110 | return -ENOMEM; |
| 111 | } |
| 112 | |
| 113 | buff[buf_size++] = pro; |
| 114 | buff[buf_size++] = cmd; |
| 115 | buff[buf_size++] = cmd_counter; |
| 116 | |
| 117 | switch (mode) { |
| 118 | case READ_LONG: |
| 119 | case WRITE_LONG: |
| 120 | buff[buf_size++] = len; |
| 121 | buff[buf_size++] = 2; |
| 122 | buff[buf_size++] = (reg >> 24); |
| 123 | buff[buf_size++] = (reg >> 16) & 0xff; |
| 124 | buff[buf_size++] = (reg >> 8) & 0xff; |
| 125 | buff[buf_size++] = reg & 0xff; |
| 126 | break; |
| 127 | case READ_SHORT: |
| 128 | buff[buf_size++] = addr; |
| 129 | break; |
| 130 | case WRITE_SHORT: |
| 131 | buff[buf_size++] = len; |
| 132 | buff[buf_size++] = addr; |
| 133 | buff[buf_size++] = (reg >> 8) & 0xff; |
| 134 | buff[buf_size++] = reg & 0xff; |
| 135 | break; |
| 136 | case READ_DATA: |
| 137 | case WRITE_DATA: |
| 138 | break; |
| 139 | case WRITE_CMD: |
| 140 | mode = 7; |
| 141 | break; |
| 142 | default: |
| 143 | kfree(buff); |
| 144 | return -EINVAL; |
| 145 | } |
| 146 | |
| 147 | if (mode & 1) { |
| 148 | for (i = 0; i < len ; i++) |
| 149 | buff[buf_size++] = data[i]; |
| 150 | } |
| 151 | chk_sum = check_sum(&buff[1], buf_size); |
| 152 | |
| 153 | buff[buf_size++] = chk_sum >> 8; |
| 154 | buff[0] = buf_size; |
| 155 | buff[buf_size++] = (chk_sum & 0xff); |
| 156 | |
| 157 | ret = it913x_bulk_write(udev, buff, buf_size , 0x02); |
| 158 | |
| 159 | ret |= it913x_bulk_read(udev, buff, (mode & 1) ? |
| 160 | 5 : len + 5 , 0x01); |
| 161 | |
| 162 | rlen = (mode & 0x1) ? 0x1 : len; |
| 163 | |
| 164 | if (mode & 1) |
| 165 | ret |= buff[2]; |
| 166 | else |
| 167 | memcpy(data, &buff[3], rlen); |
| 168 | |
| 169 | cmd_counter++; |
| 170 | |
| 171 | kfree(buff); |
| 172 | |
| 173 | return (ret < 0) ? -ENODEV : 0; |
| 174 | } |
| 175 | |
| 176 | static int it913x_wr_reg(struct usb_device *udev, u8 pro, u32 reg , u8 data) |
| 177 | { |
| 178 | int ret; |
| 179 | u8 b[1]; |
| 180 | b[0] = data; |
| 181 | ret = it913x_io(udev, WRITE_LONG, pro, |
| 182 | CMD_DEMOD_WRITE, reg, 0, b, sizeof(b)); |
| 183 | |
| 184 | return ret; |
| 185 | } |
| 186 | |
| 187 | static int it913x_read_reg(struct usb_device *udev, u32 reg) |
| 188 | { |
| 189 | int ret; |
| 190 | u8 data[1]; |
| 191 | |
| 192 | ret = it913x_io(udev, READ_LONG, DEV_0, |
| 193 | CMD_DEMOD_READ, reg, 0, &data[0], 1); |
| 194 | |
| 195 | return (ret < 0) ? ret : data[0]; |
| 196 | } |
| 197 | |
| 198 | static u32 it913x_query(struct usb_device *udev, u8 pro) |
| 199 | { |
| 200 | int ret; |
Malcolm Priestley | f6d8735 | 2011-07-25 15:35:03 -0300 | [diff] [blame] | 201 | u8 data[4]; |
| 202 | ret = it913x_io(udev, READ_LONG, pro, CMD_DEMOD_READ, |
Malcolm Priestley | bc54919 | 2011-10-14 19:54:11 -0300 | [diff] [blame] | 203 | 0x1222, 0, &data[0], 3); |
Malcolm Priestley | f6d8735 | 2011-07-25 15:35:03 -0300 | [diff] [blame] | 204 | |
Malcolm Priestley | bc54919 | 2011-10-14 19:54:11 -0300 | [diff] [blame] | 205 | it913x_config.chip_ver = data[0]; |
| 206 | it913x_config.chip_type = (u16)(data[2] << 8) + data[1]; |
| 207 | |
| 208 | info("Chip Version=%02x Chip Type=%04x", it913x_config.chip_ver, |
| 209 | it913x_config.chip_type); |
| 210 | |
| 211 | ret |= it913x_io(udev, READ_SHORT, pro, |
| 212 | CMD_QUERYINFO, 0, 0x1, &data[0], 4); |
| 213 | |
| 214 | it913x_config.firmware = (data[0] << 24) + (data[1] << 16) + |
| 215 | (data[2] << 8) + data[3]; |
| 216 | |
| 217 | return (ret < 0) ? 0 : it913x_config.firmware; |
Malcolm Priestley | f6d8735 | 2011-07-25 15:35:03 -0300 | [diff] [blame] | 218 | } |
| 219 | |
| 220 | static int it913x_pid_filter_ctrl(struct dvb_usb_adapter *adap, int onoff) |
| 221 | { |
| 222 | int ret = 0; |
| 223 | u8 pro = (adap->id == 0) ? DEV_0_DMOD : DEV_1_DMOD; |
| 224 | |
| 225 | if (mutex_lock_interruptible(&adap->dev->i2c_mutex) < 0) |
| 226 | return -EAGAIN; |
| 227 | deb_info(1, "PID_C (%02x)", onoff); |
| 228 | |
| 229 | if (!onoff) |
| 230 | ret = it913x_wr_reg(adap->dev->udev, pro, PID_RST, 0x1); |
| 231 | |
| 232 | mutex_unlock(&adap->dev->i2c_mutex); |
| 233 | return ret; |
| 234 | } |
| 235 | |
| 236 | static int it913x_pid_filter(struct dvb_usb_adapter *adap, |
| 237 | int index, u16 pid, int onoff) |
| 238 | { |
| 239 | struct usb_device *udev = adap->dev->udev; |
| 240 | int ret = 0; |
| 241 | u8 pro = (adap->id == 0) ? DEV_0_DMOD : DEV_1_DMOD; |
| 242 | |
| 243 | if (pid_filter > 0) |
| 244 | return 0; |
| 245 | |
| 246 | if (mutex_lock_interruptible(&adap->dev->i2c_mutex) < 0) |
| 247 | return -EAGAIN; |
| 248 | deb_info(1, "PID_F (%02x)", onoff); |
| 249 | if (onoff) { |
| 250 | ret = it913x_wr_reg(udev, pro, PID_EN, 0x1); |
| 251 | |
| 252 | ret |= it913x_wr_reg(udev, pro, PID_LSB, (u8)(pid & 0xff)); |
| 253 | |
| 254 | ret |= it913x_wr_reg(udev, pro, PID_MSB, (u8)(pid >> 8)); |
| 255 | |
| 256 | ret |= it913x_wr_reg(udev, pro, PID_INX_EN, (u8)onoff); |
| 257 | |
| 258 | ret |= it913x_wr_reg(udev, pro, PID_INX, (u8)(index & 0x1f)); |
| 259 | |
| 260 | } |
| 261 | |
| 262 | mutex_unlock(&adap->dev->i2c_mutex); |
| 263 | return 0; |
| 264 | } |
| 265 | |
| 266 | |
| 267 | static int it913x_return_status(struct usb_device *udev) |
| 268 | { |
| 269 | u32 firm = 0; |
| 270 | |
| 271 | firm = it913x_query(udev, DEV_0); |
| 272 | if (firm > 0) |
| 273 | info("Firmware Version %d", firm); |
| 274 | |
| 275 | return (firm > 0) ? firm : 0; |
| 276 | } |
| 277 | |
| 278 | static int it913x_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], |
| 279 | int num) |
| 280 | { |
| 281 | struct dvb_usb_device *d = i2c_get_adapdata(adap); |
| 282 | static u8 data[256]; |
| 283 | int ret; |
| 284 | u32 reg; |
| 285 | u8 pro; |
| 286 | if (mutex_lock_interruptible(&d->i2c_mutex) < 0) |
| 287 | return -EAGAIN; |
| 288 | |
| 289 | debug_data_snipet(1, "Message out", msg[0].buf); |
| 290 | deb_info(2, "num of messages %d address %02x", num, msg[0].addr); |
| 291 | |
| 292 | pro = (msg[0].addr & 0x2) ? DEV_0_DMOD : 0x0; |
| 293 | pro |= (msg[0].addr & 0x20) ? DEV_1 : DEV_0; |
| 294 | memcpy(data, msg[0].buf, msg[0].len); |
| 295 | reg = (data[0] << 24) + (data[1] << 16) + |
| 296 | (data[2] << 8) + data[3]; |
| 297 | if (num == 2) { |
| 298 | ret = it913x_io(d->udev, READ_LONG, pro, |
| 299 | CMD_DEMOD_READ, reg, 0, data, msg[1].len); |
| 300 | memcpy(msg[1].buf, data, msg[1].len); |
| 301 | } else |
| 302 | ret = it913x_io(d->udev, WRITE_LONG, pro, CMD_DEMOD_WRITE, |
| 303 | reg, 0, &data[4], msg[0].len - 4); |
| 304 | |
| 305 | mutex_unlock(&d->i2c_mutex); |
| 306 | |
| 307 | return ret; |
| 308 | } |
| 309 | |
| 310 | static u32 it913x_i2c_func(struct i2c_adapter *adapter) |
| 311 | { |
| 312 | return I2C_FUNC_I2C; |
| 313 | } |
| 314 | |
| 315 | static struct i2c_algorithm it913x_i2c_algo = { |
| 316 | .master_xfer = it913x_i2c_xfer, |
| 317 | .functionality = it913x_i2c_func, |
| 318 | }; |
| 319 | |
| 320 | /* Callbacks for DVB USB */ |
tvboxspy | 2ba0f94 | 2011-09-21 18:57:41 -0300 | [diff] [blame] | 321 | #define IT913X_POLL 250 |
| 322 | static int it913x_rc_query(struct dvb_usb_device *d) |
| 323 | { |
| 324 | u8 ibuf[4]; |
| 325 | int ret; |
| 326 | u32 key; |
| 327 | /* Avoid conflict with frontends*/ |
| 328 | if (mutex_lock_interruptible(&d->i2c_mutex) < 0) |
| 329 | return -EAGAIN; |
| 330 | |
| 331 | ret = it913x_io(d->udev, READ_LONG, PRO_LINK, CMD_IR_GET, |
| 332 | 0, 0, &ibuf[0], sizeof(ibuf)); |
| 333 | |
| 334 | if ((ibuf[2] + ibuf[3]) == 0xff) { |
| 335 | key = ibuf[2]; |
Malcolm Priestley | c725ff6 | 2011-11-28 18:22:41 -0300 | [diff] [blame] | 336 | key += ibuf[0] << 16; |
| 337 | key += ibuf[1] << 8; |
| 338 | deb_info(1, "NEC Extended Key =%08x", key); |
tvboxspy | 2ba0f94 | 2011-09-21 18:57:41 -0300 | [diff] [blame] | 339 | if (d->rc_dev != NULL) |
| 340 | rc_keydown(d->rc_dev, key, 0); |
| 341 | } |
Malcolm Priestley | c725ff6 | 2011-11-28 18:22:41 -0300 | [diff] [blame] | 342 | |
tvboxspy | 2ba0f94 | 2011-09-21 18:57:41 -0300 | [diff] [blame] | 343 | mutex_unlock(&d->i2c_mutex); |
| 344 | |
| 345 | return ret; |
| 346 | } |
Malcolm Priestley | 9c1133c | 2011-11-27 17:35:06 -0300 | [diff] [blame] | 347 | |
Malcolm Priestley | 5e642c0 | 2011-11-30 17:16:09 -0300 | [diff] [blame^] | 348 | /* Firmware sets raw */ |
| 349 | const char fw_it9135_v1[] = "dvb-usb-it9135-01.fw"; |
| 350 | const char fw_it9137[] = "dvb-usb-it9137-01.fw"; |
| 351 | |
Malcolm Priestley | 990f49a | 2011-11-28 18:04:21 -0300 | [diff] [blame] | 352 | static int ite_firmware_select(struct usb_device *udev, |
| 353 | struct dvb_usb_device_properties *props) |
| 354 | { |
| 355 | int sw; |
| 356 | /* auto switch */ |
| 357 | if (le16_to_cpu(udev->descriptor.idProduct) == |
| 358 | USB_PID_ITETECH_IT9135) |
| 359 | sw = IT9135_V1_FW; |
Malcolm Priestley | 5e642c0 | 2011-11-30 17:16:09 -0300 | [diff] [blame^] | 360 | else if (le16_to_cpu(udev->descriptor.idProduct) == |
| 361 | USB_PID_ITETECH_IT9135_9005) |
| 362 | sw = IT9135_V1_FW; |
Malcolm Priestley | 990f49a | 2011-11-28 18:04:21 -0300 | [diff] [blame] | 363 | else |
| 364 | sw = IT9137_FW; |
| 365 | |
Malcolm Priestley | 5e642c0 | 2011-11-30 17:16:09 -0300 | [diff] [blame^] | 366 | /* force switch */ |
| 367 | if (dvb_usb_it913x_firmware != IT9135_AUTO) |
| 368 | sw = dvb_usb_it913x_firmware; |
| 369 | |
Malcolm Priestley | 990f49a | 2011-11-28 18:04:21 -0300 | [diff] [blame] | 370 | switch (sw) { |
| 371 | case IT9135_V1_FW: |
Malcolm Priestley | 5e642c0 | 2011-11-30 17:16:09 -0300 | [diff] [blame^] | 372 | it913x_config.firmware_ver = 1; |
Malcolm Priestley | 990f49a | 2011-11-28 18:04:21 -0300 | [diff] [blame] | 373 | it913x_config.adc_x2 = 1; |
Malcolm Priestley | 5e642c0 | 2011-11-30 17:16:09 -0300 | [diff] [blame^] | 374 | props->firmware = fw_it9135_v1; |
Malcolm Priestley | 990f49a | 2011-11-28 18:04:21 -0300 | [diff] [blame] | 375 | break; |
| 376 | case IT9137_FW: |
| 377 | default: |
| 378 | it913x_config.firmware_ver = 0; |
| 379 | it913x_config.adc_x2 = 0; |
Malcolm Priestley | 5e642c0 | 2011-11-30 17:16:09 -0300 | [diff] [blame^] | 380 | props->firmware = fw_it9137; |
Malcolm Priestley | 990f49a | 2011-11-28 18:04:21 -0300 | [diff] [blame] | 381 | } |
| 382 | |
| 383 | return 0; |
| 384 | } |
| 385 | |
Malcolm Priestley | 9c1133c | 2011-11-27 17:35:06 -0300 | [diff] [blame] | 386 | #define TS_MPEG_PKT_SIZE 188 |
| 387 | #define EP_LOW 21 |
| 388 | #define TS_BUFFER_SIZE_PID (EP_LOW*TS_MPEG_PKT_SIZE) |
| 389 | #define EP_HIGH 348 |
| 390 | #define TS_BUFFER_SIZE_MAX (EP_HIGH*TS_MPEG_PKT_SIZE) |
| 391 | |
Malcolm Priestley | f6d8735 | 2011-07-25 15:35:03 -0300 | [diff] [blame] | 392 | static int it913x_identify_state(struct usb_device *udev, |
| 393 | struct dvb_usb_device_properties *props, |
| 394 | struct dvb_usb_device_description **desc, |
| 395 | int *cold) |
| 396 | { |
| 397 | int ret = 0, firm_no; |
Malcolm Priestley | bc54919 | 2011-10-14 19:54:11 -0300 | [diff] [blame] | 398 | u8 reg, remote; |
Malcolm Priestley | f6d8735 | 2011-07-25 15:35:03 -0300 | [diff] [blame] | 399 | |
| 400 | firm_no = it913x_return_status(udev); |
| 401 | |
Malcolm Priestley | bc54919 | 2011-10-14 19:54:11 -0300 | [diff] [blame] | 402 | /* checnk for dual mode */ |
| 403 | it913x_config.dual_mode = it913x_read_reg(udev, 0x49c5); |
| 404 | |
Malcolm Priestley | 3822c7c | 2011-11-06 10:24:30 -0300 | [diff] [blame] | 405 | if (udev->speed != USB_SPEED_HIGH) { |
| 406 | props->adapter[0].fe[0].pid_filter_count = 5; |
| 407 | info("USB 1 low speed mode - connect to USB 2 port"); |
| 408 | if (pid_filter > 0) |
| 409 | pid_filter = 0; |
| 410 | if (it913x_config.dual_mode) { |
| 411 | it913x_config.dual_mode = 0; |
| 412 | info("Dual mode not supported in USB 1"); |
| 413 | } |
| 414 | } else /* For replugging */ |
| 415 | if(props->adapter[0].fe[0].pid_filter_count == 5) |
| 416 | props->adapter[0].fe[0].pid_filter_count = 31; |
| 417 | |
Malcolm Priestley | bc54919 | 2011-10-14 19:54:11 -0300 | [diff] [blame] | 418 | /* TODO different remotes */ |
| 419 | remote = it913x_read_reg(udev, 0x49ac); /* Remote */ |
| 420 | if (remote == 0) |
| 421 | props->rc.core.rc_codes = NULL; |
| 422 | |
| 423 | /* TODO at the moment tuner_id is always assigned to 0x38 */ |
| 424 | it913x_config.tuner_id_0 = it913x_read_reg(udev, 0x49d0); |
| 425 | |
| 426 | info("Dual mode=%x Remote=%x Tuner Type=%x", it913x_config.dual_mode |
| 427 | , remote, it913x_config.tuner_id_0); |
Malcolm Priestley | f6d8735 | 2011-07-25 15:35:03 -0300 | [diff] [blame] | 428 | |
Malcolm Priestley | 9c1133c | 2011-11-27 17:35:06 -0300 | [diff] [blame] | 429 | /* Select Stream Buffer Size */ |
| 430 | if (pid_filter) |
| 431 | props->adapter[0].fe[0].stream.u.bulk.buffersize = |
| 432 | TS_BUFFER_SIZE_MAX; |
| 433 | else |
| 434 | props->adapter[0].fe[0].stream.u.bulk.buffersize = |
| 435 | TS_BUFFER_SIZE_PID; |
| 436 | if (it913x_config.dual_mode) |
| 437 | props->adapter[1].fe[0].stream.u.bulk.buffersize = |
| 438 | props->adapter[0].fe[0].stream.u.bulk.buffersize; |
| 439 | |
Malcolm Priestley | 990f49a | 2011-11-28 18:04:21 -0300 | [diff] [blame] | 440 | ret = ite_firmware_select(udev, props); |
| 441 | |
Malcolm Priestley | f6d8735 | 2011-07-25 15:35:03 -0300 | [diff] [blame] | 442 | if (firm_no > 0) { |
| 443 | *cold = 0; |
| 444 | return 0; |
| 445 | } |
| 446 | |
Malcolm Priestley | bc54919 | 2011-10-14 19:54:11 -0300 | [diff] [blame] | 447 | if (it913x_config.dual_mode) { |
| 448 | it913x_config.tuner_id_1 = it913x_read_reg(udev, 0x49e0); |
Malcolm Priestley | f6d8735 | 2011-07-25 15:35:03 -0300 | [diff] [blame] | 449 | ret = it913x_wr_reg(udev, DEV_0, GPIOH1_EN, 0x1); |
| 450 | ret |= it913x_wr_reg(udev, DEV_0, GPIOH1_ON, 0x1); |
| 451 | ret |= it913x_wr_reg(udev, DEV_0, GPIOH1_O, 0x1); |
Malcolm Priestley | bc54919 | 2011-10-14 19:54:11 -0300 | [diff] [blame] | 452 | msleep(50); |
Malcolm Priestley | f6d8735 | 2011-07-25 15:35:03 -0300 | [diff] [blame] | 453 | ret |= it913x_wr_reg(udev, DEV_0, GPIOH1_O, 0x0); |
| 454 | msleep(50); |
| 455 | reg = it913x_read_reg(udev, GPIOH1_O); |
| 456 | if (reg == 0) { |
| 457 | ret |= it913x_wr_reg(udev, DEV_0, GPIOH1_O, 0x1); |
| 458 | ret |= it913x_return_status(udev); |
| 459 | if (ret != 0) |
| 460 | ret = it913x_wr_reg(udev, DEV_0, |
| 461 | GPIOH1_O, 0x0); |
Malcolm Priestley | b7d425d39 | 2011-10-31 12:02:08 -0300 | [diff] [blame] | 462 | props->num_adapters = 2; |
Malcolm Priestley | f6d8735 | 2011-07-25 15:35:03 -0300 | [diff] [blame] | 463 | } |
| 464 | } else |
| 465 | props->num_adapters = 1; |
| 466 | |
| 467 | reg = it913x_read_reg(udev, IO_MUX_POWER_CLK); |
| 468 | |
Malcolm Priestley | bc54919 | 2011-10-14 19:54:11 -0300 | [diff] [blame] | 469 | if (it913x_config.dual_mode) { |
| 470 | ret |= it913x_wr_reg(udev, DEV_0, 0x4bfb, CHIP2_I2C_ADDR); |
Malcolm Priestley | 990f49a | 2011-11-28 18:04:21 -0300 | [diff] [blame] | 471 | if (it913x_config.firmware_ver == 1) |
| 472 | ret |= it913x_wr_reg(udev, DEV_0, 0xcfff, 0x1); |
| 473 | else |
| 474 | ret |= it913x_wr_reg(udev, DEV_0, CLK_O_EN, 0x1); |
Malcolm Priestley | bc54919 | 2011-10-14 19:54:11 -0300 | [diff] [blame] | 475 | } else { |
| 476 | ret |= it913x_wr_reg(udev, DEV_0, 0x4bfb, 0x0); |
Malcolm Priestley | 990f49a | 2011-11-28 18:04:21 -0300 | [diff] [blame] | 477 | if (it913x_config.firmware_ver == 1) |
| 478 | ret |= it913x_wr_reg(udev, DEV_0, 0xcfff, 0x0); |
| 479 | else |
| 480 | ret |= it913x_wr_reg(udev, DEV_0, CLK_O_EN, 0x0); |
Malcolm Priestley | bc54919 | 2011-10-14 19:54:11 -0300 | [diff] [blame] | 481 | } |
Malcolm Priestley | f6d8735 | 2011-07-25 15:35:03 -0300 | [diff] [blame] | 482 | |
| 483 | *cold = 1; |
| 484 | |
| 485 | return (ret < 0) ? -ENODEV : 0; |
| 486 | } |
| 487 | |
| 488 | static int it913x_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) |
| 489 | { |
| 490 | int ret = 0; |
| 491 | u8 pro = (adap->id == 0) ? DEV_0_DMOD : DEV_1_DMOD; |
| 492 | |
| 493 | if (mutex_lock_interruptible(&adap->dev->i2c_mutex) < 0) |
| 494 | return -EAGAIN; |
| 495 | deb_info(1, "STM (%02x)", onoff); |
| 496 | |
| 497 | if (!onoff) |
| 498 | ret = it913x_wr_reg(adap->dev->udev, pro, PID_RST, 0x1); |
| 499 | |
| 500 | |
| 501 | mutex_unlock(&adap->dev->i2c_mutex); |
| 502 | |
| 503 | return ret; |
| 504 | } |
| 505 | |
Malcolm Priestley | f6d8735 | 2011-07-25 15:35:03 -0300 | [diff] [blame] | 506 | static int it913x_download_firmware(struct usb_device *udev, |
| 507 | const struct firmware *fw) |
| 508 | { |
Malcolm Priestley | b699029 | 2011-11-30 17:14:47 -0300 | [diff] [blame] | 509 | int ret = 0, i = 0, pos = 0; |
| 510 | u8 packet_size; |
Malcolm Priestley | f6d8735 | 2011-07-25 15:35:03 -0300 | [diff] [blame] | 511 | u8 *fw_data; |
| 512 | |
Malcolm Priestley | f6d8735 | 2011-07-25 15:35:03 -0300 | [diff] [blame] | 513 | ret = it913x_wr_reg(udev, DEV_0, I2C_CLK, I2C_CLK_100); |
| 514 | |
| 515 | info("FRM Starting Firmware Download"); |
Malcolm Priestley | f6d8735 | 2011-07-25 15:35:03 -0300 | [diff] [blame] | 516 | |
Malcolm Priestley | b699029 | 2011-11-30 17:14:47 -0300 | [diff] [blame] | 517 | /* Multi firmware loader */ |
| 518 | /* This uses scatter write firmware headers */ |
| 519 | /* The firmware must start with 03 XX 00 */ |
| 520 | /* and be the extact firmware length */ |
| 521 | |
| 522 | while (i <= fw->size) { |
| 523 | if (((fw->data[i] == 0x3) && (fw->data[i + 2] == 0x0)) |
| 524 | || (i == fw->size)) { |
| 525 | packet_size = i - pos; |
| 526 | if ((packet_size > 0x19) || (i == fw->size)) { |
| 527 | fw_data = (u8 *)(fw->data + pos); |
| 528 | pos += packet_size; |
| 529 | if (packet_size > 0) |
| 530 | ret |= it913x_io(udev, WRITE_DATA, |
| 531 | DEV_0, CMD_SCATTER_WRITE, 0, |
| 532 | 0, fw_data, packet_size); |
| 533 | udelay(1000); |
| 534 | } |
| 535 | } |
| 536 | i++; |
Malcolm Priestley | f6d8735 | 2011-07-25 15:35:03 -0300 | [diff] [blame] | 537 | } |
| 538 | |
Malcolm Priestley | b699029 | 2011-11-30 17:14:47 -0300 | [diff] [blame] | 539 | ret |= it913x_io(udev, WRITE_CMD, DEV_0, CMD_BOOT, 0, 0, NULL, 0); |
Malcolm Priestley | f6d8735 | 2011-07-25 15:35:03 -0300 | [diff] [blame] | 540 | |
| 541 | msleep(100); |
| 542 | |
| 543 | if (ret < 0) |
| 544 | info("FRM Firmware Download Failed (%04x)" , ret); |
| 545 | else |
| 546 | info("FRM Firmware Download Completed - Resetting Device"); |
| 547 | |
| 548 | ret |= it913x_return_status(udev); |
| 549 | |
| 550 | msleep(30); |
| 551 | |
| 552 | ret |= it913x_wr_reg(udev, DEV_0, I2C_CLK, I2C_CLK_400); |
| 553 | |
| 554 | /* Tuner function */ |
Malcolm Priestley | bc54919 | 2011-10-14 19:54:11 -0300 | [diff] [blame] | 555 | if (it913x_config.dual_mode) |
| 556 | ret |= it913x_wr_reg(udev, DEV_0_DMOD , 0xec4c, 0xa0); |
Malcolm Priestley | b7d425d39 | 2011-10-31 12:02:08 -0300 | [diff] [blame] | 557 | else |
| 558 | ret |= it913x_wr_reg(udev, DEV_0_DMOD , 0xec4c, 0x68); |
Malcolm Priestley | f6d8735 | 2011-07-25 15:35:03 -0300 | [diff] [blame] | 559 | |
Malcolm Priestley | b7d425d39 | 2011-10-31 12:02:08 -0300 | [diff] [blame] | 560 | if ((it913x_config.chip_ver == 1) && |
| 561 | (it913x_config.chip_type == 0x9135)) { |
| 562 | ret |= it913x_wr_reg(udev, DEV_0, PADODPU, 0x0); |
| 563 | ret |= it913x_wr_reg(udev, DEV_0, AGC_O_D, 0x0); |
| 564 | if (it913x_config.dual_mode) { |
| 565 | ret |= it913x_wr_reg(udev, DEV_1, PADODPU, 0x0); |
| 566 | ret |= it913x_wr_reg(udev, DEV_1, AGC_O_D, 0x0); |
| 567 | } |
Malcolm Priestley | f6d8735 | 2011-07-25 15:35:03 -0300 | [diff] [blame] | 568 | } |
| 569 | |
| 570 | return (ret < 0) ? -ENODEV : 0; |
| 571 | } |
| 572 | |
| 573 | static int it913x_name(struct dvb_usb_adapter *adap) |
| 574 | { |
| 575 | const char *desc = adap->dev->desc->name; |
| 576 | char *fe_name[] = {"_1", "_2", "_3", "_4"}; |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 577 | char *name = adap->fe_adap[0].fe->ops.info.name; |
Malcolm Priestley | f6d8735 | 2011-07-25 15:35:03 -0300 | [diff] [blame] | 578 | |
| 579 | strlcpy(name, desc, 128); |
| 580 | strlcat(name, fe_name[adap->id], 128); |
| 581 | |
| 582 | return 0; |
| 583 | } |
| 584 | |
| 585 | static int it913x_frontend_attach(struct dvb_usb_adapter *adap) |
| 586 | { |
| 587 | struct usb_device *udev = adap->dev->udev; |
| 588 | int ret = 0; |
Malcolm Priestley | f6d8735 | 2011-07-25 15:35:03 -0300 | [diff] [blame] | 589 | u8 adap_addr = I2C_BASE_ADDR + (adap->id << 5); |
Malcolm Priestley | 9c1133c | 2011-11-27 17:35:06 -0300 | [diff] [blame] | 590 | u16 ep_size = adap->props.fe[0].stream.u.bulk.buffersize / 4; |
Malcolm Priestley | 3822c7c | 2011-11-06 10:24:30 -0300 | [diff] [blame] | 591 | u8 pkt_size = 0x80; |
| 592 | |
| 593 | if (adap->dev->udev->speed != USB_SPEED_HIGH) |
| 594 | pkt_size = 0x10; |
Malcolm Priestley | bc54919 | 2011-10-14 19:54:11 -0300 | [diff] [blame] | 595 | |
Malcolm Priestley | b7d425d39 | 2011-10-31 12:02:08 -0300 | [diff] [blame] | 596 | it913x_config.adf = it913x_read_reg(udev, IO_MUX_POWER_CLK); |
Malcolm Priestley | f6d8735 | 2011-07-25 15:35:03 -0300 | [diff] [blame] | 597 | |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 598 | adap->fe_adap[0].fe = dvb_attach(it913x_fe_attach, |
Malcolm Priestley | b7d425d39 | 2011-10-31 12:02:08 -0300 | [diff] [blame] | 599 | &adap->dev->i2c_adap, adap_addr, &it913x_config); |
Malcolm Priestley | f6d8735 | 2011-07-25 15:35:03 -0300 | [diff] [blame] | 600 | |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 601 | if (adap->id == 0 && adap->fe_adap[0].fe) { |
Malcolm Priestley | f6d8735 | 2011-07-25 15:35:03 -0300 | [diff] [blame] | 602 | ret = it913x_wr_reg(udev, DEV_0_DMOD, MP2_SW_RST, 0x1); |
| 603 | ret = it913x_wr_reg(udev, DEV_0_DMOD, MP2IF2_SW_RST, 0x1); |
| 604 | ret = it913x_wr_reg(udev, DEV_0, EP0_TX_EN, 0x0f); |
| 605 | ret = it913x_wr_reg(udev, DEV_0, EP0_TX_NAK, 0x1b); |
| 606 | ret = it913x_wr_reg(udev, DEV_0, EP0_TX_EN, 0x2f); |
| 607 | ret = it913x_wr_reg(udev, DEV_0, EP4_TX_LEN_LSB, |
| 608 | ep_size & 0xff); |
| 609 | ret = it913x_wr_reg(udev, DEV_0, EP4_TX_LEN_MSB, ep_size >> 8); |
Malcolm Priestley | 3822c7c | 2011-11-06 10:24:30 -0300 | [diff] [blame] | 610 | ret = it913x_wr_reg(udev, DEV_0, EP4_MAX_PKT, pkt_size); |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 611 | } else if (adap->id == 1 && adap->fe_adap[0].fe) { |
Malcolm Priestley | f6d8735 | 2011-07-25 15:35:03 -0300 | [diff] [blame] | 612 | ret = it913x_wr_reg(udev, DEV_0, EP0_TX_EN, 0x6f); |
| 613 | ret = it913x_wr_reg(udev, DEV_0, EP5_TX_LEN_LSB, |
| 614 | ep_size & 0xff); |
| 615 | ret = it913x_wr_reg(udev, DEV_0, EP5_TX_LEN_MSB, ep_size >> 8); |
Malcolm Priestley | 3822c7c | 2011-11-06 10:24:30 -0300 | [diff] [blame] | 616 | ret = it913x_wr_reg(udev, DEV_0, EP5_MAX_PKT, pkt_size); |
Malcolm Priestley | f6d8735 | 2011-07-25 15:35:03 -0300 | [diff] [blame] | 617 | ret = it913x_wr_reg(udev, DEV_0_DMOD, MP2IF2_EN, 0x1); |
| 618 | ret = it913x_wr_reg(udev, DEV_1_DMOD, MP2IF_SERIAL, 0x1); |
| 619 | ret = it913x_wr_reg(udev, DEV_1, TOP_HOSTB_SER_MODE, 0x1); |
| 620 | ret = it913x_wr_reg(udev, DEV_0_DMOD, TSIS_ENABLE, 0x1); |
| 621 | ret = it913x_wr_reg(udev, DEV_0_DMOD, MP2_SW_RST, 0x0); |
| 622 | ret = it913x_wr_reg(udev, DEV_0_DMOD, MP2IF2_SW_RST, 0x0); |
| 623 | ret = it913x_wr_reg(udev, DEV_0_DMOD, MP2IF2_HALF_PSB, 0x0); |
| 624 | ret = it913x_wr_reg(udev, DEV_0_DMOD, MP2IF_STOP_EN, 0x1); |
| 625 | ret = it913x_wr_reg(udev, DEV_1_DMOD, MPEG_FULL_SPEED, 0x0); |
| 626 | ret = it913x_wr_reg(udev, DEV_1_DMOD, MP2IF_STOP_EN, 0x0); |
| 627 | } else |
| 628 | return -ENODEV; |
| 629 | |
| 630 | ret = it913x_name(adap); |
| 631 | |
| 632 | return ret; |
| 633 | } |
| 634 | |
| 635 | /* DVB USB Driver */ |
| 636 | static struct dvb_usb_device_properties it913x_properties; |
| 637 | |
| 638 | static int it913x_probe(struct usb_interface *intf, |
| 639 | const struct usb_device_id *id) |
| 640 | { |
| 641 | cmd_counter = 0; |
| 642 | if (0 == dvb_usb_device_init(intf, &it913x_properties, |
| 643 | THIS_MODULE, NULL, adapter_nr)) { |
| 644 | info("DEV registering device driver"); |
| 645 | return 0; |
| 646 | } |
| 647 | |
| 648 | info("DEV it913x Error"); |
| 649 | return -ENODEV; |
| 650 | |
| 651 | } |
| 652 | |
| 653 | static struct usb_device_id it913x_table[] = { |
| 654 | { USB_DEVICE(USB_VID_KWORLD_2, USB_PID_KWORLD_UB499_2T_T09) }, |
Malcolm Priestley | bc54919 | 2011-10-14 19:54:11 -0300 | [diff] [blame] | 655 | { USB_DEVICE(USB_VID_ITETECH, USB_PID_ITETECH_IT9135) }, |
Malcolm Priestley | fdb5a91 | 2011-11-06 18:30:26 -0300 | [diff] [blame] | 656 | { USB_DEVICE(USB_VID_KWORLD_2, USB_PID_SVEON_STV22_IT9137) }, |
Malcolm Priestley | 5e642c0 | 2011-11-30 17:16:09 -0300 | [diff] [blame^] | 657 | { USB_DEVICE(USB_VID_ITETECH, USB_PID_ITETECH_IT9135_9005) }, |
Malcolm Priestley | f6d8735 | 2011-07-25 15:35:03 -0300 | [diff] [blame] | 658 | {} /* Terminating entry */ |
| 659 | }; |
| 660 | |
| 661 | MODULE_DEVICE_TABLE(usb, it913x_table); |
| 662 | |
| 663 | static struct dvb_usb_device_properties it913x_properties = { |
| 664 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
| 665 | .usb_ctrl = DEVICE_SPECIFIC, |
| 666 | .download_firmware = it913x_download_firmware, |
| 667 | .firmware = "dvb-usb-it9137-01.fw", |
| 668 | .no_reconnect = 1, |
| 669 | .size_of_priv = sizeof(struct it913x_state), |
| 670 | .num_adapters = 2, |
| 671 | .adapter = { |
| 672 | { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 673 | .num_frontends = 1, |
| 674 | .fe = {{ |
Malcolm Priestley | f6d8735 | 2011-07-25 15:35:03 -0300 | [diff] [blame] | 675 | .caps = DVB_USB_ADAP_HAS_PID_FILTER| |
| 676 | DVB_USB_ADAP_NEED_PID_FILTERING| |
| 677 | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, |
| 678 | .streaming_ctrl = it913x_streaming_ctrl, |
| 679 | .pid_filter_count = 31, |
| 680 | .pid_filter = it913x_pid_filter, |
| 681 | .pid_filter_ctrl = it913x_pid_filter_ctrl, |
| 682 | .frontend_attach = it913x_frontend_attach, |
| 683 | /* parameter for the MPEG2-data transfer */ |
| 684 | .stream = { |
| 685 | .type = USB_BULK, |
| 686 | .count = 10, |
| 687 | .endpoint = 0x04, |
| 688 | .u = {/* Keep Low if PID filter on */ |
| 689 | .bulk = { |
Malcolm Priestley | 9c1133c | 2011-11-27 17:35:06 -0300 | [diff] [blame] | 690 | .buffersize = |
| 691 | TS_BUFFER_SIZE_PID, |
Malcolm Priestley | f6d8735 | 2011-07-25 15:35:03 -0300 | [diff] [blame] | 692 | } |
| 693 | } |
| 694 | } |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 695 | }}, |
Malcolm Priestley | f6d8735 | 2011-07-25 15:35:03 -0300 | [diff] [blame] | 696 | }, |
| 697 | { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 698 | .num_frontends = 1, |
| 699 | .fe = {{ |
Malcolm Priestley | f6d8735 | 2011-07-25 15:35:03 -0300 | [diff] [blame] | 700 | .caps = DVB_USB_ADAP_HAS_PID_FILTER| |
| 701 | DVB_USB_ADAP_NEED_PID_FILTERING| |
| 702 | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, |
| 703 | .streaming_ctrl = it913x_streaming_ctrl, |
| 704 | .pid_filter_count = 31, |
| 705 | .pid_filter = it913x_pid_filter, |
| 706 | .pid_filter_ctrl = it913x_pid_filter_ctrl, |
| 707 | .frontend_attach = it913x_frontend_attach, |
| 708 | /* parameter for the MPEG2-data transfer */ |
| 709 | .stream = { |
| 710 | .type = USB_BULK, |
| 711 | .count = 5, |
| 712 | .endpoint = 0x05, |
| 713 | .u = { |
| 714 | .bulk = { |
Malcolm Priestley | 9c1133c | 2011-11-27 17:35:06 -0300 | [diff] [blame] | 715 | .buffersize = |
| 716 | TS_BUFFER_SIZE_PID, |
Malcolm Priestley | f6d8735 | 2011-07-25 15:35:03 -0300 | [diff] [blame] | 717 | } |
| 718 | } |
| 719 | } |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 720 | }}, |
Malcolm Priestley | f6d8735 | 2011-07-25 15:35:03 -0300 | [diff] [blame] | 721 | } |
| 722 | }, |
| 723 | .identify_state = it913x_identify_state, |
tvboxspy | 2ba0f94 | 2011-09-21 18:57:41 -0300 | [diff] [blame] | 724 | .rc.core = { |
| 725 | .protocol = RC_TYPE_NEC, |
| 726 | .module_name = "it913x", |
| 727 | .rc_query = it913x_rc_query, |
| 728 | .rc_interval = IT913X_POLL, |
| 729 | .allowed_protos = RC_TYPE_NEC, |
Malcolm Priestley | c725ff6 | 2011-11-28 18:22:41 -0300 | [diff] [blame] | 730 | .rc_codes = RC_MAP_MSI_DIGIVOX_III, |
tvboxspy | 2ba0f94 | 2011-09-21 18:57:41 -0300 | [diff] [blame] | 731 | }, |
Malcolm Priestley | f6d8735 | 2011-07-25 15:35:03 -0300 | [diff] [blame] | 732 | .i2c_algo = &it913x_i2c_algo, |
Malcolm Priestley | fdb5a91 | 2011-11-06 18:30:26 -0300 | [diff] [blame] | 733 | .num_device_descs = 3, |
Malcolm Priestley | f6d8735 | 2011-07-25 15:35:03 -0300 | [diff] [blame] | 734 | .devices = { |
| 735 | { "Kworld UB499-2T T09(IT9137)", |
| 736 | { &it913x_table[0], NULL }, |
| 737 | }, |
Malcolm Priestley | bc54919 | 2011-10-14 19:54:11 -0300 | [diff] [blame] | 738 | { "ITE 9135 Generic", |
| 739 | { &it913x_table[1], NULL }, |
| 740 | }, |
Malcolm Priestley | fdb5a91 | 2011-11-06 18:30:26 -0300 | [diff] [blame] | 741 | { "Sveon STV22 Dual DVB-T HDTV(IT9137)", |
| 742 | { &it913x_table[2], NULL }, |
| 743 | }, |
Malcolm Priestley | 5e642c0 | 2011-11-30 17:16:09 -0300 | [diff] [blame^] | 744 | { "ITE 9135(9005) Generic", |
| 745 | { &it913x_table[3], NULL }, |
| 746 | }, |
Malcolm Priestley | f6d8735 | 2011-07-25 15:35:03 -0300 | [diff] [blame] | 747 | } |
| 748 | }; |
| 749 | |
| 750 | static struct usb_driver it913x_driver = { |
| 751 | .name = "it913x", |
| 752 | .probe = it913x_probe, |
| 753 | .disconnect = dvb_usb_device_exit, |
| 754 | .id_table = it913x_table, |
| 755 | }; |
| 756 | |
| 757 | /* module stuff */ |
| 758 | static int __init it913x_module_init(void) |
| 759 | { |
| 760 | int result = usb_register(&it913x_driver); |
| 761 | if (result) { |
| 762 | err("usb_register failed. Error number %d", result); |
| 763 | return result; |
| 764 | } |
| 765 | |
| 766 | return 0; |
| 767 | } |
| 768 | |
| 769 | static void __exit it913x_module_exit(void) |
| 770 | { |
| 771 | /* deregister this driver from the USB subsystem */ |
| 772 | usb_deregister(&it913x_driver); |
| 773 | } |
| 774 | |
| 775 | module_init(it913x_module_init); |
| 776 | module_exit(it913x_module_exit); |
| 777 | |
| 778 | MODULE_AUTHOR("Malcolm Priestley <tvboxspy@gmail.com>"); |
| 779 | MODULE_DESCRIPTION("it913x USB 2 Driver"); |
Malcolm Priestley | 5e642c0 | 2011-11-30 17:16:09 -0300 | [diff] [blame^] | 780 | MODULE_VERSION("1.14"); |
Malcolm Priestley | f6d8735 | 2011-07-25 15:35:03 -0300 | [diff] [blame] | 781 | MODULE_LICENSE("GPL"); |