diff options
-rw-r--r-- | drivers/isdn/hisax/hfc_usb.c | 63 |
1 files changed, 33 insertions, 30 deletions
diff --git a/drivers/isdn/hisax/hfc_usb.c b/drivers/isdn/hisax/hfc_usb.c index 60843b3f3b6f..98b0149bca68 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 2.3.2.20 2007/08/20 14:07:54 mbachem Exp $ | 4 | * $Id: hfc_usb.c,v 2.3.2.24 2007/10/14 08:40:29 mbachem 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 | * |
@@ -45,7 +45,7 @@ | |||
45 | #include "hfc_usb.h" | 45 | #include "hfc_usb.h" |
46 | 46 | ||
47 | static const char *hfcusb_revision = | 47 | static const char *hfcusb_revision = |
48 | "$Revision: 2.3.2.20 $ $Date: 2007/08/20 14:07:54 $ "; | 48 | "$Revision: 2.3.2.24 $ $Date: 2007/10/14 08:40:29 $ "; |
49 | 49 | ||
50 | /* Hisax debug support | 50 | /* Hisax debug support |
51 | * debug flags defined in hfc_usb.h as HFCUSB_DBG_[*] | 51 | * debug flags defined in hfc_usb.h as HFCUSB_DBG_[*] |
@@ -126,6 +126,12 @@ static struct usb_device_id hfcusb_idtab[] = { | |||
126 | {LED_SCHEME1, {0x80, -64, -32, -16}, | 126 | {LED_SCHEME1, {0x80, -64, -32, -16}, |
127 | "Twister ISDN TA"}), | 127 | "Twister ISDN TA"}), |
128 | }, | 128 | }, |
129 | { | ||
130 | USB_DEVICE(0x071d, 0x1005), | ||
131 | .driver_info = (unsigned long) &((hfcsusb_vdata) | ||
132 | {LED_SCHEME1, {0x02, 0, 0x01, 0x04}, | ||
133 | "Eicon DIVA USB 4.0"}), | ||
134 | }, | ||
129 | { } | 135 | { } |
130 | }; | 136 | }; |
131 | 137 | ||
@@ -187,7 +193,7 @@ typedef struct hfcusb_data { | |||
187 | struct usb_ctrlrequest ctrl_write; /* buffer for control write request */ | 193 | struct usb_ctrlrequest ctrl_write; /* buffer for control write request */ |
188 | struct usb_ctrlrequest ctrl_read; /* same for read request */ | 194 | struct usb_ctrlrequest ctrl_read; /* same for read request */ |
189 | 195 | ||
190 | __u8 old_led_state, led_state, led_new_data, led_b_active; | 196 | __u8 old_led_state, led_state; |
191 | 197 | ||
192 | volatile __u8 threshold_mask; /* threshold actually reported */ | 198 | volatile __u8 threshold_mask; /* threshold actually reported */ |
193 | volatile __u8 bch_enables; /* or mask for sctrl_r and sctrl register values */ | 199 | volatile __u8 bch_enables; /* or mask for sctrl_r and sctrl register values */ |
@@ -263,7 +269,7 @@ ctrl_complete(struct urb *urb) | |||
263 | 269 | ||
264 | ctrl_start_transfer(hfc); /* start next transfer */ | 270 | ctrl_start_transfer(hfc); /* start next transfer */ |
265 | } | 271 | } |
266 | } /* ctrl_complete */ | 272 | } |
267 | 273 | ||
268 | /* write led data to auxport & invert if necessary */ | 274 | /* write led data to auxport & invert if necessary */ |
269 | static void | 275 | static void |
@@ -276,18 +282,18 @@ write_led(hfcusb_data * hfc, __u8 led_state) | |||
276 | } | 282 | } |
277 | 283 | ||
278 | static void | 284 | static void |
279 | set_led_bit(hfcusb_data * hfc, signed short led_bits, int unset) | 285 | set_led_bit(hfcusb_data * hfc, signed short led_bits, int on) |
280 | { | 286 | { |
281 | if (unset) { | 287 | if (on) { |
282 | if (led_bits < 0) | 288 | if (led_bits < 0) |
283 | hfc->led_state |= abs(led_bits); | 289 | hfc->led_state &= ~abs(led_bits); |
284 | else | 290 | else |
285 | hfc->led_state &= ~led_bits; | 291 | hfc->led_state |= led_bits; |
286 | } else { | 292 | } else { |
287 | if (led_bits < 0) | 293 | if (led_bits < 0) |
288 | hfc->led_state &= ~abs(led_bits); | 294 | hfc->led_state |= abs(led_bits); |
289 | else | 295 | else |
290 | hfc->led_state |= led_bits; | 296 | hfc->led_state &= ~led_bits; |
291 | } | 297 | } |
292 | } | 298 | } |
293 | 299 | ||
@@ -304,34 +310,34 @@ handle_led(hfcusb_data * hfc, int event) | |||
304 | 310 | ||
305 | switch (event) { | 311 | switch (event) { |
306 | case LED_POWER_ON: | 312 | case LED_POWER_ON: |
307 | set_led_bit(hfc, driver_info->led_bits[0], 0); | 313 | set_led_bit(hfc, driver_info->led_bits[0], 1); |
308 | set_led_bit(hfc, driver_info->led_bits[1], 1); | 314 | set_led_bit(hfc, driver_info->led_bits[1], 0); |
309 | set_led_bit(hfc, driver_info->led_bits[2], 1); | 315 | set_led_bit(hfc, driver_info->led_bits[2], 0); |
310 | set_led_bit(hfc, driver_info->led_bits[3], 1); | 316 | set_led_bit(hfc, driver_info->led_bits[3], 0); |
311 | break; | 317 | break; |
312 | case LED_POWER_OFF: | 318 | case LED_POWER_OFF: |
313 | set_led_bit(hfc, driver_info->led_bits[0], 1); | 319 | set_led_bit(hfc, driver_info->led_bits[0], 0); |
314 | set_led_bit(hfc, driver_info->led_bits[1], 1); | 320 | set_led_bit(hfc, driver_info->led_bits[1], 0); |
315 | set_led_bit(hfc, driver_info->led_bits[2], 1); | 321 | set_led_bit(hfc, driver_info->led_bits[2], 0); |
316 | set_led_bit(hfc, driver_info->led_bits[3], 1); | 322 | set_led_bit(hfc, driver_info->led_bits[3], 0); |
317 | break; | 323 | break; |
318 | case LED_S0_ON: | 324 | case LED_S0_ON: |
319 | set_led_bit(hfc, driver_info->led_bits[1], 0); | 325 | set_led_bit(hfc, driver_info->led_bits[1], 1); |
320 | break; | 326 | break; |
321 | case LED_S0_OFF: | 327 | case LED_S0_OFF: |
322 | set_led_bit(hfc, driver_info->led_bits[1], 1); | 328 | set_led_bit(hfc, driver_info->led_bits[1], 0); |
323 | break; | 329 | break; |
324 | case LED_B1_ON: | 330 | case LED_B1_ON: |
325 | set_led_bit(hfc, driver_info->led_bits[2], 0); | 331 | set_led_bit(hfc, driver_info->led_bits[2], 1); |
326 | break; | 332 | break; |
327 | case LED_B1_OFF: | 333 | case LED_B1_OFF: |
328 | set_led_bit(hfc, driver_info->led_bits[2], 1); | 334 | set_led_bit(hfc, driver_info->led_bits[2], 0); |
329 | break; | 335 | break; |
330 | case LED_B2_ON: | 336 | case LED_B2_ON: |
331 | set_led_bit(hfc, driver_info->led_bits[3], 0); | 337 | set_led_bit(hfc, driver_info->led_bits[3], 1); |
332 | break; | 338 | break; |
333 | case LED_B2_OFF: | 339 | case LED_B2_OFF: |
334 | set_led_bit(hfc, driver_info->led_bits[3], 1); | 340 | set_led_bit(hfc, driver_info->led_bits[3], 0); |
335 | break; | 341 | break; |
336 | } | 342 | } |
337 | write_led(hfc, hfc->led_state); | 343 | write_led(hfc, hfc->led_state); |
@@ -1159,7 +1165,6 @@ hfc_usb_init(hfcusb_data * hfc) | |||
1159 | hfc->l1_activated = 0; | 1165 | hfc->l1_activated = 0; |
1160 | hfc->disc_flag = 0; | 1166 | hfc->disc_flag = 0; |
1161 | hfc->led_state = 0; | 1167 | hfc->led_state = 0; |
1162 | hfc->led_new_data = 0; | ||
1163 | hfc->old_led_state = 0; | 1168 | hfc->old_led_state = 0; |
1164 | 1169 | ||
1165 | /* init the t3 timer */ | 1170 | /* init the t3 timer */ |
@@ -1514,20 +1519,18 @@ hfc_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
1514 | 1519 | ||
1515 | /* callback for unplugged USB device */ | 1520 | /* callback for unplugged USB device */ |
1516 | static void | 1521 | static void |
1517 | hfc_usb_disconnect(struct usb_interface | 1522 | hfc_usb_disconnect(struct usb_interface *intf) |
1518 | *intf) | ||
1519 | { | 1523 | { |
1520 | hfcusb_data *context = usb_get_intfdata(intf); | 1524 | hfcusb_data *context = usb_get_intfdata(intf); |
1521 | int i; | 1525 | int i; |
1522 | 1526 | ||
1523 | handle_led(context, LED_POWER_OFF); | 1527 | handle_led(context, LED_POWER_OFF); |
1524 | schedule_timeout((10 * HZ) / 1000); | 1528 | schedule_timeout(HZ / 100); |
1525 | 1529 | ||
1526 | printk(KERN_INFO "HFC-S USB: device disconnect\n"); | 1530 | printk(KERN_INFO "HFC-S USB: device disconnect\n"); |
1527 | context->disc_flag = 1; | 1531 | context->disc_flag = 1; |
1528 | usb_set_intfdata(intf, NULL); | 1532 | usb_set_intfdata(intf, NULL); |
1529 | if (!context) | 1533 | |
1530 | return; | ||
1531 | if (timer_pending(&context->t3_timer)) | 1534 | if (timer_pending(&context->t3_timer)) |
1532 | del_timer(&context->t3_timer); | 1535 | del_timer(&context->t3_timer); |
1533 | if (timer_pending(&context->t4_timer)) | 1536 | if (timer_pending(&context->t4_timer)) |