From ef3616fe663cac801f0730d0d48b418502e15c4d Mon Sep 17 00:00:00 2001 From: Ravi Jain Date: Thu, 29 Feb 2024 13:23:39 +0000 Subject: [PATCH 01/13] dumpstate: touch: Init using touch_predump More info at go/touch_predump Test: Test locally on test device and check predump_touch works. Bug: 287907308 Change-Id: Iadad909a658f4fa1d3bc163b8bfd950e5029c4a5 --- device-felix.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/device-felix.mk b/device-felix.mk index ad942d6..cccef1d 100644 --- a/device-felix.mk +++ b/device-felix.mk @@ -47,8 +47,8 @@ $(call soong_config_set,fp_hal_feature,pixel_product, product_a) include device/google/felix/vibrator/cs40l26/device.mk include device/google/gs-common/bcmbt/bluetooth.mk include device/google/gs-common/display/dump_second_display.mk -include device/google/gs-common/touch/gti/gti.mk -include device/google/gs-common/touch/stm/stm6.mk +include device/google/gs-common/touch/gti/predump_gti_dual.mk +include device/google/gs-common/touch/stm/predump_stm6.mk ifeq ($(filter factory_felix, $(TARGET_PRODUCT)),) include device/google/felix/uwb/uwb_calibration.mk endif From 3279a16af449dce427affb7f9a29c0f3906a3507 Mon Sep 17 00:00:00 2001 From: James Huang Date: Fri, 26 Jul 2024 15:11:42 +0800 Subject: [PATCH 02/13] gps: Enable Beidou measurements only in the US for F10. Bug: 354884462 Test: Field test in the US Change-Id: Ic864c27f90f17da2fa65d3864d3882395226aa91 --- location/gps.xml.f10 | 1 + location/gps_user.xml.f10 | 1 + 2 files changed, 2 insertions(+) diff --git a/location/gps.xml.f10 b/location/gps.xml.f10 index da3e110..a852a7a 100644 --- a/location/gps.xml.f10 +++ b/location/gps.xml.f10 @@ -100,6 +100,7 @@ diff --git a/location/gps_user.xml.f10 b/location/gps_user.xml.f10 index 19842ca..8f92092 100644 --- a/location/gps_user.xml.f10 +++ b/location/gps_user.xml.f10 @@ -99,6 +99,7 @@ From caeaff1444db900788dca6330f326bf31b3e467e Mon Sep 17 00:00:00 2001 From: "Peter (YM)" Date: Fri, 16 Aug 2024 06:26:10 +0000 Subject: [PATCH 03/13] thermal: read thermistor temp from sysfs - avoid wrong sensor value reading for thermalHAL Bug: 327327502 Test: Build to boot to home Flag: EXEMPT (bug 337358613) Change-Id: I93cbfa767a8d882eba526d72ce9ba3c389cd0a1e Signed-off-by: Peter (YM) --- thermal_info_config_charge_felix.json | 8 -------- thermal_info_config_felix.json | 8 -------- thermal_info_config_proactive_skin_felix.json | 8 -------- 3 files changed, 24 deletions(-) diff --git a/thermal_info_config_charge_felix.json b/thermal_info_config_charge_felix.json index b3731fc..2653344 100644 --- a/thermal_info_config_charge_felix.json +++ b/thermal_info_config_charge_felix.json @@ -3,20 +3,17 @@ { "Name":"neutral_therm", "Type":"UNKNOWN", - "TempPath":"/dev/thermal/tz-by-name/neutral_therm/tz_temp", "Multiplier":0.001 }, { "Name":"quiet_therm", "Type":"UNKNOWN", - "TempPath":"/dev/thermal/tz-by-name/quiet_therm/tz_temp", "Multiplier":0.001 }, { "Name":"skin_therm", "Type":"UNKNOWN", "HotThreshold":["NAN", 32.0, "NAN", "NAN", "NAN", "NAN", "NAN"], - "TempPath":"/dev/thermal/tz-by-name/skin_therm/tz_temp", "Multiplier":0.001, "PollingDelay":300000, "PassiveDelay":7000 @@ -24,14 +21,12 @@ { "Name":"usb_pwr_therm", "Type":"UNKNOWN", - "TempPath":"/dev/thermal/tz-by-name/usb_pwr_therm/tz_temp", "Multiplier":0.001 }, { "Name":"usb_pwr_therm2", "Type":"UNKNOWN", "HotThreshold":["NAN", 40.0, "NAN", "NAN", "NAN", "NAN", "NAN"], - "TempPath":"/dev/thermal/tz-by-name/usb_pwr_therm2/tz_temp", "Multiplier":0.001, "PollingDelay":300000, "PassiveDelay":7000 @@ -39,19 +34,16 @@ { "Name":"inner_disp_therm", "Type":"UNKNOWN", - "TempPath":"/dev/thermal/tz-by-name/inner_disp_therm/tz_temp", "Multiplier":0.001 }, { "Name":"outer_disp_therm", "Type":"UNKNOWN", - "TempPath":"/dev/thermal/tz-by-name/outer_disp_therm/tz_temp", "Multiplier":0.001 }, { "Name":"gnss_tcxo_therm", "Type":"UNKNOWN", - "TempPath":"/dev/thermal/tz-by-name/gnss_tcxo_therm/tz_temp", "Multiplier":0.001 }, { diff --git a/thermal_info_config_felix.json b/thermal_info_config_felix.json index a0bc0f2..93c0849 100644 --- a/thermal_info_config_felix.json +++ b/thermal_info_config_felix.json @@ -9,20 +9,17 @@ { "Name":"neutral_therm", "Type":"UNKNOWN", - "TempPath":"/dev/thermal/tz-by-name/neutral_therm/tz_temp", "Multiplier":0.001 }, { "Name":"quiet_therm", "Type":"UNKNOWN", - "TempPath":"/dev/thermal/tz-by-name/quiet_therm/tz_temp", "Multiplier":0.001 }, { "Name":"skin_therm", "Type":"UNKNOWN", "HotThreshold":["NAN", 32.0, "NAN", "NAN", "NAN", "NAN", "NAN"], - "TempPath":"/dev/thermal/tz-by-name/skin_therm/tz_temp", "Multiplier":0.001, "PollingDelay":300000, "PassiveDelay":7000 @@ -30,14 +27,12 @@ { "Name":"usb_pwr_therm", "Type":"UNKNOWN", - "TempPath":"/dev/thermal/tz-by-name/usb_pwr_therm/tz_temp", "Multiplier":0.001 }, { "Name":"usb_pwr_therm2", "Type":"UNKNOWN", "HotThreshold":["NAN", 40.0, "NAN", "NAN", "NAN", "NAN", "NAN"], - "TempPath":"/dev/thermal/tz-by-name/usb_pwr_therm2/tz_temp", "Multiplier":0.001, "PollingDelay":300000, "PassiveDelay":7000 @@ -45,19 +40,16 @@ { "Name":"inner_disp_therm", "Type":"UNKNOWN", - "TempPath":"/dev/thermal/tz-by-name/inner_disp_therm/tz_temp", "Multiplier":0.001 }, { "Name":"outer_disp_therm", "Type":"UNKNOWN", - "TempPath":"/dev/thermal/tz-by-name/outer_disp_therm/tz_temp", "Multiplier":0.001 }, { "Name":"gnss_tcxo_therm", "Type":"UNKNOWN", - "TempPath":"/dev/thermal/tz-by-name/gnss_tcxo_therm/tz_temp", "Multiplier":0.001 }, { diff --git a/thermal_info_config_proactive_skin_felix.json b/thermal_info_config_proactive_skin_felix.json index 5c10f4b..87a7be3 100644 --- a/thermal_info_config_proactive_skin_felix.json +++ b/thermal_info_config_proactive_skin_felix.json @@ -9,20 +9,17 @@ { "Name":"neutral_therm", "Type":"UNKNOWN", - "TempPath":"/dev/thermal/tz-by-name/neutral_therm/tz_temp", "Multiplier":0.001 }, { "Name":"quiet_therm", "Type":"UNKNOWN", - "TempPath":"/dev/thermal/tz-by-name/quiet_therm/tz_temp", "Multiplier":0.001 }, { "Name":"skin_therm", "Type":"UNKNOWN", "HotThreshold":["NAN", 32.0, "NAN", "NAN", "NAN", "NAN", "NAN"], - "TempPath":"/dev/thermal/tz-by-name/skin_therm/tz_temp", "Multiplier":0.001, "PollingDelay":300000, "PassiveDelay":7000 @@ -30,14 +27,12 @@ { "Name":"usb_pwr_therm", "Type":"UNKNOWN", - "TempPath":"/dev/thermal/tz-by-name/usb_pwr_therm/tz_temp", "Multiplier":0.001 }, { "Name":"usb_pwr_therm2", "Type":"UNKNOWN", "HotThreshold":["NAN", 40.0, "NAN", "NAN", "NAN", "NAN", "NAN"], - "TempPath":"/dev/thermal/tz-by-name/usb_pwr_therm2/tz_temp", "Multiplier":0.001, "PollingDelay":300000, "PassiveDelay":7000 @@ -45,19 +40,16 @@ { "Name":"inner_disp_therm", "Type":"UNKNOWN", - "TempPath":"/dev/thermal/tz-by-name/inner_disp_therm/tz_temp", "Multiplier":0.001 }, { "Name":"outer_disp_therm", "Type":"UNKNOWN", - "TempPath":"/dev/thermal/tz-by-name/outer_disp_therm/tz_temp", "Multiplier":0.001 }, { "Name":"gnss_tcxo_therm", "Type":"UNKNOWN", - "TempPath":"/dev/thermal/tz-by-name/gnss_tcxo_therm/tz_temp", "Multiplier":0.001 }, { From 5524ba6a07a9a73e73ad3403d56b21ac8f302b39 Mon Sep 17 00:00:00 2001 From: Wayne Lin Date: Mon, 12 Aug 2024 17:15:25 +0800 Subject: [PATCH 04/13] gps: add CpEarlyFixGuardTimeSec to prevent earlyfix response delay Bug: 358041425 Test: verify pass Change-Id: Idddb3d7968b93ebb214d1dd2938be2b1aaff8ea9 --- location/gps.6.1.xml.f10 | 1 + location/gps.xml.f10 | 1 + location/gps_user.6.1.xml.f10 | 1 + location/gps_user.xml.f10 | 1 + 4 files changed, 4 insertions(+) diff --git a/location/gps.6.1.xml.f10 b/location/gps.6.1.xml.f10 index fbf2d67..69cb18e 100644 --- a/location/gps.6.1.xml.f10 +++ b/location/gps.6.1.xml.f10 @@ -49,6 +49,7 @@ LtoSyncThresholdDays="1" GnssYearOfHardware="2020" + CpEarlyFixGuardTimeSec="1" CpGuardTimeSec="1" CpLppGuardTimeSec="1" IgnoreInjectedSystemTime="true" diff --git a/location/gps.xml.f10 b/location/gps.xml.f10 index da3e110..b528a02 100644 --- a/location/gps.xml.f10 +++ b/location/gps.xml.f10 @@ -49,6 +49,7 @@ LtoSyncThresholdDays="1" GnssYearOfHardware="2020" + CpEarlyFixGuardTimeSec="1" CpGuardTimeSec="1" CpLppGuardTimeSec="1" IgnoreInjectedSystemTime="true" diff --git a/location/gps_user.6.1.xml.f10 b/location/gps_user.6.1.xml.f10 index e4f32da..db68a27 100644 --- a/location/gps_user.6.1.xml.f10 +++ b/location/gps_user.6.1.xml.f10 @@ -48,6 +48,7 @@ LtoSyncThresholdDays="1" GnssYearOfHardware="2020" + CpEarlyFixGuardTimeSec="1" CpGuardTimeSec="1" CpLppGuardTimeSec="1" IgnoreInjectedSystemTime="true" diff --git a/location/gps_user.xml.f10 b/location/gps_user.xml.f10 index 19842ca..f533015 100644 --- a/location/gps_user.xml.f10 +++ b/location/gps_user.xml.f10 @@ -48,6 +48,7 @@ LtoSyncThresholdDays="1" GnssYearOfHardware="2020" + CpEarlyFixGuardTimeSec="1" CpGuardTimeSec="1" CpLppGuardTimeSec="1" IgnoreInjectedSystemTime="true" From d37470ea6e0a684d05cf235075e168528efe6143 Mon Sep 17 00:00:00 2001 From: Chungkai Mei Date: Tue, 20 Aug 2024 11:01:01 +0000 Subject: [PATCH 05/13] powerhint: Raise minimum MIF frequency to 546 MHz during screen on It improved 55% surfaceflinger janks in photos_playgca30fpsvideo cuj test case. Test: Build and power measurement Bug: 336872050 Flag: NONE powerhint change does not support flags Change-Id: Idad3394e5ac9d1d275f144e2d1304a115b7dc3af Signed-off-by: Chungkai Mei --- powerhint.json | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/powerhint.json b/powerhint.json index 078beb9..d68ab92 100644 --- a/powerhint.json +++ b/powerhint.json @@ -21,7 +21,8 @@ "1539000", "1352000", "1014000", - "421000" + "421000", + "546000" ], "ResetOnInit": true }, @@ -884,6 +885,12 @@ "Duration": 50, "Value": "302000" }, + { + "PowerHint": "DISPLAY_INACTIVE", + "Node": "MemFreq", + "Duration": 0, + "Value": "421000" + }, { "PowerHint": "CPU_LOAD_RESET", "Node": "MemFreq", From 777bc1274fbd4f8e9815461f9284592d723cbc35 Mon Sep 17 00:00:00 2001 From: Ankit Goyal Date: Wed, 28 Aug 2024 22:52:54 -0700 Subject: [PATCH 06/13] Delete mapper4 manifest Bug: 362183626 Flag: EXEMPT manifest update Test: Boot to home on shiba Change-Id: I1882a688138455538418b01b38084b5dfb2dd802 --- manifest.xml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/manifest.xml b/manifest.xml index ae2f526..a287416 100644 --- a/manifest.xml +++ b/manifest.xml @@ -48,15 +48,6 @@ default - - android.hardware.graphics.mapper - passthrough - 4.0 - - IMapper - default - - android.hardware.graphics.composer hwbinder From a644ef2a33b47bdf937a47f362a71eb9d80a031a Mon Sep 17 00:00:00 2001 From: leonardian Date: Mon, 24 Jun 2024 04:24:02 +0000 Subject: [PATCH 07/13] cs40l26: Align Felix HAL dump logs with common HAL - Add driver, firmware, and tuning versions. - Increase HAL buffer size to 2048 lines. - Add F0, active ID, redc Bug: 348316804 Flag: EXEMPT bugfix Test: Checked HAL dumpsys Test: atest PTS, VTS, CTS Change-Id: I277d270533868cf2075388bdc329d77c9065801e --- vibrator/common/HardwareBase.h | 16 ++++-- vibrator/cs40l26/Vibrator.cpp | 93 +++++++++++++++++++++++++++++++--- vibrator/cs40l26/Vibrator.h | 2 + 3 files changed, 100 insertions(+), 11 deletions(-) diff --git a/vibrator/common/HardwareBase.h b/vibrator/common/HardwareBase.h index 448d29c..bff664f 100644 --- a/vibrator/common/HardwareBase.h +++ b/vibrator/common/HardwareBase.h @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -47,17 +48,19 @@ class HwApiBase { class Record : public RecordInterface { public: Record(const char *func, const T &value, const std::ios *stream) - : mFunc(func), mValue(value), mStream(stream) {} + : mFunc(func), mValue(value), mStream(stream), + mTp(std::chrono::system_clock::system_clock::now()) {} std::string toString(const NamesMap &names) override; private: const char *mFunc; const T mValue; const std::ios *mStream; + const std::chrono::system_clock::time_point mTp; }; using Records = std::list>; - static constexpr uint32_t RECORDS_SIZE = 32; + static constexpr uint32_t RECORDS_SIZE = 2048; public: HwApiBase(); @@ -169,9 +172,14 @@ template std::string HwApiBase::Record::toString(const NamesMap &names) { using utils::operator<<; std::stringstream ret; + auto lTp = std::chrono::system_clock::to_time_t(mTp); + struct tm buf; + auto lTime = localtime_r(&lTp, &buf); - ret << mFunc << " '" << names.at(mStream) << "' = '" << mValue << "'"; - + ret << std::put_time(lTime, "%Y-%m-%d %H:%M:%S.") << std::setfill('0') << std::setw(3) + << (std::chrono::duration_cast(mTp.time_since_epoch()) % 1000) + .count() + << " " << mFunc << " '" << names.at(mStream) << "' = '" << mValue << "'"; return ret.str(); } diff --git a/vibrator/cs40l26/Vibrator.cpp b/vibrator/cs40l26/Vibrator.cpp index b3ce88e..c04f7a3 100644 --- a/vibrator/cs40l26/Vibrator.cpp +++ b/vibrator/cs40l26/Vibrator.cpp @@ -71,6 +71,14 @@ static constexpr int32_t COMPOSE_PWLE_SIZE_MAX_DEFAULT = 127; // See the LRA Calibration Support documentation for more details. static constexpr int32_t Q14_BIT_SHIFT = 14; +// Measured ReDC. The LRA series resistance (ReDC), expressed as follows +// redc(ohms) = redc_measured / 2^Q15_BIT_SHIFT. +// This value represents the unit-specific ReDC input to the click compensation +// algorithm. It can be overwritten at a later time by writing to the redc_stored +// sysfs control. +// See the LRA Calibration Support documentation for more details. +static constexpr int32_t Q15_BIT_SHIFT = 15; + // Measured Q factor, q_measured, is represented by Q8.16 fixed // point format on cs40l26 devices. The expression to calculate q is: // q = q_measured / 2^Q16_BIT_SHIFT @@ -115,6 +123,10 @@ static uint16_t amplitudeToScale(float amplitude, float maximum) { return std::round(ratio); } +static float redcToFloat(std::string *caldata) { + return static_cast(std::stoul(*caldata, nullptr, 16)) / (1 << Q15_BIT_SHIFT); +} + enum WaveformBankID : uint8_t { RAM_WVFRM_BANK, ROM_WVFRM_BANK, @@ -592,9 +604,12 @@ Vibrator::Vibrator(std::unique_ptr hwApiDefault, std::unique_ptr h if (mHwCalDef->getF0(&caldata)) { mHwApiDef->setF0(caldata); + mResonantFrequency = + static_cast(std::stoul(caldata, nullptr, 16)) / (1 << Q14_BIT_SHIFT); } if (mHwCalDef->getRedc(&caldata)) { mHwApiDef->setRedc(caldata); + mRedc = redcToFloat(&caldata); } if (mHwCalDef->getQ(&caldata)) { mHwApiDef->setQ(caldata); @@ -1129,12 +1144,7 @@ ndk::ScopedAStatus Vibrator::alwaysOnDisable(int32_t /*id*/) { } ndk::ScopedAStatus Vibrator::getResonantFrequency(float *resonantFreqHz) { - std::string caldata{8, '0'}; - if (!mHwCalDef->getF0(&caldata)) { - ALOGE("Failed to get resonant frequency (%d): %s", errno, strerror(errno)); - return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE); - } - *resonantFreqHz = static_cast(std::stoul(caldata, nullptr, 16)) / (1 << Q14_BIT_SHIFT); + *resonantFreqHz = mResonantFrequency; return ndk::ScopedAStatus::ok(); } @@ -1383,7 +1393,10 @@ binder_status_t Vibrator::dump(int fd, const char **args, uint32_t numArgs) { dprintf(fd, "AIDL:\n"); + dprintf(fd, " Active Effect ID: %" PRId32 "\n", mActiveId); + dprintf(fd, " F0: %.02f\n", mResonantFrequency); dprintf(fd, " F0 Offset: base: %" PRIu32 " flip: %" PRIu32 "\n", mF0Offset, mF0OffsetDual); + dprintf(fd, " Redc: %.02f\n", mRedc); dprintf(fd, " Voltage Levels:\n"); dprintf(fd, " Tick Effect Min: %" PRIu32 " Max: %" PRIu32 "\n", mTickEffectVol[0], @@ -1448,7 +1461,73 @@ binder_status_t Vibrator::dump(int fd, const char **args, uint32_t numArgs) { } } dprintf(fd, "\n"); - dprintf(fd, "\n"); + + dprintf(fd, "Versions:\n"); + 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(); + } + 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(); + } + 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); + 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()); + 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(); + } mHwApiDef->debug(fd); diff --git a/vibrator/cs40l26/Vibrator.h b/vibrator/cs40l26/Vibrator.h index 8f89713..b469b77 100644 --- a/vibrator/cs40l26/Vibrator.h +++ b/vibrator/cs40l26/Vibrator.h @@ -232,6 +232,8 @@ class Vibrator : public BnVibrator { float mLongEffectScale{1.0}; bool mIsChirpEnabled; uint32_t mSupportedPrimitivesBits = 0x0; + float mRedc{0.0f}; + float mResonantFrequency{0.0f}; std::vector mSupportedPrimitives; std::vector mPrimitiveMaxScale; std::vector mPrimitiveMinScale; From 7105ca38e802591f32236fe1b53f62a3ffa7c43e Mon Sep 17 00:00:00 2001 From: Nathan Kulczak Date: Mon, 31 Jul 2023 20:28:58 +0000 Subject: [PATCH 08/13] vibrator: Format PWLE header in user driver Add PWLE header formatting to user side driver to support new kernel driver and SVC and DVL for OWT effects. Bug: 279055885 Bug: 361011775 Flag: EXEMPT bugfix Test: idlcli Change-Id: I3b447962cc46ab57cf145072bc30303786f581ad Signed-off-by: Nathan Kulczak --- vibrator/cs40l26/Vibrator.cpp | 74 +++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/vibrator/cs40l26/Vibrator.cpp b/vibrator/cs40l26/Vibrator.cpp index 03f3646..b4b1cbe 100644 --- a/vibrator/cs40l26/Vibrator.cpp +++ b/vibrator/cs40l26/Vibrator.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -84,6 +85,30 @@ static constexpr uint8_t PWLE_CHIRP_BIT = 0x8; // Dynamic/static frequency and static constexpr uint8_t PWLE_BRAKE_BIT = 0x4; static constexpr uint8_t PWLE_AMP_REG_BIT = 0x2; +static constexpr uint8_t PWLE_WT_TYPE = 12; +static constexpr uint8_t PWLE_HEADER_WORD_COUNT = 3; +static constexpr uint8_t PWLE_HEADER_FTR_SHIFT = 8; +static constexpr uint8_t PWLE_SVC_METADATA_WORD_COUNT = 3; +static constexpr uint32_t PWLE_SVC_METADATA_TERMINATOR = 0xFFFFFF; +static constexpr uint8_t PWLE_SEGMENT_WORD_COUNT = 2; +static constexpr uint8_t PWLE_HEADER_WCOUNT_WORD_OFFSET = 2; +static constexpr uint8_t PWLE_WORD_SIZE = sizeof(uint32_t); + +static constexpr uint8_t PWLE_SVC_NO_BRAKING = -1; +static constexpr uint8_t PWLE_SVC_CAT_BRAKING = 0; +static constexpr uint8_t PWLE_SVC_OPEN_BRAKING = 1; +static constexpr uint8_t PWLE_SVC_CLOSED_BRAKING = 2; +static constexpr uint8_t PWLE_SVC_MIXED_BRAKING = 3; + +static constexpr uint32_t PWLE_SVC_MAX_BRAKING_TIME_MS = 1000; + +static constexpr uint8_t PWLE_FTR_BUZZ_BIT = 0x80; +static constexpr uint8_t PWLE_FTR_CLICK_BIT = 0x00; +static constexpr uint8_t PWLE_FTR_DYNAMIC_F0_BIT = 0x10; +static constexpr uint8_t PWLE_FTR_SVC_METADATA_BIT = 0x04; +static constexpr uint8_t PWLE_FTR_DVL_BIT = 0x02; +static constexpr uint8_t PWLE_FTR_LF0T_BIT = 0x01; + static constexpr float PWLE_LEVEL_MIN = 0.0; static constexpr float PWLE_LEVEL_MAX = 1.0; static constexpr float CS40L26_PWLE_LEVEL_MIN = -1.0; @@ -233,10 +258,18 @@ class DspMemChunk { write(8, 0); /* nsections placeholder */ write(8, 0); /* repeat */ } else if (waveformType == WAVEFORM_PWLE) { + write(16, (PWLE_FTR_BUZZ_BIT | PWLE_FTR_DVL_BIT) + << PWLE_HEADER_FTR_SHIFT); /* Feature flag */ + write(8, PWLE_WT_TYPE); /* type12 */ + write(24, PWLE_HEADER_WORD_COUNT); /* Header word count */ + write(24, 0); /* Body word count placeholder */ + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) write(24, 0); /* Waveform length placeholder */ write(8, 0); /* Repeat */ write(12, 0); /* Wait time between repeats */ write(8, 0); /* nsections placeholder */ +#endif } else { ALOGE("%s: Invalid type: %u", __func__, waveformType); } @@ -324,6 +357,9 @@ class DspMemChunk { ALOGE("%s: Invalid argument: %u", __func__, totalDuration); return -EINVAL; } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) + f += PWLE_HEADER_WORD_COUNT * PWLE_WORD_SIZE; +#endif totalDuration *= 8; /* Unit: 0.125 ms (since wlength played @ 8kHz). */ totalDuration |= WT_LEN_CALCD; /* Bit 23 is for WT_LEN_CALCD; Bit 22 is for WT_INDEFINITE. */ @@ -352,6 +388,9 @@ class DspMemChunk { ALOGE("%s: Invalid argument: %d", __func__, segmentIdx); return -EINVAL; } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) + f += PWLE_HEADER_WORD_COUNT * PWLE_WORD_SIZE; +#endif *(f + 7) |= (0xF0 & segmentIdx) >> 4; /* Bit 4 to 7 */ *(f + 9) |= (0x0F & segmentIdx) << 4; /* Bit 3 to 0 */ } else { @@ -361,6 +400,34 @@ class DspMemChunk { return 0; } + + int updateWCount(int segmentCount) { + uint8_t *f = front(); + + if (segmentCount > COMPOSE_SIZE_MAX + 1 /*1st effect may have a delay*/) { + ALOGE("%s: Invalid argument: %d", __func__, segmentCount); + return -EINVAL; + } + if (f == nullptr) { + ALOGE("%s: head does not exist!", __func__); + return -ENOMEM; + } + if (waveformType != WAVEFORM_PWLE) { + ALOGE("%s: Invalid type: %d", __func__, waveformType); + return -EDOM; + } + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) + f += PWLE_HEADER_WORD_COUNT * PWLE_WORD_SIZE; +#endif + uint32_t dataSize = segmentCount * PWLE_SEGMENT_WORD_COUNT + PWLE_HEADER_WORD_COUNT; + *(f + 0) = (dataSize >> 24) & 0xFF; + *(f + 1) = (dataSize >> 16) & 0xFF; + *(f + 2) = (dataSize >> 8) & 0xFF; + *(f + 3) = dataSize & 0xFF; + + return 0; + } }; Vibrator::Vibrator(std::unique_ptr hwApiDefault, std::unique_ptr hwCalDefault, @@ -1360,6 +1427,13 @@ ndk::ScopedAStatus Vibrator::composePwle(const std::vector &compo return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); } + /* Update word count */ + if (ch.updateWCount(segmentIdx) < 0) { + ALOGE("%s: Failed to update the waveform word count", __func__); + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } + + /* Update waveform length */ if (ch.updateWLength(totalDuration) < 0) { ALOGE("%s: Failed to update the waveform length length", __func__); return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); From 3e925e43493da1a716523f0f7e5352927dad33db Mon Sep 17 00:00:00 2001 From: Robin Peng Date: Fri, 6 Sep 2024 07:35:11 +0000 Subject: [PATCH 09/13] Symlink current prebuilt folder to android root The Android are now based on Trunk Stable world and Pixel prebuilts CLs also needs to reply with this which controlled by the flag which results: - the flag value might be different on each branches - the flag value are mostly different on each release configuration - for local builds, ENGs' needs to figure out the correct location of current prebuilts by checking through entire prebuilt textproto files To alleviate this problem, create an symlink file under android root indicates current prebuilt path after invoke the android lunch cmd. Bug: 364831620 Flag: EXEMPT export current prebuilt path Change-Id: I08d009b79c5d15c078bfbeb3f191271e154cd508 Signed-off-by: Robin Peng --- felix/BoardConfig.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/felix/BoardConfig.mk b/felix/BoardConfig.mk index fdd4c79..98459d7 100644 --- a/felix/BoardConfig.mk +++ b/felix/BoardConfig.mk @@ -39,6 +39,7 @@ USES_IDISPLAY_INTF_SEC := true include device/google/gs201/BoardConfig-common.mk -include vendor/google_devices/gs201/prebuilts/BoardConfigVendor.mk +include device/google/gs-common/check_current_prebuilt/check_current_prebuilt.mk -include vendor/google_devices/felix/proprietary/BoardConfigVendor.mk include device/google/felix-sepolicy/felix-sepolicy.mk include device/google/felix/wifi/BoardConfig-wifi.mk From a42bff793844e594b315149f8c7d775fbebe7215 Mon Sep 17 00:00:00 2001 From: Koli Lin Date: Thu, 5 Sep 2024 08:19:35 +0000 Subject: [PATCH 10/13] Update product id for Felix Test: manual Bug: 316248308 Flag: EXEMPT prop value only update Change-Id: I57bbf91eb9ce9c35a103cfc54f9a6f2002eba54a --- device-felix.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/device-felix.mk b/device-felix.mk index 0812269..69e4375 100644 --- a/device-felix.mk +++ b/device-felix.mk @@ -447,5 +447,6 @@ PRODUCT_PACKAGES += \ AvoidAppsInCutoutOverlay # Bluetooth device id +# Felix: 0x410C PRODUCT_PRODUCT_PROPERTIES += \ - bluetooth.device_id.product_id=20494 + bluetooth.device_id.product_id=16652 From c45009ef1219e071b1f04c6e28d2e820bd883388 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Grzegorz=20Ko=C5=82odziejczyk?= Date: Tue, 16 Jul 2024 12:21:23 +0000 Subject: [PATCH 11/13] audio: enable software encoded Bluetooth broadcast Bug: 345372436 Test: manual Flag: EXEMPT, trivial change Change-Id: I8e84fca69260a3be6d797ccb0d25b3032dac2bee --- .../bluetooth_with_le_audio_policy_configuration_7_0.xml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/audio/felix/config/bluetooth_with_le_audio_policy_configuration_7_0.xml b/audio/felix/config/bluetooth_with_le_audio_policy_configuration_7_0.xml index 8b2af59..efd7277 100644 --- a/audio/felix/config/bluetooth_with_le_audio_policy_configuration_7_0.xml +++ b/audio/felix/config/bluetooth_with_le_audio_policy_configuration_7_0.xml @@ -11,6 +11,7 @@ channelMasks="AUDIO_CHANNEL_OUT_STEREO"/> + + + sources="le audio output"/> + \ No newline at end of file From ea53f43031e0ca9930f145feff56221f041afa5c Mon Sep 17 00:00:00 2001 From: Wayne Lin Date: Thu, 19 Sep 2024 23:05:42 +0800 Subject: [PATCH 12/13] gps: set default SUPL SSL method to SSLv23 Bug: 363886476 Test: verify SUPL NI test pass Change-Id: I56f0139c748a3a04df9f3998653121948846c8fe --- location/gps.6.1.xml.f10 | 2 +- location/gps.xml.f10 | 2 +- location/gps_user.6.1.xml.f10 | 2 +- location/gps_user.xml.f10 | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/location/gps.6.1.xml.f10 b/location/gps.6.1.xml.f10 index 69cb18e..a753dd0 100644 --- a/location/gps.6.1.xml.f10 +++ b/location/gps.6.1.xml.f10 @@ -18,7 +18,7 @@ SuplLogFullName="/data/vendor/gps/suplflow.txt" tlsEnable="true" - SuplSslMethod="SSLv23_NO_TLSv1_2" + SuplSslMethod="SSLv23" SuplEnable="true" SuplUseApn="false" SuplUseApnNI="true" diff --git a/location/gps.xml.f10 b/location/gps.xml.f10 index 92d3316..3ce7975 100644 --- a/location/gps.xml.f10 +++ b/location/gps.xml.f10 @@ -18,7 +18,7 @@ SuplLogFullName="/data/vendor/gps/suplflow.txt" tlsEnable="true" - SuplSslMethod="SSLv23_NO_TLSv1_2" + SuplSslMethod="SSLv23" SuplEnable="true" SuplUseApn="false" SuplUseApnNI="true" diff --git a/location/gps_user.6.1.xml.f10 b/location/gps_user.6.1.xml.f10 index db68a27..7a43bf5 100644 --- a/location/gps_user.6.1.xml.f10 +++ b/location/gps_user.6.1.xml.f10 @@ -17,7 +17,7 @@ SuplLogFullName="/data/vendor/gps/suplflow.txt" tlsEnable="true" - SuplSslMethod="SSLv23_NO_TLSv1_2" + SuplSslMethod="SSLv23" SuplEnable="true" SuplUseApn="false" SuplUseApnNI="true" diff --git a/location/gps_user.xml.f10 b/location/gps_user.xml.f10 index 9ddd3aa..65f3ef0 100644 --- a/location/gps_user.xml.f10 +++ b/location/gps_user.xml.f10 @@ -17,7 +17,7 @@ SuplLogFullName="/data/vendor/gps/suplflow.txt" tlsEnable="true" - SuplSslMethod="SSLv23_NO_TLSv1_2" + SuplSslMethod="SSLv23" SuplEnable="true" SuplUseApn="false" SuplUseApnNI="true" From 810423348e42fc2cf95fb0695caa167dc075cd56 Mon Sep 17 00:00:00 2001 From: Ravi Jain Date: Fri, 27 Sep 2024 07:22:56 +0000 Subject: [PATCH 13/13] vibrator: Update location of PixelVibratorFlags Temporary move the definition from main repository to manage visibility and prevent aosp without vendor build fails Bug: 362659323 Test: Build pass Flag: EXEMPT refactor Change-Id: Ie3bb23838743df1f75261fd530652dcf55b6a643 --- vibrator/cs40l26/Android.bp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vibrator/cs40l26/Android.bp b/vibrator/cs40l26/Android.bp index bd5047a..e929343 100644 --- a/vibrator/cs40l26/Android.bp +++ b/vibrator/cs40l26/Android.bp @@ -60,7 +60,7 @@ cc_library { srcs: [ "Vibrator.cpp", ], - shared_libs: ["//hardware/google/pixel:PixelVibratorFlagsL26"], + shared_libs: ["//device/google/gs-common:PixelVibratorFlagsL26"], export_include_dirs: ["."], vendor_available: true, visibility: [":__subpackages__"],