aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/nfc/trf7970a.c
diff options
context:
space:
mode:
authorMark A. Greer <mgreer@animalcreek.com>2014-08-07 20:41:41 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2014-08-31 18:06:55 -0400
commit3bd14233aa0733fbc6c3f75ec928f1a393522644 (patch)
treee2ac5c741d2df45154f0ab958b8a10fd0fb77c19 /drivers/nfc/trf7970a.c
parentdddb3da046a4d86de649ba795726afa7fe6fbb41 (diff)
NFC: trf7970a: Add VIN voltage override support
The trf7970a driver uses the voltage from the power/regulator subsystem to determine what the voltage on the VIN pin is. Normally, this is the right thing to do but sometimes the board that the trf7970a is on may change the voltage. This is the case for the trf7970atb board from Texas Instruments where it boosts the VIN voltage from 3.3V to 5V (see http://www.ti.com/tool/trf7970atb). To handle this, add support for the 'vin-voltage-override' device tree property which overrides the voltage value given by the regulator subsystem. When the DT property is not present, the value from the regulator subsystem is used. The value of 'vin-voltage-override' is in uVolts. Signed-off-by: Mark A. Greer <mgreer@animalcreek.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/nfc/trf7970a.c')
-rw-r--r--drivers/nfc/trf7970a.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/nfc/trf7970a.c b/drivers/nfc/trf7970a.c
index 3b78b031e617..5355d0e4c045 100644
--- a/drivers/nfc/trf7970a.c
+++ b/drivers/nfc/trf7970a.c
@@ -1251,6 +1251,12 @@ static int trf7970a_get_autosuspend_delay(struct device_node *np)
1251 return autosuspend_delay; 1251 return autosuspend_delay;
1252} 1252}
1253 1253
1254static int trf7970a_get_vin_voltage_override(struct device_node *np,
1255 u32 *vin_uvolts)
1256{
1257 return of_property_read_u32(np, "vin-voltage-override", vin_uvolts);
1258}
1259
1254static int trf7970a_probe(struct spi_device *spi) 1260static int trf7970a_probe(struct spi_device *spi)
1255{ 1261{
1256 struct device_node *np = spi->dev.of_node; 1262 struct device_node *np = spi->dev.of_node;
@@ -1326,7 +1332,9 @@ static int trf7970a_probe(struct spi_device *spi)
1326 goto err_destroy_lock; 1332 goto err_destroy_lock;
1327 } 1333 }
1328 1334
1329 uvolts = regulator_get_voltage(trf->regulator); 1335 ret = trf7970a_get_vin_voltage_override(np, &uvolts);
1336 if (ret)
1337 uvolts = regulator_get_voltage(trf->regulator);
1330 1338
1331 if (uvolts > 4000000) 1339 if (uvolts > 4000000)
1332 trf->chip_status_ctrl = TRF7970A_CHIP_STATUS_VRS5_3; 1340 trf->chip_status_ctrl = TRF7970A_CHIP_STATUS_VRS5_3;