Lines Matching refs:hfc
151 struct hfcusb_data *hfc; /* pointer to main structure */ member
223 ctrl_start_transfer(hfcusb_data *hfc) in ctrl_start_transfer() argument
225 if (hfc->ctrl_cnt) { in ctrl_start_transfer()
226 hfc->ctrl_urb->pipe = hfc->ctrl_out_pipe; in ctrl_start_transfer()
227 hfc->ctrl_urb->setup_packet = (u_char *)&hfc->ctrl_write; in ctrl_start_transfer()
228 hfc->ctrl_urb->transfer_buffer = NULL; in ctrl_start_transfer()
229 hfc->ctrl_urb->transfer_buffer_length = 0; in ctrl_start_transfer()
230 hfc->ctrl_write.wIndex = in ctrl_start_transfer()
231 cpu_to_le16(hfc->ctrl_buff[hfc->ctrl_out_idx].hfc_reg); in ctrl_start_transfer()
232 hfc->ctrl_write.wValue = in ctrl_start_transfer()
233 cpu_to_le16(hfc->ctrl_buff[hfc->ctrl_out_idx].reg_val); in ctrl_start_transfer()
235 usb_submit_urb(hfc->ctrl_urb, GFP_ATOMIC); /* start transfer */ in ctrl_start_transfer()
240 queue_control_request(hfcusb_data *hfc, __u8 reg, __u8 val, int action) in queue_control_request() argument
244 if (hfc->ctrl_cnt >= HFC_CTRL_BUFSIZE) in queue_control_request()
246 buf = &hfc->ctrl_buff[hfc->ctrl_in_idx]; /* pointer to new index */ in queue_control_request()
250 if (++hfc->ctrl_in_idx >= HFC_CTRL_BUFSIZE) in queue_control_request()
251 hfc->ctrl_in_idx = 0; /* pointer wrap */ in queue_control_request()
252 if (++hfc->ctrl_cnt == 1) in queue_control_request()
253 ctrl_start_transfer(hfc); in queue_control_request()
260 hfcusb_data *hfc = (hfcusb_data *) urb->context; in ctrl_complete() local
262 urb->dev = hfc->dev; in ctrl_complete()
263 if (hfc->ctrl_cnt) { in ctrl_complete()
264 hfc->ctrl_cnt--; /* decrement actual count */ in ctrl_complete()
265 if (++hfc->ctrl_out_idx >= HFC_CTRL_BUFSIZE) in ctrl_complete()
266 hfc->ctrl_out_idx = 0; /* pointer wrap */ in ctrl_complete()
268 ctrl_start_transfer(hfc); /* start next transfer */ in ctrl_complete()
274 write_led(hfcusb_data *hfc, __u8 led_state) in write_led() argument
276 if (led_state != hfc->old_led_state) { in write_led()
277 hfc->old_led_state = led_state; in write_led()
278 queue_control_request(hfc, HFCUSB_P_DATA, led_state, 1); in write_led()
283 set_led_bit(hfcusb_data *hfc, signed short led_bits, int on) in set_led_bit() argument
287 hfc->led_state &= ~abs(led_bits); in set_led_bit()
289 hfc->led_state |= led_bits; in set_led_bit()
292 hfc->led_state |= abs(led_bits); in set_led_bit()
294 hfc->led_state &= ~led_bits; in set_led_bit()
300 handle_led(hfcusb_data *hfc, int event) in handle_led() argument
303 (hfcsusb_vdata *) hfcusb_idtab[hfc->vend_idx].driver_info; in handle_led()
311 set_led_bit(hfc, driver_info->led_bits[0], 1); in handle_led()
312 set_led_bit(hfc, driver_info->led_bits[1], 0); in handle_led()
313 set_led_bit(hfc, driver_info->led_bits[2], 0); in handle_led()
314 set_led_bit(hfc, driver_info->led_bits[3], 0); in handle_led()
317 set_led_bit(hfc, driver_info->led_bits[0], 0); in handle_led()
318 set_led_bit(hfc, driver_info->led_bits[1], 0); in handle_led()
319 set_led_bit(hfc, driver_info->led_bits[2], 0); in handle_led()
320 set_led_bit(hfc, driver_info->led_bits[3], 0); in handle_led()
323 set_led_bit(hfc, driver_info->led_bits[1], 1); in handle_led()
326 set_led_bit(hfc, driver_info->led_bits[1], 0); in handle_led()
329 set_led_bit(hfc, driver_info->led_bits[2], 1); in handle_led()
332 set_led_bit(hfc, driver_info->led_bits[2], 0); in handle_led()
335 set_led_bit(hfc, driver_info->led_bits[3], 1); in handle_led()
338 set_led_bit(hfc, driver_info->led_bits[3], 0); in handle_led()
341 write_led(hfc, hfc->led_state); in handle_led()
346 l1_timer_expire_t3(hfcusb_data *hfc) in l1_timer_expire_t3() argument
348 hfc->d_if.ifc.l1l2(&hfc->d_if.ifc, PH_DEACTIVATE | INDICATION, in l1_timer_expire_t3()
354 hfc->l1_activated = 0; in l1_timer_expire_t3()
355 handle_led(hfc, LED_S0_OFF); in l1_timer_expire_t3()
357 queue_control_request(hfc, HFCUSB_STATES, 0x10, 1); in l1_timer_expire_t3()
358 queue_control_request(hfc, HFCUSB_STATES, 3, 1); in l1_timer_expire_t3()
363 l1_timer_expire_t4(hfcusb_data *hfc) in l1_timer_expire_t4() argument
365 hfc->d_if.ifc.l1l2(&hfc->d_if.ifc, PH_DEACTIVATE | INDICATION, in l1_timer_expire_t4()
371 hfc->l1_activated = 0; in l1_timer_expire_t4()
372 handle_led(hfc, LED_S0_OFF); in l1_timer_expire_t4()
377 s0_state_handler(hfcusb_data *hfc, __u8 state) in s0_state_handler() argument
381 old_state = hfc->l1_state; in s0_state_handler()
389 if (timer_pending(&hfc->t3_timer)) in s0_state_handler()
390 del_timer(&hfc->t3_timer); in s0_state_handler()
394 if (timer_pending(&hfc->t4_timer)) in s0_state_handler()
395 del_timer(&hfc->t4_timer); in s0_state_handler()
399 if (state == 7 && !hfc->l1_activated) { in s0_state_handler()
400 hfc->d_if.ifc.l1l2(&hfc->d_if.ifc, in s0_state_handler()
403 hfc->l1_activated = 1; in s0_state_handler()
404 handle_led(hfc, LED_S0_ON); in s0_state_handler()
408 if (!timer_pending(&hfc->t4_timer)) { in s0_state_handler()
409 hfc->t4_timer.expires = in s0_state_handler()
411 add_timer(&hfc->t4_timer); in s0_state_handler()
414 hfc->d_if.ifc.l1l2(&hfc->d_if.ifc, in s0_state_handler()
419 hfc->l1_activated = 0; in s0_state_handler()
420 handle_led(hfc, LED_S0_OFF); in s0_state_handler()
423 hfc->l1_state = state; in s0_state_handler()
479 fifo->hfc->dev, fifo->pipe, in start_isoc_chain()
546 hfcusb_data *hfc = fifo->hfc; in tx_iso_complete() local
578 if (fifon < 4 && hfc->b_mode[fifon / 2] == L1_MODE_TRANS) in tx_iso_complete()
582 threshbit = (hfc->threshold_mask & (1 << fifon)); in tx_iso_complete()
591 fill_isoc_urb(urb, fifo->hfc->dev, fifo->pipe, in tx_iso_complete()
671 if (status && !hfc->disc_flag) { in tx_iso_complete()
684 hfcusb_data *hfc = fifo->hfc; in rx_iso_complete() local
718 if (iso_status && !hfc->disc_flag) in rx_iso_complete()
736 hfc->threshold_mask = buf[1]; in rx_iso_complete()
742 s0_state_handler(hfc, buf[0] >> 4); in rx_iso_complete()
759 fill_isoc_urb(urb, fifo->hfc->dev, fifo->pipe, in rx_iso_complete()
770 if (status && !hfc->disc_flag) { in rx_iso_complete()
783 hfcusb_data *hfc = fifo->hfc; in collect_rx_frame() local
788 if (fifon < 4 && hfc->b_mode[fifon / 2] == L1_MODE_TRANS) in collect_rx_frame()
856 hfcusb_data *hfc = fifo->hfc; in rx_int_complete() local
859 urb->dev = hfc->dev; /* security init */ in rx_int_complete()
888 hfc->threshold_mask = buf[1]; in rx_int_complete()
890 s0_state_handler(hfc, buf[0] >> 4); in rx_int_complete()
924 usb_fill_int_urb(fifo->urb, fifo->hfc->dev, fifo->pipe, in start_int_fifo()
939 setup_bchannel(hfcusb_data *hfc, int channel, int mode) in setup_bchannel() argument
943 if (hfc->disc_flag) { in setup_bchannel()
948 hfc->b_mode[channel] = mode; in setup_bchannel()
958 queue_control_request(hfc, HFCUSB_FIFO, idx_table[channel], 1); in setup_bchannel()
959 queue_control_request(hfc, HFCUSB_CON_HDLC, val, 1); in setup_bchannel()
961 queue_control_request(hfc, HFCUSB_INC_RES_F, 2, 1); in setup_bchannel()
963 queue_control_request(hfc, HFCUSB_FIFO, idx_table[channel] + 1, 1); in setup_bchannel()
964 queue_control_request(hfc, HFCUSB_CON_HDLC, val, 1); in setup_bchannel()
966 queue_control_request(hfc, HFCUSB_INC_RES_F, 2, 1); in setup_bchannel()
969 if (hfc->b_mode[0]) in setup_bchannel()
971 if (hfc->b_mode[1]) in setup_bchannel()
973 queue_control_request(hfc, HFCUSB_SCTRL, val, 1); in setup_bchannel()
976 if (hfc->b_mode[0]) in setup_bchannel()
978 if (hfc->b_mode[1]) in setup_bchannel()
980 queue_control_request(hfc, HFCUSB_SCTRL_R, val, 1); in setup_bchannel()
984 handle_led(hfc, LED_B2_OFF); in setup_bchannel()
986 handle_led(hfc, LED_B1_OFF); in setup_bchannel()
989 handle_led(hfc, LED_B2_ON); in setup_bchannel()
991 handle_led(hfc, LED_B1_ON); in setup_bchannel()
999 hfcusb_data *hfc = fifo->hfc; in hfc_usb_l2l1() local
1007 if (hfc->l1_state != 3 in hfc_usb_l2l1()
1008 && hfc->l1_state != 7) { in hfc_usb_l2l1()
1009 hfc->d_if.ifc.l1l2(&hfc->d_if.ifc, in hfc_usb_l2l1()
1016 if (hfc->l1_state == 7) { /* l1 already active */ in hfc_usb_l2l1()
1017 hfc->d_if.ifc.l1l2(&hfc-> in hfc_usb_l2l1()
1028 queue_control_request(hfc, in hfc_usb_l2l1()
1034 queue_control_request(hfc, in hfc_usb_l2l1()
1039 (&hfc->t3_timer)) { in hfc_usb_l2l1()
1040 hfc->t3_timer. in hfc_usb_l2l1()
1045 add_timer(&hfc-> in hfc_usb_l2l1()
1053 setup_bchannel(hfc, in hfc_usb_l2l1()
1069 setup_bchannel(hfc, in hfc_usb_l2l1()
1095 hfc_usb_init(hfcusb_data *hfc) in hfc_usb_init() argument
1103 if (read_usb(hfc, HFCUSB_CHIP_ID, &b) != 1) { in hfc_usb_init()
1113 usb_set_interface(hfc->dev, hfc->if_used, hfc->alt_used); in hfc_usb_init()
1116 write_usb(hfc, HFCUSB_CIRM, 8); in hfc_usb_init()
1118 write_usb(hfc, HFCUSB_CIRM, 0x10); in hfc_usb_init()
1121 write_usb(hfc, HFCUSB_USB_SIZE, in hfc_usb_init()
1122 (hfc->packet_size / 8) | ((hfc->packet_size / 8) << 4)); in hfc_usb_init()
1125 write_usb(hfc, HFCUSB_USB_SIZE_I, hfc->iso_packet_size); in hfc_usb_init()
1128 write_usb(hfc, HFCUSB_MST_MODE1, 0); /* set default values */ in hfc_usb_init()
1129 write_usb(hfc, HFCUSB_MST_MODE0, 1); /* enable master mode */ in hfc_usb_init()
1132 write_usb(hfc, HFCUSB_F_THRES, in hfc_usb_init()
1136 fifo = hfc->fifos; in hfc_usb_init()
1138 write_usb(hfc, HFCUSB_FIFO, i); /* select the desired fifo */ in hfc_usb_init()
1144 write_usb(hfc, HFCUSB_HDLC_PAR, in hfc_usb_init()
1147 write_usb(hfc, HFCUSB_CON_HDLC, in hfc_usb_init()
1149 write_usb(hfc, HFCUSB_INC_RES_F, 2); /* reset the fifo */ in hfc_usb_init()
1152 write_usb(hfc, HFCUSB_CLKDEL, 0x0f); /* clock delay value */ in hfc_usb_init()
1153 write_usb(hfc, HFCUSB_STATES, 3 | 0x10); /* set deactivated mode */ in hfc_usb_init()
1154 write_usb(hfc, HFCUSB_STATES, 3); /* enable state machine */ in hfc_usb_init()
1156 write_usb(hfc, HFCUSB_SCTRL_R, 0); /* disable both B receivers */ in hfc_usb_init()
1157 write_usb(hfc, HFCUSB_SCTRL, 0x40); /* disable B transmitters + capacitive mode */ in hfc_usb_init()
1160 hfc->b_mode[0] = L1_MODE_NULL; in hfc_usb_init()
1161 hfc->b_mode[1] = L1_MODE_NULL; in hfc_usb_init()
1163 hfc->l1_activated = 0; in hfc_usb_init()
1164 hfc->disc_flag = 0; in hfc_usb_init()
1165 hfc->led_state = 0; in hfc_usb_init()
1166 hfc->old_led_state = 0; in hfc_usb_init()
1169 init_timer(&hfc->t3_timer); in hfc_usb_init()
1170 hfc->t3_timer.data = (long) hfc; in hfc_usb_init()
1171 hfc->t3_timer.function = (void *) l1_timer_expire_t3; in hfc_usb_init()
1174 init_timer(&hfc->t4_timer); in hfc_usb_init()
1175 hfc->t4_timer.data = (long) hfc; in hfc_usb_init()
1176 hfc->t4_timer.function = (void *) l1_timer_expire_t4; in hfc_usb_init()
1179 hfc->ctrl_read.bRequestType = 0xc0; in hfc_usb_init()
1180 hfc->ctrl_read.bRequest = 1; in hfc_usb_init()
1181 hfc->ctrl_read.wLength = cpu_to_le16(1); in hfc_usb_init()
1182 hfc->ctrl_write.bRequestType = 0x40; in hfc_usb_init()
1183 hfc->ctrl_write.bRequest = 0; in hfc_usb_init()
1184 hfc->ctrl_write.wLength = 0; in hfc_usb_init()
1185 usb_fill_control_urb(hfc->ctrl_urb, in hfc_usb_init()
1186 hfc->dev, in hfc_usb_init()
1187 hfc->ctrl_out_pipe, in hfc_usb_init()
1188 (u_char *)&hfc->ctrl_write, in hfc_usb_init()
1189 NULL, 0, ctrl_complete, hfc); in hfc_usb_init()
1192 hfc->fifos[i].iso[0].purb = NULL; in hfc_usb_init()
1193 hfc->fifos[i].iso[1].purb = NULL; in hfc_usb_init()
1194 hfc->fifos[i].active = 0; in hfc_usb_init()
1197 hfc->d_if.owner = THIS_MODULE; in hfc_usb_init()
1198 hfc->d_if.ifc.priv = &hfc->fifos[HFCUSB_D_TX]; in hfc_usb_init()
1199 hfc->d_if.ifc.l2l1 = hfc_usb_l2l1; in hfc_usb_init()
1201 hfc->b_if[i].ifc.priv = &hfc->fifos[HFCUSB_B1_TX + i * 2]; in hfc_usb_init()
1202 hfc->b_if[i].ifc.l2l1 = hfc_usb_l2l1; in hfc_usb_init()
1203 p_b_if[i] = &hfc->b_if[i]; in hfc_usb_init()
1206 hfc->protocol = 2; in hfc_usb_init()
1207 i = hisax_register(&hfc->d_if, p_b_if, "hfc_usb", hfc->protocol); in hfc_usb_init()
1218 hfc->fifos[i].hif = &p_b_if[i / 2]->ifc; in hfc_usb_init()
1220 hfc->fifos[i].hif = &hfc->d_if.ifc; in hfc_usb_init()
1223 if (hfc->cfg_used == CNF_3INT3ISO || hfc->cfg_used == CNF_4INT3ISO) { in hfc_usb_init()
1224 start_int_fifo(hfc->fifos + HFCUSB_D_RX); in hfc_usb_init()
1225 if (hfc->fifos[HFCUSB_PCM_RX].pipe) in hfc_usb_init()
1226 start_int_fifo(hfc->fifos + HFCUSB_PCM_RX); in hfc_usb_init()
1227 start_int_fifo(hfc->fifos + HFCUSB_B1_RX); in hfc_usb_init()
1228 start_int_fifo(hfc->fifos + HFCUSB_B2_RX); in hfc_usb_init()
1231 if (hfc->cfg_used == CNF_3ISO3ISO || hfc->cfg_used == CNF_4ISO3ISO) { in hfc_usb_init()
1232 start_isoc_chain(hfc->fifos + HFCUSB_D_RX, ISOC_PACKETS_D, in hfc_usb_init()
1234 if (hfc->fifos[HFCUSB_PCM_RX].pipe) in hfc_usb_init()
1235 start_isoc_chain(hfc->fifos + HFCUSB_PCM_RX, in hfc_usb_init()
1238 start_isoc_chain(hfc->fifos + HFCUSB_B1_RX, ISOC_PACKETS_B, in hfc_usb_init()
1240 start_isoc_chain(hfc->fifos + HFCUSB_B2_RX, ISOC_PACKETS_B, in hfc_usb_init()
1244 start_isoc_chain(hfc->fifos + HFCUSB_D_TX, ISOC_PACKETS_D, in hfc_usb_init()
1246 start_isoc_chain(hfc->fifos + HFCUSB_B1_TX, ISOC_PACKETS_B, in hfc_usb_init()
1248 start_isoc_chain(hfc->fifos + HFCUSB_B2_TX, ISOC_PACKETS_B, in hfc_usb_init()
1251 handle_led(hfc, LED_POWER_ON); in hfc_usb_init()
1459 context->fifos[cidx].hfc = in hfc_usb_probe()