162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * hfcsusb.h, HFC-S USB mISDN driver 462306a36Sopenharmony_ci */ 562306a36Sopenharmony_ci 662306a36Sopenharmony_ci#ifndef __HFCSUSB_H__ 762306a36Sopenharmony_ci#define __HFCSUSB_H__ 862306a36Sopenharmony_ci 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ci#define DRIVER_NAME "HFC-S_USB" 1162306a36Sopenharmony_ci 1262306a36Sopenharmony_ci#define DBG_HFC_CALL_TRACE 0x00010000 1362306a36Sopenharmony_ci#define DBG_HFC_FIFO_VERBOSE 0x00020000 1462306a36Sopenharmony_ci#define DBG_HFC_USB_VERBOSE 0x00100000 1562306a36Sopenharmony_ci#define DBG_HFC_URB_INFO 0x00200000 1662306a36Sopenharmony_ci#define DBG_HFC_URB_ERROR 0x00400000 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ci#define DEFAULT_TRANSP_BURST_SZ 128 1962306a36Sopenharmony_ci 2062306a36Sopenharmony_ci#define HFC_CTRL_TIMEOUT 20 /* 5ms timeout writing/reading regs */ 2162306a36Sopenharmony_ci#define CLKDEL_TE 0x0f /* CLKDEL in TE mode */ 2262306a36Sopenharmony_ci#define CLKDEL_NT 0x6c /* CLKDEL in NT mode */ 2362306a36Sopenharmony_ci 2462306a36Sopenharmony_ci/* hfcsusb Layer1 commands */ 2562306a36Sopenharmony_ci#define HFC_L1_ACTIVATE_TE 1 2662306a36Sopenharmony_ci#define HFC_L1_ACTIVATE_NT 2 2762306a36Sopenharmony_ci#define HFC_L1_DEACTIVATE_NT 3 2862306a36Sopenharmony_ci#define HFC_L1_FORCE_DEACTIVATE_TE 4 2962306a36Sopenharmony_ci 3062306a36Sopenharmony_ci/* cmd FLAGS in HFCUSB_STATES register */ 3162306a36Sopenharmony_ci#define HFCUSB_LOAD_STATE 0x10 3262306a36Sopenharmony_ci#define HFCUSB_ACTIVATE 0x20 3362306a36Sopenharmony_ci#define HFCUSB_DO_ACTION 0x40 3462306a36Sopenharmony_ci#define HFCUSB_NT_G2_G3 0x80 3562306a36Sopenharmony_ci 3662306a36Sopenharmony_ci/* timers */ 3762306a36Sopenharmony_ci#define NT_ACTIVATION_TIMER 0x01 /* enables NT mode activation Timer */ 3862306a36Sopenharmony_ci#define NT_T1_COUNT 10 3962306a36Sopenharmony_ci 4062306a36Sopenharmony_ci#define MAX_BCH_SIZE 2048 /* allowed B-channel packet size */ 4162306a36Sopenharmony_ci 4262306a36Sopenharmony_ci#define HFCUSB_RX_THRESHOLD 64 /* threshold for fifo report bit rx */ 4362306a36Sopenharmony_ci#define HFCUSB_TX_THRESHOLD 96 /* threshold for fifo report bit tx */ 4462306a36Sopenharmony_ci 4562306a36Sopenharmony_ci#define HFCUSB_CHIP_ID 0x16 /* Chip ID register index */ 4662306a36Sopenharmony_ci#define HFCUSB_CIRM 0x00 /* cirm register index */ 4762306a36Sopenharmony_ci#define HFCUSB_USB_SIZE 0x07 /* int length register */ 4862306a36Sopenharmony_ci#define HFCUSB_USB_SIZE_I 0x06 /* iso length register */ 4962306a36Sopenharmony_ci#define HFCUSB_F_CROSS 0x0b /* bit order register */ 5062306a36Sopenharmony_ci#define HFCUSB_CLKDEL 0x37 /* bit delay register */ 5162306a36Sopenharmony_ci#define HFCUSB_CON_HDLC 0xfa /* channel connect register */ 5262306a36Sopenharmony_ci#define HFCUSB_HDLC_PAR 0xfb 5362306a36Sopenharmony_ci#define HFCUSB_SCTRL 0x31 /* S-bus control register (tx) */ 5462306a36Sopenharmony_ci#define HFCUSB_SCTRL_E 0x32 /* same for E and special funcs */ 5562306a36Sopenharmony_ci#define HFCUSB_SCTRL_R 0x33 /* S-bus control register (rx) */ 5662306a36Sopenharmony_ci#define HFCUSB_F_THRES 0x0c /* threshold register */ 5762306a36Sopenharmony_ci#define HFCUSB_FIFO 0x0f /* fifo select register */ 5862306a36Sopenharmony_ci#define HFCUSB_F_USAGE 0x1a /* fifo usage register */ 5962306a36Sopenharmony_ci#define HFCUSB_MST_MODE0 0x14 6062306a36Sopenharmony_ci#define HFCUSB_MST_MODE1 0x15 6162306a36Sopenharmony_ci#define HFCUSB_P_DATA 0x1f 6262306a36Sopenharmony_ci#define HFCUSB_INC_RES_F 0x0e 6362306a36Sopenharmony_ci#define HFCUSB_B1_SSL 0x20 6462306a36Sopenharmony_ci#define HFCUSB_B2_SSL 0x21 6562306a36Sopenharmony_ci#define HFCUSB_B1_RSL 0x24 6662306a36Sopenharmony_ci#define HFCUSB_B2_RSL 0x25 6762306a36Sopenharmony_ci#define HFCUSB_STATES 0x30 6862306a36Sopenharmony_ci 6962306a36Sopenharmony_ci 7062306a36Sopenharmony_ci#define HFCUSB_CHIPID 0x40 /* ID value of HFC-S USB */ 7162306a36Sopenharmony_ci 7262306a36Sopenharmony_ci/* fifo registers */ 7362306a36Sopenharmony_ci#define HFCUSB_NUM_FIFOS 8 /* maximum number of fifos */ 7462306a36Sopenharmony_ci#define HFCUSB_B1_TX 0 /* index for B1 transmit bulk/int */ 7562306a36Sopenharmony_ci#define HFCUSB_B1_RX 1 /* index for B1 receive bulk/int */ 7662306a36Sopenharmony_ci#define HFCUSB_B2_TX 2 7762306a36Sopenharmony_ci#define HFCUSB_B2_RX 3 7862306a36Sopenharmony_ci#define HFCUSB_D_TX 4 7962306a36Sopenharmony_ci#define HFCUSB_D_RX 5 8062306a36Sopenharmony_ci#define HFCUSB_PCM_TX 6 8162306a36Sopenharmony_ci#define HFCUSB_PCM_RX 7 8262306a36Sopenharmony_ci 8362306a36Sopenharmony_ci 8462306a36Sopenharmony_ci#define USB_INT 0 8562306a36Sopenharmony_ci#define USB_BULK 1 8662306a36Sopenharmony_ci#define USB_ISOC 2 8762306a36Sopenharmony_ci 8862306a36Sopenharmony_ci#define ISOC_PACKETS_D 8 8962306a36Sopenharmony_ci#define ISOC_PACKETS_B 8 9062306a36Sopenharmony_ci#define ISO_BUFFER_SIZE 128 9162306a36Sopenharmony_ci 9262306a36Sopenharmony_ci/* defines how much ISO packets are handled in one URB */ 9362306a36Sopenharmony_cistatic int iso_packets[8] = 9462306a36Sopenharmony_ci{ ISOC_PACKETS_B, ISOC_PACKETS_B, ISOC_PACKETS_B, ISOC_PACKETS_B, 9562306a36Sopenharmony_ci ISOC_PACKETS_D, ISOC_PACKETS_D, ISOC_PACKETS_D, ISOC_PACKETS_D 9662306a36Sopenharmony_ci}; 9762306a36Sopenharmony_ci 9862306a36Sopenharmony_ci 9962306a36Sopenharmony_ci/* Fifo flow Control for TX ISO */ 10062306a36Sopenharmony_ci#define SINK_MAX 68 10162306a36Sopenharmony_ci#define SINK_MIN 48 10262306a36Sopenharmony_ci#define SINK_DMIN 12 10362306a36Sopenharmony_ci#define SINK_DMAX 18 10462306a36Sopenharmony_ci#define BITLINE_INF (-96 * 8) 10562306a36Sopenharmony_ci 10662306a36Sopenharmony_ci/* HFC-S USB register access by Control-URSs */ 10762306a36Sopenharmony_ci#define write_reg_atomic(a, b, c) \ 10862306a36Sopenharmony_ci usb_control_msg((a)->dev, (a)->ctrl_out_pipe, 0, 0x40, (c), (b), \ 10962306a36Sopenharmony_ci 0, 0, HFC_CTRL_TIMEOUT) 11062306a36Sopenharmony_ci#define read_reg_atomic(a, b, c) \ 11162306a36Sopenharmony_ci usb_control_msg((a)->dev, (a)->ctrl_in_pipe, 1, 0xC0, 0, (b), (c), \ 11262306a36Sopenharmony_ci 1, HFC_CTRL_TIMEOUT) 11362306a36Sopenharmony_ci#define HFC_CTRL_BUFSIZE 64 11462306a36Sopenharmony_ci 11562306a36Sopenharmony_cistruct ctrl_buf { 11662306a36Sopenharmony_ci __u8 hfcs_reg; /* register number */ 11762306a36Sopenharmony_ci __u8 reg_val; /* value to be written (or read) */ 11862306a36Sopenharmony_ci}; 11962306a36Sopenharmony_ci 12062306a36Sopenharmony_ci/* 12162306a36Sopenharmony_ci * URB error codes 12262306a36Sopenharmony_ci * Used to represent a list of values and their respective symbolic names 12362306a36Sopenharmony_ci */ 12462306a36Sopenharmony_cistruct hfcusb_symbolic_list { 12562306a36Sopenharmony_ci const int num; 12662306a36Sopenharmony_ci const char *name; 12762306a36Sopenharmony_ci}; 12862306a36Sopenharmony_ci 12962306a36Sopenharmony_cistatic struct hfcusb_symbolic_list urb_errlist[] = { 13062306a36Sopenharmony_ci {-ENOMEM, "No memory for allocation of internal structures"}, 13162306a36Sopenharmony_ci {-ENOSPC, "The host controller's bandwidth is already consumed"}, 13262306a36Sopenharmony_ci {-ENOENT, "URB was canceled by unlink_urb"}, 13362306a36Sopenharmony_ci {-EXDEV, "ISO transfer only partially completed"}, 13462306a36Sopenharmony_ci {-EAGAIN, "Too match scheduled for the future"}, 13562306a36Sopenharmony_ci {-ENXIO, "URB already queued"}, 13662306a36Sopenharmony_ci {-EFBIG, "Too much ISO frames requested"}, 13762306a36Sopenharmony_ci {-ENOSR, "Buffer error (overrun)"}, 13862306a36Sopenharmony_ci {-EPIPE, "Specified endpoint is stalled (device not responding)"}, 13962306a36Sopenharmony_ci {-EOVERFLOW, "Babble (bad cable?)"}, 14062306a36Sopenharmony_ci {-EPROTO, "Bit-stuff error (bad cable?)"}, 14162306a36Sopenharmony_ci {-EILSEQ, "CRC/Timeout"}, 14262306a36Sopenharmony_ci {-ETIMEDOUT, "NAK (device does not respond)"}, 14362306a36Sopenharmony_ci {-ESHUTDOWN, "Device unplugged"}, 14462306a36Sopenharmony_ci {-1, NULL} 14562306a36Sopenharmony_ci}; 14662306a36Sopenharmony_ci 14762306a36Sopenharmony_cistatic inline const char * 14862306a36Sopenharmony_cisymbolic(struct hfcusb_symbolic_list list[], const int num) 14962306a36Sopenharmony_ci{ 15062306a36Sopenharmony_ci int i; 15162306a36Sopenharmony_ci for (i = 0; list[i].name != NULL; i++) 15262306a36Sopenharmony_ci if (list[i].num == num) 15362306a36Sopenharmony_ci return list[i].name; 15462306a36Sopenharmony_ci return "<unknown USB Error>"; 15562306a36Sopenharmony_ci} 15662306a36Sopenharmony_ci 15762306a36Sopenharmony_ci/* USB descriptor need to contain one of the following EndPoint combination: */ 15862306a36Sopenharmony_ci#define CNF_4INT3ISO 1 /* 4 INT IN, 3 ISO OUT */ 15962306a36Sopenharmony_ci#define CNF_3INT3ISO 2 /* 3 INT IN, 3 ISO OUT */ 16062306a36Sopenharmony_ci#define CNF_4ISO3ISO 3 /* 4 ISO IN, 3 ISO OUT */ 16162306a36Sopenharmony_ci#define CNF_3ISO3ISO 4 /* 3 ISO IN, 3 ISO OUT */ 16262306a36Sopenharmony_ci 16362306a36Sopenharmony_ci#define EP_NUL 1 /* Endpoint at this position not allowed */ 16462306a36Sopenharmony_ci#define EP_NOP 2 /* all type of endpoints allowed at this position */ 16562306a36Sopenharmony_ci#define EP_ISO 3 /* Isochron endpoint mandatory at this position */ 16662306a36Sopenharmony_ci#define EP_BLK 4 /* Bulk endpoint mandatory at this position */ 16762306a36Sopenharmony_ci#define EP_INT 5 /* Interrupt endpoint mandatory at this position */ 16862306a36Sopenharmony_ci 16962306a36Sopenharmony_ci#define HFC_CHAN_B1 0 17062306a36Sopenharmony_ci#define HFC_CHAN_B2 1 17162306a36Sopenharmony_ci#define HFC_CHAN_D 2 17262306a36Sopenharmony_ci#define HFC_CHAN_E 3 17362306a36Sopenharmony_ci 17462306a36Sopenharmony_ci 17562306a36Sopenharmony_ci/* 17662306a36Sopenharmony_ci * List of all supported endpoint configuration sets, used to find the 17762306a36Sopenharmony_ci * best matching endpoint configuration within a device's USB descriptor. 17862306a36Sopenharmony_ci * We need at least 3 RX endpoints, and 3 TX endpoints, either 17962306a36Sopenharmony_ci * INT-in and ISO-out, or ISO-in and ISO-out) 18062306a36Sopenharmony_ci * with 4 RX endpoints even E-Channel logging is possible 18162306a36Sopenharmony_ci */ 18262306a36Sopenharmony_cistatic int 18362306a36Sopenharmony_civalidconf[][19] = { 18462306a36Sopenharmony_ci /* INT in, ISO out config */ 18562306a36Sopenharmony_ci {EP_NUL, EP_INT, EP_NUL, EP_INT, EP_NUL, EP_INT, EP_NOP, EP_INT, 18662306a36Sopenharmony_ci EP_ISO, EP_NUL, EP_ISO, EP_NUL, EP_ISO, EP_NUL, EP_NUL, EP_NUL, 18762306a36Sopenharmony_ci CNF_4INT3ISO, 2, 1}, 18862306a36Sopenharmony_ci {EP_NUL, EP_INT, EP_NUL, EP_INT, EP_NUL, EP_INT, EP_NUL, EP_NUL, 18962306a36Sopenharmony_ci EP_ISO, EP_NUL, EP_ISO, EP_NUL, EP_ISO, EP_NUL, EP_NUL, EP_NUL, 19062306a36Sopenharmony_ci CNF_3INT3ISO, 2, 0}, 19162306a36Sopenharmony_ci /* ISO in, ISO out config */ 19262306a36Sopenharmony_ci {EP_NOP, EP_NOP, EP_NOP, EP_NOP, EP_NOP, EP_NOP, EP_NOP, EP_NOP, 19362306a36Sopenharmony_ci EP_ISO, EP_ISO, EP_ISO, EP_ISO, EP_ISO, EP_ISO, EP_NOP, EP_ISO, 19462306a36Sopenharmony_ci CNF_4ISO3ISO, 2, 1}, 19562306a36Sopenharmony_ci {EP_NUL, EP_NUL, EP_NUL, EP_NUL, EP_NUL, EP_NUL, EP_NUL, EP_NUL, 19662306a36Sopenharmony_ci EP_ISO, EP_ISO, EP_ISO, EP_ISO, EP_ISO, EP_ISO, EP_NUL, EP_NUL, 19762306a36Sopenharmony_ci CNF_3ISO3ISO, 2, 0}, 19862306a36Sopenharmony_ci {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} /* EOL element */ 19962306a36Sopenharmony_ci}; 20062306a36Sopenharmony_ci 20162306a36Sopenharmony_ci/* string description of chosen config */ 20262306a36Sopenharmony_cistatic char *conf_str[] = { 20362306a36Sopenharmony_ci "4 Interrupt IN + 3 Isochron OUT", 20462306a36Sopenharmony_ci "3 Interrupt IN + 3 Isochron OUT", 20562306a36Sopenharmony_ci "4 Isochron IN + 3 Isochron OUT", 20662306a36Sopenharmony_ci "3 Isochron IN + 3 Isochron OUT" 20762306a36Sopenharmony_ci}; 20862306a36Sopenharmony_ci 20962306a36Sopenharmony_ci 21062306a36Sopenharmony_ci#define LED_OFF 0 /* no LED support */ 21162306a36Sopenharmony_ci#define LED_SCHEME1 1 /* LED standard scheme */ 21262306a36Sopenharmony_ci#define LED_SCHEME2 2 /* not used yet... */ 21362306a36Sopenharmony_ci 21462306a36Sopenharmony_ci#define LED_POWER_ON 1 21562306a36Sopenharmony_ci#define LED_POWER_OFF 2 21662306a36Sopenharmony_ci#define LED_S0_ON 3 21762306a36Sopenharmony_ci#define LED_S0_OFF 4 21862306a36Sopenharmony_ci#define LED_B1_ON 5 21962306a36Sopenharmony_ci#define LED_B1_OFF 6 22062306a36Sopenharmony_ci#define LED_B1_DATA 7 22162306a36Sopenharmony_ci#define LED_B2_ON 8 22262306a36Sopenharmony_ci#define LED_B2_OFF 9 22362306a36Sopenharmony_ci#define LED_B2_DATA 10 22462306a36Sopenharmony_ci 22562306a36Sopenharmony_ci#define LED_NORMAL 0 /* LEDs are normal */ 22662306a36Sopenharmony_ci#define LED_INVERTED 1 /* LEDs are inverted */ 22762306a36Sopenharmony_ci 22862306a36Sopenharmony_ci/* time in ms to perform a Flashing LED when B-Channel has traffic */ 22962306a36Sopenharmony_ci#define LED_TIME 250 23062306a36Sopenharmony_ci 23162306a36Sopenharmony_ci 23262306a36Sopenharmony_ci 23362306a36Sopenharmony_cistruct hfcsusb; 23462306a36Sopenharmony_cistruct usb_fifo; 23562306a36Sopenharmony_ci 23662306a36Sopenharmony_ci/* structure defining input+output fifos (interrupt/bulk mode) */ 23762306a36Sopenharmony_cistruct iso_urb { 23862306a36Sopenharmony_ci struct urb *urb; 23962306a36Sopenharmony_ci __u8 buffer[ISO_BUFFER_SIZE]; /* buffer rx/tx USB URB data */ 24062306a36Sopenharmony_ci struct usb_fifo *owner_fifo; /* pointer to owner fifo */ 24162306a36Sopenharmony_ci __u8 indx; /* Fifos's ISO double buffer 0 or 1 ? */ 24262306a36Sopenharmony_ci#ifdef ISO_FRAME_START_DEBUG 24362306a36Sopenharmony_ci int start_frames[ISO_FRAME_START_RING_COUNT]; 24462306a36Sopenharmony_ci __u8 iso_frm_strt_pos; /* index in start_frame[] */ 24562306a36Sopenharmony_ci#endif 24662306a36Sopenharmony_ci}; 24762306a36Sopenharmony_ci 24862306a36Sopenharmony_cistruct usb_fifo { 24962306a36Sopenharmony_ci int fifonum; /* fifo index attached to this structure */ 25062306a36Sopenharmony_ci int active; /* fifo is currently active */ 25162306a36Sopenharmony_ci struct hfcsusb *hw; /* pointer to main structure */ 25262306a36Sopenharmony_ci int pipe; /* address of endpoint */ 25362306a36Sopenharmony_ci __u8 usb_packet_maxlen; /* maximum length for usb transfer */ 25462306a36Sopenharmony_ci unsigned int max_size; /* maximum size of receive/send packet */ 25562306a36Sopenharmony_ci __u8 intervall; /* interrupt interval */ 25662306a36Sopenharmony_ci struct urb *urb; /* transfer structure for usb routines */ 25762306a36Sopenharmony_ci __u8 buffer[128]; /* buffer USB INT OUT URB data */ 25862306a36Sopenharmony_ci int bit_line; /* how much bits are in the fifo? */ 25962306a36Sopenharmony_ci 26062306a36Sopenharmony_ci __u8 usb_transfer_mode; /* switched between ISO and INT */ 26162306a36Sopenharmony_ci struct iso_urb iso[2]; /* two urbs to have one always 26262306a36Sopenharmony_ci one pending */ 26362306a36Sopenharmony_ci 26462306a36Sopenharmony_ci struct dchannel *dch; /* link to hfcsusb_t->dch */ 26562306a36Sopenharmony_ci struct bchannel *bch; /* link to hfcsusb_t->bch */ 26662306a36Sopenharmony_ci struct dchannel *ech; /* link to hfcsusb_t->ech, TODO: E-CHANNEL */ 26762306a36Sopenharmony_ci int last_urblen; /* remember length of last packet */ 26862306a36Sopenharmony_ci __u8 stop_gracefull; /* stops URB retransmission */ 26962306a36Sopenharmony_ci}; 27062306a36Sopenharmony_ci 27162306a36Sopenharmony_cistruct hfcsusb { 27262306a36Sopenharmony_ci struct list_head list; 27362306a36Sopenharmony_ci struct dchannel dch; 27462306a36Sopenharmony_ci struct bchannel bch[2]; 27562306a36Sopenharmony_ci struct dchannel ech; /* TODO : wait for struct echannel ;) */ 27662306a36Sopenharmony_ci 27762306a36Sopenharmony_ci struct usb_device *dev; /* our device */ 27862306a36Sopenharmony_ci struct usb_interface *intf; /* used interface */ 27962306a36Sopenharmony_ci int if_used; /* used interface number */ 28062306a36Sopenharmony_ci int alt_used; /* used alternate config */ 28162306a36Sopenharmony_ci int cfg_used; /* configuration index used */ 28262306a36Sopenharmony_ci int vend_idx; /* index in hfcsusb_idtab */ 28362306a36Sopenharmony_ci int packet_size; 28462306a36Sopenharmony_ci int iso_packet_size; 28562306a36Sopenharmony_ci struct usb_fifo fifos[HFCUSB_NUM_FIFOS]; 28662306a36Sopenharmony_ci 28762306a36Sopenharmony_ci /* control pipe background handling */ 28862306a36Sopenharmony_ci struct ctrl_buf ctrl_buff[HFC_CTRL_BUFSIZE]; 28962306a36Sopenharmony_ci int ctrl_in_idx, ctrl_out_idx, ctrl_cnt; 29062306a36Sopenharmony_ci struct urb *ctrl_urb; 29162306a36Sopenharmony_ci struct usb_ctrlrequest ctrl_write; 29262306a36Sopenharmony_ci struct usb_ctrlrequest ctrl_read; 29362306a36Sopenharmony_ci int ctrl_paksize; 29462306a36Sopenharmony_ci int ctrl_in_pipe, ctrl_out_pipe; 29562306a36Sopenharmony_ci spinlock_t ctrl_lock; /* lock for ctrl */ 29662306a36Sopenharmony_ci spinlock_t lock; 29762306a36Sopenharmony_ci 29862306a36Sopenharmony_ci __u8 threshold_mask; 29962306a36Sopenharmony_ci __u8 led_state; 30062306a36Sopenharmony_ci 30162306a36Sopenharmony_ci __u8 protocol; 30262306a36Sopenharmony_ci int nt_timer; 30362306a36Sopenharmony_ci int open; 30462306a36Sopenharmony_ci __u8 timers; 30562306a36Sopenharmony_ci __u8 initdone; 30662306a36Sopenharmony_ci char name[MISDN_MAX_IDLEN]; 30762306a36Sopenharmony_ci}; 30862306a36Sopenharmony_ci 30962306a36Sopenharmony_ci/* private vendor specific data */ 31062306a36Sopenharmony_cistruct hfcsusb_vdata { 31162306a36Sopenharmony_ci __u8 led_scheme; /* led display scheme */ 31262306a36Sopenharmony_ci signed short led_bits[8]; /* array of 8 possible LED bitmask */ 31362306a36Sopenharmony_ci char *vend_name; /* device name */ 31462306a36Sopenharmony_ci}; 31562306a36Sopenharmony_ci 31662306a36Sopenharmony_ci 31762306a36Sopenharmony_ci#define HFC_MAX_TE_LAYER1_STATE 8 31862306a36Sopenharmony_ci#define HFC_MAX_NT_LAYER1_STATE 4 31962306a36Sopenharmony_ci 32062306a36Sopenharmony_cistatic const char *HFC_TE_LAYER1_STATES[HFC_MAX_TE_LAYER1_STATE + 1] = { 32162306a36Sopenharmony_ci "TE F0 - Reset", 32262306a36Sopenharmony_ci "TE F1 - Reset", 32362306a36Sopenharmony_ci "TE F2 - Sensing", 32462306a36Sopenharmony_ci "TE F3 - Deactivated", 32562306a36Sopenharmony_ci "TE F4 - Awaiting signal", 32662306a36Sopenharmony_ci "TE F5 - Identifying input", 32762306a36Sopenharmony_ci "TE F6 - Synchronized", 32862306a36Sopenharmony_ci "TE F7 - Activated", 32962306a36Sopenharmony_ci "TE F8 - Lost framing", 33062306a36Sopenharmony_ci}; 33162306a36Sopenharmony_ci 33262306a36Sopenharmony_cistatic const char *HFC_NT_LAYER1_STATES[HFC_MAX_NT_LAYER1_STATE + 1] = { 33362306a36Sopenharmony_ci "NT G0 - Reset", 33462306a36Sopenharmony_ci "NT G1 - Deactive", 33562306a36Sopenharmony_ci "NT G2 - Pending activation", 33662306a36Sopenharmony_ci "NT G3 - Active", 33762306a36Sopenharmony_ci "NT G4 - Pending deactivation", 33862306a36Sopenharmony_ci}; 33962306a36Sopenharmony_ci 34062306a36Sopenharmony_ci/* supported devices */ 34162306a36Sopenharmony_cistatic const struct usb_device_id hfcsusb_idtab[] = { 34262306a36Sopenharmony_ci { 34362306a36Sopenharmony_ci USB_DEVICE(0x0959, 0x2bd0), 34462306a36Sopenharmony_ci .driver_info = (unsigned long) &((struct hfcsusb_vdata) 34562306a36Sopenharmony_ci {LED_OFF, {4, 0, 2, 1}, 34662306a36Sopenharmony_ci "ISDN USB TA (Cologne Chip HFC-S USB based)"}), 34762306a36Sopenharmony_ci }, 34862306a36Sopenharmony_ci { 34962306a36Sopenharmony_ci USB_DEVICE(0x0675, 0x1688), 35062306a36Sopenharmony_ci .driver_info = (unsigned long) &((struct hfcsusb_vdata) 35162306a36Sopenharmony_ci {LED_SCHEME1, {1, 2, 0, 0}, 35262306a36Sopenharmony_ci "DrayTek miniVigor 128 USB ISDN TA"}), 35362306a36Sopenharmony_ci }, 35462306a36Sopenharmony_ci { 35562306a36Sopenharmony_ci USB_DEVICE(0x07b0, 0x0007), 35662306a36Sopenharmony_ci .driver_info = (unsigned long) &((struct hfcsusb_vdata) 35762306a36Sopenharmony_ci {LED_SCHEME1, {0x80, -64, -32, -16}, 35862306a36Sopenharmony_ci "Billion tiny USB ISDN TA 128"}), 35962306a36Sopenharmony_ci }, 36062306a36Sopenharmony_ci { 36162306a36Sopenharmony_ci USB_DEVICE(0x0742, 0x2008), 36262306a36Sopenharmony_ci .driver_info = (unsigned long) &((struct hfcsusb_vdata) 36362306a36Sopenharmony_ci {LED_SCHEME1, {4, 0, 2, 1}, 36462306a36Sopenharmony_ci "Stollmann USB TA"}), 36562306a36Sopenharmony_ci }, 36662306a36Sopenharmony_ci { 36762306a36Sopenharmony_ci USB_DEVICE(0x0742, 0x2009), 36862306a36Sopenharmony_ci .driver_info = (unsigned long) &((struct hfcsusb_vdata) 36962306a36Sopenharmony_ci {LED_SCHEME1, {4, 0, 2, 1}, 37062306a36Sopenharmony_ci "Aceex USB ISDN TA"}), 37162306a36Sopenharmony_ci }, 37262306a36Sopenharmony_ci { 37362306a36Sopenharmony_ci USB_DEVICE(0x0742, 0x200A), 37462306a36Sopenharmony_ci .driver_info = (unsigned long) &((struct hfcsusb_vdata) 37562306a36Sopenharmony_ci {LED_SCHEME1, {4, 0, 2, 1}, 37662306a36Sopenharmony_ci "OEM USB ISDN TA"}), 37762306a36Sopenharmony_ci }, 37862306a36Sopenharmony_ci { 37962306a36Sopenharmony_ci USB_DEVICE(0x08e3, 0x0301), 38062306a36Sopenharmony_ci .driver_info = (unsigned long) &((struct hfcsusb_vdata) 38162306a36Sopenharmony_ci {LED_SCHEME1, {2, 0, 1, 4}, 38262306a36Sopenharmony_ci "Olitec USB RNIS"}), 38362306a36Sopenharmony_ci }, 38462306a36Sopenharmony_ci { 38562306a36Sopenharmony_ci USB_DEVICE(0x07fa, 0x0846), 38662306a36Sopenharmony_ci .driver_info = (unsigned long) &((struct hfcsusb_vdata) 38762306a36Sopenharmony_ci {LED_SCHEME1, {0x80, -64, -32, -16}, 38862306a36Sopenharmony_ci "Bewan Modem RNIS USB"}), 38962306a36Sopenharmony_ci }, 39062306a36Sopenharmony_ci { 39162306a36Sopenharmony_ci USB_DEVICE(0x07fa, 0x0847), 39262306a36Sopenharmony_ci .driver_info = (unsigned long) &((struct hfcsusb_vdata) 39362306a36Sopenharmony_ci {LED_SCHEME1, {0x80, -64, -32, -16}, 39462306a36Sopenharmony_ci "Djinn Numeris USB"}), 39562306a36Sopenharmony_ci }, 39662306a36Sopenharmony_ci { 39762306a36Sopenharmony_ci USB_DEVICE(0x07b0, 0x0006), 39862306a36Sopenharmony_ci .driver_info = (unsigned long) &((struct hfcsusb_vdata) 39962306a36Sopenharmony_ci {LED_SCHEME1, {0x80, -64, -32, -16}, 40062306a36Sopenharmony_ci "Twister ISDN TA"}), 40162306a36Sopenharmony_ci }, 40262306a36Sopenharmony_ci { 40362306a36Sopenharmony_ci USB_DEVICE(0x071d, 0x1005), 40462306a36Sopenharmony_ci .driver_info = (unsigned long) &((struct hfcsusb_vdata) 40562306a36Sopenharmony_ci {LED_SCHEME1, {0x02, 0, 0x01, 0x04}, 40662306a36Sopenharmony_ci "Eicon DIVA USB 4.0"}), 40762306a36Sopenharmony_ci }, 40862306a36Sopenharmony_ci { 40962306a36Sopenharmony_ci USB_DEVICE(0x0586, 0x0102), 41062306a36Sopenharmony_ci .driver_info = (unsigned long) &((struct hfcsusb_vdata) 41162306a36Sopenharmony_ci {LED_SCHEME1, {0x88, -64, -32, -16}, 41262306a36Sopenharmony_ci "ZyXEL OMNI.NET USB II"}), 41362306a36Sopenharmony_ci }, 41462306a36Sopenharmony_ci { 41562306a36Sopenharmony_ci USB_DEVICE(0x1ae7, 0x0525), 41662306a36Sopenharmony_ci .driver_info = (unsigned long) &((struct hfcsusb_vdata) 41762306a36Sopenharmony_ci {LED_SCHEME1, {0x88, -64, -32, -16}, 41862306a36Sopenharmony_ci "X-Tensions USB ISDN TA XC-525"}), 41962306a36Sopenharmony_ci }, 42062306a36Sopenharmony_ci { } 42162306a36Sopenharmony_ci}; 42262306a36Sopenharmony_ci 42362306a36Sopenharmony_ciMODULE_DEVICE_TABLE(usb, hfcsusb_idtab); 42462306a36Sopenharmony_ci 42562306a36Sopenharmony_ci#endif /* __HFCSUSB_H__ */ 426