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

Commit bd019371 authored by Bhuvan Varshney's avatar Bhuvan Varshney
Browse files

NFC: Add recovery mechanism for i2_master_recv error



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

Change-Id: I03c36488ac521ee42335103758c8d5b02f33836a
Signed-off-by: default avatarBhuvan Varshney <bvarshne@codeaurora.org>
parent ae67c4e0
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -679,6 +679,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 raw_nci_reset_cmd[] =  {0x20, 0x00, 0x01, 0x00};
	unsigned char raw_nci_init_cmd[] =   {0x20, 0x01, 0x00};
	unsigned char nci_init_rsp[28];
@@ -686,6 +687,7 @@ static int nfcc_hw_check(struct i2c_client *client, struct nqx_dev *nqx_dev)
	unsigned char init_rsp_len = 0;
	unsigned int enable_gpio = nqx_dev->en_gpio;

reset_enable_gpio:
	/* making sure that the NFCC starts in a clean state. */
	gpio_set_value(enable_gpio, 0);/* ULPM: Disable */
	/* hardware dependent delay */
@@ -711,6 +713,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;
	}
	ret = nqx_standby_write(nqx_dev, raw_nci_init_cmd,