Lines Matching refs:stcontext

331 static int secondary_configuration_type4a(struct st95hf_context *stcontext)  in secondary_configuration_type4a()  argument
334 struct device *dev = &stcontext->nfcdev->dev; in secondary_configuration_type4a()
337 result = st95hf_send_recv_cmd(stcontext, in secondary_configuration_type4a()
348 result = st95hf_send_recv_cmd(stcontext, in secondary_configuration_type4a()
359 static int secondary_configuration_type4b(struct st95hf_context *stcontext) in secondary_configuration_type4b() argument
362 struct device *dev = &stcontext->nfcdev->dev; in secondary_configuration_type4b()
364 result = st95hf_send_recv_cmd(stcontext, in secondary_configuration_type4b()
375 static int st95hf_select_protocol(struct st95hf_context *stcontext, int type) in st95hf_select_protocol() argument
380 dev = &stcontext->nfcdev->dev; in st95hf_select_protocol()
384 stcontext->current_rf_tech = NFC_DIGITAL_RF_TECH_106A; in st95hf_select_protocol()
385 result = st95hf_send_recv_cmd(stcontext, in st95hf_select_protocol()
397 result = secondary_configuration_type4a(stcontext); in st95hf_select_protocol()
405 stcontext->current_rf_tech = NFC_DIGITAL_RF_TECH_106B; in st95hf_select_protocol()
406 result = st95hf_send_recv_cmd(stcontext, in st95hf_select_protocol()
424 result = secondary_configuration_type4b(stcontext); in st95hf_select_protocol()
432 stcontext->current_rf_tech = NFC_DIGITAL_RF_TECH_ISO15693; in st95hf_select_protocol()
433 result = st95hf_send_recv_cmd(stcontext, in st95hf_select_protocol()
603 static int st95hf_handle_wtx(struct st95hf_context *stcontext, in st95hf_handle_wtx() argument
610 struct nfc_digital_dev *nfcddev = stcontext->ddev; in st95hf_handle_wtx()
611 struct device *dev = &stcontext->nfcdev->dev; in st95hf_handle_wtx()
614 result = iso14443_config_fdt(stcontext, wtx_val & 0x3f); in st95hf_handle_wtx()
625 result = st95hf_send_recv_cmd(stcontext, in st95hf_handle_wtx()
641 result = iso14443_config_fdt(stcontext, val_mm); in st95hf_handle_wtx()
649 static int st95hf_error_handling(struct st95hf_context *stcontext, in st95hf_error_handling() argument
655 struct device *dev = &stcontext->nfcdev->dev; in st95hf_error_handling()
667 switch (stcontext->current_rf_tech) { in st95hf_error_handling()
669 if (stcontext->sendrcv_trflag == TRFLAG_NFCA_STD_FRAME_CRC) { in st95hf_error_handling()
694 static int st95hf_response_handler(struct st95hf_context *stcontext, in st95hf_response_handler() argument
701 struct nfc_digital_dev *nfcddev = stcontext->ddev; in st95hf_response_handler()
702 struct device *dev = &stcontext->nfcdev->dev; in st95hf_response_handler()
705 cb_arg = &stcontext->complete_cb_arg; in st95hf_response_handler()
719 stcontext->fwi = in st95hf_response_handler()
722 stcontext->fwi = in st95hf_response_handler()
727 result = iso14443_config_fdt(stcontext, val_mm); in st95hf_response_handler()
737 switch (stcontext->current_rf_tech) { in st95hf_response_handler()
739 if (stcontext->sendrcv_trflag == TRFLAG_NFCA_STD_FRAME_CRC) in st95hf_response_handler()
755 struct st95hf_context *stcontext = in st95hf_irq_handler() local
758 if (stcontext->spicontext.req_issync) { in st95hf_irq_handler()
759 complete(&stcontext->spicontext.done); in st95hf_irq_handler()
760 stcontext->spicontext.req_issync = false; in st95hf_irq_handler()
774 struct st95hf_context *stcontext = in st95hf_irq_thread_handler() local
778 spidevice = &stcontext->spicontext.spidev->dev; in st95hf_irq_thread_handler()
793 if (!down_trylock(&stcontext->exchange_lock)) { in st95hf_irq_thread_handler()
794 up(&stcontext->exchange_lock); in st95hf_irq_thread_handler()
799 cb_arg = &stcontext->complete_cb_arg; in st95hf_irq_thread_handler()
802 mutex_lock(&stcontext->rm_lock); in st95hf_irq_thread_handler()
803 res_len = st95hf_spi_recv_response(&stcontext->spicontext, in st95hf_irq_thread_handler()
812 if (stcontext->nfcdev_free) { in st95hf_irq_thread_handler()
819 result = st95hf_handle_wtx(stcontext, true, skb_resp->data[3]); in st95hf_irq_thread_handler()
824 mutex_unlock(&stcontext->rm_lock); in st95hf_irq_thread_handler()
828 result = st95hf_error_handling(stcontext, skb_resp, res_len); in st95hf_irq_thread_handler()
832 result = st95hf_response_handler(stcontext, skb_resp, res_len); in st95hf_irq_thread_handler()
842 result = st95hf_handle_wtx(stcontext, false, 0); in st95hf_irq_thread_handler()
848 cb_arg->complete_cb(stcontext->ddev, cb_arg->cb_usrarg, skb_resp); in st95hf_irq_thread_handler()
851 up(&stcontext->exchange_lock); in st95hf_irq_thread_handler()
852 mutex_unlock(&stcontext->rm_lock); in st95hf_irq_thread_handler()
862 cb_arg->complete_cb(stcontext->ddev, cb_arg->cb_usrarg, skb_resp); in st95hf_irq_thread_handler()
864 up(&stcontext->exchange_lock); in st95hf_irq_thread_handler()
865 mutex_unlock(&stcontext->rm_lock); in st95hf_irq_thread_handler()
874 struct st95hf_context *stcontext = nfc_digital_get_drvdata(ddev); in st95hf_in_configure_hw() local
877 return st95hf_select_protocol(stcontext, param); in st95hf_in_configure_hw()
882 stcontext->sendrcv_trflag = TRFLAG_NFCA_SHORT_FRAME; in st95hf_in_configure_hw()
885 stcontext->sendrcv_trflag = TRFLAG_NFCA_STD_FRAME; in st95hf_in_configure_hw()
890 stcontext->sendrcv_trflag = TRFLAG_NFCA_STD_FRAME_CRC; in st95hf_in_configure_hw()
902 static int rf_off(struct st95hf_context *stcontext) in rf_off() argument
907 dev = &stcontext->nfcdev->dev; in rf_off()
909 rc = st95hf_send_recv_cmd(stcontext, CMD_FIELD_OFF, 0, NULL, true); in rf_off()
922 struct st95hf_context *stcontext = nfc_digital_get_drvdata(ddev); in st95hf_in_send_cmd() local
931 switch (stcontext->current_rf_tech) { in st95hf_in_send_cmd()
934 skb_put_u8(skb, stcontext->sendrcv_trflag); in st95hf_in_send_cmd()
950 stcontext->complete_cb_arg.skb_resp = skb_resp; in st95hf_in_send_cmd()
951 stcontext->complete_cb_arg.cb_usrarg = arg; in st95hf_in_send_cmd()
952 stcontext->complete_cb_arg.complete_cb = cb; in st95hf_in_send_cmd()
956 stcontext->complete_cb_arg.rats = true; in st95hf_in_send_cmd()
963 rc = down_killable(&stcontext->exchange_lock); in st95hf_in_send_cmd()
969 rc = st95hf_spi_send(&stcontext->spicontext, skb->data, in st95hf_in_send_cmd()
973 dev_err(&stcontext->nfcdev->dev, in st95hf_in_send_cmd()
976 up(&stcontext->exchange_lock); in st95hf_in_send_cmd()
1022 struct st95hf_context *stcontext = nfc_digital_get_drvdata(ddev); in st95hf_switch_rf() local
1028 return st95hf_select_protocol(stcontext, rf_tech); in st95hf_switch_rf()
1031 return rf_off(stcontext); in st95hf_switch_rf()
1207 struct st95hf_context *stcontext = container_of(spictx, in st95hf_remove() local
1211 mutex_lock(&stcontext->rm_lock); in st95hf_remove()
1213 nfc_digital_unregister_device(stcontext->ddev); in st95hf_remove()
1214 nfc_digital_free_device(stcontext->ddev); in st95hf_remove()
1215 stcontext->nfcdev_free = true; in st95hf_remove()
1217 mutex_unlock(&stcontext->rm_lock); in st95hf_remove()
1220 result = down_killable(&stcontext->exchange_lock); in st95hf_remove()
1225 result = st95hf_spi_send(&stcontext->spicontext, in st95hf_remove()
1237 if (stcontext->st95hf_supply) in st95hf_remove()
1238 regulator_disable(stcontext->st95hf_supply); in st95hf_remove()