mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-01 10:43:43 +00:00
ASoC: dapm: Add unlocked version of snd_soc_dapm_sync
We will often call sync after several functions that require the DAPM mutex to be held. Rather than release and immediately relock the mutex provide an unlocked function for this situation. Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@linaro.org>
This commit is contained in:
parent
f6d5e586b4
commit
3eb29dfb3d
@ -461,6 +461,7 @@ int snd_soc_dapm_nc_pin_unlocked(struct snd_soc_dapm_context *dapm,
|
||||
int snd_soc_dapm_get_pin_status(struct snd_soc_dapm_context *dapm,
|
||||
const char *pin);
|
||||
int snd_soc_dapm_sync(struct snd_soc_dapm_context *dapm);
|
||||
int snd_soc_dapm_sync_unlocked(struct snd_soc_dapm_context *dapm);
|
||||
int snd_soc_dapm_force_enable_pin(struct snd_soc_dapm_context *dapm,
|
||||
const char *pin);
|
||||
int snd_soc_dapm_force_enable_pin_unlocked(struct snd_soc_dapm_context *dapm,
|
||||
|
@ -2341,6 +2341,30 @@ static int snd_soc_dapm_set_pin(struct snd_soc_dapm_context *dapm,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* snd_soc_dapm_sync_unlocked - scan and power dapm paths
|
||||
* @dapm: DAPM context
|
||||
*
|
||||
* Walks all dapm audio paths and powers widgets according to their
|
||||
* stream or path usage.
|
||||
*
|
||||
* Requires external locking.
|
||||
*
|
||||
* Returns 0 for success.
|
||||
*/
|
||||
int snd_soc_dapm_sync_unlocked(struct snd_soc_dapm_context *dapm)
|
||||
{
|
||||
/*
|
||||
* Suppress early reports (eg, jacks syncing their state) to avoid
|
||||
* silly DAPM runs during card startup.
|
||||
*/
|
||||
if (!dapm->card || !dapm->card->instantiated)
|
||||
return 0;
|
||||
|
||||
return dapm_power_widgets(dapm->card, SND_SOC_DAPM_STREAM_NOP);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_dapm_sync_unlocked);
|
||||
|
||||
/**
|
||||
* snd_soc_dapm_sync - scan and power dapm paths
|
||||
* @dapm: DAPM context
|
||||
@ -2354,15 +2378,8 @@ int snd_soc_dapm_sync(struct snd_soc_dapm_context *dapm)
|
||||
{
|
||||
int ret;
|
||||
|
||||
/*
|
||||
* Suppress early reports (eg, jacks syncing their state) to avoid
|
||||
* silly DAPM runs during card startup.
|
||||
*/
|
||||
if (!dapm->card || !dapm->card->instantiated)
|
||||
return 0;
|
||||
|
||||
mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
|
||||
ret = dapm_power_widgets(dapm->card, SND_SOC_DAPM_STREAM_NOP);
|
||||
ret = snd_soc_dapm_sync_unlocked(dapm);
|
||||
mutex_unlock(&dapm->card->dapm_mutex);
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user