aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/nfc
diff options
context:
space:
mode:
authorMark A. Greer <mgreer@animalcreek.com>2014-03-25 11:54:36 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2014-04-21 18:37:27 -0400
commitebcc5a0d08e6a680558ed74f5dd724427ff5a29b (patch)
treebd3d6034c195a32dbe03f5b0f49cca99043e0ce4 /drivers/nfc
parent12e9ade309db51e7ea26be3b4fd5bc6057ddc175 (diff)
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: Mark A. Greer <mgreer@animalcreek.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/nfc')
-rw-r--r--drivers/nfc/trf7970a.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/nfc/trf7970a.c b/drivers/nfc/trf7970a.c
index 352aaab807b6..203d86fb1d54 100644
--- a/drivers/nfc/trf7970a.c
+++ b/drivers/nfc/trf7970a.c
@@ -336,6 +336,7 @@ struct trf7970a {
336 struct sk_buff *rx_skb; 336 struct sk_buff *rx_skb;
337 nfc_digital_cmd_complete_t cb; 337 nfc_digital_cmd_complete_t cb;
338 void *cb_arg; 338 void *cb_arg;
339 u8 chip_status_ctrl;
339 u8 iso_ctrl; 340 u8 iso_ctrl;
340 u8 iso_ctrl_tech; 341 u8 iso_ctrl_tech;
341 u8 modulator_sys_clk_ctrl; 342 u8 modulator_sys_clk_ctrl;
@@ -779,8 +780,7 @@ static int trf7970a_init(struct trf7970a *trf)
779 trf->special_fcn_reg1 = 0; 780 trf->special_fcn_reg1 = 0;
780 781
781 ret = trf7970a_write(trf, TRF7970A_CHIP_STATUS_CTRL, 782 ret = trf7970a_write(trf, TRF7970A_CHIP_STATUS_CTRL,
782 TRF7970A_CHIP_STATUS_RF_ON | 783 trf->chip_status_ctrl | TRF7970A_CHIP_STATUS_RF_ON);
783 TRF7970A_CHIP_STATUS_VRS5_3);
784 if (ret) 784 if (ret)
785 goto err_out; 785 goto err_out;
786 786
@@ -1245,7 +1245,7 @@ static int trf7970a_probe(struct spi_device *spi)
1245 struct device_node *np = spi->dev.of_node; 1245 struct device_node *np = spi->dev.of_node;
1246 const struct spi_device_id *id = spi_get_device_id(spi); 1246 const struct spi_device_id *id = spi_get_device_id(spi);
1247 struct trf7970a *trf; 1247 struct trf7970a *trf;
1248 int ret; 1248 int uvolts, ret;
1249 1249
1250 if (!np) { 1250 if (!np) {
1251 dev_err(&spi->dev, "No Device Tree entry\n"); 1251 dev_err(&spi->dev, "No Device Tree entry\n");
@@ -1315,6 +1315,11 @@ static int trf7970a_probe(struct spi_device *spi)
1315 goto err_destroy_lock; 1315 goto err_destroy_lock;
1316 } 1316 }
1317 1317
1318 uvolts = regulator_get_voltage(trf->regulator);
1319
1320 if (uvolts > 4000000)
1321 trf->chip_status_ctrl = TRF7970A_CHIP_STATUS_VRS5_3;
1322
1318 trf->powering_up = true; 1323 trf->powering_up = true;
1319 1324
1320 trf->ddev = nfc_digital_allocate_device(&trf7970a_nfc_ops, 1325 trf->ddev = nfc_digital_allocate_device(&trf7970a_nfc_ops,