]>
Commit | Line | Data |
---|---|---|
a86d5057 HP |
1 | /* |
2 | * Intel Skylake I2S Machine Driver for NAU88L25+SSM4567 | |
3 | * | |
4 | * Copyright (C) 2015, Intel Corporation. All rights reserved. | |
5 | * | |
6 | * Modified from: | |
7 | * Intel Skylake I2S Machine Driver for NAU88L25 and SSM4567 | |
8 | * | |
9 | * Copyright (C) 2015, Intel Corporation. All rights reserved. | |
10 | * | |
11 | * This program is free software; you can redistribute it and/or | |
12 | * modify it under the terms of the GNU General Public License version | |
13 | * 2 as published by the Free Software Foundation. | |
14 | * | |
15 | * This program is distributed in the hope that it will be useful, | |
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 | * GNU General Public License for more details. | |
19 | */ | |
20 | ||
21 | #include <linux/module.h> | |
22 | #include <linux/platform_device.h> | |
23 | #include <sound/core.h> | |
24 | #include <sound/pcm.h> | |
25 | #include <sound/soc.h> | |
26 | #include <sound/jack.h> | |
27 | #include <sound/pcm_params.h> | |
28 | #include "../../codecs/nau8825.h" | |
bc5f6ac9 | 29 | #include "../../codecs/hdac_hdmi.h" |
a86d5057 HP |
30 | |
31 | #define SKL_NUVOTON_CODEC_DAI "nau8825-hifi" | |
32 | #define SKL_SSM_CODEC_DAI "ssm4567-hifi" | |
33 | ||
34 | static struct snd_soc_jack skylake_headset; | |
35 | static struct snd_soc_card skylake_audio_card; | |
36 | ||
bc5f6ac9 JK |
37 | enum { |
38 | SKL_DPCM_AUDIO_PB = 0, | |
39 | SKL_DPCM_AUDIO_CP, | |
40 | SKL_DPCM_AUDIO_REF_CP, | |
41 | SKL_DPCM_AUDIO_DMIC_CP, | |
42 | SKL_DPCM_AUDIO_HDMI1_PB, | |
43 | SKL_DPCM_AUDIO_HDMI2_PB, | |
44 | SKL_DPCM_AUDIO_HDMI3_PB, | |
45 | }; | |
46 | ||
a86d5057 HP |
47 | static inline struct snd_soc_dai *skl_get_codec_dai(struct snd_soc_card *card) |
48 | { | |
85af2a66 | 49 | struct snd_soc_pcm_runtime *rtd; |
a86d5057 | 50 | |
85af2a66 | 51 | list_for_each_entry(rtd, &card->rtd_list, list) { |
a86d5057 | 52 | |
a86d5057 HP |
53 | if (!strncmp(rtd->codec_dai->name, SKL_NUVOTON_CODEC_DAI, |
54 | strlen(SKL_NUVOTON_CODEC_DAI))) | |
55 | return rtd->codec_dai; | |
56 | } | |
57 | ||
58 | return NULL; | |
59 | } | |
60 | ||
61 | static const struct snd_kcontrol_new skylake_controls[] = { | |
62 | SOC_DAPM_PIN_SWITCH("Headphone Jack"), | |
63 | SOC_DAPM_PIN_SWITCH("Headset Mic"), | |
64 | SOC_DAPM_PIN_SWITCH("Left Speaker"), | |
65 | SOC_DAPM_PIN_SWITCH("Right Speaker"), | |
66 | }; | |
67 | ||
68 | static int platform_clock_control(struct snd_soc_dapm_widget *w, | |
69 | struct snd_kcontrol *k, int event) | |
70 | { | |
71 | struct snd_soc_dapm_context *dapm = w->dapm; | |
72 | struct snd_soc_card *card = dapm->card; | |
73 | struct snd_soc_dai *codec_dai; | |
74 | int ret; | |
75 | ||
76 | codec_dai = skl_get_codec_dai(card); | |
77 | if (!codec_dai) { | |
78 | dev_err(card->dev, "Codec dai not found\n"); | |
79 | return -EIO; | |
80 | } | |
81 | ||
82 | if (SND_SOC_DAPM_EVENT_ON(event)) { | |
83 | ret = snd_soc_dai_set_sysclk(codec_dai, | |
84 | NAU8825_CLK_MCLK, 24000000, SND_SOC_CLOCK_IN); | |
85 | if (ret < 0) { | |
86 | dev_err(card->dev, "set sysclk err = %d\n", ret); | |
87 | return -EIO; | |
88 | } | |
89 | } else { | |
90 | ret = snd_soc_dai_set_sysclk(codec_dai, | |
91 | NAU8825_CLK_INTERNAL, 0, SND_SOC_CLOCK_IN); | |
92 | if (ret < 0) { | |
93 | dev_err(card->dev, "set sysclk err = %d\n", ret); | |
94 | return -EIO; | |
95 | } | |
96 | } | |
97 | return ret; | |
98 | } | |
99 | ||
100 | static const struct snd_soc_dapm_widget skylake_widgets[] = { | |
101 | SND_SOC_DAPM_HP("Headphone Jack", NULL), | |
102 | SND_SOC_DAPM_MIC("Headset Mic", NULL), | |
103 | SND_SOC_DAPM_SPK("Left Speaker", NULL), | |
104 | SND_SOC_DAPM_SPK("Right Speaker", NULL), | |
105 | SND_SOC_DAPM_MIC("SoC DMIC", NULL), | |
743ad80e FY |
106 | SND_SOC_DAPM_SPK("DP", NULL), |
107 | SND_SOC_DAPM_SPK("HDMI", NULL), | |
a86d5057 HP |
108 | SND_SOC_DAPM_SUPPLY("Platform Clock", SND_SOC_NOPM, 0, 0, |
109 | platform_clock_control, SND_SOC_DAPM_PRE_PMU | | |
110 | SND_SOC_DAPM_POST_PMD), | |
111 | }; | |
112 | ||
113 | static const struct snd_soc_dapm_route skylake_map[] = { | |
114 | /* HP jack connectors - unknown if we have jack detection */ | |
115 | {"Headphone Jack", NULL, "HPOL"}, | |
116 | {"Headphone Jack", NULL, "HPOR"}, | |
117 | ||
118 | /* speaker */ | |
119 | {"Left Speaker", NULL, "Left OUT"}, | |
120 | {"Right Speaker", NULL, "Right OUT"}, | |
121 | ||
122 | /* other jacks */ | |
123 | {"MIC", NULL, "Headset Mic"}, | |
4c6ebc3e | 124 | {"DMic", NULL, "SoC DMIC"}, |
a86d5057 | 125 | |
743ad80e FY |
126 | {"HDMI", NULL, "hif5 Output"}, |
127 | {"DP", NULL, "hif6 Output"}, | |
a86d5057 HP |
128 | /* CODEC BE connections */ |
129 | { "Left Playback", NULL, "ssp0 Tx"}, | |
130 | { "Right Playback", NULL, "ssp0 Tx"}, | |
131 | { "ssp0 Tx", NULL, "codec0_out"}, | |
132 | ||
5093f928 SP |
133 | /* IV feedback path */ |
134 | { "codec0_lp_in", NULL, "ssp0 Rx"}, | |
5188b95a JK |
135 | { "ssp0 Rx", NULL, "Left Capture Sense" }, |
136 | { "ssp0 Rx", NULL, "Right Capture Sense" }, | |
5093f928 | 137 | |
4c6ebc3e | 138 | { "Playback", NULL, "ssp1 Tx"}, |
a86d5057 HP |
139 | { "ssp1 Tx", NULL, "codec1_out"}, |
140 | ||
141 | { "codec0_in", NULL, "ssp1 Rx" }, | |
4c6ebc3e | 142 | { "ssp1 Rx", NULL, "Capture" }, |
a86d5057 HP |
143 | |
144 | /* DMIC */ | |
145 | { "dmic01_hifi", NULL, "DMIC01 Rx" }, | |
4c6ebc3e | 146 | { "DMIC01 Rx", NULL, "DMIC AIF" }, |
bc5f6ac9 JK |
147 | |
148 | { "hifi3", NULL, "iDisp3 Tx"}, | |
149 | { "iDisp3 Tx", NULL, "iDisp3_out"}, | |
150 | { "hifi2", NULL, "iDisp2 Tx"}, | |
151 | { "iDisp2 Tx", NULL, "iDisp2_out"}, | |
152 | { "hifi1", NULL, "iDisp1 Tx"}, | |
153 | { "iDisp1 Tx", NULL, "iDisp1_out"}, | |
154 | ||
a86d5057 HP |
155 | { "Headphone Jack", NULL, "Platform Clock" }, |
156 | { "Headset Mic", NULL, "Platform Clock" }, | |
157 | }; | |
158 | ||
159 | static struct snd_soc_codec_conf ssm4567_codec_conf[] = { | |
160 | { | |
161 | .dev_name = "i2c-INT343B:00", | |
162 | .name_prefix = "Left", | |
163 | }, | |
164 | { | |
165 | .dev_name = "i2c-INT343B:01", | |
166 | .name_prefix = "Right", | |
167 | }, | |
168 | }; | |
169 | ||
170 | static struct snd_soc_dai_link_component ssm4567_codec_components[] = { | |
171 | { /* Left */ | |
172 | .name = "i2c-INT343B:00", | |
173 | .dai_name = SKL_SSM_CODEC_DAI, | |
174 | }, | |
175 | { /* Right */ | |
176 | .name = "i2c-INT343B:01", | |
177 | .dai_name = SKL_SSM_CODEC_DAI, | |
178 | }, | |
179 | }; | |
180 | ||
181 | static int skylake_ssm4567_codec_init(struct snd_soc_pcm_runtime *rtd) | |
182 | { | |
183 | int ret; | |
184 | ||
185 | /* Slot 1 for left */ | |
186 | ret = snd_soc_dai_set_tdm_slot(rtd->codec_dais[0], 0x01, 0x01, 2, 48); | |
187 | if (ret < 0) | |
188 | return ret; | |
189 | ||
190 | /* Slot 2 for right */ | |
191 | ret = snd_soc_dai_set_tdm_slot(rtd->codec_dais[1], 0x02, 0x02, 2, 48); | |
192 | if (ret < 0) | |
193 | return ret; | |
194 | ||
195 | return ret; | |
196 | } | |
197 | ||
198 | static int skylake_nau8825_codec_init(struct snd_soc_pcm_runtime *rtd) | |
199 | { | |
200 | int ret; | |
201 | struct snd_soc_codec *codec = rtd->codec; | |
202 | ||
203 | /* | |
204 | * 4 buttons here map to the google Reference headset | |
205 | * The use of these buttons can be decided by the user space. | |
206 | */ | |
207 | ret = snd_soc_card_jack_new(&skylake_audio_card, "Headset Jack", | |
208 | SND_JACK_HEADSET | SND_JACK_BTN_0 | SND_JACK_BTN_1 | | |
209 | SND_JACK_BTN_2 | SND_JACK_BTN_3, &skylake_headset, | |
210 | NULL, 0); | |
211 | if (ret) { | |
212 | dev_err(rtd->dev, "Headset Jack creation failed %d\n", ret); | |
213 | return ret; | |
214 | } | |
215 | ||
216 | nau8825_enable_jack_detect(codec, &skylake_headset); | |
217 | ||
941eee74 YZ |
218 | snd_soc_dapm_ignore_suspend(&rtd->card->dapm, "SoC DMIC"); |
219 | ||
a86d5057 HP |
220 | return ret; |
221 | } | |
222 | ||
bc5f6ac9 JK |
223 | static int skylake_hdmi1_init(struct snd_soc_pcm_runtime *rtd) |
224 | { | |
225 | struct snd_soc_dai *dai = rtd->codec_dai; | |
226 | ||
227 | return hdac_hdmi_jack_init(dai, SKL_DPCM_AUDIO_HDMI1_PB); | |
228 | } | |
229 | ||
230 | static int skylake_hdmi2_init(struct snd_soc_pcm_runtime *rtd) | |
231 | { | |
232 | struct snd_soc_dai *dai = rtd->codec_dai; | |
233 | ||
234 | return hdac_hdmi_jack_init(dai, SKL_DPCM_AUDIO_HDMI2_PB); | |
235 | } | |
236 | ||
237 | ||
238 | static int skylake_hdmi3_init(struct snd_soc_pcm_runtime *rtd) | |
239 | { | |
240 | struct snd_soc_dai *dai = rtd->codec_dai; | |
241 | ||
242 | return hdac_hdmi_jack_init(dai, SKL_DPCM_AUDIO_HDMI3_PB); | |
243 | } | |
244 | ||
2616e27e YZ |
245 | static int skylake_nau8825_fe_init(struct snd_soc_pcm_runtime *rtd) |
246 | { | |
247 | struct snd_soc_dapm_context *dapm; | |
248 | struct snd_soc_component *component = rtd->cpu_dai->component; | |
249 | ||
250 | dapm = snd_soc_component_get_dapm(component); | |
251 | snd_soc_dapm_ignore_suspend(dapm, "Reference Capture"); | |
252 | ||
253 | return 0; | |
254 | } | |
255 | ||
256 | static unsigned int rates[] = { | |
257 | 48000, | |
258 | }; | |
259 | ||
260 | static struct snd_pcm_hw_constraint_list constraints_rates = { | |
261 | .count = ARRAY_SIZE(rates), | |
262 | .list = rates, | |
263 | .mask = 0, | |
264 | }; | |
265 | ||
266 | static unsigned int channels[] = { | |
267 | 2, | |
268 | }; | |
269 | ||
270 | static struct snd_pcm_hw_constraint_list constraints_channels = { | |
271 | .count = ARRAY_SIZE(channels), | |
272 | .list = channels, | |
273 | .mask = 0, | |
274 | }; | |
275 | ||
276 | static int skl_fe_startup(struct snd_pcm_substream *substream) | |
277 | { | |
278 | struct snd_pcm_runtime *runtime = substream->runtime; | |
279 | ||
280 | /* | |
281 | * on this platform for PCM device we support, | |
282 | * 48Khz | |
283 | * stereo | |
284 | * 16 bit audio | |
285 | */ | |
286 | ||
287 | runtime->hw.channels_max = 2; | |
288 | snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, | |
289 | &constraints_channels); | |
290 | ||
291 | runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE; | |
292 | snd_pcm_hw_constraint_msbits(runtime, 0, 16, 16); | |
293 | ||
294 | snd_pcm_hw_constraint_list(runtime, 0, | |
295 | SNDRV_PCM_HW_PARAM_RATE, &constraints_rates); | |
296 | ||
297 | return 0; | |
298 | } | |
299 | ||
300 | static const struct snd_soc_ops skylake_nau8825_fe_ops = { | |
301 | .startup = skl_fe_startup, | |
302 | }; | |
303 | ||
a86d5057 HP |
304 | static int skylake_ssp_fixup(struct snd_soc_pcm_runtime *rtd, |
305 | struct snd_pcm_hw_params *params) | |
306 | { | |
307 | struct snd_interval *rate = hw_param_interval(params, | |
308 | SNDRV_PCM_HW_PARAM_RATE); | |
309 | struct snd_interval *channels = hw_param_interval(params, | |
310 | SNDRV_PCM_HW_PARAM_CHANNELS); | |
311 | struct snd_mask *fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT); | |
312 | ||
313 | /* The ADSP will covert the FE rate to 48k, stereo */ | |
314 | rate->min = rate->max = 48000; | |
315 | channels->min = channels->max = 2; | |
316 | ||
317 | /* set SSP0 to 24 bit */ | |
318 | snd_mask_none(fmt); | |
319 | snd_mask_set(fmt, SNDRV_PCM_FORMAT_S24_LE); | |
320 | return 0; | |
321 | } | |
322 | ||
2616e27e YZ |
323 | static int skylake_dmic_fixup(struct snd_soc_pcm_runtime *rtd, |
324 | struct snd_pcm_hw_params *params) | |
325 | { | |
326 | struct snd_interval *channels = hw_param_interval(params, | |
327 | SNDRV_PCM_HW_PARAM_CHANNELS); | |
328 | if (params_channels(params) == 2) | |
329 | channels->min = channels->max = 2; | |
330 | else | |
331 | channels->min = channels->max = 4; | |
332 | ||
333 | return 0; | |
334 | } | |
335 | ||
a86d5057 HP |
336 | static int skylake_nau8825_hw_params(struct snd_pcm_substream *substream, |
337 | struct snd_pcm_hw_params *params) | |
338 | { | |
339 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | |
340 | struct snd_soc_dai *codec_dai = rtd->codec_dai; | |
341 | int ret; | |
342 | ||
343 | ret = snd_soc_dai_set_sysclk(codec_dai, | |
344 | NAU8825_CLK_MCLK, 24000000, SND_SOC_CLOCK_IN); | |
345 | ||
346 | if (ret < 0) | |
347 | dev_err(rtd->dev, "snd_soc_dai_set_sysclk err = %d\n", ret); | |
348 | ||
349 | return ret; | |
350 | } | |
351 | ||
352 | static struct snd_soc_ops skylake_nau8825_ops = { | |
353 | .hw_params = skylake_nau8825_hw_params, | |
354 | }; | |
355 | ||
2616e27e YZ |
356 | static unsigned int channels_dmic[] = { |
357 | 2, 4, | |
358 | }; | |
359 | ||
360 | static struct snd_pcm_hw_constraint_list constraints_dmic_channels = { | |
361 | .count = ARRAY_SIZE(channels_dmic), | |
362 | .list = channels_dmic, | |
363 | .mask = 0, | |
364 | }; | |
365 | ||
366 | static int skylake_dmic_startup(struct snd_pcm_substream *substream) | |
367 | { | |
368 | struct snd_pcm_runtime *runtime = substream->runtime; | |
369 | ||
370 | runtime->hw.channels_max = 4; | |
371 | snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, | |
372 | &constraints_dmic_channels); | |
373 | ||
374 | return snd_pcm_hw_constraint_list(substream->runtime, 0, | |
375 | SNDRV_PCM_HW_PARAM_RATE, &constraints_rates); | |
376 | } | |
377 | ||
378 | static struct snd_soc_ops skylake_dmic_ops = { | |
379 | .startup = skylake_dmic_startup, | |
380 | }; | |
381 | ||
382 | static unsigned int rates_16000[] = { | |
383 | 16000, | |
384 | }; | |
385 | ||
386 | static struct snd_pcm_hw_constraint_list constraints_16000 = { | |
387 | .count = ARRAY_SIZE(rates_16000), | |
388 | .list = rates_16000, | |
389 | }; | |
390 | ||
391 | static int skylake_refcap_startup(struct snd_pcm_substream *substream) | |
392 | { | |
393 | return snd_pcm_hw_constraint_list(substream->runtime, 0, | |
394 | SNDRV_PCM_HW_PARAM_RATE, | |
395 | &constraints_16000); | |
396 | } | |
397 | ||
398 | static struct snd_soc_ops skylaye_refcap_ops = { | |
399 | .startup = skylake_refcap_startup, | |
400 | }; | |
401 | ||
a86d5057 HP |
402 | /* skylake digital audio interface glue - connects codec <--> CPU */ |
403 | static struct snd_soc_dai_link skylake_dais[] = { | |
404 | /* Front End DAI links */ | |
bc5f6ac9 | 405 | [SKL_DPCM_AUDIO_PB] = { |
a86d5057 HP |
406 | .name = "Skl Audio Port", |
407 | .stream_name = "Audio", | |
408 | .cpu_dai_name = "System Pin", | |
409 | .platform_name = "0000:00:1f.3", | |
410 | .dynamic = 1, | |
411 | .codec_name = "snd-soc-dummy", | |
412 | .codec_dai_name = "snd-soc-dummy-dai", | |
413 | .nonatomic = 1, | |
2616e27e | 414 | .init = skylake_nau8825_fe_init, |
a86d5057 HP |
415 | .trigger = { |
416 | SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, | |
417 | .dpcm_playback = 1, | |
2616e27e | 418 | .ops = &skylake_nau8825_fe_ops, |
a86d5057 | 419 | }, |
bc5f6ac9 | 420 | [SKL_DPCM_AUDIO_CP] = { |
a86d5057 HP |
421 | .name = "Skl Audio Capture Port", |
422 | .stream_name = "Audio Record", | |
423 | .cpu_dai_name = "System Pin", | |
424 | .platform_name = "0000:00:1f.3", | |
425 | .dynamic = 1, | |
426 | .codec_name = "snd-soc-dummy", | |
427 | .codec_dai_name = "snd-soc-dummy-dai", | |
428 | .nonatomic = 1, | |
429 | .trigger = { | |
430 | SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, | |
431 | .dpcm_capture = 1, | |
2616e27e | 432 | .ops = &skylake_nau8825_fe_ops, |
a86d5057 | 433 | }, |
bc5f6ac9 | 434 | [SKL_DPCM_AUDIO_REF_CP] = { |
a86d5057 | 435 | .name = "Skl Audio Reference cap", |
2154be36 | 436 | .stream_name = "Wake on Voice", |
a86d5057 HP |
437 | .cpu_dai_name = "Reference Pin", |
438 | .codec_name = "snd-soc-dummy", | |
439 | .codec_dai_name = "snd-soc-dummy-dai", | |
440 | .platform_name = "0000:00:1f.3", | |
441 | .init = NULL, | |
442 | .dpcm_capture = 1, | |
443 | .ignore_suspend = 1, | |
444 | .nonatomic = 1, | |
445 | .dynamic = 1, | |
2616e27e YZ |
446 | .ops = &skylaye_refcap_ops, |
447 | }, | |
bc5f6ac9 | 448 | [SKL_DPCM_AUDIO_DMIC_CP] = { |
2616e27e YZ |
449 | .name = "Skl Audio DMIC cap", |
450 | .stream_name = "dmiccap", | |
451 | .cpu_dai_name = "DMIC Pin", | |
452 | .codec_name = "snd-soc-dummy", | |
453 | .codec_dai_name = "snd-soc-dummy-dai", | |
454 | .platform_name = "0000:00:1f.3", | |
455 | .init = NULL, | |
456 | .dpcm_capture = 1, | |
457 | .nonatomic = 1, | |
458 | .dynamic = 1, | |
459 | .ops = &skylake_dmic_ops, | |
a86d5057 | 460 | }, |
bc5f6ac9 JK |
461 | [SKL_DPCM_AUDIO_HDMI1_PB] = { |
462 | .name = "Skl HDMI Port1", | |
463 | .stream_name = "Hdmi1", | |
464 | .cpu_dai_name = "HDMI1 Pin", | |
743ad80e FY |
465 | .codec_name = "snd-soc-dummy", |
466 | .codec_dai_name = "snd-soc-dummy-dai", | |
467 | .platform_name = "0000:00:1f.3", | |
468 | .dpcm_playback = 1, | |
469 | .init = NULL, | |
bc5f6ac9 JK |
470 | .trigger = { |
471 | SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, | |
472 | .nonatomic = 1, | |
473 | .dynamic = 1, | |
474 | }, | |
475 | [SKL_DPCM_AUDIO_HDMI2_PB] = { | |
476 | .name = "Skl HDMI Port2", | |
477 | .stream_name = "Hdmi2", | |
478 | .cpu_dai_name = "HDMI2 Pin", | |
479 | .codec_name = "snd-soc-dummy", | |
480 | .codec_dai_name = "snd-soc-dummy-dai", | |
481 | .platform_name = "0000:00:1f.3", | |
482 | .dpcm_playback = 1, | |
483 | .init = NULL, | |
484 | .trigger = { | |
485 | SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, | |
486 | .nonatomic = 1, | |
487 | .dynamic = 1, | |
488 | }, | |
489 | [SKL_DPCM_AUDIO_HDMI3_PB] = { | |
490 | .name = "Skl HDMI Port3", | |
491 | .stream_name = "Hdmi3", | |
492 | .cpu_dai_name = "HDMI3 Pin", | |
493 | .codec_name = "snd-soc-dummy", | |
494 | .codec_dai_name = "snd-soc-dummy-dai", | |
495 | .platform_name = "0000:00:1f.3", | |
496 | .trigger = { | |
497 | SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, | |
498 | .dpcm_playback = 1, | |
499 | .init = NULL, | |
743ad80e FY |
500 | .nonatomic = 1, |
501 | .dynamic = 1, | |
502 | }, | |
503 | ||
a86d5057 HP |
504 | /* Back End DAI links */ |
505 | { | |
506 | /* SSP0 - Codec */ | |
507 | .name = "SSP0-Codec", | |
508 | .be_id = 0, | |
509 | .cpu_dai_name = "SSP0 Pin", | |
510 | .platform_name = "0000:00:1f.3", | |
511 | .no_pcm = 1, | |
512 | .codecs = ssm4567_codec_components, | |
513 | .num_codecs = ARRAY_SIZE(ssm4567_codec_components), | |
514 | .dai_fmt = SND_SOC_DAIFMT_DSP_A | | |
515 | SND_SOC_DAIFMT_IB_NF | | |
516 | SND_SOC_DAIFMT_CBS_CFS, | |
517 | .init = skylake_ssm4567_codec_init, | |
a86d5057 HP |
518 | .ignore_pmdown_time = 1, |
519 | .be_hw_params_fixup = skylake_ssp_fixup, | |
520 | .dpcm_playback = 1, | |
5188b95a | 521 | .dpcm_capture = 1, |
a86d5057 HP |
522 | }, |
523 | { | |
524 | /* SSP1 - Codec */ | |
525 | .name = "SSP1-Codec", | |
bc5f6ac9 | 526 | .be_id = 1, |
a86d5057 HP |
527 | .cpu_dai_name = "SSP1 Pin", |
528 | .platform_name = "0000:00:1f.3", | |
529 | .no_pcm = 1, | |
530 | .codec_name = "i2c-10508825:00", | |
531 | .codec_dai_name = SKL_NUVOTON_CODEC_DAI, | |
532 | .init = skylake_nau8825_codec_init, | |
533 | .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | | |
534 | SND_SOC_DAIFMT_CBS_CFS, | |
a86d5057 HP |
535 | .ignore_pmdown_time = 1, |
536 | .be_hw_params_fixup = skylake_ssp_fixup, | |
537 | .ops = &skylake_nau8825_ops, | |
538 | .dpcm_playback = 1, | |
539 | .dpcm_capture = 1, | |
540 | }, | |
541 | { | |
542 | .name = "dmic01", | |
bc5f6ac9 | 543 | .be_id = 2, |
a86d5057 HP |
544 | .cpu_dai_name = "DMIC01 Pin", |
545 | .codec_name = "dmic-codec", | |
546 | .codec_dai_name = "dmic-hifi", | |
547 | .platform_name = "0000:00:1f.3", | |
548 | .ignore_suspend = 1, | |
2616e27e | 549 | .be_hw_params_fixup = skylake_dmic_fixup, |
a86d5057 HP |
550 | .dpcm_capture = 1, |
551 | .no_pcm = 1, | |
552 | }, | |
743ad80e | 553 | { |
bc5f6ac9 | 554 | .name = "iDisp1", |
743ad80e | 555 | .be_id = 3, |
bc5f6ac9 | 556 | .cpu_dai_name = "iDisp1 Pin", |
743ad80e FY |
557 | .codec_name = "ehdaudio0D2", |
558 | .codec_dai_name = "intel-hdmi-hifi1", | |
559 | .platform_name = "0000:00:1f.3", | |
560 | .dpcm_playback = 1, | |
bc5f6ac9 JK |
561 | .init = skylake_hdmi1_init, |
562 | .no_pcm = 1, | |
563 | }, | |
564 | { | |
565 | .name = "iDisp2", | |
566 | .be_id = 4, | |
567 | .cpu_dai_name = "iDisp2 Pin", | |
568 | .codec_name = "ehdaudio0D2", | |
569 | .codec_dai_name = "intel-hdmi-hifi2", | |
570 | .platform_name = "0000:00:1f.3", | |
571 | .init = skylake_hdmi2_init, | |
572 | .dpcm_playback = 1, | |
573 | .no_pcm = 1, | |
574 | }, | |
575 | { | |
576 | .name = "iDisp3", | |
577 | .be_id = 5, | |
578 | .cpu_dai_name = "iDisp3 Pin", | |
579 | .codec_name = "ehdaudio0D2", | |
580 | .codec_dai_name = "intel-hdmi-hifi3", | |
581 | .platform_name = "0000:00:1f.3", | |
582 | .init = skylake_hdmi3_init, | |
583 | .dpcm_playback = 1, | |
743ad80e FY |
584 | .no_pcm = 1, |
585 | }, | |
a86d5057 HP |
586 | }; |
587 | ||
588 | /* skylake audio machine driver for SPT + NAU88L25 */ | |
589 | static struct snd_soc_card skylake_audio_card = { | |
590 | .name = "sklnau8825adi", | |
591 | .owner = THIS_MODULE, | |
592 | .dai_link = skylake_dais, | |
593 | .num_links = ARRAY_SIZE(skylake_dais), | |
594 | .controls = skylake_controls, | |
595 | .num_controls = ARRAY_SIZE(skylake_controls), | |
596 | .dapm_widgets = skylake_widgets, | |
597 | .num_dapm_widgets = ARRAY_SIZE(skylake_widgets), | |
598 | .dapm_routes = skylake_map, | |
599 | .num_dapm_routes = ARRAY_SIZE(skylake_map), | |
600 | .codec_conf = ssm4567_codec_conf, | |
601 | .num_configs = ARRAY_SIZE(ssm4567_codec_conf), | |
4c6ebc3e | 602 | .fully_routed = true, |
a86d5057 HP |
603 | }; |
604 | ||
605 | static int skylake_audio_probe(struct platform_device *pdev) | |
606 | { | |
607 | skylake_audio_card.dev = &pdev->dev; | |
608 | ||
609 | return devm_snd_soc_register_card(&pdev->dev, &skylake_audio_card); | |
610 | } | |
611 | ||
612 | static struct platform_driver skylake_audio = { | |
613 | .probe = skylake_audio_probe, | |
614 | .driver = { | |
615 | .name = "skl_nau88l25_ssm4567_i2s", | |
616 | .pm = &snd_soc_pm_ops, | |
617 | }, | |
618 | }; | |
619 | ||
620 | module_platform_driver(skylake_audio) | |
621 | ||
622 | /* Module information */ | |
623 | MODULE_AUTHOR("Conrad Cooke <conrad.cooke@intel.com>"); | |
624 | MODULE_AUTHOR("Harsha Priya <harshapriya.n@intel.com>"); | |
625 | MODULE_AUTHOR("Naveen M <naveen.m@intel.com>"); | |
626 | MODULE_AUTHOR("Sathya Prakash M R <sathya.prakash.m.r@intel.com>"); | |
627 | MODULE_AUTHOR("Yong Zhi <yong.zhi@intel.com>"); | |
628 | MODULE_DESCRIPTION("Intel Audio Machine driver for SKL with NAU88L25 and SSM4567 in I2S Mode"); | |
629 | MODULE_LICENSE("GPL v2"); | |
630 | MODULE_ALIAS("platform:skl_nau88l25_ssm4567_i2s"); |