diff options
Diffstat (limited to 'drivers/nfc/trf7970a.c')
-rw-r--r-- | drivers/nfc/trf7970a.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/drivers/nfc/trf7970a.c b/drivers/nfc/trf7970a.c index ecb786283ffa..2d1c8ca6e679 100644 --- a/drivers/nfc/trf7970a.c +++ b/drivers/nfc/trf7970a.c | |||
@@ -444,6 +444,7 @@ struct trf7970a { | |||
444 | u8 iso_ctrl_tech; | 444 | u8 iso_ctrl_tech; |
445 | u8 modulator_sys_clk_ctrl; | 445 | u8 modulator_sys_clk_ctrl; |
446 | u8 special_fcn_reg1; | 446 | u8 special_fcn_reg1; |
447 | u8 io_ctrl; | ||
447 | unsigned int guard_time; | 448 | unsigned int guard_time; |
448 | int technology; | 449 | int technology; |
449 | int framing; | 450 | int framing; |
@@ -1051,6 +1052,11 @@ static int trf7970a_init(struct trf7970a *trf) | |||
1051 | if (ret) | 1052 | if (ret) |
1052 | goto err_out; | 1053 | goto err_out; |
1053 | 1054 | ||
1055 | ret = trf7970a_write(trf, TRF7970A_REG_IO_CTRL, | ||
1056 | trf->io_ctrl | TRF7970A_REG_IO_CTRL_VRS(0x1)); | ||
1057 | if (ret) | ||
1058 | goto err_out; | ||
1059 | |||
1054 | ret = trf7970a_write(trf, TRF7970A_NFC_TARGET_LEVEL, 0); | 1060 | ret = trf7970a_write(trf, TRF7970A_NFC_TARGET_LEVEL, 0); |
1055 | if (ret) | 1061 | if (ret) |
1056 | goto err_out; | 1062 | goto err_out; |
@@ -1767,7 +1773,7 @@ static int _trf7970a_tg_listen(struct nfc_digital_dev *ddev, u16 timeout, | |||
1767 | goto out_err; | 1773 | goto out_err; |
1768 | 1774 | ||
1769 | ret = trf7970a_write(trf, TRF7970A_REG_IO_CTRL, | 1775 | ret = trf7970a_write(trf, TRF7970A_REG_IO_CTRL, |
1770 | TRF7970A_REG_IO_CTRL_VRS(0x1)); | 1776 | trf->io_ctrl | TRF7970A_REG_IO_CTRL_VRS(0x1)); |
1771 | if (ret) | 1777 | if (ret) |
1772 | goto out_err; | 1778 | goto out_err; |
1773 | 1779 | ||
@@ -2107,6 +2113,24 @@ static int trf7970a_probe(struct spi_device *spi) | |||
2107 | if (uvolts > 4000000) | 2113 | if (uvolts > 4000000) |
2108 | trf->chip_status_ctrl = TRF7970A_CHIP_STATUS_VRS5_3; | 2114 | trf->chip_status_ctrl = TRF7970A_CHIP_STATUS_VRS5_3; |
2109 | 2115 | ||
2116 | trf->regulator = devm_regulator_get(&spi->dev, "vdd-io"); | ||
2117 | if (IS_ERR(trf->regulator)) { | ||
2118 | ret = PTR_ERR(trf->regulator); | ||
2119 | dev_err(trf->dev, "Can't get VDD_IO regulator: %d\n", ret); | ||
2120 | goto err_destroy_lock; | ||
2121 | } | ||
2122 | |||
2123 | ret = regulator_enable(trf->regulator); | ||
2124 | if (ret) { | ||
2125 | dev_err(trf->dev, "Can't enable VDD_IO: %d\n", ret); | ||
2126 | goto err_destroy_lock; | ||
2127 | } | ||
2128 | |||
2129 | if (regulator_get_voltage(trf->regulator) == 1800000) { | ||
2130 | trf->io_ctrl = TRF7970A_REG_IO_CTRL_IO_LOW; | ||
2131 | dev_dbg(trf->dev, "trf7970a config vdd_io to 1.8V\n"); | ||
2132 | } | ||
2133 | |||
2110 | trf->ddev = nfc_digital_allocate_device(&trf7970a_nfc_ops, | 2134 | trf->ddev = nfc_digital_allocate_device(&trf7970a_nfc_ops, |
2111 | TRF7970A_SUPPORTED_PROTOCOLS, | 2135 | TRF7970A_SUPPORTED_PROTOCOLS, |
2112 | NFC_DIGITAL_DRV_CAPS_IN_CRC | | 2136 | NFC_DIGITAL_DRV_CAPS_IN_CRC | |