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()
348 hfcusb_data *hfc = from_timer(hfc, t, t3_timer); in l1_timer_expire_t3() local
349 hfc->d_if.ifc.l1l2(&hfc->d_if.ifc, PH_DEACTIVATE | INDICATION, in l1_timer_expire_t3()
355 hfc->l1_activated = 0; in l1_timer_expire_t3()
356 handle_led(hfc, LED_S0_OFF); in l1_timer_expire_t3()
358 queue_control_request(hfc, HFCUSB_STATES, 0x10, 1); in l1_timer_expire_t3()
359 queue_control_request(hfc, HFCUSB_STATES, 3, 1); in l1_timer_expire_t3()
366 hfcusb_data *hfc = from_timer(hfc, t, t4_timer); in l1_timer_expire_t4() local
367 hfc->d_if.ifc.l1l2(&hfc->d_if.ifc, PH_DEACTIVATE | INDICATION, in l1_timer_expire_t4()
373 hfc->l1_activated = 0; in l1_timer_expire_t4()
374 handle_led(hfc, LED_S0_OFF); in l1_timer_expire_t4()
379 s0_state_handler(hfcusb_data *hfc, __u8 state) in s0_state_handler() argument
383 old_state = hfc->l1_state; in s0_state_handler()
391 if (timer_pending(&hfc->t3_timer)) in s0_state_handler()
392 del_timer(&hfc->t3_timer); in s0_state_handler()
396 if (timer_pending(&hfc->t4_timer)) in s0_state_handler()
397 del_timer(&hfc->t4_timer); in s0_state_handler()
401 if (state == 7 && !hfc->l1_activated) { in s0_state_handler()
402 hfc->d_if.ifc.l1l2(&hfc->d_if.ifc, in s0_state_handler()
405 hfc->l1_activated = 1; in s0_state_handler()
406 handle_led(hfc, LED_S0_ON); in s0_state_handler()
410 if (!timer_pending(&hfc->t4_timer)) { in s0_state_handler()
411 hfc->t4_timer.expires = in s0_state_handler()
413 add_timer(&hfc->t4_timer); in s0_state_handler()
416 hfc->d_if.ifc.l1l2(&hfc->d_if.ifc, in s0_state_handler()
421 hfc->l1_activated = 0; in s0_state_handler()
422 handle_led(hfc, LED_S0_OFF); in s0_state_handler()
425 hfc->l1_state = state; in s0_state_handler()
477 fifo->hfc->dev, fifo->pipe, in start_isoc_chain()
544 hfcusb_data *hfc = fifo->hfc; in tx_iso_complete() local
576 if (fifon < 4 && hfc->b_mode[fifon / 2] == L1_MODE_TRANS) in tx_iso_complete()
580 threshbit = (hfc->threshold_mask & (1 << fifon)); in tx_iso_complete()
589 fill_isoc_urb(urb, fifo->hfc->dev, fifo->pipe, in tx_iso_complete()
669 if (status && !hfc->disc_flag) { in tx_iso_complete()
682 hfcusb_data *hfc = fifo->hfc; in rx_iso_complete() local
716 if (iso_status && !hfc->disc_flag) in rx_iso_complete()
734 hfc->threshold_mask = buf[1]; in rx_iso_complete()
740 s0_state_handler(hfc, buf[0] >> 4); in rx_iso_complete()
757 fill_isoc_urb(urb, fifo->hfc->dev, fifo->pipe, in rx_iso_complete()
768 if (status && !hfc->disc_flag) { in rx_iso_complete()
781 hfcusb_data *hfc = fifo->hfc; in collect_rx_frame() local
786 if (fifon < 4 && hfc->b_mode[fifon / 2] == L1_MODE_TRANS) in collect_rx_frame()
854 hfcusb_data *hfc = fifo->hfc; in rx_int_complete() local
857 urb->dev = hfc->dev; /* security init */ in rx_int_complete()
886 hfc->threshold_mask = buf[1]; in rx_int_complete()
888 s0_state_handler(hfc, buf[0] >> 4); in rx_int_complete()
922 usb_fill_int_urb(fifo->urb, fifo->hfc->dev, fifo->pipe, in start_int_fifo()
936 setup_bchannel(hfcusb_data *hfc, int channel, int mode) in setup_bchannel() argument
940 if (hfc->disc_flag) { in setup_bchannel()
945 hfc->b_mode[channel] = mode; in setup_bchannel()
955 queue_control_request(hfc, HFCUSB_FIFO, idx_table[channel], 1); in setup_bchannel()
956 queue_control_request(hfc, HFCUSB_CON_HDLC, val, 1); in setup_bchannel()
958 queue_control_request(hfc, HFCUSB_INC_RES_F, 2, 1); in setup_bchannel()
960 queue_control_request(hfc, HFCUSB_FIFO, idx_table[channel] + 1, 1); in setup_bchannel()
961 queue_control_request(hfc, HFCUSB_CON_HDLC, val, 1); in setup_bchannel()
963 queue_control_request(hfc, HFCUSB_INC_RES_F, 2, 1); in setup_bchannel()
966 if (hfc->b_mode[0]) in setup_bchannel()
968 if (hfc->b_mode[1]) in setup_bchannel()
970 queue_control_request(hfc, HFCUSB_SCTRL, val, 1); in setup_bchannel()
973 if (hfc->b_mode[0]) in setup_bchannel()
975 if (hfc->b_mode[1]) in setup_bchannel()
977 queue_control_request(hfc, HFCUSB_SCTRL_R, val, 1); in setup_bchannel()
981 handle_led(hfc, LED_B2_OFF); in setup_bchannel()
983 handle_led(hfc, LED_B1_OFF); in setup_bchannel()
986 handle_led(hfc, LED_B2_ON); in setup_bchannel()
988 handle_led(hfc, LED_B1_ON); in setup_bchannel()
996 hfcusb_data *hfc = fifo->hfc; in hfc_usb_l2l1() local
1004 if (hfc->l1_state != 3 in hfc_usb_l2l1()
1005 && hfc->l1_state != 7) { in hfc_usb_l2l1()
1006 hfc->d_if.ifc.l1l2(&hfc->d_if.ifc, in hfc_usb_l2l1()
1013 if (hfc->l1_state == 7) { /* l1 already active */ in hfc_usb_l2l1()
1014 hfc->d_if.ifc.l1l2(&hfc-> in hfc_usb_l2l1()
1025 queue_control_request(hfc, in hfc_usb_l2l1()
1031 queue_control_request(hfc, in hfc_usb_l2l1()
1036 (&hfc->t3_timer)) { in hfc_usb_l2l1()
1037 hfc->t3_timer. in hfc_usb_l2l1()
1042 add_timer(&hfc-> in hfc_usb_l2l1()
1050 setup_bchannel(hfc, in hfc_usb_l2l1()
1066 setup_bchannel(hfc, in hfc_usb_l2l1()
1092 hfc_usb_init(hfcusb_data *hfc) in hfc_usb_init() argument
1100 if (read_usb(hfc, HFCUSB_CHIP_ID, &b) != 1) { in hfc_usb_init()
1110 usb_set_interface(hfc->dev, hfc->if_used, hfc->alt_used); in hfc_usb_init()
1113 write_usb(hfc, HFCUSB_CIRM, 8); in hfc_usb_init()
1115 write_usb(hfc, HFCUSB_CIRM, 0x10); in hfc_usb_init()
1118 write_usb(hfc, HFCUSB_USB_SIZE, in hfc_usb_init()
1119 (hfc->packet_size / 8) | ((hfc->packet_size / 8) << 4)); in hfc_usb_init()
1122 write_usb(hfc, HFCUSB_USB_SIZE_I, hfc->iso_packet_size); in hfc_usb_init()
1125 write_usb(hfc, HFCUSB_MST_MODE1, 0); /* set default values */ in hfc_usb_init()
1126 write_usb(hfc, HFCUSB_MST_MODE0, 1); /* enable master mode */ in hfc_usb_init()
1129 write_usb(hfc, HFCUSB_F_THRES, in hfc_usb_init()
1133 fifo = hfc->fifos; in hfc_usb_init()
1135 write_usb(hfc, HFCUSB_FIFO, i); /* select the desired fifo */ in hfc_usb_init()
1141 write_usb(hfc, HFCUSB_HDLC_PAR, in hfc_usb_init()
1144 write_usb(hfc, HFCUSB_CON_HDLC, in hfc_usb_init()
1146 write_usb(hfc, HFCUSB_INC_RES_F, 2); /* reset the fifo */ in hfc_usb_init()
1149 write_usb(hfc, HFCUSB_CLKDEL, 0x0f); /* clock delay value */ in hfc_usb_init()
1150 write_usb(hfc, HFCUSB_STATES, 3 | 0x10); /* set deactivated mode */ in hfc_usb_init()
1151 write_usb(hfc, HFCUSB_STATES, 3); /* enable state machine */ in hfc_usb_init()
1153 write_usb(hfc, HFCUSB_SCTRL_R, 0); /* disable both B receivers */ in hfc_usb_init()
1154 write_usb(hfc, HFCUSB_SCTRL, 0x40); /* disable B transmitters + capacitive mode */ in hfc_usb_init()
1157 hfc->b_mode[0] = L1_MODE_NULL; in hfc_usb_init()
1158 hfc->b_mode[1] = L1_MODE_NULL; in hfc_usb_init()
1160 hfc->l1_activated = 0; in hfc_usb_init()
1161 hfc->disc_flag = 0; in hfc_usb_init()
1162 hfc->led_state = 0; in hfc_usb_init()
1163 hfc->old_led_state = 0; in hfc_usb_init()
1166 timer_setup(&hfc->t3_timer, l1_timer_expire_t3, 0); in hfc_usb_init()
1169 timer_setup(&hfc->t4_timer, l1_timer_expire_t4, 0); in hfc_usb_init()
1172 hfc->ctrl_read.bRequestType = 0xc0; in hfc_usb_init()
1173 hfc->ctrl_read.bRequest = 1; in hfc_usb_init()
1174 hfc->ctrl_read.wLength = cpu_to_le16(1); in hfc_usb_init()
1175 hfc->ctrl_write.bRequestType = 0x40; in hfc_usb_init()
1176 hfc->ctrl_write.bRequest = 0; in hfc_usb_init()
1177 hfc->ctrl_write.wLength = 0; in hfc_usb_init()
1178 usb_fill_control_urb(hfc->ctrl_urb, in hfc_usb_init()
1179 hfc->dev, in hfc_usb_init()
1180 hfc->ctrl_out_pipe, in hfc_usb_init()
1181 (u_char *)&hfc->ctrl_write, in hfc_usb_init()
1182 NULL, 0, ctrl_complete, hfc); in hfc_usb_init()
1185 hfc->fifos[i].iso[0].purb = NULL; in hfc_usb_init()
1186 hfc->fifos[i].iso[1].purb = NULL; in hfc_usb_init()
1187 hfc->fifos[i].active = 0; in hfc_usb_init()
1190 hfc->d_if.owner = THIS_MODULE; in hfc_usb_init()
1191 hfc->d_if.ifc.priv = &hfc->fifos[HFCUSB_D_TX]; in hfc_usb_init()
1192 hfc->d_if.ifc.l2l1 = hfc_usb_l2l1; in hfc_usb_init()
1194 hfc->b_if[i].ifc.priv = &hfc->fifos[HFCUSB_B1_TX + i * 2]; in hfc_usb_init()
1195 hfc->b_if[i].ifc.l2l1 = hfc_usb_l2l1; in hfc_usb_init()
1196 p_b_if[i] = &hfc->b_if[i]; in hfc_usb_init()
1199 hfc->protocol = 2; in hfc_usb_init()
1200 i = hisax_register(&hfc->d_if, p_b_if, "hfc_usb", hfc->protocol); in hfc_usb_init()
1211 hfc->fifos[i].hif = &p_b_if[i / 2]->ifc; in hfc_usb_init()
1213 hfc->fifos[i].hif = &hfc->d_if.ifc; in hfc_usb_init()
1216 if (hfc->cfg_used == CNF_3INT3ISO || hfc->cfg_used == CNF_4INT3ISO) { in hfc_usb_init()
1217 start_int_fifo(hfc->fifos + HFCUSB_D_RX); in hfc_usb_init()
1218 if (hfc->fifos[HFCUSB_PCM_RX].pipe) in hfc_usb_init()
1219 start_int_fifo(hfc->fifos + HFCUSB_PCM_RX); in hfc_usb_init()
1220 start_int_fifo(hfc->fifos + HFCUSB_B1_RX); in hfc_usb_init()
1221 start_int_fifo(hfc->fifos + HFCUSB_B2_RX); in hfc_usb_init()
1224 if (hfc->cfg_used == CNF_3ISO3ISO || hfc->cfg_used == CNF_4ISO3ISO) { in hfc_usb_init()
1225 start_isoc_chain(hfc->fifos + HFCUSB_D_RX, ISOC_PACKETS_D, in hfc_usb_init()
1227 if (hfc->fifos[HFCUSB_PCM_RX].pipe) in hfc_usb_init()
1228 start_isoc_chain(hfc->fifos + HFCUSB_PCM_RX, in hfc_usb_init()
1231 start_isoc_chain(hfc->fifos + HFCUSB_B1_RX, ISOC_PACKETS_B, in hfc_usb_init()
1233 start_isoc_chain(hfc->fifos + HFCUSB_B2_RX, ISOC_PACKETS_B, in hfc_usb_init()
1237 start_isoc_chain(hfc->fifos + HFCUSB_D_TX, ISOC_PACKETS_D, in hfc_usb_init()
1239 start_isoc_chain(hfc->fifos + HFCUSB_B1_TX, ISOC_PACKETS_B, in hfc_usb_init()
1241 start_isoc_chain(hfc->fifos + HFCUSB_B2_TX, ISOC_PACKETS_B, in hfc_usb_init()
1244 handle_led(hfc, LED_POWER_ON); in hfc_usb_init()
1452 context->fifos[cidx].hfc = in hfc_usb_probe()