From 6b1eef402a6fa39230c4968ad4a62eeaea0f4fa2 Mon Sep 17 00:00:00 2001 From: Konstantin Makariev Date: Thu, 25 Aug 2022 14:51:28 -0500 Subject: [PATCH] fixup! (CR) drv8424_mmi: motor slippage recovery Fixing missed condition for running in no sensors mode Mot-CRs-fixed: (CR) Signed-off-by: Konstantin Makariev Change-Id: I2b7bb40a38c432f301d4b1a3a3742bb0d26cfafb Reviewed-on: https://gerrit.mot.com/2371667 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Qing Chang Submit-Approved: Jira Key --- drivers/misc/drv8424/drv8424.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/misc/drv8424/drv8424.c b/drivers/misc/drv8424/drv8424.c index 579271e4c528..f4c26b5b4c53 100644 --- a/drivers/misc/drv8424/drv8424.c +++ b/drivers/misc/drv8424/drv8424.c @@ -1154,6 +1154,11 @@ static enum hrtimer_restart motor_timeout_timer_action(struct hrtimer *h) int destination = atomic_read(&md->destination); enum hrtimer_restart ret = HRTIMER_NORESTART; + if (md->sensors_off) { + dev_warn(md->dev, "time out in no sensors mode!\n"); + goto exit; + } + if (POSITION_RANGE_CHK(original) && POSITION_RANGE_CHK(destination)) { LOGD("Timeout: position=%s, detection=%s\n", @@ -1180,7 +1185,7 @@ static enum hrtimer_restart motor_timeout_timer_action(struct hrtimer *h) LOGD("Timeout position detection\n"); } moto_drv8424_cmd_push(md, CMD_TIMEOUT, INT_50MS); - +exit: return ret; } @@ -2088,8 +2093,10 @@ static ssize_t motor_sensor_data_store(struct device *dev, struct device_attribu */ if (md->sensor_data[0] == UNINITIALIZED) { inited = true; - md->time_out = MOTOR_DETECT_EXPIRE; - moto_drv8424_cmd_push(md, CMD_TIMER_START, 0); + if (!md->sensors_off) { + md->time_out = MOTOR_DETECT_EXPIRE; + moto_drv8424_cmd_push(md, CMD_TIMER_START, 0); + } } } /* store necessary sensor info */