* [PATCH 1/2] ASoC: adau1372: allow sleepy powerdown GPIOs
2026-10-06 12:55 [PATCH 0/2] ASoC: adau1372: two small bugfixes for the codec Alvin Šipraga
@ 2026-10-06 12:55 ` Alvin Šipraga
2026-10-06 12:55 ` [PATCH 2/2] ASoC: adau1372: fix invalid default state of output ASRC and DAC muxes Alvin Šipraga
2026-10-06 13:03 ` [PATCH 0/2] ASoC: adau1372: two small bugfixes for the codec Nuno Sá
2 siblings, 0 replies; 4+ messages in thread
From: Alvin Šipraga @ 2026-10-06 12:55 UTC (permalink / raw)
To: Lars-Peter Clausen, Nuno Sá,
Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
Alexandre Belloni
Cc: linux-sound, linux-kernel, Alvin Šipraga
gpiod_set_value() emits a WARN when the GPIO provider indicates that it
can sleep, as is typical for I2C controlled GPIO expanders. Since the
powerdown GPIO is only manipulated in process context, use the _cansleep
variant instead. This lets the driver use sleepy GPIOs to power off the
chip.
Fixes: 6cd4c6459e47 ("ASoC: Add ADAU1372 audio CODEC support")
Signed-off-by: Alvin Šipraga <alvin.sipraga@analog.com>
---
sound/soc/codecs/adau1372.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/sound/soc/codecs/adau1372.c b/sound/soc/codecs/adau1372.c
index cc174ec3a1f8..b84495371b0b 100644
--- a/sound/soc/codecs/adau1372.c
+++ b/sound/soc/codecs/adau1372.c
@@ -798,7 +798,7 @@ static int adau1372_set_power(struct adau1372 *adau1372, bool enable)
if (ret)
return ret;
if (adau1372->pd_gpio)
- gpiod_set_value(adau1372->pd_gpio, 0);
+ gpiod_set_value_cansleep(adau1372->pd_gpio, 0);
if (adau1372->switch_mode)
adau1372->switch_mode(adau1372->dev);
@@ -818,8 +818,7 @@ static int adau1372_set_power(struct adau1372 *adau1372, bool enable)
ADAU1372_CLK_CTRL_PLL_EN,
0);
regcache_cache_only(adau1372->regmap, true);
- if (adau1372->pd_gpio)
- gpiod_set_value(adau1372->pd_gpio, 1);
+ gpiod_set_value_cansleep(adau1372->pd_gpio, 1);
clk_disable_unprepare(adau1372->mclk);
return ret;
}
@@ -836,7 +835,7 @@ static int adau1372_set_power(struct adau1372 *adau1372, bool enable)
* map. No need to do any register writes to manually
* turn things off.
*/
- gpiod_set_value(adau1372->pd_gpio, 1);
+ gpiod_set_value_cansleep(adau1372->pd_gpio, 1);
regcache_mark_dirty(adau1372->regmap);
} else {
regmap_update_bits(adau1372->regmap, ADAU1372_REG_CLK_CTRL,
--
2.54.0
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH 2/2] ASoC: adau1372: fix invalid default state of output ASRC and DAC muxes
2026-10-06 12:55 [PATCH 0/2] ASoC: adau1372: two small bugfixes for the codec Alvin Šipraga
2026-10-06 12:55 ` [PATCH 1/2] ASoC: adau1372: allow sleepy powerdown GPIOs Alvin Šipraga
@ 2026-10-06 12:55 ` Alvin Šipraga
2026-10-06 13:03 ` [PATCH 0/2] ASoC: adau1372: two small bugfixes for the codec Nuno Sá
2 siblings, 0 replies; 4+ messages in thread
From: Alvin Šipraga @ 2026-10-06 12:55 UTC (permalink / raw)
To: Lars-Peter Clausen, Nuno Sá,
Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
Alexandre Belloni
Cc: linux-sound, linux-kernel, Alvin Šipraga
The chip has strange power-on reset values for the registers that
control the output ASRC and DAC source muxes - the values are actually
marked "Reserved" in the datasheet [1]. This means that until the
underlying kcontrols are modified, the codec will not function as
expected.
The registers in question are:
register / field reset value valid values
ASRCO_SOURCE_0_1 0x10
ASRC_OUT_SOURCE0 0 4 .. 16
ASRC_OUT_SOURCE1 1 4 .. 16
ASRCO_SOURCE_2_3 0x10
ASRC_OUT_SOURCE2 2 4 .. 16
ASRC_OUT_SOURCE3 3 4 .. 16
DAC_SOURCE_0_1 0x10
DAC_SOURCE_0 0 12 .. 13
DAC_SOURCE_1 1 12 .. 13
Set some sane defaults during the driver probe:
ADC Decimator0 -> Output ASRC0
ADC Decimator1 -> Output ASRC1
ADC Decimator2 -> Output ASRC2
ADC Decimator3 -> Output ASRC3
Input ASRC0 -> DAC0
Input ASRC1 -> DAC1
With this, the chip will behave as advertised by the default kcontrol
state exposed by the driver.
[1] https://www.analog.com/media/en/technical-documentation/data-sheets/ADAU1372.pdf
Fixes: 6cd4c6459e47 ("ASoC: Add ADAU1372 audio CODEC support")
Signed-off-by: Alvin Šipraga <alvin.sipraga@analog.com>
---
sound/soc/codecs/adau1372.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/sound/soc/codecs/adau1372.c b/sound/soc/codecs/adau1372.c
index b84495371b0b..c3d3be898ba6 100644
--- a/sound/soc/codecs/adau1372.c
+++ b/sound/soc/codecs/adau1372.c
@@ -1002,6 +1002,17 @@ int adau1372_probe(struct device *dev, struct regmap *regmap,
regmap_write(regmap, ADAU1372_REG_OP_STAGE_MUTE, 0x0);
+ /*
+ * Set sane default values for the Output ASRC and DAC input muxes,
+ * since the power-on reset defaults are invalid "Reserved" states.
+ */
+ regmap_write(regmap, ADAU1372_REG_ASRCO_SOURCE_0_1,
+ 0x54); /* Decimator0, Decimator1 */
+ regmap_write(regmap, ADAU1372_REG_ASRCO_SOURCE_2_3,
+ 0x76); /* Decimator2, Decimator3 */
+ regmap_write(regmap, ADAU1372_REG_DAC_SOURCE,
+ 0xdc); /* Input ASRC0, Input ASRC1 */
+
regmap_write(regmap, 0x7, 0x01); /* CLOCK OUT */
return devm_snd_soc_register_component(dev, &adau1372_driver, &adau1372_dai_driver, 1);
--
2.54.0
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH 0/2] ASoC: adau1372: two small bugfixes for the codec
2026-10-06 12:55 [PATCH 0/2] ASoC: adau1372: two small bugfixes for the codec Alvin Šipraga
2026-10-06 12:55 ` [PATCH 1/2] ASoC: adau1372: allow sleepy powerdown GPIOs Alvin Šipraga
2026-10-06 12:55 ` [PATCH 2/2] ASoC: adau1372: fix invalid default state of output ASRC and DAC muxes Alvin Šipraga
@ 2026-10-06 13:03 ` Nuno Sá
2 siblings, 0 replies; 4+ messages in thread
From: Nuno Sá @ 2026-10-06 13:03 UTC (permalink / raw)
To: Alvin Šipraga
Cc: Lars-Peter Clausen, Liam Girdwood, Mark Brown, Jaroslav Kysela,
Takashi Iwai, Alexandre Belloni, linux-sound, linux-kernel
On Tue, Oct 06, 2026 at 02:55:55PM +0200, Alvin Šipraga wrote:
> Signed-off-by: Alvin Šipraga <alvin.sipraga@analog.com>
> ---
> Alvin Šipraga (2):
> ASoC: adau1372: allow sleepy powerdown GPIOs
> ASoC: adau1372: fix invalid default state of output ASRC and DAC muxes
>
> sound/soc/codecs/adau1372.c | 18 ++++++++++++++----
> 1 file changed, 14 insertions(+), 4 deletions(-)
> ---
> base-commit: d0cb7a7b2a490c381ad97f53155d02a748b60dea
> change-id: 20261006-asoc-adau1372-fixes-c4e6b9912ebe
>
> Best regards,
> --
> Alvin Šipraga <alvin.sipraga@analog.com>
>
Acked-by: Nuno Sá <nuno.sa@analog.com>
^ permalink raw reply [flat|nested] 4+ messages in thread