mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-13 08:07:32 -04:00
Revert "input: qcom-hv-haptics: read CAL_TLRA_CL_STS from SDAM after boot up"
This reverts commit 7d3ecfd796.
This change had caused a regression with swr-haptics driver probe
as the soundwire master couldn't enumerate swr haptics. Revert
this until we can understand why soundwire enumeration fails.
Change-Id: Ie5840247013a1a3fab15758e9ace7b131619be49
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
This commit is contained in:
parent
0afd6cbeae
commit
844516d943
1 changed files with 15 additions and 35 deletions
|
|
@ -34,7 +34,7 @@
|
|||
#define TLRA_CL_ERR_MSB_MASK GENMASK(4, 0)
|
||||
/* STATUS_DATA_MSB definition in V1 while MOD_STATUS_SEL is 5 */
|
||||
#define FIFO_REAL_TIME_FILL_STATUS_MASK_V1 GENMASK(6, 0)
|
||||
/* STATUS_DATA_MSB definition in V2 while MOD_STATUS_SEL is 5 */
|
||||
/* STATUS DATA_MSB definition in V2 while MOD_STATUS_SEL is 5 */
|
||||
#define FIFO_REAL_TIME_FILL_STATUS_MSB_MASK_V2 GENMASK(1, 0)
|
||||
|
||||
#define HAP_CFG_STATUS_DATA_LSB_REG 0x0A
|
||||
|
|
@ -791,16 +791,12 @@ static int haptics_get_closeloop_lra_period_v1(
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* The offset of SDAM register which saves STATUS_DATA_MSB value */
|
||||
#define HAP_STATUS_DATA_MSB_SDAM_OFFSET 0x46
|
||||
|
||||
/* constant definitions for calculating TLRA */
|
||||
#define TLRA_AUTO_RES_ERR_NO_CAL_STEP_PSEC 1667000
|
||||
#define TLRA_AUTO_RES_NO_CAL_STEP_PSEC 3333000
|
||||
#define TLRA_AUTO_RES_ERR_AUTO_CAL_STEP_PSEC 1627700
|
||||
#define TLRA_AUTO_RES_AUTO_CAL_STEP_PSEC 813850
|
||||
static int haptics_get_closeloop_lra_period_v2(
|
||||
struct haptics_chip *chip, bool in_boot)
|
||||
struct haptics_chip *chip)
|
||||
{
|
||||
struct haptics_hw_config *config = &chip->config;
|
||||
u16 cal_tlra_cl_sts, tlra_cl_err_sts, tlra_ol, last_good_tlra_cl_sts;
|
||||
|
|
@ -817,31 +813,16 @@ static int haptics_get_closeloop_lra_period_v2(
|
|||
|
||||
rc_clk_cal = ((val[0] & CAL_RC_CLK_MASK) >> CAL_RC_CLK_SHIFT);
|
||||
/* read auto resonance calibration result */
|
||||
if (in_boot) {
|
||||
if (chip->hap_cfg_nvmem == NULL) {
|
||||
dev_dbg(chip->dev, "nvmem device for hap_cfg is not defined\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
val[0] = MOD_STATUS_SEL_CAL_TLRA_CL_STS_VAL;
|
||||
rc = haptics_write(chip, chip->cfg_addr_base,
|
||||
HAP_CFG_MOD_STATUS_SEL_REG, val, 1);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
|
||||
rc = nvmem_device_read(chip->hap_cfg_nvmem,
|
||||
HAP_STATUS_DATA_MSB_SDAM_OFFSET, 2, val);
|
||||
if (rc < 0) {
|
||||
dev_err(chip->dev, "read SDAM %#x failed, rc=%d\n",
|
||||
HAP_STATUS_DATA_MSB_SDAM_OFFSET, rc);
|
||||
return rc;
|
||||
}
|
||||
} else {
|
||||
val[0] = MOD_STATUS_SEL_CAL_TLRA_CL_STS_VAL;
|
||||
rc = haptics_write(chip, chip->cfg_addr_base,
|
||||
HAP_CFG_MOD_STATUS_SEL_REG, val, 1);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
|
||||
rc = haptics_read(chip, chip->cfg_addr_base,
|
||||
HAP_CFG_STATUS_DATA_MSB_REG, val, 2);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
}
|
||||
rc = haptics_read(chip, chip->cfg_addr_base,
|
||||
HAP_CFG_STATUS_DATA_MSB_REG, val, 2);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
|
||||
auto_res_done = !!(val[0] & AUTO_RES_CAL_DONE_BIT);
|
||||
cal_tlra_cl_sts =
|
||||
|
|
@ -971,15 +952,14 @@ static int haptics_get_closeloop_lra_period_v2(
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int haptics_get_closeloop_lra_period(struct haptics_chip *chip,
|
||||
bool in_boot)
|
||||
static int haptics_get_closeloop_lra_period(struct haptics_chip *chip)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
if (chip->ptn_revision == HAP_PTN_V1)
|
||||
rc = haptics_get_closeloop_lra_period_v1(chip);
|
||||
else
|
||||
rc = haptics_get_closeloop_lra_period_v2(chip, in_boot);
|
||||
rc = haptics_get_closeloop_lra_period_v2(chip);
|
||||
|
||||
if (rc < 0) {
|
||||
dev_err(chip->dev, "get close loop T LRA failed, rc=%d\n",
|
||||
|
|
@ -2177,7 +2157,7 @@ static int haptics_hw_init(struct haptics_chip *chip)
|
|||
return rc;
|
||||
|
||||
/* get calibrated close loop period */
|
||||
rc = haptics_get_closeloop_lra_period(chip, true);
|
||||
rc = haptics_get_closeloop_lra_period(chip);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
|
||||
|
|
@ -3609,7 +3589,7 @@ static int haptics_start_lra_calibration(struct haptics_chip *chip)
|
|||
/* wait for ~150ms to get the LRA calibration result */
|
||||
usleep_range(150000, 155000);
|
||||
|
||||
rc = haptics_get_closeloop_lra_period(chip, false);
|
||||
rc = haptics_get_closeloop_lra_period(chip);
|
||||
if (rc < 0)
|
||||
goto restore;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue