From 8928f602e07919be72c9bd6901dac44fd78623c4 Mon Sep 17 00:00:00 2001 From: Shyam Kumar Thella Date: Wed, 18 Aug 2021 10:17:42 +0530 Subject: [PATCH] input: qcom-hv-haptics: Toggle EN_CTL for PM5100 v1.0 Toggle Haptics EN_CTL as workaround for HW issue in PM5100 v1.0. Change-Id: I83e82f261d4185132bb5a721600950f90f71db3f Signed-off-by: Shyam Kumar Thella --- drivers/input/misc/qcom-hv-haptics.c | 68 ++++++++++++++-------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/drivers/input/misc/qcom-hv-haptics.c b/drivers/input/misc/qcom-hv-haptics.c index cca0c26f8eae..c73c25c35cc6 100644 --- a/drivers/input/misc/qcom-hv-haptics.c +++ b/drivers/input/misc/qcom-hv-haptics.c @@ -1540,6 +1540,40 @@ static int haptics_open_loop_drive_config(struct haptics_chip *chip, bool en) return 0; } +static int haptics_module_enable(struct haptics_chip *chip, bool enable) +{ + u8 val; + int rc; + + val = enable ? HAPTICS_EN_BIT : 0; + rc = haptics_write(chip, chip->cfg_addr_base, + HAP_CFG_EN_CTL_REG, &val, 1); + if (rc < 0) + return rc; + + dev_dbg(chip->dev, "haptics module %s\n", + enable ? "enabled" : "disabled"); + return 0; +} + +static int haptics_toggle_module_enable(struct haptics_chip *chip) +{ + int rc; + + /* + * Updating HAPTICS_EN would vote hBoost enable status. Add 100us + * delay before updating HAPTICS_EN for hBoost to have enough time + * to handle its power transition. + */ + usleep_range(100, 101); + rc = haptics_module_enable(chip, false); + if (rc < 0) + return rc; + + usleep_range(100, 101); + return haptics_module_enable(chip, true); +} + #define BOOST_VREG_OFF_DELAY_SECONDS 2 static int haptics_enable_play(struct haptics_chip *chip, bool en) { @@ -1938,40 +1972,6 @@ static void haptics_fifo_empty_irq_config(struct haptics_chip *chip, } } -static int haptics_module_enable(struct haptics_chip *chip, bool enable) -{ - u8 val; - int rc; - - val = enable ? HAPTICS_EN_BIT : 0; - rc = haptics_write(chip, chip->cfg_addr_base, - HAP_CFG_EN_CTL_REG, &val, 1); - if (rc < 0) - return rc; - - dev_dbg(chip->dev, "haptics module %s\n", - enable ? "enabled" : "disabled"); - return 0; -} - -static int haptics_toggle_module_enable(struct haptics_chip *chip) -{ - int rc; - - /* - * Updating HAPTICS_EN would vote hBoost enable status. Add 100us - * delay before updating HAPTICS_EN for hBoost to have enough time - * to handle its power transition. - */ - usleep_range(100, 101); - rc = haptics_module_enable(chip, false); - if (rc < 0) - return rc; - - usleep_range(100, 101); - return haptics_module_enable(chip, true); -} - static int haptics_set_fifo(struct haptics_chip *chip, struct fifo_cfg *fifo) { struct fifo_play_status *status = &chip->play.fifo_status;