Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

NFC: st21nfca: Implement stop_poll HCI hook

Send DM_DISCONNECT command to disconnect Terminal Host from the HCI network.

- The persistent states of the terminal host pipes, including registry values,
are not modifies. Therefore, there is no NVRAM update to disconnect the
terminal host.
- The terminal host RF card gates are disabled which means that there will be no event
related to card RF gates until communication has been restored.
- The terminal host RF reader request is reset so the RF reader polling for terminal
host is disabled.

To restore the communication, the terminal host can send any HCI command or event.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>

authored by

Christophe Ricard and committed by
Samuel Ortiz
d57d74eb 95f7687b

+8
+8
drivers/nfc/st21nfca/st21nfca.c
··· 53 53 #define ST21NFCA_DM_PIPE_CREATED 0x02 54 54 #define ST21NFCA_DM_PIPE_OPEN 0x04 55 55 #define ST21NFCA_DM_RF_ACTIVE 0x80 56 + #define ST21NFCA_DM_DISCONNECT 0x30 56 57 57 58 #define ST21NFCA_DM_IS_PIPE_OPEN(p) \ 58 59 ((p & 0x0f) == (ST21NFCA_DM_PIPE_CREATED | ST21NFCA_DM_PIPE_OPEN)) ··· 357 356 return r; 358 357 } 359 358 359 + static void st21nfca_hci_stop_poll(struct nfc_hci_dev *hdev) 360 + { 361 + nfc_hci_send_cmd(hdev, ST21NFCA_DEVICE_MGNT_GATE, 362 + ST21NFCA_DM_DISCONNECT, NULL, 0, NULL); 363 + } 364 + 360 365 static int st21nfca_get_iso14443_3_atqa(struct nfc_hci_dev *hdev, u16 *atqa) 361 366 { 362 367 int r; ··· 608 601 .hci_ready = st21nfca_hci_ready, 609 602 .xmit = st21nfca_hci_xmit, 610 603 .start_poll = st21nfca_hci_start_poll, 604 + .stop_poll = st21nfca_hci_stop_poll, 611 605 .target_from_gate = st21nfca_hci_target_from_gate, 612 606 .im_transceive = st21nfca_hci_im_transceive, 613 607 .check_presence = st21nfca_hci_check_presence,