Lines Matching refs:ndev

30 static void nci_core_reset_ntf_packet(struct nci_dev *ndev,  in nci_core_reset_ntf_packet()  argument
36 ndev->nci_ver = ntf->nci_ver; in nci_core_reset_ntf_packet()
40 ndev->manufact_id = ntf->manufact_id; in nci_core_reset_ntf_packet()
41 ndev->manufact_specific_info = in nci_core_reset_ntf_packet()
44 nci_req_complete(ndev, NCI_STATUS_OK); in nci_core_reset_ntf_packet()
47 static void nci_core_conn_credits_ntf_packet(struct nci_dev *ndev, in nci_core_conn_credits_ntf_packet() argument
68 conn_info = nci_get_conn_info_by_conn_id(ndev, in nci_core_conn_credits_ntf_packet()
78 if (!skb_queue_empty(&ndev->tx_q)) in nci_core_conn_credits_ntf_packet()
79 queue_work(ndev->tx_wq, &ndev->tx_work); in nci_core_conn_credits_ntf_packet()
82 static void nci_core_generic_error_ntf_packet(struct nci_dev *ndev, in nci_core_generic_error_ntf_packet() argument
89 if (atomic_read(&ndev->state) == NCI_W4_HOST_SELECT) { in nci_core_generic_error_ntf_packet()
92 nci_req_complete(ndev, status); in nci_core_generic_error_ntf_packet()
96 static void nci_core_conn_intf_error_ntf_packet(struct nci_dev *ndev, in nci_core_conn_intf_error_ntf_packet() argument
106 if (test_bit(NCI_DATA_EXCHANGE, &ndev->flags)) in nci_core_conn_intf_error_ntf_packet()
107 nci_data_exchange_complete(ndev, NULL, ntf->conn_id, -EIO); in nci_core_conn_intf_error_ntf_packet()
111 nci_extract_rf_params_nfca_passive_poll(struct nci_dev *ndev, in nci_extract_rf_params_nfca_passive_poll() argument
139 nci_extract_rf_params_nfcb_passive_poll(struct nci_dev *ndev, in nci_extract_rf_params_nfcb_passive_poll() argument
154 nci_extract_rf_params_nfcf_passive_poll(struct nci_dev *ndev, in nci_extract_rf_params_nfcf_passive_poll() argument
171 nci_extract_rf_params_nfcv_passive_poll(struct nci_dev *ndev, in nci_extract_rf_params_nfcv_passive_poll() argument
183 nci_extract_rf_params_nfcf_passive_listen(struct nci_dev *ndev, in nci_extract_rf_params_nfcf_passive_listen() argument
195 static __u32 nci_get_prop_rf_protocol(struct nci_dev *ndev, __u8 rf_protocol) in nci_get_prop_rf_protocol() argument
197 if (ndev->ops->get_rfprotocol) in nci_get_prop_rf_protocol()
198 return ndev->ops->get_rfprotocol(ndev, rf_protocol); in nci_get_prop_rf_protocol()
202 static int nci_add_new_protocol(struct nci_dev *ndev, in nci_add_new_protocol() argument
230 protocol = nci_get_prop_rf_protocol(ndev, rf_protocol); in nci_add_new_protocol()
232 if (!(protocol & ndev->poll_prots)) { in nci_add_new_protocol()
281 static void nci_add_new_target(struct nci_dev *ndev, in nci_add_new_target() argument
287 for (i = 0; i < ndev->n_targets; i++) { in nci_add_new_target()
288 target = &ndev->targets[i]; in nci_add_new_target()
291 nci_add_new_protocol(ndev, target, ntf->rf_protocol, in nci_add_new_target()
299 if (ndev->n_targets == NCI_MAX_DISCOVERED_TARGETS) { in nci_add_new_target()
304 target = &ndev->targets[ndev->n_targets]; in nci_add_new_target()
306 rc = nci_add_new_protocol(ndev, target, ntf->rf_protocol, in nci_add_new_target()
311 ndev->n_targets++; in nci_add_new_target()
314 ndev->n_targets); in nci_add_new_target()
318 void nci_clear_target_list(struct nci_dev *ndev) in nci_clear_target_list() argument
320 memset(ndev->targets, 0, in nci_clear_target_list()
323 ndev->n_targets = 0; in nci_clear_target_list()
326 static void nci_rf_discover_ntf_packet(struct nci_dev *ndev, in nci_rf_discover_ntf_packet() argument
347 data = nci_extract_rf_params_nfca_passive_poll(ndev, in nci_rf_discover_ntf_packet()
352 data = nci_extract_rf_params_nfcb_passive_poll(ndev, in nci_rf_discover_ntf_packet()
357 data = nci_extract_rf_params_nfcf_passive_poll(ndev, in nci_rf_discover_ntf_packet()
362 data = nci_extract_rf_params_nfcv_passive_poll(ndev, in nci_rf_discover_ntf_packet()
378 nci_add_new_target(ndev, &ntf); in nci_rf_discover_ntf_packet()
381 atomic_set(&ndev->state, NCI_W4_ALL_DISCOVERIES); in nci_rf_discover_ntf_packet()
383 atomic_set(&ndev->state, NCI_W4_HOST_SELECT); in nci_rf_discover_ntf_packet()
384 nfc_targets_found(ndev->nfc_dev, ndev->targets, in nci_rf_discover_ntf_packet()
385 ndev->n_targets); in nci_rf_discover_ntf_packet()
389 static int nci_extract_activation_params_iso_dep(struct nci_dev *ndev, in nci_extract_activation_params_iso_dep() argument
426 static int nci_extract_activation_params_nfc_dep(struct nci_dev *ndev, in nci_extract_activation_params_nfc_dep() argument
463 static void nci_target_auto_activated(struct nci_dev *ndev, in nci_target_auto_activated() argument
469 target = &ndev->targets[ndev->n_targets]; in nci_target_auto_activated()
471 rc = nci_add_new_protocol(ndev, target, ntf->rf_protocol, in nci_target_auto_activated()
478 ndev->n_targets++; in nci_target_auto_activated()
481 target->logical_idx, ndev->n_targets); in nci_target_auto_activated()
483 nfc_targets_found(ndev->nfc_dev, ndev->targets, ndev->n_targets); in nci_target_auto_activated()
486 static int nci_store_general_bytes_nfc_dep(struct nci_dev *ndev, in nci_store_general_bytes_nfc_dep() argument
489 ndev->remote_gb_len = 0; in nci_store_general_bytes_nfc_dep()
497 ndev->remote_gb_len = min_t(__u8, in nci_store_general_bytes_nfc_dep()
501 memcpy(ndev->remote_gb, in nci_store_general_bytes_nfc_dep()
504 ndev->remote_gb_len); in nci_store_general_bytes_nfc_dep()
509 ndev->remote_gb_len = min_t(__u8, in nci_store_general_bytes_nfc_dep()
513 memcpy(ndev->remote_gb, in nci_store_general_bytes_nfc_dep()
516 ndev->remote_gb_len); in nci_store_general_bytes_nfc_dep()
528 static void nci_rf_intf_activated_ntf_packet(struct nci_dev *ndev, in nci_rf_intf_activated_ntf_packet() argument
566 data = nci_extract_rf_params_nfca_passive_poll(ndev, in nci_rf_intf_activated_ntf_packet()
571 data = nci_extract_rf_params_nfcb_passive_poll(ndev, in nci_rf_intf_activated_ntf_packet()
576 data = nci_extract_rf_params_nfcf_passive_poll(ndev, in nci_rf_intf_activated_ntf_packet()
581 data = nci_extract_rf_params_nfcv_passive_poll(ndev, in nci_rf_intf_activated_ntf_packet()
590 data = nci_extract_rf_params_nfcf_passive_listen(ndev, in nci_rf_intf_activated_ntf_packet()
617 err = nci_extract_activation_params_iso_dep(ndev, in nci_rf_intf_activated_ntf_packet()
622 err = nci_extract_activation_params_nfc_dep(ndev, in nci_rf_intf_activated_ntf_packet()
640 conn_info = ndev->rf_conn_info; in nci_rf_intf_activated_ntf_packet()
653 err = nci_store_general_bytes_nfc_dep(ndev, &ntf); in nci_rf_intf_activated_ntf_packet()
661 if (atomic_read(&ndev->state) == NCI_DISCOVERY) { in nci_rf_intf_activated_ntf_packet()
664 atomic_set(&ndev->state, NCI_POLL_ACTIVE); in nci_rf_intf_activated_ntf_packet()
666 nci_target_auto_activated(ndev, &ntf); in nci_rf_intf_activated_ntf_packet()
670 atomic_set(&ndev->state, NCI_POLL_ACTIVE); in nci_rf_intf_activated_ntf_packet()
671 nci_req_complete(ndev, err); in nci_rf_intf_activated_ntf_packet()
676 atomic_set(&ndev->state, NCI_LISTEN_ACTIVE); in nci_rf_intf_activated_ntf_packet()
679 err = nfc_tm_activated(ndev->nfc_dev, in nci_rf_intf_activated_ntf_packet()
682 ndev->remote_gb, in nci_rf_intf_activated_ntf_packet()
683 ndev->remote_gb_len); in nci_rf_intf_activated_ntf_packet()
690 static void nci_rf_deactivate_ntf_packet(struct nci_dev *ndev, in nci_rf_deactivate_ntf_packet() argument
698 conn_info = ndev->rf_conn_info; in nci_rf_deactivate_ntf_packet()
703 skb_queue_purge(&ndev->tx_q); in nci_rf_deactivate_ntf_packet()
706 if (ndev->rx_data_reassembly) { in nci_rf_deactivate_ntf_packet()
707 kfree_skb(ndev->rx_data_reassembly); in nci_rf_deactivate_ntf_packet()
708 ndev->rx_data_reassembly = NULL; in nci_rf_deactivate_ntf_packet()
712 if (test_bit(NCI_DATA_EXCHANGE, &ndev->flags)) in nci_rf_deactivate_ntf_packet()
713 nci_data_exchange_complete(ndev, NULL, NCI_STATIC_RF_CONN_ID, in nci_rf_deactivate_ntf_packet()
718 nci_clear_target_list(ndev); in nci_rf_deactivate_ntf_packet()
719 atomic_set(&ndev->state, NCI_IDLE); in nci_rf_deactivate_ntf_packet()
723 atomic_set(&ndev->state, NCI_W4_HOST_SELECT); in nci_rf_deactivate_ntf_packet()
726 nci_clear_target_list(ndev); in nci_rf_deactivate_ntf_packet()
727 atomic_set(&ndev->state, NCI_DISCOVERY); in nci_rf_deactivate_ntf_packet()
731 nci_req_complete(ndev, NCI_STATUS_OK); in nci_rf_deactivate_ntf_packet()
734 static void nci_nfcee_discover_ntf_packet(struct nci_dev *ndev, in nci_nfcee_discover_ntf_packet() argument
748 ndev->hci_dev->nfcee_id = nfcee_ntf->nfcee_id; in nci_nfcee_discover_ntf_packet()
749 ndev->cur_params.id = nfcee_ntf->nfcee_id; in nci_nfcee_discover_ntf_packet()
751 nci_req_complete(ndev, status); in nci_nfcee_discover_ntf_packet()
754 static void nci_nfcee_action_ntf_packet(struct nci_dev *ndev, in nci_nfcee_action_ntf_packet() argument
760 void nci_ntf_packet(struct nci_dev *ndev, struct sk_buff *skb) in nci_ntf_packet() argument
774 if (nci_prop_ntf_packet(ndev, ntf_opcode, skb) == -ENOTSUPP) { in nci_ntf_packet()
784 nci_core_reset_ntf_packet(ndev, skb); in nci_ntf_packet()
788 nci_core_conn_credits_ntf_packet(ndev, skb); in nci_ntf_packet()
792 nci_core_generic_error_ntf_packet(ndev, skb); in nci_ntf_packet()
796 nci_core_conn_intf_error_ntf_packet(ndev, skb); in nci_ntf_packet()
800 nci_rf_discover_ntf_packet(ndev, skb); in nci_ntf_packet()
804 nci_rf_intf_activated_ntf_packet(ndev, skb); in nci_ntf_packet()
808 nci_rf_deactivate_ntf_packet(ndev, skb); in nci_ntf_packet()
812 nci_nfcee_discover_ntf_packet(ndev, skb); in nci_ntf_packet()
816 nci_nfcee_action_ntf_packet(ndev, skb); in nci_ntf_packet()
824 nci_core_ntf_packet(ndev, ntf_opcode, skb); in nci_ntf_packet()