diff options
Diffstat (limited to 'sound/soc/samsung')
-rw-r--r-- | sound/soc/samsung/littlemill.c | 102 | ||||
-rw-r--r-- | sound/soc/samsung/lowland.c | 75 | ||||
-rw-r--r-- | sound/soc/samsung/speyside.c | 33 |
3 files changed, 125 insertions, 85 deletions
diff --git a/sound/soc/samsung/littlemill.c b/sound/soc/samsung/littlemill.c index e7416851bf7d..c82c646b8a08 100644 --- a/sound/soc/samsung/littlemill.c +++ b/sound/soc/samsung/littlemill.c | |||
@@ -23,10 +23,10 @@ static int littlemill_set_bias_level(struct snd_soc_card *card, | |||
23 | struct snd_soc_dapm_context *dapm, | 23 | struct snd_soc_dapm_context *dapm, |
24 | enum snd_soc_bias_level level) | 24 | enum snd_soc_bias_level level) |
25 | { | 25 | { |
26 | struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai; | 26 | struct snd_soc_dai *aif1_dai = card->rtd[0].codec_dai; |
27 | int ret; | 27 | int ret; |
28 | 28 | ||
29 | if (dapm->dev != codec_dai->dev) | 29 | if (dapm->dev != aif1_dai->dev) |
30 | return 0; | 30 | return 0; |
31 | 31 | ||
32 | switch (level) { | 32 | switch (level) { |
@@ -36,7 +36,7 @@ static int littlemill_set_bias_level(struct snd_soc_card *card, | |||
36 | * then do so now, otherwise these are noops. | 36 | * then do so now, otherwise these are noops. |
37 | */ | 37 | */ |
38 | if (dapm->bias_level == SND_SOC_BIAS_STANDBY) { | 38 | if (dapm->bias_level == SND_SOC_BIAS_STANDBY) { |
39 | ret = snd_soc_dai_set_pll(codec_dai, WM8994_FLL1, | 39 | ret = snd_soc_dai_set_pll(aif1_dai, WM8994_FLL1, |
40 | WM8994_FLL_SRC_MCLK2, 32768, | 40 | WM8994_FLL_SRC_MCLK2, 32768, |
41 | sample_rate * 512); | 41 | sample_rate * 512); |
42 | if (ret < 0) { | 42 | if (ret < 0) { |
@@ -44,7 +44,7 @@ static int littlemill_set_bias_level(struct snd_soc_card *card, | |||
44 | return ret; | 44 | return ret; |
45 | } | 45 | } |
46 | 46 | ||
47 | ret = snd_soc_dai_set_sysclk(codec_dai, | 47 | ret = snd_soc_dai_set_sysclk(aif1_dai, |
48 | WM8994_SYSCLK_FLL1, | 48 | WM8994_SYSCLK_FLL1, |
49 | sample_rate * 512, | 49 | sample_rate * 512, |
50 | SND_SOC_CLOCK_IN); | 50 | SND_SOC_CLOCK_IN); |
@@ -66,25 +66,25 @@ static int littlemill_set_bias_level_post(struct snd_soc_card *card, | |||
66 | struct snd_soc_dapm_context *dapm, | 66 | struct snd_soc_dapm_context *dapm, |
67 | enum snd_soc_bias_level level) | 67 | enum snd_soc_bias_level level) |
68 | { | 68 | { |
69 | struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai; | 69 | struct snd_soc_dai *aif1_dai = card->rtd[0].codec_dai; |
70 | int ret; | 70 | int ret; |
71 | 71 | ||
72 | if (dapm->dev != codec_dai->dev) | 72 | if (dapm->dev != aif1_dai->dev) |
73 | return 0; | 73 | return 0; |
74 | 74 | ||
75 | switch (level) { | 75 | switch (level) { |
76 | case SND_SOC_BIAS_STANDBY: | 76 | case SND_SOC_BIAS_STANDBY: |
77 | ret = snd_soc_dai_set_sysclk(codec_dai, WM8994_SYSCLK_MCLK2, | 77 | ret = snd_soc_dai_set_sysclk(aif1_dai, WM8994_SYSCLK_MCLK2, |
78 | 32768, SND_SOC_CLOCK_IN); | 78 | 32768, SND_SOC_CLOCK_IN); |
79 | if (ret < 0) { | 79 | if (ret < 0) { |
80 | pr_err("Failed to switch away from FLL: %d\n", ret); | 80 | pr_err("Failed to switch away from FLL1: %d\n", ret); |
81 | return ret; | 81 | return ret; |
82 | } | 82 | } |
83 | 83 | ||
84 | ret = snd_soc_dai_set_pll(codec_dai, WM8994_FLL1, | 84 | ret = snd_soc_dai_set_pll(aif1_dai, WM8994_FLL1, |
85 | 0, 0, 0); | 85 | 0, 0, 0); |
86 | if (ret < 0) { | 86 | if (ret < 0) { |
87 | pr_err("Failed to stop FLL: %d\n", ret); | 87 | pr_err("Failed to stop FLL1: %d\n", ret); |
88 | return ret; | 88 | return ret; |
89 | } | 89 | } |
90 | break; | 90 | break; |
@@ -131,6 +131,14 @@ static struct snd_soc_ops littlemill_ops = { | |||
131 | .hw_params = littlemill_hw_params, | 131 | .hw_params = littlemill_hw_params, |
132 | }; | 132 | }; |
133 | 133 | ||
134 | static const struct snd_soc_pcm_stream baseband_params = { | ||
135 | .formats = SNDRV_PCM_FMTBIT_S32_LE, | ||
136 | .rate_min = 8000, | ||
137 | .rate_max = 8000, | ||
138 | .channels_min = 2, | ||
139 | .channels_max = 2, | ||
140 | }; | ||
141 | |||
134 | static struct snd_soc_dai_link littlemill_dai[] = { | 142 | static struct snd_soc_dai_link littlemill_dai[] = { |
135 | { | 143 | { |
136 | .name = "CPU", | 144 | .name = "CPU", |
@@ -143,13 +151,75 @@ static struct snd_soc_dai_link littlemill_dai[] = { | |||
143 | | SND_SOC_DAIFMT_CBM_CFM, | 151 | | SND_SOC_DAIFMT_CBM_CFM, |
144 | .ops = &littlemill_ops, | 152 | .ops = &littlemill_ops, |
145 | }, | 153 | }, |
154 | { | ||
155 | .name = "Baseband", | ||
156 | .stream_name = "Baseband", | ||
157 | .cpu_dai_name = "wm8994-aif2", | ||
158 | .codec_dai_name = "wm1250-ev1", | ||
159 | .codec_name = "wm1250-ev1.1-0027", | ||
160 | .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | ||
161 | | SND_SOC_DAIFMT_CBM_CFM, | ||
162 | .ignore_suspend = 1, | ||
163 | .params = &baseband_params, | ||
164 | }, | ||
146 | }; | 165 | }; |
147 | 166 | ||
167 | static int bbclk_ev(struct snd_soc_dapm_widget *w, | ||
168 | struct snd_kcontrol *kcontrol, int event) | ||
169 | { | ||
170 | struct snd_soc_card *card = w->dapm->card; | ||
171 | struct snd_soc_dai *aif2_dai = card->rtd[1].cpu_dai; | ||
172 | int ret; | ||
173 | |||
174 | switch (event) { | ||
175 | case SND_SOC_DAPM_PRE_PMU: | ||
176 | ret = snd_soc_dai_set_pll(aif2_dai, WM8994_FLL2, | ||
177 | WM8994_FLL_SRC_BCLK, 64 * 8000, | ||
178 | 8000 * 256); | ||
179 | if (ret < 0) { | ||
180 | pr_err("Failed to start FLL: %d\n", ret); | ||
181 | return ret; | ||
182 | } | ||
183 | |||
184 | ret = snd_soc_dai_set_sysclk(aif2_dai, WM8994_SYSCLK_FLL2, | ||
185 | 8000 * 256, | ||
186 | SND_SOC_CLOCK_IN); | ||
187 | if (ret < 0) { | ||
188 | pr_err("Failed to set SYSCLK: %d\n", ret); | ||
189 | return ret; | ||
190 | } | ||
191 | break; | ||
192 | case SND_SOC_DAPM_POST_PMD: | ||
193 | ret = snd_soc_dai_set_sysclk(aif2_dai, WM8994_SYSCLK_MCLK2, | ||
194 | 32768, SND_SOC_CLOCK_IN); | ||
195 | if (ret < 0) { | ||
196 | pr_err("Failed to switch away from FLL2: %d\n", ret); | ||
197 | return ret; | ||
198 | } | ||
199 | |||
200 | ret = snd_soc_dai_set_pll(aif2_dai, WM8994_FLL2, | ||
201 | 0, 0, 0); | ||
202 | if (ret < 0) { | ||
203 | pr_err("Failed to stop FLL2: %d\n", ret); | ||
204 | return ret; | ||
205 | } | ||
206 | break; | ||
207 | default: | ||
208 | return -EINVAL; | ||
209 | } | ||
210 | |||
211 | return 0; | ||
212 | } | ||
213 | |||
148 | static struct snd_soc_dapm_widget widgets[] = { | 214 | static struct snd_soc_dapm_widget widgets[] = { |
149 | SND_SOC_DAPM_HP("Headphone", NULL), | 215 | SND_SOC_DAPM_HP("Headphone", NULL), |
150 | 216 | ||
151 | SND_SOC_DAPM_MIC("AMIC", NULL), | 217 | SND_SOC_DAPM_MIC("AMIC", NULL), |
152 | SND_SOC_DAPM_MIC("DMIC", NULL), | 218 | SND_SOC_DAPM_MIC("DMIC", NULL), |
219 | |||
220 | SND_SOC_DAPM_SUPPLY_S("Baseband Clock", -1, SND_SOC_NOPM, 0, 0, | ||
221 | bbclk_ev, | ||
222 | SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), | ||
153 | }; | 223 | }; |
154 | 224 | ||
155 | static struct snd_soc_dapm_route audio_paths[] = { | 225 | static struct snd_soc_dapm_route audio_paths[] = { |
@@ -162,6 +232,8 @@ static struct snd_soc_dapm_route audio_paths[] = { | |||
162 | { "DMIC", NULL, "MICBIAS2" }, /* Default for DMICBIAS jumper */ | 232 | { "DMIC", NULL, "MICBIAS2" }, /* Default for DMICBIAS jumper */ |
163 | { "DMIC1DAT", NULL, "DMIC" }, | 233 | { "DMIC1DAT", NULL, "DMIC" }, |
164 | { "DMIC2DAT", NULL, "DMIC" }, | 234 | { "DMIC2DAT", NULL, "DMIC" }, |
235 | |||
236 | { "AIF2CLK", NULL, "Baseband Clock" }, | ||
165 | }; | 237 | }; |
166 | 238 | ||
167 | static struct snd_soc_jack littlemill_headset; | 239 | static struct snd_soc_jack littlemill_headset; |
@@ -169,10 +241,16 @@ static struct snd_soc_jack littlemill_headset; | |||
169 | static int littlemill_late_probe(struct snd_soc_card *card) | 241 | static int littlemill_late_probe(struct snd_soc_card *card) |
170 | { | 242 | { |
171 | struct snd_soc_codec *codec = card->rtd[0].codec; | 243 | struct snd_soc_codec *codec = card->rtd[0].codec; |
172 | struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai; | 244 | struct snd_soc_dai *aif1_dai = card->rtd[0].codec_dai; |
245 | struct snd_soc_dai *aif2_dai = card->rtd[1].cpu_dai; | ||
173 | int ret; | 246 | int ret; |
174 | 247 | ||
175 | ret = snd_soc_dai_set_sysclk(codec_dai, WM8994_SYSCLK_MCLK2, | 248 | ret = snd_soc_dai_set_sysclk(aif1_dai, WM8994_SYSCLK_MCLK2, |
249 | 32768, SND_SOC_CLOCK_IN); | ||
250 | if (ret < 0) | ||
251 | return ret; | ||
252 | |||
253 | ret = snd_soc_dai_set_sysclk(aif2_dai, WM8994_SYSCLK_MCLK2, | ||
176 | 32768, SND_SOC_CLOCK_IN); | 254 | 32768, SND_SOC_CLOCK_IN); |
177 | if (ret < 0) | 255 | if (ret < 0) |
178 | return ret; | 256 | return ret; |
diff --git a/sound/soc/samsung/lowland.c b/sound/soc/samsung/lowland.c index 4adff934f771..6abf341c4a2a 100644 --- a/sound/soc/samsung/lowland.c +++ b/sound/soc/samsung/lowland.c | |||
@@ -21,33 +21,6 @@ | |||
21 | #define MCLK1_RATE (44100 * 512) | 21 | #define MCLK1_RATE (44100 * 512) |
22 | #define CLKOUT_RATE (44100 * 256) | 22 | #define CLKOUT_RATE (44100 * 256) |
23 | 23 | ||
24 | static int lowland_hw_params(struct snd_pcm_substream *substream, | ||
25 | struct snd_pcm_hw_params *params) | ||
26 | { | ||
27 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
28 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; | ||
29 | struct snd_soc_dai *codec_dai = rtd->codec_dai; | ||
30 | int ret; | ||
31 | |||
32 | ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S | ||
33 | | SND_SOC_DAIFMT_NB_NF | ||
34 | | SND_SOC_DAIFMT_CBM_CFM); | ||
35 | if (ret < 0) | ||
36 | return ret; | ||
37 | |||
38 | ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S | ||
39 | | SND_SOC_DAIFMT_NB_NF | ||
40 | | SND_SOC_DAIFMT_CBM_CFM); | ||
41 | if (ret < 0) | ||
42 | return ret; | ||
43 | |||
44 | return 0; | ||
45 | } | ||
46 | |||
47 | static struct snd_soc_ops lowland_ops = { | ||
48 | .hw_params = lowland_hw_params, | ||
49 | }; | ||
50 | |||
51 | static struct snd_soc_jack lowland_headset; | 24 | static struct snd_soc_jack lowland_headset; |
52 | 25 | ||
53 | /* Headset jack detection DAPM pins */ | 26 | /* Headset jack detection DAPM pins */ |
@@ -101,6 +74,25 @@ static int lowland_wm5100_init(struct snd_soc_pcm_runtime *rtd) | |||
101 | return 0; | 74 | return 0; |
102 | } | 75 | } |
103 | 76 | ||
77 | static int lowland_wm9081_init(struct snd_soc_pcm_runtime *rtd) | ||
78 | { | ||
79 | struct snd_soc_codec *codec = rtd->codec; | ||
80 | |||
81 | snd_soc_dapm_nc_pin(&codec->dapm, "LINEOUT"); | ||
82 | |||
83 | /* At any time the WM9081 is active it will have this clock */ | ||
84 | return snd_soc_codec_set_sysclk(codec, WM9081_SYSCLK_MCLK, 0, | ||
85 | CLKOUT_RATE, 0); | ||
86 | } | ||
87 | |||
88 | static const struct snd_soc_pcm_stream sub_params = { | ||
89 | .formats = SNDRV_PCM_FMTBIT_S32_LE, | ||
90 | .rate_min = 44100, | ||
91 | .rate_max = 44100, | ||
92 | .channels_min = 2, | ||
93 | .channels_max = 2, | ||
94 | }; | ||
95 | |||
104 | static struct snd_soc_dai_link lowland_dai[] = { | 96 | static struct snd_soc_dai_link lowland_dai[] = { |
105 | { | 97 | { |
106 | .name = "CPU", | 98 | .name = "CPU", |
@@ -109,7 +101,8 @@ static struct snd_soc_dai_link lowland_dai[] = { | |||
109 | .codec_dai_name = "wm5100-aif1", | 101 | .codec_dai_name = "wm5100-aif1", |
110 | .platform_name = "samsung-audio", | 102 | .platform_name = "samsung-audio", |
111 | .codec_name = "wm5100.1-001a", | 103 | .codec_name = "wm5100.1-001a", |
112 | .ops = &lowland_ops, | 104 | .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | |
105 | SND_SOC_DAIFMT_CBM_CFM, | ||
113 | .init = lowland_wm5100_init, | 106 | .init = lowland_wm5100_init, |
114 | }, | 107 | }, |
115 | { | 108 | { |
@@ -118,24 +111,20 @@ static struct snd_soc_dai_link lowland_dai[] = { | |||
118 | .cpu_dai_name = "wm5100-aif2", | 111 | .cpu_dai_name = "wm5100-aif2", |
119 | .codec_dai_name = "wm1250-ev1", | 112 | .codec_dai_name = "wm1250-ev1", |
120 | .codec_name = "wm1250-ev1.1-0027", | 113 | .codec_name = "wm1250-ev1.1-0027", |
121 | .ops = &lowland_ops, | 114 | .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | |
115 | SND_SOC_DAIFMT_CBM_CFM, | ||
122 | .ignore_suspend = 1, | 116 | .ignore_suspend = 1, |
123 | }, | 117 | }, |
124 | }; | ||
125 | |||
126 | static int lowland_wm9081_init(struct snd_soc_dapm_context *dapm) | ||
127 | { | ||
128 | snd_soc_dapm_nc_pin(dapm, "LINEOUT"); | ||
129 | |||
130 | /* At any time the WM9081 is active it will have this clock */ | ||
131 | return snd_soc_codec_set_sysclk(dapm->codec, WM9081_SYSCLK_MCLK, 0, | ||
132 | CLKOUT_RATE, 0); | ||
133 | } | ||
134 | |||
135 | static struct snd_soc_aux_dev lowland_aux_dev[] = { | ||
136 | { | 118 | { |
137 | .name = "wm9081", | 119 | .name = "Sub Speaker", |
120 | .stream_name = "Sub Speaker", | ||
121 | .cpu_dai_name = "wm5100-aif3", | ||
122 | .codec_dai_name = "wm9081-hifi", | ||
138 | .codec_name = "wm9081.1-006c", | 123 | .codec_name = "wm9081.1-006c", |
124 | .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | | ||
125 | SND_SOC_DAIFMT_CBM_CFM, | ||
126 | .ignore_suspend = 1, | ||
127 | .params = &sub_params, | ||
139 | .init = lowland_wm9081_init, | 128 | .init = lowland_wm9081_init, |
140 | }, | 129 | }, |
141 | }; | 130 | }; |
@@ -180,8 +169,6 @@ static struct snd_soc_card lowland = { | |||
180 | .owner = THIS_MODULE, | 169 | .owner = THIS_MODULE, |
181 | .dai_link = lowland_dai, | 170 | .dai_link = lowland_dai, |
182 | .num_links = ARRAY_SIZE(lowland_dai), | 171 | .num_links = ARRAY_SIZE(lowland_dai), |
183 | .aux_dev = lowland_aux_dev, | ||
184 | .num_aux_devs = ARRAY_SIZE(lowland_aux_dev), | ||
185 | .codec_conf = lowland_codec_conf, | 172 | .codec_conf = lowland_codec_conf, |
186 | .num_configs = ARRAY_SIZE(lowland_codec_conf), | 173 | .num_configs = ARRAY_SIZE(lowland_codec_conf), |
187 | 174 | ||
diff --git a/sound/soc/samsung/speyside.c b/sound/soc/samsung/speyside.c index f9ab7707a3e4..a4a9fc7e8c76 100644 --- a/sound/soc/samsung/speyside.c +++ b/sound/soc/samsung/speyside.c | |||
@@ -92,33 +92,6 @@ static int speyside_set_bias_level_post(struct snd_soc_card *card, | |||
92 | return 0; | 92 | return 0; |
93 | } | 93 | } |
94 | 94 | ||
95 | static int speyside_hw_params(struct snd_pcm_substream *substream, | ||
96 | struct snd_pcm_hw_params *params) | ||
97 | { | ||
98 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
99 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; | ||
100 | struct snd_soc_dai *codec_dai = rtd->codec_dai; | ||
101 | int ret; | ||
102 | |||
103 | ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S | ||
104 | | SND_SOC_DAIFMT_NB_NF | ||
105 | | SND_SOC_DAIFMT_CBM_CFM); | ||
106 | if (ret < 0) | ||
107 | return ret; | ||
108 | |||
109 | ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S | ||
110 | | SND_SOC_DAIFMT_NB_NF | ||
111 | | SND_SOC_DAIFMT_CBM_CFM); | ||
112 | if (ret < 0) | ||
113 | return ret; | ||
114 | |||
115 | return 0; | ||
116 | } | ||
117 | |||
118 | static struct snd_soc_ops speyside_ops = { | ||
119 | .hw_params = speyside_hw_params, | ||
120 | }; | ||
121 | |||
122 | static struct snd_soc_jack speyside_headset; | 95 | static struct snd_soc_jack speyside_headset; |
123 | 96 | ||
124 | /* Headset jack detection DAPM pins */ | 97 | /* Headset jack detection DAPM pins */ |
@@ -208,7 +181,8 @@ static struct snd_soc_dai_link speyside_dai[] = { | |||
208 | .platform_name = "samsung-audio", | 181 | .platform_name = "samsung-audio", |
209 | .codec_name = "wm8996.1-001a", | 182 | .codec_name = "wm8996.1-001a", |
210 | .init = speyside_wm8996_init, | 183 | .init = speyside_wm8996_init, |
211 | .ops = &speyside_ops, | 184 | .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
185 | | SND_SOC_DAIFMT_CBM_CFM, | ||
212 | }, | 186 | }, |
213 | { | 187 | { |
214 | .name = "Baseband", | 188 | .name = "Baseband", |
@@ -216,7 +190,8 @@ static struct snd_soc_dai_link speyside_dai[] = { | |||
216 | .cpu_dai_name = "wm8996-aif2", | 190 | .cpu_dai_name = "wm8996-aif2", |
217 | .codec_dai_name = "wm1250-ev1", | 191 | .codec_dai_name = "wm1250-ev1", |
218 | .codec_name = "wm1250-ev1.1-0027", | 192 | .codec_name = "wm1250-ev1.1-0027", |
219 | .ops = &speyside_ops, | 193 | .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
194 | | SND_SOC_DAIFMT_CBM_CFM, | ||
220 | .ignore_suspend = 1, | 195 | .ignore_suspend = 1, |
221 | }, | 196 | }, |
222 | }; | 197 | }; |