linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] ASoC: pcm3168a: Update the reset GPIO handling
@ 2019-11-20 13:17 Peter Ujfalusi
  2019-11-20 13:17 ` [PATCH 1/2] ASoC: dt-bindings: pcm3168a: Update the optional RST gpio for clarity Peter Ujfalusi
  2019-11-20 13:17 ` [PATCH 2/2] ASoC: pcm3168a: Update the RST gpio handling to align with documentation Peter Ujfalusi
  0 siblings, 2 replies; 5+ messages in thread
From: Peter Ujfalusi @ 2019-11-20 13:17 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: alsa-devel, kuninori.morimoto.gx, linus.walleij, robh+dt,
	devicetree, linux-kernel

Hi,

Switch the rst-gpios to generic reset-gpios as suggested by Rob.

Based on other threads around GPIOs, revise the GPIO active vs assert/deassert
configuration: The RST pin is a reset pin and it is active low.

Regards,
Peter
---
Peter Ujfalusi (2):
  ASoC: dt-bindings: pcm3168a: Update the optional RST gpio for clarity
  ASoC: pcm3168a: Update the RST gpio handling to align with
    documentation

 .../devicetree/bindings/sound/ti,pcm3168a.txt |  9 +++++----
 sound/soc/codecs/pcm3168a.c                   | 20 ++++++++++++++-----
 2 files changed, 20 insertions(+), 9 deletions(-)

-- 
Peter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH 1/2] ASoC: dt-bindings: pcm3168a: Update the optional RST gpio for clarity
  2019-11-20 13:17 [PATCH 0/2] ASoC: pcm3168a: Update the reset GPIO handling Peter Ujfalusi
@ 2019-11-20 13:17 ` Peter Ujfalusi
  2019-11-20 17:18   ` Applied "ASoC: dt-bindings: pcm3168a: Update the optional RST gpio for clarity" to the asoc tree Mark Brown
  2019-11-20 13:17 ` [PATCH 2/2] ASoC: pcm3168a: Update the RST gpio handling to align with documentation Peter Ujfalusi
  1 sibling, 1 reply; 5+ messages in thread
From: Peter Ujfalusi @ 2019-11-20 13:17 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: alsa-devel, kuninori.morimoto.gx, linus.walleij, robh+dt,
	devicetree, linux-kernel

Use the standard name for the gpion in DT: reset-gpios

Document that the RST line is low active and update the example
accordingly.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
 Documentation/devicetree/bindings/sound/ti,pcm3168a.txt | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/ti,pcm3168a.txt b/Documentation/devicetree/bindings/sound/ti,pcm3168a.txt
index f30aebc7603a..a02ecaab5183 100644
--- a/Documentation/devicetree/bindings/sound/ti,pcm3168a.txt
+++ b/Documentation/devicetree/bindings/sound/ti,pcm3168a.txt
@@ -27,9 +27,10 @@ For required properties on SPI/I2C, consult SPI/I2C device tree documentation
 
 Optional properties:
 
-  - rst-gpios : Optional RST gpio line for the codec
-		RST = low: device power-down
-		RST = high: device is enabled
+  - reset-gpios : Optional reset gpio line connected to RST pin of the codec.
+		  The RST line is low active:
+		  RST = low: device power-down
+		  RST = high: device is enabled
 
 Examples:
 
@@ -40,7 +41,7 @@ i2c0: i2c0@0 {
 	pcm3168a: audio-codec@44 {
 		compatible = "ti,pcm3168a";
 		reg = <0x44>;
-		rst-gpios = <&gpio0 4 GPIO_ACTIVE_HIGH>;
+		reset-gpios = <&gpio0 4 GPIO_ACTIVE_LOW>;
 		clocks = <&clk_core CLK_AUDIO>;
 		clock-names = "scki";
 		VDD1-supply = <&supply3v3>;
-- 
Peter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH 2/2] ASoC: pcm3168a: Update the RST gpio handling to align with documentation
  2019-11-20 13:17 [PATCH 0/2] ASoC: pcm3168a: Update the reset GPIO handling Peter Ujfalusi
  2019-11-20 13:17 ` [PATCH 1/2] ASoC: dt-bindings: pcm3168a: Update the optional RST gpio for clarity Peter Ujfalusi
@ 2019-11-20 13:17 ` Peter Ujfalusi
  2019-11-20 17:18   ` Applied "ASoC: pcm3168a: Update the RST gpio handling to align with documentation" to the asoc tree Mark Brown
  1 sibling, 1 reply; 5+ messages in thread
From: Peter Ujfalusi @ 2019-11-20 13:17 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: alsa-devel, kuninori.morimoto.gx, linus.walleij, robh+dt,
	devicetree, linux-kernel

