[DO NOT MERGE] vibrator/cs40l26: Synchronize base and flip actuator F0
Calculate F0 offset using calibration data during initialization for both Vibrator services. Bug: 255435707 Test: Flashed to F10 with logs to verify correct offsets were calculated. Change-Id: I923b45967f5cae04f968178b75382584091869b8 Signed-off-by: Nathan Kulczak <nathankulczak@google.com>
This commit is contained in:
parent
23055c654e
commit
c73579497f
6 changed files with 57 additions and 5 deletions
|
@ -349,13 +349,18 @@ Vibrator::Vibrator(std::unique_ptr<HwApi> hwapi, std::unique_ptr<HwCal> hwcal)
|
|||
mHwApi->setQ(caldata);
|
||||
}
|
||||
|
||||
mHwCal->getLongFrequencyShift(&longFrequencyShift);
|
||||
if (longFrequencyShift > 0) {
|
||||
mF0Offset = longFrequencyShift * std::pow(2, 14);
|
||||
} else if (longFrequencyShift < 0) {
|
||||
mF0Offset = std::pow(2, 24) - std::abs(longFrequencyShift) * std::pow(2, 14);
|
||||
if (mHwCal->getF0SyncOffset(&mF0Offset)) {
|
||||
ALOGI("Vibrator::Vibrator: F0 offset calculated from both base and flip calibration data: %u", mF0Offset);
|
||||
} else {
|
||||
mHwCal->getLongFrequencyShift(&longFrequencyShift);
|
||||
if (longFrequencyShift > 0) {
|
||||
mF0Offset = longFrequencyShift * std::pow(2, 14);
|
||||
} else if (longFrequencyShift < 0) {
|
||||
mF0Offset = std::pow(2, 24) - std::abs(longFrequencyShift) * std::pow(2, 14);
|
||||
} else {
|
||||
mF0Offset = 0;
|
||||
}
|
||||
ALOGI("Vibrator::Vibrator: F0 offset calculated from long shift frequency: %u", mF0Offset);
|
||||
}
|
||||
|
||||
mHwCal->getVersion(&calVer);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue