From bf0527051c66a71ca48d087cdc6ed5be68172eba Mon Sep 17 00:00:00 2001 From: Fenglin Wu Date: Thu, 10 Mar 2022 14:13:25 +0800 Subject: [PATCH] input: qcom-hv-haptics: ignore flushing FIFO memory during refilling HAP525_HV haptics module has a register to flush the FIFO memory before programming FIFO samples, this can only be done before initiating a new FIFO play but not during FIFO refilling. Fix this. Change-Id: I12cb9deeb1c85f979f455187f13e0f13f02f935f Signed-off-by: Fenglin Wu --- drivers/input/misc/qcom-hv-haptics.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/input/misc/qcom-hv-haptics.c b/drivers/input/misc/qcom-hv-haptics.c index 483d03512523..dace2b08e7a0 100644 --- a/drivers/input/misc/qcom-hv-haptics.c +++ b/drivers/input/misc/qcom-hv-haptics.c @@ -1598,7 +1598,7 @@ static int haptics_update_memory_data(struct haptics_chip *chip, } static int haptics_update_fifo_samples(struct haptics_chip *chip, - u8 *samples, u32 length) + u8 *samples, u32 length, bool refill) { int rc; u8 val; @@ -1608,7 +1608,7 @@ static int haptics_update_fifo_samples(struct haptics_chip *chip, return -EINVAL; } - if (chip->hw_type == HAP525_HV) { + if (chip->hw_type == HAP525_HV && !refill) { val = MEM_FLUSH_RELOAD_BIT; rc = haptics_write(chip, chip->ptn_addr_base, HAP_PTN_MEM_OP_ACCESS_REG, &val, 1); @@ -1858,7 +1858,7 @@ static int haptics_set_fifo(struct haptics_chip *chip, struct fifo_cfg *fifo) return available; num = min_t(u32, available, num); - rc = haptics_update_fifo_samples(chip, fifo->samples, num); + rc = haptics_update_fifo_samples(chip, fifo->samples, num, false); if (rc < 0) { dev_err(chip->dev, "write FIFO samples failed, rc=%d\n", rc); return rc; @@ -3008,7 +3008,7 @@ static irqreturn_t fifo_empty_irq_handler(int irq, void *data) samples = fifo->samples + status->samples_written; /* Write more pattern data into FIFO memory. */ - rc = haptics_update_fifo_samples(chip, samples, num); + rc = haptics_update_fifo_samples(chip, samples, num, true); if (rc < 0) { dev_err(chip->dev, "Update FIFO samples failed, rc=%d\n", rc);