Lines Matching refs:info
161 struct bluecard_info *info = from_timer(info, t, timer); in bluecard_activity_led_timeout() local
162 unsigned int iobase = info->p_dev->resource[0]->start; in bluecard_activity_led_timeout()
164 if (test_bit(CARD_ACTIVITY, &(info->hw_state))) { in bluecard_activity_led_timeout()
166 clear_bit(CARD_ACTIVITY, &(info->hw_state)); in bluecard_activity_led_timeout()
167 mod_timer(&(info->timer), jiffies + HZ / 10); in bluecard_activity_led_timeout()
175 static void bluecard_enable_activity_led(struct bluecard_info *info) in bluecard_enable_activity_led() argument
177 unsigned int iobase = info->p_dev->resource[0]->start; in bluecard_enable_activity_led()
180 if (timer_pending(&(info->timer))) in bluecard_enable_activity_led()
183 set_bit(CARD_ACTIVITY, &(info->hw_state)); in bluecard_enable_activity_led()
185 if (test_bit(CARD_HAS_ACTIVITY_LED, &(info->hw_state))) { in bluecard_enable_activity_led()
194 mod_timer(&(info->timer), jiffies + HZ / 10); in bluecard_enable_activity_led()
217 static void bluecard_write_wakeup(struct bluecard_info *info) in bluecard_write_wakeup() argument
219 if (!info) { in bluecard_write_wakeup()
224 if (!test_bit(XMIT_SENDING_READY, &(info->tx_state))) in bluecard_write_wakeup()
227 if (test_and_set_bit(XMIT_SENDING, &(info->tx_state))) { in bluecard_write_wakeup()
228 set_bit(XMIT_WAKEUP, &(info->tx_state)); in bluecard_write_wakeup()
233 unsigned int iobase = info->p_dev->resource[0]->start; in bluecard_write_wakeup()
240 clear_bit(XMIT_WAKEUP, &(info->tx_state)); in bluecard_write_wakeup()
242 if (!pcmcia_dev_present(info->p_dev)) in bluecard_write_wakeup()
245 if (test_bit(XMIT_BUFFER_NUMBER, &(info->tx_state))) { in bluecard_write_wakeup()
246 if (!test_bit(XMIT_BUF_TWO_READY, &(info->tx_state))) in bluecard_write_wakeup()
252 if (!test_bit(XMIT_BUF_ONE_READY, &(info->tx_state))) in bluecard_write_wakeup()
259 skb = skb_dequeue(&(info->txq)); in bluecard_write_wakeup()
265 info->ctrl_reg |= REG_CONTROL_RTS; in bluecard_write_wakeup()
266 outb(info->ctrl_reg, iobase + REG_CONTROL); in bluecard_write_wakeup()
270 bluecard_enable_activity_led(info); in bluecard_write_wakeup()
279 clear_bit(ready_bit, &(info->tx_state)); in bluecard_write_wakeup()
307 info->ctrl_reg &= ~0x03; in bluecard_write_wakeup()
308 info->ctrl_reg |= baud_reg; in bluecard_write_wakeup()
309 outb(info->ctrl_reg, iobase + REG_CONTROL); in bluecard_write_wakeup()
312 info->ctrl_reg &= ~REG_CONTROL_RTS; in bluecard_write_wakeup()
313 outb(info->ctrl_reg, iobase + REG_CONTROL); in bluecard_write_wakeup()
323 skb_queue_head(&(info->txq), skb); in bluecard_write_wakeup()
326 info->hdev->stat.byte_tx += len; in bluecard_write_wakeup()
329 change_bit(XMIT_BUFFER_NUMBER, &(info->tx_state)); in bluecard_write_wakeup()
331 } while (test_bit(XMIT_WAKEUP, &(info->tx_state))); in bluecard_write_wakeup()
333 clear_bit(XMIT_SENDING, &(info->tx_state)); in bluecard_write_wakeup()
365 static void bluecard_receive(struct bluecard_info *info, in bluecard_receive() argument
372 if (!info) { in bluecard_receive()
377 iobase = info->p_dev->resource[0]->start; in bluecard_receive()
379 if (test_bit(XMIT_SENDING_READY, &(info->tx_state))) in bluecard_receive()
380 bluecard_enable_activity_led(info); in bluecard_receive()
387 if (!info->rx_skb) { in bluecard_receive()
388 info->rx_state = RECV_WAIT_PACKET_TYPE; in bluecard_receive()
389 info->rx_count = 0; in bluecard_receive()
390 info->rx_skb = bt_skb_alloc(HCI_MAX_FRAME_SIZE, GFP_ATOMIC); in bluecard_receive()
391 if (!info->rx_skb) { in bluecard_receive()
397 if (info->rx_state == RECV_WAIT_PACKET_TYPE) { in bluecard_receive()
399 hci_skb_pkt_type(info->rx_skb) = buf[i]; in bluecard_receive()
401 switch (hci_skb_pkt_type(info->rx_skb)) { in bluecard_receive()
406 set_bit(XMIT_BUF_ONE_READY, &(info->tx_state)); in bluecard_receive()
407 set_bit(XMIT_BUF_TWO_READY, &(info->tx_state)); in bluecard_receive()
408 set_bit(XMIT_SENDING_READY, &(info->tx_state)); in bluecard_receive()
409 bluecard_write_wakeup(info); in bluecard_receive()
412 kfree_skb(info->rx_skb); in bluecard_receive()
413 info->rx_skb = NULL; in bluecard_receive()
417 info->rx_state = RECV_WAIT_EVENT_HEADER; in bluecard_receive()
418 info->rx_count = HCI_EVENT_HDR_SIZE; in bluecard_receive()
422 info->rx_state = RECV_WAIT_ACL_HEADER; in bluecard_receive()
423 info->rx_count = HCI_ACL_HDR_SIZE; in bluecard_receive()
427 info->rx_state = RECV_WAIT_SCO_HEADER; in bluecard_receive()
428 info->rx_count = HCI_SCO_HDR_SIZE; in bluecard_receive()
434 hci_skb_pkt_type(info->rx_skb)); in bluecard_receive()
435 info->hdev->stat.err_rx++; in bluecard_receive()
437 kfree_skb(info->rx_skb); in bluecard_receive()
438 info->rx_skb = NULL; in bluecard_receive()
445 skb_put_u8(info->rx_skb, buf[i]); in bluecard_receive()
446 info->rx_count--; in bluecard_receive()
448 if (info->rx_count == 0) { in bluecard_receive()
455 switch (info->rx_state) { in bluecard_receive()
458 eh = hci_event_hdr(info->rx_skb); in bluecard_receive()
459 info->rx_state = RECV_WAIT_DATA; in bluecard_receive()
460 info->rx_count = eh->plen; in bluecard_receive()
464 ah = hci_acl_hdr(info->rx_skb); in bluecard_receive()
466 info->rx_state = RECV_WAIT_DATA; in bluecard_receive()
467 info->rx_count = dlen; in bluecard_receive()
471 sh = hci_sco_hdr(info->rx_skb); in bluecard_receive()
472 info->rx_state = RECV_WAIT_DATA; in bluecard_receive()
473 info->rx_count = sh->dlen; in bluecard_receive()
477 hci_recv_frame(info->hdev, info->rx_skb); in bluecard_receive()
478 info->rx_skb = NULL; in bluecard_receive()
490 info->hdev->stat.byte_rx += len; in bluecard_receive()
496 struct bluecard_info *info = dev_inst; in bluecard_interrupt() local
500 if (!info || !info->hdev) in bluecard_interrupt()
504 if (!test_bit(CARD_READY, &(info->hw_state))) in bluecard_interrupt()
507 iobase = info->p_dev->resource[0]->start; in bluecard_interrupt()
509 spin_lock(&(info->lock)); in bluecard_interrupt()
512 info->ctrl_reg &= ~REG_CONTROL_INTERRUPT; in bluecard_interrupt()
513 outb(info->ctrl_reg, iobase + REG_CONTROL); in bluecard_interrupt()
520 bluecard_receive(info, 0x00); in bluecard_interrupt()
526 bluecard_receive(info, 0x10); in bluecard_interrupt()
532 set_bit(XMIT_BUF_ONE_READY, &(info->tx_state)); in bluecard_interrupt()
534 bluecard_write_wakeup(info); in bluecard_interrupt()
538 set_bit(XMIT_BUF_TWO_READY, &(info->tx_state)); in bluecard_interrupt()
540 bluecard_write_wakeup(info); in bluecard_interrupt()
546 info->ctrl_reg |= REG_CONTROL_INTERRUPT; in bluecard_interrupt()
547 outb(info->ctrl_reg, iobase + REG_CONTROL); in bluecard_interrupt()
549 spin_unlock(&(info->lock)); in bluecard_interrupt()
561 struct bluecard_info *info = hci_get_drvdata(hdev); in bluecard_hci_set_baud_rate() local
595 skb_queue_tail(&(info->txq), skb); in bluecard_hci_set_baud_rate()
597 bluecard_write_wakeup(info); in bluecard_hci_set_baud_rate()
609 struct bluecard_info *info = hci_get_drvdata(hdev); in bluecard_hci_flush() local
612 skb_queue_purge(&(info->txq)); in bluecard_hci_flush()
620 struct bluecard_info *info = hci_get_drvdata(hdev); in bluecard_hci_open() local
621 unsigned int iobase = info->p_dev->resource[0]->start; in bluecard_hci_open()
623 if (test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state))) in bluecard_hci_open()
635 struct bluecard_info *info = hci_get_drvdata(hdev); in bluecard_hci_close() local
636 unsigned int iobase = info->p_dev->resource[0]->start; in bluecard_hci_close()
641 del_timer_sync(&(info->timer)); in bluecard_hci_close()
652 struct bluecard_info *info = hci_get_drvdata(hdev); in bluecard_hci_send_frame() local
668 skb_queue_tail(&(info->txq), skb); in bluecard_hci_send_frame()
670 bluecard_write_wakeup(info); in bluecard_hci_send_frame()
680 static int bluecard_open(struct bluecard_info *info) in bluecard_open() argument
682 unsigned int iobase = info->p_dev->resource[0]->start; in bluecard_open()
686 spin_lock_init(&(info->lock)); in bluecard_open()
688 timer_setup(&info->timer, bluecard_activity_led_timeout, 0); in bluecard_open()
690 skb_queue_head_init(&(info->txq)); in bluecard_open()
692 info->rx_state = RECV_WAIT_PACKET_TYPE; in bluecard_open()
693 info->rx_count = 0; in bluecard_open()
694 info->rx_skb = NULL; in bluecard_open()
703 info->hdev = hdev; in bluecard_open()
706 hci_set_drvdata(hdev, info); in bluecard_open()
707 SET_HCIDEV_DEV(hdev, &info->p_dev->dev); in bluecard_open()
717 set_bit(CARD_HAS_PCCARD_ID, &(info->hw_state)); in bluecard_open()
720 set_bit(CARD_HAS_POWER_LED, &(info->hw_state)); in bluecard_open()
723 set_bit(CARD_HAS_ACTIVITY_LED, &(info->hw_state)); in bluecard_open()
726 info->ctrl_reg = REG_CONTROL_BT_RESET | REG_CONTROL_CARD_RESET; in bluecard_open()
727 outb(info->ctrl_reg, iobase + REG_CONTROL); in bluecard_open()
739 info->ctrl_reg = REG_CONTROL_BT_ON | REG_CONTROL_BT_RES_PU; in bluecard_open()
740 outb(info->ctrl_reg, iobase + REG_CONTROL); in bluecard_open()
744 info->ctrl_reg |= REG_CONTROL_INTERRUPT; in bluecard_open()
745 outb(info->ctrl_reg, iobase + REG_CONTROL); in bluecard_open()
749 info->ctrl_reg |= REG_CONTROL_RTS; in bluecard_open()
750 outb(info->ctrl_reg, iobase + REG_CONTROL); in bluecard_open()
753 info->ctrl_reg |= 0x03; in bluecard_open()
754 outb(info->ctrl_reg, iobase + REG_CONTROL); in bluecard_open()
757 info->ctrl_reg &= ~REG_CONTROL_RTS; in bluecard_open()
758 outb(info->ctrl_reg, iobase + REG_CONTROL); in bluecard_open()
760 set_bit(XMIT_BUF_ONE_READY, &(info->tx_state)); in bluecard_open()
761 set_bit(XMIT_BUF_TWO_READY, &(info->tx_state)); in bluecard_open()
762 set_bit(XMIT_SENDING_READY, &(info->tx_state)); in bluecard_open()
770 set_bit(CARD_READY, &(info->hw_state)); in bluecard_open()
773 skb_queue_purge(&(info->txq)); in bluecard_open()
784 info->hdev = NULL; in bluecard_open()
793 static int bluecard_close(struct bluecard_info *info) in bluecard_close() argument
795 unsigned int iobase = info->p_dev->resource[0]->start; in bluecard_close()
796 struct hci_dev *hdev = info->hdev; in bluecard_close()
803 clear_bit(CARD_READY, &(info->hw_state)); in bluecard_close()
806 info->ctrl_reg = REG_CONTROL_BT_RESET | REG_CONTROL_CARD_RESET; in bluecard_close()
807 outb(info->ctrl_reg, iobase + REG_CONTROL); in bluecard_close()
820 struct bluecard_info *info; in bluecard_probe() local
823 info = devm_kzalloc(&link->dev, sizeof(*info), GFP_KERNEL); in bluecard_probe()
824 if (!info) in bluecard_probe()
827 info->p_dev = link; in bluecard_probe()
828 link->priv = info; in bluecard_probe()
844 struct bluecard_info *info = link->priv; in bluecard_config() local
871 if (bluecard_open(info) != 0) in bluecard_config()
884 struct bluecard_info *info = link->priv; in bluecard_release() local
886 bluecard_close(info); in bluecard_release()
888 del_timer_sync(&(info->timer)); in bluecard_release()