diff options
author | Chase Wu <chasewu@google.com> | 2022-12-07 16:56:39 +0800 |
---|---|---|
committer | Chase Wu <chasewu@google.com> | 2022-12-19 16:02:03 +0800 |
commit | db2f13d19fe68a77ec9f1c1584a222dfa2c9e0c7 (patch) | |
tree | aade046ff55f570ce16ba7224564304207256f74 | |
parent | d4fe1ba8b5cf5ac32282b98c4941bf4dcd6fadce (diff) |
cs40l26: Improve the performance for primitive effects
When we call eraseOwtEffect() in HAL, the ff core will call kernel stop()
before calling the cs40l26_erase_owt() and it will wait for the SVC
waveform protecting time every time.
Under our use case, the vibrator should under stop status before we call
the eraseOwtEffect(). So, in eraseOwtEffect(), we turn off this protecting
time before we do the EVIOCRMFF and turn on it at the end of the
eraseOwtEffect().
Bug: 261687849
Test: atest PtsVibratorHalTestSuite \
PtsHapticsTestCases \
VibratorHalCs40l26TestSuite \
VtsHalVibratorManagerTargetTest \
VtsHalVibratorTargetTest \
android.os.cts.VibratorTest \
android.os.cts.VibratorManagerTest \
android.os.cts.VibrationEffectTest \
android.os.cts.VibrationAttributesTest \
android.os.cts.CombinedVibrationTest \
Change-Id: I48a2ad30dfb7069955ca8e5139756d0e3390fd29
Signed-off-by: Chase Wu <chasewu@google.com>
-rw-r--r-- | vibrator/cs40l26/Hardware.h | 7 | ||||
-rw-r--r-- | vibrator/cs40l26/Vibrator.cpp | 1 | ||||
-rw-r--r-- | vibrator/cs40l26/Vibrator.h | 3 |
3 files changed, 9 insertions, 2 deletions
diff --git a/vibrator/cs40l26/Hardware.h b/vibrator/cs40l26/Hardware.h index ae052ba..2143b96 100644 --- a/vibrator/cs40l26/Hardware.h +++ b/vibrator/cs40l26/Hardware.h @@ -220,7 +220,10 @@ class HwApi : public Vibrator::HwApi, private HwApiBase { ALOGE("Invalid waveform index for OWT erase: %d", effectIndex); return false; } - + // Turn off the waiting time for SVC init phase to complete since chip + // should already under STOP state + setMinOnOffInterval(0); + // Do erase flow if (effectIndex < WAVEFORM_MAX_INDEX) { /* Normal situation. Only erase the effect which we just played. */ if (ioctl(fd, EVIOCRMFF, effectIndex) < 0) { @@ -248,6 +251,8 @@ class HwApi : public Vibrator::HwApi, private HwApiBase { (*effect)[i].id = -1; } } + // Turn on the waiting time for SVC init phase to complete + setMinOnOffInterval(Vibrator::MIN_ON_OFF_INTERVAL_US); return true; } diff --git a/vibrator/cs40l26/Vibrator.cpp b/vibrator/cs40l26/Vibrator.cpp index 3af057c..8f8f48a 100644 --- a/vibrator/cs40l26/Vibrator.cpp +++ b/vibrator/cs40l26/Vibrator.cpp @@ -48,7 +48,6 @@ static constexpr uint32_t WAVEFORM_LONG_VIBRATION_THRESHOLD_MS = 50; 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 uint32_t MIN_ON_OFF_INTERVAL_US = 8500; // SVC initialization time static constexpr int8_t MAX_PAUSE_TIMING_ERROR_MS = 1; // ALERT Irq Handling static constexpr uint32_t MAX_TIME_MS = UINT16_MAX; diff --git a/vibrator/cs40l26/Vibrator.h b/vibrator/cs40l26/Vibrator.h index 220c974..27ee283 100644 --- a/vibrator/cs40l26/Vibrator.h +++ b/vibrator/cs40l26/Vibrator.h @@ -154,6 +154,9 @@ class Vibrator : public BnVibrator { binder_status_t dump(int fd, const char **args, uint32_t numArgs) override; + // SVC initialization time + static constexpr uint32_t MIN_ON_OFF_INTERVAL_US = 8500; + private: ndk::ScopedAStatus on(uint32_t timeoutMs, uint32_t effectIndex, struct dspmem_chunk *ch, const std::shared_ptr<IVibratorCallback> &callback); |