aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/omap/zoom2.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/omap/zoom2.c')
-rw-r--r--sound/soc/omap/zoom2.c96
1 files changed, 11 insertions, 85 deletions
diff --git a/sound/soc/omap/zoom2.c b/sound/soc/omap/zoom2.c
index 9a2666ffc16c..7cf35c82368a 100644
--- a/sound/soc/omap/zoom2.c
+++ b/sound/soc/omap/zoom2.c
@@ -44,29 +44,8 @@ static int zoom2_hw_params(struct snd_pcm_substream *substream,
44{ 44{
45 struct snd_soc_pcm_runtime *rtd = substream->private_data; 45 struct snd_soc_pcm_runtime *rtd = substream->private_data;
46 struct snd_soc_dai *codec_dai = rtd->codec_dai; 46 struct snd_soc_dai *codec_dai = rtd->codec_dai;
47 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
48 int ret; 47 int ret;
49 48
50 /* Set codec DAI configuration */
51 ret = snd_soc_dai_set_fmt(codec_dai,
52 SND_SOC_DAIFMT_I2S |
53 SND_SOC_DAIFMT_NB_NF |
54 SND_SOC_DAIFMT_CBM_CFM);
55 if (ret < 0) {
56 printk(KERN_ERR "can't set codec DAI configuration\n");
57 return ret;
58 }
59
60 /* Set cpu DAI configuration */
61 ret = snd_soc_dai_set_fmt(cpu_dai,
62 SND_SOC_DAIFMT_I2S |
63 SND_SOC_DAIFMT_NB_NF |
64 SND_SOC_DAIFMT_CBM_CFM);
65 if (ret < 0) {
66 printk(KERN_ERR "can't set cpu DAI configuration\n");
67 return ret;
68 }
69
70 /* Set the codec system clock for DAC and ADC */ 49 /* Set the codec system clock for DAC and ADC */
71 ret = snd_soc_dai_set_sysclk(codec_dai, 0, 26000000, 50 ret = snd_soc_dai_set_sysclk(codec_dai, 0, 26000000,
72 SND_SOC_CLOCK_IN); 51 SND_SOC_CLOCK_IN);
@@ -82,49 +61,6 @@ static struct snd_soc_ops zoom2_ops = {
82 .hw_params = zoom2_hw_params, 61 .hw_params = zoom2_hw_params,
83}; 62};
84 63
85static int zoom2_hw_voice_params(struct snd_pcm_substream *substream,
86 struct snd_pcm_hw_params *params)
87{
88 struct snd_soc_pcm_runtime *rtd = substream->private_data;
89 struct snd_soc_dai *codec_dai = rtd->codec_dai;
90 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
91 int ret;
92
93 /* Set codec DAI configuration */
94 ret = snd_soc_dai_set_fmt(codec_dai,
95 SND_SOC_DAIFMT_DSP_A |
96 SND_SOC_DAIFMT_IB_NF |
97 SND_SOC_DAIFMT_CBM_CFM);
98 if (ret) {
99 printk(KERN_ERR "can't set codec DAI configuration\n");
100 return ret;
101 }
102
103 /* Set cpu DAI configuration */
104 ret = snd_soc_dai_set_fmt(cpu_dai,
105 SND_SOC_DAIFMT_DSP_A |
106 SND_SOC_DAIFMT_IB_NF |
107 SND_SOC_DAIFMT_CBM_CFM);
108 if (ret < 0) {
109 printk(KERN_ERR "can't set cpu DAI configuration\n");
110 return ret;
111 }
112
113 /* Set the codec system clock for DAC and ADC */
114 ret = snd_soc_dai_set_sysclk(codec_dai, 0, 26000000,
115 SND_SOC_CLOCK_IN);
116 if (ret < 0) {
117 printk(KERN_ERR "can't set codec system clock\n");
118 return ret;
119 }
120
121 return 0;
122}
123
124static struct snd_soc_ops zoom2_voice_ops = {
125 .hw_params = zoom2_hw_voice_params,
126};
127
128/* Zoom2 machine DAPM */ 64/* Zoom2 machine DAPM */
129static const struct snd_soc_dapm_widget zoom2_twl4030_dapm_widgets[] = { 65static const struct snd_soc_dapm_widget zoom2_twl4030_dapm_widgets[] = {
130 SND_SOC_DAPM_MIC("Ext Mic", NULL), 66 SND_SOC_DAPM_MIC("Ext Mic", NULL),
@@ -162,23 +98,6 @@ static int zoom2_twl4030_init(struct snd_soc_pcm_runtime *rtd)
162{ 98{
163 struct snd_soc_codec *codec = rtd->codec; 99 struct snd_soc_codec *codec = rtd->codec;
164 struct snd_soc_dapm_context *dapm = &codec->dapm; 100 struct snd_soc_dapm_context *dapm = &codec->dapm;
165 int ret;
166
167 /* Add Zoom2 specific widgets */
168 ret = snd_soc_dapm_new_controls(dapm, zoom2_twl4030_dapm_widgets,
169 ARRAY_SIZE(zoom2_twl4030_dapm_widgets));
170 if (ret)
171 return ret;
172
173 /* Set up Zoom2 specific audio path audio_map */
174 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
175
176 /* Zoom2 connected pins */
177 snd_soc_dapm_enable_pin(dapm, "Ext Mic");
178 snd_soc_dapm_enable_pin(dapm, "Ext Spk");
179 snd_soc_dapm_enable_pin(dapm, "Headset Mic");
180 snd_soc_dapm_enable_pin(dapm, "Headset Stereophone");
181 snd_soc_dapm_enable_pin(dapm, "Aux In");
182 101
183 /* TWL4030 not connected pins */ 102 /* TWL4030 not connected pins */
184 snd_soc_dapm_nc_pin(dapm, "CARKITMIC"); 103 snd_soc_dapm_nc_pin(dapm, "CARKITMIC");
@@ -190,9 +109,7 @@ static int zoom2_twl4030_init(struct snd_soc_pcm_runtime *rtd)
190 snd_soc_dapm_nc_pin(dapm, "CARKITL"); 109 snd_soc_dapm_nc_pin(dapm, "CARKITL");
191 snd_soc_dapm_nc_pin(dapm, "CARKITR"); 110 snd_soc_dapm_nc_pin(dapm, "CARKITR");
192 111
193 ret = snd_soc_dapm_sync(dapm); 112 return 0;
194
195 return ret;
196} 113}
197 114
198static int zoom2_twl4030_voice_init(struct snd_soc_pcm_runtime *rtd) 115static int zoom2_twl4030_voice_init(struct snd_soc_pcm_runtime *rtd)
@@ -217,6 +134,8 @@ static struct snd_soc_dai_link zoom2_dai[] = {
217 .codec_dai_name = "twl4030-hifi", 134 .codec_dai_name = "twl4030-hifi",
218 .platform_name = "omap-pcm-audio", 135 .platform_name = "omap-pcm-audio",
219 .codec_name = "twl4030-codec", 136 .codec_name = "twl4030-codec",
137 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
138 SND_SOC_DAIFMT_CBM_CFM,
220 .init = zoom2_twl4030_init, 139 .init = zoom2_twl4030_init,
221 .ops = &zoom2_ops, 140 .ops = &zoom2_ops,
222 }, 141 },
@@ -227,8 +146,10 @@ static struct snd_soc_dai_link zoom2_dai[] = {
227 .codec_dai_name = "twl4030-voice", 146 .codec_dai_name = "twl4030-voice",
228 .platform_name = "omap-pcm-audio", 147 .platform_name = "omap-pcm-audio",
229 .codec_name = "twl4030-codec", 148 .codec_name = "twl4030-codec",
149 .dai_fmt = SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_IB_NF |
150 SND_SOC_DAIFMT_CBM_CFM,
230 .init = zoom2_twl4030_voice_init, 151 .init = zoom2_twl4030_voice_init,
231 .ops = &zoom2_voice_ops, 152 .ops = &zoom2_ops,
232 }, 153 },
233}; 154};
234 155
@@ -237,6 +158,11 @@ static struct snd_soc_card snd_soc_zoom2 = {
237 .name = "Zoom2", 158 .name = "Zoom2",
238 .dai_link = zoom2_dai, 159 .dai_link = zoom2_dai,
239 .num_links = ARRAY_SIZE(zoom2_dai), 160 .num_links = ARRAY_SIZE(zoom2_dai),
161
162 .dapm_widgets = zoom2_twl4030_dapm_widgets,
163 .num_dapm_widgets = ARRAY_SIZE(zoom2_twl4030_dapm_widgets),
164 .dapm_routes = audio_map,
165 .num_dapm_routes = ARRAY_SIZE(audio_map),
240}; 166};
241 167
242static struct platform_device *zoom2_snd_device; 168static struct platform_device *zoom2_snd_device;