aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark A. Greer <mgreer@animalcreek.com>2014-03-25 11:54:40 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2014-04-21 18:37:28 -0400
commitfd0c8280cf47104e87dc10828ded541b4e84deda (patch)
tree8a27b77b32be6504a12dc610c611976ecf0af2dc
parent18422e686ef043b9abe004326ac9ffa1e38b81ec (diff)
NFC: trf7970a: Add 'autosuspend-delay' DTS property
The trf7970a driver currently uses a fixed autosuspend delay of 30 seconds. To enable users to customize the delay as they see fit, add support for the new 'autosuspend-delay' DTS property (part of the nfc node) which can override the default 30 seconds. Signed-off-by: Mark A. Greer <mgreer@animalcreek.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
-rw-r--r--drivers/nfc/trf7970a.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/drivers/nfc/trf7970a.c b/drivers/nfc/trf7970a.c
index 8744a556fbd1..a91859b133e8 100644
--- a/drivers/nfc/trf7970a.c
+++ b/drivers/nfc/trf7970a.c
@@ -1221,12 +1221,25 @@ static struct nfc_digital_ops trf7970a_nfc_ops = {
1221 .abort_cmd = trf7970a_abort_cmd, 1221 .abort_cmd = trf7970a_abort_cmd,
1222}; 1222};
1223 1223
1224static int trf7970a_get_autosuspend_delay(struct device_node *np)
1225{
1226 int autosuspend_delay, ret;
1227
1228 ret = of_property_read_u32(np, "autosuspend-delay", &autosuspend_delay);
1229 if (ret)
1230 autosuspend_delay = TRF7970A_AUTOSUSPEND_DELAY;
1231
1232 of_node_put(np);
1233
1234 return autosuspend_delay;
1235}
1236
1224static int trf7970a_probe(struct spi_device *spi) 1237static int trf7970a_probe(struct spi_device *spi)
1225{ 1238{
1226 struct device_node *np = spi->dev.of_node; 1239 struct device_node *np = spi->dev.of_node;
1227 const struct spi_device_id *id = spi_get_device_id(spi); 1240 const struct spi_device_id *id = spi_get_device_id(spi);
1228 struct trf7970a *trf; 1241 struct trf7970a *trf;
1229 int uvolts, ret; 1242 int uvolts, autosuspend_delay, ret;
1230 1243
1231 if (!np) { 1244 if (!np) {
1232 dev_err(&spi->dev, "No Device Tree entry\n"); 1245 dev_err(&spi->dev, "No Device Tree entry\n");
@@ -1315,7 +1328,9 @@ static int trf7970a_probe(struct spi_device *spi)
1315 nfc_digital_set_drvdata(trf->ddev, trf); 1328 nfc_digital_set_drvdata(trf->ddev, trf);
1316 spi_set_drvdata(spi, trf); 1329 spi_set_drvdata(spi, trf);
1317 1330
1318 pm_runtime_set_autosuspend_delay(trf->dev, TRF7970A_AUTOSUSPEND_DELAY); 1331 autosuspend_delay = trf7970a_get_autosuspend_delay(np);
1332
1333 pm_runtime_set_autosuspend_delay(trf->dev, autosuspend_delay);
1319 pm_runtime_use_autosuspend(trf->dev); 1334 pm_runtime_use_autosuspend(trf->dev);
1320 pm_runtime_enable(trf->dev); 1335 pm_runtime_enable(trf->dev);
1321 1336