diff options
author | Harpreet Eli Sangha <eliptus@google.com> | 2020-11-09 18:00:49 +0900 |
---|---|---|
committer | Harpreet Eli Sangha <eliptus@google.com> | 2020-11-09 18:03:55 +0900 |
commit | 977898ef974e6d6bc7fda3d699ca5456abc03ebe (patch) | |
tree | 81dc400ad8bfd1ab7da7de9c52defe19d49abde1 /vibrator | |
parent | a0c6e6a56a269112c7c6208701504152d66e9bd3 (diff) | |
download | pixel-977898ef974e6d6bc7fda3d699ca5456abc03ebe.tar.gz |
vibrator: cs40l25: enable CLAB by default
Bug: 138354292
Test: CLAB is enabled on boot and vibrator functions.
Signed-off-by: Harpreet Eli Sangha <eliptus@google.com>
Change-Id: I4dc9e396ec324b9dd5e1330637a13578c4c16058
Diffstat (limited to 'vibrator')
-rw-r--r-- | vibrator/cs40l25/Hardware.h | 3 | ||||
-rw-r--r-- | vibrator/cs40l25/Vibrator.cpp | 2 | ||||
-rw-r--r-- | vibrator/cs40l25/Vibrator.h | 2 | ||||
-rw-r--r-- | vibrator/cs40l25/android.hardware.vibrator-service.cs40l25.rc | 2 | ||||
-rw-r--r-- | vibrator/cs40l25/tests/mocks.h | 1 |
5 files changed, 10 insertions, 0 deletions
diff --git a/vibrator/cs40l25/Hardware.h b/vibrator/cs40l25/Hardware.h index 81936ed9..5a841bbc 100644 --- a/vibrator/cs40l25/Hardware.h +++ b/vibrator/cs40l25/Hardware.h @@ -44,6 +44,7 @@ class HwApi : public Vibrator::HwApi, private HwApiBase { open("device/gpio1_rise_dig_scale", &mGpioRiseScale); open("device/vibe_state", &mVibeState); open("device/num_waves", &mEffectCount); + open("device/clab_enable", &mClabEnable); } bool setF0(uint32_t value) override { return set(value, &mF0); } @@ -67,6 +68,7 @@ class HwApi : public Vibrator::HwApi, private HwApiBase { bool setGpioRiseIndex(uint32_t value) override { return set(value, &mGpioRiseIndex); } bool setGpioRiseScale(uint32_t value) override { return set(value, &mGpioRiseScale); } bool pollVibeState(bool value) override { return poll(value, &mVibeState); } + bool setClabEnable(bool value) override { return set(value, &mClabEnable); } void debug(int fd) override { HwApiBase::debug(fd); } private: @@ -88,6 +90,7 @@ class HwApi : public Vibrator::HwApi, private HwApiBase { std::ofstream mGpioRiseIndex; std::ofstream mGpioRiseScale; std::ifstream mVibeState; + std::ofstream mClabEnable; }; class HwCal : public Vibrator::HwCal, private HwCalBase { diff --git a/vibrator/cs40l25/Vibrator.cpp b/vibrator/cs40l25/Vibrator.cpp index b80cb106..450ca40a 100644 --- a/vibrator/cs40l25/Vibrator.cpp +++ b/vibrator/cs40l25/Vibrator.cpp @@ -126,6 +126,8 @@ Vibrator::Vibrator(std::unique_ptr<HwApi> hwapi, std::unique_ptr<HwCal> hwcal) mEffectDurations[effectIndex] = std::ceil(effectDuration / EFFECT_FREQUENCY_KHZ); } } + + mHwApi->setClabEnable(true); } ndk::ScopedAStatus Vibrator::getCapabilities(int32_t *_aidl_return) { diff --git a/vibrator/cs40l25/Vibrator.h b/vibrator/cs40l25/Vibrator.h index 3d154067..64eab588 100644 --- a/vibrator/cs40l25/Vibrator.h +++ b/vibrator/cs40l25/Vibrator.h @@ -89,6 +89,8 @@ class Vibrator : public BnVibrator { // Blocks until vibrator reaches desired state // (true = enabled, false = disabled). virtual bool pollVibeState(bool value) = 0; + // Enables/disables closed-loop active braking. + virtual bool setClabEnable(bool value) = 0; // Emit diagnostic information to the given file. virtual void debug(int fd) = 0; }; diff --git a/vibrator/cs40l25/android.hardware.vibrator-service.cs40l25.rc b/vibrator/cs40l25/android.hardware.vibrator-service.cs40l25.rc index ff30c3cc..0381912c 100644 --- a/vibrator/cs40l25/android.hardware.vibrator-service.cs40l25.rc +++ b/vibrator/cs40l25/android.hardware.vibrator-service.cs40l25.rc @@ -12,6 +12,7 @@ on property:vendor.all.modules.ready=1 chown system system /sys/class/leds/vibrator/state chown system system /sys/class/leds/vibrator/device/asp_enable + chown system system /sys/class/leds/vibrator/device/clab_enable chown system system /sys/class/leds/vibrator/device/comp_enable chown system system /sys/class/leds/vibrator/device/cp_dig_scale chown system system /sys/class/leds/vibrator/device/cp_trigger_duration @@ -50,6 +51,7 @@ service vendor.vibrator.cs40l25 /vendor/bin/hw/android.hardware.vibrator-service setenv HWAPI_PATH_PREFIX /sys/class/leds/vibrator/ setenv HWAPI_DEBUG_PATHS " device/asp_enable + device/clab_enable device/f0_stored device/fw_rev device/gpio1_fall_dig_scale diff --git a/vibrator/cs40l25/tests/mocks.h b/vibrator/cs40l25/tests/mocks.h index f0fd27a3..7f2a4ddd 100644 --- a/vibrator/cs40l25/tests/mocks.h +++ b/vibrator/cs40l25/tests/mocks.h @@ -44,6 +44,7 @@ class MockApi : public ::aidl::android::hardware::vibrator::Vibrator::HwApi { MOCK_METHOD1(setGpioRiseIndex, bool(uint32_t value)); MOCK_METHOD1(setGpioRiseScale, bool(uint32_t value)); MOCK_METHOD1(pollVibeState, bool(bool value)); + MOCK_METHOD1(setClabEnable, bool(bool value)); MOCK_METHOD1(debug, void(int fd)); ~MockApi() override { destructor(); }; |