13 #include <linux/slab.h>
14 #include <linux/wait.h>
16 #include <linux/module.h>
19 #include <linux/time.h>
20 #include <linux/errno.h>
38 #include <linux/dvb/dmx.h>
39 #include <linux/pci.h>
66 #define dprintk(x...) do { if (debug) printk(KERN_DEBUG x); } while (0)
68 #define ISO_BUF_COUNT 4
69 #define FRAMES_PER_ISO_BUF 4
70 #define ISO_FRAME_SIZE 912
71 #define TTUSB_MAXCHANNEL 32
72 #ifdef TTUSB_HWSECTIONS
73 #define TTUSB_MAXFILTER 16
76 #define TTUSB_REV_2_2 0x22
77 #define TTUSB_BUDGET_NAME "ttusb_stc_fw"
93 struct usb_device *
dev;
138 const u8 *
data,
int len,
int needresult)
146 for (i = 0; i < len; ++
i)
155 (
u8 *) data, len, &actual_len, 1000);
157 dprintk(
"%s: usb_bulk_msg(send) failed, err == %i!\n",
162 if (actual_len != len) {
163 dprintk(
"%s: only wrote %d of %d bytes\n", __func__,
173 printk(
"%s: failed, receive error %d\n", __func__,
182 for (i = 0; i < actual_len; ++
i)
192 static int ttusb_result(
struct ttusb *ttusb,
u8 * data,
int len)
199 static int ttusb_i2c_msg(
struct ttusb *ttusb,
207 if (snd_len > 0x28 - 7 || rcv_len > 0x20 - 7)
218 for (i = 0; i < snd_len; i++)
219 b[7 + i] = snd_buf[i];
221 err = ttusb_cmd(ttusb, b, snd_len + 7, 1);
226 err = ttusb_result(ttusb, b, 0x20);
229 if ((snd_len != b[5]) || (rcv_len != b[6]))
return -
EREMOTEIO;
233 if (err || b[0] != 0x55 || b[1] !=
id) {
235 (
"%s: usb_bulk_msg(recv) failed, err == %i, id == %02x, b == ",
240 for (i = 0; i < rcv_len; i++)
241 rcv_buf[i] = b[7 + i];
249 struct ttusb *ttusb = i2c_get_adapdata(adapter);
257 u8 addr, snd_len, rcv_len, *snd_buf, *rcv_buf;
262 snd_buf = msg[
i].
buf;
263 snd_len = msg[
i].
len;
264 rcv_buf = msg[i + 1].
buf;
265 rcv_len = msg[i + 1].
len;
269 snd_buf = msg[
i].
buf;
270 snd_len = msg[
i].
len;
276 err = ttusb_i2c_msg(ttusb, addr,
277 snd_buf, snd_len, rcv_buf, rcv_len);
280 dprintk(
"%s: i == %i\n", __func__, i);
291 static int ttusb_boot_dsp(
struct ttusb *ttusb)
311 for (i = 0; i < fw->
size; i += 28) {
316 err = ttusb_cmd(ttusb, b, 32, 0);
326 err = ttusb_cmd(ttusb, b, 4, 0);
335 err = ttusb_cmd(ttusb, b, 4, 0);
340 dprintk(
"%s: usb_bulk_msg() failed, return value %i!\n",
347 static int ttusb_set_channel(
struct ttusb *ttusb,
int chan_id,
int filter_type,
352 u8 b[] = { 0xaa, ++ttusb->
c, 0x22, 4, chan_id, filter_type,
353 (pid >> 8) & 0xff, pid & 0xff
356 err = ttusb_cmd(ttusb, b,
sizeof(b), 0);
360 static int ttusb_del_channel(
struct ttusb *ttusb,
int channel_id)
364 u8 b[] = { 0xaa, ++ttusb->
c, 0x23, 1, channel_id };
366 err = ttusb_cmd(ttusb, b,
sizeof(b), 0);
370 #ifdef TTUSB_HWSECTIONS
371 static int ttusb_set_filter(
struct ttusb *ttusb,
int filter_id,
376 u8 b[] = { 0xaa, 0, 0x24, 0x1a, filter_id, associated_chan,
377 filter[0], filter[1], filter[2], filter[3],
378 filter[4], filter[5], filter[6], filter[7],
379 filter[8], filter[9], filter[10], filter[11],
380 mask[0], mask[1], mask[2], mask[3],
381 mask[4], mask[5], mask[6], mask[7],
382 mask[8], mask[9], mask[10], mask[11]
385 err = ttusb_cmd(ttusb, b,
sizeof(b), 0);
389 static int ttusb_del_filter(
struct ttusb *ttusb,
int filter_id)
393 u8 b[] = { 0xaa, ++ttusb->
c, 0x25, 1, filter_id };
395 err = ttusb_cmd(ttusb, b,
sizeof(b), 0);
400 static int ttusb_init_controller(
struct ttusb *ttusb)
402 u8 b0[] = { 0xaa, ++ttusb->
c, 0x15, 1, 0 };
403 u8 b1[] = { 0xaa, ++ttusb->
c, 0x15, 1, 1 };
404 u8 b2[] = { 0xaa, ++ttusb->
c, 0x32, 1, 0 };
407 { 0xaa, ++ttusb->
c, 0x31, 5, 0x10, 0x02, 0x01, 0x00, 0x1e };
409 { 0x55, ttusb->
c, 0x31, 4, 0x10, 0x02, 0x01, 0x00, 0x1e };
411 u8 get_version[] = { 0xaa, ++ttusb->
c, 0x17, 5, 0, 0, 0, 0, 0 };
412 u8 get_dsp_version[0x20] =
413 { 0xaa, ++ttusb->
c, 0x26, 28, 0, 0, 0, 0, 0 };
417 if ((err = ttusb_cmd(ttusb, b0,
sizeof(b0), 0)))
421 if ((err = ttusb_cmd(ttusb, b1,
sizeof(b1), 0)))
424 ttusb_boot_dsp(ttusb);
427 if ((err = ttusb_cmd(ttusb, b2,
sizeof(b2), 0)))
430 if ((err = ttusb_cmd(ttusb, b3,
sizeof(b3), 1)))
433 err = ttusb_result(ttusb, b4,
sizeof(b4));
435 if ((err = ttusb_cmd(ttusb, get_version,
sizeof(get_version), 1)))
438 if ((err = ttusb_result(ttusb, get_version,
sizeof(get_version))))
441 dprintk(
"%s: stc-version: %c%c%c%c%c\n", __func__,
442 get_version[4], get_version[5], get_version[6],
443 get_version[7], get_version[8]);
445 if (
memcmp(get_version + 4,
"V 0.0", 5) &&
446 memcmp(get_version + 4,
"V 1.1", 5) &&
447 memcmp(get_version + 4,
"V 2.1", 5) &&
448 memcmp(get_version + 4,
"V 2.2", 5)) {
450 (
"%s: unknown STC version %c%c%c%c%c, please report!\n",
451 __func__, get_version[4], get_version[5],
452 get_version[6], get_version[7], get_version[8]);
455 ttusb->
revision = ((get_version[6] -
'0') << 4) |
456 (get_version[8] -
'0');
459 ttusb_cmd(ttusb, get_dsp_version,
sizeof(get_dsp_version), 1);
464 ttusb_result(ttusb, get_dsp_version,
sizeof(get_dsp_version));
467 printk(
"%s: dsp-version: %c%c%c\n", __func__,
468 get_dsp_version[4], get_dsp_version[5], get_dsp_version[6]);
476 struct ttusb* ttusb = (
struct ttusb*) fe->
dvb->priv;
477 u8 b[12] = { 0xaa, ++ttusb->
c, 0x18 };
481 b[3] = 4 + 2 +
cmd->msg_len;
488 if ((err = ttusb_cmd(ttusb, b, 4 + b[3], 0))) {
489 dprintk(
"%s: usb_bulk_msg() failed, return value %i!\n",
497 static int ttusb_update_lnb(
struct ttusb *ttusb)
499 u8 b[] = { 0xaa, ++ttusb->
c, 0x16, 5, 1,
506 if ((err = ttusb_cmd(ttusb, b,
sizeof(b), 0))) {
507 dprintk(
"%s: usb_bulk_msg() failed, return value %i!\n",
516 struct ttusb* ttusb = (
struct ttusb*) fe->
dvb->priv;
519 return ttusb_update_lnb(ttusb);
525 struct ttusb* ttusb = (
struct ttusb*) fe->
dvb->priv;
528 return ttusb_update_lnb(ttusb);
534 static void ttusb_set_led_freq(
struct ttusb *ttusb,
u8 freq)
536 u8 b[] = { 0xaa, ++ttusb->
c, 0x19, 1, freq };
539 err = ttusb_cmd(ttusb, b,
sizeof(b), 0);
541 dprintk(
"%s: usb_bulk_msg() failed, return value %i!\n",
549 #ifdef TTUSB_HWSECTIONS
550 static void ttusb_handle_ts_data(
struct ttusb_channel *
channel,
551 const u8 * data,
int len);
552 static void ttusb_handle_sec_data(
struct ttusb_channel *
channel,
553 const u8 * data,
int len);
556 static int numpkt, numts, numstuff, numsec, numinvalid;
557 static unsigned long lastj;
559 static void ttusb_process_muxpack(
struct ttusb *ttusb,
const u8 *
muxpack,
564 for (i = 0; i < len; i += 2)
567 printk(
"%s: muxpack with incorrect checksum, ignoring\n",
573 cc = (muxpack[len - 4] << 8) | muxpack[len - 3];
575 if ((
cc != ttusb->
cc) && (ttusb->
cc != -1))
576 printk(
"%s: cc discontinuity (%d frames missing)\n",
577 __func__, (
cc - ttusb->
cc) & 0x7FFF);
578 ttusb->
cc = (
cc + 1) & 0x7FFF;
579 if (muxpack[0] & 0x80) {
580 #ifdef TTUSB_HWSECTIONS
582 int pusi = muxpack[0] & 0x40;
583 int channel = muxpack[0] & 0x1F;
585 const u8 *data = muxpack + 2;
587 if (muxpack[0] & 0x20)
590 ttusb_handle_sec_data(ttusb->channel + channel, data,
594 if ((!!(ttusb->
muxpack[0] & 0x20)) ^
598 printk(
"cc: %04x\n", (data[0] << 8) | data[1]);
601 }
else if (muxpack[0] == 0x47) {
602 #ifdef TTUSB_HWSECTIONS
604 int pid = ((muxpack[1] & 0x0F) << 8) | muxpack[2];
607 if (ttusb->channel[channel].active
608 && (pid == ttusb->channel[channel].pid))
609 ttusb_handle_ts_data(ttusb->channel +
615 }
else if (muxpack[0] != 0) {
617 printk(
"illegal muxpack type %02x\n", muxpack[0]);
622 static void ttusb_process_frame(
struct ttusb *ttusb,
u8 * data,
int len)
627 printk(
"%s: too much work\n", __func__);
676 if (ttusb->
muxpack[0] & 0x80) {
685 muxpack[0] & 0x20)) ^
691 }
else if (ttusb->
muxpack[0] ==
695 else if (ttusb->
muxpack[0] == 0x00)
701 (
"%s: invalid state: first byte is %x\n",
715 ttusb_process_muxpack(ttusb,
742 static void ttusb_iso_irq(
struct urb *
urb)
744 struct ttusb *ttusb = urb->context;
745 struct usb_iso_packet_descriptor *
d;
753 printk(
"%s: status %d, errcount == %d, length == %i\n",
755 urb->status, urb->error_count, urb->actual_length);
759 for (i = 0; i < urb->number_of_packets; ++
i) {
762 dprintk(
"frames/s: %lu (ts: %d, stuff %d, "
763 "sec: %d, invalid: %d, all: %d)\n",
764 numpkt *
HZ / (jiffies - lastj),
765 numts, numstuff, numsec, numinvalid,
766 numts + numstuff + numsec + numinvalid);
767 numts = numstuff = numsec = numinvalid = 0;
771 d = &urb->iso_frame_desc[
i];
772 data = urb->transfer_buffer + d->offset;
773 len = d->actual_length;
774 d->actual_length = 0;
776 ttusb_process_frame(ttusb, data, len);
782 static void ttusb_free_iso_urbs(
struct ttusb *ttusb)
796 static int ttusb_alloc_iso_urbs(
struct ttusb *ttusb)
807 dprintk(
"%s: pci_alloc_consistent - not enough memory\n",
821 ttusb_free_iso_urbs(ttusb);
831 static void ttusb_stop_iso_xfer(
struct ttusb *ttusb)
841 static int ttusb_start_iso_xfer(
struct ttusb *ttusb)
843 int i,
j,
err, buffer_offset = 0;
846 printk(
"%s: iso xfer already running!\n", __func__);
856 struct urb *urb = ttusb->
iso_urb[
i];
858 urb->dev = ttusb->
dev;
859 urb->context = ttusb;
860 urb->complete = ttusb_iso_irq;
862 urb->transfer_flags = URB_ISO_ASAP;
865 urb->transfer_buffer_length =
867 urb->transfer_buffer = ttusb->
iso_buffer + buffer_offset;
879 ttusb_stop_iso_xfer(ttusb);
881 (
"%s: failed urb submission (%i: err = %i)!\n",
892 #ifdef TTUSB_HWSECTIONS
893 static void ttusb_handle_ts_data(
struct dvb_demux_feed *dvbdmxfeed,
const u8 * data,
896 dvbdmxfeed->
cb.
ts(data, len, 0, 0, &dvbdmxfeed->
feed.
ts, 0);
899 static void ttusb_handle_sec_data(
struct dvb_demux_feed *dvbdmxfeed,
const u8 * data,
903 #error TODO: handle ugly stuff
910 struct ttusb *ttusb = (
struct ttusb *) dvbdmxfeed->
demux;
915 switch (dvbdmxfeed->
type) {
937 #ifdef TTUSB_HWSECTIONS
938 #error TODO: allocate filters
946 ttusb_set_channel(ttusb, dvbdmxfeed->
index, feed_type, dvbdmxfeed->
pid);
949 ttusb_start_iso_xfer(ttusb);
956 struct ttusb *ttusb = (
struct ttusb *) dvbdmxfeed->
demux;
958 ttusb_del_channel(ttusb, dvbdmxfeed->
index);
961 ttusb_stop_iso_xfer(ttusb);
966 static int ttusb_setup_interfaces(
struct ttusb *ttusb)
978 static u8 stc_firmware[8192];
985 for (addr = 0; addr < 8192; addr += 16) {
986 u8 snd_buf[2] = { addr >> 8, addr & 0xFF };
987 ttusb_i2c_msg(ttusb, 0x50, snd_buf, 2, stc_firmware + addr,
1000 static int stc_release(
struct inode *inode,
struct file *file)
1009 .release = stc_release,
1020 static int alps_tdmb7_tuner_set_params(
struct dvb_frontend *fe)
1023 struct ttusb* ttusb = (
struct ttusb*) fe->
dvb->priv;
1025 struct i2c_msg msg = {.
addr=0x61, .flags=0, .buf=data, .len=
sizeof(data) };
1028 div = (
p->frequency + 36166667) / 166667;
1030 data[0] = (div >> 8) & 0x7f;
1031 data[1] = div & 0xff;
1032 data[2] = ((div >> 10) & 0x60) | 0x85;
1033 data[3] =
p->frequency < 592000000 ? 0x40 : 0x80;
1035 if (fe->
ops.i2c_gate_ctrl)
1036 fe->
ops.i2c_gate_ctrl(fe, 1);
1042 .demod_address = 0x43,
1049 static int philips_tdm1316l_tuner_init(
struct dvb_frontend* fe)
1051 struct ttusb* ttusb = (
struct ttusb*) fe->
dvb->priv;
1052 static u8 td1316_init[] = { 0x0b, 0xf5, 0x85, 0xab };
1053 static u8 disable_mc44BC374c[] = { 0x1d, 0x74, 0xa0, 0x68 };
1054 struct i2c_msg tuner_msg = { .
addr=0x60, .flags=0, .buf=td1316_init, .len=
sizeof(td1316_init) };
1057 if (fe->
ops.i2c_gate_ctrl)
1058 fe->
ops.i2c_gate_ctrl(fe, 1);
1063 tuner_msg.
addr = 0x65;
1064 tuner_msg.
buf = disable_mc44BC374c;
1065 tuner_msg.
len =
sizeof(disable_mc44BC374c);
1066 if (fe->
ops.i2c_gate_ctrl)
1067 fe->
ops.i2c_gate_ctrl(fe, 1);
1075 static int philips_tdm1316l_tuner_set_params(
struct dvb_frontend *fe)
1078 struct ttusb* ttusb = (
struct ttusb*) fe->
dvb->priv;
1080 struct i2c_msg tuner_msg = {.
addr=0x60, .flags=0, .buf=tuner_buf, .len=
sizeof(tuner_buf) };
1081 int tuner_frequency = 0;
1085 tuner_frequency =
p->frequency + 36130000;
1086 if (tuner_frequency < 87000000)
return -
EINVAL;
1087 else if (tuner_frequency < 130000000) cp = 3;
1088 else if (tuner_frequency < 160000000) cp = 5;
1089 else if (tuner_frequency < 200000000) cp = 6;
1090 else if (tuner_frequency < 290000000) cp = 3;
1091 else if (tuner_frequency < 420000000) cp = 5;
1092 else if (tuner_frequency < 480000000) cp = 6;
1093 else if (tuner_frequency < 620000000) cp = 3;
1094 else if (tuner_frequency < 830000000) cp = 5;
1095 else if (tuner_frequency < 895000000) cp = 7;
1099 if (
p->frequency < 49000000)
1101 else if (
p->frequency < 159000000)
1103 else if (
p->frequency < 444000000)
1105 else if (
p->frequency < 861000000)
1110 switch (
p->bandwidth_hz) {
1112 tda1004x_writereg(fe, 0x0C, 0);
1117 tda1004x_writereg(fe, 0x0C, 0);
1122 tda1004x_writereg(fe, 0x0C, 0xFF);
1132 tuner_frequency = (((
p->frequency / 1000) * 6) + 217280) / 1000;
1135 tuner_buf[0] = tuner_frequency >> 8;
1136 tuner_buf[1] = tuner_frequency & 0xff;
1137 tuner_buf[2] = 0xca;
1138 tuner_buf[3] = (cp << 5) | (filter << 3) | band;
1140 if (fe->
ops.i2c_gate_ctrl)
1141 fe->
ops.i2c_gate_ctrl(fe, 1);
1151 struct ttusb* ttusb = (
struct ttusb*) fe->
dvb->priv;
1158 .demod_address = 0x8,
1161 .request_firmware = philips_tdm1316l_request_firmware,
1164 static u8 alps_bsbe1_inittab[] = {
1206 static u8 alps_bsru6_inittab[] = {
1253 if (srate < 1500000) {
1256 }
else if (srate < 3000000) {
1259 }
else if (srate < 7000000) {
1262 }
else if (srate < 14000000) {
1265 }
else if (srate < 30000000) {
1268 }
else if (srate < 45000000) {
1273 stv0299_writereg(fe, 0x13, aclk);
1274 stv0299_writereg(fe, 0x14, bclk);
1275 stv0299_writereg(fe, 0x1f, (ratio >> 16) & 0xff);
1276 stv0299_writereg(fe, 0x20, (ratio >> 8) & 0xff);
1277 stv0299_writereg(fe, 0x21, (ratio) & 0xf0);
1282 static int philips_tsa5059_tuner_set_params(
struct dvb_frontend *fe)
1285 struct ttusb* ttusb = (
struct ttusb*) fe->
dvb->priv;
1290 if ((
p->frequency < 950000) || (
p->frequency > 2150000))
1293 div = (
p->frequency + (125 - 1)) / 125;
1294 buf[0] = (div >> 8) & 0x7f;
1295 buf[1] = div & 0xff;
1296 buf[2] = 0x80 | ((div & 0x18000) >> 10) | 4;
1299 if (
p->frequency > 1530000)
1306 if (fe->
ops.i2c_gate_ctrl)
1307 fe->
ops.i2c_gate_ctrl(fe, 1);
1315 .demod_address = 0x68,
1316 .inittab = alps_bsru6_inittab,
1322 .min_delay_ms = 100,
1323 .set_symbol_rate = alps_stv0299_set_symbol_rate,
1326 static int ttusb_novas_grundig_29504_491_tuner_set_params(
struct dvb_frontend *fe)
1329 struct ttusb* ttusb = (
struct ttusb*) fe->
dvb->priv;
1334 div =
p->frequency / 125;
1336 buf[0] = (div >> 8) & 0x7f;
1337 buf[1] = div & 0xff;
1341 if (fe->
ops.i2c_gate_ctrl)
1342 fe->
ops.i2c_gate_ctrl(fe, 1);
1349 static struct tda8083_config ttusb_novas_grundig_29504_491_config = {
1351 .demod_address = 0x68,
1354 static int alps_tdbe2_tuner_set_params(
struct dvb_frontend *fe)
1357 struct ttusb* ttusb = fe->
dvb->priv;
1362 div = (p->
frequency + 35937500 + 31250) / 62500;
1364 data[0] = (div >> 8) & 0x7f;
1365 data[1] = div & 0xff;
1366 data[2] = 0x85 | ((div >> 10) & 0x60);
1367 data[3] = (p->
frequency < 174000000 ? 0x88 : p->
frequency < 470000000 ? 0x84 : 0x81);
1369 if (fe->
ops.i2c_gate_ctrl)
1370 fe->
ops.i2c_gate_ctrl(fe, 1);
1379 .demod_address = 0x09,
1385 static u8 read_pwm(
struct ttusb* ttusb)
1389 struct i2c_msg msg[] = { { .
addr = 0x50,.flags = 0,.buf = &
b,.len = 1 },
1390 { .addr = 0x50,.flags =
I2C_M_RD,.buf = &
pwm,.len = 1} };
1399 static int dvbc_philips_tdm1316l_tuner_set_params(
struct dvb_frontend *fe)
1402 struct ttusb *ttusb = (
struct ttusb *) fe->
dvb->priv;
1407 .len =
sizeof(tuner_buf) };
1408 int tuner_frequency = 0;
1413 if (tuner_frequency < 87000000) {
return -
EINVAL;}
1414 else if (tuner_frequency < 130000000) {cp = 3; band = 1;}
1415 else if (tuner_frequency < 160000000) {cp = 5; band = 1;}
1416 else if (tuner_frequency < 200000000) {cp = 6; band = 1;}
1417 else if (tuner_frequency < 290000000) {cp = 3; band = 2;}
1418 else if (tuner_frequency < 420000000) {cp = 5; band = 2;}
1419 else if (tuner_frequency < 480000000) {cp = 6; band = 2;}
1420 else if (tuner_frequency < 620000000) {cp = 3; band = 4;}
1421 else if (tuner_frequency < 830000000) {cp = 5; band = 4;}
1422 else if (tuner_frequency < 895000000) {cp = 7; band = 4;}
1430 tuner_frequency = ((p->
frequency + 36125000) / 62500);
1433 tuner_buf[0] = tuner_frequency >> 8;
1434 tuner_buf[1] = tuner_frequency & 0xff;
1435 tuner_buf[2] = 0xc8;
1436 tuner_buf[3] = (cp << 5) | (filter << 3) | band;
1437 tuner_buf[4] = 0x80;
1439 if (fe->
ops.i2c_gate_ctrl)
1440 fe->
ops.i2c_gate_ctrl(fe, 1);
1442 printk(
"dvb-ttusb-budget: dvbc_philips_tdm1316l_pll_set Error 1\n");
1448 if (fe->
ops.i2c_gate_ctrl)
1449 fe->
ops.i2c_gate_ctrl(fe, 1);
1451 printk(
"dvb-ttusb-budget: dvbc_philips_tdm1316l_pll_set Error 2\n");
1460 static u8 dvbc_philips_tdm1316l_inittab[] = {
1563 .demod_address = 0x1c,
1564 .inittab = dvbc_philips_tdm1316l_inittab,
1568 static void frontend_init(
struct ttusb* ttusb)
1575 ttusb->
fe->ops.tuner_ops.set_params = philips_tsa5059_tuner_set_params;
1578 alps_stv0299_config.
inittab = alps_bsbe1_inittab;
1581 ttusb->
fe->ops.set_voltage = ttusb_set_voltage;
1589 ttusb->
fe->ops.tuner_ops.set_params = ttusb_novas_grundig_29504_491_tuner_set_params;
1590 ttusb->
fe->ops.set_voltage = ttusb_set_voltage;
1598 ttusb->
fe->ops.tuner_ops.set_params = alps_tdbe2_tuner_set_params;
1604 ttusb->
fe->ops.tuner_ops.set_params = dvbc_philips_tdm1316l_tuner_set_params;
1613 ttusb->
fe->ops.tuner_ops.set_params = alps_tdmb7_tuner_set_params;
1620 ttusb->
fe->ops.tuner_ops.init = philips_tdm1316l_tuner_init;
1621 ttusb->
fe->ops.tuner_ops.set_params = philips_tdm1316l_tuner_set_params;
1628 printk(
"dvb-ttusb-budget: A frontend driver was not found for device [%04x:%04x]\n",
1633 printk(
"dvb-ttusb-budget: Frontend registration failed!\n");
1649 struct usb_device *
udev;
1650 struct ttusb *ttusb;
1653 dprintk(
"%s: TTUSB DVB connected\n", __func__);
1655 udev = interface_to_usbdev(intf);
1657 if (intf->altsetting->desc.bInterfaceNumber != 1)
return -
ENODEV;
1659 if (!(ttusb = kzalloc(
sizeof(
struct ttusb),
GFP_KERNEL)))
1671 ttusb_setup_interfaces(ttusb);
1673 result = ttusb_alloc_iso_urbs(ttusb);
1675 dprintk(
"%s: ttusb_alloc_iso_urbs - failed\n", __func__);
1681 if (ttusb_init_controller(ttusb))
1682 printk(
"ttusb_init_controller: error\n");
1687 "Technotrend/Hauppauge Nova-USB",
1690 ttusb_free_iso_urbs(ttusb);
1700 i2c_set_adapdata(&ttusb->
i2c_adap, ttusb);
1702 ttusb->
i2c_adap.algo = &ttusb_dec_algo;
1704 ttusb->
i2c_adap.dev.parent = &udev->dev;
1708 goto err_unregister_adapter;
1715 #ifdef TTUSB_HWSECTIONS
1716 ttusb->
dvb_demux.filternum = TTUSB_MAXFILTER;
1721 ttusb->
dvb_demux.start_feed = ttusb_start_feed;
1722 ttusb->
dvb_demux.stop_feed = ttusb_stop_feed;
1727 printk(
"ttusb_dvb: dvb_dmx_init failed (errno = %d)\n", result);
1729 goto err_i2c_del_adapter;
1734 ttusb->
dmxdev.capabilities = 0;
1738 printk(
"ttusb_dvb: dvb_dmxdev_init failed (errno = %d)\n",
1741 goto err_release_dmx;
1745 printk(
"ttusb_dvb: dvb_net_init failed!\n");
1747 goto err_release_dmxdev;
1750 usb_set_intfdata(intf, (
void *) ttusb);
1752 frontend_init(ttusb);
1760 err_i2c_del_adapter:
1762 err_unregister_adapter:
1769 struct ttusb *ttusb = usb_get_intfdata(intf);
1771 usb_set_intfdata(intf,
NULL);
1775 ttusb_stop_iso_xfer(ttusb);
1788 ttusb_free_iso_urbs(ttusb);
1792 dprintk(
"%s: TTUSB DVB disconnected\n", __func__);
1796 {USB_DEVICE(0xb48, 0x1003)},
1797 {USB_DEVICE(0xb48, 0x1004)},
1798 {USB_DEVICE(0xb48, 0x1005)},
1804 static struct usb_driver ttusb_driver = {
1806 .probe = ttusb_probe,
1807 .disconnect = ttusb_disconnect,
1808 .id_table = ttusb_table,