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

Commit 9681a3d1 authored by Karthik Poosa's avatar Karthik Poosa Committed by Bhuvan Varshney
Browse files

NFC: Fix device bootup issue



NFCC device probe was getting blocked as it was
waiting for interrupt from NFCC.

Added timeout waiting for interrupt during device probe.

Change-Id: I3685615b108e2535cd0e62934b4e7a5bc5d742fe
Signed-off-by: default avatarKarthik Poosa <kpoosa2@codeaurora.org>
parent f84134c2
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
#ifdef CONFIG_COMPAT
#include <linux/compat.h>
#endif
#include <linux/jiffies.h>

struct nqx_platform_data {
	unsigned int irq_gpio;
@@ -51,6 +52,7 @@ MODULE_DEVICE_TABLE(of, msm_match_table);
#define NCI_RESET_NTF_LEN		13
#define NCI_GET_VERSION_CMD_LEN		8
#define NCI_GET_VERSION_RSP_LEN		12
#define MAX_IRQ_WAIT_TIME		(90)	//in ms

struct nqx_dev {
	wait_queue_head_t	read_wq;
@@ -896,8 +898,9 @@ static int nfcc_hw_check(struct i2c_client *client, struct nqx_dev *nqx_dev)
		goto err_nfcc_reset_failed;
	}
	nqx_enable_irq(nqx_dev);
	ret = wait_event_interruptible(nqx_dev->read_wq, !nqx_dev->irq_enabled);
	if (ret < 0) {
	ret = wait_event_interruptible_timeout(nqx_dev->read_wq,
		!nqx_dev->irq_enabled, msecs_to_jiffies(MAX_IRQ_WAIT_TIME));
	if (ret <= 0) {
		nqx_disable_irq(nqx_dev);
		goto err_nfcc_hw_check;
	}
@@ -913,8 +916,9 @@ static int nfcc_hw_check(struct i2c_client *client, struct nqx_dev *nqx_dev)
		goto err_nfcc_hw_check;
	}
	nqx_enable_irq(nqx_dev);
	ret = wait_event_interruptible(nqx_dev->read_wq, !nqx_dev->irq_enabled);
	if (ret < 0) {
	ret = wait_event_interruptible_timeout(nqx_dev->read_wq,
		!nqx_dev->irq_enabled, msecs_to_jiffies(MAX_IRQ_WAIT_TIME));
	if (ret <= 0) {
		nqx_disable_irq(nqx_dev);
		goto err_nfcc_hw_check;
	}