David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame^] | 1 | // SPDX-License-Identifier: GPL-2.0-only |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 2 | /* DVB USB compliant linux driver for MSI Mega Sky 580 DVB-T USB2.0 receiver |
| 3 | * |
| 4 | * Copyright (C) 2006 Aapo Tahkola (aet@rasterburn.org) |
| 5 | * |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 6 | * see Documentation/media/dvb-drivers/dvb-usb.rst for more information |
| 7 | */ |
| 8 | |
| 9 | #include "m920x.h" |
| 10 | |
| 11 | #include "mt352.h" |
| 12 | #include "mt352_priv.h" |
| 13 | #include "qt1010.h" |
| 14 | #include "tda1004x.h" |
| 15 | #include "tda827x.h" |
| 16 | #include "mt2060.h" |
| 17 | |
| 18 | #include <media/tuner.h> |
| 19 | #include "tuner-simple.h" |
| 20 | #include <asm/unaligned.h> |
| 21 | |
| 22 | /* debug */ |
| 23 | static int dvb_usb_m920x_debug; |
| 24 | module_param_named(debug,dvb_usb_m920x_debug, int, 0644); |
| 25 | MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS); |
| 26 | |
| 27 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); |
| 28 | |
| 29 | static int m920x_set_filter(struct dvb_usb_device *d, int type, int idx, int pid); |
| 30 | |
| 31 | static inline int m920x_read(struct usb_device *udev, u8 request, u16 value, |
| 32 | u16 index, void *data, int size) |
| 33 | { |
| 34 | int ret; |
| 35 | |
| 36 | ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), |
| 37 | request, USB_TYPE_VENDOR | USB_DIR_IN, |
| 38 | value, index, data, size, 2000); |
| 39 | if (ret < 0) { |
| 40 | printk(KERN_INFO "m920x_read = error: %d\n", ret); |
| 41 | return ret; |
| 42 | } |
| 43 | |
| 44 | if (ret != size) { |
| 45 | deb("m920x_read = no data\n"); |
| 46 | return -EIO; |
| 47 | } |
| 48 | |
| 49 | return 0; |
| 50 | } |
| 51 | |
| 52 | static inline int m920x_write(struct usb_device *udev, u8 request, |
| 53 | u16 value, u16 index) |
| 54 | { |
| 55 | return usb_control_msg(udev, usb_sndctrlpipe(udev, 0), request, |
| 56 | USB_TYPE_VENDOR | USB_DIR_OUT, value, index, |
| 57 | NULL, 0, 2000); |
| 58 | } |
| 59 | |
| 60 | static inline int m920x_write_seq(struct usb_device *udev, u8 request, |
| 61 | struct m920x_inits *seq) |
| 62 | { |
| 63 | int ret; |
| 64 | do { |
| 65 | ret = m920x_write(udev, request, seq->data, seq->address); |
| 66 | if (ret != 0) |
| 67 | return ret; |
| 68 | |
| 69 | seq++; |
| 70 | } while (seq->address); |
| 71 | |
| 72 | return 0; |
| 73 | } |
| 74 | |
| 75 | static int m920x_init(struct dvb_usb_device *d, struct m920x_inits *rc_seq) |
| 76 | { |
| 77 | int ret, i, epi, flags = 0; |
| 78 | int adap_enabled[M9206_MAX_ADAPTERS] = { 0 }; |
| 79 | |
| 80 | /* Remote controller init. */ |
| 81 | if (d->props.rc.legacy.rc_query || d->props.rc.core.rc_query) { |
| 82 | deb("Initialising remote control\n"); |
| 83 | ret = m920x_write_seq(d->udev, M9206_CORE, rc_seq); |
| 84 | if (ret != 0) { |
| 85 | deb("Initialising remote control failed\n"); |
| 86 | return ret; |
| 87 | } |
| 88 | |
| 89 | deb("Initialising remote control success\n"); |
| 90 | } |
| 91 | |
| 92 | for (i = 0; i < d->props.num_adapters; i++) |
| 93 | flags |= d->adapter[i].props.fe[0].caps; |
| 94 | |
| 95 | /* Some devices(Dposh) might crash if we attempt touch at all. */ |
| 96 | if (flags & DVB_USB_ADAP_HAS_PID_FILTER) { |
| 97 | for (i = 0; i < d->props.num_adapters; i++) { |
| 98 | epi = d->adapter[i].props.fe[0].stream.endpoint - 0x81; |
| 99 | |
| 100 | if (epi < 0 || epi >= M9206_MAX_ADAPTERS) { |
| 101 | printk(KERN_INFO "m920x: Unexpected adapter endpoint!\n"); |
| 102 | return -EINVAL; |
| 103 | } |
| 104 | |
| 105 | adap_enabled[epi] = 1; |
| 106 | } |
| 107 | |
| 108 | for (i = 0; i < M9206_MAX_ADAPTERS; i++) { |
| 109 | if (adap_enabled[i]) |
| 110 | continue; |
| 111 | |
| 112 | if ((ret = m920x_set_filter(d, 0x81 + i, 0, 0x0)) != 0) |
| 113 | return ret; |
| 114 | |
| 115 | if ((ret = m920x_set_filter(d, 0x81 + i, 0, 0x02f5)) != 0) |
| 116 | return ret; |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | return 0; |
| 121 | } |
| 122 | |
| 123 | static int m920x_init_ep(struct usb_interface *intf) |
| 124 | { |
| 125 | struct usb_device *udev = interface_to_usbdev(intf); |
| 126 | struct usb_host_interface *alt; |
| 127 | |
| 128 | if ((alt = usb_altnum_to_altsetting(intf, 1)) == NULL) { |
| 129 | deb("No alt found!\n"); |
| 130 | return -ENODEV; |
| 131 | } |
| 132 | |
| 133 | return usb_set_interface(udev, alt->desc.bInterfaceNumber, |
| 134 | alt->desc.bAlternateSetting); |
| 135 | } |
| 136 | |
| 137 | static inline void m920x_parse_rc_state(struct dvb_usb_device *d, u8 rc_state, |
| 138 | int *state) |
| 139 | { |
| 140 | struct m920x_state *m = d->priv; |
| 141 | |
| 142 | switch (rc_state) { |
| 143 | case 0x80: |
| 144 | *state = REMOTE_NO_KEY_PRESSED; |
| 145 | break; |
| 146 | |
| 147 | case 0x88: /* framing error or "invalid code" */ |
| 148 | case 0x99: |
| 149 | case 0xc0: |
| 150 | case 0xd8: |
| 151 | *state = REMOTE_NO_KEY_PRESSED; |
| 152 | m->rep_count = 0; |
| 153 | break; |
| 154 | |
| 155 | case 0x93: |
| 156 | case 0x92: |
| 157 | case 0x83: /* pinnacle PCTV310e */ |
| 158 | case 0x82: |
| 159 | m->rep_count = 0; |
| 160 | *state = REMOTE_KEY_PRESSED; |
| 161 | break; |
| 162 | |
| 163 | case 0x91: |
| 164 | case 0x81: /* pinnacle PCTV310e */ |
| 165 | /* prevent immediate auto-repeat */ |
| 166 | if (++m->rep_count > 2) |
| 167 | *state = REMOTE_KEY_REPEAT; |
| 168 | else |
| 169 | *state = REMOTE_NO_KEY_PRESSED; |
| 170 | break; |
| 171 | |
| 172 | default: |
| 173 | deb("Unexpected rc state %02x\n", rc_state); |
| 174 | *state = REMOTE_NO_KEY_PRESSED; |
| 175 | break; |
| 176 | } |
| 177 | } |
| 178 | |
| 179 | static int m920x_rc_query(struct dvb_usb_device *d, u32 *event, int *state) |
| 180 | { |
| 181 | int i, ret = 0; |
| 182 | u8 *rc_state; |
| 183 | |
| 184 | rc_state = kmalloc(2, GFP_KERNEL); |
| 185 | if (!rc_state) |
| 186 | return -ENOMEM; |
| 187 | |
| 188 | ret = m920x_read(d->udev, M9206_CORE, 0x0, M9206_RC_STATE, |
| 189 | rc_state, 1); |
| 190 | if (ret != 0) |
| 191 | goto out; |
| 192 | |
| 193 | ret = m920x_read(d->udev, M9206_CORE, 0x0, M9206_RC_KEY, |
| 194 | rc_state + 1, 1); |
| 195 | if (ret != 0) |
| 196 | goto out; |
| 197 | |
| 198 | m920x_parse_rc_state(d, rc_state[0], state); |
| 199 | |
| 200 | for (i = 0; i < d->props.rc.legacy.rc_map_size; i++) |
| 201 | if (rc5_data(&d->props.rc.legacy.rc_map_table[i]) == rc_state[1]) { |
| 202 | *event = d->props.rc.legacy.rc_map_table[i].keycode; |
| 203 | goto out; |
| 204 | } |
| 205 | |
| 206 | if (rc_state[1] != 0) |
| 207 | deb("Unknown rc key %02x\n", rc_state[1]); |
| 208 | |
| 209 | *state = REMOTE_NO_KEY_PRESSED; |
| 210 | |
| 211 | out: |
| 212 | kfree(rc_state); |
| 213 | return ret; |
| 214 | } |
| 215 | |
| 216 | static int m920x_rc_core_query(struct dvb_usb_device *d) |
| 217 | { |
| 218 | int ret = 0; |
| 219 | u8 *rc_state; |
| 220 | int state; |
| 221 | |
| 222 | rc_state = kmalloc(2, GFP_KERNEL); |
| 223 | if (!rc_state) |
| 224 | return -ENOMEM; |
| 225 | |
| 226 | if ((ret = m920x_read(d->udev, M9206_CORE, 0x0, M9206_RC_STATE, &rc_state[0], 1)) != 0) |
| 227 | goto out; |
| 228 | |
| 229 | if ((ret = m920x_read(d->udev, M9206_CORE, 0x0, M9206_RC_KEY, &rc_state[1], 1)) != 0) |
| 230 | goto out; |
| 231 | |
| 232 | deb("state=0x%02x keycode=0x%02x\n", rc_state[0], rc_state[1]); |
| 233 | |
| 234 | m920x_parse_rc_state(d, rc_state[0], &state); |
| 235 | |
| 236 | if (state == REMOTE_NO_KEY_PRESSED) |
| 237 | rc_keyup(d->rc_dev); |
| 238 | else if (state == REMOTE_KEY_REPEAT) |
| 239 | rc_repeat(d->rc_dev); |
| 240 | else |
| 241 | rc_keydown(d->rc_dev, RC_PROTO_UNKNOWN, rc_state[1], 0); |
| 242 | |
| 243 | out: |
| 244 | kfree(rc_state); |
| 245 | return ret; |
| 246 | } |
| 247 | |
| 248 | /* I2C */ |
| 249 | static int m920x_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], int num) |
| 250 | { |
| 251 | struct dvb_usb_device *d = i2c_get_adapdata(adap); |
| 252 | int i, j; |
| 253 | int ret = 0; |
| 254 | |
| 255 | if (mutex_lock_interruptible(&d->i2c_mutex) < 0) |
| 256 | return -EAGAIN; |
| 257 | |
| 258 | for (i = 0; i < num; i++) { |
| 259 | if (msg[i].flags & (I2C_M_NO_RD_ACK | I2C_M_IGNORE_NAK | I2C_M_TEN) || msg[i].len == 0) { |
| 260 | /* For a 0 byte message, I think sending the address |
| 261 | * to index 0x80|0x40 would be the correct thing to |
| 262 | * do. However, zero byte messages are only used for |
| 263 | * probing, and since we don't know how to get the |
| 264 | * slave's ack, we can't probe. */ |
| 265 | ret = -ENOTSUPP; |
| 266 | goto unlock; |
| 267 | } |
| 268 | /* Send START & address/RW bit */ |
| 269 | if (!(msg[i].flags & I2C_M_NOSTART)) { |
| 270 | if ((ret = m920x_write(d->udev, M9206_I2C, |
| 271 | (msg[i].addr << 1) | |
| 272 | (msg[i].flags & I2C_M_RD ? 0x01 : 0), 0x80)) != 0) |
| 273 | goto unlock; |
| 274 | /* Should check for ack here, if we knew how. */ |
| 275 | } |
| 276 | if (msg[i].flags & I2C_M_RD) { |
| 277 | for (j = 0; j < msg[i].len; j++) { |
| 278 | /* Last byte of transaction? |
| 279 | * Send STOP, otherwise send ACK. */ |
| 280 | int stop = (i+1 == num && j+1 == msg[i].len) ? 0x40 : 0x01; |
| 281 | |
| 282 | if ((ret = m920x_read(d->udev, M9206_I2C, 0x0, |
| 283 | 0x20 | stop, |
| 284 | &msg[i].buf[j], 1)) != 0) |
| 285 | goto unlock; |
| 286 | } |
| 287 | } else { |
| 288 | for (j = 0; j < msg[i].len; j++) { |
| 289 | /* Last byte of transaction? Then send STOP. */ |
| 290 | int stop = (i+1 == num && j+1 == msg[i].len) ? 0x40 : 0x00; |
| 291 | |
| 292 | if ((ret = m920x_write(d->udev, M9206_I2C, msg[i].buf[j], stop)) != 0) |
| 293 | goto unlock; |
| 294 | /* Should check for ack here too. */ |
| 295 | } |
| 296 | } |
| 297 | } |
| 298 | ret = num; |
| 299 | |
| 300 | unlock: |
| 301 | mutex_unlock(&d->i2c_mutex); |
| 302 | |
| 303 | return ret; |
| 304 | } |
| 305 | |
| 306 | static u32 m920x_i2c_func(struct i2c_adapter *adapter) |
| 307 | { |
| 308 | return I2C_FUNC_I2C; |
| 309 | } |
| 310 | |
| 311 | static struct i2c_algorithm m920x_i2c_algo = { |
| 312 | .master_xfer = m920x_i2c_xfer, |
| 313 | .functionality = m920x_i2c_func, |
| 314 | }; |
| 315 | |
| 316 | /* pid filter */ |
| 317 | static int m920x_set_filter(struct dvb_usb_device *d, int type, int idx, int pid) |
| 318 | { |
| 319 | int ret = 0; |
| 320 | |
| 321 | if (pid >= 0x8000) |
| 322 | return -EINVAL; |
| 323 | |
| 324 | pid |= 0x8000; |
| 325 | |
| 326 | if ((ret = m920x_write(d->udev, M9206_FILTER, pid, (type << 8) | (idx * 4) )) != 0) |
| 327 | return ret; |
| 328 | |
| 329 | if ((ret = m920x_write(d->udev, M9206_FILTER, 0, (type << 8) | (idx * 4) )) != 0) |
| 330 | return ret; |
| 331 | |
| 332 | return ret; |
| 333 | } |
| 334 | |
| 335 | static int m920x_update_filters(struct dvb_usb_adapter *adap) |
| 336 | { |
| 337 | struct m920x_state *m = adap->dev->priv; |
| 338 | int enabled = m->filtering_enabled[adap->id]; |
| 339 | int i, ret = 0, filter = 0; |
| 340 | int ep = adap->props.fe[0].stream.endpoint; |
| 341 | |
| 342 | for (i = 0; i < M9206_MAX_FILTERS; i++) |
| 343 | if (m->filters[adap->id][i] == 8192) |
| 344 | enabled = 0; |
| 345 | |
| 346 | /* Disable all filters */ |
| 347 | if ((ret = m920x_set_filter(adap->dev, ep, 1, enabled)) != 0) |
| 348 | return ret; |
| 349 | |
| 350 | for (i = 0; i < M9206_MAX_FILTERS; i++) |
| 351 | if ((ret = m920x_set_filter(adap->dev, ep, i + 2, 0)) != 0) |
| 352 | return ret; |
| 353 | |
| 354 | /* Set */ |
| 355 | if (enabled) { |
| 356 | for (i = 0; i < M9206_MAX_FILTERS; i++) { |
| 357 | if (m->filters[adap->id][i] == 0) |
| 358 | continue; |
| 359 | |
| 360 | if ((ret = m920x_set_filter(adap->dev, ep, filter + 2, m->filters[adap->id][i])) != 0) |
| 361 | return ret; |
| 362 | |
| 363 | filter++; |
| 364 | } |
| 365 | } |
| 366 | |
| 367 | return ret; |
| 368 | } |
| 369 | |
| 370 | static int m920x_pid_filter_ctrl(struct dvb_usb_adapter *adap, int onoff) |
| 371 | { |
| 372 | struct m920x_state *m = adap->dev->priv; |
| 373 | |
| 374 | m->filtering_enabled[adap->id] = onoff ? 1 : 0; |
| 375 | |
| 376 | return m920x_update_filters(adap); |
| 377 | } |
| 378 | |
| 379 | static int m920x_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid, int onoff) |
| 380 | { |
| 381 | struct m920x_state *m = adap->dev->priv; |
| 382 | |
| 383 | m->filters[adap->id][index] = onoff ? pid : 0; |
| 384 | |
| 385 | return m920x_update_filters(adap); |
| 386 | } |
| 387 | |
| 388 | static int m920x_firmware_download(struct usb_device *udev, const struct firmware *fw) |
| 389 | { |
| 390 | u16 value, index, size; |
| 391 | u8 *read, *buff; |
| 392 | int i, pass, ret = 0; |
| 393 | |
| 394 | buff = kmalloc(65536, GFP_KERNEL); |
| 395 | if (buff == NULL) |
| 396 | return -ENOMEM; |
| 397 | |
| 398 | read = kmalloc(4, GFP_KERNEL); |
| 399 | if (!read) { |
| 400 | kfree(buff); |
| 401 | return -ENOMEM; |
| 402 | } |
| 403 | |
| 404 | if ((ret = m920x_read(udev, M9206_FILTER, 0x0, 0x8000, read, 4)) != 0) |
| 405 | goto done; |
| 406 | deb("%*ph\n", 4, read); |
| 407 | |
| 408 | if ((ret = m920x_read(udev, M9206_FW, 0x0, 0x0, read, 1)) != 0) |
| 409 | goto done; |
| 410 | deb("%x\n", read[0]); |
| 411 | |
| 412 | for (pass = 0; pass < 2; pass++) { |
| 413 | for (i = 0; i + (sizeof(u16) * 3) < fw->size;) { |
| 414 | value = get_unaligned_le16(fw->data + i); |
| 415 | i += sizeof(u16); |
| 416 | |
| 417 | index = get_unaligned_le16(fw->data + i); |
| 418 | i += sizeof(u16); |
| 419 | |
| 420 | size = get_unaligned_le16(fw->data + i); |
| 421 | i += sizeof(u16); |
| 422 | |
| 423 | if (pass == 1) { |
| 424 | /* Will stall if using fw->data ... */ |
| 425 | memcpy(buff, fw->data + i, size); |
| 426 | |
| 427 | ret = usb_control_msg(udev, usb_sndctrlpipe(udev,0), |
| 428 | M9206_FW, |
| 429 | USB_TYPE_VENDOR | USB_DIR_OUT, |
| 430 | value, index, buff, size, 20); |
| 431 | if (ret != size) { |
| 432 | deb("error while uploading fw!\n"); |
| 433 | ret = -EIO; |
| 434 | goto done; |
| 435 | } |
| 436 | msleep(3); |
| 437 | } |
| 438 | i += size; |
| 439 | } |
| 440 | if (i != fw->size) { |
| 441 | deb("bad firmware file!\n"); |
| 442 | ret = -EINVAL; |
| 443 | goto done; |
| 444 | } |
| 445 | } |
| 446 | |
| 447 | msleep(36); |
| 448 | |
| 449 | /* m920x will disconnect itself from the bus after this. */ |
| 450 | (void) m920x_write(udev, M9206_CORE, 0x01, M9206_FW_GO); |
| 451 | deb("firmware uploaded!\n"); |
| 452 | |
| 453 | done: |
| 454 | kfree(read); |
| 455 | kfree(buff); |
| 456 | |
| 457 | return ret; |
| 458 | } |
| 459 | |
| 460 | /* Callbacks for DVB USB */ |
| 461 | static int m920x_identify_state(struct usb_device *udev, |
| 462 | struct dvb_usb_device_properties *props, |
| 463 | struct dvb_usb_device_description **desc, |
| 464 | int *cold) |
| 465 | { |
| 466 | struct usb_host_interface *alt; |
| 467 | |
| 468 | alt = usb_altnum_to_altsetting(usb_ifnum_to_if(udev, 0), 1); |
| 469 | *cold = (alt == NULL) ? 1 : 0; |
| 470 | |
| 471 | return 0; |
| 472 | } |
| 473 | |
| 474 | /* demod configurations */ |
| 475 | static int m920x_mt352_demod_init(struct dvb_frontend *fe) |
| 476 | { |
| 477 | int ret; |
| 478 | u8 config[] = { CONFIG, 0x3d }; |
| 479 | u8 clock[] = { CLOCK_CTL, 0x30 }; |
| 480 | u8 reset[] = { RESET, 0x80 }; |
| 481 | u8 adc_ctl[] = { ADC_CTL_1, 0x40 }; |
| 482 | u8 agc[] = { AGC_TARGET, 0x1c, 0x20 }; |
| 483 | u8 sec_agc[] = { 0x69, 0x00, 0xff, 0xff, 0x40, 0xff, 0x00, 0x40, 0x40 }; |
| 484 | u8 unk1[] = { 0x93, 0x1a }; |
| 485 | u8 unk2[] = { 0xb5, 0x7a }; |
| 486 | |
| 487 | deb("Demod init!\n"); |
| 488 | |
| 489 | if ((ret = mt352_write(fe, config, ARRAY_SIZE(config))) != 0) |
| 490 | return ret; |
| 491 | if ((ret = mt352_write(fe, clock, ARRAY_SIZE(clock))) != 0) |
| 492 | return ret; |
| 493 | if ((ret = mt352_write(fe, reset, ARRAY_SIZE(reset))) != 0) |
| 494 | return ret; |
| 495 | if ((ret = mt352_write(fe, adc_ctl, ARRAY_SIZE(adc_ctl))) != 0) |
| 496 | return ret; |
| 497 | if ((ret = mt352_write(fe, agc, ARRAY_SIZE(agc))) != 0) |
| 498 | return ret; |
| 499 | if ((ret = mt352_write(fe, sec_agc, ARRAY_SIZE(sec_agc))) != 0) |
| 500 | return ret; |
| 501 | if ((ret = mt352_write(fe, unk1, ARRAY_SIZE(unk1))) != 0) |
| 502 | return ret; |
| 503 | if ((ret = mt352_write(fe, unk2, ARRAY_SIZE(unk2))) != 0) |
| 504 | return ret; |
| 505 | |
| 506 | return 0; |
| 507 | } |
| 508 | |
| 509 | static struct mt352_config m920x_mt352_config = { |
| 510 | .demod_address = 0x0f, |
| 511 | .no_tuner = 1, |
| 512 | .demod_init = m920x_mt352_demod_init, |
| 513 | }; |
| 514 | |
| 515 | static struct tda1004x_config m920x_tda10046_08_config = { |
| 516 | .demod_address = 0x08, |
| 517 | .invert = 0, |
| 518 | .invert_oclk = 0, |
| 519 | .ts_mode = TDA10046_TS_SERIAL, |
| 520 | .xtal_freq = TDA10046_XTAL_16M, |
| 521 | .if_freq = TDA10046_FREQ_045, |
| 522 | .agc_config = TDA10046_AGC_TDA827X, |
| 523 | .gpio_config = TDA10046_GPTRI, |
| 524 | .request_firmware = NULL, |
| 525 | }; |
| 526 | |
| 527 | static struct tda1004x_config m920x_tda10046_0b_config = { |
| 528 | .demod_address = 0x0b, |
| 529 | .invert = 0, |
| 530 | .invert_oclk = 0, |
| 531 | .ts_mode = TDA10046_TS_SERIAL, |
| 532 | .xtal_freq = TDA10046_XTAL_16M, |
| 533 | .if_freq = TDA10046_FREQ_045, |
| 534 | .agc_config = TDA10046_AGC_TDA827X, |
| 535 | .gpio_config = TDA10046_GPTRI, |
| 536 | .request_firmware = NULL, /* uses firmware EEPROM */ |
| 537 | }; |
| 538 | |
| 539 | /* tuner configurations */ |
| 540 | static struct qt1010_config m920x_qt1010_config = { |
| 541 | .i2c_address = 0x62 |
| 542 | }; |
| 543 | |
| 544 | static struct mt2060_config m920x_mt2060_config = { |
| 545 | .i2c_address = 0x60, /* 0xc0 */ |
| 546 | .clock_out = 0, |
| 547 | }; |
| 548 | |
| 549 | |
| 550 | /* Callbacks for DVB USB */ |
| 551 | static int m920x_mt352_frontend_attach(struct dvb_usb_adapter *adap) |
| 552 | { |
| 553 | deb("%s\n",__func__); |
| 554 | |
| 555 | adap->fe_adap[0].fe = dvb_attach(mt352_attach, |
| 556 | &m920x_mt352_config, |
| 557 | &adap->dev->i2c_adap); |
| 558 | if ((adap->fe_adap[0].fe) == NULL) |
| 559 | return -EIO; |
| 560 | |
| 561 | return 0; |
| 562 | } |
| 563 | |
| 564 | static int m920x_mt352_frontend_attach_vp7049(struct dvb_usb_adapter *adap) |
| 565 | { |
| 566 | struct m920x_inits vp7049_fe_init_seq[] = { |
| 567 | /* XXX without these commands the frontend cannot be detected, |
| 568 | * they must be sent BEFORE the frontend is attached */ |
| 569 | { 0xff28, 0x00 }, |
| 570 | { 0xff23, 0x00 }, |
| 571 | { 0xff28, 0x00 }, |
| 572 | { 0xff23, 0x00 }, |
| 573 | { 0xff21, 0x20 }, |
| 574 | { 0xff21, 0x60 }, |
| 575 | { 0xff28, 0x00 }, |
| 576 | { 0xff22, 0x00 }, |
| 577 | { 0xff20, 0x30 }, |
| 578 | { 0xff20, 0x20 }, |
| 579 | { 0xff20, 0x30 }, |
| 580 | { } /* terminating entry */ |
| 581 | }; |
| 582 | int ret; |
| 583 | |
| 584 | deb("%s\n", __func__); |
| 585 | |
| 586 | ret = m920x_write_seq(adap->dev->udev, M9206_CORE, vp7049_fe_init_seq); |
| 587 | if (ret != 0) { |
| 588 | deb("Initialization of vp7049 frontend failed."); |
| 589 | return ret; |
| 590 | } |
| 591 | |
| 592 | return m920x_mt352_frontend_attach(adap); |
| 593 | } |
| 594 | |
| 595 | static int m920x_tda10046_08_frontend_attach(struct dvb_usb_adapter *adap) |
| 596 | { |
| 597 | deb("%s\n",__func__); |
| 598 | |
| 599 | adap->fe_adap[0].fe = dvb_attach(tda10046_attach, |
| 600 | &m920x_tda10046_08_config, |
| 601 | &adap->dev->i2c_adap); |
| 602 | if ((adap->fe_adap[0].fe) == NULL) |
| 603 | return -EIO; |
| 604 | |
| 605 | return 0; |
| 606 | } |
| 607 | |
| 608 | static int m920x_tda10046_0b_frontend_attach(struct dvb_usb_adapter *adap) |
| 609 | { |
| 610 | deb("%s\n",__func__); |
| 611 | |
| 612 | adap->fe_adap[0].fe = dvb_attach(tda10046_attach, |
| 613 | &m920x_tda10046_0b_config, |
| 614 | &adap->dev->i2c_adap); |
| 615 | if ((adap->fe_adap[0].fe) == NULL) |
| 616 | return -EIO; |
| 617 | |
| 618 | return 0; |
| 619 | } |
| 620 | |
| 621 | static int m920x_qt1010_tuner_attach(struct dvb_usb_adapter *adap) |
| 622 | { |
| 623 | deb("%s\n",__func__); |
| 624 | |
| 625 | if (dvb_attach(qt1010_attach, adap->fe_adap[0].fe, &adap->dev->i2c_adap, &m920x_qt1010_config) == NULL) |
| 626 | return -ENODEV; |
| 627 | |
| 628 | return 0; |
| 629 | } |
| 630 | |
| 631 | static int m920x_tda8275_60_tuner_attach(struct dvb_usb_adapter *adap) |
| 632 | { |
| 633 | deb("%s\n",__func__); |
| 634 | |
| 635 | if (dvb_attach(tda827x_attach, adap->fe_adap[0].fe, 0x60, &adap->dev->i2c_adap, NULL) == NULL) |
| 636 | return -ENODEV; |
| 637 | |
| 638 | return 0; |
| 639 | } |
| 640 | |
| 641 | static int m920x_tda8275_61_tuner_attach(struct dvb_usb_adapter *adap) |
| 642 | { |
| 643 | deb("%s\n",__func__); |
| 644 | |
| 645 | if (dvb_attach(tda827x_attach, adap->fe_adap[0].fe, 0x61, &adap->dev->i2c_adap, NULL) == NULL) |
| 646 | return -ENODEV; |
| 647 | |
| 648 | return 0; |
| 649 | } |
| 650 | |
| 651 | static int m920x_fmd1216me_tuner_attach(struct dvb_usb_adapter *adap) |
| 652 | { |
| 653 | dvb_attach(simple_tuner_attach, adap->fe_adap[0].fe, |
| 654 | &adap->dev->i2c_adap, 0x61, |
| 655 | TUNER_PHILIPS_FMD1216ME_MK3); |
| 656 | return 0; |
| 657 | } |
| 658 | |
| 659 | static int m920x_mt2060_tuner_attach(struct dvb_usb_adapter *adap) |
| 660 | { |
| 661 | deb("%s\n", __func__); |
| 662 | |
| 663 | if (dvb_attach(mt2060_attach, adap->fe_adap[0].fe, &adap->dev->i2c_adap, |
| 664 | &m920x_mt2060_config, 1220) == NULL) |
| 665 | return -ENODEV; |
| 666 | |
| 667 | return 0; |
| 668 | } |
| 669 | |
| 670 | |
| 671 | /* device-specific initialization */ |
| 672 | static struct m920x_inits megasky_rc_init [] = { |
| 673 | { M9206_RC_INIT2, 0xa8 }, |
| 674 | { M9206_RC_INIT1, 0x51 }, |
| 675 | { } /* terminating entry */ |
| 676 | }; |
| 677 | |
| 678 | static struct m920x_inits tvwalkertwin_rc_init [] = { |
| 679 | { M9206_RC_INIT2, 0x00 }, |
| 680 | { M9206_RC_INIT1, 0xef }, |
| 681 | { 0xff28, 0x00 }, |
| 682 | { 0xff23, 0x00 }, |
| 683 | { 0xff21, 0x30 }, |
| 684 | { } /* terminating entry */ |
| 685 | }; |
| 686 | |
| 687 | static struct m920x_inits pinnacle310e_init[] = { |
| 688 | /* without these the tuner doesn't work */ |
| 689 | { 0xff20, 0x9b }, |
| 690 | { 0xff22, 0x70 }, |
| 691 | |
| 692 | /* rc settings */ |
| 693 | { 0xff50, 0x80 }, |
| 694 | { M9206_RC_INIT1, 0x00 }, |
| 695 | { M9206_RC_INIT2, 0xff }, |
| 696 | { } /* terminating entry */ |
| 697 | }; |
| 698 | |
| 699 | static struct m920x_inits vp7049_rc_init[] = { |
| 700 | { 0xff28, 0x00 }, |
| 701 | { 0xff23, 0x00 }, |
| 702 | { 0xff21, 0x70 }, |
| 703 | { M9206_RC_INIT2, 0x00 }, |
| 704 | { M9206_RC_INIT1, 0xff }, |
| 705 | { } /* terminating entry */ |
| 706 | }; |
| 707 | |
| 708 | /* ir keymaps */ |
| 709 | static struct rc_map_table rc_map_megasky_table[] = { |
| 710 | { 0x0012, KEY_POWER }, |
| 711 | { 0x001e, KEY_CYCLEWINDOWS }, /* min/max */ |
| 712 | { 0x0002, KEY_CHANNELUP }, |
| 713 | { 0x0005, KEY_CHANNELDOWN }, |
| 714 | { 0x0003, KEY_VOLUMEUP }, |
| 715 | { 0x0006, KEY_VOLUMEDOWN }, |
| 716 | { 0x0004, KEY_MUTE }, |
| 717 | { 0x0007, KEY_OK }, /* TS */ |
| 718 | { 0x0008, KEY_STOP }, |
| 719 | { 0x0009, KEY_MENU }, /* swap */ |
| 720 | { 0x000a, KEY_REWIND }, |
| 721 | { 0x001b, KEY_PAUSE }, |
| 722 | { 0x001f, KEY_FASTFORWARD }, |
| 723 | { 0x000c, KEY_RECORD }, |
| 724 | { 0x000d, KEY_CAMERA }, /* screenshot */ |
| 725 | { 0x000e, KEY_COFFEE }, /* "MTS" */ |
| 726 | }; |
| 727 | |
| 728 | static struct rc_map_table rc_map_tvwalkertwin_table[] = { |
| 729 | { 0x0001, KEY_ZOOM }, /* Full Screen */ |
| 730 | { 0x0002, KEY_CAMERA }, /* snapshot */ |
| 731 | { 0x0003, KEY_MUTE }, |
| 732 | { 0x0004, KEY_REWIND }, |
| 733 | { 0x0005, KEY_PLAYPAUSE }, /* Play/Pause */ |
| 734 | { 0x0006, KEY_FASTFORWARD }, |
| 735 | { 0x0007, KEY_RECORD }, |
| 736 | { 0x0008, KEY_STOP }, |
| 737 | { 0x0009, KEY_TIME }, /* Timeshift */ |
| 738 | { 0x000c, KEY_COFFEE }, /* Recall */ |
| 739 | { 0x000e, KEY_CHANNELUP }, |
| 740 | { 0x0012, KEY_POWER }, |
| 741 | { 0x0015, KEY_MENU }, /* source */ |
| 742 | { 0x0018, KEY_CYCLEWINDOWS }, /* TWIN PIP */ |
| 743 | { 0x001a, KEY_CHANNELDOWN }, |
| 744 | { 0x001b, KEY_VOLUMEDOWN }, |
| 745 | { 0x001e, KEY_VOLUMEUP }, |
| 746 | }; |
| 747 | |
| 748 | static struct rc_map_table rc_map_pinnacle310e_table[] = { |
| 749 | { 0x16, KEY_POWER }, |
| 750 | { 0x17, KEY_FAVORITES }, |
| 751 | { 0x0f, KEY_TEXT }, |
| 752 | { 0x48, KEY_PROGRAM }, /* preview */ |
| 753 | { 0x1c, KEY_EPG }, |
| 754 | { 0x04, KEY_LIST }, /* record list */ |
| 755 | { 0x03, KEY_1 }, |
| 756 | { 0x01, KEY_2 }, |
| 757 | { 0x06, KEY_3 }, |
| 758 | { 0x09, KEY_4 }, |
| 759 | { 0x1d, KEY_5 }, |
| 760 | { 0x1f, KEY_6 }, |
| 761 | { 0x0d, KEY_7 }, |
| 762 | { 0x19, KEY_8 }, |
| 763 | { 0x1b, KEY_9 }, |
| 764 | { 0x15, KEY_0 }, |
| 765 | { 0x0c, KEY_CANCEL }, |
| 766 | { 0x4a, KEY_CLEAR }, |
| 767 | { 0x13, KEY_BACK }, |
| 768 | { 0x00, KEY_TAB }, |
| 769 | { 0x4b, KEY_UP }, |
| 770 | { 0x4e, KEY_LEFT }, |
| 771 | { 0x52, KEY_RIGHT }, |
| 772 | { 0x51, KEY_DOWN }, |
| 773 | { 0x4f, KEY_ENTER }, /* could also be KEY_OK */ |
| 774 | { 0x1e, KEY_VOLUMEUP }, |
| 775 | { 0x0a, KEY_VOLUMEDOWN }, |
| 776 | { 0x05, KEY_CHANNELUP }, |
| 777 | { 0x02, KEY_CHANNELDOWN }, |
| 778 | { 0x11, KEY_RECORD }, |
| 779 | { 0x14, KEY_PLAY }, |
| 780 | { 0x4c, KEY_PAUSE }, |
| 781 | { 0x1a, KEY_STOP }, |
| 782 | { 0x40, KEY_REWIND }, |
| 783 | { 0x12, KEY_FASTFORWARD }, |
| 784 | { 0x41, KEY_PREVIOUSSONG }, /* Replay */ |
| 785 | { 0x42, KEY_NEXTSONG }, /* Skip */ |
| 786 | { 0x54, KEY_CAMERA }, /* Capture */ |
| 787 | /* { 0x50, KEY_SAP }, */ /* Sap */ |
| 788 | { 0x47, KEY_CYCLEWINDOWS }, /* Pip */ |
| 789 | { 0x4d, KEY_SCREEN }, /* FullScreen */ |
| 790 | { 0x08, KEY_SUBTITLE }, |
| 791 | { 0x0e, KEY_MUTE }, |
| 792 | /* { 0x49, KEY_LR }, */ /* L/R */ |
| 793 | { 0x07, KEY_SLEEP }, /* Hibernate */ |
| 794 | { 0x08, KEY_VIDEO }, /* A/V */ |
| 795 | { 0x0e, KEY_MENU }, /* Recall */ |
| 796 | { 0x45, KEY_ZOOMIN }, |
| 797 | { 0x46, KEY_ZOOMOUT }, |
| 798 | { 0x18, KEY_RED }, /* Red */ |
| 799 | { 0x53, KEY_GREEN }, /* Green */ |
| 800 | { 0x5e, KEY_YELLOW }, /* Yellow */ |
| 801 | { 0x5f, KEY_BLUE }, /* Blue */ |
| 802 | }; |
| 803 | |
| 804 | /* DVB USB Driver stuff */ |
| 805 | static struct dvb_usb_device_properties megasky_properties; |
| 806 | static struct dvb_usb_device_properties digivox_mini_ii_properties; |
| 807 | static struct dvb_usb_device_properties tvwalkertwin_properties; |
| 808 | static struct dvb_usb_device_properties dposh_properties; |
| 809 | static struct dvb_usb_device_properties pinnacle_pctv310e_properties; |
| 810 | static struct dvb_usb_device_properties vp7049_properties; |
| 811 | |
| 812 | static int m920x_probe(struct usb_interface *intf, |
| 813 | const struct usb_device_id *id) |
| 814 | { |
| 815 | struct dvb_usb_device *d = NULL; |
| 816 | int ret; |
| 817 | struct m920x_inits *rc_init_seq = NULL; |
| 818 | int bInterfaceNumber = intf->cur_altsetting->desc.bInterfaceNumber; |
| 819 | |
| 820 | deb("Probing for m920x device at interface %d\n", bInterfaceNumber); |
| 821 | |
| 822 | if (bInterfaceNumber == 0) { |
| 823 | /* Single-tuner device, or first interface on |
| 824 | * multi-tuner device |
| 825 | */ |
| 826 | |
| 827 | ret = dvb_usb_device_init(intf, &megasky_properties, |
| 828 | THIS_MODULE, &d, adapter_nr); |
| 829 | if (ret == 0) { |
| 830 | rc_init_seq = megasky_rc_init; |
| 831 | goto found; |
| 832 | } |
| 833 | |
| 834 | ret = dvb_usb_device_init(intf, &digivox_mini_ii_properties, |
| 835 | THIS_MODULE, &d, adapter_nr); |
| 836 | if (ret == 0) { |
| 837 | /* No remote control, so no rc_init_seq */ |
| 838 | goto found; |
| 839 | } |
| 840 | |
| 841 | /* This configures both tuners on the TV Walker Twin */ |
| 842 | ret = dvb_usb_device_init(intf, &tvwalkertwin_properties, |
| 843 | THIS_MODULE, &d, adapter_nr); |
| 844 | if (ret == 0) { |
| 845 | rc_init_seq = tvwalkertwin_rc_init; |
| 846 | goto found; |
| 847 | } |
| 848 | |
| 849 | ret = dvb_usb_device_init(intf, &dposh_properties, |
| 850 | THIS_MODULE, &d, adapter_nr); |
| 851 | if (ret == 0) { |
| 852 | /* Remote controller not supported yet. */ |
| 853 | goto found; |
| 854 | } |
| 855 | |
| 856 | ret = dvb_usb_device_init(intf, &pinnacle_pctv310e_properties, |
| 857 | THIS_MODULE, &d, adapter_nr); |
| 858 | if (ret == 0) { |
| 859 | rc_init_seq = pinnacle310e_init; |
| 860 | goto found; |
| 861 | } |
| 862 | |
| 863 | ret = dvb_usb_device_init(intf, &vp7049_properties, |
| 864 | THIS_MODULE, &d, adapter_nr); |
| 865 | if (ret == 0) { |
| 866 | rc_init_seq = vp7049_rc_init; |
| 867 | goto found; |
| 868 | } |
| 869 | |
| 870 | return ret; |
| 871 | } else { |
| 872 | /* Another interface on a multi-tuner device */ |
| 873 | |
| 874 | /* The LifeView TV Walker Twin gets here, but struct |
| 875 | * tvwalkertwin_properties already configured both |
| 876 | * tuners, so there is nothing for us to do here |
| 877 | */ |
| 878 | } |
| 879 | |
| 880 | found: |
| 881 | if ((ret = m920x_init_ep(intf)) < 0) |
| 882 | return ret; |
| 883 | |
| 884 | if (d && (ret = m920x_init(d, rc_init_seq)) != 0) |
| 885 | return ret; |
| 886 | |
| 887 | return ret; |
| 888 | } |
| 889 | |
| 890 | static struct usb_device_id m920x_table [] = { |
| 891 | { USB_DEVICE(USB_VID_MSI, USB_PID_MSI_MEGASKY580) }, |
| 892 | { USB_DEVICE(USB_VID_ANUBIS_ELECTRONIC, |
| 893 | USB_PID_MSI_DIGI_VOX_MINI_II) }, |
| 894 | { USB_DEVICE(USB_VID_ANUBIS_ELECTRONIC, |
| 895 | USB_PID_LIFEVIEW_TV_WALKER_TWIN_COLD) }, |
| 896 | { USB_DEVICE(USB_VID_ANUBIS_ELECTRONIC, |
| 897 | USB_PID_LIFEVIEW_TV_WALKER_TWIN_WARM) }, |
| 898 | { USB_DEVICE(USB_VID_DPOSH, USB_PID_DPOSH_M9206_COLD) }, |
| 899 | { USB_DEVICE(USB_VID_DPOSH, USB_PID_DPOSH_M9206_WARM) }, |
| 900 | { USB_DEVICE(USB_VID_VISIONPLUS, USB_PID_PINNACLE_PCTV310E) }, |
| 901 | { USB_DEVICE(USB_VID_AZUREWAVE, USB_PID_TWINHAN_VP7049) }, |
| 902 | { } /* Terminating entry */ |
| 903 | }; |
| 904 | MODULE_DEVICE_TABLE (usb, m920x_table); |
| 905 | |
| 906 | static struct dvb_usb_device_properties megasky_properties = { |
| 907 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
| 908 | |
| 909 | .usb_ctrl = DEVICE_SPECIFIC, |
| 910 | .firmware = "dvb-usb-megasky-02.fw", |
| 911 | .download_firmware = m920x_firmware_download, |
| 912 | |
| 913 | .rc.legacy = { |
| 914 | .rc_interval = 100, |
| 915 | .rc_map_table = rc_map_megasky_table, |
| 916 | .rc_map_size = ARRAY_SIZE(rc_map_megasky_table), |
| 917 | .rc_query = m920x_rc_query, |
| 918 | }, |
| 919 | |
| 920 | .size_of_priv = sizeof(struct m920x_state), |
| 921 | |
| 922 | .identify_state = m920x_identify_state, |
| 923 | .num_adapters = 1, |
| 924 | .adapter = {{ |
| 925 | .num_frontends = 1, |
| 926 | .fe = {{ |
| 927 | |
| 928 | .caps = DVB_USB_ADAP_HAS_PID_FILTER | |
| 929 | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, |
| 930 | |
| 931 | .pid_filter_count = 8, |
| 932 | .pid_filter = m920x_pid_filter, |
| 933 | .pid_filter_ctrl = m920x_pid_filter_ctrl, |
| 934 | |
| 935 | .frontend_attach = m920x_mt352_frontend_attach, |
| 936 | .tuner_attach = m920x_qt1010_tuner_attach, |
| 937 | |
| 938 | .stream = { |
| 939 | .type = USB_BULK, |
| 940 | .count = 8, |
| 941 | .endpoint = 0x81, |
| 942 | .u = { |
| 943 | .bulk = { |
| 944 | .buffersize = 512, |
| 945 | } |
| 946 | } |
| 947 | }, |
| 948 | }}, |
| 949 | }}, |
| 950 | .i2c_algo = &m920x_i2c_algo, |
| 951 | |
| 952 | .num_device_descs = 1, |
| 953 | .devices = { |
| 954 | { "MSI Mega Sky 580 DVB-T USB2.0", |
| 955 | { &m920x_table[0], NULL }, |
| 956 | { NULL }, |
| 957 | } |
| 958 | } |
| 959 | }; |
| 960 | |
| 961 | static struct dvb_usb_device_properties digivox_mini_ii_properties = { |
| 962 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
| 963 | |
| 964 | .usb_ctrl = DEVICE_SPECIFIC, |
| 965 | .firmware = "dvb-usb-digivox-02.fw", |
| 966 | .download_firmware = m920x_firmware_download, |
| 967 | |
| 968 | .size_of_priv = sizeof(struct m920x_state), |
| 969 | |
| 970 | .identify_state = m920x_identify_state, |
| 971 | .num_adapters = 1, |
| 972 | .adapter = {{ |
| 973 | .num_frontends = 1, |
| 974 | .fe = {{ |
| 975 | |
| 976 | .caps = DVB_USB_ADAP_HAS_PID_FILTER | |
| 977 | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, |
| 978 | |
| 979 | .pid_filter_count = 8, |
| 980 | .pid_filter = m920x_pid_filter, |
| 981 | .pid_filter_ctrl = m920x_pid_filter_ctrl, |
| 982 | |
| 983 | .frontend_attach = m920x_tda10046_08_frontend_attach, |
| 984 | .tuner_attach = m920x_tda8275_60_tuner_attach, |
| 985 | |
| 986 | .stream = { |
| 987 | .type = USB_BULK, |
| 988 | .count = 8, |
| 989 | .endpoint = 0x81, |
| 990 | .u = { |
| 991 | .bulk = { |
| 992 | .buffersize = 0x4000, |
| 993 | } |
| 994 | } |
| 995 | }, |
| 996 | }}, |
| 997 | }}, |
| 998 | .i2c_algo = &m920x_i2c_algo, |
| 999 | |
| 1000 | .num_device_descs = 1, |
| 1001 | .devices = { |
| 1002 | { "MSI DIGI VOX mini II DVB-T USB2.0", |
| 1003 | { &m920x_table[1], NULL }, |
| 1004 | { NULL }, |
| 1005 | }, |
| 1006 | } |
| 1007 | }; |
| 1008 | |
| 1009 | /* LifeView TV Walker Twin support by Nick Andrew <nick@nick-andrew.net> |
| 1010 | * |
| 1011 | * LifeView TV Walker Twin has 1 x M9206, 2 x TDA10046, 2 x TDA8275A |
| 1012 | * TDA10046 #0 is located at i2c address 0x08 |
| 1013 | * TDA10046 #1 is located at i2c address 0x0b |
| 1014 | * TDA8275A #0 is located at i2c address 0x60 |
| 1015 | * TDA8275A #1 is located at i2c address 0x61 |
| 1016 | */ |
| 1017 | static struct dvb_usb_device_properties tvwalkertwin_properties = { |
| 1018 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
| 1019 | |
| 1020 | .usb_ctrl = DEVICE_SPECIFIC, |
| 1021 | .firmware = "dvb-usb-tvwalkert.fw", |
| 1022 | .download_firmware = m920x_firmware_download, |
| 1023 | |
| 1024 | .rc.legacy = { |
| 1025 | .rc_interval = 100, |
| 1026 | .rc_map_table = rc_map_tvwalkertwin_table, |
| 1027 | .rc_map_size = ARRAY_SIZE(rc_map_tvwalkertwin_table), |
| 1028 | .rc_query = m920x_rc_query, |
| 1029 | }, |
| 1030 | |
| 1031 | .size_of_priv = sizeof(struct m920x_state), |
| 1032 | |
| 1033 | .identify_state = m920x_identify_state, |
| 1034 | .num_adapters = 2, |
| 1035 | .adapter = {{ |
| 1036 | .num_frontends = 1, |
| 1037 | .fe = {{ |
| 1038 | |
| 1039 | .caps = DVB_USB_ADAP_HAS_PID_FILTER | |
| 1040 | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, |
| 1041 | |
| 1042 | .pid_filter_count = 8, |
| 1043 | .pid_filter = m920x_pid_filter, |
| 1044 | .pid_filter_ctrl = m920x_pid_filter_ctrl, |
| 1045 | |
| 1046 | .frontend_attach = m920x_tda10046_08_frontend_attach, |
| 1047 | .tuner_attach = m920x_tda8275_60_tuner_attach, |
| 1048 | |
| 1049 | .stream = { |
| 1050 | .type = USB_BULK, |
| 1051 | .count = 8, |
| 1052 | .endpoint = 0x81, |
| 1053 | .u = { |
| 1054 | .bulk = { |
| 1055 | .buffersize = 512, |
| 1056 | } |
| 1057 | } |
| 1058 | }}, |
| 1059 | }},{ |
| 1060 | .num_frontends = 1, |
| 1061 | .fe = {{ |
| 1062 | |
| 1063 | .caps = DVB_USB_ADAP_HAS_PID_FILTER | |
| 1064 | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, |
| 1065 | |
| 1066 | .pid_filter_count = 8, |
| 1067 | .pid_filter = m920x_pid_filter, |
| 1068 | .pid_filter_ctrl = m920x_pid_filter_ctrl, |
| 1069 | |
| 1070 | .frontend_attach = m920x_tda10046_0b_frontend_attach, |
| 1071 | .tuner_attach = m920x_tda8275_61_tuner_attach, |
| 1072 | |
| 1073 | .stream = { |
| 1074 | .type = USB_BULK, |
| 1075 | .count = 8, |
| 1076 | .endpoint = 0x82, |
| 1077 | .u = { |
| 1078 | .bulk = { |
| 1079 | .buffersize = 512, |
| 1080 | } |
| 1081 | } |
| 1082 | }}, |
| 1083 | }, |
| 1084 | }}, |
| 1085 | .i2c_algo = &m920x_i2c_algo, |
| 1086 | |
| 1087 | .num_device_descs = 1, |
| 1088 | .devices = { |
| 1089 | { .name = "LifeView TV Walker Twin DVB-T USB2.0", |
| 1090 | .cold_ids = { &m920x_table[2], NULL }, |
| 1091 | .warm_ids = { &m920x_table[3], NULL }, |
| 1092 | }, |
| 1093 | } |
| 1094 | }; |
| 1095 | |
| 1096 | static struct dvb_usb_device_properties dposh_properties = { |
| 1097 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
| 1098 | |
| 1099 | .usb_ctrl = DEVICE_SPECIFIC, |
| 1100 | .firmware = "dvb-usb-dposh-01.fw", |
| 1101 | .download_firmware = m920x_firmware_download, |
| 1102 | |
| 1103 | .size_of_priv = sizeof(struct m920x_state), |
| 1104 | |
| 1105 | .identify_state = m920x_identify_state, |
| 1106 | .num_adapters = 1, |
| 1107 | .adapter = {{ |
| 1108 | .num_frontends = 1, |
| 1109 | .fe = {{ |
| 1110 | /* Hardware pid filters don't work with this device/firmware */ |
| 1111 | |
| 1112 | .frontend_attach = m920x_mt352_frontend_attach, |
| 1113 | .tuner_attach = m920x_qt1010_tuner_attach, |
| 1114 | |
| 1115 | .stream = { |
| 1116 | .type = USB_BULK, |
| 1117 | .count = 8, |
| 1118 | .endpoint = 0x81, |
| 1119 | .u = { |
| 1120 | .bulk = { |
| 1121 | .buffersize = 512, |
| 1122 | } |
| 1123 | } |
| 1124 | }, |
| 1125 | }}, |
| 1126 | }}, |
| 1127 | .i2c_algo = &m920x_i2c_algo, |
| 1128 | |
| 1129 | .num_device_descs = 1, |
| 1130 | .devices = { |
| 1131 | { .name = "Dposh DVB-T USB2.0", |
| 1132 | .cold_ids = { &m920x_table[4], NULL }, |
| 1133 | .warm_ids = { &m920x_table[5], NULL }, |
| 1134 | }, |
| 1135 | } |
| 1136 | }; |
| 1137 | |
| 1138 | static struct dvb_usb_device_properties pinnacle_pctv310e_properties = { |
| 1139 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
| 1140 | |
| 1141 | .usb_ctrl = DEVICE_SPECIFIC, |
| 1142 | .download_firmware = NULL, |
| 1143 | |
| 1144 | .rc.legacy = { |
| 1145 | .rc_interval = 100, |
| 1146 | .rc_map_table = rc_map_pinnacle310e_table, |
| 1147 | .rc_map_size = ARRAY_SIZE(rc_map_pinnacle310e_table), |
| 1148 | .rc_query = m920x_rc_query, |
| 1149 | }, |
| 1150 | |
| 1151 | .size_of_priv = sizeof(struct m920x_state), |
| 1152 | |
| 1153 | .identify_state = m920x_identify_state, |
| 1154 | .num_adapters = 1, |
| 1155 | .adapter = {{ |
| 1156 | .num_frontends = 1, |
| 1157 | .fe = {{ |
| 1158 | |
| 1159 | .caps = DVB_USB_ADAP_HAS_PID_FILTER | |
| 1160 | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, |
| 1161 | |
| 1162 | .pid_filter_count = 8, |
| 1163 | .pid_filter = m920x_pid_filter, |
| 1164 | .pid_filter_ctrl = m920x_pid_filter_ctrl, |
| 1165 | |
| 1166 | .frontend_attach = m920x_mt352_frontend_attach, |
| 1167 | .tuner_attach = m920x_fmd1216me_tuner_attach, |
| 1168 | |
| 1169 | .stream = { |
| 1170 | .type = USB_ISOC, |
| 1171 | .count = 5, |
| 1172 | .endpoint = 0x84, |
| 1173 | .u = { |
| 1174 | .isoc = { |
| 1175 | .framesperurb = 128, |
| 1176 | .framesize = 564, |
| 1177 | .interval = 1, |
| 1178 | } |
| 1179 | } |
| 1180 | }, |
| 1181 | }}, |
| 1182 | } }, |
| 1183 | .i2c_algo = &m920x_i2c_algo, |
| 1184 | |
| 1185 | .num_device_descs = 1, |
| 1186 | .devices = { |
| 1187 | { "Pinnacle PCTV 310e", |
| 1188 | { &m920x_table[6], NULL }, |
| 1189 | { NULL }, |
| 1190 | } |
| 1191 | } |
| 1192 | }; |
| 1193 | |
| 1194 | static struct dvb_usb_device_properties vp7049_properties = { |
| 1195 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
| 1196 | |
| 1197 | .usb_ctrl = DEVICE_SPECIFIC, |
| 1198 | .firmware = "dvb-usb-vp7049-0.95.fw", |
| 1199 | .download_firmware = m920x_firmware_download, |
| 1200 | |
| 1201 | .rc.core = { |
| 1202 | .rc_interval = 150, |
| 1203 | .rc_codes = RC_MAP_TWINHAN_VP1027_DVBS, |
| 1204 | .rc_query = m920x_rc_core_query, |
| 1205 | .allowed_protos = RC_PROTO_BIT_UNKNOWN, |
| 1206 | }, |
| 1207 | |
| 1208 | .size_of_priv = sizeof(struct m920x_state), |
| 1209 | |
| 1210 | .identify_state = m920x_identify_state, |
| 1211 | .num_adapters = 1, |
| 1212 | .adapter = {{ |
| 1213 | .num_frontends = 1, |
| 1214 | .fe = {{ |
| 1215 | |
| 1216 | .caps = DVB_USB_ADAP_HAS_PID_FILTER | |
| 1217 | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, |
| 1218 | |
| 1219 | .pid_filter_count = 8, |
| 1220 | .pid_filter = m920x_pid_filter, |
| 1221 | .pid_filter_ctrl = m920x_pid_filter_ctrl, |
| 1222 | |
| 1223 | .frontend_attach = m920x_mt352_frontend_attach_vp7049, |
| 1224 | .tuner_attach = m920x_mt2060_tuner_attach, |
| 1225 | |
| 1226 | .stream = { |
| 1227 | .type = USB_BULK, |
| 1228 | .count = 8, |
| 1229 | .endpoint = 0x81, |
| 1230 | .u = { |
| 1231 | .bulk = { |
| 1232 | .buffersize = 512, |
| 1233 | } |
| 1234 | } |
| 1235 | }, |
| 1236 | } }, |
| 1237 | } }, |
| 1238 | .i2c_algo = &m920x_i2c_algo, |
| 1239 | |
| 1240 | .num_device_descs = 1, |
| 1241 | .devices = { |
| 1242 | { "DTV-DVB UDTT7049", |
| 1243 | { &m920x_table[7], NULL }, |
| 1244 | { NULL }, |
| 1245 | } |
| 1246 | } |
| 1247 | }; |
| 1248 | |
| 1249 | static struct usb_driver m920x_driver = { |
| 1250 | .name = "dvb_usb_m920x", |
| 1251 | .probe = m920x_probe, |
| 1252 | .disconnect = dvb_usb_device_exit, |
| 1253 | .id_table = m920x_table, |
| 1254 | }; |
| 1255 | |
| 1256 | module_usb_driver(m920x_driver); |
| 1257 | |
| 1258 | MODULE_AUTHOR("Aapo Tahkola <aet@rasterburn.org>"); |
| 1259 | MODULE_DESCRIPTION("DVB Driver for ULI M920x"); |
| 1260 | MODULE_VERSION("0.1"); |
| 1261 | MODULE_LICENSE("GPL"); |