From f77d8b513beb88a31ecb25d5187a01dd77514690 Mon Sep 17 00:00:00 2001 From: Divya Sharma Date: Wed, 19 Aug 2020 11:29:46 -0700 Subject: [PATCH] Revert "ASoC: swr-haptics: Remove disable regulator during system suspend" This reverts commit c3ca3bfee4b7a56bb72b5ab4272011402d43be28. Change-Id: I551700579adbdde84b65d1d93608f1cb7d6e4a05 --- asoc/codecs/swr-haptics.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/asoc/codecs/swr-haptics.c b/asoc/codecs/swr-haptics.c index dcfeb39dd0..4e1a576930 100644 --- a/asoc/codecs/swr-haptics.c +++ b/asoc/codecs/swr-haptics.c @@ -456,33 +456,48 @@ static int swr_haptics_device_down(struct swr_device *sdev) static int swr_haptics_suspend(struct device *dev) { struct swr_haptics_dev *swr_hap; - int rc = 0; + int rc; swr_hap = swr_get_dev_data(to_swr_device(dev)); if (!swr_hap) { dev_err(dev, "%s: no data for swr_hap\n", __func__); return -ENODEV; } - trace_printk("%s: suspended\n", __func__); - return rc; + /* Put SWR slave into reset */ + rc = regulator_disable(swr_hap->vdd); + if (rc < 0) { + dev_err(swr_hap->dev, "%s: disable swr-slave failed, rc=%d\n", + __func__, rc); + return rc; + } + + return 0; } static int swr_haptics_resume(struct device *dev) { struct swr_haptics_dev *swr_hap; - int rc = 0; + int rc; swr_hap = swr_get_dev_data(to_swr_device(dev)); if (!swr_hap) { dev_err(dev, "%s: no data for swr_hap\n", __func__); return -ENODEV; } - trace_printk("%s: resumed\n", __func__); - return rc; + /* Take SWR slave out of reset */ + rc = regulator_enable(swr_hap->vdd); + if (rc < 0) { + dev_err(swr_hap->dev, "%s: enable swr-slave failed, rc=%d\n", + __func__, rc); + return rc; + } + + return 0; } + static const struct of_device_id swr_haptics_match_table[] = { { .compatible = "qcom,swr-haptics", }, { .compatible = "qcom,pm8350b-swr-haptics", },