diff options
author | Liam Girdwood <lg@opensource.wolfsonmicro.com> | 2008-07-07 08:35:17 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2008-07-10 03:32:30 -0400 |
commit | a5302181e5321664047f75715242aac4e0bbd17c (patch) | |
tree | eb5b8a618062099981b65eeaca4cdb9b1fe7c826 | |
parent | be321a890c25272965129ffe4b3b59a519fcf583 (diff) |
ALSA: asoc: core - refactored DAPM pin control API.
Refactored snd_soc_dapm_set_endpoint() to snd_soc_dapm_enable_pin() and
snd_soc_dapm_disable_pin().
Renamed snd_soc_dapm_sync_endpoints() to snd_soc_dapm_sync().
Renamed snd_soc_dapm_get_endpoint_status() to
snd_soc_dapm_get_pin_status().
Signed-off-by: Liam Girdwood <lg@opensource.wolfsonmicro.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
-rw-r--r-- | include/sound/soc-dapm.h | 15 | ||||
-rw-r--r-- | sound/soc/at91/eti_b1_wm8731.c | 10 | ||||
-rw-r--r-- | sound/soc/codecs/tlv320aic3x.c | 4 | ||||
-rw-r--r-- | sound/soc/davinci/davinci-evm.c | 16 | ||||
-rw-r--r-- | sound/soc/omap/n810.c | 27 | ||||
-rw-r--r-- | sound/soc/pxa/corgi.c | 42 | ||||
-rw-r--r-- | sound/soc/pxa/poodle.c | 24 | ||||
-rw-r--r-- | sound/soc/pxa/spitz.c | 62 | ||||
-rw-r--r-- | sound/soc/pxa/tosa.c | 30 | ||||
-rw-r--r-- | sound/soc/s3c24xx/neo1973_wm8753.c | 116 | ||||
-rw-r--r-- | sound/soc/sh/sh7760-ac97.c | 2 | ||||
-rw-r--r-- | sound/soc/soc-dapm.c | 81 |
12 files changed, 230 insertions, 199 deletions
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index b2849538cbfe..3030fdc6981d 100644 --- a/include/sound/soc-dapm.h +++ b/include/sound/soc-dapm.h | |||
@@ -234,16 +234,11 @@ int snd_soc_dapm_set_bias_level(struct snd_soc_device *socdev, | |||
234 | /* dapm sys fs - used by the core */ | 234 | /* dapm sys fs - used by the core */ |
235 | int snd_soc_dapm_sys_add(struct device *dev); | 235 | int snd_soc_dapm_sys_add(struct device *dev); |
236 | 236 | ||
237 | /* event handler for register modifier widget - used by the soc-dapm */ | 237 | /* dapm audio pin control and status */ |
238 | int dapm_reg_event(struct snd_soc_dapm_widget *w, | 238 | int snd_soc_dapm_enable_pin(struct snd_soc_codec *codec, char *pin); |
239 | struct snd_kcontrol *kcontrol, int event); | 239 | int snd_soc_dapm_disable_pin(struct snd_soc_codec *codec, char *pin); |
240 | 240 | int snd_soc_dapm_get_pin_status(struct snd_soc_codec *codec, char *pin); | |
241 | /* dapm audio endpoint control */ | 241 | int snd_soc_dapm_sync(struct snd_soc_codec *codec); |
242 | int snd_soc_dapm_set_endpoint(struct snd_soc_codec *codec, | ||
243 | char *pin, int status); | ||
244 | int snd_soc_dapm_get_endpoint_status(struct snd_soc_codec *codec, | ||
245 | char *pin); | ||
246 | int snd_soc_dapm_sync_endpoints(struct snd_soc_codec *codec); | ||
247 | 242 | ||
248 | /* dapm widget types */ | 243 | /* dapm widget types */ |
249 | enum snd_soc_dapm_type { | 244 | enum snd_soc_dapm_type { |
diff --git a/sound/soc/at91/eti_b1_wm8731.c b/sound/soc/at91/eti_b1_wm8731.c index 4a383a4a0ff1..ad971e7061fe 100644 --- a/sound/soc/at91/eti_b1_wm8731.c +++ b/sound/soc/at91/eti_b1_wm8731.c | |||
@@ -216,14 +216,14 @@ static int eti_b1_wm8731_init(struct snd_soc_codec *codec) | |||
216 | snd_soc_dapm_add_route(codec, intercon, ARRAY_SIZE(intercon)); | 216 | snd_soc_dapm_add_route(codec, intercon, ARRAY_SIZE(intercon)); |
217 | 217 | ||
218 | /* not connected */ | 218 | /* not connected */ |
219 | snd_soc_dapm_set_endpoint(codec, "RLINEIN", 0); | 219 | snd_soc_dapm_disable_pin(codec, "RLINEIN"); |
220 | snd_soc_dapm_set_endpoint(codec, "LLINEIN", 0); | 220 | snd_soc_dapm_disable_pin(codec, "LLINEIN"); |
221 | 221 | ||
222 | /* always connected */ | 222 | /* always connected */ |
223 | snd_soc_dapm_set_endpoint(codec, "Int Mic", 1); | 223 | snd_soc_dapm_enable_pin(codec, "Int Mic"); |
224 | snd_soc_dapm_set_endpoint(codec, "Ext Spk", 1); | 224 | snd_soc_dapm_enable_pin(codec, "Ext Spk"); |
225 | 225 | ||
226 | snd_soc_dapm_sync_endpoints(codec); | 226 | snd_soc_dapm_sync(codec); |
227 | 227 | ||
228 | return 0; | 228 | return 0; |
229 | } | 229 | } |
diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c index d13830623db1..954d39b7c040 100644 --- a/sound/soc/codecs/tlv320aic3x.c +++ b/sound/soc/codecs/tlv320aic3x.c | |||
@@ -29,7 +29,7 @@ | |||
29 | * --------------------------------------- | 29 | * --------------------------------------- |
30 | * | 30 | * |
31 | * Hence the machine layer should disable unsupported inputs/outputs by | 31 | * Hence the machine layer should disable unsupported inputs/outputs by |
32 | * snd_soc_dapm_set_endpoint(codec, "MONO_LOUT", 0), etc. | 32 | * snd_soc_dapm_disable_pin(codec, "MONO_LOUT"), etc. |
33 | */ | 33 | */ |
34 | 34 | ||
35 | #include <linux/module.h> | 35 | #include <linux/module.h> |
@@ -206,7 +206,7 @@ static int snd_soc_dapm_put_volsw_aic3x(struct snd_kcontrol *kcontrol, | |||
206 | } | 206 | } |
207 | 207 | ||
208 | if (found) | 208 | if (found) |
209 | snd_soc_dapm_sync_endpoints(widget->codec); | 209 | snd_soc_dapm_sync(widget->codec); |
210 | } | 210 | } |
211 | 211 | ||
212 | ret = snd_soc_update_bits(widget->codec, reg, val_mask, val); | 212 | ret = snd_soc_update_bits(widget->codec, reg, val_mask, val); |
diff --git a/sound/soc/davinci/davinci-evm.c b/sound/soc/davinci/davinci-evm.c index 4c70a0ed3397..091eae3a9631 100644 --- a/sound/soc/davinci/davinci-evm.c +++ b/sound/soc/davinci/davinci-evm.c | |||
@@ -103,17 +103,17 @@ static int evm_aic3x_init(struct snd_soc_codec *codec) | |||
103 | snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); | 103 | snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); |
104 | 104 | ||
105 | /* not connected */ | 105 | /* not connected */ |
106 | snd_soc_dapm_set_endpoint(codec, "MONO_LOUT", 0); | 106 | snd_soc_dapm_disable_pin(codec, "MONO_LOUT"); |
107 | snd_soc_dapm_set_endpoint(codec, "HPLCOM", 0); | 107 | snd_soc_dapm_disable_pin(codec, "HPLCOM"); |
108 | snd_soc_dapm_set_endpoint(codec, "HPRCOM", 0); | 108 | snd_soc_dapm_disable_pin(codec, "HPRCOM"); |
109 | 109 | ||
110 | /* always connected */ | 110 | /* always connected */ |
111 | snd_soc_dapm_set_endpoint(codec, "Headphone Jack", 1); | 111 | snd_soc_dapm_enable_pin(codec, "Headphone Jack"); |
112 | snd_soc_dapm_set_endpoint(codec, "Line Out", 1); | 112 | snd_soc_dapm_enable_pin(codec, "Line Out"); |
113 | snd_soc_dapm_set_endpoint(codec, "Mic Jack", 1); | 113 | snd_soc_dapm_enable_pin(codec, "Mic Jack"); |
114 | snd_soc_dapm_set_endpoint(codec, "Line In", 1); | 114 | snd_soc_dapm_enable_pin(codec, "Line In"); |
115 | 115 | ||
116 | snd_soc_dapm_sync_endpoints(codec); | 116 | snd_soc_dapm_sync(codec); |
117 | 117 | ||
118 | return 0; | 118 | return 0; |
119 | } | 119 | } |
diff --git a/sound/soc/omap/n810.c b/sound/soc/omap/n810.c index 767b39f339a8..74f4599b4d7e 100644 --- a/sound/soc/omap/n810.c +++ b/sound/soc/omap/n810.c | |||
@@ -50,11 +50,22 @@ static int n810_dmic_func; | |||
50 | 50 | ||
51 | static void n810_ext_control(struct snd_soc_codec *codec) | 51 | static void n810_ext_control(struct snd_soc_codec *codec) |
52 | { | 52 | { |
53 | snd_soc_dapm_set_endpoint(codec, "Ext Spk", n810_spk_func); | 53 | if (n810_spk_func) |
54 | snd_soc_dapm_set_endpoint(codec, "Headphone Jack", n810_jack_func); | 54 | snd_soc_dapm_enable_pin(codec, "Ext Spk"); |
55 | snd_soc_dapm_set_endpoint(codec, "DMic", n810_dmic_func); | 55 | else |
56 | snd_soc_dapm_disable_pin(codec, "Ext Spk"); | ||
57 | |||
58 | if (n810_jack_func) | ||
59 | snd_soc_dapm_enable_pin(codec, "Headphone Jack"); | ||
60 | else | ||
61 | snd_soc_dapm_disable_pin(codec, "Headphone Jack"); | ||
62 | |||
63 | if (n810_dmic_func) | ||
64 | snd_soc_dapm_enable_pin(codec, "DMic"); | ||
65 | else | ||
66 | snd_soc_dapm_disable_pin(codec, "DMic); | ||
56 | 67 | ||
57 | snd_soc_dapm_sync_endpoints(codec); | 68 | snd_soc_dapm_sync(codec); |
58 | } | 69 | } |
59 | 70 | ||
60 | static int n810_startup(struct snd_pcm_substream *substream) | 71 | static int n810_startup(struct snd_pcm_substream *substream) |
@@ -236,9 +247,9 @@ static int n810_aic33_init(struct snd_soc_codec *codec) | |||
236 | int i, err; | 247 | int i, err; |
237 | 248 | ||
238 | /* Not connected */ | 249 | /* Not connected */ |
239 | snd_soc_dapm_set_endpoint(codec, "MONO_LOUT", 0); | 250 | snd_soc_dapm_disable_pin(codec, "MONO_LOUT"); |
240 | snd_soc_dapm_set_endpoint(codec, "HPLCOM", 0); | 251 | snd_soc_dapm_disable_pin(codec, "HPLCOM"); |
241 | snd_soc_dapm_set_endpoint(codec, "HPRCOM", 0); | 252 | snd_soc_dapm_disable_pin(codec, "HPRCOM"); |
242 | 253 | ||
243 | /* Add N810 specific controls */ | 254 | /* Add N810 specific controls */ |
244 | for (i = 0; i < ARRAY_SIZE(aic33_n810_controls); i++) { | 255 | for (i = 0; i < ARRAY_SIZE(aic33_n810_controls); i++) { |
@@ -255,7 +266,7 @@ static int n810_aic33_init(struct snd_soc_codec *codec) | |||
255 | /* Set up N810 specific audio path audio_map */ | 266 | /* Set up N810 specific audio path audio_map */ |
256 | snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); | 267 | snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); |
257 | 268 | ||
258 | snd_soc_dapm_sync_endpoints(codec); | 269 | snd_soc_dapm_sync(codec); |
259 | 270 | ||
260 | return 0; | 271 | return 0; |
261 | } | 272 | } |
diff --git a/sound/soc/pxa/corgi.c b/sound/soc/pxa/corgi.c index edeea63e80e8..db18ef68b691 100644 --- a/sound/soc/pxa/corgi.c +++ b/sound/soc/pxa/corgi.c | |||
@@ -50,47 +50,51 @@ static int corgi_spk_func; | |||
50 | 50 | ||
51 | static void corgi_ext_control(struct snd_soc_codec *codec) | 51 | static void corgi_ext_control(struct snd_soc_codec *codec) |
52 | { | 52 | { |
53 | int spk = 0, mic = 0, line = 0, hp = 0, hs = 0; | ||
54 | |||
55 | /* set up jack connection */ | 53 | /* set up jack connection */ |
56 | switch (corgi_jack_func) { | 54 | switch (corgi_jack_func) { |
57 | case CORGI_HP: | 55 | case CORGI_HP: |
58 | hp = 1; | ||
59 | /* set = unmute headphone */ | 56 | /* set = unmute headphone */ |
60 | set_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_MUTE_L); | 57 | set_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_MUTE_L); |
61 | set_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_MUTE_R); | 58 | set_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_MUTE_R); |
59 | snd_soc_dapm_disable_pin(codec, "Mic Jack"); | ||
60 | snd_soc_dapm_disable_pin(codec, "Line Jack"); | ||
61 | snd_soc_dapm_enable_pin(codec, "Headphone Jack"); | ||
62 | snd_soc_dapm_disable_pin(codec, "Headset Jack"); | ||
62 | break; | 63 | break; |
63 | case CORGI_MIC: | 64 | case CORGI_MIC: |
64 | mic = 1; | ||
65 | /* reset = mute headphone */ | 65 | /* reset = mute headphone */ |
66 | reset_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_MUTE_L); | 66 | reset_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_MUTE_L); |
67 | reset_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_MUTE_R); | 67 | reset_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_MUTE_R); |
68 | snd_soc_dapm_enable_pin(codec, "Mic Jack"); | ||
69 | snd_soc_dapm_disable_pin(codec, "Line Jack"); | ||
70 | snd_soc_dapm_disable_pin(codec, "Headphone Jack"); | ||
71 | snd_soc_dapm_disable_pin(codec, "Headset Jack"); | ||
68 | break; | 72 | break; |
69 | case CORGI_LINE: | 73 | case CORGI_LINE: |
70 | line = 1; | ||
71 | reset_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_MUTE_L); | 74 | reset_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_MUTE_L); |
72 | reset_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_MUTE_R); | 75 | reset_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_MUTE_R); |
76 | snd_soc_dapm_disable_pin(codec, "Mic Jack"); | ||
77 | snd_soc_dapm_enable_pin(codec, "Line Jack"); | ||
78 | snd_soc_dapm_disable_pin(codec, "Headphone Jack"); | ||
79 | snd_soc_dapm_disable_pin(codec, "Headset Jack"); | ||
73 | break; | 80 | break; |
74 | case CORGI_HEADSET: | 81 | case CORGI_HEADSET: |
75 | hs = 1; | ||
76 | mic = 1; | ||
77 | reset_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_MUTE_L); | 82 | reset_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_MUTE_L); |
78 | set_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_MUTE_R); | 83 | set_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_MUTE_R); |
84 | snd_soc_dapm_enable_pin(codec, "Mic Jack"); | ||
85 | snd_soc_dapm_disable_pin(codec, "Line Jack"); | ||
86 | snd_soc_dapm_disable_pin(codec, "Headphone Jack"); | ||
87 | snd_soc_dapm_enable_pin(codec, "Headset Jack"); | ||
79 | break; | 88 | break; |
80 | } | 89 | } |
81 | 90 | ||
82 | if (corgi_spk_func == CORGI_SPK_ON) | 91 | if (corgi_spk_func == CORGI_SPK_ON) |
83 | spk = 1; | 92 | snd_soc_dapm_enable_pin(codec, "Ext Spk"); |
84 | 93 | else | |
85 | /* set the enpoints to their new connetion states */ | 94 | snd_soc_dapm_disable_pin(codec, "Ext Spk"); |
86 | snd_soc_dapm_set_endpoint(codec, "Ext Spk", spk); | ||
87 | snd_soc_dapm_set_endpoint(codec, "Mic Jack", mic); | ||
88 | snd_soc_dapm_set_endpoint(codec, "Line Jack", line); | ||
89 | snd_soc_dapm_set_endpoint(codec, "Headphone Jack", hp); | ||
90 | snd_soc_dapm_set_endpoint(codec, "Headset Jack", hs); | ||
91 | 95 | ||
92 | /* signal a DAPM event */ | 96 | /* signal a DAPM event */ |
93 | snd_soc_dapm_sync_endpoints(codec); | 97 | snd_soc_dapm_sync(codec); |
94 | } | 98 | } |
95 | 99 | ||
96 | static int corgi_startup(struct snd_pcm_substream *substream) | 100 | static int corgi_startup(struct snd_pcm_substream *substream) |
@@ -285,8 +289,8 @@ static int corgi_wm8731_init(struct snd_soc_codec *codec) | |||
285 | { | 289 | { |
286 | int i, err; | 290 | int i, err; |
287 | 291 | ||
288 | snd_soc_dapm_set_endpoint(codec, "LLINEIN", 0); | 292 | snd_soc_dapm_disable_pin(codec, "LLINEIN"); |
289 | snd_soc_dapm_set_endpoint(codec, "RLINEIN", 0); | 293 | snd_soc_dapm_disable_pin(codec, "RLINEIN"); |
290 | 294 | ||
291 | /* Add corgi specific controls */ | 295 | /* Add corgi specific controls */ |
292 | for (i = 0; i < ARRAY_SIZE(wm8731_corgi_controls); i++) { | 296 | for (i = 0; i < ARRAY_SIZE(wm8731_corgi_controls); i++) { |
@@ -303,7 +307,7 @@ static int corgi_wm8731_init(struct snd_soc_codec *codec) | |||
303 | /* Set up corgi specific audio path audio_map */ | 307 | /* Set up corgi specific audio path audio_map */ |
304 | snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); | 308 | snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); |
305 | 309 | ||
306 | snd_soc_dapm_sync_endpoints(codec); | 310 | snd_soc_dapm_sync(codec); |
307 | return 0; | 311 | return 0; |
308 | } | 312 | } |
309 | 313 | ||
diff --git a/sound/soc/pxa/poodle.c b/sound/soc/pxa/poodle.c index 810f1fe158ab..36cbf69f5f82 100644 --- a/sound/soc/pxa/poodle.c +++ b/sound/soc/pxa/poodle.c | |||
@@ -48,8 +48,6 @@ static int poodle_spk_func; | |||
48 | 48 | ||
49 | static void poodle_ext_control(struct snd_soc_codec *codec) | 49 | static void poodle_ext_control(struct snd_soc_codec *codec) |
50 | { | 50 | { |
51 | int spk = 0; | ||
52 | |||
53 | /* set up jack connection */ | 51 | /* set up jack connection */ |
54 | if (poodle_jack_func == POODLE_HP) { | 52 | if (poodle_jack_func == POODLE_HP) { |
55 | /* set = unmute headphone */ | 53 | /* set = unmute headphone */ |
@@ -57,23 +55,23 @@ static void poodle_ext_control(struct snd_soc_codec *codec) | |||
57 | POODLE_LOCOMO_GPIO_MUTE_L, 1); | 55 | POODLE_LOCOMO_GPIO_MUTE_L, 1); |
58 | locomo_gpio_write(&poodle_locomo_device.dev, | 56 | locomo_gpio_write(&poodle_locomo_device.dev, |
59 | POODLE_LOCOMO_GPIO_MUTE_R, 1); | 57 | POODLE_LOCOMO_GPIO_MUTE_R, 1); |
60 | snd_soc_dapm_set_endpoint(codec, "Headphone Jack", 1); | 58 | snd_soc_dapm_enable_pin(codec, "Headphone Jack"); |
61 | } else { | 59 | } else { |
62 | locomo_gpio_write(&poodle_locomo_device.dev, | 60 | locomo_gpio_write(&poodle_locomo_device.dev, |
63 | POODLE_LOCOMO_GPIO_MUTE_L, 0); | 61 | POODLE_LOCOMO_GPIO_MUTE_L, 0); |
64 | locomo_gpio_write(&poodle_locomo_device.dev, | 62 | locomo_gpio_write(&poodle_locomo_device.dev, |
65 | POODLE_LOCOMO_GPIO_MUTE_R, 0); | 63 | POODLE_LOCOMO_GPIO_MUTE_R, 0); |
66 | snd_soc_dapm_set_endpoint(codec, "Headphone Jack", 0); | 64 | snd_soc_dapm_disable_pin(codec, "Headphone Jack"); |
67 | } | 65 | } |
68 | 66 | ||
69 | if (poodle_spk_func == POODLE_SPK_ON) | ||
70 | spk = 1; | ||
71 | |||
72 | /* set the enpoints to their new connetion states */ | 67 | /* set the enpoints to their new connetion states */ |
73 | snd_soc_dapm_set_endpoint(codec, "Ext Spk", spk); | 68 | if (poodle_spk_func == POODLE_SPK_ON) |
69 | snd_soc_dapm_enable_pin(codec, "Ext Spk"); | ||
70 | else | ||
71 | snd_soc_dapm_disable_pin(codec, "Ext Spk"); | ||
74 | 72 | ||
75 | /* signal a DAPM event */ | 73 | /* signal a DAPM event */ |
76 | snd_soc_dapm_sync_endpoints(codec); | 74 | snd_soc_dapm_sync(codec); |
77 | } | 75 | } |
78 | 76 | ||
79 | static int poodle_startup(struct snd_pcm_substream *substream) | 77 | static int poodle_startup(struct snd_pcm_substream *substream) |
@@ -248,9 +246,9 @@ static int poodle_wm8731_init(struct snd_soc_codec *codec) | |||
248 | { | 246 | { |
249 | int i, err; | 247 | int i, err; |
250 | 248 | ||
251 | snd_soc_dapm_set_endpoint(codec, "LLINEIN", 0); | 249 | snd_soc_dapm_disable_pin(codec, "LLINEIN"); |
252 | snd_soc_dapm_set_endpoint(codec, "RLINEIN", 0); | 250 | snd_soc_dapm_disable_pin(codec, "RLINEIN"); |
253 | snd_soc_dapm_set_endpoint(codec, "MICIN", 1); | 251 | snd_soc_dapm_enable_pin(codec, "MICIN"); |
254 | 252 | ||
255 | /* Add poodle specific controls */ | 253 | /* Add poodle specific controls */ |
256 | for (i = 0; i < ARRAY_SIZE(wm8731_poodle_controls); i++) { | 254 | for (i = 0; i < ARRAY_SIZE(wm8731_poodle_controls); i++) { |
@@ -267,7 +265,7 @@ static int poodle_wm8731_init(struct snd_soc_codec *codec) | |||
267 | /* Set up poodle specific audio path audio_map */ | 265 | /* Set up poodle specific audio path audio_map */ |
268 | snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); | 266 | snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); |
269 | 267 | ||
270 | snd_soc_dapm_sync_endpoints(codec); | 268 | snd_soc_dapm_sync(codec); |
271 | return 0; | 269 | return 0; |
272 | } | 270 | } |
273 | 271 | ||
diff --git a/sound/soc/pxa/spitz.c b/sound/soc/pxa/spitz.c index 092b5c776b40..ec18163fdddd 100644 --- a/sound/soc/pxa/spitz.c +++ b/sound/soc/pxa/spitz.c | |||
@@ -51,60 +51,60 @@ static int spitz_spk_func; | |||
51 | static void spitz_ext_control(struct snd_soc_codec *codec) | 51 | static void spitz_ext_control(struct snd_soc_codec *codec) |
52 | { | 52 | { |
53 | if (spitz_spk_func == SPITZ_SPK_ON) | 53 | if (spitz_spk_func == SPITZ_SPK_ON) |
54 | snd_soc_dapm_set_endpoint(codec, "Ext Spk", 1); | 54 | snd_soc_dapm_enable_pin(codec, "Ext Spk"); |
55 | else | 55 | else |
56 | snd_soc_dapm_set_endpoint(codec, "Ext Spk", 0); | 56 | snd_soc_dapm_disable_pin(codec, "Ext Spk"); |
57 | 57 | ||
58 | /* set up jack connection */ | 58 | /* set up jack connection */ |
59 | switch (spitz_jack_func) { | 59 | switch (spitz_jack_func) { |
60 | case SPITZ_HP: | 60 | case SPITZ_HP: |
61 | /* enable and unmute hp jack, disable mic bias */ | 61 | /* enable and unmute hp jack, disable mic bias */ |
62 | snd_soc_dapm_set_endpoint(codec, "Headset Jack", 0); | 62 | snd_soc_dapm_disable_pin(codec, "Headset Jack"); |
63 | snd_soc_dapm_set_endpoint(codec, "Mic Jack", 0); | 63 | snd_soc_dapm_disable_pin(codec, "Mic Jack"); |
64 | snd_soc_dapm_set_endpoint(codec, "Line Jack", 0); | 64 | snd_soc_dapm_disable_pin(codec, "Line Jack"); |
65 | snd_soc_dapm_set_endpoint(codec, "Headphone Jack", 1); | 65 | snd_soc_dapm_enable_pin(codec, "Headphone Jack"); |
66 | set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_L); | 66 | set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_L); |
67 | set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_R); | 67 | set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_R); |
68 | break; | 68 | break; |
69 | case SPITZ_MIC: | 69 | case SPITZ_MIC: |
70 | /* enable mic jack and bias, mute hp */ | 70 | /* enable mic jack and bias, mute hp */ |
71 | snd_soc_dapm_set_endpoint(codec, "Headphone Jack", 0); | 71 | snd_soc_dapm_disable_pin(codec, "Headphone Jack"); |
72 | snd_soc_dapm_set_endpoint(codec, "Headset Jack", 0); | 72 | snd_soc_dapm_disable_pin(codec, "Headset Jack"); |
73 | snd_soc_dapm_set_endpoint(codec, "Line Jack", 0); | 73 | snd_soc_dapm_disable_pin(codec, "Line Jack"); |
74 | snd_soc_dapm_set_endpoint(codec, "Mic Jack", 1); | 74 | snd_soc_dapm_enable_pin(codec, "Mic Jack"); |
75 | reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_L); | 75 | reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_L); |
76 | reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_R); | 76 | reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_R); |
77 | break; | 77 | break; |
78 | case SPITZ_LINE: | 78 | case SPITZ_LINE: |
79 | /* enable line jack, disable mic bias and mute hp */ | 79 | /* enable line jack, disable mic bias and mute hp */ |
80 | snd_soc_dapm_set_endpoint(codec, "Headphone Jack", 0); | 80 | snd_soc_dapm_disable_pin(codec, "Headphone Jack"); |
81 | snd_soc_dapm_set_endpoint(codec, "Headset Jack", 0); | 81 | snd_soc_dapm_disable_pin(codec, "Headset Jack"); |
82 | snd_soc_dapm_set_endpoint(codec, "Mic Jack", 0); | 82 | snd_soc_dapm_disable_pin(codec, "Mic Jack"); |
83 | snd_soc_dapm_set_endpoint(codec, "Line Jack", 1); | 83 | snd_soc_dapm_enable_pin(codec, "Line Jack"); |
84 | reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_L); | 84 | reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_L); |
85 | reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_R); | 85 | reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_R); |
86 | break; | 86 | break; |
87 | case SPITZ_HEADSET: | 87 | case SPITZ_HEADSET: |
88 | /* enable and unmute headset jack enable mic bias, mute L hp */ | 88 | /* enable and unmute headset jack enable mic bias, mute L hp */ |
89 | snd_soc_dapm_set_endpoint(codec, "Headphone Jack", 0); | 89 | snd_soc_dapm_disable_pin(codec, "Headphone Jack"); |
90 | snd_soc_dapm_set_endpoint(codec, "Mic Jack", 1); | 90 | snd_soc_dapm_enable_pin(codec, "Mic Jack"); |
91 | snd_soc_dapm_set_endpoint(codec, "Line Jack", 0); | 91 | snd_soc_dapm_disable_pin(codec, "Line Jack"); |
92 | snd_soc_dapm_set_endpoint(codec, "Headset Jack", 1); | 92 | snd_soc_dapm_enable_pin(codec, "Headset Jack"); |
93 | reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_L); | 93 | reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_L); |
94 | set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_R); | 94 | set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_R); |
95 | break; | 95 | break; |
96 | case SPITZ_HP_OFF: | 96 | case SPITZ_HP_OFF: |
97 | 97 | ||
98 | /* jack removed, everything off */ | 98 | /* jack removed, everything off */ |
99 | snd_soc_dapm_set_endpoint(codec, "Headphone Jack", 0); | 99 | snd_soc_dapm_disable_pin(codec, "Headphone Jack"); |
100 | snd_soc_dapm_set_endpoint(codec, "Headset Jack", 0); | 100 | snd_soc_dapm_disable_pin(codec, "Headset Jack"); |
101 | snd_soc_dapm_set_endpoint(codec, "Mic Jack", 0); | 101 | snd_soc_dapm_disable_pin(codec, "Mic Jack"); |
102 | snd_soc_dapm_set_endpoint(codec, "Line Jack", 0); | 102 | snd_soc_dapm_disable_pin(codec, "Line Jack"); |
103 | reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_L); | 103 | reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_L); |
104 | reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_R); | 104 | reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_R); |
105 | break; | 105 | break; |
106 | } | 106 | } |
107 | snd_soc_dapm_sync_endpoints(codec); | 107 | snd_soc_dapm_sync(codec); |
108 | } | 108 | } |
109 | 109 | ||
110 | static int spitz_startup(struct snd_pcm_substream *substream) | 110 | static int spitz_startup(struct snd_pcm_substream *substream) |
@@ -291,13 +291,13 @@ static int spitz_wm8750_init(struct snd_soc_codec *codec) | |||
291 | int i, err; | 291 | int i, err; |
292 | 292 | ||
293 | /* NC codec pins */ | 293 | /* NC codec pins */ |
294 | snd_soc_dapm_set_endpoint(codec, "RINPUT1", 0); | 294 | snd_soc_dapm_disable_pin(codec, "RINPUT1"); |
295 | snd_soc_dapm_set_endpoint(codec, "LINPUT2", 0); | 295 | snd_soc_dapm_disable_pin(codec, "LINPUT2"); |
296 | snd_soc_dapm_set_endpoint(codec, "RINPUT2", 0); | 296 | snd_soc_dapm_disable_pin(codec, "RINPUT2"); |
297 | snd_soc_dapm_set_endpoint(codec, "LINPUT3", 0); | 297 | snd_soc_dapm_disable_pin(codec, "LINPUT3"); |
298 | snd_soc_dapm_set_endpoint(codec, "RINPUT3", 0); | 298 | snd_soc_dapm_disable_pin(codec, "RINPUT3"); |
299 | snd_soc_dapm_set_endpoint(codec, "OUT3", 0); | 299 | snd_soc_dapm_disable_pin(codec, "OUT3"); |
300 | snd_soc_dapm_set_endpoint(codec, "MONO", 0); | 300 | snd_soc_dapm_disable_pin(codec, "MONO"); |
301 | 301 | ||
302 | /* Add spitz specific controls */ | 302 | /* Add spitz specific controls */ |
303 | for (i = 0; i < ARRAY_SIZE(wm8750_spitz_controls); i++) { | 303 | for (i = 0; i < ARRAY_SIZE(wm8750_spitz_controls); i++) { |
@@ -314,7 +314,7 @@ static int spitz_wm8750_init(struct snd_soc_codec *codec) | |||
314 | /* Set up spitz specific audio paths */ | 314 | /* Set up spitz specific audio paths */ |
315 | snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); | 315 | snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); |
316 | 316 | ||
317 | snd_soc_dapm_sync_endpoints(codec); | 317 | snd_soc_dapm_sync(codec); |
318 | return 0; | 318 | return 0; |
319 | } | 319 | } |
320 | 320 | ||
diff --git a/sound/soc/pxa/tosa.c b/sound/soc/pxa/tosa.c index 465ff0f458ef..dba7689c5080 100644 --- a/sound/soc/pxa/tosa.c +++ b/sound/soc/pxa/tosa.c | |||
@@ -52,29 +52,31 @@ static int tosa_spk_func; | |||
52 | 52 | ||
53 | static void tosa_ext_control(struct snd_soc_codec *codec) | 53 | static void tosa_ext_control(struct snd_soc_codec *codec) |
54 | { | 54 | { |
55 | int spk = 0, mic_int = 0, hp = 0, hs = 0; | ||
56 | |||
57 | /* set up jack connection */ | 55 | /* set up jack connection */ |
58 | switch (tosa_jack_func) { | 56 | switch (tosa_jack_func) { |
59 | case TOSA_HP: | 57 | case TOSA_HP: |
60 | hp = 1; | 58 | snd_soc_dapm_disable_pin(codec, "Mic (Internal)"); |
59 | snd_soc_dapm_enable_pin(codec, "Headphone Jack"); | ||
60 | snd_soc_dapm_disable_pin(codec, "Headset Jack"); | ||
61 | break; | 61 | break; |
62 | case TOSA_MIC_INT: | 62 | case TOSA_MIC_INT: |
63 | mic_int = 1; | 63 | snd_soc_dapm_enable_pin(codec, "Mic (Internal)"); |
64 | snd_soc_dapm_disable_pin(codec, "Headphone Jack"); | ||
65 | snd_soc_dapm_disable_pin(codec, "Headset Jack"); | ||
64 | break; | 66 | break; |
65 | case TOSA_HEADSET: | 67 | case TOSA_HEADSET: |
66 | hs = 1; | 68 | snd_soc_dapm_disable_pin(codec, "Mic (Internal)"); |
69 | snd_soc_dapm_disable_pin(codec, "Headphone Jack"); | ||
70 | snd_soc_dapm_enable_pin(codec, "Headset Jack"); | ||
67 | break; | 71 | break; |
68 | } | 72 | } |
69 | 73 | ||
70 | if (tosa_spk_func == TOSA_SPK_ON) | 74 | if (tosa_spk_func == TOSA_SPK_ON) |
71 | spk = 1; | 75 | snd_soc_dapm_enable_pin(codec, "Speaker"); |
76 | else | ||
77 | snd_soc_dapm_disable_pin(codec, "Speaker"); | ||
72 | 78 | ||
73 | snd_soc_dapm_set_endpoint(codec, "Speaker", spk); | 79 | snd_soc_dapm_sync(codec); |
74 | snd_soc_dapm_set_endpoint(codec, "Mic (Internal)", mic_int); | ||
75 | snd_soc_dapm_set_endpoint(codec, "Headphone Jack", hp); | ||
76 | snd_soc_dapm_set_endpoint(codec, "Headset Jack", hs); | ||
77 | snd_soc_dapm_sync_endpoints(codec); | ||
78 | } | 80 | } |
79 | 81 | ||
80 | static int tosa_startup(struct snd_pcm_substream *substream) | 82 | static int tosa_startup(struct snd_pcm_substream *substream) |
@@ -191,8 +193,8 @@ static int tosa_ac97_init(struct snd_soc_codec *codec) | |||
191 | { | 193 | { |
192 | int i, err; | 194 | int i, err; |
193 | 195 | ||
194 | snd_soc_dapm_set_endpoint(codec, "OUT3", 0); | 196 | snd_soc_dapm_disable_pin(codec, "OUT3"); |
195 | snd_soc_dapm_set_endpoint(codec, "MONOOUT", 0); | 197 | snd_soc_dapm_disable_pin(codec, "MONOOUT"); |
196 | 198 | ||
197 | /* add tosa specific controls */ | 199 | /* add tosa specific controls */ |
198 | for (i = 0; i < ARRAY_SIZE(tosa_controls); i++) { | 200 | for (i = 0; i < ARRAY_SIZE(tosa_controls); i++) { |
@@ -209,7 +211,7 @@ static int tosa_ac97_init(struct snd_soc_codec *codec) | |||
209 | /* set up tosa specific audio path audio_map */ | 211 | /* set up tosa specific audio path audio_map */ |
210 | snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); | 212 | snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); |
211 | 213 | ||
212 | snd_soc_dapm_sync_endpoints(codec); | 214 | snd_soc_dapm_sync(codec); |
213 | return 0; | 215 | return 0; |
214 | } | 216 | } |
215 | 217 | ||
diff --git a/sound/soc/s3c24xx/neo1973_wm8753.c b/sound/soc/s3c24xx/neo1973_wm8753.c index 34851238dea0..f053e85ff608 100644 --- a/sound/soc/s3c24xx/neo1973_wm8753.c +++ b/sound/soc/s3c24xx/neo1973_wm8753.c | |||
@@ -250,77 +250,77 @@ static int set_scenario_endpoints(struct snd_soc_codec *codec, int scenario) | |||
250 | 250 | ||
251 | switch (neo1973_scenario) { | 251 | switch (neo1973_scenario) { |
252 | case NEO_AUDIO_OFF: | 252 | case NEO_AUDIO_OFF: |
253 | snd_soc_dapm_set_endpoint(codec, "Audio Out", 0); | 253 | snd_soc_dapm_disable_pin(codec, "Audio Out"); |
254 | snd_soc_dapm_set_endpoint(codec, "GSM Line Out", 0); | 254 | snd_soc_dapm_disable_pin(codec, "GSM Line Out"); |
255 | snd_soc_dapm_set_endpoint(codec, "GSM Line In", 0); | 255 | snd_soc_dapm_disable_pin(codec, "GSM Line In"); |
256 | snd_soc_dapm_set_endpoint(codec, "Headset Mic", 0); | 256 | snd_soc_dapm_disable_pin(codec, "Headset Mic"); |
257 | snd_soc_dapm_set_endpoint(codec, "Call Mic", 0); | 257 | snd_soc_dapm_disable_pin(codec, "Call Mic"); |
258 | break; | 258 | break; |
259 | case NEO_GSM_CALL_AUDIO_HANDSET: | 259 | case NEO_GSM_CALL_AUDIO_HANDSET: |
260 | snd_soc_dapm_set_endpoint(codec, "Audio Out", 1); | 260 | snd_soc_dapm_enable_pin(codec, "Audio Out"); |
261 | snd_soc_dapm_set_endpoint(codec, "GSM Line Out", 1); | 261 | snd_soc_dapm_enable_pin(codec, "GSM Line Out"); |
262 | snd_soc_dapm_set_endpoint(codec, "GSM Line In", 1); | 262 | snd_soc_dapm_enable_pin(codec, "GSM Line In"); |
263 | snd_soc_dapm_set_endpoint(codec, "Headset Mic", 0); | 263 | snd_soc_dapm_disable_pin(codec, "Headset Mic"); |
264 | snd_soc_dapm_set_endpoint(codec, "Call Mic", 1); | 264 | snd_soc_dapm_enable_pin(codec, "Call Mic"); |
265 | break; | 265 | break; |
266 | case NEO_GSM_CALL_AUDIO_HEADSET: | 266 | case NEO_GSM_CALL_AUDIO_HEADSET: |
267 | snd_soc_dapm_set_endpoint(codec, "Audio Out", 1); | 267 | snd_soc_dapm_enable_pin(codec, "Audio Out"); |
268 | snd_soc_dapm_set_endpoint(codec, "GSM Line Out", 1); | 268 | snd_soc_dapm_enable_pin(codec, "GSM Line Out"); |
269 | snd_soc_dapm_set_endpoint(codec, "GSM Line In", 1); | 269 | snd_soc_dapm_enable_pin(codec, "GSM Line In"); |
270 | snd_soc_dapm_set_endpoint(codec, "Headset Mic", 1); | 270 | snd_soc_dapm_enable_pin(codec, "Headset Mic"); |
271 | snd_soc_dapm_set_endpoint(codec, "Call Mic", 0); | 271 | snd_soc_dapm_disable_pin(codec, "Call Mic"); |
272 | break; | 272 | break; |
273 | case NEO_GSM_CALL_AUDIO_BLUETOOTH: | 273 | case NEO_GSM_CALL_AUDIO_BLUETOOTH: |
274 | snd_soc_dapm_set_endpoint(codec, "Audio Out", 0); | 274 | snd_soc_dapm_disable_pin(codec, "Audio Out"); |
275 | snd_soc_dapm_set_endpoint(codec, "GSM Line Out", 1); | 275 | snd_soc_dapm_enable_pin(codec, "GSM Line Out"); |
276 | snd_soc_dapm_set_endpoint(codec, "GSM Line In", 1); | 276 | snd_soc_dapm_enable_pin(codec, "GSM Line In"); |
277 | snd_soc_dapm_set_endpoint(codec, "Headset Mic", 0); | 277 | snd_soc_dapm_disable_pin(codec, "Headset Mic"); |
278 | snd_soc_dapm_set_endpoint(codec, "Call Mic", 0); | 278 | snd_soc_dapm_disable_pin(codec, "Call Mic"); |
279 | break; | 279 | break; |
280 | case NEO_STEREO_TO_SPEAKERS: | 280 | case NEO_STEREO_TO_SPEAKERS: |
281 | snd_soc_dapm_set_endpoint(codec, "Audio Out", 1); | 281 | snd_soc_dapm_enable_pin(codec, "Audio Out"); |
282 | snd_soc_dapm_set_endpoint(codec, "GSM Line Out", 0); | 282 | snd_soc_dapm_disable_pin(codec, "GSM Line Out"); |
283 | snd_soc_dapm_set_endpoint(codec, "GSM Line In", 0); | 283 | snd_soc_dapm_disable_pin(codec, "GSM Line In"); |
284 | snd_soc_dapm_set_endpoint(codec, "Headset Mic", 0); | 284 | snd_soc_dapm_disable_pin(codec, "Headset Mic"); |
285 | snd_soc_dapm_set_endpoint(codec, "Call Mic", 0); | 285 | snd_soc_dapm_disable_pin(codec, "Call Mic"); |
286 | break; | 286 | break; |
287 | case NEO_STEREO_TO_HEADPHONES: | 287 | case NEO_STEREO_TO_HEADPHONES: |
288 | snd_soc_dapm_set_endpoint(codec, "Audio Out", 1); | 288 | snd_soc_dapm_enable_pin(codec, "Audio Out"); |
289 | snd_soc_dapm_set_endpoint(codec, "GSM Line Out", 0); | 289 | snd_soc_dapm_disable_pin(codec, "GSM Line Out"); |
290 | snd_soc_dapm_set_endpoint(codec, "GSM Line In", 0); | 290 | snd_soc_dapm_disable_pin(codec, "GSM Line In"); |
291 | snd_soc_dapm_set_endpoint(codec, "Headset Mic", 0); | 291 | snd_soc_dapm_disable_pin(codec, "Headset Mic"); |
292 | snd_soc_dapm_set_endpoint(codec, "Call Mic", 0); | 292 | snd_soc_dapm_disable_pin(codec, "Call Mic"); |
293 | break; | 293 | break; |
294 | case NEO_CAPTURE_HANDSET: | 294 | case NEO_CAPTURE_HANDSET: |
295 | snd_soc_dapm_set_endpoint(codec, "Audio Out", 0); | 295 | snd_soc_dapm_disable_pin(codec, "Audio Out"); |
296 | snd_soc_dapm_set_endpoint(codec, "GSM Line Out", 0); | 296 | snd_soc_dapm_disable_pin(codec, "GSM Line Out"); |
297 | snd_soc_dapm_set_endpoint(codec, "GSM Line In", 0); | 297 | snd_soc_dapm_disable_pin(codec, "GSM Line In"); |
298 | snd_soc_dapm_set_endpoint(codec, "Headset Mic", 0); | 298 | snd_soc_dapm_disable_pin(codec, "Headset Mic"); |
299 | snd_soc_dapm_set_endpoint(codec, "Call Mic", 1); | 299 | snd_soc_dapm_enable_pin(codec, "Call Mic"); |
300 | break; | 300 | break; |
301 | case NEO_CAPTURE_HEADSET: | 301 | case NEO_CAPTURE_HEADSET: |
302 | snd_soc_dapm_set_endpoint(codec, "Audio Out", 0); | 302 | snd_soc_dapm_disable_pin(codec, "Audio Out"); |
303 | snd_soc_dapm_set_endpoint(codec, "GSM Line Out", 0); | 303 | snd_soc_dapm_disable_pin(codec, "GSM Line Out"); |
304 | snd_soc_dapm_set_endpoint(codec, "GSM Line In", 0); | 304 | snd_soc_dapm_disable_pin(codec, "GSM Line In"); |
305 | snd_soc_dapm_set_endpoint(codec, "Headset Mic", 1); | 305 | snd_soc_dapm_enable_pin(codec, "Headset Mic"); |
306 | snd_soc_dapm_set_endpoint(codec, "Call Mic", 0); | 306 | snd_soc_dapm_disable_pin(codec, "Call Mic"); |
307 | break; | 307 | break; |
308 | case NEO_CAPTURE_BLUETOOTH: | 308 | case NEO_CAPTURE_BLUETOOTH: |
309 | snd_soc_dapm_set_endpoint(codec, "Audio Out", 0); | 309 | snd_soc_dapm_disable_pin(codec, "Audio Out"); |
310 | snd_soc_dapm_set_endpoint(codec, "GSM Line Out", 0); | 310 | snd_soc_dapm_disable_pin(codec, "GSM Line Out"); |
311 | snd_soc_dapm_set_endpoint(codec, "GSM Line In", 0); | 311 | snd_soc_dapm_disable_pin(codec, "GSM Line In"); |
312 | snd_soc_dapm_set_endpoint(codec, "Headset Mic", 0); | 312 | snd_soc_dapm_disable_pin(codec, "Headset Mic"); |
313 | snd_soc_dapm_set_endpoint(codec, "Call Mic", 0); | 313 | snd_soc_dapm_disable_pin(codec, "Call Mic"); |
314 | break; | 314 | break; |
315 | default: | 315 | default: |
316 | snd_soc_dapm_set_endpoint(codec, "Audio Out", 0); | 316 | snd_soc_dapm_disable_pin(codec, "Audio Out"); |
317 | snd_soc_dapm_set_endpoint(codec, "GSM Line Out", 0); | 317 | snd_soc_dapm_disable_pin(codec, "GSM Line Out"); |
318 | snd_soc_dapm_set_endpoint(codec, "GSM Line In", 0); | 318 | snd_soc_dapm_disable_pin(codec, "GSM Line In"); |
319 | snd_soc_dapm_set_endpoint(codec, "Headset Mic", 0); | 319 | snd_soc_dapm_disable_pin(codec, "Headset Mic"); |
320 | snd_soc_dapm_set_endpoint(codec, "Call Mic", 0); | 320 | snd_soc_dapm_disable_pin(codec, "Call Mic"); |
321 | } | 321 | } |
322 | 322 | ||
323 | snd_soc_dapm_sync_endpoints(codec); | 323 | snd_soc_dapm_sync(codec); |
324 | 324 | ||
325 | return 0; | 325 | return 0; |
326 | } | 326 | } |
@@ -511,12 +511,12 @@ static int neo1973_wm8753_init(struct snd_soc_codec *codec) | |||
511 | DBG("Entered %s\n", __func__); | 511 | DBG("Entered %s\n", __func__); |
512 | 512 | ||
513 | /* set up NC codec pins */ | 513 | /* set up NC codec pins */ |
514 | snd_soc_dapm_set_endpoint(codec, "LOUT2", 0); | 514 | snd_soc_dapm_disable_pin(codec, "LOUT2"); |
515 | snd_soc_dapm_set_endpoint(codec, "ROUT2", 0); | 515 | snd_soc_dapm_disable_pin(codec, "ROUT2"); |
516 | snd_soc_dapm_set_endpoint(codec, "OUT3", 0); | 516 | snd_soc_dapm_disable_pin(codec, "OUT3"); |
517 | snd_soc_dapm_set_endpoint(codec, "OUT4", 0); | 517 | snd_soc_dapm_disable_pin(codec, "OUT4"); |
518 | snd_soc_dapm_set_endpoint(codec, "LINE1", 0); | 518 | snd_soc_dapm_disable_pin(codec, "LINE1"); |
519 | snd_soc_dapm_set_endpoint(codec, "LINE2", 0); | 519 | snd_soc_dapm_disable_pin(codec, "LINE2"); |
520 | 520 | ||
521 | 521 | ||
522 | /* set endpoints to default mode */ | 522 | /* set endpoints to default mode */ |
@@ -539,7 +539,7 @@ static int neo1973_wm8753_init(struct snd_soc_codec *codec) | |||
539 | err = snd_soc_dapm_add_routes(codec, dapm_routes, | 539 | err = snd_soc_dapm_add_routes(codec, dapm_routes, |
540 | ARRAY_SIZE(dapm_routes)); | 540 | ARRAY_SIZE(dapm_routes)); |
541 | 541 | ||
542 | snd_soc_dapm_sync_endpoints(codec); | 542 | snd_soc_dapm_sync(codec); |
543 | return 0; | 543 | return 0; |
544 | } | 544 | } |
545 | 545 | ||
diff --git a/sound/soc/sh/sh7760-ac97.c b/sound/soc/sh/sh7760-ac97.c index 2f91de84c5c7..846d1b3a6305 100644 --- a/sound/soc/sh/sh7760-ac97.c +++ b/sound/soc/sh/sh7760-ac97.c | |||
@@ -25,7 +25,7 @@ extern struct snd_soc_platform sh7760_soc_platform; | |||
25 | 25 | ||
26 | static int machine_init(struct snd_soc_codec *codec) | 26 | static int machine_init(struct snd_soc_codec *codec) |
27 | { | 27 | { |
28 | snd_soc_dapm_sync_endpoints(codec); | 28 | snd_soc_dapm_sync(codec); |
29 | return 0; | 29 | return 0; |
30 | } | 30 | } |
31 | 31 | ||
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 91cbbefefb0a..94296b5dc58f 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -880,8 +880,25 @@ static void dapm_free_widgets(struct snd_soc_codec *codec) | |||
880 | } | 880 | } |
881 | } | 881 | } |
882 | 882 | ||
883 | static int snd_soc_dapm_set_pin(struct snd_soc_codec *codec, | ||
884 | char *pin, int status) | ||
885 | { | ||
886 | struct snd_soc_dapm_widget *w; | ||
887 | |||
888 | list_for_each_entry(w, &codec->dapm_widgets, list) { | ||
889 | if (!strcmp(w->name, pin)) { | ||
890 | dbg("dapm: %s: pin %s\n", codec->name, pin); | ||
891 | w->connected = status; | ||
892 | return 0; | ||
893 | } | ||
894 | } | ||
895 | |||
896 | dbg("dapm: %s: configuring unknown pin %s\n", codec->name, pin); | ||
897 | return -EINVAL; | ||
898 | } | ||
899 | |||
883 | /** | 900 | /** |
884 | * snd_soc_dapm_sync_endpoints - scan and power dapm paths | 901 | * snd_soc_dapm_sync - scan and power dapm paths |
885 | * @codec: audio codec | 902 | * @codec: audio codec |
886 | * | 903 | * |
887 | * Walks all dapm audio paths and powers widgets according to their | 904 | * Walks all dapm audio paths and powers widgets according to their |
@@ -889,11 +906,11 @@ static void dapm_free_widgets(struct snd_soc_codec *codec) | |||
889 | * | 906 | * |
890 | * Returns 0 for success. | 907 | * Returns 0 for success. |
891 | */ | 908 | */ |
892 | int snd_soc_dapm_sync_endpoints(struct snd_soc_codec *codec) | 909 | int snd_soc_dapm_sync(struct snd_soc_codec *codec) |
893 | { | 910 | { |
894 | return dapm_power_widgets(codec, SND_SOC_DAPM_STREAM_NOP); | 911 | return dapm_power_widgets(codec, SND_SOC_DAPM_STREAM_NOP); |
895 | } | 912 | } |
896 | EXPORT_SYMBOL_GPL(snd_soc_dapm_sync_endpoints); | 913 | EXPORT_SYMBOL_GPL(snd_soc_dapm_sync); |
897 | 914 | ||
898 | static int snd_soc_dapm_add_route(struct snd_soc_codec *codec, | 915 | static int snd_soc_dapm_add_route(struct snd_soc_codec *codec, |
899 | const char *sink, const char *control, const char *source) | 916 | const char *sink, const char *control, const char *source) |
@@ -1441,53 +1458,57 @@ int snd_soc_dapm_set_bias_level(struct snd_soc_device *socdev, | |||
1441 | } | 1458 | } |
1442 | 1459 | ||
1443 | /** | 1460 | /** |
1444 | * snd_soc_dapm_set_endpoint - set audio endpoint status | 1461 | * snd_soc_dapm_enable_pin - enable pin. |
1445 | * @codec: audio codec | 1462 | * @snd_soc_codec: SoC codec |
1446 | * @endpoint: audio signal endpoint (or start point) | 1463 | * @pin: pin name |
1447 | * @status: point status | ||
1448 | * | ||
1449 | * Set audio endpoint status - connected or disconnected. | ||
1450 | * | 1464 | * |
1451 | * Returns 0 for success else error. | 1465 | * Enables input/output pin and it's parents or children widgets iff there is |
1466 | * a valid audio route and active audio stream. | ||
1467 | * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to | ||
1468 | * do any widget power switching. | ||
1452 | */ | 1469 | */ |
1453 | int snd_soc_dapm_set_endpoint(struct snd_soc_codec *codec, | 1470 | int snd_soc_dapm_enable_pin(struct snd_soc_codec *codec, char *pin) |
1454 | char *endpoint, int status) | ||
1455 | { | 1471 | { |
1456 | struct snd_soc_dapm_widget *w; | 1472 | return snd_soc_dapm_set_pin(codec, pin, 1); |
1457 | 1473 | } | |
1458 | list_for_each_entry(w, &codec->dapm_widgets, list) { | 1474 | EXPORT_SYMBOL_GPL(snd_soc_dapm_enable_pin); |
1459 | if (!strcmp(w->name, endpoint)) { | ||
1460 | w->connected = status; | ||
1461 | return 0; | ||
1462 | } | ||
1463 | } | ||
1464 | 1475 | ||
1465 | return -ENODEV; | 1476 | /** |
1477 | * snd_soc_dapm_disable_pin - disable pin. | ||
1478 | * @codec: SoC codec | ||
1479 | * @pin: pin name | ||
1480 | * | ||
1481 | * Disables input/output pin and it's parents or children widgets. | ||
1482 | * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to | ||
1483 | * do any widget power switching. | ||
1484 | */ | ||
1485 | int snd_soc_dapm_disable_pin(struct snd_soc_codec *codec, char *pin) | ||
1486 | { | ||
1487 | return snd_soc_dapm_set_pin(codec, pin, 0); | ||
1466 | } | 1488 | } |
1467 | EXPORT_SYMBOL_GPL(snd_soc_dapm_set_endpoint); | 1489 | EXPORT_SYMBOL_GPL(snd_soc_dapm_disable_pin); |
1468 | 1490 | ||
1469 | /** | 1491 | /** |
1470 | * snd_soc_dapm_get_endpoint_status - get audio endpoint status | 1492 | * snd_soc_dapm_get_pin_status - get audio pin status |
1471 | * @codec: audio codec | 1493 | * @codec: audio codec |
1472 | * @endpoint: audio signal endpoint (or start point) | 1494 | * @pin: audio signal pin endpoint (or start point) |
1473 | * | 1495 | * |
1474 | * Get audio endpoint status - connected or disconnected. | 1496 | * Get audio pin status - connected or disconnected. |
1475 | * | 1497 | * |
1476 | * Returns status | 1498 | * Returns 1 for connected otherwise 0. |
1477 | */ | 1499 | */ |
1478 | int snd_soc_dapm_get_endpoint_status(struct snd_soc_codec *codec, | 1500 | int snd_soc_dapm_get_pin_status(struct snd_soc_codec *codec, char *pin) |
1479 | char *endpoint) | ||
1480 | { | 1501 | { |
1481 | struct snd_soc_dapm_widget *w; | 1502 | struct snd_soc_dapm_widget *w; |
1482 | 1503 | ||
1483 | list_for_each_entry(w, &codec->dapm_widgets, list) { | 1504 | list_for_each_entry(w, &codec->dapm_widgets, list) { |
1484 | if (!strcmp(w->name, endpoint)) | 1505 | if (!strcmp(w->name, pin)) |
1485 | return w->connected; | 1506 | return w->connected; |
1486 | } | 1507 | } |
1487 | 1508 | ||
1488 | return 0; | 1509 | return 0; |
1489 | } | 1510 | } |
1490 | EXPORT_SYMBOL_GPL(snd_soc_dapm_get_endpoint_status); | 1511 | EXPORT_SYMBOL_GPL(snd_soc_dapm_get_pin_status); |
1491 | 1512 | ||
1492 | /** | 1513 | /** |
1493 | * snd_soc_dapm_free - free dapm resources | 1514 | * snd_soc_dapm_free - free dapm resources |