Lines Matching refs:st95context

244 static int st95hf_send_recv_cmd(struct st95hf_context *st95context,  in st95hf_send_recv_cmd()  argument
252 struct device *dev = &st95context->spicontext.spidev->dev; in st95hf_send_recv_cmd()
275 ret = st95hf_spi_send(&st95context->spicontext, in st95hf_send_recv_cmd()
287 ret = st95hf_spi_recv_response(&st95context->spicontext, in st95hf_send_recv_cmd()
305 static int st95hf_echo_command(struct st95hf_context *st95context) in st95hf_echo_command() argument
310 result = st95hf_send_recv_cmd(st95context, CMD_ECHO, 0, NULL, false); in st95hf_echo_command()
315 result = st95hf_spi_recv_echo_res(&st95context->spicontext, in st95hf_echo_command()
318 dev_err(&st95context->spicontext.spidev->dev, in st95hf_echo_command()
326 dev_err(&st95context->spicontext.spidev->dev, "err: echo res is 0x%x\n", in st95hf_echo_command()
474 static int st95hf_send_spi_reset_sequence(struct st95hf_context *st95context) in st95hf_send_spi_reset_sequence() argument
479 result = st95hf_spi_send(&st95context->spicontext, in st95hf_send_spi_reset_sequence()
484 dev_err(&st95context->spicontext.spidev->dev, in st95hf_send_spi_reset_sequence()
493 st95hf_send_st95enable_negativepulse(st95context); in st95hf_send_spi_reset_sequence()
501 static int st95hf_por_sequence(struct st95hf_context *st95context) in st95hf_por_sequence() argument
506 st95hf_send_st95enable_negativepulse(st95context); in st95hf_por_sequence()
511 result = st95hf_echo_command(st95context); in st95hf_por_sequence()
513 dev_dbg(&st95context->spicontext.spidev->dev, in st95hf_por_sequence()
522 st95hf_send_st95enable_negativepulse(st95context); in st95hf_por_sequence()
524 st95hf_send_spi_reset_sequence(st95context); in st95hf_por_sequence()
533 static int iso14443_config_fdt(struct st95hf_context *st95context, int wtxm) in iso14443_config_fdt() argument
536 struct device *dev = &st95context->spicontext.spidev->dev; in iso14443_config_fdt()
537 struct nfc_digital_dev *nfcddev = st95context->ddev; in iso14443_config_fdt()
544 st95context->fwi < 4) in iso14443_config_fdt()
545 st95context->fwi = 4; in iso14443_config_fdt()
549 new_params[0].new_param_val = st95context->fwi; in iso14443_config_fdt()
558 result = st95hf_send_recv_cmd(st95context, in iso14443_config_fdt()
570 result = secondary_configuration_type4a(st95context); in iso14443_config_fdt()
578 result = st95hf_send_recv_cmd(st95context, in iso14443_config_fdt()
590 result = secondary_configuration_type4b(st95context); in iso14443_config_fdt()
1072 struct st95hf_context *st95context; in st95hf_probe() local
1077 st95context = devm_kzalloc(&nfc_spi_dev->dev, in st95hf_probe()
1080 if (!st95context) in st95hf_probe()
1083 spicontext = &st95context->spicontext; in st95hf_probe()
1087 st95context->fwi = in st95hf_probe()
1091 st95context->st95hf_supply = in st95hf_probe()
1094 if (IS_ERR(st95context->st95hf_supply)) { in st95hf_probe()
1096 return PTR_ERR(st95context->st95hf_supply); in st95hf_probe()
1099 ret = regulator_enable(st95context->st95hf_supply); in st95hf_probe()
1115 st95context->enable_gpio = in st95hf_probe()
1119 if (!gpio_is_valid(st95context->enable_gpio)) { in st95hf_probe()
1121 ret = st95context->enable_gpio; in st95hf_probe()
1125 ret = devm_gpio_request_one(&nfc_spi_dev->dev, st95context->enable_gpio, in st95hf_probe()
1138 (void *)st95context) < 0) { in st95hf_probe()
1155 ret = st95hf_send_spi_reset_sequence(st95context); in st95hf_probe()
1162 ret = st95hf_por_sequence(st95context); in st95hf_probe()
1169 st95context->ddev = nfc_digital_allocate_device(&st95hf_nfc_digital_ops, in st95hf_probe()
1174 if (!st95context->ddev) { in st95hf_probe()
1179 st95context->nfcdev = st95context->ddev->nfc_dev; in st95hf_probe()
1180 nfc_digital_set_parent_dev(st95context->ddev, &nfc_spi_dev->dev); in st95hf_probe()
1182 ret = nfc_digital_register_device(st95context->ddev); in st95hf_probe()
1184 dev_err(&st95context->nfcdev->dev, "st95hf registration failed\n"); in st95hf_probe()
1189 nfc_digital_set_drvdata(st95context->ddev, st95context); in st95hf_probe()
1191 sema_init(&st95context->exchange_lock, 1); in st95hf_probe()
1192 mutex_init(&st95context->rm_lock); in st95hf_probe()
1197 nfc_digital_free_device(st95context->ddev); in st95hf_probe()
1199 if (st95context->st95hf_supply) in st95hf_probe()
1200 regulator_disable(st95context->st95hf_supply); in st95hf_probe()