From 29af95b9788e712ffd44d8835194e4850aebdb0b Mon Sep 17 00:00:00 2001 From: "Ali K. Zadeh" Date: Fri, 2 Aug 2024 20:10:44 +0000 Subject: [PATCH 01/12] [felix] Define CAMERA_MULTICAM_BOOST Port from ag/28607900 This CL defines CAMERA_MULTICAM_BOOST (with the same settings as the existing CAMERA_ZOOMING_BOOST). Having both definitions is necessary to be able to transition from zooming boost to multicam boost. Once the multicam boost flag is fully rolled out, we can remove the CAMERA_ZOOMING_BOOST. Bug: 347829135 Test: adb logcat Flag: EXEMPT resource file only change Change-Id: I3e25ea8e3fd84512e514aabab92b1d7c65ffab63 --- powerhint.json | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/powerhint.json b/powerhint.json index 530c865..3c4aa8f 100644 --- a/powerhint.json +++ b/powerhint.json @@ -1100,6 +1100,18 @@ "Duration": 100, "Value": "0" }, + { + "PowerHint": "CAMERA_MULTICAM_BOOST", + "Node": "CDPreferIdle", + "Duration": 100, + "Value": "1" + }, + { + "PowerHint": "CAMERA_MULTICAM_BOOST", + "Node": "PMU_POLL", + "Duration": 100, + "Value": "0" + }, { "PowerHint": "GCA_CAMERA_SHOT_BIGCPU_RANK1", "Node": "TAPreferHighCap", From 17e4c0262fb4878613b6c03313bf2df60f7af028 Mon Sep 17 00:00:00 2001 From: Jim Tang Date: Fri, 4 Oct 2024 15:50:09 +0800 Subject: [PATCH 02/12] Move modem_svc_sit from gs201 to felix Module `modem_svc_sit` is not valid unless: * USES_LASSEN_MODEM is true * BOARD_WITHOUT_RADIO is NOT true (or NOT set) Devices in gs201 family will set "USES_LASSEN_MODEM := true"; however, not evevy gs201 device disables BOARD_WITHOUT_RADIO. This commit defines PRODUCT_PACKAGES `modem_svc_sit` because it is converted from bp by moving the if-statement constrain from the module level to device level, device-felix.mk in this case. Flag: EXEMPT refactor Bug: 358485346 Test: m modem_svc_sit Change-Id: Ib57ffeb545ca52eea47f2415c7ce020ba73f2c24 --- device-felix.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/device-felix.mk b/device-felix.mk index ce2df54..ee6689f 100644 --- a/device-felix.mk +++ b/device-felix.mk @@ -108,6 +108,9 @@ PRODUCT_PACKAGES += \ android.hardware.nfc-service.st \ NfcOverlayFelix +# modem_svc_sit daemon +PRODUCT_PACKAGES += modem_svc_sit + # SecureElement PRODUCT_PACKAGES += \ android.hardware.secure_element@1.2-service-gto \ From 32a1b786206476a61acf7086dc38967ed0c1724c Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Thu, 26 Sep 2024 12:18:13 -0700 Subject: [PATCH 03/12] felix: Pull init.insmod.*.cfg from vendor_dlkm We've started pushing init.insmod.*.cfg into the kernel prebuilts, and installing it to /vendor_dlkm/etc, but it may not be available on all prebuilt variants (e.g., kernel 5.10). Here, we: 1. conditionally install our common init.*cfg to /vendor_dlkm (only if $(TARGET_KERNEL_DIR) doesn't have a copy) 2. point init at /vendor_dlkm/etc When we've cycled completely off of kernel 5.10, we can drop #1. Bug: 369686096 Test: build, boot Flag: EXEMPT refactor Change-Id: If8f879366645cbe9bf330d136dd7190763b2d6bc --- conf/init.felix.rc | 2 +- device-felix.mk | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/conf/init.felix.rc b/conf/init.felix.rc index 47475e3..46a8980 100644 --- a/conf/init.felix.rc +++ b/conf/init.felix.rc @@ -86,7 +86,7 @@ on early-boot start insmod_sh_felix chown system system /sys/class/power_supply/dualbatt/dbatt_stats -service insmod_sh_felix /vendor/bin/insmod.sh /vendor/etc/init.insmod.felix.cfg +service insmod_sh_felix /vendor/bin/insmod.sh /vendor_dlkm/etc/init.insmod.felix.cfg class main user root group root system diff --git a/device-felix.mk b/device-felix.mk index 69e4375..f443348 100644 --- a/device-felix.mk +++ b/device-felix.mk @@ -60,9 +60,13 @@ PRODUCT_COPY_FILES += \ PRODUCT_COPY_FILES += \ device/google/felix/conf/init.recovery.device.rc:$(TARGET_COPY_OUT_RECOVERY)/root/init.recovery.felix.rc -# insmod files +# insmod files. Kernel 5.10 prebuilts don't provide these yet, so provide our +# own copy if they're not in the prebuilts. +# TODO(b/369686096): drop this when 5.10 is gone. +ifeq ($(wildcard $(TARGET_KERNEL_DIR)/init.insmod.*.cfg),) PRODUCT_COPY_FILES += \ - device/google/felix/init.insmod.felix.cfg:$(TARGET_COPY_OUT_VENDOR)/etc/init.insmod.felix.cfg + device/google/felix/init.insmod.felix.cfg:$(TARGET_COPY_OUT_VENDOR_DLKM)/etc/init.insmod.felix.cfg +endif # Camera PRODUCT_COPY_FILES += \ From 9c9f564b770fdd5b8833d2eb34fac9432822553e Mon Sep 17 00:00:00 2001 From: Eileen Lai Date: Wed, 9 Oct 2024 07:55:28 +0000 Subject: [PATCH 04/12] modem_svc: use shared_modem_platform to replace all modem_svc_sit Bug: 368257019 Flag: NONE local testing only Change-Id: Ic54f0cbc895de8ba038cb581d055287768c1e23a --- device-felix.mk | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/device-felix.mk b/device-felix.mk index 1b5d82b..d0909c7 100644 --- a/device-felix.mk +++ b/device-felix.mk @@ -112,8 +112,11 @@ PRODUCT_PACKAGES += \ android.hardware.nfc-service.st \ NfcOverlayFelix -# modem_svc_sit daemon -PRODUCT_PACKAGES += modem_svc_sit +# Shared Modem Platform +SHARED_MODEM_PLATFORM_VENDOR := lassen + +# Shared Modem Platform +include device/google/gs-common/modem/shared_modem_platform/shared_modem_platform.mk # SecureElement PRODUCT_PACKAGES += \ From c5a772a3f2961a469578a6dc5cd179025ddb6435 Mon Sep 17 00:00:00 2001 From: Tai Kuo Date: Mon, 14 Oct 2024 20:37:50 +0800 Subject: [PATCH 05/12] vibrator: correct debug() calibration file path Bug: 356823441 Test: dumpsys Flag: EXEMPT bugfix Change-Id: I2d126e63ae7365b4bd199d00776f10b11c700702 --- vibrator/common/HardwareBase.cpp | 16 ++++++++++++---- vibrator/common/HardwareBase.h | 1 + vibrator/cs40l26/Vibrator.cpp | 6 +++++- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/vibrator/common/HardwareBase.cpp b/vibrator/common/HardwareBase.cpp index 329293a..583caaa 100644 --- a/vibrator/common/HardwareBase.cpp +++ b/vibrator/common/HardwareBase.cpp @@ -69,6 +69,7 @@ HwCalBase::HwCalBase() { std::ifstream calfile; std::ifstream calfile_dual; auto propertyPrefix = std::getenv("PROPERTY_PREFIX"); + auto calPath = std::getenv("CALIBRATION_FILEPATH"); if (propertyPrefix != NULL) { mPropertyPrefix = std::string(propertyPrefix); @@ -76,6 +77,14 @@ HwCalBase::HwCalBase() { ALOGE("Failed get property prefix!"); } + // Keep the cal file path for the current HwCalBase instance. + if (calPath != NULL) { + mCalPath = std::string(calPath); + } else { + ALOGE("Failed get the calibration file path!"); + } + + // Read the cal data for the current instance. utils::fileFromEnv("CALIBRATION_FILEPATH", &calfile); for (std::string line; std::getline(calfile, line);) { @@ -89,6 +98,7 @@ HwCalBase::HwCalBase() { } } + // Read the cal data for the other instance. utils::fileFromEnv("CALIBRATION_FILEPATH_DUAL", &calfile_dual); for (std::string line; std::getline(calfile_dual, line);) { @@ -106,7 +116,6 @@ HwCalBase::HwCalBase() { void HwCalBase::debug(int fd) { std::ifstream stream; - std::string path; std::string line; struct context { HwCalBase *obj; @@ -133,9 +142,8 @@ void HwCalBase::debug(int fd) { dprintf(fd, "Persist:\n"); - utils::fileFromEnv("CALIBRATION_FILEPATH", &stream, &path); - - dprintf(fd, " %s:\n", path.c_str()); + utils::openNoCreate(mCalPath, &stream); + dprintf(fd, " %s:\n", mCalPath.c_str()); while (std::getline(stream, line)) { dprintf(fd, " %s\n", line.c_str()); } diff --git a/vibrator/common/HardwareBase.h b/vibrator/common/HardwareBase.h index f09fada..0296390 100644 --- a/vibrator/common/HardwareBase.h +++ b/vibrator/common/HardwareBase.h @@ -208,6 +208,7 @@ class HwCalBase { private: std::string mPropertyPrefix; + std::string mCalPath; std::map mCalData; }; diff --git a/vibrator/cs40l26/Vibrator.cpp b/vibrator/cs40l26/Vibrator.cpp index 8543bf0..e091571 100644 --- a/vibrator/cs40l26/Vibrator.cpp +++ b/vibrator/cs40l26/Vibrator.cpp @@ -1081,7 +1081,7 @@ ndk::ScopedAStatus Vibrator::on(uint32_t timeoutMs, uint32_t effectIndex, const if (mIsDual) { mHwApiDual->getOwtFreeSpace(&freeBytes); if (ch-> size() > freeBytes) { - ALOGE("Invalid OWT length in flip: Effect %d: %d > %d!", effectIndex, + ALOGE("Invalid OWT length in flip: Effect %d: %zu > %d!", effectIndex, ch-> size(), freeBytes); return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); } @@ -1619,12 +1619,16 @@ binder_status_t Vibrator::dump(int fd, const char **args, uint32_t numArgs) { verFile.close(); } + dprintf(fd, "\n"); + mHwApiDef->debug(fd); dprintf(fd, "\n"); mHwCalDef->debug(fd); + dprintf(fd, "\n"); + if (mIsDual) { mHwApiDual->debug(fd); dprintf(fd, "\n"); From 3f7ccdf45fe49fddbad817deade85ac19641171b Mon Sep 17 00:00:00 2001 From: Tai Kuo Date: Wed, 16 Oct 2024 00:33:13 +0800 Subject: [PATCH 06/12] Update OWNERS Bug: 362659323 Test: N/A Flag: EXEMPT OWNERS change Change-Id: I6e2148448f1105933d66cec57cb879054657eeda --- vibrator/OWNERS | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vibrator/OWNERS b/vibrator/OWNERS index dec74a8..fc59b13 100644 --- a/vibrator/OWNERS +++ b/vibrator/OWNERS @@ -1 +1,3 @@ -file:platform/hardware/google/pixel:/vibrator/OWNERS +chrispaulo@google.com +nathankulczak@google.com +taikuo@google.com From 0f940132a1268cbd03b45cd7e0c6af7c4654b851 Mon Sep 17 00:00:00 2001 From: Dmitri Plotnikov Date: Fri, 18 Oct 2024 16:12:02 -0700 Subject: [PATCH 07/12] Add power profile config to reflect the presence of two displays Bug: 363857767 Test: adb shell dumpsys batterystats Flag: EXEMPT_bugfix Change-Id: I14add1339ef418b89201bc56c1b9cec80f3afc79 --- .../frameworks/base/core/res/res/xml/power_profile.xml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/felix/overlay/frameworks/base/core/res/res/xml/power_profile.xml b/felix/overlay/frameworks/base/core/res/res/xml/power_profile.xml index b633087..1c8a7e5 100644 --- a/felix/overlay/frameworks/base/core/res/res/xml/power_profile.xml +++ b/felix/overlay/frameworks/base/core/res/res/xml/power_profile.xml @@ -151,13 +151,17 @@ - 32 + 32 + 32 - 98 + 98 + 98 + - 470 + 470 + 470 240.47 From 0b3cc7ea7b3eb80e24b184b2c3ec6a633f70de3d Mon Sep 17 00:00:00 2001 From: Tai Kuo Date: Mon, 21 Oct 2024 11:40:03 +0800 Subject: [PATCH 08/12] cs40l26: organize dump() AIDL section Bug: 356823441 Test: dumpsys android.hardware.vibrator.IVibrator/default Flag: EXEMPT refactor Change-Id: Ie14e60482c3e6763921dc22f804155cd6f3b9fcd --- vibrator/cs40l26/Vibrator.cpp | 49 ++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/vibrator/cs40l26/Vibrator.cpp b/vibrator/cs40l26/Vibrator.cpp index e091571..89bd146 100644 --- a/vibrator/cs40l26/Vibrator.cpp +++ b/vibrator/cs40l26/Vibrator.cpp @@ -1482,40 +1482,31 @@ binder_status_t Vibrator::dump(int fd, const char **args, uint32_t numArgs) { dprintf(fd, " Redc: %.02f\n", mRedc); dprintf(fd, " Voltage Levels:\n"); - dprintf(fd, " Tick Effect Min: %" PRIu32 " Max: %" PRIu32 "\n", mTickEffectVol[0], + dprintf(fd, " Tick Effect Min: %" PRIu32 " Max: %" PRIu32 "\n", mTickEffectVol[0], mTickEffectVol[1]); - dprintf(fd, " Click Effect Min: %" PRIu32 " Max: %" PRIu32 "\n", mClickEffectVol[0], + dprintf(fd, " Click Effect Min: %" PRIu32 " Max: %" PRIu32 "\n", mClickEffectVol[0], mClickEffectVol[1]); - dprintf(fd, " Long Effect Min: %" PRIu32 " Max: %" PRIu32 "\n", mLongEffectVol[0], + dprintf(fd, " Long Effect Min: %" PRIu32 " Max: %" PRIu32 "\n", mLongEffectVol[0], mLongEffectVol[1]); - dprintf(fd, " FF effect:\n"); - dprintf(fd, " Physical waveform:\n"); - dprintf(fd, "==== Base ====\n\tId\tIndex\tt ->\tt'\tBrake\ttrigger button\n"); uint8_t effectId; + dprintf(fd, " Scales\n"); + dprintf(fd, "\tId\tMinScale\tMaxScale\n"); + for (effectId = 0; effectId < WAVEFORM_MAX_PHYSICAL_INDEX; effectId++) { + dprintf(fd, "\t%d\t%d\t\t%d\n", effectId, mPrimitiveMinScale[effectId], + mPrimitiveMaxScale[effectId]); + } + + dprintf(fd, " Base FF effect:\n"); + dprintf(fd, " Physical waveform:\n"); + dprintf(fd, "\tId\tIndex\tt ->\tt'\tBrake\ttrigger button\n"); for (effectId = 0; effectId < WAVEFORM_MAX_PHYSICAL_INDEX; effectId++) { dprintf(fd, "\t%d\t%d\t%d\t%d\t%d\t%X\n", mFfEffects[effectId].id, mFfEffects[effectId].u.periodic.custom_data[1], mEffectDurations[effectId], mFfEffects[effectId].replay.length, mEffectBrakingDurations[effectId], mFfEffects[effectId].trigger.button); } - if (mIsDual) { - dprintf(fd, "==== Flip ====\n\tId\tIndex\tt ->\tt'\tBrake\ttrigger button\n"); - for (effectId = 0; effectId < WAVEFORM_MAX_PHYSICAL_INDEX; effectId++) { - dprintf(fd, "\t%d\t%d\t%d\t%d\t%d\t%X\n", mFfEffectsDual[effectId].id, - mFfEffectsDual[effectId].u.periodic.custom_data[1], mEffectDurations[effectId], - mFfEffectsDual[effectId].replay.length, mEffectBrakingDurations[effectId], - mFfEffectsDual[effectId].trigger.button); - } - } - - dprintf(fd, "==== Scales ====\n\tId\tMinScale\tMaxScale\n"); - for (effectId = 0; effectId < WAVEFORM_MAX_PHYSICAL_INDEX; effectId++) { - dprintf(fd, "\t%d\t%d\t\t%d\n", effectId, mPrimitiveMinScale[effectId], - mPrimitiveMaxScale[effectId]); - } - - dprintf(fd, "\nBase: OWT waveform:\n"); + dprintf(fd, " OWT waveform:\n"); dprintf(fd, "\tId\tBytes\tData\tt\ttrigger button\n"); for (effectId = WAVEFORM_MAX_PHYSICAL_INDEX; effectId < WAVEFORM_MAX_INDEX; effectId++) { uint32_t numBytes = mFfEffects[effectId].u.periodic.custom_len * 2; @@ -1531,8 +1522,18 @@ binder_status_t Vibrator::dump(int fd, const char **args, uint32_t numArgs) { dprintf(fd, "\t%d\t%d\t{%s}\t%u\t%X\n", mFfEffects[effectId].id, numBytes, ss.str().c_str(), mFfEffectsDual[effectId].replay.length, mFfEffects[effectId].trigger.button); } + if (mIsDual) { - dprintf(fd, "Flip: OWT waveform:\n"); + dprintf(fd, " Flip FF effect:\n"); + dprintf(fd, " Physical waveform:\n"); + dprintf(fd, "\tId\tIndex\tt ->\tt'\tBrake\ttrigger button\n"); + for (effectId = 0; effectId < WAVEFORM_MAX_PHYSICAL_INDEX; effectId++) { + dprintf(fd, "\t%d\t%d\t%d\t%d\t%d\t%X\n", mFfEffectsDual[effectId].id, + mFfEffectsDual[effectId].u.periodic.custom_data[1], mEffectDurations[effectId], + mFfEffectsDual[effectId].replay.length, mEffectBrakingDurations[effectId], + mFfEffectsDual[effectId].trigger.button); + } + dprintf(fd, " OWT waveform:\n"); dprintf(fd, "\tId\tBytes\tData\tt\ttrigger button\n"); for (effectId = WAVEFORM_MAX_PHYSICAL_INDEX; effectId < WAVEFORM_MAX_INDEX; effectId++) { uint32_t numBytes = mFfEffectsDual[effectId].u.periodic.custom_len * 2; From 46065a44625e1d9535918a8f29ada33679219e4a Mon Sep 17 00:00:00 2001 From: Tai Kuo Date: Thu, 1 Feb 2024 15:22:37 +0800 Subject: [PATCH 09/12] vibrator/cs40l26: update default scales of click, tick and long vib Flow: 1. If the calibration file exist, use the value. 2. If no property, use the default setting {5,95}. Bug: 356823441 Bug: 322937989 Test: Check dumpsys records for the scaling results. case1: no calibration file and properties. case2: valid property range case3: float property (invalid) Flag: EXEMPT bugfix Change-Id: Ia3e89f34189e9725ab01d85d931925129745608c (cherry picked from commit 4063493a64fcd0f20b49a492106f58b0e3349c5c) --- vibrator/common/utils.h | 13 +++++++++++++ vibrator/cs40l26/Hardware.h | 15 ++++++--------- vibrator/cs40l26/tests/test-hwcal.cpp | 6 +++--- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/vibrator/common/utils.h b/vibrator/common/utils.h index 86dd37e..b5005a6 100644 --- a/vibrator/common/utils.h +++ b/vibrator/common/utils.h @@ -103,6 +103,19 @@ inline Enable_If_Unsigned getProperty(const std::string &key, const T def) return ::android::base::GetUintProperty(key, def); } +template +inline std::array getProperty(const std::string &key, const std::array &def) { + std::string value = ::android::base::GetProperty(key, ""); + if (!value.empty()) { + std::array result{0}; + std::stringstream stream{value}; + utils::unpack(stream, &result); + if (stream && stream.eof()) + return result; + } + return def; +} + template <> inline bool getProperty(const std::string &key, const bool def) { return ::android::base::GetBoolProperty(key, def); diff --git a/vibrator/cs40l26/Hardware.h b/vibrator/cs40l26/Hardware.h index e2c2d36..e4dd344 100644 --- a/vibrator/cs40l26/Hardware.h +++ b/vibrator/cs40l26/Hardware.h @@ -318,9 +318,9 @@ class HwCal : public Vibrator::HwCal, private HwCalBase { static constexpr uint32_t VERSION_DEFAULT = 2; static constexpr int32_t DEFAULT_FREQUENCY_SHIFT = 0; - static constexpr std::array V_TICK_DEFAULT = {1, 100}; - static constexpr std::array V_CLICK_DEFAULT = {1, 100}; - static constexpr std::array V_LONG_DEFAULT = {1, 100}; + static constexpr std::array V_TICK_DEFAULT = {5, 95}; + static constexpr std::array V_CLICK_DEFAULT = {5, 95}; + static constexpr std::array V_LONG_DEFAULT = {5, 95}; public: HwCal() {} @@ -370,22 +370,19 @@ class HwCal : public Vibrator::HwCal, private HwCalBase { if (getPersist(TICK_VOLTAGES_CONFIG, value)) { return true; } - *value = V_TICK_DEFAULT; - return true; + return getProperty(TICK_VOLTAGES_CONFIG, value, V_TICK_DEFAULT); } bool getClickVolLevels(std::array *value) override { if (getPersist(CLICK_VOLTAGES_CONFIG, value)) { return true; } - *value = V_CLICK_DEFAULT; - return true; + return getProperty(CLICK_VOLTAGES_CONFIG, value, V_CLICK_DEFAULT); } bool getLongVolLevels(std::array *value) override { if (getPersist(LONG_VOLTAGES_CONFIG, value)) { return true; } - *value = V_LONG_DEFAULT; - return true; + return getProperty(LONG_VOLTAGES_CONFIG, value, V_LONG_DEFAULT); } bool isChirpEnabled() override { return utils::getProperty("persist.vendor.vibrator.hal.chirp.enabled", false); diff --git a/vibrator/cs40l26/tests/test-hwcal.cpp b/vibrator/cs40l26/tests/test-hwcal.cpp index e482b6c..5223c85 100644 --- a/vibrator/cs40l26/tests/test-hwcal.cpp +++ b/vibrator/cs40l26/tests/test-hwcal.cpp @@ -30,9 +30,9 @@ using ::testing::Test; class HwCalTest : public Test { protected: - static constexpr std::array V_TICK_DEFAULT = {1, 100}; - static constexpr std::array V_CLICK_DEFAULT = {1, 100}; - static constexpr std::array V_LONG_DEFAULT = {1, 100}; + static constexpr std::array V_TICK_DEFAULT = {5, 95}; + static constexpr std::array V_CLICK_DEFAULT = {5, 95}; + static constexpr std::array V_LONG_DEFAULT = {5, 95}; public: void SetUp() override { setenv("CALIBRATION_FILEPATH", mCalFile.path, true); } From f669a1ea526da4a6d674019431bbeed67ced50d2 Mon Sep 17 00:00:00 2001 From: Tai Kuo Date: Mon, 21 Oct 2024 11:44:38 +0800 Subject: [PATCH 10/12] cs40l26: add DBC bin info and reduce duplicates Bug: 356823441 Test: dumpsys android.hardware.vibrator.IVibrator/default Flag: EXEMPT bugfix Change-Id: Id3d9fac99b204de581269818e69722932e4911fc (cherry picked from commit 6e4e8d2052e352a56eeab2e452addaf484d79d9f) --- vibrator/cs40l26/Vibrator.cpp | 83 ++++++++++++++--------------------- 1 file changed, 34 insertions(+), 49 deletions(-) diff --git a/vibrator/cs40l26/Vibrator.cpp b/vibrator/cs40l26/Vibrator.cpp index 89bd146..6c3c84b 100644 --- a/vibrator/cs40l26/Vibrator.cpp +++ b/vibrator/cs40l26/Vibrator.cpp @@ -1554,70 +1554,55 @@ binder_status_t Vibrator::dump(int fd, const char **args, uint32_t numArgs) { dprintf(fd, "\n"); dprintf(fd, "Versions:\n"); + const std::vector> moduleFolderNames = { + {"cs40l26_core", "Haptics"}, {"cl_dsp_core", "DSP"}}; + const std::string firmwareFolder = "/vendor/firmware/"; + const std::string waveformName = "cs40l26.bin"; + const std::array firmwareFileNames = {"cs40l26.wmfw", "cs40l26-calib.wmfw"}; + const std::array tuningFileNames = {"cs40l26-svc.bin", "cs40l26-calib.bin", + "cs40l26-dvl.bin", "cs40l26-dbc.bin"}; std::ifstream verFile; const auto verBinFileMode = std::ifstream::in | std::ifstream::binary; std::string ver; - verFile.open("/sys/module/cs40l26_core/version"); - if (verFile.is_open()) { - getline(verFile, ver); - dprintf(fd, " Haptics Driver: %s\n", ver.c_str()); - verFile.close(); + for (const auto &[folder, logTag] : moduleFolderNames) { + verFile.open("/sys/module/" + folder + "/version"); + if (verFile.is_open()) { + getline(verFile, ver); + dprintf(fd, " %s Driver: %s\n", logTag.c_str(), ver.c_str()); + verFile.close(); + } } - verFile.open("/sys/module/cl_dsp_core/version"); - if (verFile.is_open()) { - getline(verFile, ver); - dprintf(fd, " DSP Driver: %s\n", ver.c_str()); - verFile.close(); + for (auto &name : firmwareFileNames) { + verFile.open(firmwareFolder + name, verBinFileMode); + if (verFile.is_open()) { + verFile.seekg(113); + dprintf(fd, " %s: %d.%d.%d\n", name.c_str(), verFile.get(), verFile.get(), + verFile.get()); + verFile.close(); + } } - verFile.open("/vendor/firmware/cs40l26.wmfw", verBinFileMode); - if (verFile.is_open()) { - verFile.seekg(113); - dprintf(fd, " cs40l26.wmfw: %d.%d.%d\n", verFile.get(), verFile.get(), verFile.get()); - verFile.close(); - } - verFile.open("/vendor/firmware/cs40l26-calib.wmfw", verBinFileMode); - if (verFile.is_open()) { - verFile.seekg(113); - dprintf(fd, " cs40l26-calib.wmfw: %d.%d.%d\n", verFile.get(), verFile.get(), - verFile.get()); - verFile.close(); - } - verFile.open("/vendor/firmware/cs40l26.bin", verBinFileMode); + verFile.open(firmwareFolder + waveformName, verBinFileMode); if (verFile.is_open()) { while (getline(verFile, ver)) { auto pos = ver.find("Date: "); if (pos != std::string::npos) { ver = ver.substr(pos + 6, pos + 15); - dprintf(fd, " cs40l26.bin: %s\n", ver.c_str()); + dprintf(fd, " %s: %s\n", waveformName.c_str(), ver.c_str()); break; } } verFile.close(); } - verFile.open("/vendor/firmware/cs40l26-svc.bin", verBinFileMode); - if (verFile.is_open()) { - verFile.seekg(36); - getline(verFile, ver); - ver = ver.substr(ver.rfind('\\') + 1); - dprintf(fd, " cs40l26-svc.bin: %s\n", ver.c_str()); - verFile.close(); - } - verFile.open("/vendor/firmware/cs40l26-calib.bin", verBinFileMode); - if (verFile.is_open()) { - verFile.seekg(36); - getline(verFile, ver); - ver = ver.substr(ver.rfind('\\') + 1); - dprintf(fd, " cs40l26-calib.bin: %s\n", ver.c_str()); - verFile.close(); - } - verFile.open("/vendor/firmware/cs40l26-dvl.bin", verBinFileMode); - if (verFile.is_open()) { - verFile.seekg(36); - getline(verFile, ver); - ver = ver.substr(0, ver.find('\0') + 1); - ver = ver.substr(ver.rfind('\\') + 1); - dprintf(fd, " cs40l26-dvl.bin: %s\n", ver.c_str()); - verFile.close(); + for (auto &name : tuningFileNames) { + verFile.open(firmwareFolder + name, verBinFileMode); + if (verFile.is_open()) { + verFile.seekg(36); + getline(verFile, ver); + ver = ver.substr(0, ver.find(".bin") + 4); + ver = ver.substr(ver.rfind('\\') + 1); + dprintf(fd, " %s: %s\n", name.c_str(), ver.c_str()); + verFile.close(); + } } dprintf(fd, "\n"); From 2b7642486bf9f9e456b35622f1a95bba6b8bc1c5 Mon Sep 17 00:00:00 2001 From: Zouberou Sayibou Date: Wed, 23 Oct 2024 00:01:38 +0000 Subject: [PATCH 11/12] Felix HAL: Fixed VibratorTest unit tests errors. Fixed Felix HAL VibratorHalCs40l26TestSuitePrivate 3 failed tests: - VibratorTest#on - VibratorTest#perform/CLICK_LIGHT, - VibratorTest#perform/HEAVY_CLICK_STRONG. Moving the mActiveId_mutex to a global variable caused issues with the #perform/HEAVY_CLICK_STRONG test failing to call the HwApi and the #perform/CLICK_LIGHT test failing due to an outdated timeout value. Additionally, the intensifyToVolLevel function was returning an incorrect value, requiring a check to be added to the testing function. Bug: 373761684 Flag: TEST_ONLY Test: Ran VibratorHalCs40l26TestSuitePrivate. Change-Id: Ibcdbc874c5c96644f3f647cc240b5012907253d4 Signed-off-by: Zouberou Sayibou --- vibrator/cs40l26/Vibrator.cpp | 3 ++- vibrator/cs40l26/Vibrator.h | 1 - vibrator/cs40l26/tests/test-vibrator.cpp | 32 ++++++++++++++++++++++-- 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/vibrator/cs40l26/Vibrator.cpp b/vibrator/cs40l26/Vibrator.cpp index 8543bf0..8876cd6 100644 --- a/vibrator/cs40l26/Vibrator.cpp +++ b/vibrator/cs40l26/Vibrator.cpp @@ -195,6 +195,8 @@ enum vibe_state { VIBE_STATE_ASP, }; +std::mutex mActiveId_mutex; // protects mActiveId + class DspMemChunk { private: std::unique_ptr head; @@ -1930,7 +1932,6 @@ uint32_t Vibrator::intensityToVolLevel(float intensity, uint32_t effectIndex) { volLevel = calc(intensity, mClickEffectVol); break; } - // The waveform being played must fall within the allowable scale range if (effectIndex < WAVEFORM_MAX_INDEX) { if (volLevel > mPrimitiveMaxScale[effectIndex]) { diff --git a/vibrator/cs40l26/Vibrator.h b/vibrator/cs40l26/Vibrator.h index a61cea9..6fc3a3d 100644 --- a/vibrator/cs40l26/Vibrator.h +++ b/vibrator/cs40l26/Vibrator.h @@ -250,7 +250,6 @@ class Vibrator : public BnVibrator { bool mConfigHapticAlsaDeviceDone{false}; bool mGPIOStatus; bool mIsDual{false}; - std::mutex mActiveId_mutex; // protects mActiveId }; } // namespace vibrator diff --git a/vibrator/cs40l26/tests/test-vibrator.cpp b/vibrator/cs40l26/tests/test-vibrator.cpp index 6c8cebb..b9b5b3c 100644 --- a/vibrator/cs40l26/tests/test-vibrator.cpp +++ b/vibrator/cs40l26/tests/test-vibrator.cpp @@ -87,7 +87,7 @@ static const std::map EFFECT_INDEX{ static constexpr uint32_t MIN_ON_OFF_INTERVAL_US = 8500; static constexpr uint8_t VOLTAGE_SCALE_MAX = 100; static constexpr int8_t MAX_COLD_START_LATENCY_MS = 6; // I2C Transaction + DSP Return-From-Standby -static constexpr auto POLLING_TIMEOUT = 20; +static constexpr auto POLLING_TIMEOUT = 50; enum WaveformIndex : uint16_t { /* Physical waveform */ WAVEFORM_LONG_VIBRATION_EFFECT_INDEX = 0, @@ -506,6 +506,23 @@ TEST_P(EffectsTest, perform) { promise.set_value(); return ndk::ScopedAStatus::ok(); }; + std::vector primitiveMaxScale; + std::vector primitiveMinScale; + primitiveMaxScale.resize(WAVEFORM_MAX_INDEX, 100); + primitiveMaxScale[WAVEFORM_CLICK_INDEX] = 95; + primitiveMaxScale[WAVEFORM_THUD_INDEX] = 75; + primitiveMaxScale[WAVEFORM_SPIN_INDEX] = 90; + primitiveMaxScale[WAVEFORM_LIGHT_TICK_INDEX] = 75; + primitiveMaxScale[WAVEFORM_LOW_TICK_INDEX] = 75; + + primitiveMinScale.resize(WAVEFORM_MAX_INDEX, 0); + primitiveMinScale[WAVEFORM_CLICK_INDEX] = 1; + primitiveMinScale[WAVEFORM_THUD_INDEX] = 11; + primitiveMinScale[WAVEFORM_SPIN_INDEX] = 23; + primitiveMinScale[WAVEFORM_SLOW_RISE_INDEX] = 25; + primitiveMinScale[WAVEFORM_QUICK_FALL_INDEX] = 2; + primitiveMinScale[WAVEFORM_LIGHT_TICK_INDEX] = 3; + primitiveMinScale[WAVEFORM_LOW_TICK_INDEX] = 16; bool composeEffect; ExpectationSet eSetup; @@ -515,7 +532,18 @@ TEST_P(EffectsTest, perform) { EffectIndex index = EFFECT_INDEX.at(effect); duration = EFFECT_DURATIONS[index]; - eSetup += EXPECT_CALL(*mMockApi, setFFGain(_, levelToScale(scale->second))) + auto updatedScale = levelToScale(scale->second); + + if (index < WAVEFORM_MAX_INDEX) { + if (updatedScale > primitiveMaxScale[index]) { + updatedScale = primitiveMaxScale[index]; + } + if (updatedScale < primitiveMinScale[index]) { + updatedScale = primitiveMinScale[index]; + } + } + + eSetup += EXPECT_CALL(*mMockApi, setFFGain(_, updatedScale)) .WillOnce(DoDefault()); eActivate = EXPECT_CALL(*mMockApi, setFFPlay(_, index, true)) .After(eSetup) From ccd324c4b338199ad8d77a877648504a8e00dad4 Mon Sep 17 00:00:00 2001 From: Kyle Hsiao Date: Tue, 5 Nov 2024 03:03:40 +0000 Subject: [PATCH 12/12] Update ISODEP routing setting Bug: 323953256 Test: manual Flag: EXEMPT bugfix Change-Id: Ic809f837493ea92b47545dde7b5cf7c52831326f --- nfc/libnfc-hal-st.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nfc/libnfc-hal-st.conf b/nfc/libnfc-hal-st.conf index 7300e21..ac8c20d 100644 --- a/nfc/libnfc-hal-st.conf +++ b/nfc/libnfc-hal-st.conf @@ -135,7 +135,7 @@ OFFHOST_ROUTE_ESE={86} # host 0x00 # eSE 0x82 (eSE), 0x86 (eUICC/SPI-SE) # UICC 0x81 (UICC_1), 0x85 (UICC_2) -DEFAULT_ISODEP_ROUTE=0x81 +DEFAULT_ISODEP_ROUTE=0x00 ############################################################################### # Configure the HAL Clock control