Skip to contentSkip to conversation

ASoC: cs35l35: Add additional delay for reset

PATCH In review Charles Keepax 3 participants 3 messages May 31, 2017 – Jun 6, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: cs35l35: Add additional delay for reset

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.

---
 sound/soc/codecs/cs35l35.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
sound/soc/codecs/cs35l35.c +9 -1
index 375be49..f1ee184 100644
@@ -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);
 
Signature · 1 line
2.1.4
Acked-by on v1 1/1
#1 lore raw
Quoted 31 lines · Charles Keepax

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.

---
 sound/soc/codecs/cs35l35.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
sound/soc/codecs/cs35l35.c +8 -0
index 375be49..f1ee184 100644
@@ -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;

sound/soc/codecs/cs35l35.c static int cs35l35_i2c_probe(struct i2c_client *i2c_client, · line 1550

Quoted 8 lines
sound/soc/codecs/cs35l35.c +1 -1
@@ -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);
 
maintainer
#2 lore raw

Applied "ASoC: cs35l35: Add additional delay for reset" to the asoc tree

In reply to Charles Keepax

The patch

ASoC: cs35l35: Add additional delay for reset

has been applied to the asoc tree at

git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

Quoted 1 line

From dc43f46a9b6988a40d4e11d05b8107d4546c61b9 Mon Sep 17 00:00:00 2001

From: Charles Keepax <[email protected]>
Date: Wed, 31 May 2017 16:51:13 +0100
Subject: [PATCH] ASoC: cs35l35: Add additional delay for reset

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.

---
 sound/soc/codecs/cs35l35.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
sound/soc/codecs/cs35l35.c +9 -1
index f8aef5869b03..5ff12e4116e5 100644
@@ -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;
@@ -1454,7 +1462,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);
 
Signature · 1 line
2.11.0