haptics: enable low-power trigger mode for edge sense

This patch enables the low-power trigger mode for drv2624 to allow the
SLPI to trigger the leading edge of a gesture while AP is in suspend
mode.

Bug: 62658365
Test: manually toggle the trigger gpio to verity
Change-Id: Icb795867355dda9bb6987a78eb93c8af1dfb0577
This commit is contained in:
David Lin
2017-07-31 13:45:06 -07:00
parent da1c0f3d9d
commit 2dc836a07b
4 changed files with 21 additions and 4 deletions

View File

@@ -39,6 +39,7 @@ static constexpr char MODE_PATH[] = "/sys/class/leds/vibrator/device/mode";
static constexpr char SEQUENCER_PATH[] = "/sys/class/leds/vibrator/device/set_sequencer";
static constexpr char SCALE_PATH[] = "/sys/class/leds/vibrator/device/scale";
static constexpr char CTRL_LOOP_PATH[] = "/sys/class/leds/vibrator/device/ctrl_loop";
static constexpr char LP_TRIGGER_PATH[] = "/sys/class/leds/vibrator/device/lp_trigger_effect";
// File path to the calibration file
static constexpr char CALIBRATION_FILEPATH[] = "/persist/haptics/drv2624.cal";
@@ -178,13 +179,19 @@ status_t registerVibratorService() {
ALOGW("Failed to open %s (%d): %s", CTRL_LOOP_PATH, error, strerror(error));
}
std::ofstream lptrigger{LP_TRIGGER_PATH};
if (!lptrigger) {
int error = errno;
ALOGW("Failed to open %s (%d): %s", LP_TRIGGER_PATH, error, strerror(error));
}
if (!loadCalibrationData()) {
ALOGW("Failed load calibration data");
}
sp<IVibrator> vibrator = new Vibrator(std::move(activate), std::move(duration),
std::move(state), std::move(rtpinput), std::move(mode),
std::move(sequencer), std::move(scale), std::move(ctrlloop));
std::move(sequencer), std::move(scale), std::move(ctrlloop), std::move(lptrigger));
vibrator->registerAsService();