1 // SPDX-License-Identifier: GPL-2.0-or-later
5 * Copyright (c) 2002 Holger Waechtler <holger@convergence.de>
6 * Copyright (c) 2003 Felix Domke <tmbinc@elitedvb.net>
8 #include <linux/init.h>
9 #include <linux/slab.h>
10 #include <linux/wait.h>
12 #include <linux/module.h>
13 #include <linux/usb.h>
14 #include <linux/delay.h>
15 #include <linux/time.h>
16 #include <linux/errno.h>
17 #include <linux/jiffies.h>
18 #include <linux/mutex.h>
19 #include <linux/firmware.h>
21 #include <media/dvb_frontend.h>
22 #include <media/dmxdev.h>
23 #include <media/dvb_demux.h>
24 #include <media/dvb_net.h>
33 #include <linux/dvb/frontend.h>
34 #include <linux/dvb/dmx.h>
35 #include <linux/pci.h>
39 the DSP supports filtering in hardware, however, since the "muxstream"
40 is a bit braindead (no matching channel masks or no matching filter mask),
41 we won't support this - yet. it doesn't event support negative filters,
42 so the best way is maybe to keep TTUSB_HWSECTIONS undef'd and just
43 parse TS data. USB bandwidth will be a problem when having large
44 datastreams, especially for dvb-net, but hey, that's not my problem.
46 TTUSB_DISEQC, TTUSB_TONE:
47 let the STC do the diseqc/tone stuff. this isn't supported at least with
48 my TTUSB, so let it undef'd unless you want to implement another
49 frontend. never tested.
52 define it to > 3 for really hardcore debugging. you probably don't want
53 this unless the device doesn't load at all. > 2 for bandwidth statistics.
57 module_param(debug, int, 0644);
58 MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off).");
60 DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
62 #define dprintk(x...) do { if (debug) printk(KERN_DEBUG x); } while (0)
64 #define ISO_BUF_COUNT 4
65 #define FRAMES_PER_ISO_BUF 4
66 #define ISO_FRAME_SIZE 912
67 #define TTUSB_MAXCHANNEL 32
68 #ifdef TTUSB_HWSECTIONS
69 #define TTUSB_MAXFILTER 16 /* ??? */
72 #define TTUSB_REV_2_2 0x22
73 #define TTUSB_BUDGET_NAME "ttusb_stc_fw"
76 * since we're casting (struct ttusb*) <-> (struct dvb_demux*) around
77 * the dvb_demux field must be the first in struct!!
80 struct dvb_demux dvb_demux;
82 struct dvb_net dvbnet;
84 /* and one for USB access. */
88 struct dvb_adapter adapter;
89 struct usb_device *dev;
91 struct i2c_adapter i2c_adap;
96 unsigned int bulk_out_pipe;
97 unsigned int bulk_in_pipe;
98 unsigned int isoc_in_pipe;
102 struct urb *iso_urb[ISO_BUF_COUNT];
104 int running_feed_count;
108 u8 c; /* transaction counter, wraps around... */
109 enum fe_sec_tone_mode tone;
110 enum fe_sec_voltage voltage;
112 int mux_state; // 0..2 - MuxSyncWord, 3 - nMuxPacks, 4 - muxpack
115 int muxpack_ptr, muxpack_len;
119 int cc; /* MuxCounter - will increment on EVERY MUX PACKET */
120 /* (including stuffing. yes. really.) */
126 struct dvb_frontend* fe;
129 /* ugly workaround ... don't know why it's necessary to read */
130 /* all result codes. */
132 static int ttusb_cmd(struct ttusb *ttusb,
133 const u8 * data, int len, int needresult)
140 printk(KERN_DEBUG ">");
141 for (i = 0; i < len; ++i)
142 printk(KERN_CONT " %02x", data[i]);
143 printk(KERN_CONT "\n");
146 if (mutex_lock_interruptible(&ttusb->semusb) < 0)
149 err = usb_bulk_msg(ttusb->dev, ttusb->bulk_out_pipe,
150 (u8 *) data, len, &actual_len, 1000);
152 dprintk("%s: usb_bulk_msg(send) failed, err == %i!\n",
154 mutex_unlock(&ttusb->semusb);
157 if (actual_len != len) {
158 dprintk("%s: only wrote %d of %d bytes\n", __func__,
160 mutex_unlock(&ttusb->semusb);
164 err = usb_bulk_msg(ttusb->dev, ttusb->bulk_in_pipe,
165 ttusb->last_result, 32, &actual_len, 1000);
168 printk("%s: failed, receive error %d\n", __func__,
170 mutex_unlock(&ttusb->semusb);
175 actual_len = ttusb->last_result[3] + 4;
176 printk(KERN_DEBUG "<");
177 for (i = 0; i < actual_len; ++i)
178 printk(KERN_CONT " %02x", ttusb->last_result[i]);
179 printk(KERN_CONT "\n");
183 mutex_unlock(&ttusb->semusb);
187 static int ttusb_result(struct ttusb *ttusb, u8 * data, int len)
189 memcpy(data, ttusb->last_result, len);
190 mutex_unlock(&ttusb->semusb);
194 static int ttusb_i2c_msg(struct ttusb *ttusb,
195 u8 addr, u8 * snd_buf, u8 snd_len, u8 * rcv_buf,
202 if (snd_len > 0x28 - 7 || rcv_len > 0x20 - 7)
213 for (i = 0; i < snd_len; i++)
214 b[7 + i] = snd_buf[i];
216 err = ttusb_cmd(ttusb, b, snd_len + 7, 1);
221 err = ttusb_result(ttusb, b, 0x20);
223 /* check if the i2c transaction was successful */
224 if ((snd_len != b[5]) || (rcv_len != b[6])) return -EREMOTEIO;
228 if (err || b[0] != 0x55 || b[1] != id) {
230 ("%s: usb_bulk_msg(recv) failed, err == %i, id == %02x, b == ",
235 for (i = 0; i < rcv_len; i++)
236 rcv_buf[i] = b[7 + i];
242 static int master_xfer(struct i2c_adapter* adapter, struct i2c_msg *msg, int num)
244 struct ttusb *ttusb = i2c_get_adapdata(adapter);
248 if (mutex_lock_interruptible(&ttusb->semi2c) < 0)
252 u8 addr, snd_len, rcv_len, *snd_buf, *rcv_buf;
255 if (num > i + 1 && (msg[i + 1].flags & I2C_M_RD)) {
257 snd_buf = msg[i].buf;
258 snd_len = msg[i].len;
259 rcv_buf = msg[i + 1].buf;
260 rcv_len = msg[i + 1].len;
264 snd_buf = msg[i].buf;
265 snd_len = msg[i].len;
271 err = ttusb_i2c_msg(ttusb, addr,
272 snd_buf, snd_len, rcv_buf, rcv_len);
275 dprintk("%s: i == %i\n", __func__, i);
282 mutex_unlock(&ttusb->semi2c);
286 static int ttusb_boot_dsp(struct ttusb *ttusb)
288 const struct firmware *fw;
292 err = reject_firmware(&fw, "/*(DEBLOBBED)*/",
295 printk(KERN_ERR "ttusb-budget: failed to request firmware\n");
304 /* upload dsp code in 32 byte steps (36 didn't work for me ...) */
305 /* 32 is max packet size, no messages should be split. */
306 for (i = 0; i < fw->size; i += 28) {
307 memcpy(&b[4], &fw->data[i], 28);
311 err = ttusb_cmd(ttusb, b, 32, 0);
321 err = ttusb_cmd(ttusb, b, 4, 0);
330 err = ttusb_cmd(ttusb, b, 4, 0);
333 release_firmware(fw);
335 dprintk("%s: usb_bulk_msg() failed, return value %i!\n",
342 static int ttusb_set_channel(struct ttusb *ttusb, int chan_id, int filter_type,
347 u8 b[] = { 0xaa, ++ttusb->c, 0x22, 4, chan_id, filter_type,
348 (pid >> 8) & 0xff, pid & 0xff
351 err = ttusb_cmd(ttusb, b, sizeof(b), 0);
355 static int ttusb_del_channel(struct ttusb *ttusb, int channel_id)
359 u8 b[] = { 0xaa, ++ttusb->c, 0x23, 1, channel_id };
361 err = ttusb_cmd(ttusb, b, sizeof(b), 0);
365 #ifdef TTUSB_HWSECTIONS
366 static int ttusb_set_filter(struct ttusb *ttusb, int filter_id,
367 int associated_chan, u8 filter[8], u8 mask[8])
371 u8 b[] = { 0xaa, 0, 0x24, 0x1a, filter_id, associated_chan,
372 filter[0], filter[1], filter[2], filter[3],
373 filter[4], filter[5], filter[6], filter[7],
374 filter[8], filter[9], filter[10], filter[11],
375 mask[0], mask[1], mask[2], mask[3],
376 mask[4], mask[5], mask[6], mask[7],
377 mask[8], mask[9], mask[10], mask[11]
380 err = ttusb_cmd(ttusb, b, sizeof(b), 0);
384 static int ttusb_del_filter(struct ttusb *ttusb, int filter_id)
388 u8 b[] = { 0xaa, ++ttusb->c, 0x25, 1, filter_id };
390 err = ttusb_cmd(ttusb, b, sizeof(b), 0);
395 static int ttusb_init_controller(struct ttusb *ttusb)
397 u8 b0[] = { 0xaa, ++ttusb->c, 0x15, 1, 0 };
398 u8 b1[] = { 0xaa, ++ttusb->c, 0x15, 1, 1 };
399 u8 b2[] = { 0xaa, ++ttusb->c, 0x32, 1, 0 };
400 /* i2c write read: 5 bytes, addr 0x10, 0x02 bytes write, 1 bytes read. */
402 { 0xaa, ++ttusb->c, 0x31, 5, 0x10, 0x02, 0x01, 0x00, 0x1e };
404 { 0x55, ttusb->c, 0x31, 4, 0x10, 0x02, 0x01, 0x00, 0x1e };
406 u8 get_version[] = { 0xaa, ++ttusb->c, 0x17, 5, 0, 0, 0, 0, 0 };
407 u8 get_dsp_version[0x20] =
408 { 0xaa, ++ttusb->c, 0x26, 28, 0, 0, 0, 0, 0 };
412 if ((err = ttusb_cmd(ttusb, b0, sizeof(b0), 0)))
415 /* reset board (again?) */
416 if ((err = ttusb_cmd(ttusb, b1, sizeof(b1), 0)))
419 ttusb_boot_dsp(ttusb);
421 /* set i2c bit rate */
422 if ((err = ttusb_cmd(ttusb, b2, sizeof(b2), 0)))
425 if ((err = ttusb_cmd(ttusb, b3, sizeof(b3), 1)))
428 err = ttusb_result(ttusb, b4, sizeof(b4));
430 if ((err = ttusb_cmd(ttusb, get_version, sizeof(get_version), 1)))
433 if ((err = ttusb_result(ttusb, get_version, sizeof(get_version))))
436 dprintk("%s: stc-version: %c%c%c%c%c\n", __func__,
437 get_version[4], get_version[5], get_version[6],
438 get_version[7], get_version[8]);
440 if (memcmp(get_version + 4, "V 0.0", 5) &&
441 memcmp(get_version + 4, "V 1.1", 5) &&
442 memcmp(get_version + 4, "V 2.1", 5) &&
443 memcmp(get_version + 4, "V 2.2", 5)) {
445 ("%s: unknown STC version %c%c%c%c%c, please report!\n",
446 __func__, get_version[4], get_version[5],
447 get_version[6], get_version[7], get_version[8]);
450 ttusb->revision = ((get_version[6] - '0') << 4) |
451 (get_version[8] - '0');
454 ttusb_cmd(ttusb, get_dsp_version, sizeof(get_dsp_version), 1);
459 ttusb_result(ttusb, get_dsp_version, sizeof(get_dsp_version));
462 printk("%s: dsp-version: %c%c%c\n", __func__,
463 get_dsp_version[4], get_dsp_version[5], get_dsp_version[6]);
468 static int ttusb_send_diseqc(struct dvb_frontend* fe,
469 const struct dvb_diseqc_master_cmd *cmd)
471 struct ttusb* ttusb = (struct ttusb*) fe->dvb->priv;
472 u8 b[12] = { 0xaa, ++ttusb->c, 0x18 };
476 b[3] = 4 + 2 + cmd->msg_len;
477 b[4] = 0xFF; /* send diseqc master, not burst */
480 memcpy(b + 5, cmd->msg, cmd->msg_len);
483 if ((err = ttusb_cmd(ttusb, b, 4 + b[3], 0))) {
484 dprintk("%s: usb_bulk_msg() failed, return value %i!\n",
492 static int ttusb_update_lnb(struct ttusb *ttusb)
494 u8 b[] = { 0xaa, ++ttusb->c, 0x16, 5, /*power: */ 1,
495 ttusb->voltage == SEC_VOLTAGE_18 ? 0 : 1,
496 ttusb->tone == SEC_TONE_ON ? 1 : 0, 1, 1
501 if ((err = ttusb_cmd(ttusb, b, sizeof(b), 0))) {
502 dprintk("%s: usb_bulk_msg() failed, return value %i!\n",
509 static int ttusb_set_voltage(struct dvb_frontend *fe,
510 enum fe_sec_voltage voltage)
512 struct ttusb* ttusb = (struct ttusb*) fe->dvb->priv;
514 ttusb->voltage = voltage;
515 return ttusb_update_lnb(ttusb);
519 static int ttusb_set_tone(struct dvb_frontend *fe, enum fe_sec_tone_mode tone)
521 struct ttusb* ttusb = (struct ttusb*) fe->dvb->priv;
524 return ttusb_update_lnb(ttusb);
530 static void ttusb_set_led_freq(struct ttusb *ttusb, u8 freq)
532 u8 b[] = { 0xaa, ++ttusb->c, 0x19, 1, freq };
535 err = ttusb_cmd(ttusb, b, sizeof(b), 0);
537 dprintk("%s: usb_bulk_msg() failed, return value %i!\n",
543 /*****************************************************************************/
545 #ifdef TTUSB_HWSECTIONS
546 static void ttusb_handle_ts_data(struct ttusb_channel *channel,
547 const u8 * data, int len);
548 static void ttusb_handle_sec_data(struct ttusb_channel *channel,
549 const u8 * data, int len);
552 static int numpkt, numts, numstuff, numsec, numinvalid;
553 static unsigned long lastj;
555 static void ttusb_process_muxpack(struct ttusb *ttusb, const u8 * muxpack,
561 if (len < 4 || len & 0x1) {
562 pr_warn("%s: muxpack has invalid len %d\n", __func__, len);
567 for (i = 0; i < len; i += 2)
568 csum ^= le16_to_cpup((__le16 *) (muxpack + i));
570 printk("%s: muxpack with incorrect checksum, ignoring\n",
576 cc = (muxpack[len - 4] << 8) | muxpack[len - 3];
578 if ((cc != ttusb->cc) && (ttusb->cc != -1))
579 printk("%s: cc discontinuity (%d frames missing)\n",
580 __func__, (cc - ttusb->cc) & 0x7FFF);
581 ttusb->cc = (cc + 1) & 0x7FFF;
582 if (muxpack[0] & 0x80) {
583 #ifdef TTUSB_HWSECTIONS
585 int pusi = muxpack[0] & 0x40;
586 int channel = muxpack[0] & 0x1F;
587 int payload = muxpack[1];
588 const u8 *data = muxpack + 2;
589 /* check offset flag */
590 if (muxpack[0] & 0x20)
593 ttusb_handle_sec_data(ttusb->channel + channel, data,
597 if ((!!(ttusb->muxpack[0] & 0x20)) ^
598 !!(ttusb->muxpack[1] & 1))
601 printk("cc: %04x\n", (data[0] << 8) | data[1]);
604 } else if (muxpack[0] == 0x47) {
605 #ifdef TTUSB_HWSECTIONS
606 /* we have TS data here! */
607 int pid = ((muxpack[1] & 0x0F) << 8) | muxpack[2];
609 for (channel = 0; channel < TTUSB_MAXCHANNEL; ++channel)
610 if (ttusb->channel[channel].active
611 && (pid == ttusb->channel[channel].pid))
612 ttusb_handle_ts_data(ttusb->channel +
617 dvb_dmx_swfilter_packets(&ttusb->dvb_demux, muxpack, 1);
618 } else if (muxpack[0] != 0) {
620 printk("illegal muxpack type %02x\n", muxpack[0]);
625 static void ttusb_process_frame(struct ttusb *ttusb, u8 * data, int len)
630 printk("%s: too much work\n", __func__);
634 switch (ttusb->mux_state) {
642 ttusb->mux_state = 0;
644 dprintk("%s: %02x\n",
646 printk(KERN_INFO "%s: lost sync.\n",
655 ttusb->mux_npacks = *data++;
657 ttusb->muxpack_ptr = 0;
658 /* maximum bytes, until we know the length */
659 ttusb->muxpack_len = 2;
666 (ttusb->muxpack_len -
671 memcpy(ttusb->muxpack + ttusb->muxpack_ptr,
673 ttusb->muxpack_ptr += avail;
674 BUG_ON(ttusb->muxpack_ptr > 264);
677 /* determine length */
678 if (ttusb->muxpack_ptr == 2) {
679 if (ttusb->muxpack[0] & 0x80) {
681 ttusb->muxpack[1] + 2;
688 muxpack[0] & 0x20)) ^
693 ttusb->muxpack_len += 4;
694 } else if (ttusb->muxpack[0] ==
698 else if (ttusb->muxpack[0] == 0x00)
700 ttusb->muxpack[1] + 2 +
704 ("%s: invalid state: first byte is %x\n",
707 ttusb->mux_state = 0;
712 * if length is valid and we reached the end:
715 if ((ttusb->muxpack_ptr >= 2) &&
716 (ttusb->muxpack_ptr ==
717 ttusb->muxpack_len)) {
718 ttusb_process_muxpack(ttusb,
723 ttusb->muxpack_ptr = 0;
724 /* maximum bytes, until we know the length */
725 ttusb->muxpack_len = 2;
729 * return to search-sync state
731 if (!ttusb->mux_npacks--) {
732 ttusb->mux_state = 0;
745 static void ttusb_iso_irq(struct urb *urb)
747 struct ttusb *ttusb = urb->context;
748 struct usb_iso_packet_descriptor *d;
752 if (!ttusb->iso_streaming)
756 printk("%s: status %d, errcount == %d, length == %i\n",
758 urb->status, urb->error_count, urb->actual_length);
762 for (i = 0; i < urb->number_of_packets; ++i) {
764 if (time_after_eq(jiffies, lastj + HZ)) {
765 dprintk("frames/s: %lu (ts: %d, stuff %d, sec: %d, invalid: %d, all: %d)\n",
766 numpkt * HZ / (jiffies - lastj),
767 numts, numstuff, numsec, numinvalid,
768 numts + numstuff + numsec + numinvalid);
769 numts = numstuff = numsec = numinvalid = 0;
773 d = &urb->iso_frame_desc[i];
774 data = urb->transfer_buffer + d->offset;
775 len = d->actual_length;
776 d->actual_length = 0;
778 ttusb_process_frame(ttusb, data, len);
781 usb_submit_urb(urb, GFP_ATOMIC);
784 static void ttusb_free_iso_urbs(struct ttusb *ttusb)
788 for (i = 0; i < ISO_BUF_COUNT; i++)
789 usb_free_urb(ttusb->iso_urb[i]);
790 kfree(ttusb->iso_buffer);
793 static int ttusb_alloc_iso_urbs(struct ttusb *ttusb)
797 ttusb->iso_buffer = kcalloc(FRAMES_PER_ISO_BUF * ISO_BUF_COUNT,
798 ISO_FRAME_SIZE, GFP_KERNEL);
799 if (!ttusb->iso_buffer)
802 for (i = 0; i < ISO_BUF_COUNT; i++) {
807 usb_alloc_urb(FRAMES_PER_ISO_BUF, GFP_ATOMIC))) {
808 ttusb_free_iso_urbs(ttusb);
812 ttusb->iso_urb[i] = urb;
818 static void ttusb_stop_iso_xfer(struct ttusb *ttusb)
822 for (i = 0; i < ISO_BUF_COUNT; i++)
823 usb_kill_urb(ttusb->iso_urb[i]);
825 ttusb->iso_streaming = 0;
828 static int ttusb_start_iso_xfer(struct ttusb *ttusb)
830 int i, j, err, buffer_offset = 0;
832 if (ttusb->iso_streaming) {
833 printk("%s: iso xfer already running!\n", __func__);
839 ttusb->mux_state = 0;
841 for (i = 0; i < ISO_BUF_COUNT; i++) {
842 int frame_offset = 0;
843 struct urb *urb = ttusb->iso_urb[i];
845 urb->dev = ttusb->dev;
846 urb->context = ttusb;
847 urb->complete = ttusb_iso_irq;
848 urb->pipe = ttusb->isoc_in_pipe;
849 urb->transfer_flags = URB_ISO_ASAP;
851 urb->number_of_packets = FRAMES_PER_ISO_BUF;
852 urb->transfer_buffer_length =
853 ISO_FRAME_SIZE * FRAMES_PER_ISO_BUF;
854 urb->transfer_buffer = ttusb->iso_buffer + buffer_offset;
855 buffer_offset += ISO_FRAME_SIZE * FRAMES_PER_ISO_BUF;
857 for (j = 0; j < FRAMES_PER_ISO_BUF; j++) {
858 urb->iso_frame_desc[j].offset = frame_offset;
859 urb->iso_frame_desc[j].length = ISO_FRAME_SIZE;
860 frame_offset += ISO_FRAME_SIZE;
864 for (i = 0; i < ISO_BUF_COUNT; i++) {
865 if ((err = usb_submit_urb(ttusb->iso_urb[i], GFP_ATOMIC))) {
866 ttusb_stop_iso_xfer(ttusb);
868 ("%s: failed urb submission (%i: err = %i)!\n",
874 ttusb->iso_streaming = 1;
879 #ifdef TTUSB_HWSECTIONS
880 static void ttusb_handle_ts_data(struct dvb_demux_feed *dvbdmxfeed, const u8 * data,
883 dvbdmxfeed->cb.ts(data, len, 0, 0, &dvbdmxfeed->feed.ts, 0);
886 static void ttusb_handle_sec_data(struct dvb_demux_feed *dvbdmxfeed, const u8 * data,
889 // struct dvb_demux_feed *dvbdmxfeed = channel->dvbdmxfeed;
890 #error TODO: handle ugly stuff
891 // dvbdmxfeed->cb.sec(data, len, 0, 0, &dvbdmxfeed->feed.sec, 0);
895 static int ttusb_start_feed(struct dvb_demux_feed *dvbdmxfeed)
897 struct ttusb *ttusb = (struct ttusb *) dvbdmxfeed->demux;
900 dprintk("ttusb_start_feed\n");
902 switch (dvbdmxfeed->type) {
911 if (dvbdmxfeed->type == DMX_TYPE_TS) {
912 switch (dvbdmxfeed->pes_type) {
915 case DMX_PES_TELETEXT:
924 #ifdef TTUSB_HWSECTIONS
925 #error TODO: allocate filters
926 if (dvbdmxfeed->type == DMX_TYPE_TS) {
928 } else if (dvbdmxfeed->type == DMX_TYPE_SEC) {
933 ttusb_set_channel(ttusb, dvbdmxfeed->index, feed_type, dvbdmxfeed->pid);
935 if (0 == ttusb->running_feed_count++)
936 ttusb_start_iso_xfer(ttusb);
941 static int ttusb_stop_feed(struct dvb_demux_feed *dvbdmxfeed)
943 struct ttusb *ttusb = (struct ttusb *) dvbdmxfeed->demux;
945 ttusb_del_channel(ttusb, dvbdmxfeed->index);
947 if (--ttusb->running_feed_count == 0)
948 ttusb_stop_iso_xfer(ttusb);
953 static int ttusb_setup_interfaces(struct ttusb *ttusb)
955 usb_set_interface(ttusb->dev, 1, 1);
957 ttusb->bulk_out_pipe = usb_sndbulkpipe(ttusb->dev, 1);
958 ttusb->bulk_in_pipe = usb_rcvbulkpipe(ttusb->dev, 1);
959 ttusb->isoc_in_pipe = usb_rcvisocpipe(ttusb->dev, 2);
965 static u8 stc_firmware[8192];
967 static int stc_open(struct inode *inode, struct file *file)
969 struct ttusb *ttusb = file->private_data;
972 for (addr = 0; addr < 8192; addr += 16) {
973 u8 snd_buf[2] = { addr >> 8, addr & 0xFF };
974 ttusb_i2c_msg(ttusb, 0x50, snd_buf, 2, stc_firmware + addr,
981 static ssize_t stc_read(struct file *file, char *buf, size_t count,
984 return simple_read_from_buffer(buf, count, offset, stc_firmware, 8192);
987 static int stc_release(struct inode *inode, struct file *file)
992 static const struct file_operations stc_fops = {
993 .owner = THIS_MODULE,
996 .release = stc_release,
1000 static u32 functionality(struct i2c_adapter *adapter)
1002 return I2C_FUNC_I2C;
1007 static int alps_tdmb7_tuner_set_params(struct dvb_frontend *fe)
1009 struct dtv_frontend_properties *p = &fe->dtv_property_cache;
1010 struct ttusb* ttusb = (struct ttusb*) fe->dvb->priv;
1012 struct i2c_msg msg = {.addr=0x61, .flags=0, .buf=data, .len=sizeof(data) };
1015 div = (p->frequency + 36166667) / 166667;
1017 data[0] = (div >> 8) & 0x7f;
1018 data[1] = div & 0xff;
1019 data[2] = ((div >> 10) & 0x60) | 0x85;
1020 data[3] = p->frequency < 592000000 ? 0x40 : 0x80;
1022 if (fe->ops.i2c_gate_ctrl)
1023 fe->ops.i2c_gate_ctrl(fe, 1);
1024 if (i2c_transfer(&ttusb->i2c_adap, &msg, 1) != 1) return -EIO;
1028 static struct cx22700_config alps_tdmb7_config = {
1029 .demod_address = 0x43,
1036 static int philips_tdm1316l_tuner_init(struct dvb_frontend* fe)
1038 struct ttusb* ttusb = (struct ttusb*) fe->dvb->priv;
1039 static u8 td1316_init[] = { 0x0b, 0xf5, 0x85, 0xab };
1040 static u8 disable_mc44BC374c[] = { 0x1d, 0x74, 0xa0, 0x68 };
1041 struct i2c_msg tuner_msg = { .addr=0x60, .flags=0, .buf=td1316_init, .len=sizeof(td1316_init) };
1043 // setup PLL configuration
1044 if (fe->ops.i2c_gate_ctrl)
1045 fe->ops.i2c_gate_ctrl(fe, 1);
1046 if (i2c_transfer(&ttusb->i2c_adap, &tuner_msg, 1) != 1) return -EIO;
1049 // disable the mc44BC374c (do not check for errors)
1050 tuner_msg.addr = 0x65;
1051 tuner_msg.buf = disable_mc44BC374c;
1052 tuner_msg.len = sizeof(disable_mc44BC374c);
1053 if (fe->ops.i2c_gate_ctrl)
1054 fe->ops.i2c_gate_ctrl(fe, 1);
1055 if (i2c_transfer(&ttusb->i2c_adap, &tuner_msg, 1) != 1) {
1056 i2c_transfer(&ttusb->i2c_adap, &tuner_msg, 1);
1062 static int philips_tdm1316l_tuner_set_params(struct dvb_frontend *fe)
1064 struct dtv_frontend_properties *p = &fe->dtv_property_cache;
1065 struct ttusb* ttusb = (struct ttusb*) fe->dvb->priv;
1067 struct i2c_msg tuner_msg = {.addr=0x60, .flags=0, .buf=tuner_buf, .len=sizeof(tuner_buf) };
1068 int tuner_frequency = 0;
1069 u8 band, cp, filter;
1071 // determine charge pump
1072 tuner_frequency = p->frequency + 36130000;
1073 if (tuner_frequency < 87000000) return -EINVAL;
1074 else if (tuner_frequency < 130000000) cp = 3;
1075 else if (tuner_frequency < 160000000) cp = 5;
1076 else if (tuner_frequency < 200000000) cp = 6;
1077 else if (tuner_frequency < 290000000) cp = 3;
1078 else if (tuner_frequency < 420000000) cp = 5;
1079 else if (tuner_frequency < 480000000) cp = 6;
1080 else if (tuner_frequency < 620000000) cp = 3;
1081 else if (tuner_frequency < 830000000) cp = 5;
1082 else if (tuner_frequency < 895000000) cp = 7;
1083 else return -EINVAL;
1086 if (p->frequency < 49000000)
1088 else if (p->frequency < 159000000)
1090 else if (p->frequency < 444000000)
1092 else if (p->frequency < 861000000)
1094 else return -EINVAL;
1097 switch (p->bandwidth_hz) {
1099 tda1004x_writereg(fe, 0x0C, 0);
1104 tda1004x_writereg(fe, 0x0C, 0);
1109 tda1004x_writereg(fe, 0x0C, 0xFF);
1117 // calculate divisor
1118 // ((36130000+((1000000/6)/2)) + Finput)/(1000000/6)
1119 tuner_frequency = (((p->frequency / 1000) * 6) + 217280) / 1000;
1121 // setup tuner buffer
1122 tuner_buf[0] = tuner_frequency >> 8;
1123 tuner_buf[1] = tuner_frequency & 0xff;
1124 tuner_buf[2] = 0xca;
1125 tuner_buf[3] = (cp << 5) | (filter << 3) | band;
1127 if (fe->ops.i2c_gate_ctrl)
1128 fe->ops.i2c_gate_ctrl(fe, 1);
1129 if (i2c_transfer(&ttusb->i2c_adap, &tuner_msg, 1) != 1)
1136 static int philips_tdm1316l_request_firmware(struct dvb_frontend* fe, const struct firmware **fw, char* name)
1138 struct ttusb* ttusb = (struct ttusb*) fe->dvb->priv;
1140 return reject_firmware(fw, name, &ttusb->dev->dev);
1143 static struct tda1004x_config philips_tdm1316l_config = {
1145 .demod_address = 0x8,
1148 .request_firmware = philips_tdm1316l_request_firmware,
1151 static u8 alps_bsbe1_inittab[] = {
1155 0x04, 0x7d, /* F22FR = 0x7d, F22 = f_VCO / 128 / 0x7d = 22 kHz */
1156 0x05, 0x35, /* I2CT = 0, SCLT = 1, SDAT = 1 */
1157 0x06, 0x40, /* DAC not used, set to high impendance mode */
1158 0x07, 0x00, /* DAC LSB */
1159 0x08, 0x40, /* DiSEqC off, LNB power on OP2/LOCK pin on */
1160 0x09, 0x00, /* FIFO */
1161 0x0c, 0x51, /* OP1 ctl = Normal, OP1 val = 1 (LNB Power ON) */
1162 0x0d, 0x82, /* DC offset compensation = ON, beta_agc1 = 2 */
1163 0x0e, 0x23, /* alpha_tmg = 2, beta_tmg = 3 */
1164 0x10, 0x3f, // AGC2 0x3d
1167 0x15, 0xc9, // lock detector threshold
1178 0x28, 0x00, // out imp: normal out type: parallel FEC mode:0
1179 0x29, 0x1e, // 1/2 threshold
1180 0x2a, 0x14, // 2/3 threshold
1181 0x2b, 0x0f, // 3/4 threshold
1182 0x2c, 0x09, // 5/6 threshold
1183 0x2d, 0x05, // 7/8 threshold
1185 0x31, 0x1f, // test all FECs
1186 0x32, 0x19, // viterbi and synchro search
1187 0x33, 0xfc, // rs control
1188 0x34, 0x93, // error control
1193 static u8 alps_bsru6_inittab[] = {
1197 0x04, 0x7d, /* F22FR = 0x7d, F22 = f_VCO / 128 / 0x7d = 22 kHz */
1198 0x05, 0x35, /* I2CT = 0, SCLT = 1, SDAT = 1 */
1199 0x06, 0x40, /* DAC not used, set to high impendance mode */
1200 0x07, 0x00, /* DAC LSB */
1201 0x08, 0x40, /* DiSEqC off, LNB power on OP2/LOCK pin on */
1202 0x09, 0x00, /* FIFO */
1203 0x0c, 0x51, /* OP1 ctl = Normal, OP1 val = 1 (LNB Power ON) */
1204 0x0d, 0x82, /* DC offset compensation = ON, beta_agc1 = 2 */
1205 0x0e, 0x23, /* alpha_tmg = 2, beta_tmg = 3 */
1206 0x10, 0x3f, // AGC2 0x3d
1209 0x15, 0xc9, // lock detector threshold
1220 0x28, 0x00, // out imp: normal out type: parallel FEC mode:0
1221 0x29, 0x1e, // 1/2 threshold
1222 0x2a, 0x14, // 2/3 threshold
1223 0x2b, 0x0f, // 3/4 threshold
1224 0x2c, 0x09, // 5/6 threshold
1225 0x2d, 0x05, // 7/8 threshold
1227 0x31, 0x1f, // test all FECs
1228 0x32, 0x19, // viterbi and synchro search
1229 0x33, 0xfc, // rs control
1230 0x34, 0x93, // error control
1235 static int alps_stv0299_set_symbol_rate(struct dvb_frontend *fe, u32 srate, u32 ratio)
1240 if (srate < 1500000) {
1243 } else if (srate < 3000000) {
1246 } else if (srate < 7000000) {
1249 } else if (srate < 14000000) {
1252 } else if (srate < 30000000) {
1255 } else if (srate < 45000000) {
1260 stv0299_writereg(fe, 0x13, aclk);
1261 stv0299_writereg(fe, 0x14, bclk);
1262 stv0299_writereg(fe, 0x1f, (ratio >> 16) & 0xff);
1263 stv0299_writereg(fe, 0x20, (ratio >> 8) & 0xff);
1264 stv0299_writereg(fe, 0x21, (ratio) & 0xf0);
1269 static int philips_tsa5059_tuner_set_params(struct dvb_frontend *fe)
1271 struct dtv_frontend_properties *p = &fe->dtv_property_cache;
1272 struct ttusb* ttusb = (struct ttusb*) fe->dvb->priv;
1275 struct i2c_msg msg = {.addr = 0x61,.flags = 0,.buf = buf,.len = sizeof(buf) };
1277 if ((p->frequency < 950000) || (p->frequency > 2150000))
1280 div = (p->frequency + (125 - 1)) / 125; /* round correctly */
1281 buf[0] = (div >> 8) & 0x7f;
1282 buf[1] = div & 0xff;
1283 buf[2] = 0x80 | ((div & 0x18000) >> 10) | 4;
1286 if (p->frequency > 1530000)
1289 /* BSBE1 wants XCE bit set */
1290 if (ttusb->revision == TTUSB_REV_2_2)
1293 if (fe->ops.i2c_gate_ctrl)
1294 fe->ops.i2c_gate_ctrl(fe, 1);
1295 if (i2c_transfer(&ttusb->i2c_adap, &msg, 1) != 1)
1301 static struct stv0299_config alps_stv0299_config = {
1302 .demod_address = 0x68,
1303 .inittab = alps_bsru6_inittab,
1307 .lock_output = STV0299_LOCKOUTPUT_1,
1308 .volt13_op0_op1 = STV0299_VOLT13_OP1,
1309 .min_delay_ms = 100,
1310 .set_symbol_rate = alps_stv0299_set_symbol_rate,
1313 static int ttusb_novas_grundig_29504_491_tuner_set_params(struct dvb_frontend *fe)
1315 struct dtv_frontend_properties *p = &fe->dtv_property_cache;
1316 struct ttusb* ttusb = (struct ttusb*) fe->dvb->priv;
1319 struct i2c_msg msg = {.addr = 0x61,.flags = 0,.buf = buf,.len = sizeof(buf) };
1321 div = p->frequency / 125;
1323 buf[0] = (div >> 8) & 0x7f;
1324 buf[1] = div & 0xff;
1328 if (fe->ops.i2c_gate_ctrl)
1329 fe->ops.i2c_gate_ctrl(fe, 1);
1330 if (i2c_transfer(&ttusb->i2c_adap, &msg, 1) != 1)
1336 static struct tda8083_config ttusb_novas_grundig_29504_491_config = {
1338 .demod_address = 0x68,
1341 static int alps_tdbe2_tuner_set_params(struct dvb_frontend *fe)
1343 struct dtv_frontend_properties *p = &fe->dtv_property_cache;
1344 struct ttusb* ttusb = fe->dvb->priv;
1347 struct i2c_msg msg = { .addr = 0x62, .flags = 0, .buf = data, .len = sizeof(data) };
1349 div = (p->frequency + 35937500 + 31250) / 62500;
1351 data[0] = (div >> 8) & 0x7f;
1352 data[1] = div & 0xff;
1353 data[2] = 0x85 | ((div >> 10) & 0x60);
1354 data[3] = (p->frequency < 174000000 ? 0x88 : p->frequency < 470000000 ? 0x84 : 0x81);
1356 if (fe->ops.i2c_gate_ctrl)
1357 fe->ops.i2c_gate_ctrl(fe, 1);
1358 if (i2c_transfer (&ttusb->i2c_adap, &msg, 1) != 1)
1365 static struct ves1820_config alps_tdbe2_config = {
1366 .demod_address = 0x09,
1369 .selagc = VES1820_SELAGC_SIGNAMPERR,
1372 static u8 read_pwm(struct ttusb* ttusb)
1376 struct i2c_msg msg[] = { { .addr = 0x50,.flags = 0,.buf = &b,.len = 1 },
1377 { .addr = 0x50,.flags = I2C_M_RD,.buf = &pwm,.len = 1} };
1379 if ((i2c_transfer(&ttusb->i2c_adap, msg, 2) != 2) || (pwm == 0xff))
1386 static int dvbc_philips_tdm1316l_tuner_set_params(struct dvb_frontend *fe)
1388 struct dtv_frontend_properties *p = &fe->dtv_property_cache;
1389 struct ttusb *ttusb = (struct ttusb *) fe->dvb->priv;
1391 struct i2c_msg tuner_msg = {.addr = 0x60,
1394 .len = sizeof(tuner_buf) };
1395 int tuner_frequency = 0;
1396 u8 band, cp, filter;
1398 // determine charge pump
1399 tuner_frequency = p->frequency;
1400 if (tuner_frequency < 87000000) {return -EINVAL;}
1401 else if (tuner_frequency < 130000000) {cp = 3; band = 1;}
1402 else if (tuner_frequency < 160000000) {cp = 5; band = 1;}
1403 else if (tuner_frequency < 200000000) {cp = 6; band = 1;}
1404 else if (tuner_frequency < 290000000) {cp = 3; band = 2;}
1405 else if (tuner_frequency < 420000000) {cp = 5; band = 2;}
1406 else if (tuner_frequency < 480000000) {cp = 6; band = 2;}
1407 else if (tuner_frequency < 620000000) {cp = 3; band = 4;}
1408 else if (tuner_frequency < 830000000) {cp = 5; band = 4;}
1409 else if (tuner_frequency < 895000000) {cp = 7; band = 4;}
1410 else {return -EINVAL;}
1412 // assume PLL filter should always be 8MHz for the moment.
1415 // calculate divisor
1416 // (Finput + Fif)/Fref; Fif = 36125000 Hz, Fref = 62500 Hz
1417 tuner_frequency = ((p->frequency + 36125000) / 62500);
1419 // setup tuner buffer
1420 tuner_buf[0] = tuner_frequency >> 8;
1421 tuner_buf[1] = tuner_frequency & 0xff;
1422 tuner_buf[2] = 0xc8;
1423 tuner_buf[3] = (cp << 5) | (filter << 3) | band;
1424 tuner_buf[4] = 0x80;
1426 if (fe->ops.i2c_gate_ctrl)
1427 fe->ops.i2c_gate_ctrl(fe, 1);
1428 if (i2c_transfer(&ttusb->i2c_adap, &tuner_msg, 1) != 1) {
1429 printk("dvb-ttusb-budget: dvbc_philips_tdm1316l_pll_set Error 1\n");
1435 if (fe->ops.i2c_gate_ctrl)
1436 fe->ops.i2c_gate_ctrl(fe, 1);
1437 if (i2c_transfer(&ttusb->i2c_adap, &tuner_msg, 1) != 1) {
1438 printk("dvb-ttusb-budget: dvbc_philips_tdm1316l_pll_set Error 2\n");
1447 static u8 dvbc_philips_tdm1316l_inittab[] = {
1549 static struct stv0297_config dvbc_philips_tdm1316l_config = {
1550 .demod_address = 0x1c,
1551 .inittab = dvbc_philips_tdm1316l_inittab,
1555 static void frontend_init(struct ttusb* ttusb)
1557 switch(le16_to_cpu(ttusb->dev->descriptor.idProduct)) {
1558 case 0x1003: // Hauppauge/TT Nova-USB-S budget (stv0299/ALPS BSRU6|BSBE1(tsa5059))
1559 // try the stv0299 based first
1560 ttusb->fe = dvb_attach(stv0299_attach, &alps_stv0299_config, &ttusb->i2c_adap);
1561 if (ttusb->fe != NULL) {
1562 ttusb->fe->ops.tuner_ops.set_params = philips_tsa5059_tuner_set_params;
1564 if(ttusb->revision == TTUSB_REV_2_2) { // ALPS BSBE1
1565 alps_stv0299_config.inittab = alps_bsbe1_inittab;
1566 dvb_attach(lnbp21_attach, ttusb->fe, &ttusb->i2c_adap, 0, 0);
1567 } else { // ALPS BSRU6
1568 ttusb->fe->ops.set_voltage = ttusb_set_voltage;
1573 // Grundig 29504-491
1574 ttusb->fe = dvb_attach(tda8083_attach, &ttusb_novas_grundig_29504_491_config, &ttusb->i2c_adap);
1575 if (ttusb->fe != NULL) {
1576 ttusb->fe->ops.tuner_ops.set_params = ttusb_novas_grundig_29504_491_tuner_set_params;
1577 ttusb->fe->ops.set_voltage = ttusb_set_voltage;
1582 case 0x1004: // Hauppauge/TT DVB-C budget (ves1820/ALPS TDBE2(sp5659))
1583 ttusb->fe = dvb_attach(ves1820_attach, &alps_tdbe2_config, &ttusb->i2c_adap, read_pwm(ttusb));
1584 if (ttusb->fe != NULL) {
1585 ttusb->fe->ops.tuner_ops.set_params = alps_tdbe2_tuner_set_params;
1589 ttusb->fe = dvb_attach(stv0297_attach, &dvbc_philips_tdm1316l_config, &ttusb->i2c_adap);
1590 if (ttusb->fe != NULL) {
1591 ttusb->fe->ops.tuner_ops.set_params = dvbc_philips_tdm1316l_tuner_set_params;
1596 case 0x1005: // Hauppauge/TT Nova-USB-t budget (tda10046/Philips td1316(tda6651tt) OR cx22700/ALPS TDMB7(??))
1597 // try the ALPS TDMB7 first
1598 ttusb->fe = dvb_attach(cx22700_attach, &alps_tdmb7_config, &ttusb->i2c_adap);
1599 if (ttusb->fe != NULL) {
1600 ttusb->fe->ops.tuner_ops.set_params = alps_tdmb7_tuner_set_params;
1605 ttusb->fe = dvb_attach(tda10046_attach, &philips_tdm1316l_config, &ttusb->i2c_adap);
1606 if (ttusb->fe != NULL) {
1607 ttusb->fe->ops.tuner_ops.init = philips_tdm1316l_tuner_init;
1608 ttusb->fe->ops.tuner_ops.set_params = philips_tdm1316l_tuner_set_params;
1614 if (ttusb->fe == NULL) {
1615 printk("dvb-ttusb-budget: A frontend driver was not found for device [%04x:%04x]\n",
1616 le16_to_cpu(ttusb->dev->descriptor.idVendor),
1617 le16_to_cpu(ttusb->dev->descriptor.idProduct));
1619 if (dvb_register_frontend(&ttusb->adapter, ttusb->fe)) {
1620 printk("dvb-ttusb-budget: Frontend registration failed!\n");
1621 dvb_frontend_detach(ttusb->fe);
1629 static const struct i2c_algorithm ttusb_dec_algo = {
1630 .master_xfer = master_xfer,
1631 .functionality = functionality,
1634 static int ttusb_probe(struct usb_interface *intf, const struct usb_device_id *id)
1636 struct usb_device *udev;
1637 struct ttusb *ttusb;
1640 dprintk("%s: TTUSB DVB connected\n", __func__);
1642 udev = interface_to_usbdev(intf);
1644 if (intf->altsetting->desc.bInterfaceNumber != 1) return -ENODEV;
1646 if (!(ttusb = kzalloc(sizeof(struct ttusb), GFP_KERNEL)))
1651 ttusb->mux_state = 0;
1652 mutex_init(&ttusb->semi2c);
1654 mutex_lock(&ttusb->semi2c);
1656 mutex_init(&ttusb->semusb);
1658 ttusb_setup_interfaces(ttusb);
1660 result = ttusb_alloc_iso_urbs(ttusb);
1662 dprintk("%s: ttusb_alloc_iso_urbs - failed\n", __func__);
1663 mutex_unlock(&ttusb->semi2c);
1668 if (ttusb_init_controller(ttusb))
1669 printk("ttusb_init_controller: error\n");
1671 mutex_unlock(&ttusb->semi2c);
1673 result = dvb_register_adapter(&ttusb->adapter,
1674 "Technotrend/Hauppauge Nova-USB",
1675 THIS_MODULE, &udev->dev, adapter_nr);
1677 ttusb_free_iso_urbs(ttusb);
1681 ttusb->adapter.priv = ttusb;
1684 memset(&ttusb->i2c_adap, 0, sizeof(struct i2c_adapter));
1685 strscpy(ttusb->i2c_adap.name, "TTUSB DEC", sizeof(ttusb->i2c_adap.name));
1687 i2c_set_adapdata(&ttusb->i2c_adap, ttusb);
1689 ttusb->i2c_adap.algo = &ttusb_dec_algo;
1690 ttusb->i2c_adap.algo_data = NULL;
1691 ttusb->i2c_adap.dev.parent = &udev->dev;
1693 result = i2c_add_adapter(&ttusb->i2c_adap);
1695 goto err_unregister_adapter;
1697 memset(&ttusb->dvb_demux, 0, sizeof(ttusb->dvb_demux));
1699 ttusb->dvb_demux.dmx.capabilities =
1700 DMX_TS_FILTERING | DMX_SECTION_FILTERING;
1701 ttusb->dvb_demux.priv = NULL;
1702 #ifdef TTUSB_HWSECTIONS
1703 ttusb->dvb_demux.filternum = TTUSB_MAXFILTER;
1705 ttusb->dvb_demux.filternum = 32;
1707 ttusb->dvb_demux.feednum = TTUSB_MAXCHANNEL;
1708 ttusb->dvb_demux.start_feed = ttusb_start_feed;
1709 ttusb->dvb_demux.stop_feed = ttusb_stop_feed;
1710 ttusb->dvb_demux.write_to_decoder = NULL;
1712 result = dvb_dmx_init(&ttusb->dvb_demux);
1714 printk("ttusb_dvb: dvb_dmx_init failed (errno = %d)\n", result);
1716 goto err_i2c_del_adapter;
1718 //FIXME dmxdev (nur WAS?)
1719 ttusb->dmxdev.filternum = ttusb->dvb_demux.filternum;
1720 ttusb->dmxdev.demux = &ttusb->dvb_demux.dmx;
1721 ttusb->dmxdev.capabilities = 0;
1723 result = dvb_dmxdev_init(&ttusb->dmxdev, &ttusb->adapter);
1725 printk("ttusb_dvb: dvb_dmxdev_init failed (errno = %d)\n",
1728 goto err_release_dmx;
1731 if (dvb_net_init(&ttusb->adapter, &ttusb->dvbnet, &ttusb->dvb_demux.dmx)) {
1732 printk("ttusb_dvb: dvb_net_init failed!\n");
1734 goto err_release_dmxdev;
1737 usb_set_intfdata(intf, (void *) ttusb);
1739 frontend_init(ttusb);
1744 dvb_dmxdev_release(&ttusb->dmxdev);
1746 dvb_dmx_release(&ttusb->dvb_demux);
1747 err_i2c_del_adapter:
1748 i2c_del_adapter(&ttusb->i2c_adap);
1749 err_unregister_adapter:
1750 dvb_unregister_adapter (&ttusb->adapter);
1751 ttusb_free_iso_urbs(ttusb);
1756 static void ttusb_disconnect(struct usb_interface *intf)
1758 struct ttusb *ttusb = usb_get_intfdata(intf);
1760 usb_set_intfdata(intf, NULL);
1762 ttusb->disconnecting = 1;
1764 ttusb_stop_iso_xfer(ttusb);
1766 ttusb->dvb_demux.dmx.close(&ttusb->dvb_demux.dmx);
1767 dvb_net_release(&ttusb->dvbnet);
1768 dvb_dmxdev_release(&ttusb->dmxdev);
1769 dvb_dmx_release(&ttusb->dvb_demux);
1770 if (ttusb->fe != NULL) {
1771 dvb_unregister_frontend(ttusb->fe);
1772 dvb_frontend_detach(ttusb->fe);
1774 i2c_del_adapter(&ttusb->i2c_adap);
1775 dvb_unregister_adapter(&ttusb->adapter);
1777 ttusb_free_iso_urbs(ttusb);
1781 dprintk("%s: TTUSB DVB disconnected\n", __func__);
1784 static const struct usb_device_id ttusb_table[] = {
1785 {USB_DEVICE(0xb48, 0x1003)},
1786 {USB_DEVICE(0xb48, 0x1004)},
1787 {USB_DEVICE(0xb48, 0x1005)},
1791 MODULE_DEVICE_TABLE(usb, ttusb_table);
1793 static struct usb_driver ttusb_driver = {
1795 .probe = ttusb_probe,
1796 .disconnect = ttusb_disconnect,
1797 .id_table = ttusb_table,
1800 module_usb_driver(ttusb_driver);
1802 MODULE_AUTHOR("Holger Waechtler <holger@convergence.de>");
1803 MODULE_DESCRIPTION("TTUSB DVB Driver");
1804 MODULE_LICENSE("GPL");