diff options
-rw-r--r-- | drivers/extcon/extcon-arizona.c | 12 | ||||
-rw-r--r-- | drivers/input/misc/arizona-haptics.c | 19 | ||||
-rw-r--r-- | include/sound/soc-dapm.h | 8 | ||||
-rw-r--r-- | sound/soc/soc-dapm.c | 139 |
4 files changed, 134 insertions, 44 deletions
diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c index c20602f601ee..98a14f6143a7 100644 --- a/drivers/extcon/extcon-arizona.c +++ b/drivers/extcon/extcon-arizona.c | |||
@@ -222,27 +222,19 @@ static void arizona_extcon_pulse_micbias(struct arizona_extcon_info *info) | |||
222 | struct snd_soc_dapm_context *dapm = arizona->dapm; | 222 | struct snd_soc_dapm_context *dapm = arizona->dapm; |
223 | int ret; | 223 | int ret; |
224 | 224 | ||
225 | mutex_lock(&dapm->card->dapm_mutex); | ||
226 | |||
227 | ret = snd_soc_dapm_force_enable_pin(dapm, widget); | 225 | ret = snd_soc_dapm_force_enable_pin(dapm, widget); |
228 | if (ret != 0) | 226 | if (ret != 0) |
229 | dev_warn(arizona->dev, "Failed to enable %s: %d\n", | 227 | dev_warn(arizona->dev, "Failed to enable %s: %d\n", |
230 | widget, ret); | 228 | widget, ret); |
231 | 229 | ||
232 | mutex_unlock(&dapm->card->dapm_mutex); | ||
233 | |||
234 | snd_soc_dapm_sync(dapm); | 230 | snd_soc_dapm_sync(dapm); |
235 | 231 | ||
236 | if (!arizona->pdata.micd_force_micbias) { | 232 | if (!arizona->pdata.micd_force_micbias) { |
237 | mutex_lock(&dapm->card->dapm_mutex); | ||
238 | |||
239 | ret = snd_soc_dapm_disable_pin(arizona->dapm, widget); | 233 | ret = snd_soc_dapm_disable_pin(arizona->dapm, widget); |
240 | if (ret != 0) | 234 | if (ret != 0) |
241 | dev_warn(arizona->dev, "Failed to disable %s: %d\n", | 235 | dev_warn(arizona->dev, "Failed to disable %s: %d\n", |
242 | widget, ret); | 236 | widget, ret); |
243 | 237 | ||
244 | mutex_unlock(&dapm->card->dapm_mutex); | ||
245 | |||
246 | snd_soc_dapm_sync(dapm); | 238 | snd_soc_dapm_sync(dapm); |
247 | } | 239 | } |
248 | } | 240 | } |
@@ -304,16 +296,12 @@ static void arizona_stop_mic(struct arizona_extcon_info *info) | |||
304 | ARIZONA_MICD_ENA, 0, | 296 | ARIZONA_MICD_ENA, 0, |
305 | &change); | 297 | &change); |
306 | 298 | ||
307 | mutex_lock(&dapm->card->dapm_mutex); | ||
308 | |||
309 | ret = snd_soc_dapm_disable_pin(dapm, widget); | 299 | ret = snd_soc_dapm_disable_pin(dapm, widget); |
310 | if (ret != 0) | 300 | if (ret != 0) |
311 | dev_warn(arizona->dev, | 301 | dev_warn(arizona->dev, |
312 | "Failed to disable %s: %d\n", | 302 | "Failed to disable %s: %d\n", |
313 | widget, ret); | 303 | widget, ret); |
314 | 304 | ||
315 | mutex_unlock(&dapm->card->dapm_mutex); | ||
316 | |||
317 | snd_soc_dapm_sync(dapm); | 305 | snd_soc_dapm_sync(dapm); |
318 | 306 | ||
319 | if (info->micd_reva) { | 307 | if (info->micd_reva) { |
diff --git a/drivers/input/misc/arizona-haptics.c b/drivers/input/misc/arizona-haptics.c index 7a04f54ef961..ef2e281b0a43 100644 --- a/drivers/input/misc/arizona-haptics.c +++ b/drivers/input/misc/arizona-haptics.c | |||
@@ -37,7 +37,6 @@ static void arizona_haptics_work(struct work_struct *work) | |||
37 | struct arizona_haptics, | 37 | struct arizona_haptics, |
38 | work); | 38 | work); |
39 | struct arizona *arizona = haptics->arizona; | 39 | struct arizona *arizona = haptics->arizona; |
40 | struct mutex *dapm_mutex = &arizona->dapm->card->dapm_mutex; | ||
41 | int ret; | 40 | int ret; |
42 | 41 | ||
43 | if (!haptics->arizona->dapm) { | 42 | if (!haptics->arizona->dapm) { |
@@ -67,13 +66,10 @@ static void arizona_haptics_work(struct work_struct *work) | |||
67 | return; | 66 | return; |
68 | } | 67 | } |
69 | 68 | ||
70 | mutex_lock_nested(dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); | ||
71 | |||
72 | ret = snd_soc_dapm_enable_pin(arizona->dapm, "HAPTICS"); | 69 | ret = snd_soc_dapm_enable_pin(arizona->dapm, "HAPTICS"); |
73 | if (ret != 0) { | 70 | if (ret != 0) { |
74 | dev_err(arizona->dev, "Failed to start HAPTICS: %d\n", | 71 | dev_err(arizona->dev, "Failed to start HAPTICS: %d\n", |
75 | ret); | 72 | ret); |
76 | mutex_unlock(dapm_mutex); | ||
77 | return; | 73 | return; |
78 | } | 74 | } |
79 | 75 | ||
@@ -81,21 +77,14 @@ static void arizona_haptics_work(struct work_struct *work) | |||
81 | if (ret != 0) { | 77 | if (ret != 0) { |
82 | dev_err(arizona->dev, "Failed to sync DAPM: %d\n", | 78 | dev_err(arizona->dev, "Failed to sync DAPM: %d\n", |
83 | ret); | 79 | ret); |
84 | mutex_unlock(dapm_mutex); | ||
85 | return; | 80 | return; |
86 | } | 81 | } |
87 | |||
88 | mutex_unlock(dapm_mutex); | ||
89 | |||
90 | } else { | 82 | } else { |
91 | /* This disable sequence will be a noop if already enabled */ | 83 | /* This disable sequence will be a noop if already enabled */ |
92 | mutex_lock_nested(dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); | ||
93 | |||
94 | ret = snd_soc_dapm_disable_pin(arizona->dapm, "HAPTICS"); | 84 | ret = snd_soc_dapm_disable_pin(arizona->dapm, "HAPTICS"); |
95 | if (ret != 0) { | 85 | if (ret != 0) { |
96 | dev_err(arizona->dev, "Failed to disable HAPTICS: %d\n", | 86 | dev_err(arizona->dev, "Failed to disable HAPTICS: %d\n", |
97 | ret); | 87 | ret); |
98 | mutex_unlock(dapm_mutex); | ||
99 | return; | 88 | return; |
100 | } | 89 | } |
101 | 90 | ||
@@ -103,12 +92,9 @@ static void arizona_haptics_work(struct work_struct *work) | |||
103 | if (ret != 0) { | 92 | if (ret != 0) { |
104 | dev_err(arizona->dev, "Failed to sync DAPM: %d\n", | 93 | dev_err(arizona->dev, "Failed to sync DAPM: %d\n", |
105 | ret); | 94 | ret); |
106 | mutex_unlock(dapm_mutex); | ||
107 | return; | 95 | return; |
108 | } | 96 | } |
109 | 97 | ||
110 | mutex_unlock(dapm_mutex); | ||
111 | |||
112 | ret = regmap_update_bits(arizona->regmap, | 98 | ret = regmap_update_bits(arizona->regmap, |
113 | ARIZONA_HAPTICS_CONTROL_1, | 99 | ARIZONA_HAPTICS_CONTROL_1, |
114 | ARIZONA_HAP_CTRL_MASK, | 100 | ARIZONA_HAP_CTRL_MASK, |
@@ -155,16 +141,11 @@ static int arizona_haptics_play(struct input_dev *input, void *data, | |||
155 | static void arizona_haptics_close(struct input_dev *input) | 141 | static void arizona_haptics_close(struct input_dev *input) |
156 | { | 142 | { |
157 | struct arizona_haptics *haptics = input_get_drvdata(input); | 143 | struct arizona_haptics *haptics = input_get_drvdata(input); |
158 | struct mutex *dapm_mutex = &haptics->arizona->dapm->card->dapm_mutex; | ||
159 | 144 | ||
160 | cancel_work_sync(&haptics->work); | 145 | cancel_work_sync(&haptics->work); |
161 | 146 | ||
162 | mutex_lock_nested(dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); | ||
163 | |||
164 | if (haptics->arizona->dapm) | 147 | if (haptics->arizona->dapm) |
165 | snd_soc_dapm_disable_pin(haptics->arizona->dapm, "HAPTICS"); | 148 | snd_soc_dapm_disable_pin(haptics->arizona->dapm, "HAPTICS"); |
166 | |||
167 | mutex_unlock(dapm_mutex); | ||
168 | } | 149 | } |
169 | 150 | ||
170 | static int arizona_haptics_probe(struct platform_device *pdev) | 151 | static int arizona_haptics_probe(struct platform_device *pdev) |
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index 68d92e36facd..6e89ef6c11c1 100644 --- a/include/sound/soc-dapm.h +++ b/include/sound/soc-dapm.h | |||
@@ -449,14 +449,22 @@ void snd_soc_dapm_debugfs_init(struct snd_soc_dapm_context *dapm, | |||
449 | /* dapm audio pin control and status */ | 449 | /* dapm audio pin control and status */ |
450 | int snd_soc_dapm_enable_pin(struct snd_soc_dapm_context *dapm, | 450 | int snd_soc_dapm_enable_pin(struct snd_soc_dapm_context *dapm, |
451 | const char *pin); | 451 | const char *pin); |
452 | int snd_soc_dapm_enable_pin_unlocked(struct snd_soc_dapm_context *dapm, | ||
453 | const char *pin); | ||
452 | int snd_soc_dapm_disable_pin(struct snd_soc_dapm_context *dapm, | 454 | int snd_soc_dapm_disable_pin(struct snd_soc_dapm_context *dapm, |
453 | const char *pin); | 455 | const char *pin); |
456 | int snd_soc_dapm_disable_pin_unlocked(struct snd_soc_dapm_context *dapm, | ||
457 | const char *pin); | ||
454 | int snd_soc_dapm_nc_pin(struct snd_soc_dapm_context *dapm, const char *pin); | 458 | int snd_soc_dapm_nc_pin(struct snd_soc_dapm_context *dapm, const char *pin); |
459 | int snd_soc_dapm_nc_pin_unlocked(struct snd_soc_dapm_context *dapm, | ||
460 | const char *pin); | ||
455 | int snd_soc_dapm_get_pin_status(struct snd_soc_dapm_context *dapm, | 461 | int snd_soc_dapm_get_pin_status(struct snd_soc_dapm_context *dapm, |
456 | const char *pin); | 462 | const char *pin); |
457 | int snd_soc_dapm_sync(struct snd_soc_dapm_context *dapm); | 463 | int snd_soc_dapm_sync(struct snd_soc_dapm_context *dapm); |
458 | int snd_soc_dapm_force_enable_pin(struct snd_soc_dapm_context *dapm, | 464 | int snd_soc_dapm_force_enable_pin(struct snd_soc_dapm_context *dapm, |
459 | const char *pin); | 465 | const char *pin); |
466 | int snd_soc_dapm_force_enable_pin_unlocked(struct snd_soc_dapm_context *dapm, | ||
467 | const char *pin); | ||
460 | int snd_soc_dapm_ignore_suspend(struct snd_soc_dapm_context *dapm, | 468 | int snd_soc_dapm_ignore_suspend(struct snd_soc_dapm_context *dapm, |
461 | const char *pin); | 469 | const char *pin); |
462 | void snd_soc_dapm_auto_nc_codec_pins(struct snd_soc_codec *codec); | 470 | void snd_soc_dapm_auto_nc_codec_pins(struct snd_soc_codec *codec); |
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index dc8ff13187f7..b9dc6acbba8c 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -1218,7 +1218,7 @@ int dapm_regulator_event(struct snd_soc_dapm_widget *w, | |||
1218 | ret = regulator_allow_bypass(w->regulator, false); | 1218 | ret = regulator_allow_bypass(w->regulator, false); |
1219 | if (ret != 0) | 1219 | if (ret != 0) |
1220 | dev_warn(w->dapm->dev, | 1220 | dev_warn(w->dapm->dev, |
1221 | "ASoC: Failed to bypass %s: %d\n", | 1221 | "ASoC: Failed to unbypass %s: %d\n", |
1222 | w->name, ret); | 1222 | w->name, ret); |
1223 | } | 1223 | } |
1224 | 1224 | ||
@@ -1228,7 +1228,7 @@ int dapm_regulator_event(struct snd_soc_dapm_widget *w, | |||
1228 | ret = regulator_allow_bypass(w->regulator, true); | 1228 | ret = regulator_allow_bypass(w->regulator, true); |
1229 | if (ret != 0) | 1229 | if (ret != 0) |
1230 | dev_warn(w->dapm->dev, | 1230 | dev_warn(w->dapm->dev, |
1231 | "ASoC: Failed to unbypass %s: %d\n", | 1231 | "ASoC: Failed to bypass %s: %d\n", |
1232 | w->name, ret); | 1232 | w->name, ret); |
1233 | } | 1233 | } |
1234 | 1234 | ||
@@ -3210,15 +3210,11 @@ int snd_soc_dapm_put_pin_switch(struct snd_kcontrol *kcontrol, | |||
3210 | struct snd_soc_card *card = snd_kcontrol_chip(kcontrol); | 3210 | struct snd_soc_card *card = snd_kcontrol_chip(kcontrol); |
3211 | const char *pin = (const char *)kcontrol->private_value; | 3211 | const char *pin = (const char *)kcontrol->private_value; |
3212 | 3212 | ||
3213 | mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); | ||
3214 | |||
3215 | if (ucontrol->value.integer.value[0]) | 3213 | if (ucontrol->value.integer.value[0]) |
3216 | snd_soc_dapm_enable_pin(&card->dapm, pin); | 3214 | snd_soc_dapm_enable_pin(&card->dapm, pin); |
3217 | else | 3215 | else |
3218 | snd_soc_dapm_disable_pin(&card->dapm, pin); | 3216 | snd_soc_dapm_disable_pin(&card->dapm, pin); |
3219 | 3217 | ||
3220 | mutex_unlock(&card->dapm_mutex); | ||
3221 | |||
3222 | snd_soc_dapm_sync(&card->dapm); | 3218 | snd_soc_dapm_sync(&card->dapm); |
3223 | return 0; | 3219 | return 0; |
3224 | } | 3220 | } |
@@ -3248,7 +3244,7 @@ snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm, | |||
3248 | ret = regulator_allow_bypass(w->regulator, true); | 3244 | ret = regulator_allow_bypass(w->regulator, true); |
3249 | if (ret != 0) | 3245 | if (ret != 0) |
3250 | dev_warn(w->dapm->dev, | 3246 | dev_warn(w->dapm->dev, |
3251 | "ASoC: Failed to unbypass %s: %d\n", | 3247 | "ASoC: Failed to bypass %s: %d\n", |
3252 | w->name, ret); | 3248 | w->name, ret); |
3253 | } | 3249 | } |
3254 | break; | 3250 | break; |
@@ -3767,23 +3763,52 @@ void snd_soc_dapm_stream_event(struct snd_soc_pcm_runtime *rtd, int stream, | |||
3767 | } | 3763 | } |
3768 | 3764 | ||
3769 | /** | 3765 | /** |
3766 | * snd_soc_dapm_enable_pin_unlocked - enable pin. | ||
3767 | * @dapm: DAPM context | ||
3768 | * @pin: pin name | ||
3769 | * | ||
3770 | * Enables input/output pin and its parents or children widgets iff there is | ||
3771 | * a valid audio route and active audio stream. | ||
3772 | * | ||
3773 | * Requires external locking. | ||
3774 | * | ||
3775 | * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to | ||
3776 | * do any widget power switching. | ||
3777 | */ | ||
3778 | int snd_soc_dapm_enable_pin_unlocked(struct snd_soc_dapm_context *dapm, | ||
3779 | const char *pin) | ||
3780 | { | ||
3781 | return snd_soc_dapm_set_pin(dapm, pin, 1); | ||
3782 | } | ||
3783 | EXPORT_SYMBOL_GPL(snd_soc_dapm_enable_pin_unlocked); | ||
3784 | |||
3785 | /** | ||
3770 | * snd_soc_dapm_enable_pin - enable pin. | 3786 | * snd_soc_dapm_enable_pin - enable pin. |
3771 | * @dapm: DAPM context | 3787 | * @dapm: DAPM context |
3772 | * @pin: pin name | 3788 | * @pin: pin name |
3773 | * | 3789 | * |
3774 | * Enables input/output pin and its parents or children widgets iff there is | 3790 | * Enables input/output pin and its parents or children widgets iff there is |
3775 | * a valid audio route and active audio stream. | 3791 | * a valid audio route and active audio stream. |
3792 | * | ||
3776 | * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to | 3793 | * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to |
3777 | * do any widget power switching. | 3794 | * do any widget power switching. |
3778 | */ | 3795 | */ |
3779 | int snd_soc_dapm_enable_pin(struct snd_soc_dapm_context *dapm, const char *pin) | 3796 | int snd_soc_dapm_enable_pin(struct snd_soc_dapm_context *dapm, const char *pin) |
3780 | { | 3797 | { |
3781 | return snd_soc_dapm_set_pin(dapm, pin, 1); | 3798 | int ret; |
3799 | |||
3800 | mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); | ||
3801 | |||
3802 | ret = snd_soc_dapm_set_pin(dapm, pin, 1); | ||
3803 | |||
3804 | mutex_unlock(&dapm->card->dapm_mutex); | ||
3805 | |||
3806 | return ret; | ||
3782 | } | 3807 | } |
3783 | EXPORT_SYMBOL_GPL(snd_soc_dapm_enable_pin); | 3808 | EXPORT_SYMBOL_GPL(snd_soc_dapm_enable_pin); |
3784 | 3809 | ||
3785 | /** | 3810 | /** |
3786 | * snd_soc_dapm_force_enable_pin - force a pin to be enabled | 3811 | * snd_soc_dapm_force_enable_pin_unlocked - force a pin to be enabled |
3787 | * @dapm: DAPM context | 3812 | * @dapm: DAPM context |
3788 | * @pin: pin name | 3813 | * @pin: pin name |
3789 | * | 3814 | * |
@@ -3791,11 +3816,13 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_enable_pin); | |||
3791 | * intended for use with microphone bias supplies used in microphone | 3816 | * intended for use with microphone bias supplies used in microphone |
3792 | * jack detection. | 3817 | * jack detection. |
3793 | * | 3818 | * |
3819 | * Requires external locking. | ||
3820 | * | ||
3794 | * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to | 3821 | * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to |
3795 | * do any widget power switching. | 3822 | * do any widget power switching. |
3796 | */ | 3823 | */ |
3797 | int snd_soc_dapm_force_enable_pin(struct snd_soc_dapm_context *dapm, | 3824 | int snd_soc_dapm_force_enable_pin_unlocked(struct snd_soc_dapm_context *dapm, |
3798 | const char *pin) | 3825 | const char *pin) |
3799 | { | 3826 | { |
3800 | struct snd_soc_dapm_widget *w = dapm_find_widget(dapm, pin, true); | 3827 | struct snd_soc_dapm_widget *w = dapm_find_widget(dapm, pin, true); |
3801 | 3828 | ||
@@ -3811,25 +3838,103 @@ int snd_soc_dapm_force_enable_pin(struct snd_soc_dapm_context *dapm, | |||
3811 | 3838 | ||
3812 | return 0; | 3839 | return 0; |
3813 | } | 3840 | } |
3841 | EXPORT_SYMBOL_GPL(snd_soc_dapm_force_enable_pin_unlocked); | ||
3842 | |||
3843 | /** | ||
3844 | * snd_soc_dapm_force_enable_pin - force a pin to be enabled | ||
3845 | * @dapm: DAPM context | ||
3846 | * @pin: pin name | ||
3847 | * | ||
3848 | * Enables input/output pin regardless of any other state. This is | ||
3849 | * intended for use with microphone bias supplies used in microphone | ||
3850 | * jack detection. | ||
3851 | * | ||
3852 | * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to | ||
3853 | * do any widget power switching. | ||
3854 | */ | ||
3855 | int snd_soc_dapm_force_enable_pin(struct snd_soc_dapm_context *dapm, | ||
3856 | const char *pin) | ||
3857 | { | ||
3858 | int ret; | ||
3859 | |||
3860 | mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); | ||
3861 | |||
3862 | ret = snd_soc_dapm_force_enable_pin_unlocked(dapm, pin); | ||
3863 | |||
3864 | mutex_unlock(&dapm->card->dapm_mutex); | ||
3865 | |||
3866 | return ret; | ||
3867 | } | ||
3814 | EXPORT_SYMBOL_GPL(snd_soc_dapm_force_enable_pin); | 3868 | EXPORT_SYMBOL_GPL(snd_soc_dapm_force_enable_pin); |
3815 | 3869 | ||
3816 | /** | 3870 | /** |
3871 | * snd_soc_dapm_disable_pin_unlocked - disable pin. | ||
3872 | * @dapm: DAPM context | ||
3873 | * @pin: pin name | ||
3874 | * | ||
3875 | * Disables input/output pin and its parents or children widgets. | ||
3876 | * | ||
3877 | * Requires external locking. | ||
3878 | * | ||
3879 | * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to | ||
3880 | * do any widget power switching. | ||
3881 | */ | ||
3882 | int snd_soc_dapm_disable_pin_unlocked(struct snd_soc_dapm_context *dapm, | ||
3883 | const char *pin) | ||
3884 | { | ||
3885 | return snd_soc_dapm_set_pin(dapm, pin, 0); | ||
3886 | } | ||
3887 | EXPORT_SYMBOL_GPL(snd_soc_dapm_disable_pin_unlocked); | ||
3888 | |||
3889 | /** | ||
3817 | * snd_soc_dapm_disable_pin - disable pin. | 3890 | * snd_soc_dapm_disable_pin - disable pin. |
3818 | * @dapm: DAPM context | 3891 | * @dapm: DAPM context |
3819 | * @pin: pin name | 3892 | * @pin: pin name |
3820 | * | 3893 | * |
3821 | * Disables input/output pin and its parents or children widgets. | 3894 | * Disables input/output pin and its parents or children widgets. |
3895 | * | ||
3822 | * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to | 3896 | * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to |
3823 | * do any widget power switching. | 3897 | * do any widget power switching. |
3824 | */ | 3898 | */ |
3825 | int snd_soc_dapm_disable_pin(struct snd_soc_dapm_context *dapm, | 3899 | int snd_soc_dapm_disable_pin(struct snd_soc_dapm_context *dapm, |
3826 | const char *pin) | 3900 | const char *pin) |
3827 | { | 3901 | { |
3828 | return snd_soc_dapm_set_pin(dapm, pin, 0); | 3902 | int ret; |
3903 | |||
3904 | mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); | ||
3905 | |||
3906 | ret = snd_soc_dapm_set_pin(dapm, pin, 0); | ||
3907 | |||
3908 | mutex_unlock(&dapm->card->dapm_mutex); | ||
3909 | |||
3910 | return ret; | ||
3829 | } | 3911 | } |
3830 | EXPORT_SYMBOL_GPL(snd_soc_dapm_disable_pin); | 3912 | EXPORT_SYMBOL_GPL(snd_soc_dapm_disable_pin); |
3831 | 3913 | ||
3832 | /** | 3914 | /** |
3915 | * snd_soc_dapm_nc_pin_unlocked - permanently disable pin. | ||
3916 | * @dapm: DAPM context | ||
3917 | * @pin: pin name | ||
3918 | * | ||
3919 | * Marks the specified pin as being not connected, disabling it along | ||
3920 | * any parent or child widgets. At present this is identical to | ||
3921 | * snd_soc_dapm_disable_pin() but in future it will be extended to do | ||
3922 | * additional things such as disabling controls which only affect | ||
3923 | * paths through the pin. | ||
3924 | * | ||
3925 | * Requires external locking. | ||
3926 | * | ||
3927 | * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to | ||
3928 | * do any widget power switching. | ||
3929 | */ | ||
3930 | int snd_soc_dapm_nc_pin_unlocked(struct snd_soc_dapm_context *dapm, | ||
3931 | const char *pin) | ||
3932 | { | ||
3933 | return snd_soc_dapm_set_pin(dapm, pin, 0); | ||
3934 | } | ||
3935 | EXPORT_SYMBOL_GPL(snd_soc_dapm_nc_pin_unlocked); | ||
3936 | |||
3937 | /** | ||
3833 | * snd_soc_dapm_nc_pin - permanently disable pin. | 3938 | * snd_soc_dapm_nc_pin - permanently disable pin. |
3834 | * @dapm: DAPM context | 3939 | * @dapm: DAPM context |
3835 | * @pin: pin name | 3940 | * @pin: pin name |
@@ -3845,7 +3950,15 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_disable_pin); | |||
3845 | */ | 3950 | */ |
3846 | int snd_soc_dapm_nc_pin(struct snd_soc_dapm_context *dapm, const char *pin) | 3951 | int snd_soc_dapm_nc_pin(struct snd_soc_dapm_context *dapm, const char *pin) |
3847 | { | 3952 | { |
3848 | return snd_soc_dapm_set_pin(dapm, pin, 0); | 3953 | int ret; |
3954 | |||
3955 | mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); | ||
3956 | |||
3957 | ret = snd_soc_dapm_set_pin(dapm, pin, 0); | ||
3958 | |||
3959 | mutex_unlock(&dapm->card->dapm_mutex); | ||
3960 | |||
3961 | return ret; | ||
3849 | } | 3962 | } |
3850 | EXPORT_SYMBOL_GPL(snd_soc_dapm_nc_pin); | 3963 | EXPORT_SYMBOL_GPL(snd_soc_dapm_nc_pin); |
3851 | 3964 | ||