From e37bf7e664a06ee6b6872f5f3d2ed02ff0be81d8 Mon Sep 17 00:00:00 2001 From: Fenglin Wu Date: Wed, 22 Dec 2021 12:31:01 +0800 Subject: [PATCH] input: qcom-hv-haptics: use OL_TLRA if getting CL_TLRA failed If getting close-loop TLRA failed in driver probe, such as if there is no valid value in SDAM register for CAL_TLRA_CL_STS because of the bootloader had not run the frequency calibration successfully. Use open-loop TLRA to program the hardware so the vibrator can still be functional but just lose some efficiency because of unadjusted frequency. Change-Id: I8b8dd0906aa6b3fa882e2044cdbe579c746714a3 Signed-off-by: Fenglin Wu --- drivers/input/misc/qcom-hv-haptics.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/input/misc/qcom-hv-haptics.c b/drivers/input/misc/qcom-hv-haptics.c index 029c856cde07..6ae671a6b73b 100644 --- a/drivers/input/misc/qcom-hv-haptics.c +++ b/drivers/input/misc/qcom-hv-haptics.c @@ -2720,15 +2720,14 @@ static int haptics_init_lra_period_config(struct haptics_chip *chip) return rc; /* get calibrated close loop period */ + t_lra_us = chip->config.t_lra_us; rc = haptics_get_closeloop_lra_period(chip, true); - if (rc < 0) - return rc; + if (!rc && chip->config.cl_t_lra_us != 0) + t_lra_us = chip->config.cl_t_lra_us; + else + dev_warn(chip->dev, "get closeloop LRA period failed, rc=%d\n", rc); /* Config T_LRA */ - t_lra_us = chip->config.t_lra_us; - if (chip->config.cl_t_lra_us != 0) - t_lra_us = chip->config.cl_t_lra_us; - return haptics_config_openloop_lra_period(chip, t_lra_us); }