Lines Matching refs:st95context

243 static int st95hf_send_recv_cmd(struct st95hf_context *st95context,  in st95hf_send_recv_cmd()  argument
251 struct device *dev = &st95context->spicontext.spidev->dev; in st95hf_send_recv_cmd()
274 ret = st95hf_spi_send(&st95context->spicontext, in st95hf_send_recv_cmd()
286 ret = st95hf_spi_recv_response(&st95context->spicontext, in st95hf_send_recv_cmd()
304 static int st95hf_echo_command(struct st95hf_context *st95context) in st95hf_echo_command() argument
309 result = st95hf_send_recv_cmd(st95context, CMD_ECHO, 0, NULL, false); in st95hf_echo_command()
314 result = st95hf_spi_recv_echo_res(&st95context->spicontext, in st95hf_echo_command()
317 dev_err(&st95context->spicontext.spidev->dev, in st95hf_echo_command()
325 dev_err(&st95context->spicontext.spidev->dev, "err: echo res is 0x%x\n", in st95hf_echo_command()
473 static int st95hf_send_spi_reset_sequence(struct st95hf_context *st95context) in st95hf_send_spi_reset_sequence() argument
478 result = st95hf_spi_send(&st95context->spicontext, in st95hf_send_spi_reset_sequence()
483 dev_err(&st95context->spicontext.spidev->dev, in st95hf_send_spi_reset_sequence()
492 st95hf_send_st95enable_negativepulse(st95context); in st95hf_send_spi_reset_sequence()
500 static int st95hf_por_sequence(struct st95hf_context *st95context) in st95hf_por_sequence() argument
505 st95hf_send_st95enable_negativepulse(st95context); in st95hf_por_sequence()
510 result = st95hf_echo_command(st95context); in st95hf_por_sequence()
512 dev_dbg(&st95context->spicontext.spidev->dev, in st95hf_por_sequence()
521 st95hf_send_st95enable_negativepulse(st95context); in st95hf_por_sequence()
523 st95hf_send_spi_reset_sequence(st95context); in st95hf_por_sequence()
532 static int iso14443_config_fdt(struct st95hf_context *st95context, int wtxm) in iso14443_config_fdt() argument
535 struct device *dev = &st95context->spicontext.spidev->dev; in iso14443_config_fdt()
536 struct nfc_digital_dev *nfcddev = st95context->ddev; in iso14443_config_fdt()
543 st95context->fwi < 4) in iso14443_config_fdt()
544 st95context->fwi = 4; in iso14443_config_fdt()
548 new_params[0].new_param_val = st95context->fwi; in iso14443_config_fdt()
557 result = st95hf_send_recv_cmd(st95context, in iso14443_config_fdt()
569 result = secondary_configuration_type4a(st95context); in iso14443_config_fdt()
577 result = st95hf_send_recv_cmd(st95context, in iso14443_config_fdt()
589 result = secondary_configuration_type4b(st95context); in iso14443_config_fdt()
1068 struct st95hf_context *st95context; in st95hf_probe() local
1073 st95context = devm_kzalloc(&nfc_spi_dev->dev, in st95hf_probe()
1076 if (!st95context) in st95hf_probe()
1079 spicontext = &st95context->spicontext; in st95hf_probe()
1083 st95context->fwi = in st95hf_probe()
1087 st95context->st95hf_supply = in st95hf_probe()
1090 if (IS_ERR(st95context->st95hf_supply)) { in st95hf_probe()
1092 return PTR_ERR(st95context->st95hf_supply); in st95hf_probe()
1095 ret = regulator_enable(st95context->st95hf_supply); in st95hf_probe()
1111 st95context->enable_gpio = in st95hf_probe()
1115 if (!gpio_is_valid(st95context->enable_gpio)) { in st95hf_probe()
1117 ret = st95context->enable_gpio; in st95hf_probe()
1121 ret = devm_gpio_request_one(&nfc_spi_dev->dev, st95context->enable_gpio, in st95hf_probe()
1134 (void *)st95context) < 0) { in st95hf_probe()
1151 ret = st95hf_send_spi_reset_sequence(st95context); in st95hf_probe()
1158 ret = st95hf_por_sequence(st95context); in st95hf_probe()
1165 st95context->ddev = nfc_digital_allocate_device(&st95hf_nfc_digital_ops, in st95hf_probe()
1170 if (!st95context->ddev) { in st95hf_probe()
1175 st95context->nfcdev = st95context->ddev->nfc_dev; in st95hf_probe()
1176 nfc_digital_set_parent_dev(st95context->ddev, &nfc_spi_dev->dev); in st95hf_probe()
1178 ret = nfc_digital_register_device(st95context->ddev); in st95hf_probe()
1180 dev_err(&st95context->nfcdev->dev, "st95hf registration failed\n"); in st95hf_probe()
1185 nfc_digital_set_drvdata(st95context->ddev, st95context); in st95hf_probe()
1187 sema_init(&st95context->exchange_lock, 1); in st95hf_probe()
1188 mutex_init(&st95context->rm_lock); in st95hf_probe()
1193 nfc_digital_free_device(st95context->ddev); in st95hf_probe()
1195 if (st95context->st95hf_supply) in st95hf_probe()
1196 regulator_disable(st95context->st95hf_supply); in st95hf_probe()