summaryrefslogtreecommitdiff
path: root/drivers/nfc
diff options
context:
space:
mode:
authorChristophe Ricard <christophe.ricard@gmail.com>2015-06-06 13:16:47 +0200
committerSamuel Ortiz <sameo@linux.intel.com>2015-06-09 00:34:24 +0200
commitdbd70b4046c8cdb7c8f5ffea9bdcae1a35e24df4 (patch)
treed3f19c7f8ac9233a74a442676ca0a3e2ba56a3a4 /drivers/nfc
parentcc1417eb24f154ed7a7cd8aa7018b80fa120b732 (diff)
downloadlwn-dbd70b4046c8cdb7c8f5ffea9bdcae1a35e24df4.tar.gz
lwn-dbd70b4046c8cdb7c8f5ffea9bdcae1a35e24df4.zip
NFC: st21nfcb: Add support for nci proprietary commands
On st21nfcb, nci proprietary commands are available to run specific chip operations (for example: power management) Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/nfc')
-rw-r--r--drivers/nfc/st21nfcb/st21nfcb.c21
-rw-r--r--drivers/nfc/st21nfcb/st21nfcb.h6
2 files changed, 27 insertions, 0 deletions
diff --git a/drivers/nfc/st21nfcb/st21nfcb.c b/drivers/nfc/st21nfcb/st21nfcb.c
index 12699fa0b1b9..50ad6d04f0f4 100644
--- a/drivers/nfc/st21nfcb/st21nfcb.c
+++ b/drivers/nfc/st21nfcb/st21nfcb.c
@@ -20,6 +20,8 @@
#include <linux/nfc.h>
#include <net/nfc/nci.h>
#include <net/nfc/nci_core.h>
+#include <linux/gpio.h>
+#include <linux/delay.h>
#include "st21nfcb.h"
#include "st21nfcb_se.h"
@@ -76,6 +78,23 @@ static __u32 st21nfcb_nci_get_rfprotocol(struct nci_dev *ndev,
NFC_PROTO_ISO15693_MASK : 0;
}
+static int st21nfcb_nci_prop_rsp_packet(struct nci_dev *ndev,
+ struct sk_buff *skb)
+{
+ __u8 status = skb->data[0];
+
+ nci_req_complete(ndev, status);
+ return 0;
+}
+
+static struct nci_prop_ops st21nfcb_nci_prop_ops[] = {
+ {
+ .opcode = nci_opcode_pack(NCI_GID_PROPRIETARY,
+ ST21NFCB_NCI_CORE_PROP),
+ .rsp = st21nfcb_nci_prop_rsp_packet,
+ },
+};
+
static struct nci_ops st21nfcb_nci_ops = {
.open = st21nfcb_nci_open,
.close = st21nfcb_nci_close,
@@ -88,6 +107,8 @@ static struct nci_ops st21nfcb_nci_ops = {
.hci_load_session = st21nfcb_hci_load_session,
.hci_event_received = st21nfcb_hci_event_received,
.hci_cmd_received = st21nfcb_hci_cmd_received,
+ .prop_ops = st21nfcb_nci_prop_ops,
+ .n_prop_ops = ARRAY_SIZE(st21nfcb_nci_prop_ops),
};
int st21nfcb_nci_probe(struct llt_ndlc *ndlc, int phy_headroom,
diff --git a/drivers/nfc/st21nfcb/st21nfcb.h b/drivers/nfc/st21nfcb/st21nfcb.h
index 5ef8a58c9839..7c12d9dd03d0 100644
--- a/drivers/nfc/st21nfcb/st21nfcb.h
+++ b/drivers/nfc/st21nfcb/st21nfcb.h
@@ -25,6 +25,12 @@
/* Define private flags: */
#define ST21NFCB_NCI_RUNNING 1
+#define ST21NFCB_NCI_CORE_PROP 0x01
+
+struct nci_mode_set_rsp {
+ u8 status;
+} __packed;
+
struct st21nfcb_nci_info {
struct llt_ndlc *ndlc;
unsigned long flags;