aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-dapm.c
diff options
context:
space:
mode:
authorLiam Girdwood <lrg@ti.com>2012-03-07 05:38:27 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-04-01 06:28:21 -0400
commit4edbb34577c98297f958f131e093a150b9f3226f (patch)
treeab613ec2f17f5a7838ca226fc9cc5638234511b8 /sound/soc/soc-dapm.c
parenta73fb2df01866b772a48fab93401fe3edbe0b38d (diff)
ASoC: dapm: lock mixer & mux update power with DAPM mutex
Both snd_soc_dapm_mux_update_power() and snd_soc_dapm_mixer_update_power() can be called internally within DAPM core (with DAPM mutex held) and externally. Provide some wrappers so that external users of both functions do not have to remember to hold the DAPM mutex. Signed-off-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/soc-dapm.c')
-rw-r--r--sound/soc/soc-dapm.c36
1 files changed, 30 insertions, 6 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 78aa19257143..e1863d7e8012 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -1719,7 +1719,7 @@ static inline void dapm_debugfs_cleanup(struct snd_soc_dapm_context *dapm)
1719#endif 1719#endif
1720 1720
1721/* test and update the power status of a mux widget */ 1721/* test and update the power status of a mux widget */
1722int snd_soc_dapm_mux_update_power(struct snd_soc_dapm_widget *widget, 1722static int soc_dapm_mux_update_power(struct snd_soc_dapm_widget *widget,
1723 struct snd_kcontrol *kcontrol, int mux, struct soc_enum *e) 1723 struct snd_kcontrol *kcontrol, int mux, struct soc_enum *e)
1724{ 1724{
1725 struct snd_soc_dapm_path *path; 1725 struct snd_soc_dapm_path *path;
@@ -1758,10 +1758,22 @@ int snd_soc_dapm_mux_update_power(struct snd_soc_dapm_widget *widget,
1758 1758
1759 return 0; 1759 return 0;
1760} 1760}
1761
1762int snd_soc_dapm_mux_update_power(struct snd_soc_dapm_widget *widget,
1763 struct snd_kcontrol *kcontrol, int mux, struct soc_enum *e)
1764{
1765 struct snd_soc_card *card = widget->dapm->card;
1766 int ret;
1767
1768 mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_PCM);
1769 ret = soc_dapm_mux_update_power(widget, kcontrol, mux, e);
1770 mutex_unlock(&card->dapm_mutex);
1771 return ret;
1772}
1761EXPORT_SYMBOL_GPL(snd_soc_dapm_mux_update_power); 1773EXPORT_SYMBOL_GPL(snd_soc_dapm_mux_update_power);
1762 1774
1763/* test and update the power status of a mixer or switch widget */ 1775/* test and update the power status of a mixer or switch widget */
1764int snd_soc_dapm_mixer_update_power(struct snd_soc_dapm_widget *widget, 1776static int soc_dapm_mixer_update_power(struct snd_soc_dapm_widget *widget,
1765 struct snd_kcontrol *kcontrol, int connect) 1777 struct snd_kcontrol *kcontrol, int connect)
1766{ 1778{
1767 struct snd_soc_dapm_path *path; 1779 struct snd_soc_dapm_path *path;
@@ -1790,6 +1802,18 @@ int snd_soc_dapm_mixer_update_power(struct snd_soc_dapm_widget *widget,
1790 1802
1791 return 0; 1803 return 0;
1792} 1804}
1805
1806int snd_soc_dapm_mixer_update_power(struct snd_soc_dapm_widget *widget,
1807 struct snd_kcontrol *kcontrol, int connect)
1808{
1809 struct snd_soc_card *card = widget->dapm->card;
1810 int ret;
1811
1812 mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_PCM);
1813 ret = soc_dapm_mixer_update_power(widget, kcontrol, connect);
1814 mutex_unlock(&card->dapm_mutex);
1815 return ret;
1816}
1793EXPORT_SYMBOL_GPL(snd_soc_dapm_mixer_update_power); 1817EXPORT_SYMBOL_GPL(snd_soc_dapm_mixer_update_power);
1794 1818
1795/* show dapm widget status in sys fs */ 1819/* show dapm widget status in sys fs */
@@ -2393,7 +2417,7 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol,
2393 update.val = val; 2417 update.val = val;
2394 widget->dapm->update = &update; 2418 widget->dapm->update = &update;
2395 2419
2396 snd_soc_dapm_mixer_update_power(widget, kcontrol, connect); 2420 soc_dapm_mixer_update_power(widget, kcontrol, connect);
2397 2421
2398 widget->dapm->update = NULL; 2422 widget->dapm->update = NULL;
2399 } 2423 }
@@ -2485,7 +2509,7 @@ int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol,
2485 update.val = val; 2509 update.val = val;
2486 widget->dapm->update = &update; 2510 widget->dapm->update = &update;
2487 2511
2488 snd_soc_dapm_mux_update_power(widget, kcontrol, mux, e); 2512 soc_dapm_mux_update_power(widget, kcontrol, mux, e);
2489 2513
2490 widget->dapm->update = NULL; 2514 widget->dapm->update = NULL;
2491 } 2515 }
@@ -2547,7 +2571,7 @@ int snd_soc_dapm_put_enum_virt(struct snd_kcontrol *kcontrol,
2547 2571
2548 widget->value = ucontrol->value.enumerated.item[0]; 2572 widget->value = ucontrol->value.enumerated.item[0];
2549 2573
2550 snd_soc_dapm_mux_update_power(widget, kcontrol, widget->value, e); 2574 soc_dapm_mux_update_power(widget, kcontrol, widget->value, e);
2551 } 2575 }
2552 } 2576 }
2553 2577
@@ -2651,7 +2675,7 @@ int snd_soc_dapm_put_value_enum_double(struct snd_kcontrol *kcontrol,
2651 update.val = val; 2675 update.val = val;
2652 widget->dapm->update = &update; 2676 widget->dapm->update = &update;
2653 2677
2654 snd_soc_dapm_mux_update_power(widget, kcontrol, mux, e); 2678 soc_dapm_mux_update_power(widget, kcontrol, mux, e);
2655 2679
2656 widget->dapm->update = NULL; 2680 widget->dapm->update = NULL;
2657 } 2681 }