Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /* DVB USB compliant linux driver for Technotrend DVB USB boxes and clones
0003  * (e.g. Pinnacle 400e DVB-S USB2.0).
0004  *
0005  * The Pinnacle 400e uses the same protocol as the Technotrend USB1.1 boxes.
0006  *
0007  * TDA8263 + TDA10086
0008  *
0009  * I2C addresses:
0010  * 0x08 - LNBP21PD   - LNB power supply
0011  * 0x0e - TDA10086   - Demodulator
0012  * 0x50 - FX2 eeprom
0013  * 0x60 - TDA8263    - Tuner
0014  * 0x78 ???
0015  *
0016  * Copyright (c) 2002 Holger Waechtler <holger@convergence.de>
0017  * Copyright (c) 2003 Felix Domke <tmbinc@elitedvb.net>
0018  * Copyright (C) 2005-6 Patrick Boettcher <pb@linuxtv.org>
0019  *
0020  * see Documentation/driver-api/media/drivers/dvb-usb.rst for more information
0021  */
0022 #define DVB_USB_LOG_PREFIX "ttusb2"
0023 #include "dvb-usb.h"
0024 
0025 #include "ttusb2.h"
0026 
0027 #include "tda826x.h"
0028 #include "tda10086.h"
0029 #include "tda1002x.h"
0030 #include "tda10048.h"
0031 #include "tda827x.h"
0032 #include "lnbp21.h"
0033 /* CA */
0034 #include <media/dvb_ca_en50221.h>
0035 
0036 /* debug */
0037 static int dvb_usb_ttusb2_debug;
0038 #define deb_info(args...)   dprintk(dvb_usb_ttusb2_debug,0x01,args)
0039 module_param_named(debug,dvb_usb_ttusb2_debug, int, 0644);
0040 MODULE_PARM_DESC(debug, "set debugging level (1=info (or-able))." DVB_USB_DEBUG_STATUS);
0041 static int dvb_usb_ttusb2_debug_ci;
0042 module_param_named(debug_ci,dvb_usb_ttusb2_debug_ci, int, 0644);
0043 MODULE_PARM_DESC(debug_ci, "set debugging ci." DVB_USB_DEBUG_STATUS);
0044 
0045 DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
0046 
0047 #define ci_dbg(format, arg...)                \
0048 do {                                          \
0049     if (dvb_usb_ttusb2_debug_ci)                                    \
0050         printk(KERN_DEBUG DVB_USB_LOG_PREFIX \
0051             ": %s " format "\n" , __func__, ## arg);       \
0052 } while (0)
0053 
0054 enum {
0055     TT3650_CMD_CI_TEST = 0x40,
0056     TT3650_CMD_CI_RD_CTRL,
0057     TT3650_CMD_CI_WR_CTRL,
0058     TT3650_CMD_CI_RD_ATTR,
0059     TT3650_CMD_CI_WR_ATTR,
0060     TT3650_CMD_CI_RESET,
0061     TT3650_CMD_CI_SET_VIDEO_PORT
0062 };
0063 
0064 struct ttusb2_state {
0065     struct dvb_ca_en50221 ca;
0066     struct mutex ca_mutex;
0067     u8 id;
0068     u16 last_rc_key;
0069 };
0070 
0071 static int ttusb2_msg(struct dvb_usb_device *d, u8 cmd,
0072         u8 *wbuf, int wlen, u8 *rbuf, int rlen)
0073 {
0074     struct ttusb2_state *st = d->priv;
0075     u8 *s, *r = NULL;
0076     int ret = 0;
0077 
0078     if (4 + rlen > 64)
0079         return -EIO;
0080 
0081     s = kzalloc(wlen+4, GFP_KERNEL);
0082     if (!s)
0083         return -ENOMEM;
0084 
0085     r = kzalloc(64, GFP_KERNEL);
0086     if (!r) {
0087         kfree(s);
0088         return -ENOMEM;
0089     }
0090 
0091     s[0] = 0xaa;
0092     s[1] = ++st->id;
0093     s[2] = cmd;
0094     s[3] = wlen;
0095     memcpy(&s[4],wbuf,wlen);
0096 
0097     ret = dvb_usb_generic_rw(d, s, wlen+4, r, 64, 0);
0098 
0099     if (ret  != 0 ||
0100         r[0] != 0x55 ||
0101         r[1] != s[1] ||
0102         r[2] != cmd ||
0103         (rlen > 0 && r[3] != rlen)) {
0104         warn("there might have been an error during control message transfer. (rlen = %d, was %d)",rlen,r[3]);
0105         kfree(s);
0106         kfree(r);
0107         return -EIO;
0108     }
0109 
0110     if (rlen > 0)
0111         memcpy(rbuf, &r[4], rlen);
0112 
0113     kfree(s);
0114     kfree(r);
0115 
0116     return 0;
0117 }
0118 
0119 /* ci */
0120 static int tt3650_ci_msg(struct dvb_usb_device *d, u8 cmd, u8 *data, unsigned int write_len, unsigned int read_len)
0121 {
0122     int ret;
0123     u8 rx[60];/* (64 -4) */
0124     ret = ttusb2_msg(d, cmd, data, write_len, rx, read_len);
0125     if (!ret)
0126         memcpy(data, rx, read_len);
0127     return ret;
0128 }
0129 
0130 static int tt3650_ci_msg_locked(struct dvb_ca_en50221 *ca, u8 cmd, u8 *data, unsigned int write_len, unsigned int read_len)
0131 {
0132     struct dvb_usb_device *d = ca->data;
0133     struct ttusb2_state *state = d->priv;
0134     int ret;
0135 
0136     mutex_lock(&state->ca_mutex);
0137     ret = tt3650_ci_msg(d, cmd, data, write_len, read_len);
0138     mutex_unlock(&state->ca_mutex);
0139 
0140     return ret;
0141 }
0142 
0143 static int tt3650_ci_read_attribute_mem(struct dvb_ca_en50221 *ca, int slot, int address)
0144 {
0145     u8 buf[3];
0146     int ret = 0;
0147 
0148     if (slot)
0149         return -EINVAL;
0150 
0151     buf[0] = (address >> 8) & 0x0F;
0152     buf[1] = address;
0153 
0154 
0155     ret = tt3650_ci_msg_locked(ca, TT3650_CMD_CI_RD_ATTR, buf, 2, 3);
0156 
0157     ci_dbg("%04x -> %d 0x%02x", address, ret, buf[2]);
0158 
0159     if (ret < 0)
0160         return ret;
0161 
0162     return buf[2];
0163 }
0164 
0165 static int tt3650_ci_write_attribute_mem(struct dvb_ca_en50221 *ca, int slot, int address, u8 value)
0166 {
0167     u8 buf[3];
0168 
0169     ci_dbg("%d 0x%04x 0x%02x", slot, address, value);
0170 
0171     if (slot)
0172         return -EINVAL;
0173 
0174     buf[0] = (address >> 8) & 0x0F;
0175     buf[1] = address;
0176     buf[2] = value;
0177 
0178     return tt3650_ci_msg_locked(ca, TT3650_CMD_CI_WR_ATTR, buf, 3, 3);
0179 }
0180 
0181 static int tt3650_ci_read_cam_control(struct dvb_ca_en50221 *ca, int slot, u8 address)
0182 {
0183     u8 buf[2];
0184     int ret;
0185 
0186     if (slot)
0187         return -EINVAL;
0188 
0189     buf[0] = address & 3;
0190 
0191     ret = tt3650_ci_msg_locked(ca, TT3650_CMD_CI_RD_CTRL, buf, 1, 2);
0192 
0193     ci_dbg("0x%02x -> %d 0x%02x", address, ret, buf[1]);
0194 
0195     if (ret < 0)
0196         return ret;
0197 
0198     return buf[1];
0199 }
0200 
0201 static int tt3650_ci_write_cam_control(struct dvb_ca_en50221 *ca, int slot, u8 address, u8 value)
0202 {
0203     u8 buf[2];
0204 
0205     ci_dbg("%d 0x%02x 0x%02x", slot, address, value);
0206 
0207     if (slot)
0208         return -EINVAL;
0209 
0210     buf[0] = address;
0211     buf[1] = value;
0212 
0213     return tt3650_ci_msg_locked(ca, TT3650_CMD_CI_WR_CTRL, buf, 2, 2);
0214 }
0215 
0216 static int tt3650_ci_set_video_port(struct dvb_ca_en50221 *ca, int slot, int enable)
0217 {
0218     u8 buf[1];
0219     int ret;
0220 
0221     ci_dbg("%d %d", slot, enable);
0222 
0223     if (slot)
0224         return -EINVAL;
0225 
0226     buf[0] = enable;
0227 
0228     ret = tt3650_ci_msg_locked(ca, TT3650_CMD_CI_SET_VIDEO_PORT, buf, 1, 1);
0229     if (ret < 0)
0230         return ret;
0231 
0232     if (enable != buf[0]) {
0233         err("CI not %sabled.", enable ? "en" : "dis");
0234         return -EIO;
0235     }
0236 
0237     return 0;
0238 }
0239 
0240 static int tt3650_ci_slot_shutdown(struct dvb_ca_en50221 *ca, int slot)
0241 {
0242     return tt3650_ci_set_video_port(ca, slot, 0);
0243 }
0244 
0245 static int tt3650_ci_slot_ts_enable(struct dvb_ca_en50221 *ca, int slot)
0246 {
0247     return tt3650_ci_set_video_port(ca, slot, 1);
0248 }
0249 
0250 static int tt3650_ci_slot_reset(struct dvb_ca_en50221 *ca, int slot)
0251 {
0252     struct dvb_usb_device *d = ca->data;
0253     struct ttusb2_state *state = d->priv;
0254     u8 buf[1];
0255     int ret;
0256 
0257     ci_dbg("%d", slot);
0258 
0259     if (slot)
0260         return -EINVAL;
0261 
0262     buf[0] = 0;
0263 
0264     mutex_lock(&state->ca_mutex);
0265 
0266     ret = tt3650_ci_msg(d, TT3650_CMD_CI_RESET, buf, 1, 1);
0267     if (ret)
0268         goto failed;
0269 
0270     msleep(500);
0271 
0272     buf[0] = 1;
0273 
0274     ret = tt3650_ci_msg(d, TT3650_CMD_CI_RESET, buf, 1, 1);
0275     if (ret)
0276         goto failed;
0277 
0278     msleep(500);
0279 
0280     buf[0] = 0; /* FTA */
0281 
0282     ret = tt3650_ci_msg(d, TT3650_CMD_CI_SET_VIDEO_PORT, buf, 1, 1);
0283 
0284     msleep(1100);
0285 
0286  failed:
0287     mutex_unlock(&state->ca_mutex);
0288 
0289     return ret;
0290 }
0291 
0292 static int tt3650_ci_poll_slot_status(struct dvb_ca_en50221 *ca, int slot, int open)
0293 {
0294     u8 buf[1];
0295     int ret;
0296 
0297     if (slot)
0298         return -EINVAL;
0299 
0300     ret = tt3650_ci_msg_locked(ca, TT3650_CMD_CI_TEST, buf, 0, 1);
0301     if (ret)
0302         return ret;
0303 
0304     if (1 == buf[0]) {
0305         return DVB_CA_EN50221_POLL_CAM_PRESENT |
0306             DVB_CA_EN50221_POLL_CAM_READY;
0307     }
0308     return 0;
0309 }
0310 
0311 static void tt3650_ci_uninit(struct dvb_usb_device *d)
0312 {
0313     struct ttusb2_state *state;
0314 
0315     ci_dbg("");
0316 
0317     if (NULL == d)
0318         return;
0319 
0320     state = d->priv;
0321     if (NULL == state)
0322         return;
0323 
0324     if (NULL == state->ca.data)
0325         return;
0326 
0327     dvb_ca_en50221_release(&state->ca);
0328 
0329     memset(&state->ca, 0, sizeof(state->ca));
0330 }
0331 
0332 static int tt3650_ci_init(struct dvb_usb_adapter *a)
0333 {
0334     struct dvb_usb_device *d = a->dev;
0335     struct ttusb2_state *state = d->priv;
0336     int ret;
0337 
0338     ci_dbg("");
0339 
0340     mutex_init(&state->ca_mutex);
0341 
0342     state->ca.owner = THIS_MODULE;
0343     state->ca.read_attribute_mem = tt3650_ci_read_attribute_mem;
0344     state->ca.write_attribute_mem = tt3650_ci_write_attribute_mem;
0345     state->ca.read_cam_control = tt3650_ci_read_cam_control;
0346     state->ca.write_cam_control = tt3650_ci_write_cam_control;
0347     state->ca.slot_reset = tt3650_ci_slot_reset;
0348     state->ca.slot_shutdown = tt3650_ci_slot_shutdown;
0349     state->ca.slot_ts_enable = tt3650_ci_slot_ts_enable;
0350     state->ca.poll_slot_status = tt3650_ci_poll_slot_status;
0351     state->ca.data = d;
0352 
0353     ret = dvb_ca_en50221_init(&a->dvb_adap,
0354                   &state->ca,
0355                   /* flags */ 0,
0356                   /* n_slots */ 1);
0357     if (ret) {
0358         err("Cannot initialize CI: Error %d.", ret);
0359         memset(&state->ca, 0, sizeof(state->ca));
0360         return ret;
0361     }
0362 
0363     info("CI initialized.");
0364 
0365     return 0;
0366 }
0367 
0368 static int ttusb2_i2c_xfer(struct i2c_adapter *adap,struct i2c_msg msg[],int num)
0369 {
0370     struct dvb_usb_device *d = i2c_get_adapdata(adap);
0371     static u8 obuf[60], ibuf[60];
0372     int i, write_read, read;
0373 
0374     if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
0375         return -EAGAIN;
0376 
0377     if (num > 2)
0378         warn("more than 2 i2c messages at a time is not handled yet. TODO.");
0379 
0380     for (i = 0; i < num; i++) {
0381         write_read = i+1 < num && (msg[i+1].flags & I2C_M_RD);
0382         read = msg[i].flags & I2C_M_RD;
0383 
0384         if (3 + msg[i].len > sizeof(obuf)) {
0385             err("i2c wr len=%d too high", msg[i].len);
0386             break;
0387         }
0388         if (write_read) {
0389             if (3 + msg[i+1].len > sizeof(ibuf)) {
0390                 err("i2c rd len=%d too high", msg[i+1].len);
0391                 break;
0392             }
0393         } else if (read) {
0394             if (3 + msg[i].len > sizeof(ibuf)) {
0395                 err("i2c rd len=%d too high", msg[i].len);
0396                 break;
0397             }
0398         }
0399 
0400         obuf[0] = (msg[i].addr << 1) | (write_read | read);
0401         if (read)
0402             obuf[1] = 0;
0403         else
0404             obuf[1] = msg[i].len;
0405 
0406         /* read request */
0407         if (write_read)
0408             obuf[2] = msg[i+1].len;
0409         else if (read)
0410             obuf[2] = msg[i].len;
0411         else
0412             obuf[2] = 0;
0413 
0414         memcpy(&obuf[3], msg[i].buf, msg[i].len);
0415 
0416         if (ttusb2_msg(d, CMD_I2C_XFER, obuf, obuf[1]+3, ibuf, obuf[2] + 3) < 0) {
0417             err("i2c transfer failed.");
0418             break;
0419         }
0420 
0421         if (write_read) {
0422             memcpy(msg[i+1].buf, &ibuf[3], msg[i+1].len);
0423             i++;
0424         } else if (read)
0425             memcpy(msg[i].buf, &ibuf[3], msg[i].len);
0426     }
0427 
0428     mutex_unlock(&d->i2c_mutex);
0429     return i;
0430 }
0431 
0432 static u32 ttusb2_i2c_func(struct i2c_adapter *adapter)
0433 {
0434     return I2C_FUNC_I2C;
0435 }
0436 
0437 static struct i2c_algorithm ttusb2_i2c_algo = {
0438     .master_xfer   = ttusb2_i2c_xfer,
0439     .functionality = ttusb2_i2c_func,
0440 };
0441 
0442 /* command to poll IR receiver (copied from pctv452e.c) */
0443 #define CMD_GET_IR_CODE     0x1b
0444 
0445 /* IR */
0446 static int tt3650_rc_query(struct dvb_usb_device *d)
0447 {
0448     int ret;
0449     u8 rx[9]; /* A CMD_GET_IR_CODE reply is 9 bytes long */
0450     struct ttusb2_state *st = d->priv;
0451     ret = ttusb2_msg(d, CMD_GET_IR_CODE, NULL, 0, rx, sizeof(rx));
0452     if (ret != 0)
0453         return ret;
0454 
0455     if (rx[8] & 0x01) {
0456         /* got a "press" event */
0457         st->last_rc_key = RC_SCANCODE_RC5(rx[3], rx[2]);
0458         deb_info("%s: cmd=0x%02x sys=0x%02x\n", __func__, rx[2], rx[3]);
0459         rc_keydown(d->rc_dev, RC_PROTO_RC5, st->last_rc_key, rx[1]);
0460     } else if (st->last_rc_key) {
0461         rc_keyup(d->rc_dev);
0462         st->last_rc_key = 0;
0463     }
0464 
0465     return 0;
0466 }
0467 
0468 
0469 /* Callbacks for DVB USB */
0470 static int ttusb2_identify_state(struct usb_device *udev,
0471                  const struct dvb_usb_device_properties *props,
0472                  const struct dvb_usb_device_description **desc,
0473                  int *cold)
0474 {
0475     *cold = udev->descriptor.iManufacturer == 0 && udev->descriptor.iProduct == 0;
0476     return 0;
0477 }
0478 
0479 static int ttusb2_power_ctrl(struct dvb_usb_device *d, int onoff)
0480 {
0481     u8 b = onoff;
0482     ttusb2_msg(d, CMD_POWER, &b, 0, NULL, 0);
0483     return ttusb2_msg(d, CMD_POWER, &b, 1, NULL, 0);
0484 }
0485 
0486 
0487 static struct tda10086_config tda10086_config = {
0488     .demod_address = 0x0e,
0489     .invert = 0,
0490     .diseqc_tone = 1,
0491     .xtal_freq = TDA10086_XTAL_16M,
0492 };
0493 
0494 static struct tda10023_config tda10023_config = {
0495     .demod_address = 0x0c,
0496     .invert = 0,
0497     .xtal = 16000000,
0498     .pll_m = 11,
0499     .pll_p = 3,
0500     .pll_n = 1,
0501     .deltaf = 0xa511,
0502 };
0503 
0504 static struct tda10048_config tda10048_config = {
0505     .demod_address    = 0x10 >> 1,
0506     .output_mode      = TDA10048_PARALLEL_OUTPUT,
0507     .inversion        = TDA10048_INVERSION_ON,
0508     .dtv6_if_freq_khz = TDA10048_IF_4000,
0509     .dtv7_if_freq_khz = TDA10048_IF_4500,
0510     .dtv8_if_freq_khz = TDA10048_IF_5000,
0511     .clk_freq_khz     = TDA10048_CLK_16000,
0512     .no_firmware      = 1,
0513     .set_pll          = true ,
0514     .pll_m            = 5,
0515     .pll_n            = 3,
0516     .pll_p            = 0,
0517 };
0518 
0519 static struct tda827x_config tda827x_config = {
0520     .config = 0,
0521 };
0522 
0523 static int ttusb2_frontend_tda10086_attach(struct dvb_usb_adapter *adap)
0524 {
0525     if (usb_set_interface(adap->dev->udev,0,3) < 0)
0526         err("set interface to alts=3 failed");
0527 
0528     if ((adap->fe_adap[0].fe = dvb_attach(tda10086_attach, &tda10086_config, &adap->dev->i2c_adap)) == NULL) {
0529         deb_info("TDA10086 attach failed\n");
0530         return -ENODEV;
0531     }
0532 
0533     return 0;
0534 }
0535 
0536 static int ttusb2_ct3650_i2c_gate_ctrl(struct dvb_frontend *fe, int enable)
0537 {
0538     struct dvb_usb_adapter *adap = fe->dvb->priv;
0539 
0540     return adap->fe_adap[0].fe->ops.i2c_gate_ctrl(adap->fe_adap[0].fe, enable);
0541 }
0542 
0543 static int ttusb2_frontend_tda10023_attach(struct dvb_usb_adapter *adap)
0544 {
0545     if (usb_set_interface(adap->dev->udev, 0, 3) < 0)
0546         err("set interface to alts=3 failed");
0547 
0548     if (adap->fe_adap[0].fe == NULL) {
0549         /* FE 0 DVB-C */
0550         adap->fe_adap[0].fe = dvb_attach(tda10023_attach,
0551             &tda10023_config, &adap->dev->i2c_adap, 0x48);
0552 
0553         if (adap->fe_adap[0].fe == NULL) {
0554             deb_info("TDA10023 attach failed\n");
0555             return -ENODEV;
0556         }
0557         tt3650_ci_init(adap);
0558     } else {
0559         adap->fe_adap[1].fe = dvb_attach(tda10048_attach,
0560             &tda10048_config, &adap->dev->i2c_adap);
0561 
0562         if (adap->fe_adap[1].fe == NULL) {
0563             deb_info("TDA10048 attach failed\n");
0564             return -ENODEV;
0565         }
0566 
0567         /* tuner is behind TDA10023 I2C-gate */
0568         adap->fe_adap[1].fe->ops.i2c_gate_ctrl = ttusb2_ct3650_i2c_gate_ctrl;
0569 
0570     }
0571 
0572     return 0;
0573 }
0574 
0575 static int ttusb2_tuner_tda827x_attach(struct dvb_usb_adapter *adap)
0576 {
0577     struct dvb_frontend *fe;
0578 
0579     /* MFE: select correct FE to attach tuner since that's called twice */
0580     if (adap->fe_adap[1].fe == NULL)
0581         fe = adap->fe_adap[0].fe;
0582     else
0583         fe = adap->fe_adap[1].fe;
0584 
0585     /* attach tuner */
0586     if (dvb_attach(tda827x_attach, fe, 0x61, &adap->dev->i2c_adap, &tda827x_config) == NULL) {
0587         printk(KERN_ERR "%s: No tda827x found!\n", __func__);
0588         return -ENODEV;
0589     }
0590     return 0;
0591 }
0592 
0593 static int ttusb2_tuner_tda826x_attach(struct dvb_usb_adapter *adap)
0594 {
0595     if (dvb_attach(tda826x_attach, adap->fe_adap[0].fe, 0x60, &adap->dev->i2c_adap, 0) == NULL) {
0596         deb_info("TDA8263 attach failed\n");
0597         return -ENODEV;
0598     }
0599 
0600     if (dvb_attach(lnbp21_attach, adap->fe_adap[0].fe, &adap->dev->i2c_adap, 0, 0) == NULL) {
0601         deb_info("LNBP21 attach failed\n");
0602         return -ENODEV;
0603     }
0604     return 0;
0605 }
0606 
0607 /* DVB USB Driver stuff */
0608 static struct dvb_usb_device_properties ttusb2_properties;
0609 static struct dvb_usb_device_properties ttusb2_properties_s2400;
0610 static struct dvb_usb_device_properties ttusb2_properties_ct3650;
0611 
0612 static void ttusb2_usb_disconnect(struct usb_interface *intf)
0613 {
0614     struct dvb_usb_device *d = usb_get_intfdata(intf);
0615 
0616     tt3650_ci_uninit(d);
0617     dvb_usb_device_exit(intf);
0618 }
0619 
0620 static int ttusb2_probe(struct usb_interface *intf,
0621         const struct usb_device_id *id)
0622 {
0623     if (0 == dvb_usb_device_init(intf, &ttusb2_properties,
0624                      THIS_MODULE, NULL, adapter_nr) ||
0625         0 == dvb_usb_device_init(intf, &ttusb2_properties_s2400,
0626                      THIS_MODULE, NULL, adapter_nr) ||
0627         0 == dvb_usb_device_init(intf, &ttusb2_properties_ct3650,
0628                      THIS_MODULE, NULL, adapter_nr))
0629         return 0;
0630     return -ENODEV;
0631 }
0632 
0633 enum {
0634     PINNACLE_PCTV_400E,
0635     PINNACLE_PCTV_450E,
0636     TECHNOTREND_CONNECT_S2400,
0637     TECHNOTREND_CONNECT_CT3650,
0638     TECHNOTREND_CONNECT_S2400_8KEEPROM,
0639 };
0640 
0641 static struct usb_device_id ttusb2_table[] = {
0642     DVB_USB_DEV(PINNACLE, PINNACLE_PCTV_400E),
0643     DVB_USB_DEV(PINNACLE, PINNACLE_PCTV_450E),
0644     DVB_USB_DEV(TECHNOTREND, TECHNOTREND_CONNECT_S2400),
0645     DVB_USB_DEV(TECHNOTREND, TECHNOTREND_CONNECT_CT3650),
0646     DVB_USB_DEV(TECHNOTREND, TECHNOTREND_CONNECT_S2400_8KEEPROM),
0647     { }
0648 };
0649 
0650 MODULE_DEVICE_TABLE (usb, ttusb2_table);
0651 
0652 static struct dvb_usb_device_properties ttusb2_properties = {
0653     .caps = DVB_USB_IS_AN_I2C_ADAPTER,
0654 
0655     .usb_ctrl = CYPRESS_FX2,
0656     .firmware = "dvb-usb-pctv-400e-01.fw",
0657 
0658     .size_of_priv = sizeof(struct ttusb2_state),
0659 
0660     .num_adapters = 1,
0661     .adapter = {
0662         {
0663         .num_frontends = 1,
0664         .fe = {{
0665             .streaming_ctrl   = NULL, // ttusb2_streaming_ctrl,
0666 
0667             .frontend_attach  = ttusb2_frontend_tda10086_attach,
0668             .tuner_attach     = ttusb2_tuner_tda826x_attach,
0669 
0670             /* parameter for the MPEG2-data transfer */
0671             .stream = {
0672                 .type = USB_ISOC,
0673                 .count = 5,
0674                 .endpoint = 0x02,
0675                 .u = {
0676                     .isoc = {
0677                         .framesperurb = 4,
0678                         .framesize = 940,
0679                         .interval = 1,
0680                     }
0681                 }
0682             }
0683         }},
0684         }
0685     },
0686 
0687     .power_ctrl       = ttusb2_power_ctrl,
0688     .identify_state   = ttusb2_identify_state,
0689 
0690     .i2c_algo         = &ttusb2_i2c_algo,
0691 
0692     .generic_bulk_ctrl_endpoint = 0x01,
0693 
0694     .num_device_descs = 2,
0695     .devices = {
0696         {   "Pinnacle 400e DVB-S USB2.0",
0697             { &ttusb2_table[PINNACLE_PCTV_400E], NULL },
0698             { NULL },
0699         },
0700         {   "Pinnacle 450e DVB-S USB2.0",
0701             { &ttusb2_table[PINNACLE_PCTV_450E], NULL },
0702             { NULL },
0703         },
0704     }
0705 };
0706 
0707 static struct dvb_usb_device_properties ttusb2_properties_s2400 = {
0708     .caps = DVB_USB_IS_AN_I2C_ADAPTER,
0709 
0710     .usb_ctrl = CYPRESS_FX2,
0711     .firmware = "dvb-usb-tt-s2400-01.fw",
0712 
0713     .size_of_priv = sizeof(struct ttusb2_state),
0714 
0715     .num_adapters = 1,
0716     .adapter = {
0717         {
0718         .num_frontends = 1,
0719         .fe = {{
0720             .streaming_ctrl   = NULL,
0721 
0722             .frontend_attach  = ttusb2_frontend_tda10086_attach,
0723             .tuner_attach     = ttusb2_tuner_tda826x_attach,
0724 
0725             /* parameter for the MPEG2-data transfer */
0726             .stream = {
0727                 .type = USB_ISOC,
0728                 .count = 5,
0729                 .endpoint = 0x02,
0730                 .u = {
0731                     .isoc = {
0732                         .framesperurb = 4,
0733                         .framesize = 940,
0734                         .interval = 1,
0735                     }
0736                 }
0737             }
0738         }},
0739         }
0740     },
0741 
0742     .power_ctrl       = ttusb2_power_ctrl,
0743     .identify_state   = ttusb2_identify_state,
0744 
0745     .i2c_algo         = &ttusb2_i2c_algo,
0746 
0747     .generic_bulk_ctrl_endpoint = 0x01,
0748 
0749     .num_device_descs = 2,
0750     .devices = {
0751         {   "Technotrend TT-connect S-2400",
0752             { &ttusb2_table[TECHNOTREND_CONNECT_S2400], NULL },
0753             { NULL },
0754         },
0755         {   "Technotrend TT-connect S-2400 (8kB EEPROM)",
0756             { &ttusb2_table[TECHNOTREND_CONNECT_S2400_8KEEPROM], NULL },
0757             { NULL },
0758         },
0759     }
0760 };
0761 
0762 static struct dvb_usb_device_properties ttusb2_properties_ct3650 = {
0763     .caps = DVB_USB_IS_AN_I2C_ADAPTER,
0764 
0765     .usb_ctrl = CYPRESS_FX2,
0766 
0767     .size_of_priv = sizeof(struct ttusb2_state),
0768 
0769     .rc.core = {
0770         .rc_interval      = 150, /* Less than IR_KEYPRESS_TIMEOUT */
0771         .rc_codes         = RC_MAP_TT_1500,
0772         .rc_query         = tt3650_rc_query,
0773         .allowed_protos   = RC_PROTO_BIT_RC5,
0774     },
0775 
0776     .num_adapters = 1,
0777     .adapter = {
0778         {
0779         .num_frontends = 2,
0780         .fe = {{
0781             .streaming_ctrl   = NULL,
0782 
0783             .frontend_attach  = ttusb2_frontend_tda10023_attach,
0784             .tuner_attach = ttusb2_tuner_tda827x_attach,
0785 
0786             /* parameter for the MPEG2-data transfer */
0787             .stream = {
0788                 .type = USB_ISOC,
0789                 .count = 5,
0790                 .endpoint = 0x02,
0791                 .u = {
0792                     .isoc = {
0793                         .framesperurb = 4,
0794                         .framesize = 940,
0795                         .interval = 1,
0796                     }
0797                 }
0798             }
0799         }, {
0800             .streaming_ctrl   = NULL,
0801 
0802             .frontend_attach  = ttusb2_frontend_tda10023_attach,
0803             .tuner_attach = ttusb2_tuner_tda827x_attach,
0804 
0805             /* parameter for the MPEG2-data transfer */
0806             .stream = {
0807                 .type = USB_ISOC,
0808                 .count = 5,
0809                 .endpoint = 0x02,
0810                 .u = {
0811                     .isoc = {
0812                         .framesperurb = 4,
0813                         .framesize = 940,
0814                         .interval = 1,
0815                     }
0816                 }
0817             }
0818         }},
0819         },
0820     },
0821 
0822     .power_ctrl       = ttusb2_power_ctrl,
0823     .identify_state   = ttusb2_identify_state,
0824 
0825     .i2c_algo         = &ttusb2_i2c_algo,
0826 
0827     .generic_bulk_ctrl_endpoint = 0x01,
0828 
0829     .num_device_descs = 1,
0830     .devices = {
0831         {   "Technotrend TT-connect CT-3650",
0832             .warm_ids = { &ttusb2_table[TECHNOTREND_CONNECT_CT3650], NULL },
0833         },
0834     }
0835 };
0836 
0837 static struct usb_driver ttusb2_driver = {
0838     .name       = "dvb_usb_ttusb2",
0839     .probe      = ttusb2_probe,
0840     .disconnect = ttusb2_usb_disconnect,
0841     .id_table   = ttusb2_table,
0842 };
0843 
0844 module_usb_driver(ttusb2_driver);
0845 
0846 MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@posteo.de>");
0847 MODULE_DESCRIPTION("Driver for Pinnacle PCTV 400e DVB-S USB2.0");
0848 MODULE_VERSION("1.0");
0849 MODULE_LICENSE("GPL");