From 5850a67068ec44919c1b9d2ffa87dac3fa6795d3 Mon Sep 17 00:00:00 2001 From: Fenglin Wu Date: Wed, 24 Jun 2020 11:20:01 +0800 Subject: [PATCH] input: qcom-hv-haptics: set effect to NULL in constant playing In constant waveform playing, there is no need to use an effect data structure to capture the current playing effect, hence set it to NULL. This also helps the set_gain() callback to use the correct Vmax when it's called in constant playing case. Also add a debug message to show the Vmax setting. Change-Id: I763ec7407b8696300dbe93f5e6935900544e75a8 Signed-off-by: Fenglin Wu --- drivers/input/misc/qcom-hv-haptics.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/input/misc/qcom-hv-haptics.c b/drivers/input/misc/qcom-hv-haptics.c index c875acf01ddf..b766e6fd2a6b 100644 --- a/drivers/input/misc/qcom-hv-haptics.c +++ b/drivers/input/misc/qcom-hv-haptics.c @@ -840,6 +840,8 @@ static int haptics_set_vmax_mv(struct haptics_chip *chip, u32 vmax_mv) HAP_CFG_VMAX_REG, &val, 1); if (rc < 0) dev_err(chip->dev, "config VMAX failed, rc=%d\n", rc); + else + dev_dbg(chip->dev, "Set Vmax to %u mV\n", vmax_mv); return rc; } @@ -1313,6 +1315,9 @@ static int haptics_load_constant_effect(struct haptics_chip *chip, u8 amplitude) goto unlock; } + /* No effect data when playing constant waveform */ + play->effect = NULL; + /* configure VMAX in case it was changed in previous effect playing */ rc = haptics_set_vmax_mv(chip, chip->config.vmax_mv); if (rc < 0)