Lines Matching full:ndev
30 static void nci_core_conn_credits_ntf_packet(struct nci_dev *ndev, in nci_core_conn_credits_ntf_packet() argument
51 conn_info = nci_get_conn_info_by_conn_id(ndev, in nci_core_conn_credits_ntf_packet()
61 if (!skb_queue_empty(&ndev->tx_q)) in nci_core_conn_credits_ntf_packet()
62 queue_work(ndev->tx_wq, &ndev->tx_work); in nci_core_conn_credits_ntf_packet()
65 static void nci_core_generic_error_ntf_packet(struct nci_dev *ndev, in nci_core_generic_error_ntf_packet() argument
72 if (atomic_read(&ndev->state) == NCI_W4_HOST_SELECT) { in nci_core_generic_error_ntf_packet()
75 nci_req_complete(ndev, status); in nci_core_generic_error_ntf_packet()
79 static void nci_core_conn_intf_error_ntf_packet(struct nci_dev *ndev, in nci_core_conn_intf_error_ntf_packet() argument
89 if (test_bit(NCI_DATA_EXCHANGE, &ndev->flags)) in nci_core_conn_intf_error_ntf_packet()
90 nci_data_exchange_complete(ndev, NULL, ntf->conn_id, -EIO); in nci_core_conn_intf_error_ntf_packet()
93 static __u8 *nci_extract_rf_params_nfca_passive_poll(struct nci_dev *ndev, in nci_extract_rf_params_nfca_passive_poll() argument
120 static __u8 *nci_extract_rf_params_nfcb_passive_poll(struct nci_dev *ndev, in nci_extract_rf_params_nfcb_passive_poll() argument
134 static __u8 *nci_extract_rf_params_nfcf_passive_poll(struct nci_dev *ndev, in nci_extract_rf_params_nfcf_passive_poll() argument
150 static __u8 *nci_extract_rf_params_nfcv_passive_poll(struct nci_dev *ndev, in nci_extract_rf_params_nfcv_passive_poll() argument
161 static __u8 *nci_extract_rf_params_nfcf_passive_listen(struct nci_dev *ndev, in nci_extract_rf_params_nfcf_passive_listen() argument
173 static __u32 nci_get_prop_rf_protocol(struct nci_dev *ndev, __u8 rf_protocol) in nci_get_prop_rf_protocol() argument
175 if (ndev->ops->get_rfprotocol) in nci_get_prop_rf_protocol()
176 return ndev->ops->get_rfprotocol(ndev, rf_protocol); in nci_get_prop_rf_protocol()
180 static int nci_add_new_protocol(struct nci_dev *ndev, in nci_add_new_protocol() argument
208 protocol = nci_get_prop_rf_protocol(ndev, rf_protocol); in nci_add_new_protocol()
210 if (!(protocol & ndev->poll_prots)) { in nci_add_new_protocol()
259 static void nci_add_new_target(struct nci_dev *ndev, in nci_add_new_target() argument
265 for (i = 0; i < ndev->n_targets; i++) { in nci_add_new_target()
266 target = &ndev->targets[i]; in nci_add_new_target()
269 nci_add_new_protocol(ndev, target, ntf->rf_protocol, in nci_add_new_target()
277 if (ndev->n_targets == NCI_MAX_DISCOVERED_TARGETS) { in nci_add_new_target()
282 target = &ndev->targets[ndev->n_targets]; in nci_add_new_target()
284 rc = nci_add_new_protocol(ndev, target, ntf->rf_protocol, in nci_add_new_target()
289 ndev->n_targets++; in nci_add_new_target()
292 ndev->n_targets); in nci_add_new_target()
296 void nci_clear_target_list(struct nci_dev *ndev) in nci_clear_target_list() argument
298 memset(ndev->targets, 0, in nci_clear_target_list()
301 ndev->n_targets = 0; in nci_clear_target_list()
304 static void nci_rf_discover_ntf_packet(struct nci_dev *ndev, in nci_rf_discover_ntf_packet() argument
325 data = nci_extract_rf_params_nfca_passive_poll(ndev, in nci_rf_discover_ntf_packet()
330 data = nci_extract_rf_params_nfcb_passive_poll(ndev, in nci_rf_discover_ntf_packet()
335 data = nci_extract_rf_params_nfcf_passive_poll(ndev, in nci_rf_discover_ntf_packet()
340 data = nci_extract_rf_params_nfcv_passive_poll(ndev, in nci_rf_discover_ntf_packet()
356 nci_add_new_target(ndev, &ntf); in nci_rf_discover_ntf_packet()
359 atomic_set(&ndev->state, NCI_W4_ALL_DISCOVERIES); in nci_rf_discover_ntf_packet()
361 atomic_set(&ndev->state, NCI_W4_HOST_SELECT); in nci_rf_discover_ntf_packet()
362 nfc_targets_found(ndev->nfc_dev, ndev->targets, in nci_rf_discover_ntf_packet()
363 ndev->n_targets); in nci_rf_discover_ntf_packet()
367 static int nci_extract_activation_params_iso_dep(struct nci_dev *ndev, in nci_extract_activation_params_iso_dep() argument
403 static int nci_extract_activation_params_nfc_dep(struct nci_dev *ndev, in nci_extract_activation_params_nfc_dep() argument
439 static void nci_target_auto_activated(struct nci_dev *ndev, in nci_target_auto_activated() argument
445 target = &ndev->targets[ndev->n_targets]; in nci_target_auto_activated()
447 rc = nci_add_new_protocol(ndev, target, ntf->rf_protocol, in nci_target_auto_activated()
454 ndev->n_targets++; in nci_target_auto_activated()
457 target->logical_idx, ndev->n_targets); in nci_target_auto_activated()
459 nfc_targets_found(ndev->nfc_dev, ndev->targets, ndev->n_targets); in nci_target_auto_activated()
462 static int nci_store_general_bytes_nfc_dep(struct nci_dev *ndev, in nci_store_general_bytes_nfc_dep() argument
465 ndev->remote_gb_len = 0; in nci_store_general_bytes_nfc_dep()
473 ndev->remote_gb_len = min_t(__u8, in nci_store_general_bytes_nfc_dep()
477 memcpy(ndev->remote_gb, in nci_store_general_bytes_nfc_dep()
480 ndev->remote_gb_len); in nci_store_general_bytes_nfc_dep()
485 ndev->remote_gb_len = min_t(__u8, in nci_store_general_bytes_nfc_dep()
489 memcpy(ndev->remote_gb, in nci_store_general_bytes_nfc_dep()
492 ndev->remote_gb_len); in nci_store_general_bytes_nfc_dep()
504 static void nci_rf_intf_activated_ntf_packet(struct nci_dev *ndev, in nci_rf_intf_activated_ntf_packet() argument
542 data = nci_extract_rf_params_nfca_passive_poll(ndev, in nci_rf_intf_activated_ntf_packet()
547 data = nci_extract_rf_params_nfcb_passive_poll(ndev, in nci_rf_intf_activated_ntf_packet()
552 data = nci_extract_rf_params_nfcf_passive_poll(ndev, in nci_rf_intf_activated_ntf_packet()
557 data = nci_extract_rf_params_nfcv_passive_poll(ndev, in nci_rf_intf_activated_ntf_packet()
566 data = nci_extract_rf_params_nfcf_passive_listen(ndev, in nci_rf_intf_activated_ntf_packet()
593 err = nci_extract_activation_params_iso_dep(ndev, in nci_rf_intf_activated_ntf_packet()
598 err = nci_extract_activation_params_nfc_dep(ndev, in nci_rf_intf_activated_ntf_packet()
616 conn_info = ndev->rf_conn_info; in nci_rf_intf_activated_ntf_packet()
629 err = nci_store_general_bytes_nfc_dep(ndev, &ntf); in nci_rf_intf_activated_ntf_packet()
637 if (atomic_read(&ndev->state) == NCI_DISCOVERY) { in nci_rf_intf_activated_ntf_packet()
640 atomic_set(&ndev->state, NCI_POLL_ACTIVE); in nci_rf_intf_activated_ntf_packet()
642 nci_target_auto_activated(ndev, &ntf); in nci_rf_intf_activated_ntf_packet()
643 } else { /* ndev->state == NCI_W4_HOST_SELECT */ in nci_rf_intf_activated_ntf_packet()
646 atomic_set(&ndev->state, NCI_POLL_ACTIVE); in nci_rf_intf_activated_ntf_packet()
647 nci_req_complete(ndev, err); in nci_rf_intf_activated_ntf_packet()
652 atomic_set(&ndev->state, NCI_LISTEN_ACTIVE); in nci_rf_intf_activated_ntf_packet()
655 err = nfc_tm_activated(ndev->nfc_dev, in nci_rf_intf_activated_ntf_packet()
658 ndev->remote_gb, in nci_rf_intf_activated_ntf_packet()
659 ndev->remote_gb_len); in nci_rf_intf_activated_ntf_packet()
666 static void nci_rf_deactivate_ntf_packet(struct nci_dev *ndev, in nci_rf_deactivate_ntf_packet() argument
674 conn_info = ndev->rf_conn_info; in nci_rf_deactivate_ntf_packet()
679 skb_queue_purge(&ndev->tx_q); in nci_rf_deactivate_ntf_packet()
682 if (ndev->rx_data_reassembly) { in nci_rf_deactivate_ntf_packet()
683 kfree_skb(ndev->rx_data_reassembly); in nci_rf_deactivate_ntf_packet()
684 ndev->rx_data_reassembly = NULL; in nci_rf_deactivate_ntf_packet()
688 if (test_bit(NCI_DATA_EXCHANGE, &ndev->flags)) in nci_rf_deactivate_ntf_packet()
689 nci_data_exchange_complete(ndev, NULL, NCI_STATIC_RF_CONN_ID, in nci_rf_deactivate_ntf_packet()
694 nci_clear_target_list(ndev); in nci_rf_deactivate_ntf_packet()
695 atomic_set(&ndev->state, NCI_IDLE); in nci_rf_deactivate_ntf_packet()
699 atomic_set(&ndev->state, NCI_W4_HOST_SELECT); in nci_rf_deactivate_ntf_packet()
702 nci_clear_target_list(ndev); in nci_rf_deactivate_ntf_packet()
703 atomic_set(&ndev->state, NCI_DISCOVERY); in nci_rf_deactivate_ntf_packet()
707 nci_req_complete(ndev, NCI_STATUS_OK); in nci_rf_deactivate_ntf_packet()
710 static void nci_nfcee_discover_ntf_packet(struct nci_dev *ndev, in nci_nfcee_discover_ntf_packet() argument
724 ndev->hci_dev->nfcee_id = nfcee_ntf->nfcee_id; in nci_nfcee_discover_ntf_packet()
725 ndev->cur_params.id = nfcee_ntf->nfcee_id; in nci_nfcee_discover_ntf_packet()
727 nci_req_complete(ndev, status); in nci_nfcee_discover_ntf_packet()
730 static void nci_nfcee_action_ntf_packet(struct nci_dev *ndev, in nci_nfcee_action_ntf_packet() argument
736 void nci_ntf_packet(struct nci_dev *ndev, struct sk_buff *skb) in nci_ntf_packet() argument
750 if (nci_prop_ntf_packet(ndev, ntf_opcode, skb) == -ENOTSUPP) { in nci_ntf_packet()
760 nci_core_conn_credits_ntf_packet(ndev, skb); in nci_ntf_packet()
764 nci_core_generic_error_ntf_packet(ndev, skb); in nci_ntf_packet()
768 nci_core_conn_intf_error_ntf_packet(ndev, skb); in nci_ntf_packet()
772 nci_rf_discover_ntf_packet(ndev, skb); in nci_ntf_packet()
776 nci_rf_intf_activated_ntf_packet(ndev, skb); in nci_ntf_packet()
780 nci_rf_deactivate_ntf_packet(ndev, skb); in nci_ntf_packet()
784 nci_nfcee_discover_ntf_packet(ndev, skb); in nci_ntf_packet()
788 nci_nfcee_action_ntf_packet(ndev, skb); in nci_ntf_packet()
796 nci_core_ntf_packet(ndev, ntf_opcode, skb); in nci_ntf_packet()