mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-09 05:39:54 -04:00
haptic_hv: Select waveform based on duration
If seq <= 2 and duration <= 100, select a waveform based on ranges defined in the devicetree. There are three ranges, from smallest duration to largest, corresponding to waveforms 3, 5, and 1, respectively. Change-Id: Iaa83fb9d54c02ef9d13fd0ecb8dbfbd6753390df Signed-off-by: Perry White <awhite6@motorola.com> Reviewed-on: https://gerrit.mot.com/2462031 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Konstantin Makariev <kmakariev@motorola.com> Submit-Approved: Jira Key
This commit is contained in:
parent
c890634342
commit
1b047e88bc
3 changed files with 28 additions and 8 deletions
|
|
@ -7,7 +7,7 @@ ifneq ($(filter m y,$(CONFIG_INPUT_AWINIC_HAPTIC)),)
|
|||
endif
|
||||
|
||||
ifneq (,$(filter felix%,$(TARGET_PRODUCT)))
|
||||
EXTRA_CFLAGS += -DHAPTIC_HV_HAL_COMPAT
|
||||
EXTRA_CFLAGS += -DHAPTIC_HV_HAL_COMPAT -DAW_DURATION_DECIDE_WAVEFORM -DAW_DURATION_WAVESEQ_2=5
|
||||
endif
|
||||
|
||||
obj-m += aw_haptic_hv.o
|
||||
|
|
|
|||
|
|
@ -975,15 +975,15 @@ static int ram_select_waveform(struct aw_haptic *aw_haptic)
|
|||
aw_haptic->activate_mode = AW_RAM_MODE;
|
||||
if ((aw_haptic->duration > 0) &&
|
||||
(aw_haptic->duration < aw_haptic->info.duration_time[0])) {
|
||||
wavseq = 3;
|
||||
wavseq = AW_DURATION_WAVESEQ_1;
|
||||
} else if ((aw_haptic->duration >= aw_haptic->info.duration_time[0]) &&
|
||||
(aw_haptic->duration < aw_haptic->info.duration_time[1])) {
|
||||
wavseq = 2;
|
||||
wavseq = AW_DURATION_WAVESEQ_2;
|
||||
} else if ((aw_haptic->duration >= aw_haptic->info.duration_time[1]) &&
|
||||
(aw_haptic->duration < aw_haptic->info.duration_time[2])) {
|
||||
wavseq = 1;
|
||||
} else if (aw_haptic->duration >= aw_haptic->info.duration_time[2]) {
|
||||
wavseq = 4;
|
||||
(aw_haptic->duration <= aw_haptic->info.duration_time[2])) {
|
||||
wavseq = AW_DURATION_WAVESEQ_3;
|
||||
} else if (aw_haptic->duration > aw_haptic->info.duration_time[2]) {
|
||||
wavseq = AW_DURATION_WAVESEQ_4;
|
||||
wavloop = 15;
|
||||
aw_haptic->activate_mode = AW_RAM_LOOP_MODE;
|
||||
}
|
||||
|
|
@ -1006,7 +1006,7 @@ static void vibrator_work_routine(struct work_struct *work)
|
|||
hrtimer_cancel(&aw_haptic->timer);
|
||||
aw_haptic->func->play_stop(aw_haptic);
|
||||
if (aw_haptic->state) {
|
||||
#ifdef AW_DURATION_DECIDE_WAVEFORM
|
||||
#if defined(AW_DURATION_DECIDE_WAVEFORM) && !defined(HAPTIC_HV_HAL_COMPAT)
|
||||
ram_select_waveform(aw_haptic);
|
||||
#endif
|
||||
aw_haptic->func->upload_lra(aw_haptic, AW_F0_CALI_LRA);
|
||||
|
|
@ -1735,6 +1735,10 @@ static ssize_t activate_store(struct device *dev, struct device_attribute *attr,
|
|||
aw_haptic->state = val;
|
||||
aw_haptic->func->set_wav_seq(aw_haptic, 0, aw_haptic->seq[0]);
|
||||
if (aw_haptic->duration <= 100 || aw_haptic->seq[0] > 2) { /* Short vibration */
|
||||
#ifdef AW_DURATION_DECIDE_WAVEFORM
|
||||
if (aw_haptic->seq[0] <= 2)
|
||||
ram_select_waveform(aw_haptic);
|
||||
#endif
|
||||
aw_haptic->activate_mode = AW_RAM_MODE;
|
||||
aw_haptic->loop[0] = 0x00;
|
||||
aw_haptic->func->set_wav_loop(aw_haptic, 0x00, 0x00);
|
||||
|
|
|
|||
|
|
@ -79,6 +79,22 @@
|
|||
#define AW_BIT_RESET (0xAA)
|
||||
#define CPU_LATENCY_QOC_VALUE (0)
|
||||
|
||||
#ifndef AW_DURATION_WAVESEQ_1
|
||||
#define AW_DURATION_WAVESEQ_1 (3)
|
||||
#endif
|
||||
|
||||
#ifndef AW_DURATION_WAVESEQ_2
|
||||
#define AW_DURATION_WAVESEQ_2 (2)
|
||||
#endif
|
||||
|
||||
#ifndef AW_DURATION_WAVESEQ_3
|
||||
#define AW_DURATION_WAVESEQ_3 (1)
|
||||
#endif
|
||||
|
||||
#ifndef AW_DURATION_WAVESEQ_4
|
||||
#define AW_DURATION_WAVESEQ_4 (4)
|
||||
#endif
|
||||
|
||||
#define AW_CHECK_RAM_DATA
|
||||
#define AW_READ_BIN_FLEXBALLY
|
||||
#define AW_LRA_F0_DEFAULT
|
||||
|
|
|
|||
Loading…
Reference in a new issue