From 84848b01a3d396c82ea709d5e663b6a3177bf4e4 Mon Sep 17 00:00:00 2001 From: Richard Fitzgerald Date: Fri, 30 Jun 2017 09:29:35 +0100 Subject: [PATCH] ASoC: madera: Inmux changes must always handle DMIC mode For the unganged inputs on CS47L85 and CS47L90 the code was skipping the update to DMIC mode, so changing these from a digital 'A' to 'B' would not clear DMIC mode. This patch moves the code to handle DMIC mode so that it is always run when 'A' is configured as digital. Change-Id: I07fbb03b395f6264cd2b8ae0197560f3f60b588a Signed-off-by: Richard Fitzgerald --- sound/soc/codecs/madera.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/sound/soc/codecs/madera.c b/sound/soc/codecs/madera.c index 4866a9836f77..88410740140b 100644 --- a/sound/soc/codecs/madera.c +++ b/sound/soc/codecs/madera.c @@ -673,8 +673,22 @@ static int madera_inmux_put(struct snd_kcontrol *kcontrol, else if (ret) changed = true; - /* if the A input is digital we must switch both channels together */ if (inmode_a == MADERA_INMODE_DMIC) { + if (mux) + dmode_val = 0; /* B always analogue */ + else + dmode_val = 1 << MADERA_IN1_MODE_SHIFT; /* DMIC */ + + dev_dbg(madera->dev, "dmode_val=0x%x\n", dmode_val); + + ret = snd_soc_component_update_bits(dapm->component, + dmode_reg, + MADERA_IN1_MODE_MASK, + dmode_val); + if (ret < 0) + return ret; + + /* if A is digital we must switch both channels together */ switch (madera->type) { case CS47L85: case WM1840: @@ -696,14 +710,9 @@ static int madera_inmux_put(struct snd_kcontrol *kcontrol, else src_val &= ~(1 << MADERA_IN1L_SRC_SE_SHIFT); - if (mux) - dmode_val = 0; /* B always analogue */ - else - dmode_val = 1 << MADERA_IN1_MODE_SHIFT; /* DMIC */ - dev_dbg(madera->dev, - "gang_reg=0x%x inmode_gang=0x%x gang_val=0x%x dmode_val=0x%x\n", - gang_reg, inmode_gang, src_val, dmode_val); + "gang_reg=0x%x inmode_gang=0x%x gang_val=0x%x\n", + gang_reg, inmode_gang, src_val); ret = snd_soc_component_update_bits(dapm->component, gang_reg, @@ -713,11 +722,6 @@ static int madera_inmux_put(struct snd_kcontrol *kcontrol, return ret; else if (ret) changed = true; - - ret = snd_soc_component_update_bits(dapm->component, - dmode_reg, - MADERA_IN1_MODE_MASK, - dmode_val); } out: -- 2.20.1