aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/nfc
diff options
context:
space:
mode:
authorMark A. Greer <mgreer@animalcreek.com>2014-03-25 11:54:37 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2014-04-21 18:37:27 -0400
commita1d2dc5b407ae18b59b7a129c93c8eb5ad7b1c80 (patch)
treea7ea854f277bd046f7c399e09466e3dcda9ea7d7 /drivers/nfc
parentebcc5a0d08e6a680558ed74f5dd724427ff5a29b (diff)
NFC: trf7970a: Turn RF on after hardware is configured
The NFC digital layer calls the 'switch_rf' hook to turn the RF on before it configures the RF technology and framing. There is potential to confuse a tag doing it this way so don't enable the RF until the RF technology and initial framing have been configured. 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.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/drivers/nfc/trf7970a.c b/drivers/nfc/trf7970a.c
index 203d86fb1d54..0a46348f9af6 100644
--- a/drivers/nfc/trf7970a.c
+++ b/drivers/nfc/trf7970a.c
@@ -779,11 +779,6 @@ static int trf7970a_init(struct trf7970a *trf)
779 779
780 trf->special_fcn_reg1 = 0; 780 trf->special_fcn_reg1 = 0;
781 781
782 ret = trf7970a_write(trf, TRF7970A_CHIP_STATUS_CTRL,
783 trf->chip_status_ctrl | TRF7970A_CHIP_STATUS_RF_ON);
784 if (ret)
785 goto err_out;
786
787 trf->iso_ctrl = 0xff; 782 trf->iso_ctrl = 0xff;
788 return 0; 783 return 0;
789 784
@@ -796,6 +791,10 @@ static void trf7970a_switch_rf_off(struct trf7970a *trf)
796{ 791{
797 dev_dbg(trf->dev, "Switching rf off\n"); 792 dev_dbg(trf->dev, "Switching rf off\n");
798 793
794 trf->chip_status_ctrl &= ~TRF7970A_CHIP_STATUS_RF_ON;
795
796 trf7970a_write(trf, TRF7970A_CHIP_STATUS_CTRL, trf->chip_status_ctrl);
797
799 gpio_set_value(trf->en_gpio, 0); 798 gpio_set_value(trf->en_gpio, 0);
800 gpio_set_value(trf->en2_gpio, 0); 799 gpio_set_value(trf->en2_gpio, 0);
801 800
@@ -948,6 +947,18 @@ static int trf7970a_config_framing(struct trf7970a *trf, int framing)
948 return ret; 947 return ret;
949 } 948 }
950 949
950 if (!(trf->chip_status_ctrl & TRF7970A_CHIP_STATUS_RF_ON)) {
951 ret = trf7970a_write(trf, TRF7970A_CHIP_STATUS_CTRL,
952 trf->chip_status_ctrl |
953 TRF7970A_CHIP_STATUS_RF_ON);
954 if (ret)
955 return ret;
956
957 trf->chip_status_ctrl |= TRF7970A_CHIP_STATUS_RF_ON;
958
959 usleep_range(5000, 6000);
960 }
961
951 return 0; 962 return 0;
952} 963}
953 964