summaryrefslogtreecommitdiffstats
path: root/drivers/nfc/trf7970a.c
diff options
context:
space:
mode:
authorMark A. Greer <mgreer@animalcreek.com>2014-09-02 15:12:23 -0700
committerSamuel Ortiz <sameo@linux.intel.com>2014-09-07 23:13:43 +0200
commita08e54549e743ea3704da939f92caf3eaa8471d3 (patch)
tree519f1465b5ae0711bcd3e6056c172a145afe6f51 /drivers/nfc/trf7970a.c
parent6c08df422ede7db94776b8099a5f43597629234c (diff)
downloadlinux-a08e54549e743ea3704da939f92caf3eaa8471d3.tar.bz2
NFC: trf7970a: Initialize when enabling RF
Currently, the trf7970a is reset & initialized only when the pm_runtime resume hook is called. Instead, initialize it every time the RF is enabled to ensure that the trf7970a is quiesced and in a known state before being set up for another RF technology. 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.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/nfc/trf7970a.c b/drivers/nfc/trf7970a.c
index 9c0549d4f276..ce9686c44350 100644
--- a/drivers/nfc/trf7970a.c
+++ b/drivers/nfc/trf7970a.c
@@ -823,10 +823,18 @@ static void trf7970a_switch_rf_off(struct trf7970a *trf)
static void trf7970a_switch_rf_on(struct trf7970a *trf)
{
+ int ret;
+
dev_dbg(trf->dev, "Switching rf on\n");
pm_runtime_get_sync(trf->dev);
+ ret = trf7970a_init(trf);
+ if (ret) {
+ dev_err(trf->dev, "%s - Can't initialize: %d\n", __func__, ret);
+ return;
+ }
+
trf->state = TRF7970A_ST_IDLE;
}
@@ -1473,12 +1481,6 @@ static int trf7970a_pm_runtime_resume(struct device *dev)
usleep_range(20000, 21000);
- ret = trf7970a_init(trf);
- if (ret) {
- dev_err(dev, "%s - Can't initialize: %d\n", __func__, ret);
- return ret;
- }
-
pm_runtime_mark_last_busy(dev);
return 0;