Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a440f1aa authored by Saurabh Sengar's avatar Saurabh Sengar Committed by Samuel Ortiz
Browse files

NFC: add rx delay sysfs parameter for nfcsim workqueue



added the rx delay parameter as a device tunable parameter.

Signed-off-by: default avatarSaurabh Sengar <saurabh.truth@gmail.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent c6b5df0d
Loading
Loading
Loading
Loading
+7 −3
Original line number Original line Diff line number Diff line
@@ -32,6 +32,8 @@
#define NFCSIM_POLL_TARGET	2
#define NFCSIM_POLL_TARGET	2
#define NFCSIM_POLL_DUAL	(NFCSIM_POLL_INITIATOR | NFCSIM_POLL_TARGET)
#define NFCSIM_POLL_DUAL	(NFCSIM_POLL_INITIATOR | NFCSIM_POLL_TARGET)


#define RX_DEFAULT_DELAY	5

struct nfcsim {
struct nfcsim {
	struct nfc_dev *nfc_dev;
	struct nfc_dev *nfc_dev;


@@ -51,6 +53,8 @@ struct nfcsim {


	u8 initiator;
	u8 initiator;


	u32 rx_delay;

	data_exchange_cb_t cb;
	data_exchange_cb_t cb;
	void *cb_context;
	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
	 * If packet transmission occurs immediately between them, we have a
	 * non-stop flow of several tens of thousands SYMM packets per second
	 * non-stop flow of several tens of thousands SYMM packets per second
	 * and a burning cpu.
	 * 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);
	mutex_unlock(&peer->lock);


@@ -461,6 +464,7 @@ static struct nfcsim *nfcsim_init_dev(void)
	if (rc)
	if (rc)
		goto free_nfc_dev;
		goto free_nfc_dev;


	dev->rx_delay = RX_DEFAULT_DELAY;
	return dev;
	return dev;


free_nfc_dev:
free_nfc_dev: