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

Commit 5524fcb9 authored by Bhuvan Varshney's avatar Bhuvan Varshney Committed by Gerrit - the friendly Code Review server
Browse files

NFC: Add recovery mechanism for i2_master_recv error



Added recovery mechanism by re-toggling the enable gpio
and repeat the process of core reset command.

Change-Id: I03c36488ac521ee42335103758c8d5b02f33836a
Signed-off-by: default avatarBhuvan Varshney <bvarshne@codeaurora.org>
parent 8d296426
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -676,6 +676,7 @@ static int nfcc_hw_check(struct i2c_client *client, struct nqx_dev *nqx_dev)
{
	int ret = 0;

	int gpio_retry_count = 0;
	unsigned char init_rsp_len = 0;
	unsigned int enable_gpio = nqx_dev->en_gpio;
	char *nci_reset_cmd = NULL;
@@ -707,6 +708,7 @@ static int nfcc_hw_check(struct i2c_client *client, struct nqx_dev *nqx_dev)
		goto done;
	}

reset_enable_gpio:
	/* making sure that the NFCC starts in a clean state. */
	gpio_set_value(enable_gpio, 0);/* ULPM: Disable */
	/* hardware dependent delay */
@@ -734,6 +736,9 @@ static int nfcc_hw_check(struct i2c_client *client, struct nqx_dev *nqx_dev)
	if (ret < 0) {
		dev_err(&client->dev,
		"%s: - i2c_master_recv Error\n", __func__);
		gpio_retry_count = gpio_retry_count + 1;
		if (gpio_retry_count < MAX_RETRY_COUNT)
			goto reset_enable_gpio;
		goto err_nfcc_hw_check;
	}
	nci_init_cmd[0] = 0x20;