mirror of
https://github.com/torvalds/linux.git
synced 2024-11-24 13:11:40 +00:00
ASoC: dapm: add snd_soc_dapm_put_enum_double_locked
Adds snd_soc_dapm_put_enum_double_locked() for those use cases if dapm_mutex has already locked. Signed-off-by: Tzung-Bi Shih <tzungbi@google.com> Link: https://lore.kernel.org/r/20200117073814.82441-3-tzungbi@google.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
08df0d9a00
commit
839284e794
@ -392,6 +392,8 @@ int snd_soc_dapm_get_enum_double(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol);
|
||||
int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol);
|
||||
int snd_soc_dapm_put_enum_double_locked(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol);
|
||||
int snd_soc_dapm_info_pin_switch(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_info *uinfo);
|
||||
int snd_soc_dapm_get_pin_switch(struct snd_kcontrol *kcontrol,
|
||||
|
@ -3441,17 +3441,8 @@ int snd_soc_dapm_get_enum_double(struct snd_kcontrol *kcontrol,
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_dapm_get_enum_double);
|
||||
|
||||
/**
|
||||
* snd_soc_dapm_put_enum_double - dapm enumerated double mixer set callback
|
||||
* @kcontrol: mixer control
|
||||
* @ucontrol: control element information
|
||||
*
|
||||
* Callback to set the value of a dapm enumerated double mixer control.
|
||||
*
|
||||
* Returns 0 for success.
|
||||
*/
|
||||
int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
static int __snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol, int locked)
|
||||
{
|
||||
struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol);
|
||||
struct snd_soc_card *card = dapm->card;
|
||||
@ -3474,7 +3465,9 @@ int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol,
|
||||
mask |= e->mask << e->shift_r;
|
||||
}
|
||||
|
||||
mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
|
||||
if (!locked)
|
||||
mutex_lock_nested(&card->dapm_mutex,
|
||||
SND_SOC_DAPM_CLASS_RUNTIME);
|
||||
|
||||
change = dapm_kcontrol_set_value(kcontrol, val);
|
||||
|
||||
@ -3496,6 +3489,7 @@ int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol,
|
||||
card->update = NULL;
|
||||
}
|
||||
|
||||
if (!locked)
|
||||
mutex_unlock(&card->dapm_mutex);
|
||||
|
||||
if (ret > 0)
|
||||
@ -3503,8 +3497,42 @@ int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol,
|
||||
|
||||
return change;
|
||||
}
|
||||
|
||||
/**
|
||||
* snd_soc_dapm_put_enum_double - dapm enumerated double mixer set callback
|
||||
* @kcontrol: mixer control
|
||||
* @ucontrol: control element information
|
||||
*
|
||||
* Callback to set the value of a dapm enumerated double mixer control.
|
||||
*
|
||||
* Returns 0 for success.
|
||||
*/
|
||||
int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
return __snd_soc_dapm_put_enum_double(kcontrol, ucontrol, 0);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_dapm_put_enum_double);
|
||||
|
||||
/**
|
||||
* snd_soc_dapm_put_enum_double_locked - dapm enumerated double mixer set
|
||||
* callback
|
||||
* @kcontrol: mixer control
|
||||
* @ucontrol: control element information
|
||||
*
|
||||
* Callback to set the value of a dapm enumerated double mixer control.
|
||||
* Must acquire dapm_mutex before calling the function.
|
||||
*
|
||||
* Returns 0 for success.
|
||||
*/
|
||||
int snd_soc_dapm_put_enum_double_locked(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
dapm_assert_locked(snd_soc_dapm_kcontrol_dapm(kcontrol));
|
||||
return __snd_soc_dapm_put_enum_double(kcontrol, ucontrol, 1);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_dapm_put_enum_double_locked);
|
||||
|
||||
/**
|
||||
* snd_soc_dapm_info_pin_switch - Info for a pin switch
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user