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

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: default avatarMark A. Greer <mgreer@animalcreek.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent 18422e68
...@@ -1221,12 +1221,25 @@ static struct nfc_digital_ops trf7970a_nfc_ops = { ...@@ -1221,12 +1221,25 @@ static struct nfc_digital_ops trf7970a_nfc_ops = {
.abort_cmd = trf7970a_abort_cmd, .abort_cmd = trf7970a_abort_cmd,
}; };
static int trf7970a_get_autosuspend_delay(struct device_node *np)
{
int autosuspend_delay, ret;
ret = of_property_read_u32(np, "autosuspend-delay", &autosuspend_delay);
if (ret)
autosuspend_delay = TRF7970A_AUTOSUSPEND_DELAY;
of_node_put(np);
return autosuspend_delay;
}
static int trf7970a_probe(struct spi_device *spi) 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 uvolts, ret; int uvolts, autosuspend_delay, ret;
if (!np) { if (!np) {
dev_err(&spi->dev, "No Device Tree entry\n"); dev_err(&spi->dev, "No Device Tree entry\n");
...@@ -1315,7 +1328,9 @@ static int trf7970a_probe(struct spi_device *spi) ...@@ -1315,7 +1328,9 @@ static int trf7970a_probe(struct spi_device *spi)
nfc_digital_set_drvdata(trf->ddev, trf); nfc_digital_set_drvdata(trf->ddev, trf);
spi_set_drvdata(spi, trf); spi_set_drvdata(spi, trf);
pm_runtime_set_autosuspend_delay(trf->dev, TRF7970A_AUTOSUSPEND_DELAY); autosuspend_delay = trf7970a_get_autosuspend_delay(np);
pm_runtime_set_autosuspend_delay(trf->dev, autosuspend_delay);
pm_runtime_use_autosuspend(trf->dev); pm_runtime_use_autosuspend(trf->dev);
pm_runtime_enable(trf->dev); pm_runtime_enable(trf->dev);
......
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