diff options
author | Rohit Rangwani <rrangwan@codeaurora.org> | 2017-10-09 17:36:51 +0530 |
---|---|---|
committer | Rohit Rangwani <rrangwan@codeaurora.org> | 2017-11-02 12:22:21 +0530 |
commit | cc0a4ac3f0d41f515a215a4c4290fedbdfdc0a2a (patch) | |
tree | ea99a43f2c0f69f0cc4100fec30e4e854ca40f01 | |
parent | fc5b771a74b50b15c781142b711a7ae2cd9cbf3e (diff) | |
download | android_vendor_nxp_opensource_packages_apps_Nfc-cc0a4ac3f0d41f515a215a4c4290fedbdfdc0a2a.tar.gz android_vendor_nxp_opensource_packages_apps_Nfc-cc0a4ac3f0d41f515a215a4c4290fedbdfdc0a2a.tar.bz2 android_vendor_nxp_opensource_packages_apps_Nfc-cc0a4ac3f0d41f515a215a4c4290fedbdfdc0a2a.zip |
NFC: Fix delay in NFC enable in NQ2xx devices
Delay in NFC enable seen due to failure to configure SWP1A
in NQ2xx devices. Only encountered when ESE not present
NFCEE notfication received and set configuration command
to disable all SWPs is sent
Changes done to dynamically modify set/get SWP configuration
based on chipid
Change-Id: I823ceb2fd3b37df0c8c3af49f19ebb141995f916
-rw-r--r-- | nci/jni/NativeNxpFeature.cpp | 18 | ||||
-rw-r--r-- | nci/jni/extns/pn54x/src/utils/phNxpConfig.cpp | 16 |
2 files changed, 19 insertions, 15 deletions
diff --git a/nci/jni/NativeNxpFeature.cpp b/nci/jni/NativeNxpFeature.cpp index 170575c8..172d8ba0 100644 --- a/nci/jni/NativeNxpFeature.cpp +++ b/nci/jni/NativeNxpFeature.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2017, The Linux Foundation. All rights reserved. * Not a Contribution. * * Copyright (C) 2015 NXP Semiconductors @@ -664,12 +664,14 @@ tNFA_STATUS GetNumNFCEEConfigured(void) uint8_t cmd_buf_len = 0x08; uint8_t num_config_params = 0x02; uint8_t config_param_len = 0x05; - uint8_t buf_offset = 0x08; - cmd_buf[buf_offset++] = NXP_NFC_SET_CONFIG_PARAM_EXT; - cmd_buf[buf_offset++] = NXP_NFC_PARAM_ID_SWP1A; - cmd_buf_len += 0x02; - num_config_params++; - config_param_len += 0x02; + if ((nfcFL.chipType == pn551) || (nfcFL.chipType == pn553) || (nfcFL.chipType == pn557)) { + uint8_t buf_offset = 0x08; + cmd_buf[buf_offset++] = NXP_NFC_SET_CONFIG_PARAM_EXT; + cmd_buf[buf_offset++] = NXP_NFC_PARAM_ID_SWP1A; + cmd_buf_len += 0x02; + num_config_params++; + config_param_len += 0x02; + } cmd_buf[2] = config_param_len; cmd_buf[3] = num_config_params; @@ -842,7 +844,7 @@ tNFA_STATUS enableSWPInterface() SetCbStatus(NFA_STATUS_FAILED); { SyncEventGuard guard (gnxpfeature_conf.NxpFeatureConfigEvt); - if(nfcFL.nfccFL._NFC_NXP_STAT_DUAL_UICC_WO_EXT_SWITCH) { + if ((nfcFL.chipType == pn551) || (nfcFL.chipType == pn553) || (nfcFL.chipType == pn557)) { status = NFA_SendNxpNciCommand(sizeof(dual_uicc_cmd_buf), dual_uicc_cmd_buf, NxpResponse_Cb); } diff --git a/nci/jni/extns/pn54x/src/utils/phNxpConfig.cpp b/nci/jni/extns/pn54x/src/utils/phNxpConfig.cpp index b82b3ffe..ce6fb2aa 100644 --- a/nci/jni/extns/pn54x/src/utils/phNxpConfig.cpp +++ b/nci/jni/extns/pn54x/src/utils/phNxpConfig.cpp @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright (c) 2016, The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2017, The Linux Foundation. All rights reserved. * Not a Contribution. * * Copyright (C) 2011-2012 Broadcom Corporation @@ -62,7 +62,6 @@ #include <cutils/log.h> #include <cutils/properties.h> #include <errno.h> - #if GENERIC_TARGET const char alternative_config_path[] = "/data/nfc/"; #else @@ -294,6 +293,7 @@ int CNxpNfcConfig::getconfiguration_id(char *config_file) int config_id = QRD_TYPE_DEFAULT; char target_type[MAX_SOC_INFO_NAME_LEN] = {'\0'}; char soc_info[MAX_SOC_INFO_NAME_LEN] = {'\0'}; + bool nq2xx_present = false; char nq_chipid[PROPERTY_VALUE_MAX] = {0}; char nq_fw_ver[PROPERTY_VALUE_MAX] = {0}; string strPath; @@ -312,13 +312,15 @@ int CNxpNfcConfig::getconfiguration_id(char *config_file) ALOGE("get_soc_info(HW_PLATFORM) fail!\n"); return DEFAULT_CONFIG; } - rc = __system_property_get("sys.nfc.nq.chipid", nq_chipid); if (rc <= 0) ALOGE("get sys.nfc.nq.chipid fail, rc = %d\n", rc); else ALOGD("sys.nfc.nq.chipid = %s\n", nq_chipid); + nq2xx_present = (!strncmp(nq_chipid, NQ220, PROPERTY_VALUE_MAX)) + || (!strncmp(nq_chipid, NQ210, PROPERTY_VALUE_MAX)); + rc = __system_property_get("sys.nfc.nq.fwver", nq_fw_ver); if (rc <= 0) ALOGE("get sys.nfc.nq.fwver fail, rc = %d\n", rc); @@ -356,7 +358,7 @@ int CNxpNfcConfig::getconfiguration_id(char *config_file) case TARGET_MSM8937: case TARGET_MSM8940: case TARGET_MSM8917: - if ((!strncmp(nq_chipid, NQ220, PROPERTY_VALUE_MAX)) || (!strncmp(nq_chipid, NQ210, PROPERTY_VALUE_MAX))) { + if (nq2xx_present) { // NQ210 or NQ220 config_id = QRD_TYPE_DEFAULT; strlcpy(config_file, config_name_qrd, MAX_DATA_CONFIG_PATH_LEN); @@ -384,7 +386,7 @@ int CNxpNfcConfig::getconfiguration_id(char *config_file) case TARGET_MSM8997: case TARGET_SDM660: case TARGET_SDM630: - if ((!strncmp(nq_chipid, NQ220, PROPERTY_VALUE_MAX)) || (!strncmp(nq_chipid, NQ210, PROPERTY_VALUE_MAX))) { + if (nq2xx_present) { // NQ210 or NQ220 config_id = QRD_TYPE_2; strlcpy(config_file, config_name_qrd2, MAX_DATA_CONFIG_PATH_LEN); @@ -410,7 +412,7 @@ int CNxpNfcConfig::getconfiguration_id(char *config_file) case TARGET_MSM8937: case TARGET_MSM8940: case TARGET_MSM8917: - if ((!strncmp(nq_chipid, NQ220, PROPERTY_VALUE_MAX)) || (!strncmp(nq_chipid, NQ210, PROPERTY_VALUE_MAX))) { + if (nq2xx_present) { // NQ210 or NQ220 config_id = MTP_TYPE_DEFAULT; strlcpy(config_file, config_name_mtp, MAX_DATA_CONFIG_PATH_LEN); @@ -433,7 +435,7 @@ int CNxpNfcConfig::getconfiguration_id(char *config_file) case TARGET_MSM8997: case TARGET_SDM660: case TARGET_SDM630: - if ((!strncmp(nq_chipid, NQ220, PROPERTY_VALUE_MAX)) || (!strncmp(nq_chipid, NQ210, PROPERTY_VALUE_MAX))) { + if (nq2xx_present) { // NQ210 or NQ220 config_id = MTP_TYPE_1; strlcpy(config_file, config_name_mtp1, MAX_DATA_CONFIG_PATH_LEN); |