From 6f5ee642088c10f1e7f29386ce103e12e3adb0c2 Mon Sep 17 00:00:00 2001 From: Shyam Kumar Thella Date: Thu, 25 Mar 2021 14:24:24 +0530 Subject: [PATCH] input: qcom-hv-haptics: Don't initialize swr regulator for HAP_CFG V3 Since HAP_CFG V3 doesn't support soundwire haptics, skip initializing swr regulator so that swr_haptics cannot use it. Change-Id: I64d783aabcf699233c68a96af5ffd922d361fb24 Signed-off-by: Shyam Kumar Thella --- drivers/input/misc/qcom-hv-haptics.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/drivers/input/misc/qcom-hv-haptics.c b/drivers/input/misc/qcom-hv-haptics.c index 1709d2af7ef7..4ba08ec6e05d 100644 --- a/drivers/input/misc/qcom-hv-haptics.c +++ b/drivers/input/misc/qcom-hv-haptics.c @@ -28,6 +28,7 @@ #define HAP_CFG_REVISION2_REG 0x01 #define HAP_CFG_V1 0x1 #define HAP_CFG_V2 0x2 +#define HAP_CFG_V3 0x3 #define HAP_CFG_STATUS_DATA_MSB_REG 0x09 /* STATUS_DATA_MSB definitions while MOD_STATUS_SEL is 0 */ @@ -4367,6 +4368,15 @@ static struct attribute *hap_class_attrs[] = { }; ATTRIBUTE_GROUPS(hap_class); +static bool is_swr_supported(struct haptics_chip *chip) +{ + /* Haptics config version 3 does not support soundwire */ + if (chip->cfg_revision == HAP_CFG_V3) + return false; + + return true; +} + static int haptics_probe(struct platform_device *pdev) { struct haptics_chip *chip; @@ -4407,11 +4417,13 @@ static int haptics_probe(struct platform_device *pdev) return rc; } - rc = haptics_init_swr_slave_regulator(chip); - if (rc < 0) { - dev_err(chip->dev, "Initialize swr slave regulator failed, rc = %d\n", - rc); - return rc; + if (is_swr_supported(chip)) { + rc = haptics_init_swr_slave_regulator(chip); + if (rc < 0) { + dev_err(chip->dev, "Initialize swr slave regulator failed, rc = %d\n", + rc); + return rc; + } } rc = devm_request_threaded_irq(chip->dev, chip->fifo_empty_irq,