ASoC: DAPM: Fix missing kctl change notifications
commit 5af82c81b2c49cfb1cad84d9eb6eab0e3d1c4842 upstream. The put callback of a kcontrol is supposed to return 1 when the value is changed, and this will be notified to user-space. However, some DAPM kcontrols always return 0 (except for errors), hence the user-space misses the update of a control value. This patch corrects the behavior by properly returning 1 when the value gets updated. Reported-and-tested-by: Hans de Goede <hdegoede@redhat.com> Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://lore.kernel.org/r/20211006141712.2439-1-tiwai@suse.de Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
a2606acf41
commit
0d867a3599
@@ -2559,6 +2559,7 @@ static int snd_soc_dapm_set_pin(struct snd_soc_dapm_context *dapm,
|
|||||||
const char *pin, int status)
|
const char *pin, int status)
|
||||||
{
|
{
|
||||||
struct snd_soc_dapm_widget *w = dapm_find_widget(dapm, pin, true);
|
struct snd_soc_dapm_widget *w = dapm_find_widget(dapm, pin, true);
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
dapm_assert_locked(dapm);
|
dapm_assert_locked(dapm);
|
||||||
|
|
||||||
@@ -2571,13 +2572,14 @@ static int snd_soc_dapm_set_pin(struct snd_soc_dapm_context *dapm,
|
|||||||
dapm_mark_dirty(w, "pin configuration");
|
dapm_mark_dirty(w, "pin configuration");
|
||||||
dapm_widget_invalidate_input_paths(w);
|
dapm_widget_invalidate_input_paths(w);
|
||||||
dapm_widget_invalidate_output_paths(w);
|
dapm_widget_invalidate_output_paths(w);
|
||||||
|
ret = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
w->connected = status;
|
w->connected = status;
|
||||||
if (status == 0)
|
if (status == 0)
|
||||||
w->force = 0;
|
w->force = 0;
|
||||||
|
|
||||||
return 0;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -3582,14 +3584,15 @@ int snd_soc_dapm_put_pin_switch(struct snd_kcontrol *kcontrol,
|
|||||||
{
|
{
|
||||||
struct snd_soc_card *card = snd_kcontrol_chip(kcontrol);
|
struct snd_soc_card *card = snd_kcontrol_chip(kcontrol);
|
||||||
const char *pin = (const char *)kcontrol->private_value;
|
const char *pin = (const char *)kcontrol->private_value;
|
||||||
|
int ret;
|
||||||
|
|
||||||
if (ucontrol->value.integer.value[0])
|
if (ucontrol->value.integer.value[0])
|
||||||
snd_soc_dapm_enable_pin(&card->dapm, pin);
|
ret = snd_soc_dapm_enable_pin(&card->dapm, pin);
|
||||||
else
|
else
|
||||||
snd_soc_dapm_disable_pin(&card->dapm, pin);
|
ret = snd_soc_dapm_disable_pin(&card->dapm, pin);
|
||||||
|
|
||||||
snd_soc_dapm_sync(&card->dapm);
|
snd_soc_dapm_sync(&card->dapm);
|
||||||
return 0;
|
return ret;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(snd_soc_dapm_put_pin_switch);
|
EXPORT_SYMBOL_GPL(snd_soc_dapm_put_pin_switch);
|
||||||
|
|
||||||
@@ -4035,7 +4038,7 @@ static int snd_soc_dapm_dai_link_put(struct snd_kcontrol *kcontrol,
|
|||||||
|
|
||||||
rtd->params_select = ucontrol->value.enumerated.item[0];
|
rtd->params_select = ucontrol->value.enumerated.item[0];
|
||||||
|
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Reference in New Issue
Block a user