Commit ebcc5a0d authored by Mark A. Greer's avatar Mark A. Greer Committed by Samuel Ortiz

NFC: trf7970a: Set correct Vin voltage in Chip Status Control register

Currently, the trf7970a driver assumes that the Vin voltage is 5V when
it writes to the 'Chip Status Control' register. That may not be correct
so use the regulator facility to get the Vin voltage and set the VRS5_3
bit correctly when writing to that register.
Signed-off-by: default avatarMark A. Greer <mgreer@animalcreek.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent 12e9ade3
...@@ -336,6 +336,7 @@ struct trf7970a { ...@@ -336,6 +336,7 @@ struct trf7970a {
struct sk_buff *rx_skb; struct sk_buff *rx_skb;
nfc_digital_cmd_complete_t cb; nfc_digital_cmd_complete_t cb;
void *cb_arg; void *cb_arg;
u8 chip_status_ctrl;
u8 iso_ctrl; u8 iso_ctrl;
u8 iso_ctrl_tech; u8 iso_ctrl_tech;
u8 modulator_sys_clk_ctrl; u8 modulator_sys_clk_ctrl;
...@@ -779,8 +780,7 @@ static int trf7970a_init(struct trf7970a *trf) ...@@ -779,8 +780,7 @@ static int trf7970a_init(struct trf7970a *trf)
trf->special_fcn_reg1 = 0; trf->special_fcn_reg1 = 0;
ret = trf7970a_write(trf, TRF7970A_CHIP_STATUS_CTRL, ret = trf7970a_write(trf, TRF7970A_CHIP_STATUS_CTRL,
TRF7970A_CHIP_STATUS_RF_ON | trf->chip_status_ctrl | TRF7970A_CHIP_STATUS_RF_ON);
TRF7970A_CHIP_STATUS_VRS5_3);
if (ret) if (ret)
goto err_out; goto err_out;
...@@ -1245,7 +1245,7 @@ static int trf7970a_probe(struct spi_device *spi) ...@@ -1245,7 +1245,7 @@ static int trf7970a_probe(struct spi_device *spi)
struct device_node *np = spi->dev.of_node; struct device_node *np = spi->dev.of_node;
const struct spi_device_id *id = spi_get_device_id(spi); const struct spi_device_id *id = spi_get_device_id(spi);
struct trf7970a *trf; struct trf7970a *trf;
int ret; int uvolts, ret;
if (!np) { if (!np) {
dev_err(&spi->dev, "No Device Tree entry\n"); dev_err(&spi->dev, "No Device Tree entry\n");
...@@ -1315,6 +1315,11 @@ static int trf7970a_probe(struct spi_device *spi) ...@@ -1315,6 +1315,11 @@ static int trf7970a_probe(struct spi_device *spi)
goto err_destroy_lock; goto err_destroy_lock;
} }
uvolts = regulator_get_voltage(trf->regulator);
if (uvolts > 4000000)
trf->chip_status_ctrl = TRF7970A_CHIP_STATUS_VRS5_3;
trf->powering_up = true; trf->powering_up = true;
trf->ddev = nfc_digital_allocate_device(&trf7970a_nfc_ops, trf->ddev = nfc_digital_allocate_device(&trf7970a_nfc_ops,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment