All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2] ASoC: cs42xx8: Add reset gpio handling
@ 2019-05-16  6:04 S.j. Wang
  2019-05-16 10:11 ` Mark Brown
  2019-05-17 10:34 ` Applied "ASoC: cs42xx8: Add reset gpio handling" to the asoc tree Mark Brown
  0 siblings, 2 replies; 5+ messages in thread
From: S.j. Wang @ 2019-05-16  6:04 UTC (permalink / raw)
  To: brian.austin, Paul.Handrigan, lgirdwood, broonie, perex, tiwai,
	alsa-devel
  Cc: linux-kernel

Handle the reset GPIO and reset the device every time we
start it.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
---
Changes in v2
- use devm_gpiod_get_optional instead of of_get_named_gpio

 sound/soc/codecs/cs42xx8.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/sound/soc/codecs/cs42xx8.c b/sound/soc/codecs/cs42xx8.c
index 28a4ac36c4f8..b377cddaf2e6 100644
--- a/sound/soc/codecs/cs42xx8.c
+++ b/sound/soc/codecs/cs42xx8.c
@@ -14,6 +14,7 @@
 #include <linux/delay.h>
 #include <linux/module.h>
 #include <linux/of_device.h>
+#include <linux/of_gpio.h>
 #include <linux/pm_runtime.h>
 #include <linux/regulator/consumer.h>
 #include <sound/pcm_params.h>
@@ -45,6 +46,7 @@ struct cs42xx8_priv {
 	bool slave_mode;
 	unsigned long sysclk;
 	u32 tx_channels;
+	struct gpio_desc *gpiod_reset;
 };
 
 /* -127.5dB to 0dB with step of 0.5dB */
@@ -467,6 +469,13 @@ int cs42xx8_probe(struct device *dev, struct regmap *regmap)
 		return -EINVAL;
 	}
 
+	cs42xx8->gpiod_reset = devm_gpiod_get_optional(dev, "reset",
+							GPIOD_OUT_HIGH);
+	if (IS_ERR(cs42xx8->gpiod_reset))
+		return PTR_ERR(cs42xx8->gpiod_reset);
+
+	gpiod_set_value_cansleep(cs42xx8->gpiod_reset, 0);
+
 	cs42xx8->clk = devm_clk_get(dev, "mclk");
 	if (IS_ERR(cs42xx8->clk)) {
 		dev_err(dev, "failed to get the clock: %ld\n",
@@ -547,6 +556,8 @@ static int cs42xx8_runtime_resume(struct device *dev)
 		return ret;
 	}
 
+	gpiod_set_value_cansleep(cs42xx8->gpiod_reset, 0);
+
 	ret = regulator_bulk_enable(ARRAY_SIZE(cs42xx8->supplies),
 				    cs42xx8->supplies);
 	if (ret) {
@@ -586,6 +597,8 @@ static int cs42xx8_runtime_suspend(struct device *dev)
 	regulator_bulk_disable(ARRAY_SIZE(cs42xx8->supplies),
 			       cs42xx8->supplies);
 
+	gpiod_set_value_cansleep(cs42xx8->gpiod_reset, 1);
+
 	clk_disable_unprepare(cs42xx8->clk);
 
 	return 0;
-- 
2.21.0


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

* Re: [PATCH V2] ASoC: cs42xx8: Add reset gpio handling
  2019-05-16  6:04 [PATCH V2] ASoC: cs42xx8: Add reset gpio handling S.j. Wang
@ 2019-05-16 10:11 ` Mark Brown
  2019-05-17 10:34 ` Applied "ASoC: cs42xx8: Add reset gpio handling" to the asoc tree Mark Brown
  1 sibling, 0 replies; 5+ messages in thread
From: Mark Brown @ 2019-05-16 10:11 UTC (permalink / raw)
  To: S.j. Wang
  Cc: brian.austin, Paul.Handrigan, lgirdwood, perex, tiwai,
	alsa-devel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 284 bytes --]

On Thu, May 16, 2019 at 06:04:58AM +0000, S.j. Wang wrote:

> +	cs42xx8->gpiod_reset = devm_gpiod_get_optional(dev, "reset",
> +							GPIOD_OUT_HIGH);
> +	if (IS_ERR(cs42xx8->gpiod_reset))
> +		return PTR_ERR(cs42xx8->gpiod_reset);

You also need a binding document update for this.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Applied "ASoC: cs42xx8: Add reset gpio handling" to the asoc tree
  2019-05-16  6:04 [PATCH V2] ASoC: cs42xx8: Add reset gpio handling S.j. Wang
  2019-05-16 10:11 ` Mark Brown
@ 2019-05-17 10:34 ` Mark Brown
  1 sibling, 0 replies; 5+ messages in thread
From: Mark Brown @ 2019-05-17 10:34 UTC (permalink / raw)
  Cc: brian.austin, alsa-devel, Shengjiu Wang, tiwai, linux-kernel,
	Paul.Handrigan, lgirdwood, Mark Brown

The patch

   ASoC: cs42xx8: Add reset gpio handling

has been applied to the asoc tree at

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.3

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

>From bfe95dfa4dacefbe20a8532bdac0a19da0708be4 Mon Sep 17 00:00:00 2001
From: "S.j. Wang" <shengjiu.wang@nxp.com>
Date: Thu, 16 May 2019 06:04:58 +0000
Subject: [PATCH] ASoC: cs42xx8: Add reset gpio handling

Handle the reset GPIO and reset the device every time we
start it.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/codecs/cs42xx8.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/sound/soc/codecs/cs42xx8.c b/sound/soc/codecs/cs42xx8.c
index ebb9e0cf8364..3e8dbf63adbe 100644
--- a/sound/soc/codecs/cs42xx8.c
+++ b/sound/soc/codecs/cs42xx8.c
@@ -14,6 +14,7 @@
 #include <linux/delay.h>
 #include <linux/module.h>
 #include <linux/of_device.h>
+#include <linux/of_gpio.h>
 #include <linux/pm_runtime.h>
 #include <linux/regulator/consumer.h>
 #include <sound/pcm_params.h>
@@ -45,6 +46,7 @@ struct cs42xx8_priv {
 	bool slave_mode;
 	unsigned long sysclk;
 	u32 tx_channels;
+	struct gpio_desc *gpiod_reset;
 };
 
 /* -127.5dB to 0dB with step of 0.5dB */
@@ -467,6 +469,13 @@ int cs42xx8_probe(struct device *dev, struct regmap *regmap)
 		return -EINVAL;
 	}
 
