mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] ASoC: codecs: ak4619: Add PDN pin handling
@ 2026-09-28 11:40 Alexander Koch
  2026-09-28 11:40 ` [PATCH 1/2] ASoC: codecs: ak4619: Add optional PDN pin support Alexander Koch
  2026-09-28 11:40 ` [PATCH 2/2] SoC: dt-bindings: asahi-kasei,ak4619: Add PDN GPIO support Alexander Koch
  0 siblings, 2 replies; 8+ messages in thread
From: Alexander Koch @ 2026-09-28 11:40 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:

  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". [1]

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.


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


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

 .../devicetree/bindings/sound/asahi-kasei,ak4619.yaml     | 8 ++++++++
 sound/soc/codecs/ak4619.c                                 | 7 +++++++
 2 files changed, 15 insertions(+)

-- 
2.55.0


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

* [PATCH 1/2] ASoC: codecs: ak4619: Add optional PDN pin support
  2026-09-28 11:40 [PATCH 0/2] ASoC: codecs: ak4619: Add PDN pin handling Alexander Koch
@ 2026-09-28 11:40 ` Alexander Koch
  2026-09-28 11:40 ` [PATCH 2/2] SoC: dt-bindings: asahi-kasei,ak4619: Add PDN GPIO support Alexander Koch
  1 sibling, 0 replies; 8+ messages in thread
From: Alexander Koch @ 2026-09-28 11:40 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>;
        pdn-gpios = <&gpio1 0 GPIO_ACTIVE_HIGH>;  // <--
        #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 'pdn-gpios' property 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 | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/sound/soc/codecs/ak4619.c b/sound/soc/codecs/ak4619.c
index d9c9f6b20028..f3357c1ee907 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,6 +876,12 @@ static int ak4619_i2c_probe(struct i2c_client *i2c)
 
 	i2c_set_clientdata(i2c, ak4619);
 
+	ak4619->pdn_gpio = devm_gpiod_get_optional(dev, "pdn", GPIOD_OUT_HIGH);
+	if (IS_ERR(ak4619->pdn_gpio))
+		return PTR_ERR(ak4619->pdn_gpio);
+	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);
-- 
2.55.0


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

* [PATCH 2/2] SoC: dt-bindings: asahi-kasei,ak4619: Add PDN GPIO support
  2026-09-28 11:40 [PATCH 0/2] ASoC: codecs: ak4619: Add PDN pin handling Alexander Koch
  2026-09-28 11:40 ` [PATCH 1/2] ASoC: codecs: ak4619: Add optional PDN pin support Alexander Koch
@ 2026-09-28 11:40 ` Alexander Koch
  2026-09-28 12:58   ` Rob Herring (Arm)
                     ` (2 more replies)
  1 sibling, 3 replies; 8+ messages in thread
From: Alexander Koch @ 2026-09-28 11:40 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 optional property that enables operation of the
'PDN' pin during initialization:

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

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

diff --git a/Documentation/devicetree/bindings/sound/asahi-kasei,ak4619.yaml b/Documentation/devicetree/bindings/sound/asahi-kasei,ak4619.yaml
index d412531ef9a2..3c7754351e8a 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
 
+  pdn-gpios:
+    maxItems: 1
+    description:
+      GPIO controlling the AK4619 PDN input pin. Used during driver
+      probing to power up the codec.
+
 required:
   - compatible
   - reg
@@ -49,6 +55,8 @@ examples:
             compatible = "asahi-kasei,ak4619";
             reg = <0x10>;
 
+            pdn-gpios = <&gpio1 0 GPIO_ACTIVE_HIGH>;
+
             clocks = <&rcar_sound>;
             clock-names = "mclk";
 
-- 
2.55.0


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

