NFC: nfcmrvl: Add setup handler
authorAmitkumar Karwar <akarwar@marvell.com>
Mon, 6 Jan 2014 20:58:20 +0000 (12:58 -0800)
committerSamuel Ortiz <sameo@linux.intel.com>
Tue, 7 Jan 2014 00:32:41 +0000 (01:32 +0100)
Marvell nfc device provides support for external coexistance
control. It allows Device Host to inhibit the NFCC from polling
when required by asserting a GPIO pin. A second pin allows the
DH to have feedback on the current NFCC state.

The required configuration for this feature is done in setup
handler.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
drivers/nfc/nfcmrvl/main.c
drivers/nfc/nfcmrvl/nfcmrvl.h

index 396fc270ffc3eb78f49a4e0959f94b55c2f11ad8..5f91d45714299848f2f11c9891884c02947b2256 100644 (file)
@@ -66,10 +66,25 @@ static int nfcmrvl_nci_send(struct nci_dev *ndev, struct sk_buff *skb)
        return priv->if_ops->nci_send(priv, skb);
 }
 
+static int nfcmrvl_nci_setup(struct nci_dev *ndev)
+{
+       __u8 val;
+
+       val = NFCMRVL_GPIO_PIN_NFC_NOT_ALLOWED;
+       nci_set_config(ndev, NFCMRVL_NOT_ALLOWED_ID, 1, &val);
+       val = NFCMRVL_GPIO_PIN_NFC_ACTIVE;
+       nci_set_config(ndev, NFCMRVL_ACTIVE_ID, 1, &val);
+       val = NFCMRVL_EXT_COEX_ENABLE;
+       nci_set_config(ndev, NFCMRVL_EXT_COEX_ID, 1, &val);
+
+       return 0;
+}
+
 static struct nci_ops nfcmrvl_nci_ops = {
        .open = nfcmrvl_nci_open,
        .close = nfcmrvl_nci_close,
        .send = nfcmrvl_nci_send,
+       .setup = nfcmrvl_nci_setup,
 };
 
 struct nfcmrvl_private *nfcmrvl_nci_register_dev(void *drv_data,
index a007175f77fe4f63e443d2a9a6a521dccab0a084..54c4a956bd450f1a340b155beff8643927fbaa61 100644 (file)
 /* Define private flags: */
 #define NFCMRVL_NCI_RUNNING                    1
 
+#define NFCMRVL_EXT_COEX_ID                    0xE0
+#define NFCMRVL_NOT_ALLOWED_ID                 0xE1
+#define NFCMRVL_ACTIVE_ID                      0xE2
+#define NFCMRVL_EXT_COEX_ENABLE                        1
+#define NFCMRVL_GPIO_PIN_NFC_NOT_ALLOWED       0xA
+#define NFCMRVL_GPIO_PIN_NFC_ACTIVE            0xB
 #define NFCMRVL_NCI_MAX_EVENT_SIZE             260
 
 struct nfcmrvl_private {