hisax: hfc_usb: update to current CVS version
- killed paranoid NULL Pointer check - human readable LED states - support for "Eicon DIVA USB 4.0" (0x071d/0x1005) Signed-off-by: Martin Bachem <info@colognechip.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
325a80715f
commit
7441dd12e6
1 changed files with 42 additions and 39 deletions
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* hfc_usb.c
|
||||
*
|
||||
* $Id: hfc_usb.c,v 2.3.2.20 2007/08/20 14:07:54 mbachem Exp $
|
||||
* $Id: hfc_usb.c,v 2.3.2.24 2007/10/14 08:40:29 mbachem Exp $
|
||||
*
|
||||
* modular HiSax ISDN driver for Colognechip HFC-S USB chip
|
||||
*
|
||||
|
@ -45,7 +45,7 @@
|
|||
#include "hfc_usb.h"
|
||||
|
||||
static const char *hfcusb_revision =
|
||||
"$Revision: 2.3.2.20 $ $Date: 2007/08/20 14:07:54 $ ";
|
||||
"$Revision: 2.3.2.24 $ $Date: 2007/10/14 08:40:29 $ ";
|
||||
|
||||
/* Hisax debug support
|
||||
* debug flags defined in hfc_usb.h as HFCUSB_DBG_[*]
|
||||
|
@ -126,6 +126,12 @@ static struct usb_device_id hfcusb_idtab[] = {
|
|||
{LED_SCHEME1, {0x80, -64, -32, -16},
|
||||
"Twister ISDN TA"}),
|
||||
},
|
||||
{
|
||||
USB_DEVICE(0x071d, 0x1005),
|
||||
.driver_info = (unsigned long) &((hfcsusb_vdata)
|
||||
{LED_SCHEME1, {0x02, 0, 0x01, 0x04},
|
||||
"Eicon DIVA USB 4.0"}),
|
||||
},
|
||||
{ }
|
||||
};
|
||||
|
||||
|
@ -187,7 +193,7 @@ typedef struct hfcusb_data {
|
|||
struct usb_ctrlrequest ctrl_write; /* buffer for control write request */
|
||||
struct usb_ctrlrequest ctrl_read; /* same for read request */
|
||||
|
||||
__u8 old_led_state, led_state, led_new_data, led_b_active;
|
||||
__u8 old_led_state, led_state;
|
||||
|
||||
volatile __u8 threshold_mask; /* threshold actually reported */
|
||||
volatile __u8 bch_enables; /* or mask for sctrl_r and sctrl register values */
|
||||
|
@ -263,7 +269,7 @@ ctrl_complete(struct urb *urb)
|
|||
|
||||
ctrl_start_transfer(hfc); /* start next transfer */
|
||||
}
|
||||
} /* ctrl_complete */
|
||||
}
|
||||
|
||||
/* write led data to auxport & invert if necessary */
|
||||
static void
|
||||
|
@ -276,18 +282,18 @@ write_led(hfcusb_data * hfc, __u8 led_state)
|
|||
}
|
||||
|
||||
static void
|
||||
set_led_bit(hfcusb_data * hfc, signed short led_bits, int unset)
|
||||
set_led_bit(hfcusb_data * hfc, signed short led_bits, int on)
|
||||
{
|
||||
if (unset) {
|
||||
if (led_bits < 0)
|
||||
hfc->led_state |= abs(led_bits);
|
||||
else
|
||||
hfc->led_state &= ~led_bits;
|
||||
} else {
|
||||
if (on) {
|
||||
if (led_bits < 0)
|
||||
hfc->led_state &= ~abs(led_bits);
|
||||
else
|
||||
hfc->led_state |= led_bits;
|
||||
} else {
|
||||
if (led_bits < 0)
|
||||
hfc->led_state |= abs(led_bits);
|
||||
else
|
||||
hfc->led_state &= ~led_bits;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -304,35 +310,35 @@ handle_led(hfcusb_data * hfc, int event)
|
|||
|
||||
switch (event) {
|
||||
case LED_POWER_ON:
|
||||
set_led_bit(hfc, driver_info->led_bits[0], 0);
|
||||
set_led_bit(hfc, driver_info->led_bits[1], 1);
|
||||
set_led_bit(hfc, driver_info->led_bits[2], 1);
|
||||
set_led_bit(hfc, driver_info->led_bits[3], 1);
|
||||
break;
|
||||
case LED_POWER_OFF:
|
||||
set_led_bit(hfc, driver_info->led_bits[0], 1);
|
||||
set_led_bit(hfc, driver_info->led_bits[1], 1);
|
||||
set_led_bit(hfc, driver_info->led_bits[2], 1);
|
||||
set_led_bit(hfc, driver_info->led_bits[3], 1);
|
||||
break;
|
||||
case LED_S0_ON:
|
||||
set_led_bit(hfc, driver_info->led_bits[1], 0);
|
||||
break;
|
||||
case LED_S0_OFF:
|
||||
set_led_bit(hfc, driver_info->led_bits[1], 1);
|
||||
break;
|
||||
case LED_B1_ON:
|
||||
set_led_bit(hfc, driver_info->led_bits[2], 0);
|
||||
break;
|
||||
case LED_B1_OFF:
|
||||
set_led_bit(hfc, driver_info->led_bits[2], 1);
|
||||
break;
|
||||
case LED_B2_ON:
|
||||
set_led_bit(hfc, driver_info->led_bits[3], 0);
|
||||
break;
|
||||
case LED_B2_OFF:
|
||||
case LED_POWER_OFF:
|
||||
set_led_bit(hfc, driver_info->led_bits[0], 0);
|
||||
set_led_bit(hfc, driver_info->led_bits[1], 0);
|
||||
set_led_bit(hfc, driver_info->led_bits[2], 0);
|
||||
set_led_bit(hfc, driver_info->led_bits[3], 0);
|
||||
break;
|
||||
case LED_S0_ON:
|
||||
set_led_bit(hfc, driver_info->led_bits[1], 1);
|
||||
break;
|
||||
case LED_S0_OFF:
|
||||
set_led_bit(hfc, driver_info->led_bits[1], 0);
|
||||
break;
|
||||
case LED_B1_ON:
|
||||
set_led_bit(hfc, driver_info->led_bits[2], 1);
|
||||
break;
|
||||
case LED_B1_OFF:
|
||||
set_led_bit(hfc, driver_info->led_bits[2], 0);
|
||||
break;
|
||||
case LED_B2_ON:
|
||||
set_led_bit(hfc, driver_info->led_bits[3], 1);
|
||||
break;
|
||||
case LED_B2_OFF:
|
||||
set_led_bit(hfc, driver_info->led_bits[3], 0);
|
||||
break;
|
||||
}
|
||||
write_led(hfc, hfc->led_state);
|
||||
}
|
||||
|
@ -1159,7 +1165,6 @@ hfc_usb_init(hfcusb_data * hfc)
|
|||
hfc->l1_activated = 0;
|
||||
hfc->disc_flag = 0;
|
||||
hfc->led_state = 0;
|
||||
hfc->led_new_data = 0;
|
||||
hfc->old_led_state = 0;
|
||||
|
||||
/* init the t3 timer */
|
||||
|
@ -1514,20 +1519,18 @@ hfc_usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
|
|||
|
||||
/* callback for unplugged USB device */
|
||||
static void
|
||||
hfc_usb_disconnect(struct usb_interface
|
||||
*intf)
|
||||
hfc_usb_disconnect(struct usb_interface *intf)
|
||||
{
|
||||
hfcusb_data *context = usb_get_intfdata(intf);
|
||||
int i;
|
||||
|
||||
handle_led(context, LED_POWER_OFF);
|
||||
schedule_timeout((10 * HZ) / 1000);
|
||||
schedule_timeout(HZ / 100);
|
||||
|
||||
printk(KERN_INFO "HFC-S USB: device disconnect\n");
|
||||
context->disc_flag = 1;
|
||||
usb_set_intfdata(intf, NULL);
|
||||
if (!context)
|
||||
return;
|
||||
|
||||
if (timer_pending(&context->t3_timer))
|
||||
del_timer(&context->t3_timer);
|
||||
if (timer_pending(&context->t4_timer))
|
||||
|
|
Loading…
Reference in a new issue