aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/s6000/s6105-ipcam.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/s6000/s6105-ipcam.c')
-rw-r--r--sound/soc/s6000/s6105-ipcam.c73
1 files changed, 32 insertions, 41 deletions
diff --git a/sound/soc/s6000/s6105-ipcam.c b/sound/soc/s6000/s6105-ipcam.c
index c1b40ac22c05..5890e431852f 100644
--- a/sound/soc/s6000/s6105-ipcam.c
+++ b/sound/soc/s6000/s6105-ipcam.c
@@ -18,11 +18,9 @@
18#include <sound/core.h> 18#include <sound/core.h>
19#include <sound/pcm.h> 19#include <sound/pcm.h>
20#include <sound/soc.h> 20#include <sound/soc.h>
21#include <sound/soc-dapm.h>
22 21
23#include <variant/dmac.h> 22#include <variant/dmac.h>
24 23
25#include "../codecs/tlv320aic3x.h"
26#include "s6000-pcm.h" 24#include "s6000-pcm.h"
27#include "s6000-i2s.h" 25#include "s6000-i2s.h"
28 26
@@ -32,8 +30,8 @@ static int s6105_hw_params(struct snd_pcm_substream *substream,
32 struct snd_pcm_hw_params *params) 30 struct snd_pcm_hw_params *params)
33{ 31{
34 struct snd_soc_pcm_runtime *rtd = substream->private_data; 32 struct snd_soc_pcm_runtime *rtd = substream->private_data;
35 struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; 33 struct snd_soc_dai *codec_dai = rtd->codec_dai;
36 struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; 34 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
37 int ret = 0; 35 int ret = 0;
38 36
39 /* set codec DAI configuration */ 37 /* set codec DAI configuration */
@@ -107,6 +105,7 @@ static int output_type_put(struct snd_kcontrol *kcontrol,
107 struct snd_ctl_elem_value *ucontrol) 105 struct snd_ctl_elem_value *ucontrol)
108{ 106{
109 struct snd_soc_codec *codec = kcontrol->private_data; 107 struct snd_soc_codec *codec = kcontrol->private_data;
108 struct snd_soc_dapm_context *dapm = &codec->dapm;
110 unsigned int val = (ucontrol->value.enumerated.item[0] != 0); 109 unsigned int val = (ucontrol->value.enumerated.item[0] != 0);
111 char *differential = "Audio Out Differential"; 110 char *differential = "Audio Out Differential";
112 char *stereo = "Audio Out Stereo"; 111 char *stereo = "Audio Out Stereo";
@@ -114,10 +113,10 @@ static int output_type_put(struct snd_kcontrol *kcontrol,
114 if (kcontrol->private_value == val) 113 if (kcontrol->private_value == val)
115 return 0; 114 return 0;
116 kcontrol->private_value = val; 115 kcontrol->private_value = val;
117 snd_soc_dapm_disable_pin(codec, val ? differential : stereo); 116 snd_soc_dapm_disable_pin(dapm, val ? differential : stereo);
118 snd_soc_dapm_sync(codec); 117 snd_soc_dapm_sync(dapm);
119 snd_soc_dapm_enable_pin(codec, val ? stereo : differential); 118 snd_soc_dapm_enable_pin(dapm, val ? stereo : differential);
120 snd_soc_dapm_sync(codec); 119 snd_soc_dapm_sync(dapm);
121 120
122 return 1; 121 return 1;
123} 122}
@@ -134,38 +133,41 @@ static const struct snd_kcontrol_new audio_out_mux = {
134}; 133};
135 134
136/* Logic for a aic3x as connected on the s6105 ip camera ref design */ 135/* Logic for a aic3x as connected on the s6105 ip camera ref design */
137static int s6105_aic3x_init(struct snd_soc_codec *codec) 136static int s6105_aic3x_init(struct snd_soc_pcm_runtime *rtd)
138{ 137{
138 struct snd_soc_codec *codec = rtd->codec;
139 struct snd_soc_dapm_context *dapm = &codec->dapm;
140
139 /* Add s6105 specific widgets */ 141 /* Add s6105 specific widgets */
140 snd_soc_dapm_new_controls(codec, aic3x_dapm_widgets, 142 snd_soc_dapm_new_controls(dapm, aic3x_dapm_widgets,
141 ARRAY_SIZE(aic3x_dapm_widgets)); 143 ARRAY_SIZE(aic3x_dapm_widgets));
142 144
143 /* Set up s6105 specific audio path audio_map */ 145 /* Set up s6105 specific audio path audio_map */
144 snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); 146 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
145 147
146 /* not present */ 148 /* not present */
147 snd_soc_dapm_nc_pin(codec, "MONO_LOUT"); 149 snd_soc_dapm_nc_pin(dapm, "MONO_LOUT");
148 snd_soc_dapm_nc_pin(codec, "LINE2L"); 150 snd_soc_dapm_nc_pin(dapm, "LINE2L");
149 snd_soc_dapm_nc_pin(codec, "LINE2R"); 151 snd_soc_dapm_nc_pin(dapm, "LINE2R");
150 152
151 /* not connected */ 153 /* not connected */
152 snd_soc_dapm_nc_pin(codec, "MIC3L"); /* LINE2L on this chip */ 154 snd_soc_dapm_nc_pin(dapm, "MIC3L"); /* LINE2L on this chip */
153 snd_soc_dapm_nc_pin(codec, "MIC3R"); /* LINE2R on this chip */ 155 snd_soc_dapm_nc_pin(dapm, "MIC3R"); /* LINE2R on this chip */
154 snd_soc_dapm_nc_pin(codec, "LLOUT"); 156 snd_soc_dapm_nc_pin(dapm, "LLOUT");
155 snd_soc_dapm_nc_pin(codec, "RLOUT"); 157 snd_soc_dapm_nc_pin(dapm, "RLOUT");
156 snd_soc_dapm_nc_pin(codec, "HPRCOM"); 158 snd_soc_dapm_nc_pin(dapm, "HPRCOM");
157 159
158 /* always connected */ 160 /* always connected */
159 snd_soc_dapm_enable_pin(codec, "Audio In"); 161 snd_soc_dapm_enable_pin(dapm, "Audio In");
160 162
161 /* must correspond to audio_out_mux.private_value initializer */ 163 /* must correspond to audio_out_mux.private_value initializer */
162 snd_soc_dapm_disable_pin(codec, "Audio Out Differential"); 164 snd_soc_dapm_disable_pin(dapm, "Audio Out Differential");
163 snd_soc_dapm_sync(codec); 165 snd_soc_dapm_sync(dapm);
164 snd_soc_dapm_enable_pin(codec, "Audio Out Stereo"); 166 snd_soc_dapm_enable_pin(dapm, "Audio Out Stereo");
165 167
166 snd_soc_dapm_sync(codec); 168 snd_soc_dapm_sync(dapm);
167 169
168 snd_ctl_add(codec->card, snd_ctl_new1(&audio_out_mux, codec)); 170 snd_ctl_add(codec->card->snd_card, snd_ctl_new1(&audio_out_mux, codec));
169 171
170 return 0; 172 return 0;
171} 173}
@@ -174,8 +176,10 @@ static int s6105_aic3x_init(struct snd_soc_codec *codec)
174static struct snd_soc_dai_link s6105_dai = { 176static struct snd_soc_dai_link s6105_dai = {
175 .name = "TLV320AIC31", 177 .name = "TLV320AIC31",
176 .stream_name = "AIC31", 178 .stream_name = "AIC31",
177 .cpu_dai = &s6000_i2s_dai, 179 .cpu_dai_name = "s6000-i2s",
178 .codec_dai = &aic3x_dai, 180 .codec_dai_name = "tlv320aic3x-hifi",
181 .platform_name = "s6000-pcm-audio",
182 .codec_name = "tlv320aic3x-codec.0-001a",
179 .init = s6105_aic3x_init, 183 .init = s6105_aic3x_init,
180 .ops = &s6105_ops, 184 .ops = &s6105_ops,
181}; 185};
@@ -183,22 +187,10 @@ static struct snd_soc_dai_link s6105_dai = {
183/* s6105 audio machine driver */ 187/* s6105 audio machine driver */
184static struct snd_soc_card snd_soc_card_s6105 = { 188static struct snd_soc_card snd_soc_card_s6105 = {
185 .name = "Stretch IP Camera", 189 .name = "Stretch IP Camera",
186 .platform = &s6000_soc_platform,
187 .dai_link = &s6105_dai, 190 .dai_link = &s6105_dai,
188 .num_links = 1, 191 .num_links = 1,
189}; 192};
190 193
191/* s6105 audio private data */
192static struct aic3x_setup_data s6105_aic3x_setup = {
193};
194
195/* s6105 audio subsystem */
196static struct snd_soc_device s6105_snd_devdata = {
197 .card = &snd_soc_card_s6105,
198 .codec_dev = &soc_codec_dev_aic3x,
199 .codec_data = &s6105_aic3x_setup,
200};
201
202static struct s6000_snd_platform_data __initdata s6105_snd_data = { 194static struct s6000_snd_platform_data __initdata s6105_snd_data = {
203 .wide = 0, 195 .wide = 0,
204 .channel_in = 0, 196 .channel_in = 0,
@@ -227,8 +219,7 @@ static int __init s6105_init(void)
227 if (!s6105_snd_device) 219 if (!s6105_snd_device)
228 return -ENOMEM; 220 return -ENOMEM;
229 221
230 platform_set_drvdata(s6105_snd_device, &s6105_snd_devdata); 222 platform_set_drvdata(s6105_snd_device, &snd_soc_card_s6105);
231 s6105_snd_devdata.dev = &s6105_snd_device->dev;
232 platform_device_add_data(s6105_snd_device, &s6105_snd_data, 223 platform_device_add_data(s6105_snd_device, &s6105_snd_data,
233 sizeof(s6105_snd_data)); 224 sizeof(s6105_snd_data));
234 225