summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChase Wu <chasewu@google.com>2022-08-19 10:50:39 +0800
committerChase Wu <chasewu@google.com>2022-09-21 08:11:51 +0000
commit63e50d6af20c5c33d517fe3b003ab3fd699ebb75 (patch)
treeaf19975ff0699014d9407011db57816fe3ab3f60
parent474de6daef401d8442a52b264f65061b92c05885 (diff)
downloadpixel-63e50d6af20c5c33d517fe3b003ab3fd699ebb75.tar.gz
cs40l25: Remove the low level Ramp Down feature
When enabling both high/low level ramp down feature, the random buzzy feeling will appear . To fix this symptom, we disable the low level ramp down feature since it let high level one lose it's function under a back-to-back call and when the high level one do nothing, the buzzy feeling will appear. Bug: 242061915 Bug: 246475480 Test: check the delay time from VibrationThread logs Signed-off-by: Chase Wu <chasewu@google.com> Change-Id: Id2aab1179125985b5bb83652c55118c0ce672fcd
-rw-r--r--vibrator/cs40l25/Vibrator.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/vibrator/cs40l25/Vibrator.cpp b/vibrator/cs40l25/Vibrator.cpp
index 669258f2..ba4efadf 100644
--- a/vibrator/cs40l25/Vibrator.cpp
+++ b/vibrator/cs40l25/Vibrator.cpp
@@ -112,7 +112,7 @@ static constexpr float PWLE_FREQUENCY_MAX_HZ = 999.0f;
static constexpr float PWLE_BW_MAP_SIZE =
1 + ((PWLE_FREQUENCY_MAX_HZ - PWLE_FREQUENCY_MIN_HZ) / PWLE_FREQUENCY_RESOLUTION_HZ);
static constexpr float RAMP_DOWN_CONSTANT = 1048.576f;
-static constexpr float RAMP_DOWN_TIME_MS = 50.0f;
+static constexpr float RAMP_DOWN_TIME_MS = 0.0f;
static struct pcm_config haptic_nohost_config = {
.channels = 1,
@@ -1276,12 +1276,18 @@ void Vibrator::setPwleRampDown() {
// where Trd is the desired ramp down time in seconds
// pwle_ramp_down accepts only 24 bit integers values
- const float seconds = RAMP_DOWN_TIME_MS / 1000;
- const auto ramp_down_coefficient = static_cast<uint32_t>(RAMP_DOWN_CONSTANT / seconds);
-
- if (!mHwApi->setPwleRampDown(ramp_down_coefficient)) {
- ALOGE("Failed to write \"%d\" to pwle_ramp_down (%d): %s", ramp_down_coefficient, errno,
- strerror(errno));
+ if (RAMP_DOWN_TIME_MS != 0.0) {
+ const float seconds = RAMP_DOWN_TIME_MS / 1000;
+ const auto ramp_down_coefficient = static_cast<uint32_t>(RAMP_DOWN_CONSTANT / seconds);
+ if (!mHwApi->setPwleRampDown(ramp_down_coefficient)) {
+ ALOGE("Failed to write \"%d\" to pwle_ramp_down (%d): %s", ramp_down_coefficient, errno,
+ strerror(errno));
+ }
+ } else {
+ // Turn off the low level PWLE Ramp Down feature
+ if (!mHwApi->setPwleRampDown(0)) {
+ ALOGE("Failed to write 0 to pwle_ramp_down (%d): %s", errno, strerror(errno));
+ }
}
}