Skip to content

Commit b373076

Browse files
committed
ASoC: mt8192: Fix event generation for controls
ALSA controls put() operations should return 1 if the value changed and 0 if it remains the same, fix the mt8192 driver to do so. Reviewed-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> Tested-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20230223-asoc-mt8192-quick-fixes-v1-2-9a85f90368e1@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 5df1a5d commit b373076

1 file changed

Lines changed: 18 additions & 7 deletions

File tree

sound/soc/mediatek/mt8192/mt8192-dai-adda.c

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -591,16 +591,19 @@ static int stf_positive_gain_set(struct snd_kcontrol *kcontrol,
591591
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(cmpnt);
592592
struct mt8192_afe_private *afe_priv = afe->platform_priv;
593593
int gain_db = ucontrol->value.integer.value[0];
594+
bool change = false;
594595

595596
afe_priv->stf_positive_gain_db = gain_db;
596597

597598
if (gain_db >= 0 && gain_db <= 24) {
598-
regmap_update_bits(afe->regmap,
599-
AFE_SIDETONE_GAIN,
600-
POSITIVE_GAIN_MASK_SFT,
601-
(gain_db / 6) << POSITIVE_GAIN_SFT);
599+
regmap_update_bits_check(afe->regmap,
600+
AFE_SIDETONE_GAIN,
601+
POSITIVE_GAIN_MASK_SFT,
602+
(gain_db / 6) << POSITIVE_GAIN_SFT,
603+
&change);
602604
}
603-
return 0;
605+
606+
return change;
604607
}
605608

606609
static int mt8192_adda_dmic_get(struct snd_kcontrol *kcontrol,
@@ -621,12 +624,17 @@ static int mt8192_adda_dmic_set(struct snd_kcontrol *kcontrol,
621624
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(cmpnt);
622625
struct mt8192_afe_private *afe_priv = afe->platform_priv;
623626
int dmic_on;
627+
bool change;
624628

625629
dmic_on = ucontrol->value.integer.value[0];
626630

631+
change = (afe_priv->mtkaif_dmic != dmic_on) ||
632+
(afe_priv->mtkaif_dmic_ch34 != dmic_on);
633+
627634
afe_priv->mtkaif_dmic = dmic_on;
628635
afe_priv->mtkaif_dmic_ch34 = dmic_on;
629-
return 0;
636+
637+
return change;
630638
}
631639

632640
static int mt8192_adda6_only_get(struct snd_kcontrol *kcontrol,
@@ -647,11 +655,14 @@ static int mt8192_adda6_only_set(struct snd_kcontrol *kcontrol,
647655
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(cmpnt);
648656
struct mt8192_afe_private *afe_priv = afe->platform_priv;
649657
int mtkaif_adda6_only;
658+
bool change;
650659

651660
mtkaif_adda6_only = ucontrol->value.integer.value[0];
652661

662+
change = afe_priv->mtkaif_adda6_only != mtkaif_adda6_only;
653663
afe_priv->mtkaif_adda6_only = mtkaif_adda6_only;
654-
return 0;
664+
665+
return change;
655666
}
656667

657668
static const struct snd_kcontrol_new mtk_adda_controls[] = {

0 commit comments

Comments
 (0)