From e678995484fc1c97fd1622653b6173bc41765211 Mon Sep 17 00:00:00 2001 From: Fenglin Wu Date: Tue, 7 Jul 2020 08:30:54 +0800 Subject: [PATCH] input: qcom-hv-haptics: clear HW faults before enabling play If there was any HW fault generated in previous playing, it would be retained until writing the FAULT_CLR register. Clear the HW faults before triggering play to make sure it won't be started with any retained fault status. Change-Id: Ibac0e1ed3c745efeb5048845a073605642d8407d Signed-off-by: Fenglin Wu --- drivers/input/misc/qcom-hv-haptics.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/input/misc/qcom-hv-haptics.c b/drivers/input/misc/qcom-hv-haptics.c index bd73ac348607..d0e013b8db35 100644 --- a/drivers/input/misc/qcom-hv-haptics.c +++ b/drivers/input/misc/qcom-hv-haptics.c @@ -891,6 +891,15 @@ static int haptics_enable_play(struct haptics_chip *chip, bool en) int rc; u8 val; + if (en) { + val = SC_CLR_BIT | AUTO_RES_ERR_CLR_BIT | + HPWR_RDY_FAULT_CLR_BIT; + rc = haptics_write(chip, chip->cfg_addr_base, + HAP_CFG_FAULT_CLR_REG, &val, 1); + if (rc < 0) + return rc; + } + val = play->pattern_src; if (play->brake && !play->brake->disabled) val |= BRAKE_EN_BIT;