summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2026-09-29 12:45:37 +0100
committerMark Brown <broonie@kernel.org>2026-09-29 12:45:37 +0100
commitd733add0b2db8bf0d7159133adc2bd2c688367dd (patch)
tree8a45f1fc13e15b96ec4c554924cef5b72b7e1bc2
parentab2766a603e1758104b1b66a4f1ecc0f43d932dd (diff)
parentb224c8932773c63f4905d217544ab67bfef1c64e (diff)
downloadlinux-d733add0b2db8bf0d7159133adc2bd2c688367dd.tar.gz
linux-d733add0b2db8bf0d7159133adc2bd2c688367dd.zip
ASoC: codecs: ak4619: Add PDN pin handling
Alexander Koch <mail@alexanderkoch.net> says: 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. Link: https://patch.msgid.link/20260929090821.1476257-1-mail@alexanderkoch.net
-rw-r--r--Documentation/devicetree/bindings/sound/asahi-kasei,ak4619.yaml10
-rw-r--r--sound/soc/codecs/ak4619.c13
2 files changed, 23 insertions, 0 deletions
diff --git a/Documentation/devicetree/bindings/sound/asahi-kasei,ak4619.yaml b/Documentation/devicetree/bindings/sound/asahi-kasei,ak4619.yaml
index 2e81947bb8dd..7a7534493e6b 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";
diff --git a/sound/soc/codecs/ak4619.c b/sound/soc/codecs/ak4619.c
index 5252b30669d4..bae8e8b6a430 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;
@@ -894,10 +895,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;
}
@@ -906,6 +917,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;
}