Lines Matching refs:stcontext
332 static int secondary_configuration_type4a(struct st95hf_context *stcontext) in secondary_configuration_type4a() argument
335 struct device *dev = &stcontext->nfcdev->dev; in secondary_configuration_type4a()
338 result = st95hf_send_recv_cmd(stcontext, in secondary_configuration_type4a()
349 result = st95hf_send_recv_cmd(stcontext, in secondary_configuration_type4a()
360 static int secondary_configuration_type4b(struct st95hf_context *stcontext) in secondary_configuration_type4b() argument
363 struct device *dev = &stcontext->nfcdev->dev; in secondary_configuration_type4b()
365 result = st95hf_send_recv_cmd(stcontext, in secondary_configuration_type4b()
376 static int st95hf_select_protocol(struct st95hf_context *stcontext, int type) in st95hf_select_protocol() argument
381 dev = &stcontext->nfcdev->dev; in st95hf_select_protocol()
385 stcontext->current_rf_tech = NFC_DIGITAL_RF_TECH_106A; in st95hf_select_protocol()
386 result = st95hf_send_recv_cmd(stcontext, in st95hf_select_protocol()
398 result = secondary_configuration_type4a(stcontext); in st95hf_select_protocol()
406 stcontext->current_rf_tech = NFC_DIGITAL_RF_TECH_106B; in st95hf_select_protocol()
407 result = st95hf_send_recv_cmd(stcontext, in st95hf_select_protocol()
425 result = secondary_configuration_type4b(stcontext); in st95hf_select_protocol()
433 stcontext->current_rf_tech = NFC_DIGITAL_RF_TECH_ISO15693; in st95hf_select_protocol()
434 result = st95hf_send_recv_cmd(stcontext, in st95hf_select_protocol()
604 static int st95hf_handle_wtx(struct st95hf_context *stcontext, in st95hf_handle_wtx() argument
611 struct nfc_digital_dev *nfcddev = stcontext->ddev; in st95hf_handle_wtx()
612 struct device *dev = &stcontext->nfcdev->dev; in st95hf_handle_wtx()
615 result = iso14443_config_fdt(stcontext, wtx_val & 0x3f); in st95hf_handle_wtx()
626 result = st95hf_send_recv_cmd(stcontext, in st95hf_handle_wtx()
642 result = iso14443_config_fdt(stcontext, val_mm); in st95hf_handle_wtx()
650 static int st95hf_error_handling(struct st95hf_context *stcontext, in st95hf_error_handling() argument
656 struct device *dev = &stcontext->nfcdev->dev; in st95hf_error_handling()
668 switch (stcontext->current_rf_tech) { in st95hf_error_handling()
670 if (stcontext->sendrcv_trflag == TRFLAG_NFCA_STD_FRAME_CRC) { in st95hf_error_handling()
695 static int st95hf_response_handler(struct st95hf_context *stcontext, in st95hf_response_handler() argument
702 struct nfc_digital_dev *nfcddev = stcontext->ddev; in st95hf_response_handler()
703 struct device *dev = &stcontext->nfcdev->dev; in st95hf_response_handler()
706 cb_arg = &stcontext->complete_cb_arg; in st95hf_response_handler()
720 stcontext->fwi = in st95hf_response_handler()
723 stcontext->fwi = in st95hf_response_handler()
728 result = iso14443_config_fdt(stcontext, val_mm); in st95hf_response_handler()
738 switch (stcontext->current_rf_tech) { in st95hf_response_handler()
740 if (stcontext->sendrcv_trflag == TRFLAG_NFCA_STD_FRAME_CRC) in st95hf_response_handler()
756 struct st95hf_context *stcontext = in st95hf_irq_handler() local
759 if (stcontext->spicontext.req_issync) { in st95hf_irq_handler()
760 complete(&stcontext->spicontext.done); in st95hf_irq_handler()
761 stcontext->spicontext.req_issync = false; in st95hf_irq_handler()
775 struct st95hf_context *stcontext = in st95hf_irq_thread_handler() local
779 spidevice = &stcontext->spicontext.spidev->dev; in st95hf_irq_thread_handler()
794 if (!down_trylock(&stcontext->exchange_lock)) { in st95hf_irq_thread_handler()
795 up(&stcontext->exchange_lock); in st95hf_irq_thread_handler()
800 cb_arg = &stcontext->complete_cb_arg; in st95hf_irq_thread_handler()
803 mutex_lock(&stcontext->rm_lock); in st95hf_irq_thread_handler()
804 res_len = st95hf_spi_recv_response(&stcontext->spicontext, in st95hf_irq_thread_handler()
813 if (stcontext->nfcdev_free) { in st95hf_irq_thread_handler()
820 result = st95hf_handle_wtx(stcontext, true, skb_resp->data[3]); in st95hf_irq_thread_handler()
825 mutex_unlock(&stcontext->rm_lock); in st95hf_irq_thread_handler()
829 result = st95hf_error_handling(stcontext, skb_resp, res_len); in st95hf_irq_thread_handler()
833 result = st95hf_response_handler(stcontext, skb_resp, res_len); in st95hf_irq_thread_handler()
843 result = st95hf_handle_wtx(stcontext, false, 0); in st95hf_irq_thread_handler()
849 cb_arg->complete_cb(stcontext->ddev, cb_arg->cb_usrarg, skb_resp); in st95hf_irq_thread_handler()
852 up(&stcontext->exchange_lock); in st95hf_irq_thread_handler()
853 mutex_unlock(&stcontext->rm_lock); in st95hf_irq_thread_handler()
863 cb_arg->complete_cb(stcontext->ddev, cb_arg->cb_usrarg, skb_resp); in st95hf_irq_thread_handler()
865 up(&stcontext->exchange_lock); in st95hf_irq_thread_handler()
866 mutex_unlock(&stcontext->rm_lock); in st95hf_irq_thread_handler()
875 struct st95hf_context *stcontext = nfc_digital_get_drvdata(ddev); in st95hf_in_configure_hw() local
878 return st95hf_select_protocol(stcontext, param); in st95hf_in_configure_hw()
883 stcontext->sendrcv_trflag = TRFLAG_NFCA_SHORT_FRAME; in st95hf_in_configure_hw()
886 stcontext->sendrcv_trflag = TRFLAG_NFCA_STD_FRAME; in st95hf_in_configure_hw()
891 stcontext->sendrcv_trflag = TRFLAG_NFCA_STD_FRAME_CRC; in st95hf_in_configure_hw()
903 static int rf_off(struct st95hf_context *stcontext) in rf_off() argument
908 dev = &stcontext->nfcdev->dev; in rf_off()
910 rc = st95hf_send_recv_cmd(stcontext, CMD_FIELD_OFF, 0, NULL, true); in rf_off()
923 struct st95hf_context *stcontext = nfc_digital_get_drvdata(ddev); in st95hf_in_send_cmd() local
934 switch (stcontext->current_rf_tech) { in st95hf_in_send_cmd()
937 skb_put_u8(skb, stcontext->sendrcv_trflag); in st95hf_in_send_cmd()
953 stcontext->complete_cb_arg.skb_resp = skb_resp; in st95hf_in_send_cmd()
954 stcontext->complete_cb_arg.cb_usrarg = arg; in st95hf_in_send_cmd()
955 stcontext->complete_cb_arg.complete_cb = cb; in st95hf_in_send_cmd()
959 stcontext->complete_cb_arg.rats = true; in st95hf_in_send_cmd()
966 rc = down_killable(&stcontext->exchange_lock); in st95hf_in_send_cmd()
972 rc = st95hf_spi_send(&stcontext->spicontext, skb->data, in st95hf_in_send_cmd()
976 dev_err(&stcontext->nfcdev->dev, in st95hf_in_send_cmd()
979 up(&stcontext->exchange_lock); in st95hf_in_send_cmd()
1026 struct st95hf_context *stcontext = nfc_digital_get_drvdata(ddev); in st95hf_switch_rf() local
1032 return st95hf_select_protocol(stcontext, rf_tech); in st95hf_switch_rf()
1035 return rf_off(stcontext); in st95hf_switch_rf()
1211 struct st95hf_context *stcontext = container_of(spictx, in st95hf_remove() local
1215 mutex_lock(&stcontext->rm_lock); in st95hf_remove()
1217 nfc_digital_unregister_device(stcontext->ddev); in st95hf_remove()
1218 nfc_digital_free_device(stcontext->ddev); in st95hf_remove()
1219 stcontext->nfcdev_free = true; in st95hf_remove()
1221 mutex_unlock(&stcontext->rm_lock); in st95hf_remove()
1224 result = down_killable(&stcontext->exchange_lock); in st95hf_remove()
1229 result = st95hf_spi_send(&stcontext->spicontext, in st95hf_remove()
1243 if (stcontext->st95hf_supply) in st95hf_remove()
1244 regulator_disable(stcontext->st95hf_supply); in st95hf_remove()