summaryrefslogtreecommitdiff
path: root/vibrator
diff options
context:
space:
mode:
authorchasewu <chasewu@google.com>2020-02-18 18:07:46 +0800
committerchasewu <chasewu@google.com>2020-04-28 09:15:16 +0800
commitb3aa4df6bf4cf2ac0a2342377e5e5d29b064a07a (patch)
tree8dd10630c3d0bf728af0b2288ef9176e38f57c1f /vibrator
parentaea1243a43294ba5a8c2bd72fc06cdc7c597d608 (diff)
downloadsunfish-b3aa4df6bf4cf2ac0a2342377e5e5d29b064a07a.tar.gz
vibrator: Remove trigger effect support
In the previous projects, only edge sensor used this trigger effect. However, edge sensor did not involve in this project, we decide to remove trigger effect support. Bug: 148838005 Test: print registers' value in suspend mode Change-Id: I27d7c2419f77a3ddba71776c35b3de20c29af016 Signed-off-by: chasewu <chasewu@google.com>
Diffstat (limited to 'vibrator')
-rw-r--r--vibrator/drv2624/Hardware.h4
-rw-r--r--vibrator/drv2624/Vibrator.cpp7
-rw-r--r--vibrator/drv2624/Vibrator.h2
-rw-r--r--vibrator/drv2624/tests/mocks.h1
4 files changed, 12 insertions, 2 deletions
diff --git a/vibrator/drv2624/Hardware.h b/vibrator/drv2624/Hardware.h
index 8e220688..774a0f1d 100644
--- a/vibrator/drv2624/Hardware.h
+++ b/vibrator/drv2624/Hardware.h
@@ -108,6 +108,7 @@ class HwCal : public Vibrator::HwCal, private HwCalBase {
static constexpr uint32_t DEFAULT_LRA_PERIOD = 262;
static constexpr uint32_t DEFAULT_FREQUENCY_SHIFT = 10;
static constexpr uint32_t DEFAULT_VOLTAGE_MAX = 107; // 2.15V;
+ static constexpr uint32_t DEFAULT_LP_TRIGGER_SUPPORT = 1;
public:
HwCal() {}
@@ -167,6 +168,9 @@ class HwCal : public Vibrator::HwCal, private HwCalBase {
bool getSteadyShape(uint32_t *value) override {
return getProperty("steady.shape", value, UINT32_MAX);
}
+ bool getTriggerEffectSupport(uint32_t *value) override {
+ return getProperty("lptrigger", value, DEFAULT_LP_TRIGGER_SUPPORT);
+ }
void debug(int fd) override { HwCalBase::debug(fd); }
};
diff --git a/vibrator/drv2624/Vibrator.cpp b/vibrator/drv2624/Vibrator.cpp
index be611de8..99fd6d93 100644
--- a/vibrator/drv2624/Vibrator.cpp
+++ b/vibrator/drv2624/Vibrator.cpp
@@ -181,7 +181,7 @@ using EffectStrength = ::android::hardware::vibrator::V1_0::EffectStrength;
Vibrator::Vibrator(std::unique_ptr<HwApi> hwapi, std::unique_ptr<HwCal> hwcal)
: mHwApi(std::move(hwapi)), mHwCal(std::move(hwcal)) {
std::string autocal;
- uint32_t lraPeriod = 0;
+ uint32_t lraPeriod = 0, lpTrigSupport = 0;
bool dynamicConfig = false;
bool hasEffectCoeffs = false;
std::array<float, 4> effectCoeffs = {0};
@@ -271,7 +271,10 @@ Vibrator::Vibrator(std::unique_ptr<HwApi> hwapi, std::unique_ptr<HwCal> hwcal)
// This enables effect #1 from the waveform library to be triggered by SLPI
// while the AP is in suspend mode
- if (!mHwApi->setLpTriggerEffect(1)) {
+ // For default setting, we will enable this feature if that project did not
+ // set the lptrigger config
+ mHwCal->getTriggerEffectSupport(&lpTrigSupport);
+ if (!mHwApi->setLpTriggerEffect(lpTrigSupport)) {
ALOGW("Failed to set LP trigger mode (%d): %s", errno, strerror(errno));
}
}
diff --git a/vibrator/drv2624/Vibrator.h b/vibrator/drv2624/Vibrator.h
index 5419d62e..fb3c2d37 100644
--- a/vibrator/drv2624/Vibrator.h
+++ b/vibrator/drv2624/Vibrator.h
@@ -121,6 +121,8 @@ class Vibrator : public IVibrator {
virtual bool getEffectShape(uint32_t *value) = 0;
// Obtains the wave shape for steady vibration
virtual bool getSteadyShape(uint32_t *value) = 0;
+ // Obtains the trigger effect support
+ virtual bool getTriggerEffectSupport(uint32_t *value) = 0;
// Emit diagnostic information to the given file.
virtual void debug(int fd) = 0;
};
diff --git a/vibrator/drv2624/tests/mocks.h b/vibrator/drv2624/tests/mocks.h
index 553e7a97..b3c7cb02 100644
--- a/vibrator/drv2624/tests/mocks.h
+++ b/vibrator/drv2624/tests/mocks.h
@@ -59,6 +59,7 @@ class MockCal : public ::android::hardware::vibrator::V1_3::implementation::Vibr
MOCK_METHOD1(getHeavyClickDuration, bool(uint32_t *value));
MOCK_METHOD1(getEffectShape, bool(uint32_t *value));
MOCK_METHOD1(getSteadyShape, bool(uint32_t *value));
+ MOCK_METHOD1(getTriggerEffectSupport, bool(uint32_t *value));
MOCK_METHOD1(debug, void(int fd));
~MockCal() override { destructor(); };