aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/hisax/hfc_usb.c
diff options
context:
space:
mode:
authorMartin Bachem <info@colognechip.com>2005-11-07 04:00:20 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-07 10:53:47 -0500
commit597a107b1d5587dc230dbbe3faeca242daed494e (patch)
tree0bb0aeb735a917561cf4d91d4c3fa1ed5434bede /drivers/isdn/hisax/hfc_usb.c
parent6978bbc097c2f665c336927a9d56ae39ef75fa56 (diff)
[PATCH] i4l: update hfc_usb driver
- cleanup source - remove nonfunctional code parts Signed-off-by: Karsten Keil <kkeil@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/isdn/hisax/hfc_usb.c')
-rw-r--r--drivers/isdn/hisax/hfc_usb.c292
1 files changed, 117 insertions, 175 deletions
diff --git a/drivers/isdn/hisax/hfc_usb.c b/drivers/isdn/hisax/hfc_usb.c
index e2c3af49d72b..32bf0d5d0f9a 100644
--- a/drivers/isdn/hisax/hfc_usb.c
+++ b/drivers/isdn/hisax/hfc_usb.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * hfc_usb.c 2 * hfc_usb.c
3 * 3 *
4 * $Id: hfc_usb.c,v 4.34 2005/01/26 17:25:53 martinb1 Exp $ 4 * $Id: hfc_usb.c,v 4.36 2005/04/08 09:55:13 martinb1 Exp $
5 * 5 *
6 * modular HiSax ISDN driver for Colognechip HFC-S USB chip 6 * modular HiSax ISDN driver for Colognechip HFC-S USB chip
7 * 7 *
@@ -44,12 +44,8 @@
44#include "hisax_if.h" 44#include "hisax_if.h"
45#include "hfc_usb.h" 45#include "hfc_usb.h"
46 46
47/*
48* Version Information
49* (do not modify the CVS Makros $Revision: 4.34 $ and $Date: 2005/01/26 17:25:53 $ !)
50*/
51static const char *hfcusb_revision = 47static const char *hfcusb_revision =
52 "Revision: 4.34 $ Date: 2005/01/26 17:25:53 $ "; 48 "$Revision: 4.36 $ $Date: 2005/04/08 09:55:13 $ ";
53 49
54/* Hisax debug support 50/* Hisax debug support
55* use "modprobe debug=x" where x is bitfield of USB_DBG & ISDN_DBG 51* use "modprobe debug=x" where x is bitfield of USB_DBG & ISDN_DBG
@@ -63,81 +59,89 @@ module_param(debug, uint, 0);
63static int hfc_debug; 59static int hfc_debug;
64#endif 60#endif
65 61
62/* private vendor specific data */
63typedef struct {
64 __u8 led_scheme; // led display scheme
65 signed short led_bits[8]; // array of 8 possible LED bitmask settings
66 char *vend_name; // device name
67} hfcsusb_vdata;
66 68
67/****************************************/ 69/****************************************/
68/* data defining the devices to be used */ 70/* data defining the devices to be used */
69/****************************************/ 71/****************************************/
70static struct usb_device_id hfc_usb_idtab[] = { 72static struct usb_device_id hfcusb_idtab[] = {
71 {USB_DEVICE(0x0959, 0x2bd0)}, /* Colognechip USB eval TA */ 73 {
72 {USB_DEVICE(0x0675, 0x1688)}, /* DrayTek miniVigor 128 USB ISDN TA */ 74 .idVendor = 0x0959,
73 {USB_DEVICE(0x07b0, 0x0007)}, /* Billion USB TA 2 */ 75 .idProduct = 0x2bd0,
74 {USB_DEVICE(0x0742, 0x2008)}, /* Stollmann USB TA */ 76 .driver_info = (unsigned long) &((hfcsusb_vdata)
75 {USB_DEVICE(0x0742, 0x2009)}, /* Aceex USB ISDN TA */ 77 {LED_OFF, {4, 0, 2, 1},
76 {USB_DEVICE(0x0742, 0x200A)}, /* OEM USB ISDN TA */ 78 "ISDN USB TA (Cologne Chip HFC-S USB based)"}),
77 {USB_DEVICE(0x08e3, 0x0301)}, /* OliTec ISDN USB */ 79 },
78 {USB_DEVICE(0x07fa, 0x0846)}, /* Bewan ISDN USB TA */ 80 {
79 {USB_DEVICE(0x07fa, 0x0847)}, /* Djinn Numeris USB */ 81 .idVendor = 0x0675,
80 {USB_DEVICE(0x07b0, 0x0006)}, /* Twister ISDN USB TA */ 82 .idProduct = 0x1688,
81 {} /* end with an all-zeroes entry */ 83 .driver_info = (unsigned long) &((hfcsusb_vdata)
84 {LED_SCHEME1, {1, 2, 0, 0},
85 "DrayTek miniVigor 128 USB ISDN TA"}),
86 },
87 {
88 .idVendor = 0x07b0,
89 .idProduct = 0x0007,
90 .driver_info = (unsigned long) &((hfcsusb_vdata)
91 {LED_SCHEME1, {0x80, -64, -32, -16},
92 "Billion tiny USB ISDN TA 128"}),
93 },
94 {
95 .idVendor = 0x0742,
96 .idProduct = 0x2008,
97 .driver_info = (unsigned long) &((hfcsusb_vdata)
98 {LED_SCHEME1, {4, 0, 2, 1},
99 "Stollmann USB TA"}),
100 },
101 {
102 .idVendor = 0x0742,
103 .idProduct = 0x2009,
104 .driver_info = (unsigned long) &((hfcsusb_vdata)
105 {LED_SCHEME1, {4, 0, 2, 1},
106 "Aceex USB ISDN TA"}),
107 },
108 {
109 .idVendor = 0x0742,
110 .idProduct = 0x200A,
111 .driver_info = (unsigned long) &((hfcsusb_vdata)
112 {LED_SCHEME1, {4, 0, 2, 1},
113 "OEM USB ISDN TA"}),
114 },
115 {
116 .idVendor = 0x08e3,
117 .idProduct = 0x0301,
118 .driver_info = (unsigned long) &((hfcsusb_vdata)
119 {LED_SCHEME1, {2, 0, 1, 4},
120 "Olitec USB RNIS"}),
121 },
122 {
123 .idVendor = 0x07fa,
124 .idProduct = 0x0846,
125 .driver_info = (unsigned long) &((hfcsusb_vdata)
126 {LED_SCHEME1, {0x80, -64, -32, -16},
127 "Bewan Modem RNIS USB"}),
128 },
129 {
130 .idVendor = 0x07fa,
131 .idProduct = 0x0847,
132 .driver_info = (unsigned long) &((hfcsusb_vdata)
133 {LED_SCHEME1, {0x80, -64, -32, -16},
134 "Djinn Numeris USB"}),
135 },
136 {
137 .idVendor = 0x07b0,
138 .idProduct = 0x0006,
139 .driver_info = (unsigned long) &((hfcsusb_vdata)
140 {LED_SCHEME1, {0x80, -64, -32, -16},
141 "Twister ISDN TA"}),
142 },
82}; 143};
83 144
84/* driver internal device specific data:
85* VendorID, ProductID, Devicename, LED_SCHEME,
86* LED's BitMask in HFCUSB_P_DATA Register : LED_USB, LED_S0, LED_B1, LED_B2
87*/
88static vendor_data vdata[] = {
89 /* CologneChip Eval TA */
90 {0x0959, 0x2bd0, "ISDN USB TA (Cologne Chip HFC-S USB based)",
91 LED_OFF, {4, 0, 2, 1}
92 }
93 ,
94 /* DrayTek miniVigor 128 USB ISDN TA */
95 {0x0675, 0x1688, "DrayTek miniVigor 128 USB ISDN TA",
96 LED_SCHEME1, {1, 2, 0, 0}
97 }
98 ,
99 /* Billion TA */
100 {0x07b0, 0x0007, "Billion tiny USB ISDN TA 128",
101 LED_SCHEME1, {0x80, -64, -32, -16}
102 }
103 ,
104 /* Stollmann TA */
105 {0x0742, 0x2008, "Stollmann USB TA",
106 LED_SCHEME1, {4, 0, 2, 1}
107 }
108 ,
109 /* Aceex USB ISDN TA */
110 {0x0742, 0x2009, "Aceex USB ISDN TA",
111 LED_SCHEME1, {4, 0, 2, 1}
112 }
113 ,
114 /* OEM USB ISDN TA */
115 {0x0742, 0x200A, "OEM USB ISDN TA",
116 LED_SCHEME1, {4, 0, 2, 1}
117 }
118 ,
119 /* Olitec TA */
120 {0x08e3, 0x0301, "Olitec USB RNIS",
121 LED_SCHEME1, {2, 0, 1, 4}
122 }
123 ,
124 /* Bewan TA */
125 {0x07fa, 0x0846, "Bewan Modem RNIS USB",
126 LED_SCHEME1, {0x80, -64, -32, -16}
127 }
128 ,
129 /* Bewan TA */
130 {0x07fa, 0x0847, "Djinn Numeris USB",
131 LED_SCHEME1, {0x80, -64, -32, -16}
132 }
133 ,
134 /* Twister ISDN TA */
135 {0x07b0, 0x0006, "Twister ISDN TA",
136 LED_SCHEME1, {0x80, -64, -32, -16}
137 }
138 ,
139 {0, 0, 0} /* EOL element */
140};
141 145
142/***************************************************************/ 146/***************************************************************/
143/* structure defining input+output fifos (interrupt/bulk mode) */ 147/* structure defining input+output fifos (interrupt/bulk mode) */
@@ -211,8 +215,6 @@ typedef struct hfcusb_data {
211 volatile __u8 l1_state; /* actual l1 state */ 215 volatile __u8 l1_state; /* actual l1 state */
212 struct timer_list t3_timer; /* timer 3 for activation/deactivation */ 216 struct timer_list t3_timer; /* timer 3 for activation/deactivation */
213 struct timer_list t4_timer; /* timer 4 for activation/deactivation */ 217 struct timer_list t4_timer; /* timer 4 for activation/deactivation */
214 struct timer_list led_timer; /* timer flashing leds */
215
216} hfcusb_data; 218} hfcusb_data;
217 219
218 220
@@ -227,7 +229,7 @@ symbolic(struct hfcusb_symbolic_list list[], const int num)
227 for (i = 0; list[i].name != NULL; i++) 229 for (i = 0; list[i].name != NULL; i++)
228 if (list[i].num == num) 230 if (list[i].num == num)
229 return (list[i].name); 231 return (list[i].name);
230 return "<unkown>"; 232 return "<unkown ERROR>";
231} 233}
232 234
233 235
@@ -335,93 +337,57 @@ set_led_bit(hfcusb_data * hfc, signed short led_bits, int unset)
335 } 337 }
336} 338}
337 339
338/******************************************/
339/* invert B-channel LEDs if data is sent */
340/******************************************/
341static void
342led_timer(hfcusb_data * hfc)
343{
344 static int cnt = 0;
345
346 if (cnt) {
347 if (hfc->led_b_active & 1)
348 set_led_bit(hfc, vdata[hfc->vend_idx].led_bits[2],
349 0);
350 if (hfc->led_b_active & 2)
351 set_led_bit(hfc, vdata[hfc->vend_idx].led_bits[3],
352 0);
353 } else {
354 if (!(hfc->led_b_active & 1) || hfc->led_new_data & 1)
355 set_led_bit(hfc, vdata[hfc->vend_idx].led_bits[2],
356 1);
357 if (!(hfc->led_b_active & 2) || hfc->led_new_data & 2)
358 set_led_bit(hfc, vdata[hfc->vend_idx].led_bits[3],
359 1);
360 }
361
362 write_led(hfc, hfc->led_state);
363 hfc->led_new_data = 0;
364
365 cnt = !cnt;
366
367 /* restart 4 hz timer */
368 if (!timer_pending(&hfc->led_timer)) {
369 add_timer(&hfc->led_timer);
370 hfc->led_timer.expires = jiffies + (LED_TIME * HZ) / 1000;
371 }
372}
373
374/**************************/ 340/**************************/
375/* handle LED requests */ 341/* handle LED requests */
376/**************************/ 342/**************************/
377static void 343static void
378handle_led(hfcusb_data * hfc, int event) 344handle_led(hfcusb_data * hfc, int event)
379{ 345{
346 hfcsusb_vdata *driver_info =
347 (hfcsusb_vdata *) hfcusb_idtab[hfc->vend_idx].driver_info;
348
380 /* if no scheme -> no LED action */ 349 /* if no scheme -> no LED action */
381 if (vdata[hfc->vend_idx].led_scheme == LED_OFF) 350 if (driver_info->led_scheme == LED_OFF)
382 return; 351 return;
383 352
384 switch (event) { 353 switch (event) {
385 case LED_POWER_ON: 354 case LED_POWER_ON:
386 set_led_bit(hfc, vdata[hfc->vend_idx].led_bits[0], 355 set_led_bit(hfc, driver_info->led_bits[0],
387 0); 356 0);
388 set_led_bit(hfc, vdata[hfc->vend_idx].led_bits[1], 357 set_led_bit(hfc, driver_info->led_bits[1],
389 1); 358 1);
390 set_led_bit(hfc, vdata[hfc->vend_idx].led_bits[2], 359 set_led_bit(hfc, driver_info->led_bits[2],
391 1); 360 1);
392 set_led_bit(hfc, vdata[hfc->vend_idx].led_bits[3], 361 set_led_bit(hfc, driver_info->led_bits[3],
393 1); 362 1);
394 break; 363 break;
395 case LED_POWER_OFF: /* no Power off handling */ 364 case LED_POWER_OFF: /* no Power off handling */
396 break; 365 break;
397 case LED_S0_ON: 366 case LED_S0_ON:
398 set_led_bit(hfc, vdata[hfc->vend_idx].led_bits[1], 367 set_led_bit(hfc, driver_info->led_bits[1],
399 0); 368 0);
400 break; 369 break;
401 case LED_S0_OFF: 370 case LED_S0_OFF:
402 set_led_bit(hfc, vdata[hfc->vend_idx].led_bits[1], 371 set_led_bit(hfc, driver_info->led_bits[1],
403 1); 372 1);
404 break; 373 break;
405 case LED_B1_ON: 374 case LED_B1_ON:
406 hfc->led_b_active |= 1; 375 set_led_bit(hfc, driver_info->led_bits[2],
376 0);
407 break; 377 break;
408 case LED_B1_OFF: 378 case LED_B1_OFF:
409 hfc->led_b_active &= ~1; 379 set_led_bit(hfc, driver_info->led_bits[2],
410 break; 380 1);
411 case LED_B1_DATA:
412 hfc->led_new_data |= 1;
413 break; 381 break;
414 case LED_B2_ON: 382 case LED_B2_ON:
415 hfc->led_b_active |= 2; 383 set_led_bit(hfc, driver_info->led_bits[3],
384 0);
416 break; 385 break;
417 case LED_B2_OFF: 386 case LED_B2_OFF:
418 hfc->led_b_active &= ~2; 387 set_led_bit(hfc, driver_info->led_bits[3],
419 break; 388 1);
420 case LED_B2_DATA:
421 hfc->led_new_data |= 2;
422 break; 389 break;
423 } 390 }
424
425 write_led(hfc, hfc->led_state); 391 write_led(hfc, hfc->led_state);
426} 392}
427 393
@@ -725,14 +691,6 @@ tx_iso_complete(struct urb *urb, struct pt_regs *regs)
725 current_len + 1; 691 current_len + 1;
726 692
727 tx_offset += (current_len + 1); 693 tx_offset += (current_len + 1);
728 if (!transp_mode) {
729 if (fifon == HFCUSB_B1_TX)
730 handle_led(hfc,
731 LED_B1_DATA);
732 if (fifon == HFCUSB_B2_TX)
733 handle_led(hfc,
734 LED_B2_DATA);
735 }
736 } else { 694 } else {
737 urb->iso_frame_desc[k].offset = 695 urb->iso_frame_desc[k].offset =
738 tx_offset++; 696 tx_offset++;
@@ -966,14 +924,6 @@ collect_rx_frame(usb_fifo * fifo, __u8 * data, int len, int finish)
966 skb_trim(fifo->skbuff, 0); 924 skb_trim(fifo->skbuff, 0);
967 } 925 }
968 } 926 }
969
970 /* LED flashing only in HDLC mode */
971 if (!transp_mode) {
972 if (fifon == HFCUSB_B1_RX)
973 handle_led(hfc, LED_B1_DATA);
974 if (fifon == HFCUSB_B2_RX)
975 handle_led(hfc, LED_B2_DATA);
976 }
977} 927}
978 928
979/***********************************************/ 929/***********************************************/
@@ -1339,17 +1289,6 @@ usb_init(hfcusb_data * hfc)
1339 hfc->t4_timer.data = (long) hfc; 1289 hfc->t4_timer.data = (long) hfc;
1340 hfc->t4_timer.function = (void *) l1_timer_expire_t4; 1290 hfc->t4_timer.function = (void *) l1_timer_expire_t4;
1341 1291
1342 /* init the led timer */
1343 init_timer(&hfc->led_timer);
1344 hfc->led_timer.data = (long) hfc;
1345 hfc->led_timer.function = (void *) led_timer;
1346
1347 /* trigger 4 hz led timer */
1348 if (!timer_pending(&hfc->led_timer)) {
1349 hfc->led_timer.expires = jiffies + (LED_TIME * HZ) / 1000;
1350 add_timer(&hfc->led_timer);
1351 }
1352
1353 /* init the background machinery for control requests */ 1292 /* init the background machinery for control requests */
1354 hfc->ctrl_read.bRequestType = 0xc0; 1293 hfc->ctrl_read.bRequestType = 0xc0;
1355 hfc->ctrl_read.bRequest = 1; 1294 hfc->ctrl_read.bRequest = 1;
@@ -1440,13 +1379,18 @@ hfc_usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
1440 attr, cfg_found, cidx, ep_addr; 1379 attr, cfg_found, cidx, ep_addr;
1441 int cmptbl[16], small_match, iso_packet_size, packet_size, 1380 int cmptbl[16], small_match, iso_packet_size, packet_size,
1442 alt_used = 0; 1381 alt_used = 0;
1382 hfcsusb_vdata *driver_info;
1443 1383
1444 vend_idx = 0xffff; 1384 vend_idx = 0xffff;
1445 for (i = 0; vdata[i].vendor; i++) { 1385 for (i = 0; hfcusb_idtab[i].idVendor; i++) {
1446 if (dev->descriptor.idVendor == vdata[i].vendor 1386 if (dev->descriptor.idVendor == hfcusb_idtab[i].idVendor
1447 && dev->descriptor.idProduct == vdata[i].prod_id) 1387 && dev->descriptor.idProduct ==
1388 hfcusb_idtab[i].idProduct) {
1448 vend_idx = i; 1389 vend_idx = i;
1390 continue;
1391 }
1449 } 1392 }
1393
1450#ifdef CONFIG_HISAX_DEBUG 1394#ifdef CONFIG_HISAX_DEBUG
1451 DBG(USB_DBG, 1395 DBG(USB_DBG,
1452 "HFC-USB: probing interface(%d) actalt(%d) minor(%d)\n", ifnum, 1396 "HFC-USB: probing interface(%d) actalt(%d) minor(%d)\n", ifnum,
@@ -1457,10 +1401,6 @@ hfc_usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
1457 ifnum, iface->desc.bAlternateSetting, intf->minor); 1401 ifnum, iface->desc.bAlternateSetting, intf->minor);
1458 1402
1459 if (vend_idx != 0xffff) { 1403 if (vend_idx != 0xffff) {
1460#ifdef CONFIG_HISAX_DEBUG
1461 DBG(USB_DBG, "HFC-S USB: found vendor idx:%d name:%s",
1462 vend_idx, vdata[vend_idx].vend_name);
1463#endif
1464 /* if vendor and product ID is OK, start probing alternate settings */ 1404 /* if vendor and product ID is OK, start probing alternate settings */
1465 alt_idx = 0; 1405 alt_idx = 0;
1466 small_match = 0xffff; 1406 small_match = 0xffff;
@@ -1687,9 +1627,11 @@ hfc_usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
1687 usb_sndctrlpipe(context->dev, 0); 1627 usb_sndctrlpipe(context->dev, 0);
1688 context->ctrl_urb = usb_alloc_urb(0, GFP_KERNEL); 1628 context->ctrl_urb = usb_alloc_urb(0, GFP_KERNEL);
1689 1629
1690 printk(KERN_INFO 1630 driver_info =
1691 "HFC-S USB: detected \"%s\"\n", 1631 (hfcsusb_vdata *) hfcusb_idtab[vend_idx].
1692 vdata[vend_idx].vend_name); 1632 driver_info;
1633 printk(KERN_INFO "HFC-S USB: detected \"%s\"\n",
1634 driver_info->vend_name);
1693#ifdef CONFIG_HISAX_DEBUG 1635#ifdef CONFIG_HISAX_DEBUG
1694 DBG(USB_DBG, 1636 DBG(USB_DBG,
1695 "HFC-S USB: Endpoint-Config: %s (if=%d alt=%d)\n", 1637 "HFC-S USB: Endpoint-Config: %s (if=%d alt=%d)\n",
@@ -1740,8 +1682,6 @@ hfc_usb_disconnect(struct usb_interface
1740 del_timer(&context->t3_timer); 1682 del_timer(&context->t3_timer);
1741 if (timer_pending(&context->t4_timer)) 1683 if (timer_pending(&context->t4_timer))
1742 del_timer(&context->t4_timer); 1684 del_timer(&context->t4_timer);
1743 if (timer_pending(&context->led_timer))
1744 del_timer(&context->led_timer);
1745 /* tell all fifos to terminate */ 1685 /* tell all fifos to terminate */
1746 for (i = 0; i < HFCUSB_NUM_FIFOS; i++) { 1686 for (i = 0; i < HFCUSB_NUM_FIFOS; i++) {
1747 if (context->fifos[i].usb_transfer_mode == USB_ISOC) { 1687 if (context->fifos[i].usb_transfer_mode == USB_ISOC) {
@@ -1785,9 +1725,11 @@ hfc_usb_disconnect(struct usb_interface
1785/* our driver information structure */ 1725/* our driver information structure */
1786/************************************/ 1726/************************************/
1787static struct usb_driver hfc_drv = { 1727static struct usb_driver hfc_drv = {
1788 .owner = THIS_MODULE,.name = 1728 .owner = THIS_MODULE,
1789 "hfc_usb",.id_table = hfc_usb_idtab,.probe = 1729 .name = "hfc_usb",
1790 hfc_usb_probe,.disconnect = hfc_usb_disconnect, 1730 .id_table = hfcusb_idtab,
1731 .probe = hfc_usb_probe,
1732 .disconnect = hfc_usb_disconnect,
1791}; 1733};
1792static void __exit 1734static void __exit
1793hfc_usb_exit(void) 1735hfc_usb_exit(void)
@@ -1825,4 +1767,4 @@ module_exit(hfc_usb_exit);
1825MODULE_AUTHOR(DRIVER_AUTHOR); 1767MODULE_AUTHOR(DRIVER_AUTHOR);
1826MODULE_DESCRIPTION(DRIVER_DESC); 1768MODULE_DESCRIPTION(DRIVER_DESC);
1827MODULE_LICENSE("GPL"); 1769MODULE_LICENSE("GPL");
1828MODULE_DEVICE_TABLE(usb, hfc_usb_idtab); 1770MODULE_DEVICE_TABLE(usb, hfcusb_idtab);