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

Commit 0421fe11 authored by Bhuvan Varshney's avatar Bhuvan Varshney
Browse files

NFC: Fix device node probing issue



Probing fails after retrying maximum times to
receive response for NCI core reset command.

Changed method of receiving response from poll
mode to interrupt mode to receive response of
the NCI commands sent.

Change-Id: I41b0fc8e99fc31fd8b573549a21087737f540ed8
Signed-off-by: default avatarBhuvan Varshney <bvarshne@codeaurora.org>
parent 2f79d07f
Loading
Loading
Loading
Loading
+15 −5
Original line number Diff line number Diff line
@@ -827,6 +827,9 @@ static int nfcc_hw_check(struct i2c_client *client, struct nqx_dev *nqx_dev)

reset_enable_gpio:
	/* making sure that the NFCC starts in a clean state. */
	gpio_set_value(enable_gpio, 1);/* HPD : Enable*/
	/* hardware dependent delay */
	usleep_range(10000, 10100);
	gpio_set_value(enable_gpio, 0);/* ULPM: Disable */
	/* hardware dependent delay */
	usleep_range(10000, 10100);
@@ -892,8 +895,12 @@ static int nfcc_hw_check(struct i2c_client *client, struct nqx_dev *nqx_dev)
		}
		goto err_nfcc_reset_failed;
	}
	/* hardware dependent delay */
	msleep(30);
	nqx_enable_irq(nqx_dev);
	ret = wait_event_interruptible(nqx_dev->read_wq, !nqx_dev->irq_enabled);
	if (ret < 0) {
		nqx_disable_irq(nqx_dev);
		goto err_nfcc_hw_check;
	}

	/* Read Response of RESET command */
	ret = i2c_master_recv(client, nci_reset_rsp, NCI_RESET_RSP_LEN);
@@ -905,9 +912,12 @@ static int nfcc_hw_check(struct i2c_client *client, struct nqx_dev *nqx_dev)
			goto reset_enable_gpio;
		goto err_nfcc_hw_check;
	}

	/* hardware dependent delay */
	msleep(30);
	nqx_enable_irq(nqx_dev);
	ret = wait_event_interruptible(nqx_dev->read_wq, !nqx_dev->irq_enabled);
	if (ret < 0) {
		nqx_disable_irq(nqx_dev);
		goto err_nfcc_hw_check;
	}

	/* Read Notification of RESET command */
	ret = i2c_master_recv(client, nci_reset_ntf, NCI_RESET_NTF_LEN);