Skip to content

Commit 71b5ab9

Browse files
charleskeepaxbroonie
authored andcommitted
ASoC: wm5102: Fix event generation for output compensation
The output compensation controls always returns zero regardless of if the control value was updated. This results in missing notifications to user-space of the control change. Update the handling to return 1 when the value is changed. Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20220628153409.3266932-1-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent a5d6d28 commit 71b5ab9

1 file changed

Lines changed: 17 additions & 4 deletions

File tree

sound/soc/codecs/wm5102.c

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -680,12 +680,17 @@ static int wm5102_out_comp_coeff_put(struct snd_kcontrol *kcontrol,
680680
{
681681
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
682682
struct arizona *arizona = dev_get_drvdata(component->dev->parent);
683+
uint16_t dac_comp_coeff = get_unaligned_be16(ucontrol->value.bytes.data);
684+
int ret = 0;
683685

684686
mutex_lock(&arizona->dac_comp_lock);
685-
arizona->dac_comp_coeff = get_unaligned_be16(ucontrol->value.bytes.data);
687+
if (arizona->dac_comp_coeff != dac_comp_coeff) {
688+
arizona->dac_comp_coeff = dac_comp_coeff;
689+
ret = 1;
690+
}
686691
mutex_unlock(&arizona->dac_comp_lock);
687692

688-
return 0;
693+
return ret;
689694
}
690695

691696
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,
706711
{
707712
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
708713
struct arizona *arizona = dev_get_drvdata(component->dev->parent);
714+
struct soc_mixer_control *mc = (struct soc_mixer_control *)kcontrol->private_value;
715+
int ret = 0;
716+
717+
if (ucontrol->value.integer.value[0] > mc->max)
718+
return -EINVAL;
709719

710720
mutex_lock(&arizona->dac_comp_lock);
711-
arizona->dac_comp_enabled = ucontrol->value.integer.value[0];
721+
if (arizona->dac_comp_enabled != ucontrol->value.integer.value[0]) {
722+
arizona->dac_comp_enabled = ucontrol->value.integer.value[0];
723+
ret = 1;
724+
}
712725
mutex_unlock(&arizona->dac_comp_lock);
713726

714-
return 0;
727+
return ret;
715728
}
716729

717730
static const char * const wm5102_osr_text[] = {

0 commit comments

Comments
 (0)