Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7f9efca4 authored by Fenglin Wu's avatar Fenglin Wu
Browse files

input: qcom-hv-haptics: restore RC calibration mode after FIFO playing



Auto RC clock calibration is used as default configuration. When playing
FIFO streaming data, manual RC clock calibration is used for adjusting
the FIFO pattern based on the detected LRA frequency. Restore back to use
auto RC clock calibration after FIFO pattern is played.

Change-Id: I335552cfeafe559aa35a76bf6aa218a92b62d3db
Signed-off-by: default avatarFenglin Wu <fenglinw@codeaurora.org>
parent 88fc3718
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -1687,6 +1687,7 @@ static void haptics_fifo_empty_irq_config(struct haptics_chip *chip,
static int haptics_stop_fifo_play(struct haptics_chip *chip)
{
	int rc;
	u8 val;

	if (atomic_read(&chip->play.fifo_status.is_busy) == 0) {
		dev_dbg(chip->dev, "FIFO playing is not in progress\n");
@@ -1707,6 +1708,18 @@ static int haptics_stop_fifo_play(struct haptics_chip *chip)
	chip->custom_effect->fifo->samples = NULL;

	atomic_set(&chip->play.fifo_status.is_busy, 0);

	/*
	 * All other playing modes would use AUTO mode RC
	 * calibration except FIFO streaming mode, so restore
	 * back to AUTO RC calibration after FIFO playing.
	 */
	val = CAL_RC_CLK_AUTO_VAL << CAL_RC_CLK_SHIFT;
	rc = haptics_masked_write(chip, chip->cfg_addr_base,
			HAP_CFG_CAL_EN_REG, CAL_RC_CLK_MASK, val);
	if (rc < 0)
		return rc;

	dev_dbg(chip->dev, "stopped FIFO playing successfully\n");
	return 0;
}