The RST (reset-gpios) is low active so the driver must handle it
accordingly.

Add comments to explain clearly how the line is used.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
 sound/soc/codecs/pcm3168a.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/sound/soc/codecs/pcm3168a.c b/sound/soc/codecs/pcm3168a.c
index f3475134b519..9711fab296eb 100644
--- a/sound/soc/codecs/pcm3168a.c
+++ b/sound/soc/codecs/pcm3168a.c
@@ -707,11 +707,15 @@ int pcm3168a_probe(struct device *dev, struct regmap *regmap)
 	dev_set_drvdata(dev, pcm3168a);
 
 	/*
-	 * Request the RST gpio line as non exclusive as the same reset line
-	 * might be connected to multiple pcm3168a codec
+	 * Request the reset (connected to RST pin) gpio line as non exclusive
+	 * as the same reset line might be connected to multiple pcm3168a codec
+	 *
+	 * The RST is low active, we want the GPIO line to be high initially, so
+	 * request the initial level to LOW which in practice means DEASSERTED:
+	 * The deasserted level of GPIO_ACTIVE_LOW is HIGH.
 	 */
-	pcm3168a->gpio_rst = devm_gpiod_get_optional(dev, "rst",
-						GPIOD_OUT_HIGH |
+	pcm3168a->gpio_rst = devm_gpiod_get_optional(dev, "reset",
+						GPIOD_OUT_LOW |
 						GPIOD_FLAGS_BIT_NONEXCLUSIVE);
 	if (IS_ERR(pcm3168a->gpio_rst)) {
 		ret = PTR_ERR(pcm3168a->gpio_rst);
@@ -814,7 +818,13 @@ void pcm3168a_remove(struct device *dev)
 {
 	struct pcm3168a_priv *pcm3168a = dev_get_drvdata(dev);
 
-	gpiod_set_value_cansleep(pcm3168a->gpio_rst, 0);
+	/*
+	 * The RST is low active, we want the GPIO line to be low when the
+	 * driver is removed, so set level to 1 which in practice means
+	 * ASSERTED:
+	 * The asserted level of GPIO_ACTIVE_LOW is LOW.
+	 */
+	gpiod_set_value_cansleep(pcm3168a->gpio_rst, 1);
 	pm_runtime_disable(dev);
 #ifndef CONFIG_PM
 	pcm3168a_disable(dev);
-- 
Peter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* Applied "ASoC: pcm3168a: Update the RST gpio handling to align with documentation" to the asoc tree
  2019-11-20 13:17 ` [PATCH 2/2] ASoC: pcm3168a: Update the RST gpio handling to align with documentation Peter Ujfalusi
@ 2019-11-20 17:18   ` Mark Brown
  0 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2019-11-20 17:18 UTC (permalink / raw)
  To: Peter Ujfalusi
  Cc: alsa-devel, broonie, devicetree, kuninori.morimoto.gx, lgirdwood,
	linus.walleij, linux-kernel, Mark Brown, robh+dt

The patch

   ASoC: pcm3168a: Update the RST gpio handling to align with documentation

has been applied to the asoc tree at

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

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 4ec48e7cbe6e70352c802b5cb172b00ebd8af8e0 Mon Sep 17 00:00:00 2001
From: Peter Ujfalusi <peter.ujfalusi@ti.com>
Date: Wed, 20 Nov 2019 15:17:53 +0200
Subject: [PATCH] ASoC: pcm3168a: Update the RST gpio handling to align with
 documentation

The RST (reset-gpios) is low active so the driver must handle it
accordingly.

Add comments to explain clearly how the line is used.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Link: https://lore.kernel.org/r/20191120131753.6831-3-peter.ujfalusi@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/codecs/pcm3168a.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/sound/soc/codecs/pcm3168a.c b/sound/soc/codecs/pcm3168a.c
index f3475134b519..9711fab296eb 100644
--- a/sound/soc/codecs/pcm3168a.c
+++ b/sound/soc/codecs/pcm3168a.c
@@ -707,11 +707,15 @@ int pcm3168a_probe(struct device *dev, struct regmap *regmap)
 	dev_set_drvdata(dev, pcm3168a);
 
 	/*
-	 * Request the RST gpio line as non exclusive as the same reset line
-	 * might be connected to multiple pcm3168a codec
+	 * Request the reset (connected to RST pin) gpio line as non exclusive
+	 * as the same reset line might be connected to multiple pcm3168a codec
+	 *
+	 * The RST is low active, we want the GPIO line to be high initially, so
+	 * request the initial level to LOW which in practice means DEASSERTED:
+	 * The deasserted level of GPIO_ACTIVE_LOW is HIGH.
 	 */
-	pcm3168a->gpio_rst = devm_gpiod_get_optional(dev, "rst",
-						GPIOD_OUT_HIGH |
+	pcm3168a->gpio_rst = devm_gpiod_get_optional(dev, "reset",
+						GPIOD_OUT_LOW |
 						GPIOD_FLAGS_BIT_NONEXCLUSIVE);
 	if (IS_ERR(pcm3168a->gpio_rst)) {
 		ret = PTR_ERR(pcm3168a->gpio_rst);
@@ -814,7 +818,13 @@ void pcm3168a_remove(struct device *dev)
 {
 	struct pcm3168a_priv *pcm3168a = dev_get_drvdata(dev);
 
-	gpiod_set_value_cansleep(pcm3168a->gpio_rst, 0);
+	/*
+	 * The RST is low active, we want the GPIO line to be low when the
+	 * driver is removed, so set level to 1 which in practice means
+	 * ASSERTED:
+	 * The asserted level of GPIO_ACTIVE_LOW is LOW.
+	 */
+	gpiod_set_value_cansleep(pcm3168a->gpio_rst, 1);
 	pm_runtime_disable(dev);
 #ifndef CONFIG_PM
 	pcm3168a_disable(dev);
-- 
2.20.1


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

* Applied "ASoC: dt-bindings: pcm3168a: Update the optional RST gpio for clarity" to the asoc tree
  2019-11-20 13:17 ` [PATCH 1/2] ASoC: dt-bindings: pcm3168a: Update the optional RST gpio for clarity Peter Ujfalusi
@ 2019-11-20 17:18   ` Mark Brown
  0 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2019-11-20 17:18 UTC (permalink / raw)
  To: Peter Ujfalusi
  Cc: alsa-devel, broonie, devicetree, kuninori.morimoto.gx, lgirdwood,
	linus.walleij, linux-kernel, Mark Brown, robh+dt

The patch

   ASoC: dt-bindings: pcm3168a: Update the optional RST gpio for clarity

has been applied to the asoc tree at

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

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 103e5d734ae28fc1ccd80d1df9d33f44536d74a4 Mon Sep 17 00:00:00 2001
From: Peter Ujfalusi <peter.ujfalusi@ti.com>
Date: Wed, 20 Nov 2019 15:17:52 +0200
Subject: [PATCH] ASoC: dt-bindings: pcm3168a: Update the optional RST gpio for
 clarity

Use the standard name for the gpion in DT: reset-gpios

Document that the RST line is low active and update the example
accordingly.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Link: https://lore.kernel.org/r/20191120131753.6831-2-peter.ujfalusi@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 Documentation/devicetree/bindings/sound/ti,pcm3168a.txt | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/ti,pcm3168a.txt b/Documentation/devicetree/bindings/sound/ti,pcm3168a.txt
index f30aebc7603a..a02ecaab5183 100644
--- a/Documentation/devicetree/bindings/sound/ti,pcm3168a.txt
+++ b/Documentation/devicetree/bindings/sound/ti,pcm3168a.txt
@@ -27,9 +27,10 @@ For required properties on SPI/I2C, consult SPI/I2C device tree documentation
 
 Optional properties:
 
-  - rst-gpios : Optional RST gpio line for the codec
-		RST = low: device power-down
-		RST = high: device is enabled
+  - reset-gpios : Optional reset gpio line connected to RST pin of the codec.
+		  The RST line is low active:
+		  RST = low: device power-down
+		  RST = high: device is enabled
 
 Examples:
 
@@ -40,7 +41,7 @@ i2c0: i2c0@0 {
 	pcm3168a: audio-codec@44 {
 		compatible = "ti,pcm3168a";
 		reg = <0x44>;
-		rst-gpios = <&gpio0 4 GPIO_ACTIVE_HIGH>;
+		reset-gpios = <&gpio0 4 GPIO_ACTIVE_LOW>;
 		clocks = <&clk_core CLK_AUDIO>;
 		clock-names = "scki";
 		VDD1-supply = <&supply3v3>;
-- 
2.20.1


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

end of thread, other threads:[~2019-11-20 17:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-20 13:17 [PATCH 0/2] ASoC: pcm3168a: Update the reset GPIO handling Peter Ujfalusi
2019-11-20 13:17 ` [PATCH 1/2] ASoC: dt-bindings: pcm3168a: Update the optional RST gpio for clarity Peter Ujfalusi
2019-11-20 17:18   ` Applied "ASoC: dt-bindings: pcm3168a: Update the optional RST gpio for clarity" to the asoc tree Mark Brown
2019-11-20 13:17 ` [PATCH 2/2] ASoC: pcm3168a: Update the RST gpio handling to align with documentation Peter Ujfalusi
2019-11-20 17:18   ` Applied "ASoC: pcm3168a: Update the RST gpio handling to align with documentation" to the asoc tree Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).