All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: cs35l35: Add additional delay for reset
@ 2017-05-31 15:51 Charles Keepax
  2017-06-06 15:18 ` Paul Handrigan
  2017-06-06 19:05 ` Applied "ASoC: cs35l35: Add additional delay for reset" to the asoc tree Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Charles Keepax @ 2017-05-31 15:51 UTC (permalink / raw)
  To: broonie; +Cc: patches, brian.austin, alsa-devel, lgirdwood, Paul.Handrigan

Very fast systems may violate the minimum constraints for time the reset
line needs to remain low, or communicate with the device too soon after
releasing the reset. Fix this by adding some delays in to allow the chip
to properly reset, also factor out the reset into a function as it is
likely it will be re-used in later additions to the driver.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
---
 sound/soc/codecs/cs35l35.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/sound/soc/codecs/cs35l35.c b/sound/soc/codecs/cs35l35.c
index 375be49..f1ee184 100644
--- a/sound/soc/codecs/cs35l35.c
+++ b/sound/soc/codecs/cs35l35.c
@@ -162,6 +162,14 @@ static bool cs35l35_precious_register(struct device *dev, unsigned int reg)
 	}
 }
 
+static void cs35l35_reset(struct cs35l35_private *cs35l35)
+{
+	gpiod_set_value_cansleep(cs35l35->reset_gpio, 0);
+	usleep_range(2000, 2100);
+	gpiod_set_value_cansleep(cs35l35->reset_gpio, 1);
+	usleep_range(1000, 1100);
+}
+
 static int cs35l35_wait_for_pdn(struct cs35l35_private *cs35l35)
 {
 	int ret;
@@ -1536,7 +1544,7 @@ static int cs35l35_i2c_probe(struct i2c_client *i2c_client,
 		}
 	}
 
-	gpiod_set_value_cansleep(cs35l35->reset_gpio, 1);
+	cs35l35_reset(cs35l35);
 
 	init_completion(&cs35l35->pdn_done);
 
-- 
2.1.4

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

end of thread, other threads:[~2017-06-06 19:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-31 15:51 [PATCH] ASoC: cs35l35: Add additional delay for reset Charles Keepax
2017-06-06 15:18 ` Paul Handrigan
2017-06-06 19:05 ` Applied "ASoC: cs35l35: Add additional delay for reset" to the asoc tree Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.