From f7dec3bb51ed69b14d290d22e7fde15072e3985d Mon Sep 17 00:00:00 2001 From: chenglong1 Date: Tue, 8 Jun 2021 14:53:06 +0800 Subject: [PATCH] Fix artificial vibrating pattern caused AF always on. When vibrating with pattern [0,200,0,50], the vibrating will be started with 200ms duration first, when 200ms timeout, vibrator will be stopped with duration 50ms which will not be considered as long vibrating, then AF will not be turned off after that. This change is for fixing above issue, though we haven't got evidence pointing to above metioned vibrating pattern is user really encounted issue. Change-Id: Iadc8ff7b9e00a11dc1d3e89b822e6cb8adb76116 Signed-off-by: chenglong1 Reviewed-on: https://gerrit.mot.com/1973075 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Long Cheng Reviewed-by: Zhilong Wang Reviewed-by: Darong Huang Reviewed-by: Jian Zhang Reviewed-by: Shuo Wang Reviewed-by: Zhuoran Xu Reviewed-by: Zhichao Chen Reviewed-by: Huosheng Liao Submit-Approved: Jira Key --- drivers/misc/awinic/aw8695/aw8695.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/misc/awinic/aw8695/aw8695.c b/drivers/misc/awinic/aw8695/aw8695.c index 4fb373f72877..135694e5dc8a 100644 --- a/drivers/misc/awinic/aw8695/aw8695.c +++ b/drivers/misc/awinic/aw8695/aw8695.c @@ -67,6 +67,9 @@ #define PM_QOS_VALUE_VB 400 struct pm_qos_request pm_qos_req_vb; +#ifdef CONFIG_AF_NOISE_ELIMINATION +static bool is_af_enabled = false; +#endif /****************************************************** * * variable @@ -603,6 +606,7 @@ static int aw8695_haptic_play_go(struct aw8695 *aw8695, bool flag) if (aw8695->haptic_mode == HAPTIC_LONG) { pr_info("%s: %d: mot_actuator_on_vibrate_start, duration=%d, haptic_mode=%d, play_mode=%hhu \n", __func__,__LINE__ ,aw8695->duration,aw8695->haptic_mode,aw8695->play_mode); + is_af_enabled = true; mot_actuator_on_vibrate_start(); } #endif @@ -644,10 +648,11 @@ static int aw8695_haptic_stop(struct aw8695 *aw8695) aw8695_haptic_play_mode(aw8695, AW8695_HAPTIC_STANDBY_MODE); #ifdef CONFIG_AF_NOISE_ELIMINATION - if (aw8695->haptic_mode == HAPTIC_LONG) { + if ((aw8695->haptic_mode == HAPTIC_LONG) || (is_af_enabled == true)) { pr_info("%s: %d: mot_actuator_on_vibrate_stop, duration=%d, haptic_mode=%d, play_mode=%hhu \n", __func__,__LINE__ ,aw8695->duration,aw8695->haptic_mode,aw8695->play_mode); mot_actuator_on_vibrate_stop(); + is_af_enabled = false; } #endif