* [PATCH 2/4] ASoC: wm5110: Fix DRE control
2022-06-21 10:20 [PATCH 1/4] ASoC: wm_adsp: Fix event for preloader Charles Keepax
@ 2022-06-21 10:20 ` Charles Keepax
2022-06-21 10:20 ` [PATCH 3/4] ASoC: cs35l41: Correct some control names Charles Keepax
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Charles Keepax @ 2022-06-21 10:20 UTC (permalink / raw)
To: broonie
Cc: james.schulman, david.rhodes, lgirdwood, alsa-devel, patches,
linux-kernel
The DRE controls on wm5110 should return a value of 1 if the DRE state
is actually changed, update to fix this.
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---
sound/soc/codecs/wm5110.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/wm5110.c b/sound/soc/codecs/wm5110.c
index 4973ba1ed7791..4ab7a672f8de8 100644
--- a/sound/soc/codecs/wm5110.c
+++ b/sound/soc/codecs/wm5110.c
@@ -413,6 +413,7 @@ static int wm5110_put_dre(struct snd_kcontrol *kcontrol,
unsigned int rnew = (!!ucontrol->value.integer.value[1]) << mc->rshift;
unsigned int lold, rold;
unsigned int lena, rena;
+ bool change = false;
int ret;
snd_soc_dapm_mutex_lock(dapm);
@@ -440,8 +441,8 @@ static int wm5110_put_dre(struct snd_kcontrol *kcontrol,
goto err;
}
- ret = regmap_update_bits(arizona->regmap, ARIZONA_DRE_ENABLE,
- mask, lnew | rnew);
+ ret = regmap_update_bits_check(arizona->regmap, ARIZONA_DRE_ENABLE,
+ mask, lnew | rnew, &change);
if (ret) {
dev_err(arizona->dev, "Failed to set DRE: %d\n", ret);
goto err;
@@ -454,6 +455,9 @@ static int wm5110_put_dre(struct snd_kcontrol *kcontrol,
if (!rnew && rold)
wm5110_clear_pga_volume(arizona, mc->rshift);
+ if (change)
+ ret = 1;
+
err:
snd_soc_dapm_mutex_unlock(dapm);
--
2.30.2
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH 3/4] ASoC: cs35l41: Correct some control names
2022-06-21 10:20 [PATCH 1/4] ASoC: wm_adsp: Fix event for preloader Charles Keepax
2022-06-21 10:20 ` [PATCH 2/4] ASoC: wm5110: Fix DRE control Charles Keepax
@ 2022-06-21 10:20 ` Charles Keepax
2022-06-21 17:11 ` David Rhodes
2022-06-21 10:20 ` [PATCH 4/4] ASoC: core: Add new SOC_DOUBLE_SX_TLV macro Charles Keepax
2022-06-21 16:59 ` [PATCH 1/4] ASoC: wm_adsp: Fix event for preloader Mark Brown
3 siblings, 1 reply; 6+ messages in thread
From: Charles Keepax @ 2022-06-21 10:20 UTC (permalink / raw)
To: broonie
Cc: james.schulman, david.rhodes, lgirdwood, alsa-devel, patches,
linux-kernel
Various boolean controls on cs35l41 are missing the required "Switch" in
the name, add these.
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---
sound/soc/codecs/cs35l41.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/sound/soc/codecs/cs35l41.c b/sound/soc/codecs/cs35l41.c
index a115ea35b92d4..8766e19d85f11 100644
--- a/sound/soc/codecs/cs35l41.c
+++ b/sound/soc/codecs/cs35l41.c
@@ -333,7 +333,7 @@ static const struct snd_kcontrol_new cs35l41_aud_controls[] = {
SOC_SINGLE("HW Noise Gate Enable", CS35L41_NG_CFG, 8, 63, 0),
SOC_SINGLE("HW Noise Gate Delay", CS35L41_NG_CFG, 4, 7, 0),
SOC_SINGLE("HW Noise Gate Threshold", CS35L41_NG_CFG, 0, 7, 0),
- SOC_SINGLE("Aux Noise Gate CH1 Enable",
+ SOC_SINGLE("Aux Noise Gate CH1 Switch",
CS35L41_MIXER_NGATE_CH1_CFG, 16, 1, 0),
SOC_SINGLE("Aux Noise Gate CH1 Entry Delay",
CS35L41_MIXER_NGATE_CH1_CFG, 8, 15, 0),
@@ -341,15 +341,15 @@ static const struct snd_kcontrol_new cs35l41_aud_controls[] = {
CS35L41_MIXER_NGATE_CH1_CFG, 0, 7, 0),
SOC_SINGLE("Aux Noise Gate CH2 Entry Delay",
CS35L41_MIXER_NGATE_CH2_CFG, 8, 15, 0),
- SOC_SINGLE("Aux Noise Gate CH2 Enable",
+ SOC_SINGLE("Aux Noise Gate CH2 Switch",
CS35L41_MIXER_NGATE_CH2_CFG, 16, 1, 0),
SOC_SINGLE("Aux Noise Gate CH2 Threshold",
CS35L41_MIXER_NGATE_CH2_CFG, 0, 7, 0),
- SOC_SINGLE("SCLK Force", CS35L41_SP_FORMAT, CS35L41_SCLK_FRC_SHIFT, 1, 0),
- SOC_SINGLE("LRCLK Force", CS35L41_SP_FORMAT, CS35L41_LRCLK_FRC_SHIFT, 1, 0),
- SOC_SINGLE("Invert Class D", CS35L41_AMP_DIG_VOL_CTRL,
+ SOC_SINGLE("SCLK Force Switch", CS35L41_SP_FORMAT, CS35L41_SCLK_FRC_SHIFT, 1, 0),
+ SOC_SINGLE("LRCLK Force Switch", CS35L41_SP_FORMAT, CS35L41_LRCLK_FRC_SHIFT, 1, 0),
+ SOC_SINGLE("Invert Class D Switch", CS35L41_AMP_DIG_VOL_CTRL,
CS35L41_AMP_INV_PCM_SHIFT, 1, 0),
- SOC_SINGLE("Amp Gain ZC", CS35L41_AMP_GAIN_CTRL,
+ SOC_SINGLE("Amp Gain ZC Switch", CS35L41_AMP_GAIN_CTRL,
CS35L41_AMP_GAIN_ZC_SHIFT, 1, 0),
WM_ADSP2_PRELOAD_SWITCH("DSP1", 1),
WM_ADSP_FW_CONTROL("DSP1", 0),
--
2.30.2
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH 4/4] ASoC: core: Add new SOC_DOUBLE_SX_TLV macro
2022-06-21 10:20 [PATCH 1/4] ASoC: wm_adsp: Fix event for preloader Charles Keepax
2022-06-21 10:20 ` [PATCH 2/4] ASoC: wm5110: Fix DRE control Charles Keepax
2022-06-21 10:20 ` [PATCH 3/4] ASoC: cs35l41: Correct some control names Charles Keepax
@ 2022-06-21 10:20 ` Charles Keepax
2022-06-21 16:59 ` [PATCH 1/4] ASoC: wm_adsp: Fix event for preloader Mark Brown
3 siblings, 0 replies; 6+ messages in thread
From: Charles Keepax @ 2022-06-21 10:20 UTC (permalink / raw)
To: broonie
Cc: james.schulman, david.rhodes, lgirdwood, alsa-devel, patches,
linux-kernel
Currently macros only exist for SX style (implicit sign bit 2's
compliment) volume controls where the volumes for left and right
are in separate registers. Some future Cirrus devices will have
both volumes in the same register, as such add a new macro to
support this.
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---
include/sound/soc.h | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 8909cc7d311ef..76ee3c2b8b56c 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -136,6 +136,18 @@
.put = snd_soc_put_volsw, \
.private_value = SOC_DOUBLE_VALUE(reg, shift_left, shift_right, \
max, invert, 0) }
+#define SOC_DOUBLE_SX_TLV(xname, xreg, shift_left, shift_right, xmin, xmax, tlv_array) \
+{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
+ .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
+ SNDRV_CTL_ELEM_ACCESS_READWRITE, \
+ .tlv.p = (tlv_array), \
+ .info = snd_soc_info_volsw_sx, \
+ .get = snd_soc_get_volsw_sx, \
+ .put = snd_soc_put_volsw_sx, \
+ .private_value = (unsigned long)&(struct soc_mixer_control) \
+ {.reg = xreg, .rreg = xreg, \
+ .shift = shift_left, .rshift = shift_right, \
+ .max = xmax, .min = xmin} }
#define SOC_DOUBLE_R_TLV(xname, reg_left, reg_right, xshift, xmax, xinvert, tlv_array) \
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
--
2.30.2
^ permalink raw reply [flat|nested] 6+ messages in thread