mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 0/2] ASoC: codecs: ak4619: Add PDN pin handling
@ 2026-09-29  9:08 Alexander Koch
  2026-09-29  9:08 ` [PATCH v2 1/2] ASoC: codecs: ak4619: Add optional powerdown GPIO Alexander Koch
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Alexander Koch @ 2026-09-29  9:08 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Jaroslav Kysela, Takashi Iwai, Kuninori Morimoto,
	Khanh Le
  Cc: linux-sound, devicetree, linux-kernel, Alexander Koch

The AK4619 datasheet describes the functionality of the power down (PDN)
pin as follows (p. 39, 'Power-up/down Sequence'):

  The AK4619 should be powered up when the PDN pin = "L". The PDN pin
  should be set "H" after all power supplies have ramped up.
  At that point, the reference voltage generator block (REFBLK) and LDO
  (AVDRV) circuit are powered up and the control registers are
  initialized. Control register settings should be no less than 10ms
  after PDN pin = "H".

The current implementation of the driver does not operate the PDN pin
in any way, it seems to rely on external control of the pin.

Improve this by adding a device tree binding to enable the driver to
set the pin 'high' during probe. Make it optional to keep the behaviour
for existing device trees unchanged.

Tested on an i.MX8MM board with the AK4619 connected to GPIO1 and SSI3.


Changed in v2:
 - Fix typo in bindings update subject
 - Fix missing #include in example block for dt binding YAML
 - Improve property description in binding YAML
 - Switch property name to commonly used 'powerdown-gpios'
 - Invert GPIO logic to avoid confusion (the pin is called 'power down'
   but when driven high the chip is powered _up_)
 - Fix power leak on error after GPIO is acquired by turning the codec
   off again


Alexander Koch (2):
  ASoC: codecs: ak4619: Add optional powerdown GPIO
  ASoC: dt-bindings: asahi-kasei,ak4619: Add powerdown GPIO

 .../bindings/sound/asahi-kasei,ak4619.yaml          | 10 ++++++++++
 sound/soc/codecs/ak4619.c                           | 13 +++++++++++++
 2 files changed, 23 insertions(+)

-- 
2.55.0


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

* [PATCH v2 1/2] ASoC: codecs: ak4619: Add optional powerdown GPIO
  2026-09-29  9:08 [PATCH v2 0/2] ASoC: codecs: ak4619: Add PDN pin handling Alexander Koch
@ 2026-09-29  9:08 ` Alexander Koch
  2026-09-29  9:08 ` [PATCH v2 2/2] ASoC: dt-bindings: asahi-kasei,ak4619: Add " Alexander Koch
  2026-09-29 11:46 ` [PATCH v2 0/2] ASoC: codecs: ak4619: Add PDN pin handling Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Alexander Koch @ 2026-09-29  9:08 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Jaroslav Kysela, Takashi Iwai, Kuninori Morimoto,
	Khanh Le
  Cc: linux-sound, devicetree, linux-kernel, Alexander Koch

Add optional device tree binding that enables operation of the 'PDN' pin
during initialization:

    codec@10 {
        compatible = "asahi-kasei,ak4619";
        reg = <0x10>;
        powerdown-gpios = <&gpio1 0 GPIO_ACTIVE_LOW>;  // <--
        #sound-dai-cells = <0>;
    };

If defined, PDN is set high during driver probe, followed by a 10 ms
delay as required before first register access [1].

If no 'powerdown-gpios' is defined, the behaviour is unchanged.

[1] AK4619 datasheet, sec. 2 'Power-up/down Sequence', page 39

Signed-off-by: Alexander Koch <mail@alexanderkoch.net>
---
 sound/soc/codecs/ak4619.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/sound/soc/codecs/ak4619.c b/sound/soc/codecs/ak4619.c