* Re: [PATCH 2/2] SoC: dt-bindings: asahi-kasei,ak4619: Add PDN GPIO support
  2026-09-28 11:40 ` [PATCH 2/2] SoC: dt-bindings: asahi-kasei,ak4619: Add PDN GPIO support Alexander Koch
@ 2026-09-28 12:58   ` Rob Herring (Arm)
  2026-09-28 13:59     ` Alexander Koch
  2026-09-28 13:12   ` Rob Herring
  2026-09-28 13:12   ` Rob Herring
  2 siblings, 1 reply; 8+ messages in thread
From: Rob Herring (Arm) @ 2026-09-28 12:58 UTC (permalink / raw)
  To: Alexander Koch
  Cc: Takashi Iwai, Kuninori Morimoto, Jaroslav Kysela, linux-sound,
	Mark Brown, devicetree, Liam Girdwood, linux-kernel,
	Krzysztof Kozlowski, Khanh Le, Conor Dooley


On Mon, 28 Sep 2026 13:40:19 +0200, Alexander Koch wrote:
> Add documentation for optional property that enables operation of the
> 'PDN' pin during initialization:
> 
>     codec@10 {
>         compatible = "asahi-kasei,ak4619";
>         reg = <0x10>;
>         pdn-gpios = <&gpio1 0 GPIO_ACTIVE_HIGH>;  // <--
>         #sound-dai-cells = <0>;
>     };
> 
> Signed-off-by: Alexander Koch <mail@alexanderkoch.net>
> ---
>  .../devicetree/bindings/sound/asahi-kasei,ak4619.yaml     | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 

My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:

dtschema/dtc warnings/errors:
Lexical error: Documentation/devicetree/bindings/sound/asahi-kasei,ak4619.example.dts:25.39-55 Unexpected 'GPIO_ACTIVE_HIGH'
FATAL ERROR: Syntax error parsing input tree
make[2]: *** [scripts/Makefile.dtbs:140: Documentation/devicetree/bindings/sound/asahi-kasei,ak4619.example.dtb] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [/builds/robherring/linux-dt-review/Makefile:1714: dt_binding_check] Error 2
make: *** [Makefile:248: __sub-make] Error 2

doc reference errors (make refcheckdocs):

See https://patchwork.kernel.org/project/devicetree/patch/20260928114019.1441752-3-mail@alexanderkoch.net

The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.


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

* Re: [PATCH 2/2] SoC: dt-bindings: asahi-kasei,ak4619: Add PDN GPIO support
  2026-09-28 11:40 ` [PATCH 2/2] SoC: dt-bindings: asahi-kasei,ak4619: Add PDN GPIO support Alexander Koch
  2026-09-28 12:58   ` Rob Herring (Arm)
@ 2026-09-28 13:12   ` Rob Herring
  2026-09-28 14:01     ` Alexander Koch
  2026-09-28 13:12   ` Rob Herring
  2 siblings, 1 reply; 8+ messages in thread
From: Rob Herring @ 2026-09-28 13:12 UTC (permalink / raw)
  To: Alexander Koch
  Cc: Liam Girdwood, Mark Brown, Krzysztof Kozlowski, Conor Dooley,
	Jaroslav Kysela, Takashi Iwai, Kuninori Morimoto, Khanh Le,
	linux-sound, devicetree, linux-kernel

On Mon, Sep 28, 2026 at 01:40:19PM +0200, Alexander Koch wrote:
> Add documentation for optional property that enables operation of the
> 'PDN' pin during initialization:
> 
>     codec@10 {
>         compatible = "asahi-kasei,ak4619";
>         reg = <0x10>;
>         pdn-gpios = <&gpio1 0 GPIO_ACTIVE_HIGH>;  // <--
>         #sound-dai-cells = <0>;
>     };
> 
> Signed-off-by: Alexander Koch <mail@alexanderkoch.net>
> ---
>  .../devicetree/bindings/sound/asahi-kasei,ak4619.yaml     | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/sound/asahi-kasei,ak4619.yaml b/Documentation/devicetree/bindings/sound/asahi-kasei,ak4619.yaml
> index d412531ef9a2..3c7754351e8a 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
>  
> +  pdn-gpios:

powerdown-gpios is a standard name for this function.

> +    maxItems: 1
> +    description:
> +      GPIO controlling the AK4619 PDN input pin. Used during driver
> +      probing to power up the codec.

When a driver does something is not relevant. Would be useful to state 
the active (meaning powered down state based on the naming) state.

Rob

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

* Re: [PATCH 2/2] SoC: dt-bindings: asahi-kasei,ak4619: Add PDN GPIO support
  2026-09-28 11:40 ` [PATCH 2/2] SoC: dt-bindings: asahi-kasei,ak4619: Add PDN GPIO support Alexander Koch
  2026-09-28 12:58   ` Rob Herring (Arm)
  2026-09-28 13:12   ` Rob Herring
@ 2026-09-28 13:12   ` Rob Herring
  2 siblings, 0 replies; 8+ messages in thread
From: Rob Herring @ 2026-09-28 13:12 UTC (permalink / raw)
  To: Alexander Koch
  Cc: Liam Girdwood, Mark Brown, Krzysztof Kozlowski, Conor Dooley,
	Jaroslav Kysela, Takashi Iwai, Kuninori Morimoto, Khanh Le,
	linux-sound, devicetree, linux-kernel

On Mon, Sep 28, 2026 at 01:40:19PM +0200, Alexander Koch wrote:
> Add documentation for optional property that enables operation of the
> 'PDN' pin during initialization:

Also, s/Soc/ASoC/ in the subject.

Rob

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

* Re: [PATCH 2/2] SoC: dt-bindings: asahi-kasei,ak4619: Add PDN GPIO support
  2026-09-28 12:58   ` Rob Herring (Arm)
@ 2026-09-28 13:59     ` Alexander Koch
  0 siblings, 0 replies; 8+ messages in thread
From: Alexander Koch @ 2026-09-28 13:59 UTC (permalink / raw)
  To: Rob Herring (Arm)
  Cc: Takashi Iwai, Kuninori Morimoto, Jaroslav Kysela, linux-sound,
	Mark Brown, devicetree, Liam Girdwood, linux-kernel,
	Krzysztof Kozlowski, Khanh Le, Conor Dooley

