Lines Matching refs:ret

459 	int ret;  in trf7970a_cmd()  local
463 ret = spi_write(trf->spi, &cmd, 1); in trf7970a_cmd()
464 if (ret) in trf7970a_cmd()
466 ret); in trf7970a_cmd()
467 return ret; in trf7970a_cmd()
473 int ret; in trf7970a_read() local
475 ret = spi_write_then_read(trf->spi, &addr, 1, val, 1); in trf7970a_read()
476 if (ret) in trf7970a_read()
478 ret); in trf7970a_read()
482 return ret; in trf7970a_read()
491 int ret; in trf7970a_read_cont() local
507 ret = spi_sync(trf->spi, &m); in trf7970a_read_cont()
508 if (ret) in trf7970a_read_cont()
510 ret); in trf7970a_read_cont()
511 return ret; in trf7970a_read_cont()
517 int ret; in trf7970a_write() local
521 ret = spi_write(trf->spi, buf, 2); in trf7970a_write()
522 if (ret) in trf7970a_write()
524 buf[0], buf[1], ret); in trf7970a_write()
526 return ret; in trf7970a_write()
531 int ret; in trf7970a_read_irqstatus() local
539 ret = spi_write_then_read(trf->spi, &addr, 1, buf, 2); in trf7970a_read_irqstatus()
541 ret = spi_write_then_read(trf->spi, &addr, 1, buf, 1); in trf7970a_read_irqstatus()
544 if (ret) in trf7970a_read_irqstatus()
546 __func__, ret); in trf7970a_read_irqstatus()
550 return ret; in trf7970a_read_irqstatus()
555 int ret; in trf7970a_read_target_proto() local
562 ret = spi_write_then_read(trf->spi, &addr, 1, buf, 2); in trf7970a_read_target_proto()
563 if (ret) in trf7970a_read_target_proto()
565 __func__, ret); in trf7970a_read_target_proto()
569 return ret; in trf7970a_read_target_proto()
574 int ret; in trf7970a_mode_detect() local
577 ret = trf7970a_read_target_proto(trf, &target_proto); in trf7970a_mode_detect()
578 if (ret) in trf7970a_mode_detect()
579 return ret; in trf7970a_mode_detect()
602 return ret; in trf7970a_mode_detect()
652 int ret; in trf7970a_transmit() local
669 ret = spi_sync(trf->spi, &m); in trf7970a_transmit()
670 if (ret) { in trf7970a_transmit()
672 ret); in trf7970a_transmit()
673 return ret; in trf7970a_transmit()
707 int ret; in trf7970a_fill_fifo() local
711 ret = trf7970a_read(trf, TRF7970A_FIFO_STATUS, &fifo_bytes); in trf7970a_fill_fifo()
712 if (ret) { in trf7970a_fill_fifo()
713 trf7970a_send_err_upstream(trf, ret); in trf7970a_fill_fifo()
733 ret = trf7970a_transmit(trf, skb, len, &prefix, sizeof(prefix)); in trf7970a_fill_fifo()
734 if (ret) in trf7970a_fill_fifo()
735 trf7970a_send_err_upstream(trf, ret); in trf7970a_fill_fifo()
741 int ret; in trf7970a_drain_fifo() local
749 ret = trf7970a_read(trf, TRF7970A_FIFO_STATUS, &fifo_bytes); in trf7970a_drain_fifo()
750 if (ret) { in trf7970a_drain_fifo()
751 trf7970a_send_err_upstream(trf, ret); in trf7970a_drain_fifo()
776 ret = trf7970a_read_cont(trf, TRF7970A_FIFO_IO_REGISTER, in trf7970a_drain_fifo()
778 if (ret) { in trf7970a_drain_fifo()
779 trf7970a_send_err_upstream(trf, ret); in trf7970a_drain_fifo()
791 ret = trf7970a_read(trf, TRF7970A_FIFO_STATUS, &fifo_bytes); in trf7970a_drain_fifo()
792 if (ret) { in trf7970a_drain_fifo()
793 trf7970a_send_err_upstream(trf, ret); in trf7970a_drain_fifo()
823 int ret; in trf7970a_irq() local
833 ret = trf7970a_read_irqstatus(trf, &status); in trf7970a_irq()
834 if (ret) { in trf7970a_irq()
878 ret = trf7970a_read(trf, TRF7970A_FIFO_STATUS, in trf7970a_irq()
883 if (ret) in trf7970a_irq()
884 trf7970a_send_err_upstream(trf, ret); in trf7970a_irq()
918 ret = trf7970a_write(trf, in trf7970a_irq()
921 if (ret) in trf7970a_irq()
932 ret = trf7970a_write(trf, TRF7970A_ISO_CTRL, in trf7970a_irq()
934 if (ret) in trf7970a_irq()
961 ret = trf7970a_mode_detect(trf, &trf->md_rf_tech); in trf7970a_irq()
962 if (ret) { in trf7970a_irq()
963 trf7970a_send_err_upstream(trf, ret); in trf7970a_irq()
984 int ret; in trf7970a_issue_eof() local
988 ret = trf7970a_cmd(trf, TRF7970A_CMD_FIFO_RESET); in trf7970a_issue_eof()
989 if (ret) in trf7970a_issue_eof()
990 trf7970a_send_err_upstream(trf, ret); in trf7970a_issue_eof()
992 ret = trf7970a_cmd(trf, TRF7970A_CMD_EOF); in trf7970a_issue_eof()
993 if (ret) in trf7970a_issue_eof()
994 trf7970a_send_err_upstream(trf, ret); in trf7970a_issue_eof()
1029 int ret; in trf7970a_init() local
1033 ret = trf7970a_cmd(trf, TRF7970A_CMD_SOFT_INIT); in trf7970a_init()
1034 if (ret) in trf7970a_init()
1037 ret = trf7970a_cmd(trf, TRF7970A_CMD_IDLE); in trf7970a_init()
1038 if (ret) in trf7970a_init()
1041 ret = trf7970a_write(trf, TRF7970A_REG_IO_CTRL, in trf7970a_init()
1043 if (ret) in trf7970a_init()
1046 ret = trf7970a_write(trf, TRF7970A_NFC_TARGET_LEVEL, 0); in trf7970a_init()
1047 if (ret) in trf7970a_init()
1054 ret = trf7970a_write(trf, TRF7970A_MODULATOR_SYS_CLK_CTRL, in trf7970a_init()
1056 if (ret) in trf7970a_init()
1059 ret = trf7970a_write(trf, TRF7970A_ADJUTABLE_FIFO_IRQ_LEVELS, in trf7970a_init()
1062 if (ret) in trf7970a_init()
1065 ret = trf7970a_write(trf, TRF7970A_SPECIAL_FCN_REG1, 0); in trf7970a_init()
1066 if (ret) in trf7970a_init()
1075 dev_dbg(trf->dev, "Couldn't init device: %d\n", ret); in trf7970a_init()
1076 return ret; in trf7970a_init()
1100 int ret; in trf7970a_switch_rf_on() local
1112 ret = trf7970a_init(trf); in trf7970a_switch_rf_on()
1113 if (ret) { in trf7970a_switch_rf_on()
1114 dev_err(trf->dev, "%s - Can't initialize: %d\n", __func__, ret); in trf7970a_switch_rf_on()
1115 return ret; in trf7970a_switch_rf_on()
1126 int ret = 0; in trf7970a_switch_rf() local
1136 ret = trf7970a_switch_rf_on(trf); in trf7970a_switch_rf()
1145 ret = -EINVAL; in trf7970a_switch_rf()
1155 ret = -EINVAL; in trf7970a_switch_rf()
1166 return ret; in trf7970a_switch_rf()
1171 int ret = 0; in trf7970a_in_config_rf_tech() local
1224 ret = trf7970a_write(trf, TRF7970A_NFC_TARGET_LEVEL, 0); in trf7970a_in_config_rf_tech()
1226 return ret; in trf7970a_in_config_rf_tech()
1231 int ret; in trf7970a_is_rf_field() local
1234 ret = trf7970a_write(trf, TRF7970A_CHIP_STATUS_CTRL, in trf7970a_is_rf_field()
1237 if (ret) in trf7970a_is_rf_field()
1238 return ret; in trf7970a_is_rf_field()
1240 ret = trf7970a_cmd(trf, TRF7970A_CMD_TEST_EXT_RF); in trf7970a_is_rf_field()
1241 if (ret) in trf7970a_is_rf_field()
1242 return ret; in trf7970a_is_rf_field()
1246 ret = trf7970a_read(trf, TRF7970A_RSSI_OSC_STATUS, &rssi); in trf7970a_is_rf_field()
1247 if (ret) in trf7970a_is_rf_field()
1248 return ret; in trf7970a_is_rf_field()
1250 ret = trf7970a_write(trf, TRF7970A_CHIP_STATUS_CTRL, in trf7970a_is_rf_field()
1252 if (ret) in trf7970a_is_rf_field()
1253 return ret; in trf7970a_is_rf_field()
1267 int ret; in trf7970a_in_config_framing() local
1302 ret = trf7970a_is_rf_field(trf, &is_rf_field); in trf7970a_in_config_framing()
1303 if (ret) in trf7970a_in_config_framing()
1304 return ret; in trf7970a_in_config_framing()
1311 ret = trf7970a_write(trf, TRF7970A_ISO_CTRL, iso_ctrl); in trf7970a_in_config_framing()
1312 if (ret) in trf7970a_in_config_framing()
1313 return ret; in trf7970a_in_config_framing()
1317 ret = trf7970a_write(trf, TRF7970A_MODULATOR_SYS_CLK_CTRL, in trf7970a_in_config_framing()
1319 if (ret) in trf7970a_in_config_framing()
1320 return ret; in trf7970a_in_config_framing()
1324 ret = trf7970a_write(trf, TRF7970A_CHIP_STATUS_CTRL, in trf7970a_in_config_framing()
1327 if (ret) in trf7970a_in_config_framing()
1328 return ret; in trf7970a_in_config_framing()
1342 int ret; in trf7970a_in_configure_hw() local
1352 ret = trf7970a_switch_rf_on(trf); in trf7970a_in_configure_hw()
1353 if (ret) in trf7970a_in_configure_hw()
1359 ret = trf7970a_in_config_rf_tech(trf, param); in trf7970a_in_configure_hw()
1362 ret = trf7970a_in_config_framing(trf, param); in trf7970a_in_configure_hw()
1366 ret = -EINVAL; in trf7970a_in_configure_hw()
1371 return ret; in trf7970a_in_configure_hw()
1394 int ret; in trf7970a_per_cmd_config() local
1415 ret = trf7970a_write(trf, TRF7970A_SPECIAL_FCN_REG1, in trf7970a_per_cmd_config()
1417 if (ret) in trf7970a_per_cmd_config()
1418 return ret; in trf7970a_per_cmd_config()
1442 ret = trf7970a_write(trf, TRF7970A_ISO_CTRL, iso_ctrl); in trf7970a_per_cmd_config()
1443 if (ret) in trf7970a_per_cmd_config()
1444 return ret; in trf7970a_per_cmd_config()
1465 int ret; in trf7970a_send_cmd() local
1480 ret = -EIO; in trf7970a_send_cmd()
1487 ret = -ECANCELED; in trf7970a_send_cmd()
1496 ret = -ENOMEM; in trf7970a_send_cmd()
1502 ret = trf7970a_cmd(trf, TRF7970A_CMD_ENABLE_RX); in trf7970a_send_cmd()
1503 if (ret) in trf7970a_send_cmd()
1510 ret = trf7970a_per_cmd_config(trf, skb); in trf7970a_send_cmd()
1511 if (ret) in trf7970a_send_cmd()
1547 ret = trf7970a_read_irqstatus(trf, &status); in trf7970a_send_cmd()
1548 if (ret) in trf7970a_send_cmd()
1551 ret = trf7970a_transmit(trf, skb, len, prefix, sizeof(prefix)); in trf7970a_send_cmd()
1552 if (ret) { in trf7970a_send_cmd()
1559 return ret; in trf7970a_send_cmd()
1564 int ret = 0; in trf7970a_tg_config_rf_tech() local
1606 ret = trf7970a_write(trf, TRF7970A_ISO_CTRL, in trf7970a_tg_config_rf_tech()
1612 return ret; in trf7970a_tg_config_rf_tech()
1624 int ret; in trf7970a_tg_config_framing() local
1655 ret = trf7970a_write(trf, TRF7970A_ISO_CTRL, iso_ctrl); in trf7970a_tg_config_framing()
1656 if (ret) in trf7970a_tg_config_framing()
1657 return ret; in trf7970a_tg_config_framing()
1661 ret = trf7970a_write(trf, TRF7970A_MODULATOR_SYS_CLK_CTRL, in trf7970a_tg_config_framing()
1663 if (ret) in trf7970a_tg_config_framing()
1664 return ret; in trf7970a_tg_config_framing()
1668 ret = trf7970a_write(trf, TRF7970A_CHIP_STATUS_CTRL, in trf7970a_tg_config_framing()
1671 if (ret) in trf7970a_tg_config_framing()
1672 return ret; in trf7970a_tg_config_framing()
1684 int ret; in trf7970a_tg_configure_hw() local
1694 ret = trf7970a_switch_rf_on(trf); in trf7970a_tg_configure_hw()
1695 if (ret) in trf7970a_tg_configure_hw()
1701 ret = trf7970a_tg_config_rf_tech(trf, param); in trf7970a_tg_configure_hw()
1704 ret = trf7970a_tg_config_framing(trf, param); in trf7970a_tg_configure_hw()
1708 ret = -EINVAL; in trf7970a_tg_configure_hw()
1713 return ret; in trf7970a_tg_configure_hw()
1721 int ret; in _trf7970a_tg_listen() local
1729 ret = -EIO; in _trf7970a_tg_listen()
1736 ret = -ECANCELED; in _trf7970a_tg_listen()
1744 ret = -ENOMEM; in _trf7970a_tg_listen()
1748 ret = trf7970a_write(trf, TRF7970A_RX_SPECIAL_SETTINGS, in _trf7970a_tg_listen()
1753 if (ret) in _trf7970a_tg_listen()
1756 ret = trf7970a_write(trf, TRF7970A_REG_IO_CTRL, in _trf7970a_tg_listen()
1758 if (ret) in _trf7970a_tg_listen()
1761 ret = trf7970a_write(trf, TRF7970A_NFC_LOW_FIELD_LEVEL, in _trf7970a_tg_listen()
1763 if (ret) in _trf7970a_tg_listen()
1766 ret = trf7970a_write(trf, TRF7970A_NFC_TARGET_LEVEL, in _trf7970a_tg_listen()
1768 if (ret) in _trf7970a_tg_listen()
1777 ret = trf7970a_cmd(trf, TRF7970A_CMD_ENABLE_RX); in _trf7970a_tg_listen()
1778 if (ret) in _trf7970a_tg_listen()
1788 return ret; in _trf7970a_tg_listen()
1807 int ret; in trf7970a_tg_listen_md() local
1812 ret = trf7970a_tg_configure_hw(ddev, NFC_DIGITAL_CONFIG_RF_TECH, in trf7970a_tg_listen_md()
1814 if (ret) in trf7970a_tg_listen_md()
1815 return ret; in trf7970a_tg_listen_md()
1817 ret = trf7970a_tg_configure_hw(ddev, NFC_DIGITAL_CONFIG_FRAMING, in trf7970a_tg_listen_md()
1819 if (ret) in trf7970a_tg_listen_md()
1820 return ret; in trf7970a_tg_listen_md()
1878 int ret; in trf7970a_power_up() local
1885 ret = regulator_enable(trf->regulator); in trf7970a_power_up()
1886 if (ret) { in trf7970a_power_up()
1887 dev_err(trf->dev, "%s - Can't enable VIN: %d\n", __func__, ret); in trf7970a_power_up()
1888 return ret; in trf7970a_power_up()
1910 int ret; in trf7970a_power_down() local
1928 ret = regulator_disable(trf->regulator); in trf7970a_power_down()
1929 if (ret) in trf7970a_power_down()
1931 ret); in trf7970a_power_down()
1935 return ret; in trf7970a_power_down()
1940 int ret; in trf7970a_startup() local
1942 ret = trf7970a_power_up(trf); in trf7970a_startup()
1943 if (ret) in trf7970a_startup()
1944 return ret; in trf7970a_startup()
1979 int autosuspend_delay, ret; in trf7970a_get_autosuspend_delay() local
1981 ret = of_property_read_u32(np, "autosuspend-delay", &autosuspend_delay); in trf7970a_get_autosuspend_delay()
1982 if (ret) in trf7970a_get_autosuspend_delay()
1992 int uvolts, autosuspend_delay, ret; in trf7970a_probe() local
2011 ret = spi_setup(spi); in trf7970a_probe()
2012 if (ret < 0) { in trf7970a_probe()
2014 return ret; in trf7970a_probe()
2055 ret = devm_request_threaded_irq(trf->dev, spi->irq, NULL, in trf7970a_probe()
2059 if (ret) { in trf7970a_probe()
2060 dev_err(trf->dev, "Can't request IRQ#%d: %d\n", spi->irq, ret); in trf7970a_probe()
2061 return ret; in trf7970a_probe()
2069 ret = PTR_ERR(trf->regulator); in trf7970a_probe()
2070 dev_err(trf->dev, "Can't get VIN regulator: %d\n", ret); in trf7970a_probe()
2074 ret = regulator_enable(trf->regulator); in trf7970a_probe()
2075 if (ret) { in trf7970a_probe()
2076 dev_err(trf->dev, "Can't enable VIN: %d\n", ret); in trf7970a_probe()
2086 ret = PTR_ERR(trf->regulator); in trf7970a_probe()
2087 dev_err(trf->dev, "Can't get VDD_IO regulator: %d\n", ret); in trf7970a_probe()
2091 ret = regulator_enable(trf->regulator); in trf7970a_probe()
2092 if (ret) { in trf7970a_probe()
2093 dev_err(trf->dev, "Can't enable VDD_IO: %d\n", ret); in trf7970a_probe()
2109 ret = -ENOMEM; in trf7970a_probe()
2122 ret = trf7970a_startup(trf); in trf7970a_probe()
2123 if (ret) in trf7970a_probe()
2126 ret = nfc_digital_register_device(trf->ddev); in trf7970a_probe()
2127 if (ret) { in trf7970a_probe()
2129 ret); in trf7970a_probe()
2143 return ret; in trf7970a_probe()
2187 int ret; in trf7970a_resume() local
2193 ret = trf7970a_startup(trf); in trf7970a_resume()
2197 return ret; in trf7970a_resume()
2206 int ret; in trf7970a_pm_runtime_suspend() local
2212 ret = trf7970a_power_down(trf); in trf7970a_pm_runtime_suspend()
2216 return ret; in trf7970a_pm_runtime_suspend()
2223 int ret; in trf7970a_pm_runtime_resume() local
2227 ret = trf7970a_power_up(trf); in trf7970a_pm_runtime_resume()
2228 if (!ret) in trf7970a_pm_runtime_resume()
2231 return ret; in trf7970a_pm_runtime_resume()