From 85d7b144dd1a38f68ec28e64f3a8f865bd86191e Mon Sep 17 00:00:00 2001 From: yaozm1 Date: Wed, 30 Jan 2019 11:07:31 +0800 Subject: [PATCH] Madera-core:Add hard reset as part of resume This is a patch from cirrus. Do hard reset first instead of softreset Change-Id: I2e39289a70f6ba1ee3f1e5f61cbb4611eb06a4d2 Signed-off-by: yaozm1 Reviewed-on: https://gerrit.mot.com/1302929 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Xiangpo Zhao Submit-Approved: Jira Key --- drivers/mfd/madera-core.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/drivers/mfd/madera-core.c b/drivers/mfd/madera-core.c index 098156b951fc..cfdd6cae6a28 100755 --- a/drivers/mfd/madera-core.c +++ b/drivers/mfd/madera-core.c @@ -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); -- 2.20.1