>> Add documentation for optional property that enables operation of the
>> 'PDN' pin during initialization:
>>
>>      codec@10 {
>>          compatible = "asahi-kasei,ak4619";
>>          reg = <0x10>;
>>          pdn-gpios = <&gpio1 0 GPIO_ACTIVE_HIGH>;  // <--
>>          #sound-dai-cells = <0>;
>>      };
>>
>> Signed-off-by: Alexander Koch <mail@alexanderkoch.net>
>> ---
>>   .../devicetree/bindings/sound/asahi-kasei,ak4619.yaml     | 8 ++++++++
>>   1 file changed, 8 insertions(+)
>>
> My bot found errors running 'make dt_binding_check' on your patch:
>
> yamllint warnings/errors:
>
> dtschema/dtc warnings/errors:
> Lexical error: Documentation/devicetree/bindings/sound/asahi-kasei,ak4619.example.dts:25.39-55 Unexpected 'GPIO_ACTIVE_HIGH'
> FATAL ERROR: Syntax error parsing input tree
> make[2]: *** [scripts/Makefile.dtbs:140: Documentation/devicetree/bindings/sound/asahi-kasei,ak4619.example.dtb] Error 1
> make[2]: *** Waiting for unfinished jobs....
> make[1]: *** [/builds/robherring/linux-dt-review/Makefile:1714: dt_binding_check] Error 2
> make: *** [Makefile:248: __sub-make] Error 2
>
> doc reference errors (make refcheckdocs):
>
> See https://patchwork.kernel.org/project/devicetree/patch/20260928114019.1441752-3-mail@alexanderkoch.net
>
> The base for the series is generally the latest rc1. A different dependency
> should be noted in *this* patch.
>
> If you already ran 'make dt_binding_check' and didn't see the above
> error(s), then make sure 'yamllint' is installed and dt-schema is up to
> date:
>
> pip3 install dtschema --upgrade
>
> Please check and re-submit after running the above command yourself. Note
> that DT_SCHEMA_FILES can be set to your schema file to speed up checking
> your schema. However, it must be unset to test all examples with your schema.

Thanks for the review and the clarifications!

I must admit I am a bit new to the concept of YAML based DT bindings 
documentation and did not realize that examples must be syntactically 
complete.

So for a fixed v2 would you prefer

a) the missing #include added above the i2c block or
b) the new property removed from the example since it is optional anyway?


Best regards,

Alex


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

* Re: [PATCH 2/2] SoC: dt-bindings: asahi-kasei,ak4619: Add PDN GPIO support
  2026-09-28 13:12   ` Rob Herring
@ 2026-09-28 14:01     ` Alexander Koch
  0 siblings, 0 replies; 8+ messages in thread
From: Alexander Koch @ 2026-09-28 14:01 UTC (permalink / raw)
  To: Rob Herring
  Cc: Liam Girdwood, Mark Brown, Krzysztof Kozlowski, Conor Dooley,
	Jaroslav Kysela, Takashi Iwai, Kuninori Morimoto, Khanh Le,
	linux-sound, devicetree, linux-kernel

>> Add documentation for optional property that enables operation of the
>> 'PDN' pin during initialization:
>>
>>      codec@10 {
>>          compatible = "asahi-kasei,ak4619";
>>          reg = <0x10>;
>>          pdn-gpios = <&gpio1 0 GPIO_ACTIVE_HIGH>;  // <--
>>          #sound-dai-cells = <0>;
>>      };
>>
>> Signed-off-by: Alexander Koch <mail@alexanderkoch.net>
>> ---
>>   .../devicetree/bindings/sound/asahi-kasei,ak4619.yaml     | 8 ++++++++
>>   1 file changed, 8 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/sound/asahi-kasei,ak4619.yaml b/Documentation/devicetree/bindings/sound/asahi-kasei,ak4619.yaml
>> index d412531ef9a2..3c7754351e8a 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
>>   
>> +  pdn-gpios:
> powerdown-gpios is a standard name for this function.

Thanks for the hint, this might actually inverse the logical polarity of 
the GPIO that I had in mind. I will look at other examples and consider 
them when submitting v2.

>> +    maxItems: 1
>> +    description:
>> +      GPIO controlling the AK4619 PDN input pin. Used during driver
>> +      probing to power up the codec.
> When a driver does something is not relevant. Would be useful to state
> the active (meaning powered down state based on the naming) state.

Understood, I will make that more clear in v2.


Best regards,

Alex


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

end of thread, other threads:[~2026-09-28 14:02 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-28 11:40 [PATCH 0/2] ASoC: codecs: ak4619: Add PDN pin handling Alexander Koch
2026-09-28 11:40 ` [PATCH 1/2] ASoC: codecs: ak4619: Add optional PDN pin support Alexander Koch
2026-09-28 11:40 ` [PATCH 2/2] SoC: dt-bindings: asahi-kasei,ak4619: Add PDN GPIO support Alexander Koch
2026-09-28 12:58   ` Rob Herring (Arm)
2026-09-28 13:59     ` Alexander Koch
2026-09-28 13:12   ` Rob Herring
2026-09-28 14:01     ` Alexander Koch
2026-09-28 13:12   ` Rob Herring

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®