Lines Matching refs:st95context
255 static int st95hf_send_recv_cmd(struct st95hf_context *st95context, in st95hf_send_recv_cmd() argument
263 struct device *dev = &st95context->spicontext.spidev->dev; in st95hf_send_recv_cmd()
286 ret = st95hf_spi_send(&st95context->spicontext, in st95hf_send_recv_cmd()
298 ret = st95hf_spi_recv_response(&st95context->spicontext, in st95hf_send_recv_cmd()
316 static int st95hf_echo_command(struct st95hf_context *st95context) in st95hf_echo_command() argument
321 result = st95hf_send_recv_cmd(st95context, CMD_ECHO, 0, NULL, false); in st95hf_echo_command()
326 result = st95hf_spi_recv_echo_res(&st95context->spicontext, in st95hf_echo_command()
329 dev_err(&st95context->spicontext.spidev->dev, in st95hf_echo_command()
337 dev_err(&st95context->spicontext.spidev->dev, "err: echo res is 0x%x\n", in st95hf_echo_command()
485 static int st95hf_send_spi_reset_sequence(struct st95hf_context *st95context) in st95hf_send_spi_reset_sequence() argument
490 result = st95hf_spi_send(&st95context->spicontext, in st95hf_send_spi_reset_sequence()
495 dev_err(&st95context->spicontext.spidev->dev, in st95hf_send_spi_reset_sequence()
504 st95hf_send_st95enable_negativepulse(st95context); in st95hf_send_spi_reset_sequence()
512 static int st95hf_por_sequence(struct st95hf_context *st95context) in st95hf_por_sequence() argument
517 st95hf_send_st95enable_negativepulse(st95context); in st95hf_por_sequence()
522 result = st95hf_echo_command(st95context); in st95hf_por_sequence()
524 dev_dbg(&st95context->spicontext.spidev->dev, in st95hf_por_sequence()
533 st95hf_send_st95enable_negativepulse(st95context); in st95hf_por_sequence()
535 st95hf_send_spi_reset_sequence(st95context); in st95hf_por_sequence()
544 static int iso14443_config_fdt(struct st95hf_context *st95context, int wtxm) in iso14443_config_fdt() argument
547 struct device *dev = &st95context->spicontext.spidev->dev; in iso14443_config_fdt()
548 struct nfc_digital_dev *nfcddev = st95context->ddev; in iso14443_config_fdt()
555 st95context->fwi < 4) in iso14443_config_fdt()
556 st95context->fwi = 4; in iso14443_config_fdt()
560 new_params[0].new_param_val = st95context->fwi; in iso14443_config_fdt()
569 result = st95hf_send_recv_cmd(st95context, in iso14443_config_fdt()
581 result = secondary_configuration_type4a(st95context); in iso14443_config_fdt()
589 result = st95hf_send_recv_cmd(st95context, in iso14443_config_fdt()
601 result = secondary_configuration_type4b(st95context); in iso14443_config_fdt()
1081 struct st95hf_context *st95context; in st95hf_probe() local
1086 st95context = devm_kzalloc(&nfc_spi_dev->dev, in st95hf_probe()
1089 if (!st95context) in st95hf_probe()
1092 spicontext = &st95context->spicontext; in st95hf_probe()
1096 st95context->fwi = in st95hf_probe()
1100 st95context->st95hf_supply = in st95hf_probe()
1103 if (IS_ERR(st95context->st95hf_supply)) { in st95hf_probe()
1105 return PTR_ERR(st95context->st95hf_supply); in st95hf_probe()
1108 ret = regulator_enable(st95context->st95hf_supply); in st95hf_probe()
1124 st95context->enable_gpio = in st95hf_probe()
1128 if (!gpio_is_valid(st95context->enable_gpio)) { in st95hf_probe()
1130 ret = st95context->enable_gpio; in st95hf_probe()
1134 ret = devm_gpio_request_one(&nfc_spi_dev->dev, st95context->enable_gpio, in st95hf_probe()
1147 (void *)st95context) < 0) { in st95hf_probe()
1164 ret = st95hf_send_spi_reset_sequence(st95context); in st95hf_probe()
1171 ret = st95hf_por_sequence(st95context); in st95hf_probe()
1178 st95context->ddev = nfc_digital_allocate_device(&st95hf_nfc_digital_ops, in st95hf_probe()
1183 if (!st95context->ddev) { in st95hf_probe()
1188 st95context->nfcdev = st95context->ddev->nfc_dev; in st95hf_probe()
1189 nfc_digital_set_parent_dev(st95context->ddev, &nfc_spi_dev->dev); in st95hf_probe()
1191 ret = nfc_digital_register_device(st95context->ddev); in st95hf_probe()
1193 dev_err(&st95context->nfcdev->dev, "st95hf registration failed\n"); in st95hf_probe()
1198 nfc_digital_set_drvdata(st95context->ddev, st95context); in st95hf_probe()
1200 sema_init(&st95context->exchange_lock, 1); in st95hf_probe()
1201 mutex_init(&st95context->rm_lock); in st95hf_probe()
1206 nfc_digital_free_device(st95context->ddev); in st95hf_probe()
1208 if (st95context->st95hf_supply) in st95hf_probe()
1209 regulator_disable(st95context->st95hf_supply); in st95hf_probe()