aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c')
-rw-r--r--drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c58
1 files changed, 31 insertions, 27 deletions
diff --git a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c
index 7902ae1d9a18..732ce4de512e 100644
--- a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c
+++ b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c
@@ -56,10 +56,11 @@
56*/ 56*/
57 57
58static int debug; 58static int debug;
59
60module_param(debug, int, 0644); 59module_param(debug, int, 0644);
61MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off)."); 60MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off).");
62 61
62DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
63
63#define dprintk(x...) do { if (debug) printk(KERN_DEBUG x); } while (0) 64#define dprintk(x...) do { if (debug) printk(KERN_DEBUG x); } while (0)
64 65
65#define ISO_BUF_COUNT 4 66#define ISO_BUF_COUNT 4
@@ -153,12 +154,12 @@ static int ttusb_cmd(struct ttusb *ttusb,
153 (u8 *) data, len, &actual_len, 1000); 154 (u8 *) data, len, &actual_len, 1000);
154 if (err != 0) { 155 if (err != 0) {
155 dprintk("%s: usb_bulk_msg(send) failed, err == %i!\n", 156 dprintk("%s: usb_bulk_msg(send) failed, err == %i!\n",
156 __FUNCTION__, err); 157 __func__, err);
157 mutex_unlock(&ttusb->semusb); 158 mutex_unlock(&ttusb->semusb);
158 return err; 159 return err;
159 } 160 }
160 if (actual_len != len) { 161 if (actual_len != len) {
161 dprintk("%s: only wrote %d of %d bytes\n", __FUNCTION__, 162 dprintk("%s: only wrote %d of %d bytes\n", __func__,
162 actual_len, len); 163 actual_len, len);
163 mutex_unlock(&ttusb->semusb); 164 mutex_unlock(&ttusb->semusb);
164 return -1; 165 return -1;
@@ -168,7 +169,7 @@ static int ttusb_cmd(struct ttusb *ttusb,
168 ttusb->last_result, 32, &actual_len, 1000); 169 ttusb->last_result, 32, &actual_len, 1000);
169 170
170 if (err != 0) { 171 if (err != 0) {
171 printk("%s: failed, receive error %d\n", __FUNCTION__, 172 printk("%s: failed, receive error %d\n", __func__,
172 err); 173 err);
173 mutex_unlock(&ttusb->semusb); 174 mutex_unlock(&ttusb->semusb);
174 return err; 175 return err;
@@ -229,7 +230,7 @@ static int ttusb_i2c_msg(struct ttusb *ttusb,
229 if (err || b[0] != 0x55 || b[1] != id) { 230 if (err || b[0] != 0x55 || b[1] != id) {
230 dprintk 231 dprintk
231 ("%s: usb_bulk_msg(recv) failed, err == %i, id == %02x, b == ", 232 ("%s: usb_bulk_msg(recv) failed, err == %i, id == %02x, b == ",
232 __FUNCTION__, err, id); 233 __func__, err, id);
233 return -EREMOTEIO; 234 return -EREMOTEIO;
234 } 235 }
235 236
@@ -273,7 +274,7 @@ static int master_xfer(struct i2c_adapter* adapter, struct i2c_msg *msg, int num
273 snd_buf, snd_len, rcv_buf, rcv_len); 274 snd_buf, snd_len, rcv_buf, rcv_len);
274 275
275 if (err < rcv_len) { 276 if (err < rcv_len) {
276 dprintk("%s: i == %i\n", __FUNCTION__, i); 277 dprintk("%s: i == %i\n", __func__, i);
277 break; 278 break;
278 } 279 }
279 280
@@ -327,7 +328,7 @@ static int ttusb_boot_dsp(struct ttusb *ttusb)
327 done: 328 done:
328 if (err) { 329 if (err) {
329 dprintk("%s: usb_bulk_msg() failed, return value %i!\n", 330 dprintk("%s: usb_bulk_msg() failed, return value %i!\n",
330 __FUNCTION__, err); 331 __func__, err);
331 } 332 }
332 333
333 return err; 334 return err;
@@ -427,7 +428,7 @@ static int ttusb_init_controller(struct ttusb *ttusb)
427 if ((err = ttusb_result(ttusb, get_version, sizeof(get_version)))) 428 if ((err = ttusb_result(ttusb, get_version, sizeof(get_version))))
428 return err; 429 return err;
429 430
430 dprintk("%s: stc-version: %c%c%c%c%c\n", __FUNCTION__, 431 dprintk("%s: stc-version: %c%c%c%c%c\n", __func__,
431 get_version[4], get_version[5], get_version[6], 432 get_version[4], get_version[5], get_version[6],
432 get_version[7], get_version[8]); 433 get_version[7], get_version[8]);
433 434
@@ -437,7 +438,7 @@ static int ttusb_init_controller(struct ttusb *ttusb)
437 memcmp(get_version + 4, "V 2.2", 5)) { 438 memcmp(get_version + 4, "V 2.2", 5)) {
438 printk 439 printk
439 ("%s: unknown STC version %c%c%c%c%c, please report!\n", 440 ("%s: unknown STC version %c%c%c%c%c, please report!\n",
440 __FUNCTION__, get_version[4], get_version[5], 441 __func__, get_version[4], get_version[5],
441 get_version[6], get_version[7], get_version[8]); 442 get_version[6], get_version[7], get_version[8]);
442 } 443 }
443 444
@@ -453,7 +454,7 @@ static int ttusb_init_controller(struct ttusb *ttusb)
453 ttusb_result(ttusb, get_dsp_version, sizeof(get_dsp_version)); 454 ttusb_result(ttusb, get_dsp_version, sizeof(get_dsp_version));
454 if (err) 455 if (err)
455 return err; 456 return err;
456 printk("%s: dsp-version: %c%c%c\n", __FUNCTION__, 457 printk("%s: dsp-version: %c%c%c\n", __func__,
457 get_dsp_version[4], get_dsp_version[5], get_dsp_version[6]); 458 get_dsp_version[4], get_dsp_version[5], get_dsp_version[6]);
458 return 0; 459 return 0;
459} 460}
@@ -476,7 +477,7 @@ static int ttusb_send_diseqc(struct dvb_frontend* fe,
476 /* Diseqc */ 477 /* Diseqc */
477 if ((err = ttusb_cmd(ttusb, b, 4 + b[3], 0))) { 478 if ((err = ttusb_cmd(ttusb, b, 4 + b[3], 0))) {
478 dprintk("%s: usb_bulk_msg() failed, return value %i!\n", 479 dprintk("%s: usb_bulk_msg() failed, return value %i!\n",
479 __FUNCTION__, err); 480 __func__, err);
480 } 481 }
481 482
482 return err; 483 return err;
@@ -494,7 +495,7 @@ static int ttusb_update_lnb(struct ttusb *ttusb)
494 /* SetLNB */ 495 /* SetLNB */
495 if ((err = ttusb_cmd(ttusb, b, sizeof(b), 0))) { 496 if ((err = ttusb_cmd(ttusb, b, sizeof(b), 0))) {
496 dprintk("%s: usb_bulk_msg() failed, return value %i!\n", 497 dprintk("%s: usb_bulk_msg() failed, return value %i!\n",
497 __FUNCTION__, err); 498 __func__, err);
498 } 499 }
499 500
500 return err; 501 return err;
@@ -528,7 +529,7 @@ static void ttusb_set_led_freq(struct ttusb *ttusb, u8 freq)
528 err = ttusb_cmd(ttusb, b, sizeof(b), 0); 529 err = ttusb_cmd(ttusb, b, sizeof(b), 0);
529 if (err) { 530 if (err) {
530 dprintk("%s: usb_bulk_msg() failed, return value %i!\n", 531 dprintk("%s: usb_bulk_msg() failed, return value %i!\n",
531 __FUNCTION__, err); 532 __func__, err);
532 } 533 }
533} 534}
534#endif 535#endif
@@ -542,7 +543,7 @@ static void ttusb_handle_sec_data(struct ttusb_channel *channel,
542 const u8 * data, int len); 543 const u8 * data, int len);
543#endif 544#endif
544 545
545static int numpkt = 0, numts, numstuff, numsec, numinvalid; 546static int numpkt, numts, numstuff, numsec, numinvalid;
546static unsigned long lastj; 547static unsigned long lastj;
547 548
548static void ttusb_process_muxpack(struct ttusb *ttusb, const u8 * muxpack, 549static void ttusb_process_muxpack(struct ttusb *ttusb, const u8 * muxpack,
@@ -554,7 +555,7 @@ static void ttusb_process_muxpack(struct ttusb *ttusb, const u8 * muxpack,
554 csum ^= le16_to_cpup((u16 *) (muxpack + i)); 555 csum ^= le16_to_cpup((u16 *) (muxpack + i));
555 if (csum) { 556 if (csum) {
556 printk("%s: muxpack with incorrect checksum, ignoring\n", 557 printk("%s: muxpack with incorrect checksum, ignoring\n",
557 __FUNCTION__); 558 __func__);
558 numinvalid++; 559 numinvalid++;
559 return; 560 return;
560 } 561 }
@@ -563,7 +564,7 @@ static void ttusb_process_muxpack(struct ttusb *ttusb, const u8 * muxpack,
563 cc &= 0x7FFF; 564 cc &= 0x7FFF;
564 if ((cc != ttusb->cc) && (ttusb->cc != -1)) 565 if ((cc != ttusb->cc) && (ttusb->cc != -1))
565 printk("%s: cc discontinuity (%d frames missing)\n", 566 printk("%s: cc discontinuity (%d frames missing)\n",
566 __FUNCTION__, (cc - ttusb->cc) & 0x7FFF); 567 __func__, (cc - ttusb->cc) & 0x7FFF);
567 ttusb->cc = (cc + 1) & 0x7FFF; 568 ttusb->cc = (cc + 1) & 0x7FFF;
568 if (muxpack[0] & 0x80) { 569 if (muxpack[0] & 0x80) {
569#ifdef TTUSB_HWSECTIONS 570#ifdef TTUSB_HWSECTIONS
@@ -613,7 +614,7 @@ static void ttusb_process_frame(struct ttusb *ttusb, u8 * data, int len)
613 int maxwork = 1024; 614 int maxwork = 1024;
614 while (len) { 615 while (len) {
615 if (!(maxwork--)) { 616 if (!(maxwork--)) {
616 printk("%s: too much work\n", __FUNCTION__); 617 printk("%s: too much work\n", __func__);
617 break; 618 break;
618 } 619 }
619 620
@@ -632,7 +633,7 @@ static void ttusb_process_frame(struct ttusb *ttusb, u8 * data, int len)
632#else 633#else
633 if (ttusb->insync) { 634 if (ttusb->insync) {
634 printk("%s: lost sync.\n", 635 printk("%s: lost sync.\n",
635 __FUNCTION__); 636 __func__);
636 ttusb->insync = 0; 637 ttusb->insync = 0;
637 } 638 }
638#endif 639#endif
@@ -691,7 +692,7 @@ static void ttusb_process_frame(struct ttusb *ttusb, u8 * data, int len)
691 else { 692 else {
692 dprintk 693 dprintk
693 ("%s: invalid state: first byte is %x\n", 694 ("%s: invalid state: first byte is %x\n",
694 __FUNCTION__, 695 __func__,
695 ttusb->muxpack[0]); 696 ttusb->muxpack[0]);
696 ttusb->mux_state = 0; 697 ttusb->mux_state = 0;
697 } 698 }
@@ -740,7 +741,7 @@ static void ttusb_iso_irq(struct urb *urb)
740 741
741#if 0 742#if 0
742 printk("%s: status %d, errcount == %d, length == %i\n", 743 printk("%s: status %d, errcount == %d, length == %i\n",
743 __FUNCTION__, 744 __func__,
744 urb->status, urb->error_count, urb->actual_length); 745 urb->status, urb->error_count, urb->actual_length);
745#endif 746#endif
746 747
@@ -833,7 +834,7 @@ static int ttusb_start_iso_xfer(struct ttusb *ttusb)
833 int i, j, err, buffer_offset = 0; 834 int i, j, err, buffer_offset = 0;
834 835
835 if (ttusb->iso_streaming) { 836 if (ttusb->iso_streaming) {
836 printk("%s: iso xfer already running!\n", __FUNCTION__); 837 printk("%s: iso xfer already running!\n", __func__);
837 return 0; 838 return 0;
838 } 839 }
839 840
@@ -869,7 +870,7 @@ static int ttusb_start_iso_xfer(struct ttusb *ttusb)
869 ttusb_stop_iso_xfer(ttusb); 870 ttusb_stop_iso_xfer(ttusb);
870 printk 871 printk
871 ("%s: failed urb submission (%i: err = %i)!\n", 872 ("%s: failed urb submission (%i: err = %i)!\n",
872 __FUNCTION__, i, err); 873 __func__, i, err);
873 return err; 874 return err;
874 } 875 }
875 } 876 }
@@ -1005,7 +1006,7 @@ static int stc_release(struct inode *inode, struct file *file)
1005 return 0; 1006 return 0;
1006} 1007}
1007 1008
1008static struct file_operations stc_fops = { 1009static const struct file_operations stc_fops = {
1009 .owner = THIS_MODULE, 1010 .owner = THIS_MODULE,
1010 .read = stc_read, 1011 .read = stc_read,
1011 .open = stc_open, 1012 .open = stc_open,
@@ -1313,7 +1314,7 @@ static struct stv0299_config alps_stv0299_config = {
1313 .mclk = 88000000UL, 1314 .mclk = 88000000UL,
1314 .invert = 1, 1315 .invert = 1,
1315 .skip_reinit = 0, 1316 .skip_reinit = 0,
1316 .lock_output = STV0229_LOCKOUTPUT_1, 1317 .lock_output = STV0299_LOCKOUTPUT_1,
1317 .volt13_op0_op1 = STV0299_VOLT13_OP1, 1318 .volt13_op0_op1 = STV0299_VOLT13_OP1,
1318 .min_delay_ms = 100, 1319 .min_delay_ms = 100,
1319 .set_symbol_rate = alps_stv0299_set_symbol_rate, 1320 .set_symbol_rate = alps_stv0299_set_symbol_rate,
@@ -1643,7 +1644,7 @@ static int ttusb_probe(struct usb_interface *intf, const struct usb_device_id *i
1643 struct ttusb *ttusb; 1644 struct ttusb *ttusb;
1644 int result; 1645 int result;
1645 1646
1646 dprintk("%s: TTUSB DVB connected\n", __FUNCTION__); 1647 dprintk("%s: TTUSB DVB connected\n", __func__);
1647 1648
1648 udev = interface_to_usbdev(intf); 1649 udev = interface_to_usbdev(intf);
1649 1650
@@ -1669,7 +1670,10 @@ static int ttusb_probe(struct usb_interface *intf, const struct usb_device_id *i
1669 1670
1670 mutex_unlock(&ttusb->semi2c); 1671 mutex_unlock(&ttusb->semi2c);
1671 1672
1672 if ((result = dvb_register_adapter(&ttusb->adapter, "Technotrend/Hauppauge Nova-USB", THIS_MODULE, &udev->dev)) < 0) { 1673 result = dvb_register_adapter(&ttusb->adapter,
1674 "Technotrend/Hauppauge Nova-USB",
1675 THIS_MODULE, &udev->dev, adapter_nr);
1676 if (result < 0) {
1673 ttusb_free_iso_urbs(ttusb); 1677 ttusb_free_iso_urbs(ttusb);
1674 kfree(ttusb); 1678 kfree(ttusb);
1675 return result; 1679 return result;
@@ -1773,7 +1777,7 @@ static void ttusb_disconnect(struct usb_interface *intf)
1773 1777
1774 kfree(ttusb); 1778 kfree(ttusb);
1775 1779
1776 dprintk("%s: TTUSB DVB disconnected\n", __FUNCTION__); 1780 dprintk("%s: TTUSB DVB disconnected\n", __func__);
1777} 1781}
1778 1782
1779static struct usb_device_id ttusb_table[] = { 1783static struct usb_device_id ttusb_table[] = {