Madera-core:Add hard reset as part of resume
authoryaozm1 <yaozm1@lenovo.com>
Wed, 30 Jan 2019 03:07:31 +0000 (11:07 +0800)
committerCosmin Tanislav <demonsingur@gmail.com>
Mon, 22 Apr 2024 17:23:54 +0000 (20:23 +0300)
This is a patch from cirrus.
Do hard reset first instead of softreset

Change-Id: I2e39289a70f6ba1ee3f1e5f61cbb4611eb06a4d2
Signed-off-by: yaozm1 <yaozm1@mt.com>
Reviewed-on: https://gerrit.mot.com/1302929
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com>
Submit-Approved: Jira Key

drivers/mfd/madera-core.c

index 098156b951fcf4f396d324e94cc7f756640e5cfb..cfdd6cae6a287c1d582db57288f78187d7ebe32f 100755 (executable)
@@ -277,6 +277,8 @@ static int madera_runtime_resume(struct device *dev)
 
        dev_dbg(dev, "Leaving sleep mode\n");
 
+       madera_enable_hard_reset(madera);
+
        ret = regulator_enable(madera->dcvdd);
        if (ret) {
                dev_err(dev, "Failed to enable DCVDD: %d\n", ret);
@@ -289,11 +291,18 @@ static int madera_runtime_resume(struct device *dev)
        regcache_cache_only(madera->regmap, false);
        regcache_cache_only(madera->regmap_32bit, false);
 
-       usleep_range(2000, 3000);
-       ret = madera_soft_reset(madera);
-       if (ret) {
-               dev_err(dev, "Failed to reset: %d\n", ret);
-               goto err;
+       madera_disable_hard_reset(madera);
+
+       if (!madera->reset_gpio) {
+               ret = madera_wait_for_boot(madera);
+               if (ret)
+                       goto err;
+
+               ret = madera_soft_reset(madera);
+               if (ret) {
+                       dev_err(dev, "Failed to reset: %d\n", ret);
+                       goto err;
+               }
        }
 
        ret = madera_wait_for_boot(madera);