summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSaurabh Sengar <saurabh.truth@gmail.com>2015-12-21 00:29:30 +0530
committerSamuel Ortiz <sameo@linux.intel.com>2015-12-21 00:07:27 +0100
commita440f1aa74da9cb1a77afcfadb12e1d4a78e7e02 (patch)
treec7c8a2038df17d5ed4a0dc5d7d94d947d318d4d4
parentc6b5df0daf0ecbb986420ea7342a6bd9c71619a9 (diff)
downloadlinux-a440f1aa74da9cb1a77afcfadb12e1d4a78e7e02.tar.bz2
NFC: add rx delay sysfs parameter for nfcsim workqueue
added the rx delay parameter as a device tunable parameter. Signed-off-by: Saurabh Sengar <saurabh.truth@gmail.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
-rw-r--r--drivers/nfc/nfcsim.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/nfc/nfcsim.c b/drivers/nfc/nfcsim.c
index 26ac9e5fa1ab..93aaca586858 100644
--- a/drivers/nfc/nfcsim.c
+++ b/drivers/nfc/nfcsim.c
@@ -32,6 +32,8 @@
#define NFCSIM_POLL_TARGET 2
#define NFCSIM_POLL_DUAL (NFCSIM_POLL_INITIATOR | NFCSIM_POLL_TARGET)
+#define RX_DEFAULT_DELAY 5
+
struct nfcsim {
struct nfc_dev *nfc_dev;
@@ -51,6 +53,8 @@ struct nfcsim {
u8 initiator;
+ u32 rx_delay;
+
data_exchange_cb_t cb;
void *cb_context;
@@ -320,10 +324,9 @@ static int nfcsim_tx(struct nfc_dev *nfc_dev, struct nfc_target *target,
* If packet transmission occurs immediately between them, we have a
* non-stop flow of several tens of thousands SYMM packets per second
* and a burning cpu.
- *
- * TODO: Add support for a sysfs entry to control this delay.
*/
- queue_delayed_work(wq, &peer->recv_work, msecs_to_jiffies(5));
+ queue_delayed_work(wq, &peer->recv_work,
+ msecs_to_jiffies(dev->rx_delay));
mutex_unlock(&peer->lock);
@@ -461,6 +464,7 @@ static struct nfcsim *nfcsim_init_dev(void)
if (rc)
goto free_nfc_dev;
+ dev->rx_delay = RX_DEFAULT_DELAY;
return dev;
free_nfc_dev: