| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* DVB USB compliant linux driver for Conexant USB reference design. |
|---|
| 2 | 3 | * |
|---|
| 3 | 4 | * The Conexant reference design I saw on their website was only for analogue |
|---|
| .. | .. |
|---|
| 11 | 12 | * design, so it can be reused for the "analogue-only" device (if it will |
|---|
| 12 | 13 | * appear at all). |
|---|
| 13 | 14 | * |
|---|
| 14 | | - * TODO: Use the cx25840-driver for the analogue part |
|---|
| 15 | 15 | * |
|---|
| 16 | 16 | * Copyright (C) 2005 Patrick Boettcher (patrick.boettcher@posteo.de) |
|---|
| 17 | 17 | * Copyright (C) 2006 Michael Krufky (mkrufky@linuxtv.org) |
|---|
| 18 | 18 | * Copyright (C) 2006, 2007 Chris Pascoe (c.pascoe@itee.uq.edu.au) |
|---|
| 19 | + * Copyright (C) 2011, 2017 Maciej S. Szmigiero (mail@maciej.szmigiero.name) |
|---|
| 19 | 20 | * |
|---|
| 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. |
|---|
| 23 | | - * |
|---|
| 24 | | - * see Documentation/media/dvb-drivers/dvb-usb.rst for more information |
|---|
| 21 | + * see Documentation/driver-api/media/drivers/dvb-usb.rst for more information |
|---|
| 25 | 22 | */ |
|---|
| 26 | 23 | #include <media/tuner.h> |
|---|
| 27 | | -#include <linux/vmalloc.h> |
|---|
| 28 | | -#include <linux/slab.h> |
|---|
| 24 | +#include <linux/delay.h> |
|---|
| 25 | +#include <linux/device.h> |
|---|
| 29 | 26 | #include <linux/kernel.h> |
|---|
| 27 | +#include <linux/slab.h> |
|---|
| 28 | +#include <linux/string.h> |
|---|
| 29 | +#include <linux/vmalloc.h> |
|---|
| 30 | 30 | |
|---|
| 31 | 31 | #include "cxusb.h" |
|---|
| 32 | 32 | |
|---|
| .. | .. |
|---|
| 47 | 47 | #include "si2157.h" |
|---|
| 48 | 48 | |
|---|
| 49 | 49 | /* debug */ |
|---|
| 50 | | -static int dvb_usb_cxusb_debug; |
|---|
| 50 | +int dvb_usb_cxusb_debug; |
|---|
| 51 | 51 | module_param_named(debug, dvb_usb_cxusb_debug, int, 0644); |
|---|
| 52 | | -MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS); |
|---|
| 52 | +MODULE_PARM_DESC(debug, "set debugging level (see cxusb.h)." |
|---|
| 53 | + DVB_USB_DEBUG_STATUS); |
|---|
| 53 | 54 | |
|---|
| 54 | 55 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); |
|---|
| 55 | 56 | |
|---|
| 56 | | -#define deb_info(args...) dprintk(dvb_usb_cxusb_debug, 0x03, args) |
|---|
| 57 | | -#define deb_i2c(args...) dprintk(dvb_usb_cxusb_debug, 0x02, args) |
|---|
| 57 | +enum cxusb_table_index { |
|---|
| 58 | + MEDION_MD95700, |
|---|
| 59 | + DVICO_BLUEBIRD_LG064F_COLD, |
|---|
| 60 | + DVICO_BLUEBIRD_LG064F_WARM, |
|---|
| 61 | + DVICO_BLUEBIRD_DUAL_1_COLD, |
|---|
| 62 | + DVICO_BLUEBIRD_DUAL_1_WARM, |
|---|
| 63 | + DVICO_BLUEBIRD_LGZ201_COLD, |
|---|
| 64 | + DVICO_BLUEBIRD_LGZ201_WARM, |
|---|
| 65 | + DVICO_BLUEBIRD_TH7579_COLD, |
|---|
| 66 | + DVICO_BLUEBIRD_TH7579_WARM, |
|---|
| 67 | + DIGITALNOW_BLUEBIRD_DUAL_1_COLD, |
|---|
| 68 | + DIGITALNOW_BLUEBIRD_DUAL_1_WARM, |
|---|
| 69 | + DVICO_BLUEBIRD_DUAL_2_COLD, |
|---|
| 70 | + DVICO_BLUEBIRD_DUAL_2_WARM, |
|---|
| 71 | + DVICO_BLUEBIRD_DUAL_4, |
|---|
| 72 | + DVICO_BLUEBIRD_DVB_T_NANO_2, |
|---|
| 73 | + DVICO_BLUEBIRD_DVB_T_NANO_2_NFW_WARM, |
|---|
| 74 | + AVERMEDIA_VOLAR_A868R, |
|---|
| 75 | + DVICO_BLUEBIRD_DUAL_4_REV_2, |
|---|
| 76 | + CONEXANT_D680_DMB, |
|---|
| 77 | + MYGICA_D689, |
|---|
| 78 | + NR__cxusb_table_index |
|---|
| 79 | +}; |
|---|
| 58 | 80 | |
|---|
| 59 | | -static int cxusb_ctrl_msg(struct dvb_usb_device *d, |
|---|
| 60 | | - u8 cmd, const u8 *wbuf, int wlen, u8 *rbuf, int rlen) |
|---|
| 81 | +static struct usb_device_id cxusb_table[]; |
|---|
| 82 | + |
|---|
| 83 | +int cxusb_ctrl_msg(struct dvb_usb_device *d, |
|---|
| 84 | + u8 cmd, const u8 *wbuf, int wlen, u8 *rbuf, int rlen) |
|---|
| 61 | 85 | { |
|---|
| 62 | 86 | struct cxusb_state *st = d->priv; |
|---|
| 63 | 87 | int ret; |
|---|
| .. | .. |
|---|
| 89 | 113 | struct cxusb_state *st = d->priv; |
|---|
| 90 | 114 | u8 o[2], i; |
|---|
| 91 | 115 | |
|---|
| 92 | | - if (st->gpio_write_state[GPIO_TUNER] == onoff) |
|---|
| 116 | + if (st->gpio_write_state[GPIO_TUNER] == onoff && |
|---|
| 117 | + !st->gpio_write_refresh[GPIO_TUNER]) |
|---|
| 93 | 118 | return; |
|---|
| 94 | 119 | |
|---|
| 95 | 120 | o[0] = GPIO_TUNER; |
|---|
| .. | .. |
|---|
| 97 | 122 | cxusb_ctrl_msg(d, CMD_GPIO_WRITE, o, 2, &i, 1); |
|---|
| 98 | 123 | |
|---|
| 99 | 124 | if (i != 0x01) |
|---|
| 100 | | - deb_info("gpio_write failed.\n"); |
|---|
| 125 | + dev_info(&d->udev->dev, "gpio_write failed.\n"); |
|---|
| 101 | 126 | |
|---|
| 102 | 127 | st->gpio_write_state[GPIO_TUNER] = onoff; |
|---|
| 128 | + st->gpio_write_refresh[GPIO_TUNER] = false; |
|---|
| 103 | 129 | } |
|---|
| 104 | 130 | |
|---|
| 105 | 131 | static int cxusb_bluebird_gpio_rw(struct dvb_usb_device *d, u8 changemask, |
|---|
| 106 | | - u8 newval) |
|---|
| 132 | + u8 newval) |
|---|
| 107 | 133 | { |
|---|
| 108 | 134 | u8 o[2], gpio_state; |
|---|
| 109 | 135 | int rc; |
|---|
| .. | .. |
|---|
| 113 | 139 | |
|---|
| 114 | 140 | rc = cxusb_ctrl_msg(d, CMD_BLUEBIRD_GPIO_RW, o, 2, &gpio_state, 1); |
|---|
| 115 | 141 | if (rc < 0 || (gpio_state & changemask) != (newval & changemask)) |
|---|
| 116 | | - deb_info("bluebird_gpio_write failed.\n"); |
|---|
| 142 | + dev_info(&d->udev->dev, "bluebird_gpio_write failed.\n"); |
|---|
| 117 | 143 | |
|---|
| 118 | 144 | return rc < 0 ? rc : gpio_state; |
|---|
| 119 | 145 | } |
|---|
| .. | .. |
|---|
| 131 | 157 | } |
|---|
| 132 | 158 | |
|---|
| 133 | 159 | static int cxusb_d680_dmb_gpio_tuner(struct dvb_usb_device *d, |
|---|
| 134 | | - u8 addr, int onoff) |
|---|
| 160 | + u8 addr, int onoff) |
|---|
| 135 | 161 | { |
|---|
| 136 | 162 | u8 o[2] = {addr, onoff}; |
|---|
| 137 | 163 | u8 i; |
|---|
| .. | .. |
|---|
| 141 | 167 | |
|---|
| 142 | 168 | if (rc < 0) |
|---|
| 143 | 169 | return rc; |
|---|
| 170 | + |
|---|
| 144 | 171 | if (i == 0x01) |
|---|
| 145 | 172 | return 0; |
|---|
| 146 | | - else { |
|---|
| 147 | | - deb_info("gpio_write failed.\n"); |
|---|
| 148 | | - return -EIO; |
|---|
| 149 | | - } |
|---|
| 173 | + |
|---|
| 174 | + dev_info(&d->udev->dev, "gpio_write failed.\n"); |
|---|
| 175 | + return -EIO; |
|---|
| 150 | 176 | } |
|---|
| 151 | 177 | |
|---|
| 152 | 178 | /* I2C */ |
|---|
| .. | .. |
|---|
| 161 | 187 | return -EAGAIN; |
|---|
| 162 | 188 | |
|---|
| 163 | 189 | for (i = 0; i < num; i++) { |
|---|
| 164 | | - |
|---|
| 165 | 190 | if (le16_to_cpu(d->udev->descriptor.idVendor) == USB_VID_MEDION) |
|---|
| 166 | 191 | switch (msg[i].addr) { |
|---|
| 167 | 192 | case 0x63: |
|---|
| .. | .. |
|---|
| 187 | 212 | obuf[2] = msg[i].addr; |
|---|
| 188 | 213 | if (cxusb_ctrl_msg(d, CMD_I2C_READ, |
|---|
| 189 | 214 | obuf, 3, |
|---|
| 190 | | - ibuf, 1+msg[i].len) < 0) { |
|---|
| 215 | + ibuf, 1 + msg[i].len) < 0) { |
|---|
| 191 | 216 | warn("i2c read failed"); |
|---|
| 192 | 217 | break; |
|---|
| 193 | 218 | } |
|---|
| 194 | 219 | memcpy(msg[i].buf, &ibuf[1], msg[i].len); |
|---|
| 195 | | - } else if (i+1 < num && (msg[i+1].flags & I2C_M_RD) && |
|---|
| 196 | | - msg[i].addr == msg[i+1].addr) { |
|---|
| 220 | + } else if (i + 1 < num && (msg[i + 1].flags & I2C_M_RD) && |
|---|
| 221 | + msg[i].addr == msg[i + 1].addr) { |
|---|
| 197 | 222 | /* write to then read from same address */ |
|---|
| 198 | 223 | u8 obuf[MAX_XFER_SIZE], ibuf[MAX_XFER_SIZE]; |
|---|
| 199 | 224 | |
|---|
| .. | .. |
|---|
| 210 | 235 | goto unlock; |
|---|
| 211 | 236 | } |
|---|
| 212 | 237 | obuf[0] = msg[i].len; |
|---|
| 213 | | - obuf[1] = msg[i+1].len; |
|---|
| 238 | + obuf[1] = msg[i + 1].len; |
|---|
| 214 | 239 | obuf[2] = msg[i].addr; |
|---|
| 215 | 240 | memcpy(&obuf[3], msg[i].buf, msg[i].len); |
|---|
| 216 | 241 | |
|---|
| 217 | 242 | if (cxusb_ctrl_msg(d, CMD_I2C_READ, |
|---|
| 218 | | - obuf, 3+msg[i].len, |
|---|
| 219 | | - ibuf, 1+msg[i+1].len) < 0) |
|---|
| 243 | + obuf, 3 + msg[i].len, |
|---|
| 244 | + ibuf, 1 + msg[i + 1].len) < 0) |
|---|
| 220 | 245 | break; |
|---|
| 221 | 246 | |
|---|
| 222 | 247 | if (ibuf[0] != 0x08) |
|---|
| 223 | | - deb_i2c("i2c read may have failed\n"); |
|---|
| 248 | + dev_info(&d->udev->dev, "i2c read may have failed\n"); |
|---|
| 224 | 249 | |
|---|
| 225 | | - memcpy(msg[i+1].buf, &ibuf[1], msg[i+1].len); |
|---|
| 250 | + memcpy(msg[i + 1].buf, &ibuf[1], msg[i + 1].len); |
|---|
| 226 | 251 | |
|---|
| 227 | 252 | i++; |
|---|
| 228 | 253 | } else { |
|---|
| .. | .. |
|---|
| 240 | 265 | memcpy(&obuf[2], msg[i].buf, msg[i].len); |
|---|
| 241 | 266 | |
|---|
| 242 | 267 | if (cxusb_ctrl_msg(d, CMD_I2C_WRITE, obuf, |
|---|
| 243 | | - 2+msg[i].len, &ibuf,1) < 0) |
|---|
| 268 | + 2 + msg[i].len, &ibuf, 1) < 0) |
|---|
| 244 | 269 | break; |
|---|
| 245 | 270 | if (ibuf != 0x08) |
|---|
| 246 | | - deb_i2c("i2c write may have failed\n"); |
|---|
| 271 | + dev_info(&d->udev->dev, "i2c write may have failed\n"); |
|---|
| 247 | 272 | } |
|---|
| 248 | 273 | } |
|---|
| 249 | 274 | |
|---|
| .. | .. |
|---|
| 259 | 284 | |
|---|
| 260 | 285 | static u32 cxusb_i2c_func(struct i2c_adapter *adapter) |
|---|
| 261 | 286 | { |
|---|
| 262 | | - return I2C_FUNC_I2C; |
|---|
| 287 | + return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; |
|---|
| 263 | 288 | } |
|---|
| 264 | 289 | |
|---|
| 265 | 290 | static struct i2c_algorithm cxusb_i2c_algo = { |
|---|
| .. | .. |
|---|
| 267 | 292 | .functionality = cxusb_i2c_func, |
|---|
| 268 | 293 | }; |
|---|
| 269 | 294 | |
|---|
| 270 | | -static int cxusb_power_ctrl(struct dvb_usb_device *d, int onoff) |
|---|
| 295 | +static int _cxusb_power_ctrl(struct dvb_usb_device *d, int onoff) |
|---|
| 271 | 296 | { |
|---|
| 272 | 297 | u8 b = 0; |
|---|
| 298 | + |
|---|
| 299 | + dev_info(&d->udev->dev, "setting power %s\n", onoff ? "ON" : "OFF"); |
|---|
| 300 | + |
|---|
| 273 | 301 | if (onoff) |
|---|
| 274 | 302 | return cxusb_ctrl_msg(d, CMD_POWER_ON, &b, 1, NULL, 0); |
|---|
| 275 | 303 | else |
|---|
| 276 | 304 | return cxusb_ctrl_msg(d, CMD_POWER_OFF, &b, 1, NULL, 0); |
|---|
| 277 | 305 | } |
|---|
| 278 | 306 | |
|---|
| 307 | +static int cxusb_power_ctrl(struct dvb_usb_device *d, int onoff) |
|---|
| 308 | +{ |
|---|
| 309 | + bool is_medion = d->props.devices[0].warm_ids[0] == &cxusb_table[MEDION_MD95700]; |
|---|
| 310 | + int ret; |
|---|
| 311 | + |
|---|
| 312 | + if (is_medion && !onoff) { |
|---|
| 313 | + struct cxusb_medion_dev *cxdev = d->priv; |
|---|
| 314 | + |
|---|
| 315 | + mutex_lock(&cxdev->open_lock); |
|---|
| 316 | + |
|---|
| 317 | + if (cxdev->open_type == CXUSB_OPEN_ANALOG) { |
|---|
| 318 | + dev_info(&d->udev->dev, "preventing DVB core from setting power OFF while we are in analog mode\n"); |
|---|
| 319 | + ret = -EBUSY; |
|---|
| 320 | + goto ret_unlock; |
|---|
| 321 | + } |
|---|
| 322 | + } |
|---|
| 323 | + |
|---|
| 324 | + ret = _cxusb_power_ctrl(d, onoff); |
|---|
| 325 | + |
|---|
| 326 | +ret_unlock: |
|---|
| 327 | + if (is_medion && !onoff) { |
|---|
| 328 | + struct cxusb_medion_dev *cxdev = d->priv; |
|---|
| 329 | + |
|---|
| 330 | + mutex_unlock(&cxdev->open_lock); |
|---|
| 331 | + } |
|---|
| 332 | + |
|---|
| 333 | + return ret; |
|---|
| 334 | +} |
|---|
| 335 | + |
|---|
| 279 | 336 | static int cxusb_aver_power_ctrl(struct dvb_usb_device *d, int onoff) |
|---|
| 280 | 337 | { |
|---|
| 281 | 338 | int ret; |
|---|
| 339 | + |
|---|
| 282 | 340 | if (!onoff) |
|---|
| 283 | 341 | return cxusb_ctrl_msg(d, CMD_POWER_OFF, NULL, 0, NULL, 0); |
|---|
| 284 | 342 | if (d->state == DVB_USB_STATE_INIT && |
|---|
| 285 | 343 | usb_set_interface(d->udev, 0, 0) < 0) |
|---|
| 286 | 344 | err("set interface failed"); |
|---|
| 287 | | - do {} while (!(ret = cxusb_ctrl_msg(d, CMD_POWER_ON, NULL, 0, NULL, 0)) && |
|---|
| 288 | | - !(ret = cxusb_ctrl_msg(d, 0x15, NULL, 0, NULL, 0)) && |
|---|
| 289 | | - !(ret = cxusb_ctrl_msg(d, 0x17, NULL, 0, NULL, 0)) && 0); |
|---|
| 345 | + do { |
|---|
| 346 | + /* Nothing */ |
|---|
| 347 | + } while (!(ret = cxusb_ctrl_msg(d, CMD_POWER_ON, NULL, 0, NULL, 0)) && |
|---|
| 348 | + !(ret = cxusb_ctrl_msg(d, 0x15, NULL, 0, NULL, 0)) && |
|---|
| 349 | + !(ret = cxusb_ctrl_msg(d, 0x17, NULL, 0, NULL, 0)) && 0); |
|---|
| 350 | + |
|---|
| 290 | 351 | if (!ret) { |
|---|
| 291 | | - /* FIXME: We don't know why, but we need to configure the |
|---|
| 292 | | - * lgdt3303 with the register settings below on resume */ |
|---|
| 352 | + /* |
|---|
| 353 | + * FIXME: We don't know why, but we need to configure the |
|---|
| 354 | + * lgdt3303 with the register settings below on resume |
|---|
| 355 | + */ |
|---|
| 293 | 356 | int i; |
|---|
| 294 | 357 | u8 buf; |
|---|
| 295 | 358 | static const u8 bufs[] = { |
|---|
| .. | .. |
|---|
| 307 | 370 | msleep(20); |
|---|
| 308 | 371 | for (i = 0; i < ARRAY_SIZE(bufs); i += 4 / sizeof(u8)) { |
|---|
| 309 | 372 | ret = cxusb_ctrl_msg(d, CMD_I2C_WRITE, |
|---|
| 310 | | - bufs+i, 4, &buf, 1); |
|---|
| 373 | + bufs + i, 4, &buf, 1); |
|---|
| 311 | 374 | if (ret) |
|---|
| 312 | 375 | break; |
|---|
| 313 | 376 | if (buf != 0x8) |
|---|
| .. | .. |
|---|
| 320 | 383 | static int cxusb_bluebird_power_ctrl(struct dvb_usb_device *d, int onoff) |
|---|
| 321 | 384 | { |
|---|
| 322 | 385 | u8 b = 0; |
|---|
| 386 | + |
|---|
| 323 | 387 | if (onoff) |
|---|
| 324 | 388 | return cxusb_ctrl_msg(d, CMD_POWER_ON, &b, 1, NULL, 0); |
|---|
| 325 | 389 | else |
|---|
| .. | .. |
|---|
| 341 | 405 | { |
|---|
| 342 | 406 | int ret; |
|---|
| 343 | 407 | u8 b; |
|---|
| 408 | + |
|---|
| 344 | 409 | ret = cxusb_power_ctrl(d, onoff); |
|---|
| 345 | 410 | if (!onoff) |
|---|
| 346 | 411 | return ret; |
|---|
| .. | .. |
|---|
| 353 | 418 | |
|---|
| 354 | 419 | static int cxusb_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) |
|---|
| 355 | 420 | { |
|---|
| 421 | + struct dvb_usb_device *dvbdev = adap->dev; |
|---|
| 422 | + bool is_medion = dvbdev->props.devices[0].warm_ids[0] == |
|---|
| 423 | + &cxusb_table[MEDION_MD95700]; |
|---|
| 356 | 424 | u8 buf[2] = { 0x03, 0x00 }; |
|---|
| 425 | + |
|---|
| 426 | + if (is_medion && onoff) { |
|---|
| 427 | + int ret; |
|---|
| 428 | + |
|---|
| 429 | + ret = cxusb_medion_get(dvbdev, CXUSB_OPEN_DIGITAL); |
|---|
| 430 | + if (ret != 0) |
|---|
| 431 | + return ret; |
|---|
| 432 | + } |
|---|
| 433 | + |
|---|
| 357 | 434 | if (onoff) |
|---|
| 358 | | - cxusb_ctrl_msg(adap->dev, CMD_STREAMING_ON, buf, 2, NULL, 0); |
|---|
| 435 | + cxusb_ctrl_msg(dvbdev, CMD_STREAMING_ON, buf, 2, NULL, 0); |
|---|
| 359 | 436 | else |
|---|
| 360 | | - cxusb_ctrl_msg(adap->dev, CMD_STREAMING_OFF, NULL, 0, NULL, 0); |
|---|
| 437 | + cxusb_ctrl_msg(dvbdev, CMD_STREAMING_OFF, NULL, 0, NULL, 0); |
|---|
| 438 | + |
|---|
| 439 | + if (is_medion && !onoff) |
|---|
| 440 | + cxusb_medion_put(dvbdev); |
|---|
| 361 | 441 | |
|---|
| 362 | 442 | return 0; |
|---|
| 363 | 443 | } |
|---|
| .. | .. |
|---|
| 370 | 450 | cxusb_ctrl_msg(adap->dev, CMD_AVER_STREAM_OFF, |
|---|
| 371 | 451 | NULL, 0, NULL, 0); |
|---|
| 372 | 452 | return 0; |
|---|
| 373 | | -} |
|---|
| 374 | | - |
|---|
| 375 | | -static int cxusb_read_status(struct dvb_frontend *fe, |
|---|
| 376 | | - enum fe_status *status) |
|---|
| 377 | | -{ |
|---|
| 378 | | - struct dvb_usb_adapter *adap = (struct dvb_usb_adapter *)fe->dvb->priv; |
|---|
| 379 | | - struct cxusb_state *state = (struct cxusb_state *)adap->dev->priv; |
|---|
| 380 | | - int ret; |
|---|
| 381 | | - |
|---|
| 382 | | - ret = state->fe_read_status(fe, status); |
|---|
| 383 | | - |
|---|
| 384 | | - /* it need resync slave fifo when signal change from unlock to lock.*/ |
|---|
| 385 | | - if ((*status & FE_HAS_LOCK) && (!state->last_lock)) { |
|---|
| 386 | | - mutex_lock(&state->stream_mutex); |
|---|
| 387 | | - cxusb_streaming_ctrl(adap, 1); |
|---|
| 388 | | - mutex_unlock(&state->stream_mutex); |
|---|
| 389 | | - } |
|---|
| 390 | | - |
|---|
| 391 | | - state->last_lock = (*status & FE_HAS_LOCK) ? 1 : 0; |
|---|
| 392 | | - return ret; |
|---|
| 393 | 453 | } |
|---|
| 394 | 454 | |
|---|
| 395 | 455 | static void cxusb_d680_dmb_drain_message(struct dvb_usb_device *d) |
|---|
| .. | .. |
|---|
| 406 | 466 | return; |
|---|
| 407 | 467 | while (1) { |
|---|
| 408 | 468 | if (usb_bulk_msg(d->udev, |
|---|
| 409 | | - usb_rcvbulkpipe(d->udev, ep), |
|---|
| 410 | | - junk, junk_len, &rd_count, timeout) < 0) |
|---|
| 469 | + usb_rcvbulkpipe(d->udev, ep), |
|---|
| 470 | + junk, junk_len, &rd_count, timeout) < 0) |
|---|
| 411 | 471 | break; |
|---|
| 412 | 472 | if (!rd_count) |
|---|
| 413 | 473 | break; |
|---|
| .. | .. |
|---|
| 429 | 489 | return; |
|---|
| 430 | 490 | while (1) { |
|---|
| 431 | 491 | if (usb_bulk_msg(d->udev, |
|---|
| 432 | | - usb_rcvbulkpipe(d->udev, p->endpoint), |
|---|
| 433 | | - junk, junk_len, &rd_count, timeout) < 0) |
|---|
| 492 | + usb_rcvbulkpipe(d->udev, p->endpoint), |
|---|
| 493 | + junk, junk_len, &rd_count, timeout) < 0) |
|---|
| 434 | 494 | break; |
|---|
| 435 | 495 | if (!rd_count) |
|---|
| 436 | 496 | break; |
|---|
| .. | .. |
|---|
| 438 | 498 | kfree(junk); |
|---|
| 439 | 499 | } |
|---|
| 440 | 500 | |
|---|
| 441 | | -static int cxusb_d680_dmb_streaming_ctrl( |
|---|
| 442 | | - struct dvb_usb_adapter *adap, int onoff) |
|---|
| 501 | +static int cxusb_d680_dmb_streaming_ctrl(struct dvb_usb_adapter *adap, |
|---|
| 502 | + int onoff) |
|---|
| 443 | 503 | { |
|---|
| 444 | 504 | if (onoff) { |
|---|
| 445 | 505 | u8 buf[2] = { 0x03, 0x00 }; |
|---|
| 506 | + |
|---|
| 446 | 507 | cxusb_d680_dmb_drain_video(adap->dev); |
|---|
| 447 | 508 | return cxusb_ctrl_msg(adap->dev, CMD_STREAMING_ON, |
|---|
| 448 | | - buf, sizeof(buf), NULL, 0); |
|---|
| 509 | + buf, sizeof(buf), NULL, 0); |
|---|
| 449 | 510 | } else { |
|---|
| 450 | 511 | int ret = cxusb_ctrl_msg(adap->dev, |
|---|
| 451 | | - CMD_STREAMING_OFF, NULL, 0, NULL, 0); |
|---|
| 512 | + CMD_STREAMING_OFF, NULL, 0, NULL, 0); |
|---|
| 452 | 513 | return ret; |
|---|
| 453 | 514 | } |
|---|
| 454 | 515 | } |
|---|
| .. | .. |
|---|
| 469 | 530 | static int cxusb_bluebird2_rc_query(struct dvb_usb_device *d) |
|---|
| 470 | 531 | { |
|---|
| 471 | 532 | u8 ircode[4]; |
|---|
| 472 | | - struct i2c_msg msg = { .addr = 0x6b, .flags = I2C_M_RD, |
|---|
| 473 | | - .buf = ircode, .len = 4 }; |
|---|
| 533 | + struct i2c_msg msg = { |
|---|
| 534 | + .addr = 0x6b, |
|---|
| 535 | + .flags = I2C_M_RD, |
|---|
| 536 | + .buf = ircode, |
|---|
| 537 | + .len = 4 |
|---|
| 538 | + }; |
|---|
| 474 | 539 | |
|---|
| 475 | 540 | if (cxusb_i2c_xfer(&d->i2c_adap, &msg, 1) != 1) |
|---|
| 476 | 541 | return 0; |
|---|
| .. | .. |
|---|
| 494 | 559 | return 0; |
|---|
| 495 | 560 | } |
|---|
| 496 | 561 | |
|---|
| 497 | | -static int cxusb_dee1601_demod_init(struct dvb_frontend* fe) |
|---|
| 562 | +static int cxusb_dee1601_demod_init(struct dvb_frontend *fe) |
|---|
| 498 | 563 | { |
|---|
| 499 | | - static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x28 }; |
|---|
| 500 | | - static u8 reset [] = { RESET, 0x80 }; |
|---|
| 501 | | - static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 }; |
|---|
| 502 | | - static u8 agc_cfg [] = { AGC_TARGET, 0x28, 0x20 }; |
|---|
| 503 | | - static u8 gpp_ctl_cfg [] = { GPP_CTL, 0x33 }; |
|---|
| 564 | + static u8 clock_config[] = { CLOCK_CTL, 0x38, 0x28 }; |
|---|
| 565 | + static u8 reset[] = { RESET, 0x80 }; |
|---|
| 566 | + static u8 adc_ctl_1_cfg[] = { ADC_CTL_1, 0x40 }; |
|---|
| 567 | + static u8 agc_cfg[] = { AGC_TARGET, 0x28, 0x20 }; |
|---|
| 568 | + static u8 gpp_ctl_cfg[] = { GPP_CTL, 0x33 }; |
|---|
| 504 | 569 | static u8 capt_range_cfg[] = { CAPT_RANGE, 0x32 }; |
|---|
| 505 | 570 | |
|---|
| 506 | 571 | mt352_write(fe, clock_config, sizeof(clock_config)); |
|---|
| .. | .. |
|---|
| 515 | 580 | return 0; |
|---|
| 516 | 581 | } |
|---|
| 517 | 582 | |
|---|
| 518 | | -static int cxusb_mt352_demod_init(struct dvb_frontend* fe) |
|---|
| 519 | | -{ /* used in both lgz201 and th7579 */ |
|---|
| 520 | | - static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x29 }; |
|---|
| 521 | | - static u8 reset [] = { RESET, 0x80 }; |
|---|
| 522 | | - static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 }; |
|---|
| 523 | | - static u8 agc_cfg [] = { AGC_TARGET, 0x24, 0x20 }; |
|---|
| 524 | | - static u8 gpp_ctl_cfg [] = { GPP_CTL, 0x33 }; |
|---|
| 583 | +static int cxusb_mt352_demod_init(struct dvb_frontend *fe) |
|---|
| 584 | +{ |
|---|
| 585 | + /* used in both lgz201 and th7579 */ |
|---|
| 586 | + static u8 clock_config[] = { CLOCK_CTL, 0x38, 0x29 }; |
|---|
| 587 | + static u8 reset[] = { RESET, 0x80 }; |
|---|
| 588 | + static u8 adc_ctl_1_cfg[] = { ADC_CTL_1, 0x40 }; |
|---|
| 589 | + static u8 agc_cfg[] = { AGC_TARGET, 0x24, 0x20 }; |
|---|
| 590 | + static u8 gpp_ctl_cfg[] = { GPP_CTL, 0x33 }; |
|---|
| 525 | 591 | static u8 capt_range_cfg[] = { CAPT_RANGE, 0x32 }; |
|---|
| 526 | 592 | |
|---|
| 527 | 593 | mt352_write(fe, clock_config, sizeof(clock_config)); |
|---|
| .. | .. |
|---|
| 631 | 697 | /* Callbacks for DVB USB */ |
|---|
| 632 | 698 | static int cxusb_fmd1216me_tuner_attach(struct dvb_usb_adapter *adap) |
|---|
| 633 | 699 | { |
|---|
| 700 | + struct dvb_usb_device *dvbdev = adap->dev; |
|---|
| 701 | + bool is_medion = dvbdev->props.devices[0].warm_ids[0] == |
|---|
| 702 | + &cxusb_table[MEDION_MD95700]; |
|---|
| 703 | + |
|---|
| 634 | 704 | dvb_attach(simple_tuner_attach, adap->fe_adap[0].fe, |
|---|
| 635 | | - &adap->dev->i2c_adap, 0x61, |
|---|
| 705 | + &dvbdev->i2c_adap, 0x61, |
|---|
| 636 | 706 | TUNER_PHILIPS_FMD1216ME_MK3); |
|---|
| 707 | + |
|---|
| 708 | + if (is_medion && adap->fe_adap[0].fe) |
|---|
| 709 | + /* |
|---|
| 710 | + * make sure that DVB core won't put to sleep (reset, really) |
|---|
| 711 | + * tuner when we might be open in analog mode |
|---|
| 712 | + */ |
|---|
| 713 | + adap->fe_adap[0].fe->ops.tuner_ops.sleep = NULL; |
|---|
| 714 | + |
|---|
| 637 | 715 | return 0; |
|---|
| 638 | 716 | } |
|---|
| 639 | 717 | |
|---|
| .. | .. |
|---|
| 646 | 724 | |
|---|
| 647 | 725 | static int cxusb_lgz201_tuner_attach(struct dvb_usb_adapter *adap) |
|---|
| 648 | 726 | { |
|---|
| 649 | | - dvb_attach(dvb_pll_attach, adap->fe_adap[0].fe, 0x61, NULL, DVB_PLL_LG_Z201); |
|---|
| 727 | + dvb_attach(dvb_pll_attach, adap->fe_adap[0].fe, 0x61, |
|---|
| 728 | + NULL, DVB_PLL_LG_Z201); |
|---|
| 650 | 729 | return 0; |
|---|
| 651 | 730 | } |
|---|
| 652 | 731 | |
|---|
| .. | .. |
|---|
| 672 | 751 | |
|---|
| 673 | 752 | switch (command) { |
|---|
| 674 | 753 | case XC2028_TUNER_RESET: |
|---|
| 675 | | - deb_info("%s: XC2028_TUNER_RESET %d\n", __func__, arg); |
|---|
| 754 | + dev_info(&d->udev->dev, "XC2028_TUNER_RESET %d\n", arg); |
|---|
| 676 | 755 | cxusb_bluebird_gpio_pulse(d, 0x01, 1); |
|---|
| 677 | 756 | break; |
|---|
| 678 | 757 | case XC2028_RESET_CLK: |
|---|
| 679 | | - deb_info("%s: XC2028_RESET_CLK %d\n", __func__, arg); |
|---|
| 758 | + dev_info(&d->udev->dev, "XC2028_RESET_CLK %d\n", arg); |
|---|
| 680 | 759 | break; |
|---|
| 681 | 760 | case XC2028_I2C_FLUSH: |
|---|
| 682 | 761 | break; |
|---|
| 683 | 762 | default: |
|---|
| 684 | | - deb_info("%s: unknown command %d, arg %d\n", __func__, |
|---|
| 763 | + dev_info(&d->udev->dev, "unknown command %d, arg %d\n", |
|---|
| 685 | 764 | command, arg); |
|---|
| 686 | 765 | return -EINVAL; |
|---|
| 687 | 766 | } |
|---|
| .. | .. |
|---|
| 706 | 785 | adap->fe_adap[0].fe->callback = dvico_bluebird_xc2028_callback; |
|---|
| 707 | 786 | |
|---|
| 708 | 787 | fe = dvb_attach(xc2028_attach, adap->fe_adap[0].fe, &cfg); |
|---|
| 709 | | - if (fe == NULL || fe->ops.tuner_ops.set_config == NULL) |
|---|
| 788 | + if (!fe || !fe->ops.tuner_ops.set_config) |
|---|
| 710 | 789 | return -EIO; |
|---|
| 711 | 790 | |
|---|
| 712 | 791 | fe->ops.tuner_ops.set_config(fe, &ctl); |
|---|
| .. | .. |
|---|
| 724 | 803 | static int cxusb_d680_dmb_tuner_attach(struct dvb_usb_adapter *adap) |
|---|
| 725 | 804 | { |
|---|
| 726 | 805 | struct dvb_frontend *fe; |
|---|
| 806 | + |
|---|
| 727 | 807 | fe = dvb_attach(mxl5005s_attach, adap->fe_adap[0].fe, |
|---|
| 728 | 808 | &adap->dev->i2c_adap, &d680_dmb_tuner); |
|---|
| 729 | | - return (fe == NULL) ? -EIO : 0; |
|---|
| 809 | + return (!fe) ? -EIO : 0; |
|---|
| 730 | 810 | } |
|---|
| 731 | 811 | |
|---|
| 732 | 812 | static int cxusb_mygica_d689_tuner_attach(struct dvb_usb_adapter *adap) |
|---|
| 733 | 813 | { |
|---|
| 734 | 814 | struct dvb_frontend *fe; |
|---|
| 815 | + |
|---|
| 735 | 816 | fe = dvb_attach(max2165_attach, adap->fe_adap[0].fe, |
|---|
| 736 | 817 | &adap->dev->i2c_adap, &mygica_d689_max2165_cfg); |
|---|
| 737 | | - return (fe == NULL) ? -EIO : 0; |
|---|
| 818 | + return (!fe) ? -EIO : 0; |
|---|
| 819 | +} |
|---|
| 820 | + |
|---|
| 821 | +static int cxusb_medion_fe_ts_bus_ctrl(struct dvb_frontend *fe, int acquire) |
|---|
| 822 | +{ |
|---|
| 823 | + struct dvb_usb_adapter *adap = fe->dvb->priv; |
|---|
| 824 | + struct dvb_usb_device *dvbdev = adap->dev; |
|---|
| 825 | + |
|---|
| 826 | + if (acquire) |
|---|
| 827 | + return cxusb_medion_get(dvbdev, CXUSB_OPEN_DIGITAL); |
|---|
| 828 | + |
|---|
| 829 | + cxusb_medion_put(dvbdev); |
|---|
| 830 | + |
|---|
| 831 | + return 0; |
|---|
| 832 | +} |
|---|
| 833 | + |
|---|
| 834 | +static int cxusb_medion_set_mode(struct dvb_usb_device *dvbdev, bool digital) |
|---|
| 835 | +{ |
|---|
| 836 | + struct cxusb_state *st = dvbdev->priv; |
|---|
| 837 | + int ret; |
|---|
| 838 | + u8 b; |
|---|
| 839 | + unsigned int i; |
|---|
| 840 | + |
|---|
| 841 | + /* |
|---|
| 842 | + * switching mode while doing an I2C transaction often causes |
|---|
| 843 | + * the device to crash |
|---|
| 844 | + */ |
|---|
| 845 | + mutex_lock(&dvbdev->i2c_mutex); |
|---|
| 846 | + |
|---|
| 847 | + if (digital) { |
|---|
| 848 | + ret = usb_set_interface(dvbdev->udev, 0, 6); |
|---|
| 849 | + if (ret != 0) { |
|---|
| 850 | + dev_err(&dvbdev->udev->dev, |
|---|
| 851 | + "digital interface selection failed (%d)\n", |
|---|
| 852 | + ret); |
|---|
| 853 | + goto ret_unlock; |
|---|
| 854 | + } |
|---|
| 855 | + } else { |
|---|
| 856 | + ret = usb_set_interface(dvbdev->udev, 0, 1); |
|---|
| 857 | + if (ret != 0) { |
|---|
| 858 | + dev_err(&dvbdev->udev->dev, |
|---|
| 859 | + "analog interface selection failed (%d)\n", |
|---|
| 860 | + ret); |
|---|
| 861 | + goto ret_unlock; |
|---|
| 862 | + } |
|---|
| 863 | + } |
|---|
| 864 | + |
|---|
| 865 | + /* pipes need to be cleared after setting interface */ |
|---|
| 866 | + ret = usb_clear_halt(dvbdev->udev, usb_rcvbulkpipe(dvbdev->udev, 1)); |
|---|
| 867 | + if (ret != 0) |
|---|
| 868 | + dev_warn(&dvbdev->udev->dev, |
|---|
| 869 | + "clear halt on IN pipe failed (%d)\n", |
|---|
| 870 | + ret); |
|---|
| 871 | + |
|---|
| 872 | + ret = usb_clear_halt(dvbdev->udev, usb_sndbulkpipe(dvbdev->udev, 1)); |
|---|
| 873 | + if (ret != 0) |
|---|
| 874 | + dev_warn(&dvbdev->udev->dev, |
|---|
| 875 | + "clear halt on OUT pipe failed (%d)\n", |
|---|
| 876 | + ret); |
|---|
| 877 | + |
|---|
| 878 | + ret = cxusb_ctrl_msg(dvbdev, digital ? CMD_DIGITAL : CMD_ANALOG, |
|---|
| 879 | + NULL, 0, &b, 1); |
|---|
| 880 | + if (ret != 0) { |
|---|
| 881 | + dev_err(&dvbdev->udev->dev, "mode switch failed (%d)\n", |
|---|
| 882 | + ret); |
|---|
| 883 | + goto ret_unlock; |
|---|
| 884 | + } |
|---|
| 885 | + |
|---|
| 886 | + /* mode switch seems to reset GPIO states */ |
|---|
| 887 | + for (i = 0; i < ARRAY_SIZE(st->gpio_write_refresh); i++) |
|---|
| 888 | + st->gpio_write_refresh[i] = true; |
|---|
| 889 | + |
|---|
| 890 | +ret_unlock: |
|---|
| 891 | + mutex_unlock(&dvbdev->i2c_mutex); |
|---|
| 892 | + |
|---|
| 893 | + return ret; |
|---|
| 738 | 894 | } |
|---|
| 739 | 895 | |
|---|
| 740 | 896 | static int cxusb_cx22702_frontend_attach(struct dvb_usb_adapter *adap) |
|---|
| 741 | 897 | { |
|---|
| 742 | | - u8 b; |
|---|
| 743 | | - if (usb_set_interface(adap->dev->udev, 0, 6) < 0) |
|---|
| 744 | | - err("set interface failed"); |
|---|
| 898 | + struct dvb_usb_device *dvbdev = adap->dev; |
|---|
| 899 | + bool is_medion = dvbdev->props.devices[0].warm_ids[0] == |
|---|
| 900 | + &cxusb_table[MEDION_MD95700]; |
|---|
| 745 | 901 | |
|---|
| 746 | | - cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, &b, 1); |
|---|
| 902 | + if (is_medion) { |
|---|
| 903 | + int ret; |
|---|
| 904 | + |
|---|
| 905 | + ret = cxusb_medion_set_mode(dvbdev, true); |
|---|
| 906 | + if (ret) |
|---|
| 907 | + return ret; |
|---|
| 908 | + } |
|---|
| 747 | 909 | |
|---|
| 748 | 910 | adap->fe_adap[0].fe = dvb_attach(cx22702_attach, &cxusb_cx22702_config, |
|---|
| 749 | | - &adap->dev->i2c_adap); |
|---|
| 750 | | - if ((adap->fe_adap[0].fe) != NULL) |
|---|
| 751 | | - return 0; |
|---|
| 911 | + &dvbdev->i2c_adap); |
|---|
| 912 | + if (!adap->fe_adap[0].fe) |
|---|
| 913 | + return -EIO; |
|---|
| 752 | 914 | |
|---|
| 753 | | - return -EIO; |
|---|
| 915 | + if (is_medion) |
|---|
| 916 | + adap->fe_adap[0].fe->ops.ts_bus_ctrl = |
|---|
| 917 | + cxusb_medion_fe_ts_bus_ctrl; |
|---|
| 918 | + |
|---|
| 919 | + return 0; |
|---|
| 754 | 920 | } |
|---|
| 755 | 921 | |
|---|
| 756 | 922 | static int cxusb_lgdt3303_frontend_attach(struct dvb_usb_adapter *adap) |
|---|
| .. | .. |
|---|
| 764 | 930 | &cxusb_lgdt3303_config, |
|---|
| 765 | 931 | 0x0e, |
|---|
| 766 | 932 | &adap->dev->i2c_adap); |
|---|
| 767 | | - if ((adap->fe_adap[0].fe) != NULL) |
|---|
| 933 | + if (adap->fe_adap[0].fe) |
|---|
| 768 | 934 | return 0; |
|---|
| 769 | 935 | |
|---|
| 770 | 936 | return -EIO; |
|---|
| .. | .. |
|---|
| 776 | 942 | &cxusb_aver_lgdt3303_config, |
|---|
| 777 | 943 | 0x0e, |
|---|
| 778 | 944 | &adap->dev->i2c_adap); |
|---|
| 779 | | - if (adap->fe_adap[0].fe != NULL) |
|---|
| 945 | + if (adap->fe_adap[0].fe) |
|---|
| 780 | 946 | return 0; |
|---|
| 781 | 947 | |
|---|
| 782 | 948 | return -EIO; |
|---|
| .. | .. |
|---|
| 792 | 958 | |
|---|
| 793 | 959 | adap->fe_adap[0].fe = dvb_attach(mt352_attach, &cxusb_mt352_config, |
|---|
| 794 | 960 | &adap->dev->i2c_adap); |
|---|
| 795 | | - if ((adap->fe_adap[0].fe) != NULL) |
|---|
| 961 | + if (adap->fe_adap[0].fe) |
|---|
| 796 | 962 | return 0; |
|---|
| 797 | 963 | |
|---|
| 798 | 964 | return -EIO; |
|---|
| .. | .. |
|---|
| 807 | 973 | |
|---|
| 808 | 974 | adap->fe_adap[0].fe = dvb_attach(mt352_attach, &cxusb_dee1601_config, |
|---|
| 809 | 975 | &adap->dev->i2c_adap); |
|---|
| 810 | | - if ((adap->fe_adap[0].fe) != NULL) |
|---|
| 976 | + if (adap->fe_adap[0].fe) |
|---|
| 811 | 977 | return 0; |
|---|
| 812 | 978 | |
|---|
| 813 | 979 | adap->fe_adap[0].fe = dvb_attach(zl10353_attach, |
|---|
| 814 | 980 | &cxusb_zl10353_dee1601_config, |
|---|
| 815 | 981 | &adap->dev->i2c_adap); |
|---|
| 816 | | - if ((adap->fe_adap[0].fe) != NULL) |
|---|
| 982 | + if (adap->fe_adap[0].fe) |
|---|
| 817 | 983 | return 0; |
|---|
| 818 | 984 | |
|---|
| 819 | 985 | return -EIO; |
|---|
| .. | .. |
|---|
| 823 | 989 | { |
|---|
| 824 | 990 | u8 ircode[4]; |
|---|
| 825 | 991 | int i; |
|---|
| 826 | | - struct i2c_msg msg = { .addr = 0x6b, .flags = I2C_M_RD, |
|---|
| 827 | | - .buf = ircode, .len = 4 }; |
|---|
| 992 | + struct i2c_msg msg = { |
|---|
| 993 | + .addr = 0x6b, |
|---|
| 994 | + .flags = I2C_M_RD, |
|---|
| 995 | + .buf = ircode, |
|---|
| 996 | + .len = 4 |
|---|
| 997 | + }; |
|---|
| 828 | 998 | |
|---|
| 829 | 999 | if (usb_set_interface(adap->dev->udev, 0, 1) < 0) |
|---|
| 830 | 1000 | err("set interface failed"); |
|---|
| .. | .. |
|---|
| 840 | 1010 | dvb_attach(zl10353_attach, |
|---|
| 841 | 1011 | &cxusb_zl10353_xc3028_config_no_i2c_gate, |
|---|
| 842 | 1012 | &adap->dev->i2c_adap); |
|---|
| 843 | | - if ((adap->fe_adap[0].fe) == NULL) |
|---|
| 1013 | + if (!adap->fe_adap[0].fe) |
|---|
| 844 | 1014 | return -EIO; |
|---|
| 845 | 1015 | |
|---|
| 846 | 1016 | /* try to determine if there is no IR decoder on the I2C bus */ |
|---|
| .. | .. |
|---|
| 938 | 1108 | }; |
|---|
| 939 | 1109 | |
|---|
| 940 | 1110 | struct dib0700_adapter_state { |
|---|
| 941 | | - int (*set_param_save)(struct dvb_frontend *); |
|---|
| 1111 | + int (*set_param_save)(struct dvb_frontend *fe); |
|---|
| 942 | 1112 | struct dib7000p_ops dib7000p_ops; |
|---|
| 943 | 1113 | }; |
|---|
| 944 | 1114 | |
|---|
| .. | .. |
|---|
| 957 | 1127 | return -ENODEV; |
|---|
| 958 | 1128 | |
|---|
| 959 | 1129 | if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 18, |
|---|
| 960 | | - &cxusb_dualdig4_rev2_config) < 0) { |
|---|
| 961 | | - printk(KERN_WARNING "Unable to enumerate dib7000p\n"); |
|---|
| 1130 | + &cxusb_dualdig4_rev2_config) < 0) { |
|---|
| 1131 | + pr_warn("Unable to enumerate dib7000p\n"); |
|---|
| 962 | 1132 | return -ENODEV; |
|---|
| 963 | 1133 | } |
|---|
| 964 | 1134 | |
|---|
| 965 | | - adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 0x80, |
|---|
| 966 | | - &cxusb_dualdig4_rev2_config); |
|---|
| 967 | | - if (adap->fe_adap[0].fe == NULL) |
|---|
| 1135 | + adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, |
|---|
| 1136 | + 0x80, |
|---|
| 1137 | + &cxusb_dualdig4_rev2_config); |
|---|
| 1138 | + if (!adap->fe_adap[0].fe) |
|---|
| 968 | 1139 | return -EIO; |
|---|
| 969 | 1140 | |
|---|
| 970 | 1141 | return 0; |
|---|
| .. | .. |
|---|
| 997 | 1168 | struct dib0700_adapter_state *state = adap->priv; |
|---|
| 998 | 1169 | |
|---|
| 999 | 1170 | u16 offset; |
|---|
| 1000 | | - u8 band = BAND_OF_FREQUENCY(p->frequency/1000); |
|---|
| 1171 | + u8 band = BAND_OF_FREQUENCY(p->frequency / 1000); |
|---|
| 1172 | + |
|---|
| 1001 | 1173 | switch (band) { |
|---|
| 1002 | | - case BAND_VHF: offset = 950; break; |
|---|
| 1174 | + case BAND_VHF: |
|---|
| 1175 | + offset = 950; |
|---|
| 1176 | + break; |
|---|
| 1003 | 1177 | default: |
|---|
| 1004 | | - case BAND_UHF: offset = 550; break; |
|---|
| 1178 | + case BAND_UHF: |
|---|
| 1179 | + offset = 550; |
|---|
| 1180 | + break; |
|---|
| 1005 | 1181 | } |
|---|
| 1006 | 1182 | |
|---|
| 1007 | 1183 | state->dib7000p_ops.set_wbd_ref(fe, offset + dib0070_wbd_offset(fe)); |
|---|
| .. | .. |
|---|
| 1017 | 1193 | /* |
|---|
| 1018 | 1194 | * No need to call dvb7000p_attach here, as it was called |
|---|
| 1019 | 1195 | * already, as frontend_attach method is called first, and |
|---|
| 1020 | | - * tuner_attach is only called on sucess. |
|---|
| 1196 | + * tuner_attach is only called on success. |
|---|
| 1021 | 1197 | */ |
|---|
| 1022 | 1198 | tun_i2c = st->dib7000p_ops.get_i2c_master(adap->fe_adap[0].fe, |
|---|
| 1023 | 1199 | DIBX000_I2C_INTERFACE_TUNER, 1); |
|---|
| 1024 | 1200 | |
|---|
| 1025 | 1201 | if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c, |
|---|
| 1026 | | - &dib7070p_dib0070_config) == NULL) |
|---|
| 1202 | + &dib7070p_dib0070_config) == NULL) |
|---|
| 1027 | 1203 | return -ENODEV; |
|---|
| 1028 | 1204 | |
|---|
| 1029 | 1205 | st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params; |
|---|
| .. | .. |
|---|
| 1046 | 1222 | adap->fe_adap[0].fe = dvb_attach(zl10353_attach, |
|---|
| 1047 | 1223 | &cxusb_zl10353_xc3028_config, |
|---|
| 1048 | 1224 | &adap->dev->i2c_adap); |
|---|
| 1049 | | - if ((adap->fe_adap[0].fe) != NULL) |
|---|
| 1225 | + if (adap->fe_adap[0].fe) |
|---|
| 1050 | 1226 | return 0; |
|---|
| 1051 | 1227 | |
|---|
| 1052 | 1228 | adap->fe_adap[0].fe = dvb_attach(mt352_attach, |
|---|
| 1053 | 1229 | &cxusb_mt352_xc3028_config, |
|---|
| 1054 | 1230 | &adap->dev->i2c_adap); |
|---|
| 1055 | | - if ((adap->fe_adap[0].fe) != NULL) |
|---|
| 1231 | + if (adap->fe_adap[0].fe) |
|---|
| 1056 | 1232 | return 0; |
|---|
| 1057 | 1233 | |
|---|
| 1058 | 1234 | return -EIO; |
|---|
| .. | .. |
|---|
| 1083 | 1259 | |
|---|
| 1084 | 1260 | /* Unblock all USB pipes */ |
|---|
| 1085 | 1261 | usb_clear_halt(d->udev, |
|---|
| 1086 | | - usb_sndbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint)); |
|---|
| 1262 | + usb_sndbulkpipe(d->udev, |
|---|
| 1263 | + d->props.generic_bulk_ctrl_endpoint)); |
|---|
| 1087 | 1264 | usb_clear_halt(d->udev, |
|---|
| 1088 | | - usb_rcvbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint)); |
|---|
| 1265 | + usb_rcvbulkpipe(d->udev, |
|---|
| 1266 | + d->props.generic_bulk_ctrl_endpoint)); |
|---|
| 1089 | 1267 | usb_clear_halt(d->udev, |
|---|
| 1090 | | - usb_rcvbulkpipe(d->udev, d->props.adapter[0].fe[0].stream.endpoint)); |
|---|
| 1268 | + usb_rcvbulkpipe(d->udev, |
|---|
| 1269 | + d->props.adapter[0].fe[0].stream.endpoint)); |
|---|
| 1091 | 1270 | |
|---|
| 1092 | 1271 | /* Drain USB pipes to avoid hang after reboot */ |
|---|
| 1093 | 1272 | for (n = 0; n < 5; n++) { |
|---|
| .. | .. |
|---|
| 1109 | 1288 | msleep(100); |
|---|
| 1110 | 1289 | |
|---|
| 1111 | 1290 | /* Attach frontend */ |
|---|
| 1112 | | - adap->fe_adap[0].fe = dvb_attach(lgs8gxx_attach, &d680_lgs8gl5_cfg, &d->i2c_adap); |
|---|
| 1113 | | - if (adap->fe_adap[0].fe == NULL) |
|---|
| 1291 | + adap->fe_adap[0].fe = dvb_attach(lgs8gxx_attach, |
|---|
| 1292 | + &d680_lgs8gl5_cfg, &d->i2c_adap); |
|---|
| 1293 | + if (!adap->fe_adap[0].fe) |
|---|
| 1114 | 1294 | return -EIO; |
|---|
| 1115 | 1295 | |
|---|
| 1116 | 1296 | return 0; |
|---|
| .. | .. |
|---|
| 1140 | 1320 | |
|---|
| 1141 | 1321 | /* Unblock all USB pipes */ |
|---|
| 1142 | 1322 | usb_clear_halt(d->udev, |
|---|
| 1143 | | - usb_sndbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint)); |
|---|
| 1323 | + usb_sndbulkpipe(d->udev, |
|---|
| 1324 | + d->props.generic_bulk_ctrl_endpoint)); |
|---|
| 1144 | 1325 | usb_clear_halt(d->udev, |
|---|
| 1145 | | - usb_rcvbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint)); |
|---|
| 1326 | + usb_rcvbulkpipe(d->udev, |
|---|
| 1327 | + d->props.generic_bulk_ctrl_endpoint)); |
|---|
| 1146 | 1328 | usb_clear_halt(d->udev, |
|---|
| 1147 | | - usb_rcvbulkpipe(d->udev, d->props.adapter[0].fe[0].stream.endpoint)); |
|---|
| 1148 | | - |
|---|
| 1329 | + usb_rcvbulkpipe(d->udev, |
|---|
| 1330 | + d->props.adapter[0].fe[0].stream.endpoint)); |
|---|
| 1149 | 1331 | |
|---|
| 1150 | 1332 | /* Reset the tuner */ |
|---|
| 1151 | 1333 | if (cxusb_d680_dmb_gpio_tuner(d, 0x07, 0) < 0) { |
|---|
| .. | .. |
|---|
| 1160 | 1342 | msleep(100); |
|---|
| 1161 | 1343 | |
|---|
| 1162 | 1344 | /* Attach frontend */ |
|---|
| 1163 | | - adap->fe_adap[0].fe = dvb_attach(atbm8830_attach, &mygica_d689_atbm8830_cfg, |
|---|
| 1164 | | - &d->i2c_adap); |
|---|
| 1165 | | - if (adap->fe_adap[0].fe == NULL) |
|---|
| 1345 | + adap->fe_adap[0].fe = dvb_attach(atbm8830_attach, |
|---|
| 1346 | + &mygica_d689_atbm8830_cfg, |
|---|
| 1347 | + &d->i2c_adap); |
|---|
| 1348 | + if (!adap->fe_adap[0].fe) |
|---|
| 1166 | 1349 | return -EIO; |
|---|
| 1167 | | - |
|---|
| 1168 | | - return 0; |
|---|
| 1169 | | -} |
|---|
| 1170 | | - |
|---|
| 1171 | | -static int cxusb_mygica_t230_frontend_attach(struct dvb_usb_adapter *adap) |
|---|
| 1172 | | -{ |
|---|
| 1173 | | - struct dvb_usb_device *d = adap->dev; |
|---|
| 1174 | | - struct cxusb_state *st = d->priv; |
|---|
| 1175 | | - struct i2c_adapter *adapter; |
|---|
| 1176 | | - struct i2c_client *client_demod; |
|---|
| 1177 | | - struct i2c_client *client_tuner; |
|---|
| 1178 | | - struct i2c_board_info info; |
|---|
| 1179 | | - struct si2168_config si2168_config; |
|---|
| 1180 | | - struct si2157_config si2157_config; |
|---|
| 1181 | | - |
|---|
| 1182 | | - /* Select required USB configuration */ |
|---|
| 1183 | | - if (usb_set_interface(d->udev, 0, 0) < 0) |
|---|
| 1184 | | - err("set interface failed"); |
|---|
| 1185 | | - |
|---|
| 1186 | | - /* Unblock all USB pipes */ |
|---|
| 1187 | | - usb_clear_halt(d->udev, |
|---|
| 1188 | | - usb_sndbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint)); |
|---|
| 1189 | | - usb_clear_halt(d->udev, |
|---|
| 1190 | | - usb_rcvbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint)); |
|---|
| 1191 | | - usb_clear_halt(d->udev, |
|---|
| 1192 | | - usb_rcvbulkpipe(d->udev, d->props.adapter[0].fe[0].stream.endpoint)); |
|---|
| 1193 | | - |
|---|
| 1194 | | - /* attach frontend */ |
|---|
| 1195 | | - si2168_config.i2c_adapter = &adapter; |
|---|
| 1196 | | - si2168_config.fe = &adap->fe_adap[0].fe; |
|---|
| 1197 | | - si2168_config.ts_mode = SI2168_TS_PARALLEL; |
|---|
| 1198 | | - si2168_config.ts_clock_inv = 1; |
|---|
| 1199 | | - memset(&info, 0, sizeof(struct i2c_board_info)); |
|---|
| 1200 | | - strlcpy(info.type, "si2168", I2C_NAME_SIZE); |
|---|
| 1201 | | - info.addr = 0x64; |
|---|
| 1202 | | - info.platform_data = &si2168_config; |
|---|
| 1203 | | - request_module(info.type); |
|---|
| 1204 | | - client_demod = i2c_new_device(&d->i2c_adap, &info); |
|---|
| 1205 | | - if (client_demod == NULL || client_demod->dev.driver == NULL) |
|---|
| 1206 | | - return -ENODEV; |
|---|
| 1207 | | - |
|---|
| 1208 | | - if (!try_module_get(client_demod->dev.driver->owner)) { |
|---|
| 1209 | | - i2c_unregister_device(client_demod); |
|---|
| 1210 | | - return -ENODEV; |
|---|
| 1211 | | - } |
|---|
| 1212 | | - |
|---|
| 1213 | | - st->i2c_client_demod = client_demod; |
|---|
| 1214 | | - |
|---|
| 1215 | | - /* attach tuner */ |
|---|
| 1216 | | - memset(&si2157_config, 0, sizeof(si2157_config)); |
|---|
| 1217 | | - si2157_config.fe = adap->fe_adap[0].fe; |
|---|
| 1218 | | - si2157_config.if_port = 1; |
|---|
| 1219 | | - memset(&info, 0, sizeof(struct i2c_board_info)); |
|---|
| 1220 | | - strlcpy(info.type, "si2157", I2C_NAME_SIZE); |
|---|
| 1221 | | - info.addr = 0x60; |
|---|
| 1222 | | - info.platform_data = &si2157_config; |
|---|
| 1223 | | - request_module(info.type); |
|---|
| 1224 | | - client_tuner = i2c_new_device(adapter, &info); |
|---|
| 1225 | | - if (client_tuner == NULL || client_tuner->dev.driver == NULL) { |
|---|
| 1226 | | - module_put(client_demod->dev.driver->owner); |
|---|
| 1227 | | - i2c_unregister_device(client_demod); |
|---|
| 1228 | | - return -ENODEV; |
|---|
| 1229 | | - } |
|---|
| 1230 | | - if (!try_module_get(client_tuner->dev.driver->owner)) { |
|---|
| 1231 | | - i2c_unregister_device(client_tuner); |
|---|
| 1232 | | - module_put(client_demod->dev.driver->owner); |
|---|
| 1233 | | - i2c_unregister_device(client_demod); |
|---|
| 1234 | | - return -ENODEV; |
|---|
| 1235 | | - } |
|---|
| 1236 | | - |
|---|
| 1237 | | - st->i2c_client_tuner = client_tuner; |
|---|
| 1238 | | - |
|---|
| 1239 | | - /* hook fe: need to resync the slave fifo when signal locks. */ |
|---|
| 1240 | | - mutex_init(&st->stream_mutex); |
|---|
| 1241 | | - st->last_lock = 0; |
|---|
| 1242 | | - st->fe_read_status = adap->fe_adap[0].fe->ops.read_status; |
|---|
| 1243 | | - adap->fe_adap[0].fe->ops.read_status = cxusb_read_status; |
|---|
| 1244 | 1350 | |
|---|
| 1245 | 1351 | return 0; |
|---|
| 1246 | 1352 | } |
|---|
| .. | .. |
|---|
| 1252 | 1358 | * not, and forget a match if it turns out we selected the wrong device. |
|---|
| 1253 | 1359 | */ |
|---|
| 1254 | 1360 | static int bluebird_fx2_identify_state(struct usb_device *udev, |
|---|
| 1255 | | - struct dvb_usb_device_properties *props, |
|---|
| 1256 | | - struct dvb_usb_device_description **desc, |
|---|
| 1361 | + const struct dvb_usb_device_properties *props, |
|---|
| 1362 | + const struct dvb_usb_device_description **desc, |
|---|
| 1257 | 1363 | int *cold) |
|---|
| 1258 | 1364 | { |
|---|
| 1259 | 1365 | int wascold = *cold; |
|---|
| .. | .. |
|---|
| 1313 | 1419 | return -EINVAL; |
|---|
| 1314 | 1420 | } |
|---|
| 1315 | 1421 | |
|---|
| 1422 | +int cxusb_medion_get(struct dvb_usb_device *dvbdev, |
|---|
| 1423 | + enum cxusb_open_type open_type) |
|---|
| 1424 | +{ |
|---|
| 1425 | + struct cxusb_medion_dev *cxdev = dvbdev->priv; |
|---|
| 1426 | + int ret = 0; |
|---|
| 1427 | + |
|---|
| 1428 | + mutex_lock(&cxdev->open_lock); |
|---|
| 1429 | + |
|---|
| 1430 | + if (WARN_ON((cxdev->open_type == CXUSB_OPEN_INIT || |
|---|
| 1431 | + cxdev->open_type == CXUSB_OPEN_NONE) && |
|---|
| 1432 | + cxdev->open_ctr != 0)) { |
|---|
| 1433 | + ret = -EINVAL; |
|---|
| 1434 | + goto ret_unlock; |
|---|
| 1435 | + } |
|---|
| 1436 | + |
|---|
| 1437 | + if (cxdev->open_type == CXUSB_OPEN_INIT) { |
|---|
| 1438 | + ret = -EAGAIN; |
|---|
| 1439 | + goto ret_unlock; |
|---|
| 1440 | + } |
|---|
| 1441 | + |
|---|
| 1442 | + if (cxdev->open_ctr == 0) { |
|---|
| 1443 | + if (cxdev->open_type != open_type) { |
|---|
| 1444 | + dev_info(&dvbdev->udev->dev, "will acquire and switch to %s\n", |
|---|
| 1445 | + open_type == CXUSB_OPEN_ANALOG ? |
|---|
| 1446 | + "analog" : "digital"); |
|---|
| 1447 | + |
|---|
| 1448 | + if (open_type == CXUSB_OPEN_ANALOG) { |
|---|
| 1449 | + ret = _cxusb_power_ctrl(dvbdev, 1); |
|---|
| 1450 | + if (ret != 0) |
|---|
| 1451 | + dev_warn(&dvbdev->udev->dev, |
|---|
| 1452 | + "powerup for analog switch failed (%d)\n", |
|---|
| 1453 | + ret); |
|---|
| 1454 | + |
|---|
| 1455 | + ret = cxusb_medion_set_mode(dvbdev, false); |
|---|
| 1456 | + if (ret != 0) |
|---|
| 1457 | + goto ret_unlock; |
|---|
| 1458 | + |
|---|
| 1459 | + ret = cxusb_medion_analog_init(dvbdev); |
|---|
| 1460 | + if (ret != 0) |
|---|
| 1461 | + goto ret_unlock; |
|---|
| 1462 | + } else { /* digital */ |
|---|
| 1463 | + ret = _cxusb_power_ctrl(dvbdev, 1); |
|---|
| 1464 | + if (ret != 0) |
|---|
| 1465 | + dev_warn(&dvbdev->udev->dev, |
|---|
| 1466 | + "powerup for digital switch failed (%d)\n", |
|---|
| 1467 | + ret); |
|---|
| 1468 | + |
|---|
| 1469 | + ret = cxusb_medion_set_mode(dvbdev, true); |
|---|
| 1470 | + if (ret != 0) |
|---|
| 1471 | + goto ret_unlock; |
|---|
| 1472 | + } |
|---|
| 1473 | + |
|---|
| 1474 | + cxdev->open_type = open_type; |
|---|
| 1475 | + } else { |
|---|
| 1476 | + dev_info(&dvbdev->udev->dev, "reacquired idle %s\n", |
|---|
| 1477 | + open_type == CXUSB_OPEN_ANALOG ? |
|---|
| 1478 | + "analog" : "digital"); |
|---|
| 1479 | + } |
|---|
| 1480 | + |
|---|
| 1481 | + cxdev->open_ctr = 1; |
|---|
| 1482 | + } else if (cxdev->open_type == open_type) { |
|---|
| 1483 | + cxdev->open_ctr++; |
|---|
| 1484 | + dev_info(&dvbdev->udev->dev, "acquired %s\n", |
|---|
| 1485 | + open_type == CXUSB_OPEN_ANALOG ? "analog" : "digital"); |
|---|
| 1486 | + } else { |
|---|
| 1487 | + ret = -EBUSY; |
|---|
| 1488 | + } |
|---|
| 1489 | + |
|---|
| 1490 | +ret_unlock: |
|---|
| 1491 | + mutex_unlock(&cxdev->open_lock); |
|---|
| 1492 | + |
|---|
| 1493 | + return ret; |
|---|
| 1494 | +} |
|---|
| 1495 | + |
|---|
| 1496 | +void cxusb_medion_put(struct dvb_usb_device *dvbdev) |
|---|
| 1497 | +{ |
|---|
| 1498 | + struct cxusb_medion_dev *cxdev = dvbdev->priv; |
|---|
| 1499 | + |
|---|
| 1500 | + mutex_lock(&cxdev->open_lock); |
|---|
| 1501 | + |
|---|
| 1502 | + if (cxdev->open_type == CXUSB_OPEN_INIT) { |
|---|
| 1503 | + WARN_ON(cxdev->open_ctr != 0); |
|---|
| 1504 | + cxdev->open_type = CXUSB_OPEN_NONE; |
|---|
| 1505 | + goto unlock; |
|---|
| 1506 | + } |
|---|
| 1507 | + |
|---|
| 1508 | + if (!WARN_ON(cxdev->open_ctr < 1)) { |
|---|
| 1509 | + cxdev->open_ctr--; |
|---|
| 1510 | + |
|---|
| 1511 | + dev_info(&dvbdev->udev->dev, "release %s\n", |
|---|
| 1512 | + cxdev->open_type == CXUSB_OPEN_ANALOG ? |
|---|
| 1513 | + "analog" : "digital"); |
|---|
| 1514 | + } |
|---|
| 1515 | + |
|---|
| 1516 | +unlock: |
|---|
| 1517 | + mutex_unlock(&cxdev->open_lock); |
|---|
| 1518 | +} |
|---|
| 1519 | + |
|---|
| 1316 | 1520 | /* DVB USB Driver stuff */ |
|---|
| 1317 | 1521 | static struct dvb_usb_device_properties cxusb_medion_properties; |
|---|
| 1318 | 1522 | static struct dvb_usb_device_properties cxusb_bluebird_lgh064f_properties; |
|---|
| .. | .. |
|---|
| 1326 | 1530 | static struct dvb_usb_device_properties cxusb_aver_a868r_properties; |
|---|
| 1327 | 1531 | static struct dvb_usb_device_properties cxusb_d680_dmb_properties; |
|---|
| 1328 | 1532 | static struct dvb_usb_device_properties cxusb_mygica_d689_properties; |
|---|
| 1329 | | -static struct dvb_usb_device_properties cxusb_mygica_t230_properties; |
|---|
| 1533 | + |
|---|
| 1534 | +static int cxusb_medion_priv_init(struct dvb_usb_device *dvbdev) |
|---|
| 1535 | +{ |
|---|
| 1536 | + struct cxusb_medion_dev *cxdev = dvbdev->priv; |
|---|
| 1537 | + |
|---|
| 1538 | + cxdev->dvbdev = dvbdev; |
|---|
| 1539 | + cxdev->open_type = CXUSB_OPEN_INIT; |
|---|
| 1540 | + mutex_init(&cxdev->open_lock); |
|---|
| 1541 | + |
|---|
| 1542 | + return 0; |
|---|
| 1543 | +} |
|---|
| 1544 | + |
|---|
| 1545 | +static void cxusb_medion_priv_destroy(struct dvb_usb_device *dvbdev) |
|---|
| 1546 | +{ |
|---|
| 1547 | + struct cxusb_medion_dev *cxdev = dvbdev->priv; |
|---|
| 1548 | + |
|---|
| 1549 | + mutex_destroy(&cxdev->open_lock); |
|---|
| 1550 | +} |
|---|
| 1551 | + |
|---|
| 1552 | +static bool cxusb_medion_check_altsetting(struct usb_host_interface *as) |
|---|
| 1553 | +{ |
|---|
| 1554 | + unsigned int ctr; |
|---|
| 1555 | + |
|---|
| 1556 | + for (ctr = 0; ctr < as->desc.bNumEndpoints; ctr++) { |
|---|
| 1557 | + if ((as->endpoint[ctr].desc.bEndpointAddress & |
|---|
| 1558 | + USB_ENDPOINT_NUMBER_MASK) != 2) |
|---|
| 1559 | + continue; |
|---|
| 1560 | + |
|---|
| 1561 | + if (as->endpoint[ctr].desc.bEndpointAddress & USB_DIR_IN && |
|---|
| 1562 | + ((as->endpoint[ctr].desc.bmAttributes & |
|---|
| 1563 | + USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_ISOC)) |
|---|
| 1564 | + return true; |
|---|
| 1565 | + |
|---|
| 1566 | + break; |
|---|
| 1567 | + } |
|---|
| 1568 | + |
|---|
| 1569 | + return false; |
|---|
| 1570 | +} |
|---|
| 1571 | + |
|---|
| 1572 | +static bool cxusb_medion_check_intf(struct usb_interface *intf) |
|---|
| 1573 | +{ |
|---|
| 1574 | + unsigned int ctr; |
|---|
| 1575 | + |
|---|
| 1576 | + if (intf->num_altsetting < 2) { |
|---|
| 1577 | + dev_err(intf->usb_dev, "no alternate interface"); |
|---|
| 1578 | + |
|---|
| 1579 | + return false; |
|---|
| 1580 | + } |
|---|
| 1581 | + |
|---|
| 1582 | + for (ctr = 0; ctr < intf->num_altsetting; ctr++) { |
|---|
| 1583 | + if (intf->altsetting[ctr].desc.bAlternateSetting != 1) |
|---|
| 1584 | + continue; |
|---|
| 1585 | + |
|---|
| 1586 | + if (cxusb_medion_check_altsetting(&intf->altsetting[ctr])) |
|---|
| 1587 | + return true; |
|---|
| 1588 | + |
|---|
| 1589 | + break; |
|---|
| 1590 | + } |
|---|
| 1591 | + |
|---|
| 1592 | + dev_err(intf->usb_dev, "no iso interface"); |
|---|
| 1593 | + |
|---|
| 1594 | + return false; |
|---|
| 1595 | +} |
|---|
| 1330 | 1596 | |
|---|
| 1331 | 1597 | static int cxusb_probe(struct usb_interface *intf, |
|---|
| 1332 | 1598 | const struct usb_device_id *id) |
|---|
| 1333 | 1599 | { |
|---|
| 1334 | | - if (0 == dvb_usb_device_init(intf, &cxusb_medion_properties, |
|---|
| 1335 | | - THIS_MODULE, NULL, adapter_nr) || |
|---|
| 1336 | | - 0 == dvb_usb_device_init(intf, &cxusb_bluebird_lgh064f_properties, |
|---|
| 1337 | | - THIS_MODULE, NULL, adapter_nr) || |
|---|
| 1338 | | - 0 == dvb_usb_device_init(intf, &cxusb_bluebird_dee1601_properties, |
|---|
| 1339 | | - THIS_MODULE, NULL, adapter_nr) || |
|---|
| 1340 | | - 0 == dvb_usb_device_init(intf, &cxusb_bluebird_lgz201_properties, |
|---|
| 1341 | | - THIS_MODULE, NULL, adapter_nr) || |
|---|
| 1342 | | - 0 == dvb_usb_device_init(intf, &cxusb_bluebird_dtt7579_properties, |
|---|
| 1343 | | - THIS_MODULE, NULL, adapter_nr) || |
|---|
| 1344 | | - 0 == dvb_usb_device_init(intf, &cxusb_bluebird_dualdig4_properties, |
|---|
| 1345 | | - THIS_MODULE, NULL, adapter_nr) || |
|---|
| 1346 | | - 0 == dvb_usb_device_init(intf, &cxusb_bluebird_nano2_properties, |
|---|
| 1347 | | - THIS_MODULE, NULL, adapter_nr) || |
|---|
| 1348 | | - 0 == dvb_usb_device_init(intf, |
|---|
| 1349 | | - &cxusb_bluebird_nano2_needsfirmware_properties, |
|---|
| 1350 | | - THIS_MODULE, NULL, adapter_nr) || |
|---|
| 1351 | | - 0 == dvb_usb_device_init(intf, &cxusb_aver_a868r_properties, |
|---|
| 1352 | | - THIS_MODULE, NULL, adapter_nr) || |
|---|
| 1353 | | - 0 == dvb_usb_device_init(intf, |
|---|
| 1354 | | - &cxusb_bluebird_dualdig4_rev2_properties, |
|---|
| 1355 | | - THIS_MODULE, NULL, adapter_nr) || |
|---|
| 1356 | | - 0 == dvb_usb_device_init(intf, &cxusb_d680_dmb_properties, |
|---|
| 1357 | | - THIS_MODULE, NULL, adapter_nr) || |
|---|
| 1358 | | - 0 == dvb_usb_device_init(intf, &cxusb_mygica_d689_properties, |
|---|
| 1359 | | - THIS_MODULE, NULL, adapter_nr) || |
|---|
| 1360 | | - 0 == dvb_usb_device_init(intf, &cxusb_mygica_t230_properties, |
|---|
| 1361 | | - THIS_MODULE, NULL, adapter_nr) || |
|---|
| 1362 | | - 0) |
|---|
| 1600 | + struct dvb_usb_device *dvbdev; |
|---|
| 1601 | + int ret; |
|---|
| 1602 | + |
|---|
| 1603 | + /* Medion 95700 */ |
|---|
| 1604 | + if (!dvb_usb_device_init(intf, &cxusb_medion_properties, |
|---|
| 1605 | + THIS_MODULE, &dvbdev, adapter_nr)) { |
|---|
| 1606 | + if (!cxusb_medion_check_intf(intf)) { |
|---|
| 1607 | + ret = -ENODEV; |
|---|
| 1608 | + goto ret_uninit; |
|---|
| 1609 | + } |
|---|
| 1610 | + |
|---|
| 1611 | + _cxusb_power_ctrl(dvbdev, 1); |
|---|
| 1612 | + ret = cxusb_medion_set_mode(dvbdev, false); |
|---|
| 1613 | + if (ret) |
|---|
| 1614 | + goto ret_uninit; |
|---|
| 1615 | + |
|---|
| 1616 | + ret = cxusb_medion_register_analog(dvbdev); |
|---|
| 1617 | + |
|---|
| 1618 | + cxusb_medion_set_mode(dvbdev, true); |
|---|
| 1619 | + _cxusb_power_ctrl(dvbdev, 0); |
|---|
| 1620 | + |
|---|
| 1621 | + if (ret != 0) |
|---|
| 1622 | + goto ret_uninit; |
|---|
| 1623 | + |
|---|
| 1624 | + /* release device from INIT mode to normal operation */ |
|---|
| 1625 | + cxusb_medion_put(dvbdev); |
|---|
| 1626 | + |
|---|
| 1627 | + return 0; |
|---|
| 1628 | + } else if (!dvb_usb_device_init(intf, |
|---|
| 1629 | + &cxusb_bluebird_lgh064f_properties, |
|---|
| 1630 | + THIS_MODULE, NULL, adapter_nr) || |
|---|
| 1631 | + !dvb_usb_device_init(intf, |
|---|
| 1632 | + &cxusb_bluebird_dee1601_properties, |
|---|
| 1633 | + THIS_MODULE, NULL, adapter_nr) || |
|---|
| 1634 | + !dvb_usb_device_init(intf, |
|---|
| 1635 | + &cxusb_bluebird_lgz201_properties, |
|---|
| 1636 | + THIS_MODULE, NULL, adapter_nr) || |
|---|
| 1637 | + !dvb_usb_device_init(intf, |
|---|
| 1638 | + &cxusb_bluebird_dtt7579_properties, |
|---|
| 1639 | + THIS_MODULE, NULL, adapter_nr) || |
|---|
| 1640 | + !dvb_usb_device_init(intf, |
|---|
| 1641 | + &cxusb_bluebird_dualdig4_properties, |
|---|
| 1642 | + THIS_MODULE, NULL, adapter_nr) || |
|---|
| 1643 | + !dvb_usb_device_init(intf, |
|---|
| 1644 | + &cxusb_bluebird_nano2_properties, |
|---|
| 1645 | + THIS_MODULE, NULL, adapter_nr) || |
|---|
| 1646 | + !dvb_usb_device_init(intf, |
|---|
| 1647 | + &cxusb_bluebird_nano2_needsfirmware_properties, |
|---|
| 1648 | + THIS_MODULE, NULL, adapter_nr) || |
|---|
| 1649 | + !dvb_usb_device_init(intf, &cxusb_aver_a868r_properties, |
|---|
| 1650 | + THIS_MODULE, NULL, adapter_nr) || |
|---|
| 1651 | + !dvb_usb_device_init(intf, |
|---|
| 1652 | + &cxusb_bluebird_dualdig4_rev2_properties, |
|---|
| 1653 | + THIS_MODULE, NULL, adapter_nr) || |
|---|
| 1654 | + !dvb_usb_device_init(intf, &cxusb_d680_dmb_properties, |
|---|
| 1655 | + THIS_MODULE, NULL, adapter_nr) || |
|---|
| 1656 | + !dvb_usb_device_init(intf, &cxusb_mygica_d689_properties, |
|---|
| 1657 | + THIS_MODULE, NULL, adapter_nr) || |
|---|
| 1658 | + 0) |
|---|
| 1363 | 1659 | return 0; |
|---|
| 1364 | 1660 | |
|---|
| 1365 | 1661 | return -EINVAL; |
|---|
| 1662 | + |
|---|
| 1663 | +ret_uninit: |
|---|
| 1664 | + dvb_usb_device_exit(intf); |
|---|
| 1665 | + |
|---|
| 1666 | + return ret; |
|---|
| 1366 | 1667 | } |
|---|
| 1367 | 1668 | |
|---|
| 1368 | 1669 | static void cxusb_disconnect(struct usb_interface *intf) |
|---|
| .. | .. |
|---|
| 1370 | 1671 | struct dvb_usb_device *d = usb_get_intfdata(intf); |
|---|
| 1371 | 1672 | struct cxusb_state *st = d->priv; |
|---|
| 1372 | 1673 | struct i2c_client *client; |
|---|
| 1674 | + |
|---|
| 1675 | + if (d->props.devices[0].warm_ids[0] == &cxusb_table[MEDION_MD95700]) |
|---|
| 1676 | + cxusb_medion_unregister_analog(d); |
|---|
| 1373 | 1677 | |
|---|
| 1374 | 1678 | /* remove I2C client for tuner */ |
|---|
| 1375 | 1679 | client = st->i2c_client_tuner; |
|---|
| .. | .. |
|---|
| 1387 | 1691 | |
|---|
| 1388 | 1692 | dvb_usb_device_exit(intf); |
|---|
| 1389 | 1693 | } |
|---|
| 1390 | | - |
|---|
| 1391 | | -enum cxusb_table_index { |
|---|
| 1392 | | - MEDION_MD95700, |
|---|
| 1393 | | - DVICO_BLUEBIRD_LG064F_COLD, |
|---|
| 1394 | | - DVICO_BLUEBIRD_LG064F_WARM, |
|---|
| 1395 | | - DVICO_BLUEBIRD_DUAL_1_COLD, |
|---|
| 1396 | | - DVICO_BLUEBIRD_DUAL_1_WARM, |
|---|
| 1397 | | - DVICO_BLUEBIRD_LGZ201_COLD, |
|---|
| 1398 | | - DVICO_BLUEBIRD_LGZ201_WARM, |
|---|
| 1399 | | - DVICO_BLUEBIRD_TH7579_COLD, |
|---|
| 1400 | | - DVICO_BLUEBIRD_TH7579_WARM, |
|---|
| 1401 | | - DIGITALNOW_BLUEBIRD_DUAL_1_COLD, |
|---|
| 1402 | | - DIGITALNOW_BLUEBIRD_DUAL_1_WARM, |
|---|
| 1403 | | - DVICO_BLUEBIRD_DUAL_2_COLD, |
|---|
| 1404 | | - DVICO_BLUEBIRD_DUAL_2_WARM, |
|---|
| 1405 | | - DVICO_BLUEBIRD_DUAL_4, |
|---|
| 1406 | | - DVICO_BLUEBIRD_DVB_T_NANO_2, |
|---|
| 1407 | | - DVICO_BLUEBIRD_DVB_T_NANO_2_NFW_WARM, |
|---|
| 1408 | | - AVERMEDIA_VOLAR_A868R, |
|---|
| 1409 | | - DVICO_BLUEBIRD_DUAL_4_REV_2, |
|---|
| 1410 | | - CONEXANT_D680_DMB, |
|---|
| 1411 | | - MYGICA_D689, |
|---|
| 1412 | | - MYGICA_T230, |
|---|
| 1413 | | - NR__cxusb_table_index |
|---|
| 1414 | | -}; |
|---|
| 1415 | 1694 | |
|---|
| 1416 | 1695 | static struct usb_device_id cxusb_table[NR__cxusb_table_index + 1] = { |
|---|
| 1417 | 1696 | [MEDION_MD95700] = { |
|---|
| .. | .. |
|---|
| 1442 | 1721 | USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_TH7579_WARM) |
|---|
| 1443 | 1722 | }, |
|---|
| 1444 | 1723 | [DIGITALNOW_BLUEBIRD_DUAL_1_COLD] = { |
|---|
| 1445 | | - USB_DEVICE(USB_VID_DVICO, USB_PID_DIGITALNOW_BLUEBIRD_DUAL_1_COLD) |
|---|
| 1724 | + USB_DEVICE(USB_VID_DVICO, |
|---|
| 1725 | + USB_PID_DIGITALNOW_BLUEBIRD_DUAL_1_COLD) |
|---|
| 1446 | 1726 | }, |
|---|
| 1447 | 1727 | [DIGITALNOW_BLUEBIRD_DUAL_1_WARM] = { |
|---|
| 1448 | | - USB_DEVICE(USB_VID_DVICO, USB_PID_DIGITALNOW_BLUEBIRD_DUAL_1_WARM) |
|---|
| 1728 | + USB_DEVICE(USB_VID_DVICO, |
|---|
| 1729 | + USB_PID_DIGITALNOW_BLUEBIRD_DUAL_1_WARM) |
|---|
| 1449 | 1730 | }, |
|---|
| 1450 | 1731 | [DVICO_BLUEBIRD_DUAL_2_COLD] = { |
|---|
| 1451 | 1732 | USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_2_COLD) |
|---|
| .. | .. |
|---|
| 1460 | 1741 | USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DVB_T_NANO_2) |
|---|
| 1461 | 1742 | }, |
|---|
| 1462 | 1743 | [DVICO_BLUEBIRD_DVB_T_NANO_2_NFW_WARM] = { |
|---|
| 1463 | | - USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DVB_T_NANO_2_NFW_WARM) |
|---|
| 1744 | + USB_DEVICE(USB_VID_DVICO, |
|---|
| 1745 | + USB_PID_DVICO_BLUEBIRD_DVB_T_NANO_2_NFW_WARM) |
|---|
| 1464 | 1746 | }, |
|---|
| 1465 | 1747 | [AVERMEDIA_VOLAR_A868R] = { |
|---|
| 1466 | 1748 | USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR_A868R) |
|---|
| .. | .. |
|---|
| 1474 | 1756 | [MYGICA_D689] = { |
|---|
| 1475 | 1757 | USB_DEVICE(USB_VID_CONEXANT, USB_PID_MYGICA_D689) |
|---|
| 1476 | 1758 | }, |
|---|
| 1477 | | - [MYGICA_T230] = { |
|---|
| 1478 | | - USB_DEVICE(USB_VID_CONEXANT, USB_PID_MYGICA_T230) |
|---|
| 1479 | | - }, |
|---|
| 1480 | 1759 | {} /* Terminating entry */ |
|---|
| 1481 | 1760 | }; |
|---|
| 1482 | | -MODULE_DEVICE_TABLE (usb, cxusb_table); |
|---|
| 1761 | +MODULE_DEVICE_TABLE(usb, cxusb_table); |
|---|
| 1483 | 1762 | |
|---|
| 1484 | 1763 | static struct dvb_usb_device_properties cxusb_medion_properties = { |
|---|
| 1485 | 1764 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
|---|
| 1486 | 1765 | |
|---|
| 1487 | 1766 | .usb_ctrl = CYPRESS_FX2, |
|---|
| 1488 | 1767 | |
|---|
| 1489 | | - .size_of_priv = sizeof(struct cxusb_state), |
|---|
| 1768 | + .size_of_priv = sizeof(struct cxusb_medion_dev), |
|---|
| 1769 | + .priv_init = cxusb_medion_priv_init, |
|---|
| 1770 | + .priv_destroy = cxusb_medion_priv_destroy, |
|---|
| 1490 | 1771 | |
|---|
| 1491 | 1772 | .num_adapters = 1, |
|---|
| 1492 | 1773 | .adapter = { |
|---|
| .. | .. |
|---|
| 1507 | 1788 | } |
|---|
| 1508 | 1789 | } |
|---|
| 1509 | 1790 | }, |
|---|
| 1510 | | - }}, |
|---|
| 1791 | + } }, |
|---|
| 1511 | 1792 | }, |
|---|
| 1512 | 1793 | }, |
|---|
| 1513 | 1794 | .power_ctrl = cxusb_power_ctrl, |
|---|
| .. | .. |
|---|
| 1518 | 1799 | |
|---|
| 1519 | 1800 | .num_device_descs = 1, |
|---|
| 1520 | 1801 | .devices = { |
|---|
| 1521 | | - { "Medion MD95700 (MDUSBTV-HYBRID)", |
|---|
| 1802 | + { |
|---|
| 1803 | + "Medion MD95700 (MDUSBTV-HYBRID)", |
|---|
| 1522 | 1804 | { NULL }, |
|---|
| 1523 | 1805 | { &cxusb_table[MEDION_MD95700], NULL }, |
|---|
| 1524 | 1806 | }, |
|---|
| .. | .. |
|---|
| 1531 | 1813 | .usb_ctrl = DEVICE_SPECIFIC, |
|---|
| 1532 | 1814 | .firmware = "dvb-usb-bluebird-01.fw", |
|---|
| 1533 | 1815 | .download_firmware = bluebird_patch_dvico_firmware_download, |
|---|
| 1534 | | - /* use usb alt setting 0 for EP4 transfer (dvb-t), |
|---|
| 1535 | | - use usb alt setting 7 for EP2 transfer (atsc) */ |
|---|
| 1816 | + /* |
|---|
| 1817 | + * use usb alt setting 0 for EP4 transfer (dvb-t), |
|---|
| 1818 | + * use usb alt setting 7 for EP2 transfer (atsc) |
|---|
| 1819 | + */ |
|---|
| 1536 | 1820 | |
|---|
| 1537 | 1821 | .size_of_priv = sizeof(struct cxusb_state), |
|---|
| 1538 | 1822 | |
|---|
| .. | .. |
|---|
| 1556 | 1840 | } |
|---|
| 1557 | 1841 | } |
|---|
| 1558 | 1842 | }, |
|---|
| 1559 | | - }}, |
|---|
| 1843 | + } }, |
|---|
| 1560 | 1844 | }, |
|---|
| 1561 | 1845 | }, |
|---|
| 1562 | 1846 | |
|---|
| .. | .. |
|---|
| 1589 | 1873 | .usb_ctrl = DEVICE_SPECIFIC, |
|---|
| 1590 | 1874 | .firmware = "dvb-usb-bluebird-01.fw", |
|---|
| 1591 | 1875 | .download_firmware = bluebird_patch_dvico_firmware_download, |
|---|
| 1592 | | - /* use usb alt setting 0 for EP4 transfer (dvb-t), |
|---|
| 1593 | | - use usb alt setting 7 for EP2 transfer (atsc) */ |
|---|
| 1876 | + /* |
|---|
| 1877 | + * use usb alt setting 0 for EP4 transfer (dvb-t), |
|---|
| 1878 | + * use usb alt setting 7 for EP2 transfer (atsc) |
|---|
| 1879 | + */ |
|---|
| 1594 | 1880 | |
|---|
| 1595 | 1881 | .size_of_priv = sizeof(struct cxusb_state), |
|---|
| 1596 | 1882 | |
|---|
| .. | .. |
|---|
| 1613 | 1899 | } |
|---|
| 1614 | 1900 | } |
|---|
| 1615 | 1901 | }, |
|---|
| 1616 | | - }}, |
|---|
| 1902 | + } }, |
|---|
| 1617 | 1903 | }, |
|---|
| 1618 | 1904 | }, |
|---|
| 1619 | 1905 | |
|---|
| .. | .. |
|---|
| 1638 | 1924 | { &cxusb_table[DVICO_BLUEBIRD_DUAL_1_WARM], NULL }, |
|---|
| 1639 | 1925 | }, |
|---|
| 1640 | 1926 | { "DigitalNow DVB-T Dual USB", |
|---|
| 1641 | | - { &cxusb_table[DIGITALNOW_BLUEBIRD_DUAL_1_COLD], NULL }, |
|---|
| 1927 | + { &cxusb_table[DIGITALNOW_BLUEBIRD_DUAL_1_COLD], NULL }, |
|---|
| 1642 | 1928 | { &cxusb_table[DIGITALNOW_BLUEBIRD_DUAL_1_WARM], NULL }, |
|---|
| 1643 | 1929 | }, |
|---|
| 1644 | 1930 | { "DViCO FusionHDTV DVB-T Dual Digital 2", |
|---|
| .. | .. |
|---|
| 1654 | 1940 | .usb_ctrl = DEVICE_SPECIFIC, |
|---|
| 1655 | 1941 | .firmware = "dvb-usb-bluebird-01.fw", |
|---|
| 1656 | 1942 | .download_firmware = bluebird_patch_dvico_firmware_download, |
|---|
| 1657 | | - /* use usb alt setting 0 for EP4 transfer (dvb-t), |
|---|
| 1658 | | - use usb alt setting 7 for EP2 transfer (atsc) */ |
|---|
| 1943 | + /* |
|---|
| 1944 | + * use usb alt setting 0 for EP4 transfer (dvb-t), |
|---|
| 1945 | + * use usb alt setting 7 for EP2 transfer (atsc) |
|---|
| 1946 | + */ |
|---|
| 1659 | 1947 | |
|---|
| 1660 | 1948 | .size_of_priv = sizeof(struct cxusb_state), |
|---|
| 1661 | 1949 | |
|---|
| .. | .. |
|---|
| 1679 | 1967 | } |
|---|
| 1680 | 1968 | } |
|---|
| 1681 | 1969 | }, |
|---|
| 1682 | | - }}, |
|---|
| 1970 | + } }, |
|---|
| 1683 | 1971 | }, |
|---|
| 1684 | 1972 | }, |
|---|
| 1685 | 1973 | .power_ctrl = cxusb_bluebird_power_ctrl, |
|---|
| .. | .. |
|---|
| 1710 | 1998 | .usb_ctrl = DEVICE_SPECIFIC, |
|---|
| 1711 | 1999 | .firmware = "dvb-usb-bluebird-01.fw", |
|---|
| 1712 | 2000 | .download_firmware = bluebird_patch_dvico_firmware_download, |
|---|
| 1713 | | - /* use usb alt setting 0 for EP4 transfer (dvb-t), |
|---|
| 1714 | | - use usb alt setting 7 for EP2 transfer (atsc) */ |
|---|
| 2001 | + |
|---|
| 2002 | + /* |
|---|
| 2003 | + * use usb alt setting 0 for EP4 transfer (dvb-t), |
|---|
| 2004 | + * use usb alt setting 7 for EP2 transfer (atsc) |
|---|
| 2005 | + */ |
|---|
| 1715 | 2006 | |
|---|
| 1716 | 2007 | .size_of_priv = sizeof(struct cxusb_state), |
|---|
| 1717 | 2008 | |
|---|
| .. | .. |
|---|
| 1735 | 2026 | } |
|---|
| 1736 | 2027 | } |
|---|
| 1737 | 2028 | }, |
|---|
| 1738 | | - }}, |
|---|
| 2029 | + } }, |
|---|
| 1739 | 2030 | }, |
|---|
| 1740 | 2031 | }, |
|---|
| 1741 | 2032 | .power_ctrl = cxusb_bluebird_power_ctrl, |
|---|
| .. | .. |
|---|
| 1787 | 2078 | } |
|---|
| 1788 | 2079 | } |
|---|
| 1789 | 2080 | }, |
|---|
| 1790 | | - }}, |
|---|
| 2081 | + } }, |
|---|
| 1791 | 2082 | }, |
|---|
| 1792 | 2083 | }, |
|---|
| 1793 | 2084 | |
|---|
| .. | .. |
|---|
| 1841 | 2132 | } |
|---|
| 1842 | 2133 | } |
|---|
| 1843 | 2134 | }, |
|---|
| 1844 | | - }}, |
|---|
| 2135 | + } }, |
|---|
| 1845 | 2136 | }, |
|---|
| 1846 | 2137 | }, |
|---|
| 1847 | 2138 | |
|---|
| .. | .. |
|---|
| 1868 | 2159 | } |
|---|
| 1869 | 2160 | }; |
|---|
| 1870 | 2161 | |
|---|
| 1871 | | -static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_properties = { |
|---|
| 2162 | +static struct dvb_usb_device_properties |
|---|
| 2163 | +cxusb_bluebird_nano2_needsfirmware_properties = { |
|---|
| 1872 | 2164 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
|---|
| 1873 | 2165 | |
|---|
| 1874 | 2166 | .usb_ctrl = DEVICE_SPECIFIC, |
|---|
| .. | .. |
|---|
| 1897 | 2189 | } |
|---|
| 1898 | 2190 | } |
|---|
| 1899 | 2191 | }, |
|---|
| 1900 | | - }}, |
|---|
| 2192 | + } }, |
|---|
| 1901 | 2193 | }, |
|---|
| 1902 | 2194 | }, |
|---|
| 1903 | 2195 | |
|---|
| .. | .. |
|---|
| 1916 | 2208 | }, |
|---|
| 1917 | 2209 | |
|---|
| 1918 | 2210 | .num_device_descs = 1, |
|---|
| 1919 | | - .devices = { |
|---|
| 1920 | | - { "DViCO FusionHDTV DVB-T NANO2 w/o firmware", |
|---|
| 2211 | + .devices = { { |
|---|
| 2212 | + "DViCO FusionHDTV DVB-T NANO2 w/o firmware", |
|---|
| 1921 | 2213 | { &cxusb_table[DVICO_BLUEBIRD_DVB_T_NANO_2], NULL }, |
|---|
| 1922 | | - { &cxusb_table[DVICO_BLUEBIRD_DVB_T_NANO_2_NFW_WARM], NULL }, |
|---|
| 2214 | + { &cxusb_table[DVICO_BLUEBIRD_DVB_T_NANO_2_NFW_WARM], |
|---|
| 2215 | + NULL }, |
|---|
| 1923 | 2216 | }, |
|---|
| 1924 | 2217 | } |
|---|
| 1925 | 2218 | }; |
|---|
| .. | .. |
|---|
| 1950 | 2243 | } |
|---|
| 1951 | 2244 | } |
|---|
| 1952 | 2245 | }, |
|---|
| 1953 | | - }}, |
|---|
| 2246 | + } }, |
|---|
| 1954 | 2247 | }, |
|---|
| 1955 | 2248 | }, |
|---|
| 1956 | 2249 | .power_ctrl = cxusb_aver_power_ctrl, |
|---|
| .. | .. |
|---|
| 1996 | 2289 | } |
|---|
| 1997 | 2290 | } |
|---|
| 1998 | 2291 | }, |
|---|
| 1999 | | - }}, |
|---|
| 2292 | + } }, |
|---|
| 2000 | 2293 | }, |
|---|
| 2001 | 2294 | }, |
|---|
| 2002 | 2295 | |
|---|
| .. | .. |
|---|
| 2050 | 2343 | } |
|---|
| 2051 | 2344 | } |
|---|
| 2052 | 2345 | }, |
|---|
| 2053 | | - }}, |
|---|
| 2346 | + } }, |
|---|
| 2054 | 2347 | }, |
|---|
| 2055 | 2348 | }, |
|---|
| 2056 | 2349 | |
|---|
| .. | .. |
|---|
| 2105 | 2398 | } |
|---|
| 2106 | 2399 | } |
|---|
| 2107 | 2400 | }, |
|---|
| 2108 | | - }}, |
|---|
| 2401 | + } }, |
|---|
| 2109 | 2402 | }, |
|---|
| 2110 | 2403 | }, |
|---|
| 2111 | 2404 | |
|---|
| .. | .. |
|---|
| 2133 | 2426 | } |
|---|
| 2134 | 2427 | }; |
|---|
| 2135 | 2428 | |
|---|
| 2136 | | -static struct dvb_usb_device_properties cxusb_mygica_t230_properties = { |
|---|
| 2137 | | - .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
|---|
| 2138 | | - |
|---|
| 2139 | | - .usb_ctrl = CYPRESS_FX2, |
|---|
| 2140 | | - |
|---|
| 2141 | | - .size_of_priv = sizeof(struct cxusb_state), |
|---|
| 2142 | | - |
|---|
| 2143 | | - .num_adapters = 1, |
|---|
| 2144 | | - .adapter = { |
|---|
| 2145 | | - { |
|---|
| 2146 | | - .num_frontends = 1, |
|---|
| 2147 | | - .fe = {{ |
|---|
| 2148 | | - .streaming_ctrl = cxusb_streaming_ctrl, |
|---|
| 2149 | | - .frontend_attach = cxusb_mygica_t230_frontend_attach, |
|---|
| 2150 | | - |
|---|
| 2151 | | - /* parameter for the MPEG2-data transfer */ |
|---|
| 2152 | | - .stream = { |
|---|
| 2153 | | - .type = USB_BULK, |
|---|
| 2154 | | - .count = 5, |
|---|
| 2155 | | - .endpoint = 0x02, |
|---|
| 2156 | | - .u = { |
|---|
| 2157 | | - .bulk = { |
|---|
| 2158 | | - .buffersize = 8192, |
|---|
| 2159 | | - } |
|---|
| 2160 | | - } |
|---|
| 2161 | | - }, |
|---|
| 2162 | | - } }, |
|---|
| 2163 | | - }, |
|---|
| 2164 | | - }, |
|---|
| 2165 | | - |
|---|
| 2166 | | - .power_ctrl = cxusb_d680_dmb_power_ctrl, |
|---|
| 2167 | | - |
|---|
| 2168 | | - .i2c_algo = &cxusb_i2c_algo, |
|---|
| 2169 | | - |
|---|
| 2170 | | - .generic_bulk_ctrl_endpoint = 0x01, |
|---|
| 2171 | | - |
|---|
| 2172 | | - .rc.core = { |
|---|
| 2173 | | - .rc_interval = 100, |
|---|
| 2174 | | - .rc_codes = RC_MAP_D680_DMB, |
|---|
| 2175 | | - .module_name = KBUILD_MODNAME, |
|---|
| 2176 | | - .rc_query = cxusb_d680_dmb_rc_query, |
|---|
| 2177 | | - .allowed_protos = RC_PROTO_BIT_UNKNOWN, |
|---|
| 2178 | | - }, |
|---|
| 2179 | | - |
|---|
| 2180 | | - .num_device_descs = 1, |
|---|
| 2181 | | - .devices = { |
|---|
| 2182 | | - { |
|---|
| 2183 | | - "Mygica T230 DVB-T/T2/C", |
|---|
| 2184 | | - { NULL }, |
|---|
| 2185 | | - { &cxusb_table[MYGICA_T230], NULL }, |
|---|
| 2186 | | - }, |
|---|
| 2187 | | - } |
|---|
| 2188 | | -}; |
|---|
| 2189 | | - |
|---|
| 2190 | 2429 | static struct usb_driver cxusb_driver = { |
|---|
| 2191 | 2430 | .name = "dvb_usb_cxusb", |
|---|
| 2192 | 2431 | .probe = cxusb_probe, |
|---|
| .. | .. |
|---|
| 2199 | 2438 | MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@posteo.de>"); |
|---|
| 2200 | 2439 | MODULE_AUTHOR("Michael Krufky <mkrufky@linuxtv.org>"); |
|---|
| 2201 | 2440 | MODULE_AUTHOR("Chris Pascoe <c.pascoe@itee.uq.edu.au>"); |
|---|
| 2441 | +MODULE_AUTHOR("Maciej S. Szmigiero <mail@maciej.szmigiero.name>"); |
|---|
| 2202 | 2442 | MODULE_DESCRIPTION("Driver for Conexant USB2.0 hybrid reference design"); |
|---|
| 2203 | | -MODULE_VERSION("1.0-alpha"); |
|---|
| 2204 | 2443 | MODULE_LICENSE("GPL"); |
|---|