Snap for 12272146 from 06cddbc2ec57c0c62865517f4aba45e39bdc9b67 to 24Q4-release Change-Id: Ia4ee656acd71ccfe06482c57153eec29a429e51d
diff --git a/halimpl/config/README.md b/halimpl/config/README.md index de62154..67c6a53 100644 --- a/halimpl/config/README.md +++ b/halimpl/config/README.md
@@ -70,6 +70,8 @@ * if the file path has `<country>` in it, `<country>` part will be replaced with country code (or region string) * if the file path has `<sku>` in it, `<sku>` part will be replace with the 'persist.vendor.uwb.cal.sku' property value. if `persist.vendor.uwb.cal.sku` is unspecified, HAL will try to use `defaultsku` as a default. +* if the file path has `<revision>` in it, `<revision>` part will be replace with the 'persist.vendor.uwb.cal.revision' property value. + if `persist.vendor.uwb.cal.revision` is unspecified, HAL will try to use `defaultrevision` as a default. Example: @@ -79,7 +81,8 @@ EXTRA_CONF_PATH_1="/vendor/etc/uwb/cal-base.conf" EXTRA_CONF_PATH_2="/vendor/etc/uwb/cal-<sku>.conf" EXTRA_CONF_PATH_3="/vendor/etc/uwb/cal-<country>.conf" -EXTRA_CONF_PATH_4="/mnt/vendor/persist/uwb/cal-factory.conf" +EXTRA_CONF_PATH_4="/vendor/etc/uwb/cal-<revision>.conf" +EXTRA_CONF_PATH_5="/mnt/vendor/persist/uwb/cal-factory.conf" ``` #### Region mapping @@ -131,9 +134,33 @@ e.g. `cal.xtal={11 00 11 00 3f 00}` -##### *cal.ant`<antenna-id>`.ch`<channel-number>`.ant_delay*`=<16bit unsigned>` +##### RX antenna delay -Per-country, RX antenna delay value in Q14.2. e.g. `cal.ant1.ch5.ant_delay=2000` +* *cal.ant`<antenna-id>`.ch`<channel-number>`.ant_delay*`=<16bit unsigned>` + + Default RX antenna delay value in Q14.2. + +* *cal.ant`<antenna-id>`.ch`<channel-number>`.ant_delay.force_version*`=<16bit unsigned>` + + Forcefully override *...ant_delay* value by specifying version number. + Platform can specify multiple version numbers for selecting alternate delay values + using *...ant_delay.force_value.`<version>`* property. + +* *cal.ant`<antenna-id>`.ch`<channel-number>`.ant_delay.force_value.`<version>`*`=<16bit unsigned>` + + Alternate RX antenna delay value in Q14.2. + HAL will take this value if *...ant_delay.force_version=`<version>`* and + and *ant_delay.force_value.`<version>`* are provided. + +e.g. +``` +cal.ant1.ch5.ant_delay=2000 +cal.ant1.ch5.ant_delay.force_version=2 +cal.ant1.cht.ant_delay.force_value.1=2100 +cal.ant1.cht.ant_delay.force_value.2=2200 +``` + +In the above example, HAL applies 2200 for the antenna delay. ##### *cal.ant`<antenna-id>`.ch`<channel-number>`.tx_power*`=<byte array>` @@ -165,7 +192,8 @@ EXTRA_CONF_PATH_1="/vendor/etc/uwb/cal-base.conf" EXTRA_CONF_PATH_2="/vendor/etc/uwb/cal-<sku>.conf" EXTRA_CONF_PATH_3="/vendor/etc/uwb/cal-<country>.conf" -EXTRA_CONF_PATH_4="/mnt/vendor/persist/uwb/cal-factory.conf" +EXTRA_CONF_PATH_4="/vendor/etc/uwb/cal-<sku>-<revision>.conf" +EXTRA_CONF_PATH_5="/mnt/vendor/persist/uwb/cal-factory.conf" # /vendor/etc/uwb/cal-base.conf: cal.rx_antenna_mask=0x03 @@ -205,4 +233,9 @@ CE="AT BE BG CH CY CZ DE DK EE ES FI FR GB GR HR HU IE IS IT LI LV LT LU MT NI NL NO PL PT RO SE SK SI" FCC="US CA" RESTRICTED="AR AM AZ BY ID KZ KG NP PK PY RU SB TJ TM UA UZ" + +# /vendor/etc/uwb/cal-modelA-EVT.conf: +# effective when persist.vendor.uwb.cal.sku=modelA && persist.vendor.uwb.cal.revision=EVT +cal.ant1.ch5.tx_power={02, 00, 11, 00} +cal.ant1.ch9.tx_power={02, 00, 12, 00} ```
diff --git a/halimpl/hal/phNxpUciHal_ext.cc b/halimpl/hal/phNxpUciHal_ext.cc index 21776f8..f5cc90d 100644 --- a/halimpl/hal/phNxpUciHal_ext.cc +++ b/halimpl/hal/phNxpUciHal_ext.cc
@@ -572,14 +572,35 @@ continue; const uint8_t ant_id = i + 1; - uint16_t delay_value; - char key[32]; - std::snprintf(key, sizeof(key), "cal.ant%u.ch%u.ant_delay", ant_id, ch); - if (!NxpConfig_GetNum(key, &delay_value, 2)) + uint16_t delay_value, version_value; + bool value_provided = false; + + const std::string key_ant_delay = std::format("cal.ant{}.ch{}.ant_delay", ant_id, ch); + const std::string key_force_version = key_ant_delay + std::format(".force_version", ant_id, ch); + + // 1) try cal.ant{N}.ch{N}.ant_delay.force_value.{N} + if (NxpConfig_GetNum(key_force_version.c_str(), &version_value, 2)) { + const std::string key_force_value = key_ant_delay + std::format(".force_value.{}", ant_id, ch, version_value); + if (NxpConfig_GetNum(key_force_value.c_str(), &delay_value, 2)) { + value_provided = true; + NXPLOG_UCIHAL_D("Apply RX_ANT_DELAY_CALIB %s = %u", key_force_value.c_str(), delay_value); + } + } + + // 2) try cal.ant{N}.ch{N}.ant_delay + if (!value_provided) { + if (NxpConfig_GetNum(key_ant_delay.c_str(), &delay_value, 2)) { + value_provided = true; + NXPLOG_UCIHAL_D("Apply RX_ANT_DELAY_CALIB: %s = %u", key_ant_delay.c_str(), delay_value); + } + } + + if (!value_provided) { + NXPLOG_UCIHAL_V("%s was not provided from configuration files.", key_ant_delay.c_str()); continue; + } - NXPLOG_UCIHAL_D("Apply RX_ANT_DELAY_CALIB: %s = %u", key, delay_value); entries.push_back(ant_id); // Little Endian entries.push_back(delay_value & 0xff);
diff --git a/halimpl/utils/phNxpConfig.cc b/halimpl/utils/phNxpConfig.cc index ad6faf3..b929a03 100644 --- a/halimpl/utils/phNxpConfig.cc +++ b/halimpl/utils/phNxpConfig.cc
@@ -50,12 +50,17 @@ static const char country_code_specifier[] = "<country>"; static const char sku_specifier[] = "<sku>"; static const char extid_specifier[] = "<extid>"; +static const char revision_specifier[] = "<revision>"; + static const char extid_config_name[] = "cal.extid"; static const char extid_default_value[] = "defaultextid"; static const char prop_name_calsku[] = "persist.vendor.uwb.cal.sku"; static const char prop_default_calsku[] = "defaultsku"; +static const char prop_name_revision[] = "persist.vendor.uwb.cal.revision"; +static const char prop_default_revision[] = "defaultrevision"; + using namespace::std; class uwbParam @@ -660,10 +665,12 @@ string mCurSku; string mCurExtid; string mCurRegionCode; + string mCurRevision; void reset() { mCurSku.clear(); mCurExtid.clear(); mCurRegionCode.clear(); + mCurRevision.clear(); } }; ExtraConfPathSpecifiers mExtraConfSpecifiers; @@ -693,27 +700,28 @@ bool updated = false; for (auto& [filename, config] : mExtraConfig) { - auto posSku = filename.find(sku_specifier); - auto posExtid = filename.find(extid_specifier); - auto posCountry = filename.find(country_code_specifier); - - if (posSku == std::string::npos && posExtid == std::string::npos && posCountry == std::string::npos) - continue; - std::string new_filename(filename); + auto posSku = filename.find(sku_specifier); if (posSku != std::string::npos && !mExtraConfSpecifiers.mCurSku.empty()) { new_filename.replace(posSku, strlen(sku_specifier), mExtraConfSpecifiers.mCurSku); } + + auto posExtid = filename.find(extid_specifier); if (posExtid != std::string::npos && !mExtraConfSpecifiers.mCurExtid.empty()) { - posExtid = new_filename.find(extid_specifier); new_filename.replace(posExtid, strlen(extid_specifier), mExtraConfSpecifiers.mCurExtid); } + + auto posCountry = filename.find(country_code_specifier); if (posCountry != std::string::npos && !mExtraConfSpecifiers.mCurRegionCode.empty()) { - posCountry = new_filename.find(country_code_specifier); new_filename.replace(posCountry, strlen(country_code_specifier), mExtraConfSpecifiers.mCurRegionCode); } + auto posRevision = filename.find(revision_specifier); + if (posRevision != std::string::npos && !mExtraConfSpecifiers.mCurRevision.empty()) { + new_filename.replace(posRevision, strlen(revision_specifier), mExtraConfSpecifiers.mCurRevision); + } + // re-open the file if filepath got re-evaluated. if (new_filename != config.getFilePath()) { config.open(new_filename.c_str()); @@ -750,7 +758,9 @@ } char sku_value[PROPERTY_VALUE_MAX]; + char revision_value[PROPERTY_VALUE_MAX]; property_get(prop_name_calsku, sku_value, prop_default_calsku); + property_get(prop_name_revision, revision_value, prop_default_revision); // Read EXTRA_CONF_PATH[N] for (int i = 1; i <= 10; i++) { @@ -766,8 +776,9 @@ mExtraConfig.emplace_back(std::move(entry)); } - // evaluate <sku> + // evaluate <sku> and <revision> mExtraConfSpecifiers.mCurSku = sku_value; + mExtraConfSpecifiers.mCurRevision = revision_value; evaluateExtraConfPaths(); // re-evaluate with "<extid>" @@ -778,6 +789,8 @@ mExtraConfSpecifiers.mCurExtid = extid_value; evaluateExtraConfPaths(); + ALOGI("Provided specifiers: sku=[%s] revision=[%s] extid=[%s]", sku_value, revision_value, extid_value); + // Pick one libuwb-countrycode.conf with the highest VERSION number // from multiple directories specified by COUNTRY_CODE_CAP_FILE_LOCATION unsigned long arrLen = 0;