index d9c9f6b20028..c4f0db1e51c8 100644
--- a/sound/soc/codecs/ak4619.c
+++ b/sound/soc/codecs/ak4619.c
@@ -152,6 +152,7 @@
 struct ak4619_priv {
 	struct regmap *regmap;
 	struct snd_pcm_hw_constraint_list constraint;
+	struct gpio_desc *pdn_gpio;
 	int deemph_en;
 	unsigned int playback_rate;
 	unsigned int sysclk;
@@ -875,10 +876,20 @@ static int ak4619_i2c_probe(struct i2c_client *i2c)
 
 	i2c_set_clientdata(i2c, ak4619);
 
+	ak4619->pdn_gpio = devm_gpiod_get_optional(dev, "powerdown",
+		GPIOD_OUT_LOW);
+	if (IS_ERR(ak4619->pdn_gpio))
+		return dev_err_probe(dev, PTR_ERR(ak4619->pdn_gpio),
+			"powerdown GPIO request failed\n");
+	if (ak4619->pdn_gpio)
+		msleep(10);
+
 	ak4619->regmap = devm_regmap_init_i2c(i2c, &ak4619_regmap_cfg);
 	if (IS_ERR(ak4619->regmap)) {
 		ret = PTR_ERR(ak4619->regmap);
 		dev_err(dev, "regmap_init() failed: %d\n", ret);
+		if (ak4619->pdn_gpio)
+			gpiod_set_value_cansleep(ak4619->pdn_gpio, 1);
 		return ret;
 	}
 
@@ -887,6 +898,8 @@ static int ak4619_i2c_probe(struct i2c_client *i2c)
 	if (ret < 0) {
 		dev_err(dev, "Failed to register ak4619 component: %d\n",
 			ret);
+		if (ak4619->pdn_gpio)
+			gpiod_set_value_cansleep(ak4619->pdn_gpio, 1);
 		return ret;
 	}
 
-- 
2.55.0


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

* [PATCH v2 2/2] ASoC: dt-bindings: asahi-kasei,ak4619: Add powerdown GPIO
  2026-09-29  9:08 [PATCH v2 0/2] ASoC: codecs: ak4619: Add PDN pin handling Alexander Koch
  2026-09-29  9:08 ` [PATCH v2 1/2] ASoC: codecs: ak4619: Add optional powerdown GPIO Alexander Koch
@ 2026-09-29  9:08 ` Alexander Koch
  2026-09-29 11:46 ` [PATCH v2 0/2] ASoC: codecs: ak4619: Add PDN pin handling Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Alexander Koch @ 2026-09-29  9:08 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Jaroslav Kysela, Takashi Iwai, Kuninori Morimoto,
	Khanh Le
  Cc: linux-sound, devicetree, linux-kernel, Alexander Koch

Add documentation for an optional property that enables operation of the
'PDN' (powerdown) pin during initialization:

    codec@10 {
        compatible = "asahi-kasei,ak4619";
        reg = <0x10>;
        powerdown-gpios = <&gpio1 0 GPIO_ACTIVE_LOW>;  // <--
        #sound-dai-cells = <0>;
    };

Signed-off-by: Alexander Koch <mail@alexanderkoch.net>
---
 .../devicetree/bindings/sound/asahi-kasei,ak4619.yaml  | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/Documentation/devicetree/bindings/sound/asahi-kasei,ak4619.yaml b/Documentation/devicetree/bindings/sound/asahi-kasei,ak4619.yaml
index d412531ef9a2..86e0b8cbfc29 100644
--- a/Documentation/devicetree/bindings/sound/asahi-kasei,ak4619.yaml
+++ b/Documentation/devicetree/bindings/sound/asahi-kasei,ak4619.yaml
@@ -34,6 +34,12 @@ properties:
     $ref: audio-graph-port.yaml#
     unevaluatedProperties: false
 
+  powerdown-gpios:
+    maxItems: 1
+    description:
+      GPIO connected to the 'PDN' pin, if any. Needs to be set low to
+      power down the codec, hence the GPIO must be GPIO_ACTIVE_LOW.
+
 required:
   - compatible
   - reg
@@ -42,6 +48,8 @@ unevaluatedProperties: false
 
 examples:
   - |
+    #include <dt-bindings/gpio/gpio.h>
+
     i2c {
         #address-cells = <1>;
         #size-cells = <0>;
@@ -49,6 +57,8 @@ examples:
             compatible = "asahi-kasei,ak4619";
             reg = <0x10>;
 
+            powerdown-gpios = <&gpio1 0 GPIO_ACTIVE_LOW>;
+
             clocks = <&rcar_sound>;
             clock-names = "mclk";
 
-- 
2.55.0


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

* Re: [PATCH v2 0/2] ASoC: codecs: ak4619: Add PDN pin handling
  2026-09-29  9:08 [PATCH v2 0/2] ASoC: codecs: ak4619: Add PDN pin handling Alexander Koch
  2026-09-29  9:08 ` [PATCH v2 1/2] ASoC: codecs: ak4619: Add optional powerdown GPIO Alexander Koch
  2026-09-29  9:08 ` [PATCH v2 2/2] ASoC: dt-bindings: asahi-kasei,ak4619: Add " Alexander Koch
@ 2026-09-29 11:46 ` Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2026-09-29 11:46 UTC (permalink / raw)
  To: Liam Girdwood, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Jaroslav Kysela, Takashi Iwai, Kuninori Morimoto, Khanh Le,
	Alexander Koch
  Cc: linux-sound, devicetree, linux-kernel

On Tue, 29 Sep 2026 11:08:19 +0200, Alexander Koch wrote:
> ASoC: codecs: ak4619: Add PDN pin handling
> 
> The AK4619 datasheet describes the functionality of the power down (PDN)
> pin as follows (p. 39, 'Power-up/down Sequence'):
> 
>   The AK4619 should be powered up when the PDN pin = "L". The PDN pin
>   should be set "H" after all power supplies have ramped up.
>   At that point, the reference voltage generator block (REFBLK) and LDO
>   (AVDRV) circuit are powered up and the control registers are
>   initialized. Control register settings should be no less than 10ms
>   after PDN pin = "H".
> 
> [...]

Applied to

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

Thanks!

[1/2] ASoC: codecs: ak4619: Add optional powerdown GPIO
      https://git.kernel.org/broonie/sound/c/f38638f5181a
[2/2] ASoC: dt-bindings: asahi-kasei,ak4619: Add powerdown GPIO
      https://git.kernel.org/broonie/sound/c/b224c8932773

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


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

end of thread, other threads:[~2026-09-29 13:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-29  9:08 [PATCH v2 0/2] ASoC: codecs: ak4619: Add PDN pin handling Alexander Koch
2026-09-29  9:08 ` [PATCH v2 1/2] ASoC: codecs: ak4619: Add optional powerdown GPIO Alexander Koch
2026-09-29  9:08 ` [PATCH v2 2/2] ASoC: dt-bindings: asahi-kasei,ak4619: Add " Alexander Koch
2026-09-29 11:46 ` [PATCH v2 0/2] ASoC: codecs: ak4619: Add PDN pin handling Mark Brown

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

all inboxes | Powered by JetHome®