NFC: pn533: Enable AUTO RFCA
authorSamuel Ortiz <sameo@linux.intel.com>
Mon, 1 Jul 2013 15:26:58 +0000 (17:26 +0200)
committerSamuel Ortiz <sameo@linux.intel.com>
Tue, 13 Aug 2013 22:35:18 +0000 (00:35 +0200)
The AUTO RFCA bit forbids the pn533 chipset to turn its radio on
whenever an external field is present.
Without this bit set, some devices seems to get over flood by the
pn533 rf field and thus become hardly detectable.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
drivers/nfc/pn533.c

index ff3e19dcc7c5824667014315f7b2fb565581b621..125d995c11a9e6553b5c5336e011d521910b324b 100644 (file)
@@ -168,8 +168,9 @@ struct pn533_fw_version {
 #define PN533_CFGITEM_MAX_RETRIES 0x05
 #define PN533_CFGITEM_PASORI      0x82
 
-#define PN533_CFGITEM_RF_FIELD_ON  0x1
-#define PN533_CFGITEM_RF_FIELD_OFF 0x0
+#define PN533_CFGITEM_RF_FIELD_AUTO_RFCA 0x2
+#define PN533_CFGITEM_RF_FIELD_ON        0x1
+#define PN533_CFGITEM_RF_FIELD_OFF       0x0
 
 #define PN533_CONFIG_TIMING_102 0xb
 #define PN533_CONFIG_TIMING_204 0xc
@@ -1696,7 +1697,7 @@ static void pn533_wq_rf(struct work_struct *work)
                return;
 
        *skb_put(skb, 1) = PN533_CFGITEM_RF_FIELD;
-       *skb_put(skb, 1) = 0;
+       *skb_put(skb, 1) = PN533_CFGITEM_RF_FIELD_AUTO_RFCA;
 
        rc = pn533_send_cmd_async(dev, PN533_CMD_RF_CONFIGURATION, skb,
                                  pn533_rf_complete, NULL);
@@ -2598,6 +2599,8 @@ static int pn533_rf_field(struct nfc_dev *nfc_dev, u8 rf)
        u8 rf_field = !!rf;
        int rc;
 
+       rf_field |= PN533_CFGITEM_RF_FIELD_AUTO_RFCA;
+
        rc = pn533_set_configuration(dev, PN533_CFGITEM_RF_FIELD,
                                     (u8 *)&rf_field, 1);
        if (rc) {