cfde894d250feb6c9f84e0cd49610ce2a60efb4d
[muen/linux.git] / sound / soc / intel / boards / kbl_rt5663_rt5514_max98927.c
1 /*
2  * Intel Kabylake I2S Machine Driver with MAXIM98927
3  * RT5514 and RT5663 Codecs
4  *
5  * Copyright (C) 2017, Intel Corporation. All rights reserved.
6  *
7  * Modified from:
8  *   Intel Kabylake I2S Machine driver supporting MAXIM98927 and
9  *   RT5663 codecs
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/jack.h>
25 #include <sound/pcm.h>
26 #include <sound/pcm_params.h>
27 #include <sound/soc.h>
28 #include "../../codecs/rt5514.h"
29 #include "../../codecs/rt5663.h"
30 #include "../../codecs/hdac_hdmi.h"
31 #include "../skylake/skl.h"
32
33 #define KBL_REALTEK_CODEC_DAI "rt5663-aif"
34 #define KBL_REALTEK_DMIC_CODEC_DAI "rt5514-aif1"
35 #define KBL_MAXIM_CODEC_DAI "max98927-aif1"
36 #define MAXIM_DEV0_NAME "i2c-MX98927:00"
37 #define MAXIM_DEV1_NAME "i2c-MX98927:01"
38 #define RT5514_DEV_NAME "i2c-10EC5514:00"
39 #define RT5663_DEV_NAME "i2c-10EC5663:00"
40 #define RT5514_AIF1_BCLK_FREQ (48000 * 8 * 16)
41 #define RT5514_AIF1_SYSCLK_FREQ 12288000
42 #define NAME_SIZE 32
43
44 #define DMIC_CH(p) p->list[p->count-1]
45
46
47 static struct snd_soc_card kabylake_audio_card;
48 static const struct snd_pcm_hw_constraint_list *dmic_constraints;
49
50 struct kbl_hdmi_pcm {
51         struct list_head head;
52         struct snd_soc_dai *codec_dai;
53         int device;
54 };
55
56 struct kbl_codec_private {
57         struct snd_soc_jack kabylake_headset;
58         struct list_head hdmi_pcm_list;
59         struct snd_soc_jack kabylake_hdmi[2];
60 };
61
62 enum {
63         KBL_DPCM_AUDIO_PB = 0,
64         KBL_DPCM_AUDIO_CP,
65         KBL_DPCM_AUDIO_DMIC_CP,
66         KBL_DPCM_AUDIO_HDMI1_PB,
67         KBL_DPCM_AUDIO_HDMI2_PB,
68 };
69
70 static const struct snd_kcontrol_new kabylake_controls[] = {
71         SOC_DAPM_PIN_SWITCH("Headphone Jack"),
72         SOC_DAPM_PIN_SWITCH("Headset Mic"),
73         SOC_DAPM_PIN_SWITCH("Left Spk"),
74         SOC_DAPM_PIN_SWITCH("Right Spk"),
75         SOC_DAPM_PIN_SWITCH("DMIC"),
76 };
77
78 static const struct snd_soc_dapm_widget kabylake_widgets[] = {
79         SND_SOC_DAPM_HP("Headphone Jack", NULL),
80         SND_SOC_DAPM_MIC("Headset Mic", NULL),
81         SND_SOC_DAPM_SPK("Left Spk", NULL),
82         SND_SOC_DAPM_SPK("Right Spk", NULL),
83         SND_SOC_DAPM_MIC("DMIC", NULL),
84         SND_SOC_DAPM_SPK("DP", NULL),
85         SND_SOC_DAPM_SPK("HDMI", NULL),
86
87 };
88
89 static const struct snd_soc_dapm_route kabylake_map[] = {
90         /* Headphones */
91         { "Headphone Jack", NULL, "HPOL" },
92         { "Headphone Jack", NULL, "HPOR" },
93
94         /* speaker */
95         { "Left Spk", NULL, "Left BE_OUT" },
96         { "Right Spk", NULL, "Right BE_OUT" },
97
98         /* other jacks */
99         { "IN1P", NULL, "Headset Mic" },
100         { "IN1N", NULL, "Headset Mic" },
101
102         { "HDMI", NULL, "hif5 Output" },
103         { "DP", NULL, "hif6 Output" },
104
105         /* CODEC BE connections */
106         { "Left HiFi Playback", NULL, "ssp0 Tx" },
107         { "Right HiFi Playback", NULL, "ssp0 Tx" },
108         { "ssp0 Tx", NULL, "codec0_out" },
109
110         { "AIF Playback", NULL, "ssp1 Tx" },
111         { "ssp1 Tx", NULL, "codec1_out" },
112
113         { "codec0_in", NULL, "ssp1 Rx" },
114         { "ssp1 Rx", NULL, "AIF Capture" },
115
116         { "codec1_in", NULL, "ssp0 Rx" },
117         { "ssp0 Rx", NULL, "AIF1 Capture" },
118
119         /* DMIC */
120         { "DMIC1L", NULL, "DMIC" },
121         { "DMIC1R", NULL, "DMIC" },
122         { "DMIC2L", NULL, "DMIC" },
123         { "DMIC2R", NULL, "DMIC" },
124
125         { "hifi2", NULL, "iDisp2 Tx" },
126         { "iDisp2 Tx", NULL, "iDisp2_out" },
127         { "hifi1", NULL, "iDisp1 Tx" },
128         { "iDisp1 Tx", NULL, "iDisp1_out" },
129 };
130
131 static struct snd_soc_codec_conf max98927_codec_conf[] = {
132         {
133                 .dev_name = MAXIM_DEV0_NAME,
134                 .name_prefix = "Right",
135         },
136         {
137                 .dev_name = MAXIM_DEV1_NAME,
138                 .name_prefix = "Left",
139         },
140 };
141
142 static struct snd_soc_dai_link_component ssp0_codec_components[] = {
143         { /* Left */
144                 .name = MAXIM_DEV0_NAME,
145                 .dai_name = KBL_MAXIM_CODEC_DAI,
146         },
147         { /* Right */
148                 .name = MAXIM_DEV1_NAME,
149                 .dai_name = KBL_MAXIM_CODEC_DAI,
150         },
151         { /*dmic */
152                 .name = RT5514_DEV_NAME,
153                 .dai_name = KBL_REALTEK_DMIC_CODEC_DAI,
154         },
155 };
156
157 static int kabylake_rt5663_fe_init(struct snd_soc_pcm_runtime *rtd)
158 {
159         struct snd_soc_dapm_context *dapm;
160         struct snd_soc_component *component = rtd->cpu_dai->component;
161         int ret;
162
163         dapm = snd_soc_component_get_dapm(component);
164         ret = snd_soc_dapm_ignore_suspend(dapm, "Reference Capture");
165         if (ret)
166                 dev_err(rtd->dev, "Ref Cap -Ignore suspend failed = %d\n", ret);
167
168         return ret;
169 }
170
171 static int kabylake_rt5663_codec_init(struct snd_soc_pcm_runtime *rtd)
172 {
173         int ret;
174         struct kbl_codec_private *ctx = snd_soc_card_get_drvdata(rtd->card);
175         struct snd_soc_codec *codec = rtd->codec;
176
177         /*
178          * Headset buttons map to the google Reference headset.
179          * These can be configured by userspace.
180          */
181         ret = snd_soc_card_jack_new(&kabylake_audio_card, "Headset Jack",
182                         SND_JACK_HEADSET | SND_JACK_BTN_0 | SND_JACK_BTN_1 |
183                         SND_JACK_BTN_2 | SND_JACK_BTN_3, &ctx->kabylake_headset,
184                         NULL, 0);
185         if (ret) {
186                 dev_err(rtd->dev, "Headset Jack creation failed %d\n", ret);
187                 return ret;
188         }
189
190         rt5663_set_jack_detect(codec, &ctx->kabylake_headset);
191
192         ret = snd_soc_dapm_ignore_suspend(&rtd->card->dapm, "DMIC");
193         if (ret)
194                 dev_err(rtd->dev, "DMIC - Ignore suspend failed = %d\n", ret);
195
196         return ret;
197 }
198
199 static int kabylake_hdmi_init(struct snd_soc_pcm_runtime *rtd, int device)
200 {
201         struct kbl_codec_private *ctx = snd_soc_card_get_drvdata(rtd->card);
202         struct snd_soc_dai *dai = rtd->codec_dai;
203         struct kbl_hdmi_pcm *pcm;
204
205         pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL);
206         if (!pcm)
207                 return -ENOMEM;
208
209         pcm->device = device;
210         pcm->codec_dai = dai;
211
212         list_add_tail(&pcm->head, &ctx->hdmi_pcm_list);
213
214         return 0;
215 }
216
217 static int kabylake_hdmi1_init(struct snd_soc_pcm_runtime *rtd)
218 {
219         return kabylake_hdmi_init(rtd, KBL_DPCM_AUDIO_HDMI1_PB);
220 }
221
222 static int kabylake_hdmi2_init(struct snd_soc_pcm_runtime *rtd)
223 {
224         return kabylake_hdmi_init(rtd, KBL_DPCM_AUDIO_HDMI2_PB);
225 }
226
227 static const unsigned int rates[] = {
228         48000,
229 };
230
231 static const struct snd_pcm_hw_constraint_list constraints_rates = {
232         .count = ARRAY_SIZE(rates),
233         .list  = rates,
234         .mask = 0,
235 };
236
237 static const unsigned int channels[] = {
238         2,
239 };
240
241 static const struct snd_pcm_hw_constraint_list constraints_channels = {
242         .count = ARRAY_SIZE(channels),
243         .list = channels,
244         .mask = 0,
245 };
246
247 static int kbl_fe_startup(struct snd_pcm_substream *substream)
248 {
249         struct snd_pcm_runtime *runtime = substream->runtime;
250
251         /*
252          * On this platform for PCM device we support,
253          * 48Khz
254          * stereo
255          * 16 bit audio
256          */
257
258         runtime->hw.channels_max = 2;
259         snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
260                                            &constraints_channels);
261
262         runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE;
263         snd_pcm_hw_constraint_msbits(runtime, 0, 16, 16);
264
265         snd_pcm_hw_constraint_list(runtime, 0,
266                                 SNDRV_PCM_HW_PARAM_RATE, &constraints_rates);
267
268         return 0;
269 }
270
271 static const struct snd_soc_ops kabylake_rt5663_fe_ops = {
272         .startup = kbl_fe_startup,
273 };
274
275 static int kabylake_ssp_fixup(struct snd_soc_pcm_runtime *rtd,
276                                         struct snd_pcm_hw_params *params)
277 {
278         struct snd_interval *rate = hw_param_interval(params,
279                         SNDRV_PCM_HW_PARAM_RATE);
280         struct snd_interval *channels = hw_param_interval(params,
281                         SNDRV_PCM_HW_PARAM_CHANNELS);
282         struct snd_mask *fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
283         struct snd_soc_dpcm *dpcm = container_of(
284                         params, struct snd_soc_dpcm, hw_params);
285         struct snd_soc_dai_link *fe_dai_link = dpcm->fe->dai_link;
286         struct snd_soc_dai_link *be_dai_link = dpcm->be->dai_link;
287
288         /*
289          * The ADSP will convert the FE rate to 48k, stereo, 24 bit
290          */
291         if (!strcmp(fe_dai_link->name, "Kbl Audio Port") ||
292             !strcmp(fe_dai_link->name, "Kbl Audio Capture Port")) {
293                 rate->min = rate->max = 48000;
294                 channels->min = channels->max = 2;
295                 snd_mask_none(fmt);
296                 snd_mask_set(fmt, SNDRV_PCM_FORMAT_S24_LE);
297         } else if (!strcmp(fe_dai_link->name, "Kbl Audio DMIC cap")) {
298                 if (params_channels(params) == 2 ||
299                                 DMIC_CH(dmic_constraints) == 2)
300                         channels->min = channels->max = 2;
301                 else
302                         channels->min = channels->max = 4;
303         }
304         /*
305          * The speaker on the SSP0 supports S16_LE and not S24_LE.
306          * thus changing the mask here
307          */
308         if (!strcmp(be_dai_link->name, "SSP0-Codec"))
309                 snd_mask_set(fmt, SNDRV_PCM_FORMAT_S16_LE);
310
311         return 0;
312 }
313
314 static int kabylake_rt5663_hw_params(struct snd_pcm_substream *substream,
315         struct snd_pcm_hw_params *params)
316 {
317         struct snd_soc_pcm_runtime *rtd = substream->private_data;
318         struct snd_soc_dai *codec_dai = rtd->codec_dai;
319         int ret;
320
321         /* use ASRC for internal clocks, as PLL rate isn't multiple of BCLK */
322         rt5663_sel_asrc_clk_src(codec_dai->codec,
323                         RT5663_DA_STEREO_FILTER | RT5663_AD_STEREO_FILTER,
324                         RT5663_CLK_SEL_I2S1_ASRC);
325
326         ret = snd_soc_dai_set_sysclk(codec_dai,
327                         RT5663_SCLK_S_MCLK, 24576000, SND_SOC_CLOCK_IN);
328         if (ret < 0)
329                 dev_err(rtd->dev, "snd_soc_dai_set_sysclk err = %d\n", ret);
330
331         return ret;
332 }
333
334 static struct snd_soc_ops kabylake_rt5663_ops = {
335         .hw_params = kabylake_rt5663_hw_params,
336 };
337
338 static int kabylake_ssp0_hw_params(struct snd_pcm_substream *substream,
339         struct snd_pcm_hw_params *params)
340 {
341         struct snd_soc_pcm_runtime *rtd = substream->private_data;
342         int ret = 0, j;
343
344         for (j = 0; j < rtd->num_codecs; j++) {
345                 struct snd_soc_dai *codec_dai = rtd->codec_dais[j];
346
347                 if (!strcmp(codec_dai->component->name, RT5514_DEV_NAME)) {
348                         ret = snd_soc_dai_set_tdm_slot(codec_dai, 0xF, 0, 8, 16);
349                         if (ret < 0) {
350                                 dev_err(rtd->dev, "set TDM slot err:%d\n", ret);
351                                 return ret;
352                         }
353
354                         ret = snd_soc_dai_set_pll(codec_dai, 0,
355                                 RT5514_PLL1_S_BCLK, RT5514_AIF1_BCLK_FREQ,
356                                                 RT5514_AIF1_SYSCLK_FREQ);
357                         if (ret < 0) {
358                                 dev_err(rtd->dev, "set bclk err: %d\n", ret);
359                                 return ret;
360                         }
361
362                         ret = snd_soc_dai_set_sysclk(codec_dai,
363                                 RT5514_SCLK_S_PLL1, RT5514_AIF1_SYSCLK_FREQ,
364                                                         SND_SOC_CLOCK_IN);
365                         if (ret < 0) {
366                                 dev_err(rtd->dev, "set sclk err: %d\n", ret);
367                                 return ret;
368                         }
369                 }
370                 if (!strcmp(codec_dai->component->name, MAXIM_DEV0_NAME) ||
371                         !strcmp(codec_dai->component->name, MAXIM_DEV1_NAME)) {
372                         ret = snd_soc_dai_set_tdm_slot(codec_dai, 0xF0, 3, 8, 16);
373                         if (ret < 0) {
374                                 dev_err(rtd->dev, "set TDM slot err:%d\n", ret);
375                                 return ret;
376                         }
377                 }
378         }
379         return ret;
380 }
381
382 static struct snd_soc_ops kabylake_ssp0_ops = {
383         .hw_params = kabylake_ssp0_hw_params,
384 };
385
386 static const unsigned int channels_dmic[] = {
387         4,
388 };
389
390 static const struct snd_pcm_hw_constraint_list constraints_dmic_channels = {
391         .count = ARRAY_SIZE(channels_dmic),
392         .list = channels_dmic,
393         .mask = 0,
394 };
395
396 static const unsigned int dmic_2ch[] = {
397         4,
398 };
399
400 static const struct snd_pcm_hw_constraint_list constraints_dmic_2ch = {
401         .count = ARRAY_SIZE(dmic_2ch),
402         .list = dmic_2ch,
403         .mask = 0,
404 };
405
406 static int kabylake_dmic_startup(struct snd_pcm_substream *substream)
407 {
408         struct snd_pcm_runtime *runtime = substream->runtime;
409
410         runtime->hw.channels_max = DMIC_CH(dmic_constraints);
411         snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
412                         dmic_constraints);
413
414         return snd_pcm_hw_constraint_list(substream->runtime, 0,
415                         SNDRV_PCM_HW_PARAM_RATE, &constraints_rates);
416 }
417
418 static struct snd_soc_ops kabylake_dmic_ops = {
419         .startup = kabylake_dmic_startup,
420 };
421
422 /* kabylake digital audio interface glue - connects codec <--> CPU */
423 static struct snd_soc_dai_link kabylake_dais[] = {
424         /* Front End DAI links */
425         [KBL_DPCM_AUDIO_PB] = {
426                 .name = "Kbl Audio Port",
427                 .stream_name = "Audio",
428                 .cpu_dai_name = "System Pin",
429                 .platform_name = "0000:00:1f.3",
430                 .dynamic = 1,
431                 .codec_name = "snd-soc-dummy",
432                 .codec_dai_name = "snd-soc-dummy-dai",
433                 .nonatomic = 1,
434                 .init = kabylake_rt5663_fe_init,
435                 .trigger = {
436                         SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
437                 .dpcm_playback = 1,
438                 .ops = &kabylake_rt5663_fe_ops,
439         },
440         [KBL_DPCM_AUDIO_CP] = {
441                 .name = "Kbl Audio Capture Port",
442                 .stream_name = "Audio Record",
443                 .cpu_dai_name = "System Pin",
444                 .platform_name = "0000:00:1f.3",
445                 .dynamic = 1,
446                 .codec_name = "snd-soc-dummy",
447                 .codec_dai_name = "snd-soc-dummy-dai",
448                 .nonatomic = 1,
449                 .trigger = {
450                         SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
451                 .dpcm_capture = 1,
452                 .ops = &kabylake_rt5663_fe_ops,
453         },
454         [KBL_DPCM_AUDIO_DMIC_CP] = {
455                 .name = "Kbl Audio DMIC cap",
456                 .stream_name = "dmiccap",
457                 .cpu_dai_name = "DMIC Pin",
458                 .codec_name = "snd-soc-dummy",
459                 .codec_dai_name = "snd-soc-dummy-dai",
460                 .platform_name = "0000:00:1f.3",
461                 .init = NULL,
462                 .dpcm_capture = 1,
463                 .nonatomic = 1,
464                 .dynamic = 1,
465                 .ops = &kabylake_dmic_ops,
466         },
467         [KBL_DPCM_AUDIO_HDMI1_PB] = {
468                 .name = "Kbl HDMI Port1",
469                 .stream_name = "Hdmi1",
470                 .cpu_dai_name = "HDMI1 Pin",
471                 .codec_name = "snd-soc-dummy",
472                 .codec_dai_name = "snd-soc-dummy-dai",
473                 .platform_name = "0000:00:1f.3",
474                 .dpcm_playback = 1,
475                 .init = NULL,
476                 .trigger = {
477                         SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
478                 .nonatomic = 1,
479                 .dynamic = 1,
480         },
481         [KBL_DPCM_AUDIO_HDMI2_PB] = {
482                 .name = "Kbl HDMI Port2",
483                 .stream_name = "Hdmi2",
484                 .cpu_dai_name = "HDMI2 Pin",
485                 .codec_name = "snd-soc-dummy",
486                 .codec_dai_name = "snd-soc-dummy-dai",
487                 .platform_name = "0000:00:1f.3",
488                 .dpcm_playback = 1,
489                 .init = NULL,
490                 .trigger = {
491                         SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
492                 .nonatomic = 1,
493                 .dynamic = 1,
494         },
495         /* Back End DAI links */
496         /* single Back end dai for both max speakers and dmic */
497         {
498                 /* SSP0 - Codec */
499                 .name = "SSP0-Codec",
500                 .id = 0,
501                 .cpu_dai_name = "SSP0 Pin",
502                 .platform_name = "0000:00:1f.3",
503                 .no_pcm = 1,
504                 .codecs = ssp0_codec_components,
505                 .num_codecs = ARRAY_SIZE(ssp0_codec_components),
506                 .dai_fmt = SND_SOC_DAIFMT_DSP_B |
507                         SND_SOC_DAIFMT_NB_NF |
508                         SND_SOC_DAIFMT_CBS_CFS,
509                 .ignore_pmdown_time = 1,
510                 .be_hw_params_fixup = kabylake_ssp_fixup,
511                 .dpcm_playback = 1,
512                 .dpcm_capture = 1,
513                 .ops = &kabylake_ssp0_ops,
514         },
515         {
516                 .name = "SSP1-Codec",
517                 .id = 1,
518                 .cpu_dai_name = "SSP1 Pin",
519                 .platform_name = "0000:00:1f.3",
520                 .no_pcm = 1,
521                 .codec_name = RT5663_DEV_NAME,
522                 .codec_dai_name = KBL_REALTEK_CODEC_DAI,
523                 .init = kabylake_rt5663_codec_init,
524                 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
525                         SND_SOC_DAIFMT_CBS_CFS,
526                 .ignore_pmdown_time = 1,
527                 .be_hw_params_fixup = kabylake_ssp_fixup,
528                 .ops = &kabylake_rt5663_ops,
529                 .dpcm_playback = 1,
530                 .dpcm_capture = 1,
531         },
532         {
533                 .name = "iDisp1",
534                 .id = 3,
535                 .cpu_dai_name = "iDisp1 Pin",
536                 .codec_name = "ehdaudio0D2",
537                 .codec_dai_name = "intel-hdmi-hifi1",
538                 .platform_name = "0000:00:1f.3",
539                 .dpcm_playback = 1,
540                 .init = kabylake_hdmi1_init,
541                 .no_pcm = 1,
542         },
543         {
544                 .name = "iDisp2",
545                 .id = 4,
546                 .cpu_dai_name = "iDisp2 Pin",
547                 .codec_name = "ehdaudio0D2",
548                 .codec_dai_name = "intel-hdmi-hifi2",
549                 .platform_name = "0000:00:1f.3",
550                 .init = kabylake_hdmi2_init,
551                 .dpcm_playback = 1,
552                 .no_pcm = 1,
553         },
554 };
555
556 static int kabylake_card_late_probe(struct snd_soc_card *card)
557 {
558         struct kbl_codec_private *ctx = snd_soc_card_get_drvdata(card);
559         struct kbl_hdmi_pcm *pcm;
560         int err, i = 0;
561         char jack_name[NAME_SIZE];
562
563         list_for_each_entry(pcm, &ctx->hdmi_pcm_list, head) {
564                 err = snd_soc_card_jack_new(card, jack_name,
565                                 SND_JACK_AVOUT, &ctx->kabylake_hdmi[i],
566                                 NULL, 0);
567
568                 if (err)
569                         return err;
570                 err = hdac_hdmi_jack_init(pcm->codec_dai, pcm->device,
571                                                 &ctx->kabylake_hdmi[i]);
572                 if (err < 0)
573                         return err;
574                 i++;
575         }
576
577         return 0;
578 }
579
580 /*
581  * kabylake audio machine driver for  MAX98927 + RT5514 + RT5663
582  */
583 static struct snd_soc_card kabylake_audio_card = {
584         .name = "kbl_r5514_5663_max",
585         .owner = THIS_MODULE,
586         .dai_link = kabylake_dais,
587         .num_links = ARRAY_SIZE(kabylake_dais),
588         .controls = kabylake_controls,
589         .num_controls = ARRAY_SIZE(kabylake_controls),
590         .dapm_widgets = kabylake_widgets,
591         .num_dapm_widgets = ARRAY_SIZE(kabylake_widgets),
592         .dapm_routes = kabylake_map,
593         .num_dapm_routes = ARRAY_SIZE(kabylake_map),
594         .codec_conf = max98927_codec_conf,
595         .num_configs = ARRAY_SIZE(max98927_codec_conf),
596         .fully_routed = true,
597         .late_probe = kabylake_card_late_probe,
598 };
599
600 static int kabylake_audio_probe(struct platform_device *pdev)
601 {
602         struct kbl_codec_private *ctx;
603         struct skl_machine_pdata *pdata;
604
605         ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_ATOMIC);
606         if (!ctx)
607                 return -ENOMEM;
608
609         INIT_LIST_HEAD(&ctx->hdmi_pcm_list);
610
611         kabylake_audio_card.dev = &pdev->dev;
612         snd_soc_card_set_drvdata(&kabylake_audio_card, ctx);
613
614         pdata = dev_get_drvdata(&pdev->dev);
615         if (pdata)
616                 dmic_constraints = pdata->dmic_num == 2 ?
617                         &constraints_dmic_2ch : &constraints_dmic_channels;
618
619         return devm_snd_soc_register_card(&pdev->dev, &kabylake_audio_card);
620 }
621
622 static const struct platform_device_id kbl_board_ids[] = {
623         { .name = "kbl_r5514_5663_max" },
624         { }
625 };
626
627 static struct platform_driver kabylake_audio = {
628         .probe = kabylake_audio_probe,
629         .driver = {
630                 .name = "kbl_r5514_5663_max",
631                 .pm = &snd_soc_pm_ops,
632         },
633         .id_table = kbl_board_ids,
634 };
635
636 module_platform_driver(kabylake_audio)
637
638 /* Module information */
639 MODULE_DESCRIPTION("Audio Machine driver-RT5663 RT5514 & MAX98927");
640 MODULE_AUTHOR("Harsha Priya <harshapriya.n@intel.com>");
641 MODULE_LICENSE("GPL v2");
642 MODULE_ALIAS("platform:kbl_r5514_5663_max");