Merge "Merge branch 'caf/driver/br_android_ncihalx_comm_13' into nfc-driver.lnx.13.0"

This commit is contained in:
Linux Build Service Account
2022-03-31 14:04:25 -07:00
committed by Gerrit - the friendly Code Review server
2 changed files with 21 additions and 30 deletions

View File

@@ -1,6 +1,6 @@
/****************************************************************************** /******************************************************************************
* Copyright (C) 2015, The Linux Foundation. All rights reserved. * Copyright (C) 2015, The Linux Foundation. All rights reserved.
* Copyright (C) 2019-2021 NXP * Copyright (C) 2019-2022 NXP
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -92,12 +92,8 @@
#define NCI_CMD_RSP_TIMEOUT_MS (2000) #define NCI_CMD_RSP_TIMEOUT_MS (2000)
/* Time to wait for NFCC to be ready again after any change in the GPIO */ /* Time to wait for NFCC to be ready again after any change in the GPIO */
#define NFC_GPIO_SET_WAIT_TIME_US (10000) #define NFC_GPIO_SET_WAIT_TIME_US (10000)
/*Time to wait after soft reset via any NCI/DL cmd*/ /* Time to wait before retrying writes */
#define NFC_SOFT_RESET_WAIT_TIME_USEC (5000) #define WRITE_RETRY_WAIT_TIME_US (3000)
/* Time to wait for IRQ low during write 5*3ms */
#define NFC_WRITE_IRQ_WAIT_TIME_US (3000)
/* Time to wait before retrying i2c/I3C writes */
#define WRITE_RETRY_WAIT_TIME_US (1000)
/* Time to wait before retrying read for some specific usecases */ /* Time to wait before retrying read for some specific usecases */
#define READ_RETRY_WAIT_TIME_US (3500) #define READ_RETRY_WAIT_TIME_US (3500)
#define NFC_MAGIC (0xE9) #define NFC_MAGIC (0xE9)

View File

@@ -1,6 +1,6 @@
/****************************************************************************** /******************************************************************************
* Copyright (C) 2015, The Linux Foundation. All rights reserved. * Copyright (C) 2015, The Linux Foundation. All rights reserved.
* Copyright (C) 2013-2021 NXP * Copyright (C) 2013-2022 NXP
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -237,8 +237,8 @@ int i2c_write(struct nfc_dev *nfc_dev, const char *buf, size_t count,
for (retry_cnt = 1; retry_cnt <= MAX_WRITE_IRQ_COUNT; retry_cnt++) { for (retry_cnt = 1; retry_cnt <= MAX_WRITE_IRQ_COUNT; retry_cnt++) {
if (gpio_get_value(nfc_gpio->irq)) { if (gpio_get_value(nfc_gpio->irq)) {
pr_warn("%s: irq high during write, wait\n", __func__); pr_warn("%s: irq high during write, wait\n", __func__);
usleep_range(NFC_WRITE_IRQ_WAIT_TIME_US, usleep_range(WRITE_RETRY_WAIT_TIME_US,
NFC_WRITE_IRQ_WAIT_TIME_US + 100); WRITE_RETRY_WAIT_TIME_US + 100);
} else { } else {
break; break;
} }
@@ -336,27 +336,27 @@ int nfc_i2c_dev_probe(struct i2c_client *client, const struct i2c_device_id *id)
int ret = 0; int ret = 0;
struct nfc_dev *nfc_dev = NULL; struct nfc_dev *nfc_dev = NULL;
struct i2c_dev *i2c_dev = NULL; struct i2c_dev *i2c_dev = NULL;
struct platform_configs nfc_configs; struct platform_configs *nfc_configs = NULL;
struct platform_gpio *nfc_gpio = &nfc_configs.gpio; struct platform_gpio *nfc_gpio = NULL;
pr_debug("%s: enter\n", __func__); pr_debug("%s: enter\n", __func__);
/* retrieve details of gpios from dt */
ret = nfc_parse_dt(&client->dev, &nfc_configs, PLATFORM_IF_I2C);
if (ret) {
pr_err("%s: failed to parse dt\n", __func__);
goto err;
}
if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
pr_err("%s: need I2C_FUNC_I2C\n", __func__);
ret = -ENODEV;
goto err;
}
nfc_dev = kzalloc(sizeof(struct nfc_dev), GFP_KERNEL); nfc_dev = kzalloc(sizeof(struct nfc_dev), GFP_KERNEL);
if (nfc_dev == NULL) { if (nfc_dev == NULL) {
ret = -ENOMEM; ret = -ENOMEM;
goto err; goto err;
} }
nfc_configs = &nfc_dev->configs;
nfc_gpio = &nfc_configs->gpio;
/* retrieve details of gpios from dt */
ret = nfc_parse_dt(&client->dev,nfc_configs, PLATFORM_IF_I2C);
if (ret) {
pr_err("%s: failed to parse dt\n", __func__);
goto err_free_nfc_dev;
}
if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
pr_err("%s: need I2C_FUNC_I2C\n", __func__);
ret = -ENODEV;
goto err_free_nfc_dev;
}
nfc_dev->read_kbuf = kzalloc(MAX_NCI_BUFFER_SIZE, GFP_DMA | GFP_KERNEL); nfc_dev->read_kbuf = kzalloc(MAX_NCI_BUFFER_SIZE, GFP_DMA | GFP_KERNEL);
if (!nfc_dev->read_kbuf) { if (!nfc_dev->read_kbuf) {
ret = -ENOMEM; ret = -ENOMEM;
@@ -393,11 +393,6 @@ int nfc_i2c_dev_probe(struct i2c_client *client, const struct i2c_device_id *id)
pr_err("%s: unable to request nfc firm downl gpio [%d]\n", pr_err("%s: unable to request nfc firm downl gpio [%d]\n",
__func__, nfc_gpio->dwl_req); __func__, nfc_gpio->dwl_req);
} }
/* copy the retrieved gpio details from DT */
memcpy(&nfc_dev->configs, &nfc_configs,
sizeof(struct platform_configs));
/* init mutex and queues */ /* init mutex and queues */
init_waitqueue_head(&nfc_dev->read_wq); init_waitqueue_head(&nfc_dev->read_wq);
mutex_init(&nfc_dev->read_mutex); mutex_init(&nfc_dev->read_mutex);