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 <quic_fenglinw@quicinc.com>
This commit is contained in:
Fenglin Wu 2022-03-10 14:13:25 +08:00 committed by David Collins
parent ede62fd6fb
commit bf0527051c

View File

@ -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);