+	cs42xx8->gpiod_reset = devm_gpiod_get_optional(dev, "reset",
+							GPIOD_OUT_HIGH);
+	if (IS_ERR(cs42xx8->gpiod_reset))
+		return PTR_ERR(cs42xx8->gpiod_reset);
+
+	gpiod_set_value_cansleep(cs42xx8->gpiod_reset, 0);
+
 	cs42xx8->clk = devm_clk_get(dev, "mclk");
 	if (IS_ERR(cs42xx8->clk)) {
 		dev_err(dev, "failed to get the clock: %ld\n",
@@ -547,6 +556,8 @@ static int cs42xx8_runtime_resume(struct device *dev)
 		return ret;
 	}
 
+	gpiod_set_value_cansleep(cs42xx8->gpiod_reset, 0);
+
 	ret = regulator_bulk_enable(ARRAY_SIZE(cs42xx8->supplies),
 				    cs42xx8->supplies);
 	if (ret) {
@@ -585,6 +596,8 @@ static int cs42xx8_runtime_suspend(struct device *dev)
 	regulator_bulk_disable(ARRAY_SIZE(cs42xx8->supplies),
 			       cs42xx8->supplies);
 
+	gpiod_set_value_cansleep(cs42xx8->gpiod_reset, 1);
+
 	clk_disable_unprepare(cs42xx8->clk);
 
 	return 0;
-- 
2.20.1

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

* Re: [PATCH V2] ASoC: cs42xx8: Add reset gpio handling
  2019-05-16 11:09 [PATCH V2] ASoC: cs42xx8: Add reset gpio handling S.j. Wang
@ 2019-05-16 11:12 ` Mark Brown
  0 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2019-05-16 11:12 UTC (permalink / raw)
  To: S.j. Wang
  Cc: brian.austin, Paul.Handrigan, lgirdwood, perex, tiwai,
	alsa-devel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 232 bytes --]

On Thu, May 16, 2019 at 11:09:27AM +0000, S.j. Wang wrote:

> > You also need a binding document update for this.
> ok, will send v3

Separate patch please, I already applied this and binding docs should be
separate patches anyway.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH V2] ASoC: cs42xx8: Add reset gpio handling
@ 2019-05-16 11:09 S.j. Wang
  2019-05-16 11:12 ` Mark Brown
  0 siblings, 1 reply; 5+ messages in thread
From: S.j. Wang @ 2019-05-16 11:09 UTC (permalink / raw)
  To: Mark Brown
  Cc: brian.austin, Paul.Handrigan, lgirdwood, perex, tiwai,
	alsa-devel, linux-kernel

Hi

> 
> On Thu, May 16, 2019 at 06:04:58AM +0000, S.j. Wang wrote:
> 
> > +	cs42xx8->gpiod_reset = devm_gpiod_get_optional(dev, "reset",
> > +							GPIOD_OUT_HIGH);
> > +	if (IS_ERR(cs42xx8->gpiod_reset))
> > +		return PTR_ERR(cs42xx8->gpiod_reset);
> 
> You also need a binding document update for this.
ok, will send v3

best regards
wang shengjiu

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

end of thread, other threads:[~2019-05-17 10:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-16  6:04 [PATCH V2] ASoC: cs42xx8: Add reset gpio handling S.j. Wang
2019-05-16 10:11 ` Mark Brown
2019-05-17 10:34 ` Applied "ASoC: cs42xx8: Add reset gpio handling" to the asoc tree Mark Brown
2019-05-16 11:09 [PATCH V2] ASoC: cs42xx8: Add reset gpio handling S.j. Wang
2019-05-16 11:12 ` 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.