diff options
author | Mark Brown <broonie@kernel.org> | 2022-07-11 15:51:01 +0100 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2022-07-11 15:51:01 +0100 |
commit | 39c5c44fc451c083908e77c3b2762fae2bf8acca (patch) | |
tree | 6e3c05c56e48fa9d29ad1f89614e9f0ef48459d4 /sound/soc/codecs/wm5102.c | |
parent | ASoC: fsl_utils: Drop usage of __clk_get_name() (diff) | |
parent | ASoC: rockchip: i2s: Fix NULL pointer dereference when pinctrl is not found (diff) | |
download | wireguard-linux-39c5c44fc451c083908e77c3b2762fae2bf8acca.tar.xz wireguard-linux-39c5c44fc451c083908e77c3b2762fae2bf8acca.zip |
ASoC: Merge up fixes
Needed for the Rockchip driver.
Diffstat (limited to 'sound/soc/codecs/wm5102.c')
-rw-r--r-- | sound/soc/codecs/wm5102.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/sound/soc/codecs/wm5102.c b/sound/soc/codecs/wm5102.c index 8b1caac65c3a..af7d324e3352 100644 --- a/sound/soc/codecs/wm5102.c +++ b/sound/soc/codecs/wm5102.c @@ -680,12 +680,17 @@ static int wm5102_out_comp_coeff_put(struct snd_kcontrol *kcontrol, { struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); struct arizona *arizona = dev_get_drvdata(component->dev->parent); + uint16_t dac_comp_coeff = get_unaligned_be16(ucontrol->value.bytes.data); + int ret = 0; mutex_lock(&arizona->dac_comp_lock); - arizona->dac_comp_coeff = get_unaligned_be16(ucontrol->value.bytes.data); + if (arizona->dac_comp_coeff != dac_comp_coeff) { + arizona->dac_comp_coeff = dac_comp_coeff; + ret = 1; + } mutex_unlock(&arizona->dac_comp_lock); - return 0; + return ret; } static int wm5102_out_comp_switch_get(struct snd_kcontrol *kcontrol, @@ -706,12 +711,20 @@ static int wm5102_out_comp_switch_put(struct snd_kcontrol *kcontrol, { struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); struct arizona *arizona = dev_get_drvdata(component->dev->parent); + struct soc_mixer_control *mc = (struct soc_mixer_control *)kcontrol->private_value; + int ret = 0; + + if (ucontrol->value.integer.value[0] > mc->max) + return -EINVAL; mutex_lock(&arizona->dac_comp_lock); - arizona->dac_comp_enabled = ucontrol->value.integer.value[0]; + if (arizona->dac_comp_enabled != ucontrol->value.integer.value[0]) { + arizona->dac_comp_enabled = ucontrol->value.integer.value[0]; + ret = 1; + } mutex_unlock(&arizona->dac_comp_lock); - return 0; + return ret; } static const char * const wm5102_osr_text[] = { |