input: qcom-hv-haptics: limit play rate for PM8350B v1 hardware

Due to a hardware limitation, PM8350B v1 cannot play more than 8 KHz as
it has a FIFO size of 104 bytes. Hence limit the play rate for PM8350B
v1 to 8 KHz.

Change-Id: Ibeabd4c0229a54e2d99023c8fbc5970b1a7a1e64
Signed-off-by: Fenglin Wu <fenglinw@codeaurora.org>
This commit is contained in:
Fenglin Wu 2020-04-03 12:53:15 +08:00 committed by David Collins
parent 6679b3b4e6
commit 326c01c11c

View File

@ -966,6 +966,13 @@ static int haptics_set_fifo(struct haptics_chip *chip, struct fifo_cfg *fifo)
return -EBUSY;
}
if (chip->ptn_revision == HAP_PTN_V1 &&
fifo->period_per_s > F_8KHZ &&
fifo->num_s > MAX_FIFO_SAMPLES(chip)) {
dev_err(chip->dev, "PM8350B v1 doesn't support playing long FIFO pattern higher than 8 KHz play rate\n");
return -EINVAL;
}
/* Configure FIFO play rate */
rc = haptics_set_fifo_playrate(chip, fifo->period_per_s);
if (rc < 0)