From c890634342db6a31bf68fffd0ce72544046379ea Mon Sep 17 00:00:00 2001 From: Andy White Date: Tue, 6 Dec 2022 10:44:17 -0600 Subject: [PATCH] Reset to default waveform after vibration After any vibration, reset the waveform to the default index of 1. This ensures that the vibe state is always consistent. Change-Id: I7821d7cb0abd57a4b0d0cf1d7315c6b67de58a92 Signed-off-by: Perry White Reviewed-on: https://gerrit.mot.com/2452957 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Konstantin Makariev Submit-Approved: Jira Key --- drivers/misc/awinic/haptic_hv/haptic_hv.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/misc/awinic/haptic_hv/haptic_hv.c b/drivers/misc/awinic/haptic_hv/haptic_hv.c index d95aafb06207..5f0ba42732ec 100644 --- a/drivers/misc/awinic/haptic_hv/haptic_hv.c +++ b/drivers/misc/awinic/haptic_hv/haptic_hv.c @@ -1733,7 +1733,8 @@ static ssize_t activate_store(struct device *dev, struct device_attribute *attr, mutex_lock(&aw_haptic->lock); aw_haptic->state = val; - if (aw_haptic->duration <= 100) { /* Short vibration */ + 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 */ aw_haptic->activate_mode = AW_RAM_MODE; aw_haptic->loop[0] = 0x00; aw_haptic->func->set_wav_loop(aw_haptic, 0x00, 0x00); @@ -1742,6 +1743,8 @@ static ssize_t activate_store(struct device *dev, struct device_attribute *attr, aw_haptic->index = 0x02; aw_haptic->func->set_repeat_seq(aw_haptic, aw_haptic->index); } + + aw_haptic->seq[0] = 1; /* Restore default waveform */ mutex_unlock(&aw_haptic->lock); schedule_work(&aw_haptic->vibrator_work);