public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH RESEND 1/2] mfd: madera: Add reset as part of resume
@ 2020-10-27  9:41 Charles Keepax
  2020-10-27  9:41 ` [PATCH RESEND 2/2] mfd: madera: Add special errata reset handling for cs47l15 Charles Keepax
  2020-11-04 15:40 ` [PATCH RESEND 1/2] mfd: madera: Add reset as part of resume Lee Jones
  0 siblings, 2 replies; 4+ messages in thread
From: Charles Keepax @ 2020-10-27  9:41 UTC (permalink / raw)
  To: lee.jones; +Cc: linux-kernel, patches

The DCVDD supply does not always power down when the CODEC enters
suspend, for example shared regulators or always-on regulators. In
these cases if a register is written back to the default value whilst
the CODEC is in suspend that register will retain the previous value.
As DCVDD never powered down, the register retains its old value and
as the cache sync only synchronises registers that differ from the
default the new value is never written out.

Ensure the registers are in the expected state after suspend by always
resetting the CODEC on resume. This also has the benefit of being
recommended by the datasheet for DCVDD supplies that take longer than
2mS to rise.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---
 drivers/mfd/madera-core.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/mfd/madera-core.c b/drivers/mfd/madera-core.c
index 4ed6ad8ce0020..a9c6f0833f327 100644
--- a/drivers/mfd/madera-core.c
+++ b/drivers/mfd/madera-core.c
@@ -291,6 +291,8 @@ static int __maybe_unused 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);
@@ -300,7 +302,19 @@ static int __maybe_unused madera_runtime_resume(struct device *dev)
 	regcache_cache_only(madera->regmap, false);
 	regcache_cache_only(madera->regmap_32bit, false);
 
-	usleep_range(MADERA_RESET_MIN_US, MADERA_RESET_MAX_US);
+	madera_disable_hard_reset(madera);
+
+	if (!madera->pdata.reset) {
+		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);
 	if (ret)
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-11-04 15:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-27  9:41 [PATCH RESEND 1/2] mfd: madera: Add reset as part of resume Charles Keepax
2020-10-27  9:41 ` [PATCH RESEND 2/2] mfd: madera: Add special errata reset handling for cs47l15 Charles Keepax
2020-11-04 15:42   ` Lee Jones
2020-11-04 15:40 ` [PATCH RESEND 1/2] mfd: madera: Add reset as part of resume Lee Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox