aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/nfc/pn544_hci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/nfc/pn544_hci.c')
-rw-r--r--drivers/nfc/pn544_hci.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/drivers/nfc/pn544_hci.c b/drivers/nfc/pn544_hci.c
index 6d564bd8b3b4..4ed2b8356017 100644
--- a/drivers/nfc/pn544_hci.c
+++ b/drivers/nfc/pn544_hci.c
@@ -746,6 +746,43 @@ static int pn544_hci_start_poll(struct nfc_hci_dev *hdev,
746 return r; 746 return r;
747} 747}
748 748
749static int pn544_hci_dep_link_up(struct nfc_hci_dev *hdev,
750 struct nfc_target *target, u8 comm_mode,
751 u8 *gb, size_t gb_len)
752{
753 struct sk_buff *rgb_skb = NULL;
754 int r;
755
756 r = nfc_hci_get_param(hdev, target->hci_reader_gate,
757 PN544_DEP_ATR_RES, &rgb_skb);
758 if (r < 0)
759 return r;
760
761 if (rgb_skb->len == 0 || rgb_skb->len > NFC_GB_MAXSIZE) {
762 r = -EPROTO;
763 goto exit;
764 }
765 print_hex_dump(KERN_DEBUG, "remote gb: ", DUMP_PREFIX_OFFSET,
766 16, 1, rgb_skb->data, rgb_skb->len, true);
767
768 r = nfc_set_remote_general_bytes(hdev->ndev, rgb_skb->data,
769 rgb_skb->len);
770
771 if (r == 0)
772 r = nfc_dep_link_is_up(hdev->ndev, target->idx, comm_mode,
773 NFC_RF_INITIATOR);
774exit:
775 kfree_skb(rgb_skb);
776 return r;
777}
778
779static int pn544_hci_dep_link_down(struct nfc_hci_dev *hdev)
780{
781
782 return nfc_hci_send_event(hdev, PN544_RF_READER_NFCIP1_INITIATOR_GATE,
783 NFC_HCI_EVT_END_OPERATION, NULL, 0);
784}
785
749static int pn544_hci_target_from_gate(struct nfc_hci_dev *hdev, u8 gate, 786static int pn544_hci_target_from_gate(struct nfc_hci_dev *hdev, u8 gate,
750 struct nfc_target *target) 787 struct nfc_target *target)
751{ 788{
@@ -973,6 +1010,8 @@ static struct nfc_hci_ops pn544_hci_ops = {
973 .hci_ready = pn544_hci_ready, 1010 .hci_ready = pn544_hci_ready,
974 .xmit = pn544_hci_xmit, 1011 .xmit = pn544_hci_xmit,
975 .start_poll = pn544_hci_start_poll, 1012 .start_poll = pn544_hci_start_poll,
1013 .dep_link_up = pn544_hci_dep_link_up,
1014 .dep_link_down = pn544_hci_dep_link_down,
976 .target_from_gate = pn544_hci_target_from_gate, 1015 .target_from_gate = pn544_hci_target_from_gate,
977 .complete_target_discovered = pn544_hci_complete_target_discovered, 1016 .complete_target_discovered = pn544_hci_complete_target_discovered,
978 .data_exchange = pn544_hci_data_exchange, 1017 .data_exchange = pn544_hci_data_exchange,