From 72e5413d75e2342d1d490a245b2dbb1d7ff1d41f Mon Sep 17 00:00:00 2001 From: Fenglin Wu Date: Mon, 14 Dec 2020 11:00:04 +0800 Subject: [PATCH] input: qcom-hv-haptics: keep FORCE_VREG_RDY always set in non-HBoost case FORCE_VREG_RDY bit can be always set when non-HBoost regulator is used and don't clear it when stopping play in non-HBoost case. Also set this bit in driver initialization in non-HBoost case so that swr-haptics driver can take the advantage of triggering SWR play without setting this bit. Change-Id: I6283396d9d5a4f0b87d87932d6db2d8e7bb7a623 Signed-off-by: Fenglin Wu --- drivers/input/misc/qcom-hv-haptics.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/input/misc/qcom-hv-haptics.c b/drivers/input/misc/qcom-hv-haptics.c index c6294c374a41..2f95f454618c 100644 --- a/drivers/input/misc/qcom-hv-haptics.c +++ b/drivers/input/misc/qcom-hv-haptics.c @@ -1205,13 +1205,12 @@ static int haptics_enable_hpwr_vreg(struct haptics_chip *chip, bool en) static int haptics_open_loop_drive_config(struct haptics_chip *chip, bool en) { - int rc; + int rc = 0; u8 val; if ((is_boost_vreg_enabled_in_open_loop(chip) || chip->hpwr_vreg != NULL) && en) { /* Force VREG_RDY */ - val = FORCE_VREG_RDY_BIT; rc = haptics_masked_write(chip, chip->cfg_addr_base, HAP_CFG_VSET_CFG_REG, FORCE_VREG_RDY_BIT, FORCE_VREG_RDY_BIT); @@ -1242,11 +1241,10 @@ static int haptics_open_loop_drive_config(struct haptics_chip *chip, bool en) dev_dbg(chip->dev, "Toggle CAL_EN in open-loop-VREG playing\n"); } - } else { - val = en ? FORCE_VREG_RDY_BIT : 0; + } else if (chip->hpwr_vreg == NULL) { rc = haptics_masked_write(chip, chip->cfg_addr_base, HAP_CFG_VSET_CFG_REG, - FORCE_VREG_RDY_BIT, val); + FORCE_VREG_RDY_BIT, 0); } return rc; @@ -2335,6 +2333,15 @@ static int haptics_hw_init(struct haptics_chip *chip) if (rc < 0) return rc; + /* Force VREG_RDY if non-HBoost is used for powering haptics */ + if (chip->hpwr_vreg) { + rc = haptics_masked_write(chip, chip->cfg_addr_base, + HAP_CFG_VSET_CFG_REG, FORCE_VREG_RDY_BIT, + FORCE_VREG_RDY_BIT); + if (rc < 0) + return rc; + } + if (config->is_erm) return 0;