[PATCH] ASoC: ak4619: Turn off DAC de-emphasis when disabling it

From: Haowen Tu

Date: Tue Dec 01 2026 - 22:11:10 EST


Turning off Playback De-Emphasis Switch clears deemph_en before
calling ak4619_set_deemph(). The helper then returns early, leaving
the previously selected de-emphasis filters active on both DACs
even though the control reports them as disabled.

Program the off setting on both DACs when the switch transitions
to off. Apply the rate-dependent settings during playback setup
only while the switch is enabled so that manual per-DAC filter
settings are preserved with the switch off.

Fixes: ca73d314363d ("ASoC: Add ak4619 codec support")
Signed-off-by: Haowen Tu <tuhaowen@xxxxxxxxxxxxx>
---
sound/soc/codecs/ak4619.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/sound/soc/codecs/ak4619.c b/sound/soc/codecs/ak4619.c
index 890830d79aea..ab2e68acdc68 100644
--- a/sound/soc/codecs/ak4619.c
+++ b/sound/soc/codecs/ak4619.c
@@ -233,12 +233,10 @@ static SOC_ENUM_SINGLE_DECL(ak4619_dac_2_digi_fil, DAC_MF, DA2SL_SHIFT, ak4619_d
static void ak4619_set_deemph(struct snd_soc_component *component)
{
struct ak4619_priv *ak4619 = snd_soc_component_get_drvdata(component);
+ unsigned int rate = ak4619->deemph_en ? ak4619->playback_rate : 0;
u8 dem = 0;

- if (!ak4619->deemph_en)
- return;
-
- switch (ak4619->playback_rate) {
+ switch (rate) {
case 32000:
dem |= DEM1_32000 | DEM2_32000;
break;
@@ -261,7 +259,7 @@ static int ak4619_put_deemph(struct snd_kcontrol *kcontrol,
struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
struct ak4619_priv *ak4619 = snd_soc_component_get_drvdata(component);
int deemph_en = ucontrol->value.integer.value[0];
- int ret = 0;
+ bool changed;

switch (deemph_en) {
case 0:
@@ -271,13 +269,13 @@ static int ak4619_put_deemph(struct snd_kcontrol *kcontrol,
return -EINVAL;
}

- if (ak4619->deemph_en != deemph_en)
- ret = 1; /* The value changed */
+ changed = ak4619->deemph_en != deemph_en;

ak4619->deemph_en = deemph_en;
- ak4619_set_deemph(component);
+ if (changed || deemph_en)
+ ak4619_set_deemph(component);

- return ret;
+ return changed;
}

static int ak4619_get_deemph(struct snd_kcontrol *kcontrol,
@@ -619,7 +617,8 @@ static int ak4619_dai_hw_params(struct snd_pcm_substream *substream,

if (is_play) {
ak4619->playback_rate = rate;
- ak4619_set_deemph(component);
+ if (ak4619->deemph_en)
+ ak4619_set_deemph(component);
}

return 0;
--
2.50.1