input: qcom-hv-haptics: Toggle EN_CTL for PM5100 v1.0

Toggle Haptics EN_CTL as workaround for HW issue in PM5100 v1.0.

Change-Id: I83e82f261d4185132bb5a721600950f90f71db3f
Signed-off-by: Shyam Kumar Thella <sthella@codeaurora.org>
This commit is contained in:
Shyam Kumar Thella 2021-08-18 10:17:42 +05:30 committed by Fenglin Wu
parent b17d684b3b
commit 8928f602e0

View File

@ -1540,6 +1540,40 @@ static int haptics_open_loop_drive_config(struct haptics_chip *chip, bool en)
return 0;
}
static int haptics_module_enable(struct haptics_chip *chip, bool enable)
{
u8 val;
int rc;
val = enable ? HAPTICS_EN_BIT : 0;
rc = haptics_write(chip, chip->cfg_addr_base,
HAP_CFG_EN_CTL_REG, &val, 1);
if (rc < 0)
return rc;
dev_dbg(chip->dev, "haptics module %s\n",
enable ? "enabled" : "disabled");
return 0;
}
static int haptics_toggle_module_enable(struct haptics_chip *chip)
{
int rc;
/*
* Updating HAPTICS_EN would vote hBoost enable status. Add 100us
* delay before updating HAPTICS_EN for hBoost to have enough time
* to handle its power transition.
*/
usleep_range(100, 101);
rc = haptics_module_enable(chip, false);
if (rc < 0)
return rc;
usleep_range(100, 101);
return haptics_module_enable(chip, true);
}
#define BOOST_VREG_OFF_DELAY_SECONDS 2
static int haptics_enable_play(struct haptics_chip *chip, bool en)
{
@ -1938,40 +1972,6 @@ static void haptics_fifo_empty_irq_config(struct haptics_chip *chip,
}
}
static int haptics_module_enable(struct haptics_chip *chip, bool enable)
{
u8 val;
int rc;
val = enable ? HAPTICS_EN_BIT : 0;
rc = haptics_write(chip, chip->cfg_addr_base,
HAP_CFG_EN_CTL_REG, &val, 1);
if (rc < 0)
return rc;
dev_dbg(chip->dev, "haptics module %s\n",
enable ? "enabled" : "disabled");
return 0;
}
static int haptics_toggle_module_enable(struct haptics_chip *chip)
{
int rc;
/*
* Updating HAPTICS_EN would vote hBoost enable status. Add 100us
* delay before updating HAPTICS_EN for hBoost to have enough time
* to handle its power transition.
*/
usleep_range(100, 101);
rc = haptics_module_enable(chip, false);
if (rc < 0)
return rc;
usleep_range(100, 101);
return haptics_module_enable(chip, true);
}
static int haptics_set_fifo(struct haptics_chip *chip, struct fifo_cfg *fifo)
{
struct fifo_play_status *status = &chip->play.fifo_status;