aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCharles Keepax <ckeepax@opensource.wolfsonmicro.com>2014-02-18 10:22:15 -0500
committerMark Brown <broonie@linaro.org>2014-02-20 05:22:24 -0500
commit3eb29dfb3d3bd4b600370007b96c3c675fb97aa7 (patch)
tree8fa691f7e686fdcf7f38a41e93540bb1b55802fe
parentf6d5e586b416746664c01ab5d4b19ed5e2d1cbaa (diff)
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>
-rw-r--r--include/sound/soc-dapm.h1
-rw-r--r--sound/soc/soc-dapm.c27
2 files changed, 23 insertions, 5 deletions
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 6e89ef6c11c1..3b991766a8f2 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -461,6 +461,7 @@ int snd_soc_dapm_nc_pin_unlocked(struct snd_soc_dapm_context *dapm,
461int snd_soc_dapm_get_pin_status(struct snd_soc_dapm_context *dapm, 461int snd_soc_dapm_get_pin_status(struct snd_soc_dapm_context *dapm,
462 const char *pin); 462 const char *pin);
463int snd_soc_dapm_sync(struct snd_soc_dapm_context *dapm); 463int snd_soc_dapm_sync(struct snd_soc_dapm_context *dapm);
464int snd_soc_dapm_sync_unlocked(struct snd_soc_dapm_context *dapm);
464int snd_soc_dapm_force_enable_pin(struct snd_soc_dapm_context *dapm, 465int snd_soc_dapm_force_enable_pin(struct snd_soc_dapm_context *dapm,
465 const char *pin); 466 const char *pin);
466int snd_soc_dapm_force_enable_pin_unlocked(struct snd_soc_dapm_context *dapm, 467int snd_soc_dapm_force_enable_pin_unlocked(struct snd_soc_dapm_context *dapm,
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 48a4eeb05192..4200f96a1483 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -2342,18 +2342,18 @@ static int snd_soc_dapm_set_pin(struct snd_soc_dapm_context *dapm,
2342} 2342}
2343 2343
2344/** 2344/**
2345 * snd_soc_dapm_sync - scan and power dapm paths 2345 * snd_soc_dapm_sync_unlocked - scan and power dapm paths
2346 * @dapm: DAPM context 2346 * @dapm: DAPM context
2347 * 2347 *
2348 * Walks all dapm audio paths and powers widgets according to their 2348 * Walks all dapm audio paths and powers widgets according to their
2349 * stream or path usage. 2349 * stream or path usage.
2350 * 2350 *
2351 * Requires external locking.
2352 *
2351 * Returns 0 for success. 2353 * Returns 0 for success.
2352 */ 2354 */
2353int snd_soc_dapm_sync(struct snd_soc_dapm_context *dapm) 2355int snd_soc_dapm_sync_unlocked(struct snd_soc_dapm_context *dapm)
2354{ 2356{
2355 int ret;
2356
2357 /* 2357 /*
2358 * Suppress early reports (eg, jacks syncing their state) to avoid 2358 * Suppress early reports (eg, jacks syncing their state) to avoid
2359 * silly DAPM runs during card startup. 2359 * silly DAPM runs during card startup.
@@ -2361,8 +2361,25 @@ int snd_soc_dapm_sync(struct snd_soc_dapm_context *dapm)
2361 if (!dapm->card || !dapm->card->instantiated) 2361 if (!dapm->card || !dapm->card->instantiated)
2362 return 0; 2362 return 0;
2363 2363
2364 return dapm_power_widgets(dapm->card, SND_SOC_DAPM_STREAM_NOP);
2365}
2366EXPORT_SYMBOL_GPL(snd_soc_dapm_sync_unlocked);
2367
2368/**
2369 * snd_soc_dapm_sync - scan and power dapm paths
2370 * @dapm: DAPM context
2371 *
2372 * Walks all dapm audio paths and powers widgets according to their
2373 * stream or path usage.
2374 *
2375 * Returns 0 for success.
2376 */
2377int snd_soc_dapm_sync(struct snd_soc_dapm_context *dapm)
2378{
2379 int ret;
2380
2364 mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); 2381 mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
2365 ret = dapm_power_widgets(dapm->card, SND_SOC_DAPM_STREAM_NOP); 2382 ret = snd_soc_dapm_sync_unlocked(dapm);
2366 mutex_unlock(&dapm->card->dapm_mutex); 2383 mutex_unlock(&dapm->card->dapm_mutex);
2367 return ret; 2384 return ret;
2368} 2385}