aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/pxa/poodle.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/pxa/poodle.c')
-rw-r--r--sound/soc/pxa/poodle.c50
1 files changed, 22 insertions, 28 deletions
diff --git a/sound/soc/pxa/poodle.c b/sound/soc/pxa/poodle.c
index 7e830b218943..65a4e9a8c39e 100644
--- a/sound/soc/pxa/poodle.c
+++ b/sound/soc/pxa/poodle.c
@@ -48,8 +48,6 @@ static int poodle_spk_func;
48 48
49static void poodle_ext_control(struct snd_soc_codec *codec) 49static 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
79static int poodle_startup(struct snd_pcm_substream *substream) 77static int poodle_startup(struct snd_pcm_substream *substream)
@@ -104,8 +102,8 @@ static int poodle_hw_params(struct snd_pcm_substream *substream,
104 struct snd_pcm_hw_params *params) 102 struct snd_pcm_hw_params *params)
105{ 103{
106 struct snd_soc_pcm_runtime *rtd = substream->private_data; 104 struct snd_soc_pcm_runtime *rtd = substream->private_data;
107 struct snd_soc_codec_dai *codec_dai = rtd->dai->codec_dai; 105 struct snd_soc_dai *codec_dai = rtd->dai->codec_dai;
108 struct snd_soc_cpu_dai *cpu_dai = rtd->dai->cpu_dai; 106 struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;
109 unsigned int clk = 0; 107 unsigned int clk = 0;
110 int ret = 0; 108 int ret = 0;
111 109
@@ -124,25 +122,25 @@ static int poodle_hw_params(struct snd_pcm_substream *substream,
124 } 122 }
125 123
126 /* set codec DAI configuration */ 124 /* set codec DAI configuration */
127 ret = codec_dai->dai_ops.set_fmt(codec_dai, SND_SOC_DAIFMT_I2S | 125 ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
128 SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS); 126 SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS);
129 if (ret < 0) 127 if (ret < 0)
130 return ret; 128 return ret;
131 129
132 /* set cpu DAI configuration */ 130 /* set cpu DAI configuration */
133 ret = cpu_dai->dai_ops.set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S | 131 ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S |
134 SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS); 132 SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS);
135 if (ret < 0) 133 if (ret < 0)
136 return ret; 134 return ret;
137 135
138 /* set the codec system clock for DAC and ADC */ 136 /* set the codec system clock for DAC and ADC */
139 ret = codec_dai->dai_ops.set_sysclk(codec_dai, WM8731_SYSCLK, clk, 137 ret = snd_soc_dai_set_sysclk(codec_dai, WM8731_SYSCLK, clk,
140 SND_SOC_CLOCK_IN); 138 SND_SOC_CLOCK_IN);
141 if (ret < 0) 139 if (ret < 0)
142 return ret; 140 return ret;
143 141
144 /* set the I2S system clock as input (unused) */ 142 /* set the I2S system clock as input (unused) */
145 ret = cpu_dai->dai_ops.set_sysclk(cpu_dai, PXA2XX_I2S_SYSCLK, 0, 143 ret = snd_soc_dai_set_sysclk(cpu_dai, PXA2XX_I2S_SYSCLK, 0,
146 SND_SOC_CLOCK_IN); 144 SND_SOC_CLOCK_IN);
147 if (ret < 0) 145 if (ret < 0)
148 return ret; 146 return ret;
@@ -215,8 +213,8 @@ SND_SOC_DAPM_HP("Headphone Jack", NULL),
215SND_SOC_DAPM_SPK("Ext Spk", poodle_amp_event), 213SND_SOC_DAPM_SPK("Ext Spk", poodle_amp_event),
216}; 214};
217 215
218/* Corgi machine audio_mapnections to the codec pins */ 216/* Corgi machine connections to the codec pins */
219static const char *audio_map[][3] = { 217static const struct snd_soc_dapm_route audio_map[] = {
220 218
221 /* headphone connected to LHPOUT1, RHPOUT1 */ 219 /* headphone connected to LHPOUT1, RHPOUT1 */
222 {"Headphone Jack", NULL, "LHPOUT"}, 220 {"Headphone Jack", NULL, "LHPOUT"},
@@ -225,8 +223,6 @@ static const char *audio_map[][3] = {
225 /* speaker connected to LOUT, ROUT */ 223 /* speaker connected to LOUT, ROUT */
226 {"Ext Spk", NULL, "ROUT"}, 224 {"Ext Spk", NULL, "ROUT"},
227 {"Ext Spk", NULL, "LOUT"}, 225 {"Ext Spk", NULL, "LOUT"},
228
229 {NULL, NULL, NULL},
230}; 226};
231 227
232static const char *jack_function[] = {"Off", "Headphone"}; 228static const char *jack_function[] = {"Off", "Headphone"};
@@ -250,9 +246,9 @@ static int poodle_wm8731_init(struct snd_soc_codec *codec)
250{ 246{
251 int i, err; 247 int i, err;
252 248
253 snd_soc_dapm_set_endpoint(codec, "LLINEIN", 0); 249 snd_soc_dapm_disable_pin(codec, "LLINEIN");
254 snd_soc_dapm_set_endpoint(codec, "RLINEIN", 0); 250 snd_soc_dapm_disable_pin(codec, "RLINEIN");
255 snd_soc_dapm_set_endpoint(codec, "MICIN", 1); 251 snd_soc_dapm_enable_pin(codec, "MICIN");
256 252
257 /* Add poodle specific controls */ 253 /* Add poodle specific controls */
258 for (i = 0; i < ARRAY_SIZE(wm8731_poodle_controls); i++) { 254 for (i = 0; i < ARRAY_SIZE(wm8731_poodle_controls); i++) {
@@ -263,15 +259,13 @@ static int poodle_wm8731_init(struct snd_soc_codec *codec)
263 } 259 }
264 260
265 /* Add poodle specific widgets */ 261 /* Add poodle specific widgets */
266 for (i = 0; i < ARRAY_SIZE(wm8731_dapm_widgets); i++) 262 snd_soc_dapm_new_controls(codec, wm8731_dapm_widgets,
267 snd_soc_dapm_new_control(codec, &wm8731_dapm_widgets[i]); 263 ARRAY_SIZE(wm8731_dapm_widgets));
268 264
269 /* Set up poodle specific audio path audio_map */ 265 /* Set up poodle specific audio path audio_map */
270 for (i = 0; audio_map[i][0] != NULL; i++) 266 snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map));
271 snd_soc_dapm_connect_input(codec, audio_map[i][0],
272 audio_map[i][1], audio_map[i][2]);
273 267
274 snd_soc_dapm_sync_endpoints(codec); 268 snd_soc_dapm_sync(codec);
275 return 0; 269 return 0;
276} 270}
277 271