1 // SPDX-License-Identifier: GPL-2.0-only
2 // Copyright(c) 2018 Intel Corporation.
3 
4 /*
5  * Intel Kabylake I2S Machine Driver with MAX98927, MAX98373 & DA7219 Codecs
6  *
7  * Modified from:
8  *   Intel Kabylake I2S Machine driver supporting MAX98927 and
9  *   RT5663 codecs
10  */
11 
12 #include <linux/input.h>
13 #include <linux/module.h>
14 #include <linux/platform_device.h>
15 #include <sound/core.h>
16 #include <sound/jack.h>
17 #include <sound/pcm.h>
18 #include <sound/pcm_params.h>
19 #include <sound/soc.h>
20 #include "../../codecs/da7219.h"
21 #include "../../codecs/hdac_hdmi.h"
22 
23 #define KBL_DIALOG_CODEC_DAI	"da7219-hifi"
24 #define MAX98927_CODEC_DAI	"max98927-aif1"
25 #define MAX98927_DEV0_NAME	"i2c-MX98927:00"
26 #define MAX98927_DEV1_NAME	"i2c-MX98927:01"
27 
28 #define MAX98373_CODEC_DAI	"max98373-aif1"
29 #define MAX98373_DEV0_NAME	"i2c-MX98373:00"
30 #define MAX98373_DEV1_NAME	"i2c-MX98373:01"
31 
32 
33 #define DUAL_CHANNEL	2
34 #define QUAD_CHANNEL	4
35 #define NAME_SIZE	32
36 
37 static struct snd_soc_card *kabylake_audio_card;
38 static struct snd_soc_jack kabylake_hdmi[3];
39 
40 struct kbl_hdmi_pcm {
41 	struct list_head head;
42 	struct snd_soc_dai *codec_dai;
43 	int device;
44 };
45 
46 struct kbl_codec_private {
47 	struct snd_soc_jack kabylake_headset;
48 	struct list_head hdmi_pcm_list;
49 };
50 
51 enum {
52 	KBL_DPCM_AUDIO_PB = 0,
53 	KBL_DPCM_AUDIO_ECHO_REF_CP,
54 	KBL_DPCM_AUDIO_REF_CP,
55 	KBL_DPCM_AUDIO_DMIC_CP,
56 	KBL_DPCM_AUDIO_HDMI1_PB,
57 	KBL_DPCM_AUDIO_HDMI2_PB,
58 	KBL_DPCM_AUDIO_HDMI3_PB,
59 	KBL_DPCM_AUDIO_HS_PB,
60 	KBL_DPCM_AUDIO_CP,
61 };
62 
63 static int platform_clock_control(struct snd_soc_dapm_widget *w,
64 					struct snd_kcontrol *k, int  event)
65 {
66 	struct snd_soc_dapm_context *dapm = w->dapm;
67 	struct snd_soc_card *card = dapm->card;
68 	struct snd_soc_dai *codec_dai;
69 	int ret = 0;
70 
71 	codec_dai = snd_soc_card_get_codec_dai(card, KBL_DIALOG_CODEC_DAI);
72 	if (!codec_dai) {
73 		dev_err(card->dev, "Codec dai not found; Unable to set/unset codec pll\n");
74 		return -EIO;
75 	}
76 
77 	/* Configure sysclk for codec */
78 	ret = snd_soc_dai_set_sysclk(codec_dai, DA7219_CLKSRC_MCLK, 24576000,
79 				     SND_SOC_CLOCK_IN);
80 	if (ret) {
81 		dev_err(card->dev, "can't set codec sysclk configuration\n");
82 		return ret;
83 	}
84 
85 	if (SND_SOC_DAPM_EVENT_OFF(event)) {
86 		ret = snd_soc_dai_set_pll(codec_dai, 0,
87 				     DA7219_SYSCLK_MCLK, 0, 0);
88 		if (ret)
89 			dev_err(card->dev, "failed to stop PLL: %d\n", ret);
90 	} else if (SND_SOC_DAPM_EVENT_ON(event)) {
91 		ret = snd_soc_dai_set_pll(codec_dai, 0,	DA7219_SYSCLK_PLL_SRM,
92 				     0, DA7219_PLL_FREQ_OUT_98304);
93 		if (ret)
94 			dev_err(card->dev, "failed to start PLL: %d\n", ret);
95 	}
96 
97 	return ret;
98 }
99 
100 static const struct snd_kcontrol_new kabylake_controls[] = {
101 	SOC_DAPM_PIN_SWITCH("Headphone Jack"),
102 	SOC_DAPM_PIN_SWITCH("Headset Mic"),
103 	SOC_DAPM_PIN_SWITCH("Left Spk"),
104 	SOC_DAPM_PIN_SWITCH("Right Spk"),
105 };
106 
107 static const struct snd_soc_dapm_widget kabylake_widgets[] = {
108 	SND_SOC_DAPM_HP("Headphone Jack", NULL),
109 	SND_SOC_DAPM_MIC("Headset Mic", NULL),
110 	SND_SOC_DAPM_SPK("Left Spk", NULL),
111 	SND_SOC_DAPM_SPK("Right Spk", NULL),
112 	SND_SOC_DAPM_MIC("SoC DMIC", NULL),
113 	SND_SOC_DAPM_SPK("HDMI1", NULL),
114 	SND_SOC_DAPM_SPK("HDMI2", NULL),
115 	SND_SOC_DAPM_SPK("HDMI3", NULL),
116 	SND_SOC_DAPM_SUPPLY("Platform Clock", SND_SOC_NOPM, 0, 0,
117 			platform_clock_control, SND_SOC_DAPM_PRE_PMU |
118 			SND_SOC_DAPM_POST_PMD),
119 };
120 
121 static struct snd_soc_jack_pin jack_pins[] = {
122 	{
123 		.pin    = "Headphone Jack",
124 		.mask   = SND_JACK_HEADPHONE,
125 	},
126 	{
127 		.pin    = "Headset Mic",
128 		.mask   = SND_JACK_MICROPHONE,
129 	},
130 };
131 
132 static const struct snd_soc_dapm_route kabylake_map[] = {
133 	/* speaker */
134 	{ "Left Spk", NULL, "Left BE_OUT" },
135 	{ "Right Spk", NULL, "Right BE_OUT" },
136 
137 	/* other jacks */
138 	{ "DMic", NULL, "SoC DMIC" },
139 
140 	{"HDMI1", NULL, "hif5-0 Output"},
141 	{"HDMI2", NULL, "hif6-0 Output"},
142 	{"HDMI3", NULL, "hif7-0 Output"},
143 
144 	/* CODEC BE connections */
145 	{ "Left HiFi Playback", NULL, "ssp0 Tx" },
146 	{ "Right HiFi Playback", NULL, "ssp0 Tx" },
147 	{ "ssp0 Tx", NULL, "spk_out" },
148 
149 	/* IV feedback path */
150 	{ "codec0_fb_in", NULL, "ssp0 Rx"},
151 	{ "ssp0 Rx", NULL, "Left HiFi Capture" },
152 	{ "ssp0 Rx", NULL, "Right HiFi Capture" },
153 
154 	/* AEC capture path */
155 	{ "echo_ref_out", NULL, "ssp0 Rx" },
156 
157 	/* DMIC */
158 	{ "dmic01_hifi", NULL, "DMIC01 Rx" },
159 	{ "DMIC01 Rx", NULL, "DMIC AIF" },
160 
161 	{ "hifi1", NULL, "iDisp1 Tx" },
162 	{ "iDisp1 Tx", NULL, "iDisp1_out" },
163 	{ "hifi2", NULL, "iDisp2 Tx" },
164 	{ "iDisp2 Tx", NULL, "iDisp2_out" },
165 	{ "hifi3", NULL, "iDisp3 Tx"},
166 	{ "iDisp3 Tx", NULL, "iDisp3_out"},
167 };
168 
169 static const struct snd_soc_dapm_route kabylake_ssp1_map[] = {
170 	{ "Headphone Jack", NULL, "HPL" },
171 	{ "Headphone Jack", NULL, "HPR" },
172 
173 	/* other jacks */
174 	{ "MIC", NULL, "Headset Mic" },
175 
176 	/* CODEC BE connections */
177 	{ "Playback", NULL, "ssp1 Tx" },
178 	{ "ssp1 Tx", NULL, "codec1_out" },
179 
180 	{ "hs_in", NULL, "ssp1 Rx" },
181 	{ "ssp1 Rx", NULL, "Capture" },
182 
183 	{ "Headphone Jack", NULL, "Platform Clock" },
184 	{ "Headset Mic", NULL, "Platform Clock" },
185 };
186 
187 static int kabylake_ssp0_hw_params(struct snd_pcm_substream *substream,
188 	struct snd_pcm_hw_params *params)
189 {
190 	struct snd_soc_pcm_runtime *runtime = asoc_substream_to_rtd(substream);
191 	struct snd_soc_dai *codec_dai;
192 	int ret, j;
193 
194 	for_each_rtd_codec_dais(runtime, j, codec_dai) {
195 
196 		if (!strcmp(codec_dai->component->name, MAX98927_DEV0_NAME)) {
197 			ret = snd_soc_dai_set_tdm_slot(codec_dai, 0x30, 3, 8, 16);
198 			if (ret < 0) {
199 				dev_err(runtime->dev, "DEV0 TDM slot err:%d\n", ret);
200 				return ret;
201 			}
202 		}
203 		if (!strcmp(codec_dai->component->name, MAX98927_DEV1_NAME)) {
204 			ret = snd_soc_dai_set_tdm_slot(codec_dai, 0xC0, 3, 8, 16);
205 			if (ret < 0) {
206 				dev_err(runtime->dev, "DEV1 TDM slot err:%d\n", ret);
207 				return ret;
208 			}
209 		}
210 		if (!strcmp(codec_dai->component->name, MAX98373_DEV0_NAME)) {
211 			ret = snd_soc_dai_set_tdm_slot(codec_dai,
212 							0x30, 3, 8, 16);
213 			if (ret < 0) {
214 				dev_err(runtime->dev,
215 						"DEV0 TDM slot err:%d\n", ret);
216 				return ret;
217 			}
218 		}
219 		if (!strcmp(codec_dai->component->name, MAX98373_DEV1_NAME)) {
220 			ret = snd_soc_dai_set_tdm_slot(codec_dai,
221 							0xC0, 3, 8, 16);
222 			if (ret < 0) {
223 				dev_err(runtime->dev,
224 						"DEV1 TDM slot err:%d\n", ret);
225 				return ret;
226 			}
227 		}
228 	}
229 
230 	return 0;
231 }
232 
233 static int kabylake_ssp0_trigger(struct snd_pcm_substream *substream, int cmd)
234 {
235 	struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
236 	struct snd_soc_dai *codec_dai;
237 	int j, ret;
238 
239 	for_each_rtd_codec_dais(rtd, j, codec_dai) {
240 		const char *name = codec_dai->component->name;
241 		struct snd_soc_component *component = codec_dai->component;
242 		struct snd_soc_dapm_context *dapm =
243 				snd_soc_component_get_dapm(component);
244 		char pin_name[20];
245 
246 		if (strcmp(name, MAX98927_DEV0_NAME) &&
247 			strcmp(name, MAX98927_DEV1_NAME) &&
248 			strcmp(name, MAX98373_DEV0_NAME) &&
249 			strcmp(name, MAX98373_DEV1_NAME))
250 			continue;
251 
252 		snprintf(pin_name, ARRAY_SIZE(pin_name), "%s Spk",
253 			codec_dai->component->name_prefix);
254 
255 		switch (cmd) {
256 		case SNDRV_PCM_TRIGGER_START:
257 		case SNDRV_PCM_TRIGGER_RESUME:
258 		case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
259 			ret = snd_soc_dapm_enable_pin(dapm, pin_name);
260 			if (ret) {
261 				dev_err(rtd->dev, "failed to enable %s: %d\n",
262 				pin_name, ret);
263 				return ret;
264 			}
265 			snd_soc_dapm_sync(dapm);
266 			break;
267 		case SNDRV_PCM_TRIGGER_STOP:
268 		case SNDRV_PCM_TRIGGER_SUSPEND:
269 		case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
270 			ret = snd_soc_dapm_disable_pin(dapm, pin_name);
271 			if (ret) {
272 				dev_err(rtd->dev, "failed to disable %s: %d\n",
273 				pin_name, ret);
274 				return ret;
275 			}
276 			snd_soc_dapm_sync(dapm);
277 			break;
278 		}
279 	}
280 
281 	return 0;
282 }
283 
284 static struct snd_soc_ops kabylake_ssp0_ops = {
285 	.hw_params = kabylake_ssp0_hw_params,
286 	.trigger = kabylake_ssp0_trigger,
287 };
288 
289 static int kabylake_ssp_fixup(struct snd_soc_pcm_runtime *rtd,
290 			struct snd_pcm_hw_params *params)
291 {
292 	struct snd_interval *rate = hw_param_interval(params,
293 			SNDRV_PCM_HW_PARAM_RATE);
294 	struct snd_interval *chan = hw_param_interval(params,
295 			SNDRV_PCM_HW_PARAM_CHANNELS);
296 	struct snd_mask *fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
297 	struct snd_soc_dpcm *dpcm, *rtd_dpcm = NULL;
298 
299 	/*
300 	 * The following loop will be called only for playback stream
301 	 * In this platform, there is only one playback device on every SSP
302 	 */
303 	for_each_dpcm_fe(rtd, SNDRV_PCM_STREAM_PLAYBACK, dpcm) {
304 		rtd_dpcm = dpcm;
305 		break;
306 	}
307 
308 	/*
309 	 * This following loop will be called only for capture stream
310 	 * In this platform, there is only one capture device on every SSP
311 	 */
312 	for_each_dpcm_fe(rtd, SNDRV_PCM_STREAM_CAPTURE, dpcm) {
313 		rtd_dpcm = dpcm;
314 		break;
315 	}
316 
317 	if (!rtd_dpcm)
318 		return -EINVAL;
319 
320 	/*
321 	 * The above 2 loops are mutually exclusive based on the stream direction,
322 	 * thus rtd_dpcm variable will never be overwritten
323 	 */
324 
325 	/*
326 	 * The ADSP will convert the FE rate to 48k, stereo, 24 bit
327 	 */
328 	if (!strcmp(rtd_dpcm->fe->dai_link->name, "Kbl Audio Port") ||
329 	    !strcmp(rtd_dpcm->fe->dai_link->name, "Kbl Audio Headset Playback") ||
330 	    !strcmp(rtd_dpcm->fe->dai_link->name, "Kbl Audio Capture Port")) {
331 		rate->min = rate->max = 48000;
332 		chan->min = chan->max = 2;
333 		snd_mask_none(fmt);
334 		snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S24_LE);
335 	}
336 
337 	/*
338 	 * The speaker on the SSP0 supports S16_LE and not S24_LE.
339 	 * thus changing the mask here
340 	 */
341 	if (!strcmp(rtd_dpcm->be->dai_link->name, "SSP0-Codec"))
342 		snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S16_LE);
343 
344 	return 0;
345 }
346 
347 static int kabylake_da7219_codec_init(struct snd_soc_pcm_runtime *rtd)
348 {
349 	struct kbl_codec_private *ctx = snd_soc_card_get_drvdata(rtd->card);
350 	struct snd_soc_component *component = asoc_rtd_to_codec(rtd, 0)->component;
351 	struct snd_soc_jack *jack;
352 	struct snd_soc_card *card = rtd->card;
353 	int ret;
354 
355 
356 	ret = snd_soc_dapm_add_routes(&card->dapm,
357 			kabylake_ssp1_map,
358 			ARRAY_SIZE(kabylake_ssp1_map));
359 
360 	if (ret)
361 		return ret;
362 
363 	/*
364 	 * Headset buttons map to the google Reference headset.
365 	 * These can be configured by userspace.
366 	 */
367 	ret = snd_soc_card_jack_new_pins(kabylake_audio_card, "Headset Jack",
368 					 SND_JACK_HEADSET | SND_JACK_BTN_0 | SND_JACK_BTN_1 |
369 					 SND_JACK_BTN_2 | SND_JACK_BTN_3 | SND_JACK_LINEOUT,
370 					 &ctx->kabylake_headset,
371 					 jack_pins,
372 					 ARRAY_SIZE(jack_pins));
373 	if (ret) {
374 		dev_err(rtd->dev, "Headset Jack creation failed: %d\n", ret);
375 		return ret;
376 	}
377 
378 	jack = &ctx->kabylake_headset;
379 	snd_jack_set_key(jack->jack, SND_JACK_BTN_0, KEY_PLAYPAUSE);
380 	snd_jack_set_key(jack->jack, SND_JACK_BTN_1, KEY_VOLUMEUP);
381 	snd_jack_set_key(jack->jack, SND_JACK_BTN_2, KEY_VOLUMEDOWN);
382 	snd_jack_set_key(jack->jack, SND_JACK_BTN_3, KEY_VOICECOMMAND);
383 
384 	snd_soc_component_set_jack(component, &ctx->kabylake_headset, NULL);
385 
386 	return 0;
387 }
388 
389 static int kabylake_dmic_init(struct snd_soc_pcm_runtime *rtd)
390 {
391 	int ret;
392 	ret = snd_soc_dapm_ignore_suspend(&rtd->card->dapm, "SoC DMIC");
393 	if (ret)
394 		dev_err(rtd->dev, "SoC DMIC - Ignore suspend failed %d\n", ret);
395 
396 	return ret;
397 }
398 
399 static int kabylake_hdmi_init(struct snd_soc_pcm_runtime *rtd, int device)
400 {
401 	struct kbl_codec_private *ctx = snd_soc_card_get_drvdata(rtd->card);
402 	struct snd_soc_dai *dai = asoc_rtd_to_codec(rtd, 0);
403 	struct kbl_hdmi_pcm *pcm;
404 
405 	pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL);
406 	if (!pcm)
407 		return -ENOMEM;
408 
409 	pcm->device = device;
410 	pcm->codec_dai = dai;
411 
412 	list_add_tail(&pcm->head, &ctx->hdmi_pcm_list);
413 
414 	return 0;
415 }
416 
417 static int kabylake_hdmi1_init(struct snd_soc_pcm_runtime *rtd)
418 {
419 	return kabylake_hdmi_init(rtd, KBL_DPCM_AUDIO_HDMI1_PB);
420 }
421 
422 static int kabylake_hdmi2_init(struct snd_soc_pcm_runtime *rtd)
423 {
424 	return kabylake_hdmi_init(rtd, KBL_DPCM_AUDIO_HDMI2_PB);
425 }
426 
427 static int kabylake_hdmi3_init(struct snd_soc_pcm_runtime *rtd)
428 {
429 	return kabylake_hdmi_init(rtd, KBL_DPCM_AUDIO_HDMI3_PB);
430 }
431 
432 static int kabylake_da7219_fe_init(struct snd_soc_pcm_runtime *rtd)
433 {
434 	struct snd_soc_dapm_context *dapm;
435 	struct snd_soc_component *component = asoc_rtd_to_cpu(rtd, 0)->component;
436 
437 	dapm = snd_soc_component_get_dapm(component);
438 	snd_soc_dapm_ignore_suspend(dapm, "Reference Capture");
439 
440 	return 0;
441 }
442 
443 static const unsigned int rates[] = {
444 	48000,
445 };
446 
447 static const struct snd_pcm_hw_constraint_list constraints_rates = {
448 	.count = ARRAY_SIZE(rates),
449 	.list  = rates,
450 	.mask = 0,
451 };
452 
453 static const unsigned int channels[] = {
454 	DUAL_CHANNEL,
455 };
456 
457 static const struct snd_pcm_hw_constraint_list constraints_channels = {
458 	.count = ARRAY_SIZE(channels),
459 	.list = channels,
460 	.mask = 0,
461 };
462 
463 static unsigned int channels_quad[] = {
464 	QUAD_CHANNEL,
465 };
466 
467 static struct snd_pcm_hw_constraint_list constraints_channels_quad = {
468 	.count = ARRAY_SIZE(channels_quad),
469 	.list = channels_quad,
470 	.mask = 0,
471 };
472 
473 static int kbl_fe_startup(struct snd_pcm_substream *substream)
474 {
475 	struct snd_pcm_runtime *runtime = substream->runtime;
476 
477 	/*
478 	 * On this platform for PCM device we support,
479 	 * 48Khz
480 	 * stereo
481 	 * 16 bit audio
482 	 */
483 
484 	runtime->hw.channels_max = DUAL_CHANNEL;
485 	snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
486 					   &constraints_channels);
487 
488 	runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE;
489 	snd_pcm_hw_constraint_msbits(runtime, 0, 16, 16);
490 
491 	snd_pcm_hw_constraint_list(runtime, 0,
492 				SNDRV_PCM_HW_PARAM_RATE, &constraints_rates);
493 
494 	return 0;
495 }
496 
497 static const struct snd_soc_ops kabylake_da7219_fe_ops = {
498 	.startup = kbl_fe_startup,
499 };
500 
501 static int kabylake_dmic_fixup(struct snd_soc_pcm_runtime *rtd,
502 		struct snd_pcm_hw_params *params)
503 {
504 	struct snd_interval *chan = hw_param_interval(params,
505 				SNDRV_PCM_HW_PARAM_CHANNELS);
506 
507 	/*
508 	 * set BE channel constraint as user FE channels
509 	 */
510 
511 	if (params_channels(params) == 2)
512 		chan->min = chan->max = 2;
513 	else
514 		chan->min = chan->max = 4;
515 
516 	return 0;
517 }
518 
519 static int kabylake_dmic_startup(struct snd_pcm_substream *substream)
520 {
521 	struct snd_pcm_runtime *runtime = substream->runtime;
522 
523 	runtime->hw.channels_min = runtime->hw.channels_max = QUAD_CHANNEL;
524 	snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
525 			&constraints_channels_quad);
526 
527 	return snd_pcm_hw_constraint_list(substream->runtime, 0,
528 			SNDRV_PCM_HW_PARAM_RATE, &constraints_rates);
529 }
530 
531 static struct snd_soc_ops kabylake_dmic_ops = {
532 	.startup = kabylake_dmic_startup,
533 };
534 
535 static const unsigned int rates_16000[] = {
536 	16000,
537 };
538 
539 static const struct snd_pcm_hw_constraint_list constraints_16000 = {
540 	.count = ARRAY_SIZE(rates_16000),
541 	.list  = rates_16000,
542 };
543 
544 static const unsigned int ch_mono[] = {
545 	1,
546 };
547 static const struct snd_pcm_hw_constraint_list constraints_refcap = {
548 	.count = ARRAY_SIZE(ch_mono),
549 	.list  = ch_mono,
550 };
551 
552 static int kabylake_refcap_startup(struct snd_pcm_substream *substream)
553 {
554 	substream->runtime->hw.channels_max = 1;
555 	snd_pcm_hw_constraint_list(substream->runtime, 0,
556 					SNDRV_PCM_HW_PARAM_CHANNELS,
557 					&constraints_refcap);
558 
559 	return snd_pcm_hw_constraint_list(substream->runtime, 0,
560 				SNDRV_PCM_HW_PARAM_RATE,
561 				&constraints_16000);
562 }
563 
564 
565 static struct snd_soc_ops skylake_refcap_ops = {
566 	.startup = kabylake_refcap_startup,
567 };
568 
569 static struct snd_soc_codec_conf max98927_codec_conf[] = {
570 
571 	{
572 		.dlc = COMP_CODEC_CONF(MAX98927_DEV0_NAME),
573 		.name_prefix = "Right",
574 	},
575 
576 	{
577 		.dlc = COMP_CODEC_CONF(MAX98927_DEV1_NAME),
578 		.name_prefix = "Left",
579 	},
580 };
581 
582 static struct snd_soc_codec_conf max98373_codec_conf[] = {
583 
584 	{
585 		.dlc = COMP_CODEC_CONF(MAX98373_DEV0_NAME),
586 		.name_prefix = "Right",
587 	},
588 
589 	{
590 		.dlc = COMP_CODEC_CONF(MAX98373_DEV1_NAME),
591 		.name_prefix = "Left",
592 	},
593 };
594 
595 static struct snd_soc_dai_link_component max98373_ssp0_codec_components[] = {
596 	{ /* Left */
597 		.name = MAX98373_DEV0_NAME,
598 		.dai_name = MAX98373_CODEC_DAI,
599 	},
600 
601 	{  /* For Right */
602 		.name = MAX98373_DEV1_NAME,
603 		.dai_name = MAX98373_CODEC_DAI,
604 	},
605 
606 };
607 
608 SND_SOC_DAILINK_DEF(dummy,
609 	DAILINK_COMP_ARRAY(COMP_DUMMY()));
610 
611 SND_SOC_DAILINK_DEF(system,
612 	DAILINK_COMP_ARRAY(COMP_CPU("System Pin")));
613 
614 SND_SOC_DAILINK_DEF(echoref,
615 	DAILINK_COMP_ARRAY(COMP_CPU("Echoref Pin")));
616 
617 SND_SOC_DAILINK_DEF(reference,
618 	DAILINK_COMP_ARRAY(COMP_CPU("Reference Pin")));
619 
620 SND_SOC_DAILINK_DEF(dmic,
621 	DAILINK_COMP_ARRAY(COMP_CPU("DMIC Pin")));
622 
623 SND_SOC_DAILINK_DEF(hdmi1,
624 	DAILINK_COMP_ARRAY(COMP_CPU("HDMI1 Pin")));
625 
626 SND_SOC_DAILINK_DEF(hdmi2,
627 	DAILINK_COMP_ARRAY(COMP_CPU("HDMI2 Pin")));
628 
629 SND_SOC_DAILINK_DEF(hdmi3,
630 	DAILINK_COMP_ARRAY(COMP_CPU("HDMI3 Pin")));
631 
632 SND_SOC_DAILINK_DEF(system2,
633 	DAILINK_COMP_ARRAY(COMP_CPU("System Pin2")));
634 
635 SND_SOC_DAILINK_DEF(ssp0_pin,
636 	DAILINK_COMP_ARRAY(COMP_CPU("SSP0 Pin")));
637 SND_SOC_DAILINK_DEF(ssp0_codec,
638 	DAILINK_COMP_ARRAY(
639 	/* Left */	COMP_CODEC(MAX98927_DEV0_NAME, MAX98927_CODEC_DAI),
640 	/* For Right */	COMP_CODEC(MAX98927_DEV1_NAME, MAX98927_CODEC_DAI)));
641 
642 SND_SOC_DAILINK_DEF(ssp1_pin,
643 	DAILINK_COMP_ARRAY(COMP_CPU("SSP1 Pin")));
644 SND_SOC_DAILINK_DEF(ssp1_codec,
645 	DAILINK_COMP_ARRAY(COMP_CODEC("i2c-DLGS7219:00",
646 				      KBL_DIALOG_CODEC_DAI)));
647 
648 SND_SOC_DAILINK_DEF(dmic_pin,
649 	DAILINK_COMP_ARRAY(COMP_CPU("DMIC01 Pin")));
650 SND_SOC_DAILINK_DEF(dmic_codec,
651 	DAILINK_COMP_ARRAY(COMP_CODEC("dmic-codec", "dmic-hifi")));
652 
653 SND_SOC_DAILINK_DEF(idisp1_pin,
654 	DAILINK_COMP_ARRAY(COMP_CPU("iDisp1 Pin")));
655 SND_SOC_DAILINK_DEF(idisp1_codec,
656 	DAILINK_COMP_ARRAY(COMP_CODEC("ehdaudio0D2", "intel-hdmi-hifi1")));
657 
658 SND_SOC_DAILINK_DEF(idisp2_pin,
659 	DAILINK_COMP_ARRAY(COMP_CPU("iDisp2 Pin")));
660 SND_SOC_DAILINK_DEF(idisp2_codec,
661 	DAILINK_COMP_ARRAY(COMP_CODEC("ehdaudio0D2", "intel-hdmi-hifi2")));
662 
663 SND_SOC_DAILINK_DEF(idisp3_pin,
664 	DAILINK_COMP_ARRAY(COMP_CPU("iDisp3 Pin")));
665 SND_SOC_DAILINK_DEF(idisp3_codec,
666 	DAILINK_COMP_ARRAY(COMP_CODEC("ehdaudio0D2", "intel-hdmi-hifi3")));
667 
668 SND_SOC_DAILINK_DEF(platform,
669 	DAILINK_COMP_ARRAY(COMP_PLATFORM("0000:00:1f.3")));
670 
671 /* kabylake digital audio interface glue - connects codec <--> CPU */
672 static struct snd_soc_dai_link kabylake_dais[] = {
673 	/* Front End DAI links */
674 	[KBL_DPCM_AUDIO_PB] = {
675 		.name = "Kbl Audio Port",
676 		.stream_name = "Audio",
677 		.dynamic = 1,
678 		.nonatomic = 1,
679 		.init = kabylake_da7219_fe_init,
680 		.trigger = {
681 			SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
682 		.dpcm_playback = 1,
683 		.ops = &kabylake_da7219_fe_ops,
684 		SND_SOC_DAILINK_REG(system, dummy, platform),
685 	},
686 	[KBL_DPCM_AUDIO_ECHO_REF_CP] = {
687 		.name = "Kbl Audio Echo Reference cap",
688 		.stream_name = "Echoreference Capture",
689 		.init = NULL,
690 		.dpcm_capture = 1,
691 		.nonatomic = 1,
692 		SND_SOC_DAILINK_REG(echoref, dummy, platform),
693 	},
694 	[KBL_DPCM_AUDIO_REF_CP] = {
695 		.name = "Kbl Audio Reference cap",
696 		.stream_name = "Wake on Voice",
697 		.init = NULL,
698 		.dpcm_capture = 1,
699 		.nonatomic = 1,
700 		.dynamic = 1,
701 		.ops = &skylake_refcap_ops,
702 		SND_SOC_DAILINK_REG(reference, dummy, platform),
703 	},
704 	[KBL_DPCM_AUDIO_DMIC_CP] = {
705 		.name = "Kbl Audio DMIC cap",
706 		.stream_name = "dmiccap",
707 		.init = NULL,
708 		.dpcm_capture = 1,
709 		.nonatomic = 1,
710 		.dynamic = 1,
711 		.ops = &kabylake_dmic_ops,
712 		SND_SOC_DAILINK_REG(dmic, dummy, platform),
713 	},
714 	[KBL_DPCM_AUDIO_HDMI1_PB] = {
715 		.name = "Kbl HDMI Port1",
716 		.stream_name = "Hdmi1",
717 		.dpcm_playback = 1,
718 		.init = NULL,
719 		.trigger = {
720 			SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
721 		.nonatomic = 1,
722 		.dynamic = 1,
723 		SND_SOC_DAILINK_REG(hdmi1, dummy, platform),
724 	},
725 	[KBL_DPCM_AUDIO_HDMI2_PB] = {
726 		.name = "Kbl HDMI Port2",
727 		.stream_name = "Hdmi2",
728 		.dpcm_playback = 1,
729 		.init = NULL,
730 		.trigger = {
731 			SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
732 		.nonatomic = 1,
733 		.dynamic = 1,
734 		SND_SOC_DAILINK_REG(hdmi2, dummy, platform),
735 	},
736 	[KBL_DPCM_AUDIO_HDMI3_PB] = {
737 		.name = "Kbl HDMI Port3",
738 		.stream_name = "Hdmi3",
739 		.trigger = {
740 			SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
741 		.dpcm_playback = 1,
742 		.init = NULL,
743 		.nonatomic = 1,
744 		.dynamic = 1,
745 		SND_SOC_DAILINK_REG(hdmi3, dummy, platform),
746 	},
747 	[KBL_DPCM_AUDIO_HS_PB] = {
748 		.name = "Kbl Audio Headset Playback",
749 		.stream_name = "Headset Audio",
750 		.dpcm_playback = 1,
751 		.nonatomic = 1,
752 		.dynamic = 1,
753 		.init = kabylake_da7219_fe_init,
754 		.trigger = {
755 			SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
756 		.ops = &kabylake_da7219_fe_ops,
757 		SND_SOC_DAILINK_REG(system2, dummy, platform),
758 	},
759 	[KBL_DPCM_AUDIO_CP] = {
760 		.name = "Kbl Audio Capture Port",
761 		.stream_name = "Audio Record",
762 		.dynamic = 1,
763 		.nonatomic = 1,
764 		.trigger = {
765 			SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
766 		.dpcm_capture = 1,
767 		.ops = &kabylake_da7219_fe_ops,
768 		SND_SOC_DAILINK_REG(system, dummy, platform),
769 	},
770 
771 	/* Back End DAI links */
772 	{
773 		/* SSP0 - Codec */
774 		.name = "SSP0-Codec",
775 		.id = 0,
776 		.no_pcm = 1,
777 		.dai_fmt = SND_SOC_DAIFMT_DSP_B |
778 			SND_SOC_DAIFMT_NB_NF |
779 			SND_SOC_DAIFMT_CBC_CFC,
780 		.dpcm_playback = 1,
781 		.dpcm_capture = 1,
782 		.ignore_pmdown_time = 1,
783 		.be_hw_params_fixup = kabylake_ssp_fixup,
784 		.ops = &kabylake_ssp0_ops,
785 		SND_SOC_DAILINK_REG(ssp0_pin, ssp0_codec, platform),
786 	},
787 	{
788 		/* SSP1 - Codec */
789 		.name = "SSP1-Codec",
790 		.id = 1,
791 		.no_pcm = 1,
792 		.init = kabylake_da7219_codec_init,
793 		.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
794 			SND_SOC_DAIFMT_CBC_CFC,
795 		.ignore_pmdown_time = 1,
796 		.be_hw_params_fixup = kabylake_ssp_fixup,
797 		.dpcm_playback = 1,
798 		.dpcm_capture = 1,
799 		SND_SOC_DAILINK_REG(ssp1_pin, ssp1_codec, platform),
800 	},
801 	{
802 		.name = "dmic01",
803 		.id = 2,
804 		.init = kabylake_dmic_init,
805 		.be_hw_params_fixup = kabylake_dmic_fixup,
806 		.ignore_suspend = 1,
807 		.dpcm_capture = 1,
808 		.no_pcm = 1,
809 		SND_SOC_DAILINK_REG(dmic_pin, dmic_codec, platform),
810 	},
811 	{
812 		.name = "iDisp1",
813 		.id = 3,
814 		.dpcm_playback = 1,
815 		.init = kabylake_hdmi1_init,
816 		.no_pcm = 1,
817 		SND_SOC_DAILINK_REG(idisp1_pin, idisp1_codec, platform),
818 	},
819 	{
820 		.name = "iDisp2",
821 		.id = 4,
822 		.init = kabylake_hdmi2_init,
823 		.dpcm_playback = 1,
824 		.no_pcm = 1,
825 		SND_SOC_DAILINK_REG(idisp2_pin, idisp2_codec, platform),
826 	},
827 	{
828 		.name = "iDisp3",
829 		.id = 5,
830 		.init = kabylake_hdmi3_init,
831 		.dpcm_playback = 1,
832 		.no_pcm = 1,
833 		SND_SOC_DAILINK_REG(idisp3_pin, idisp3_codec, platform),
834 	},
835 };
836 
837 /* kabylake digital audio interface glue - connects codec <--> CPU */
838 static struct snd_soc_dai_link kabylake_max98_927_373_dais[] = {
839 	/* Front End DAI links */
840 	[KBL_DPCM_AUDIO_PB] = {
841 		.name = "Kbl Audio Port",
842 		.stream_name = "Audio",
843 		.dynamic = 1,
844 		.nonatomic = 1,
845 		.init = kabylake_da7219_fe_init,
846 		.trigger = {
847 			SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
848 		.dpcm_playback = 1,
849 		.ops = &kabylake_da7219_fe_ops,
850 		SND_SOC_DAILINK_REG(system, dummy, platform),
851 	},
852 	[KBL_DPCM_AUDIO_ECHO_REF_CP] = {
853 		.name = "Kbl Audio Echo Reference cap",
854 		.stream_name = "Echoreference Capture",
855 		.init = NULL,
856 		.dpcm_capture = 1,
857 		.nonatomic = 1,
858 		SND_SOC_DAILINK_REG(echoref, dummy, platform),
859 	},
860 	[KBL_DPCM_AUDIO_REF_CP] = {
861 		.name = "Kbl Audio Reference cap",
862 		.stream_name = "Wake on Voice",
863 		.init = NULL,
864 		.dpcm_capture = 1,
865 		.nonatomic = 1,
866 		.dynamic = 1,
867 		.ops = &skylake_refcap_ops,
868 		SND_SOC_DAILINK_REG(reference, dummy, platform),
869 	},
870 	[KBL_DPCM_AUDIO_DMIC_CP] = {
871 		.name = "Kbl Audio DMIC cap",
872 		.stream_name = "dmiccap",
873 		.init = NULL,
874 		.dpcm_capture = 1,
875 		.nonatomic = 1,
876 		.dynamic = 1,
877 		.ops = &kabylake_dmic_ops,
878 		SND_SOC_DAILINK_REG(dmic, dummy, platform),
879 	},
880 	[KBL_DPCM_AUDIO_HDMI1_PB] = {
881 		.name = "Kbl HDMI Port1",
882 		.stream_name = "Hdmi1",
883 		.dpcm_playback = 1,
884 		.init = NULL,
885 		.trigger = {
886 			SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
887 		.nonatomic = 1,
888 		.dynamic = 1,
889 		SND_SOC_DAILINK_REG(hdmi1, dummy, platform),
890 	},
891 	[KBL_DPCM_AUDIO_HDMI2_PB] = {
892 		.name = "Kbl HDMI Port2",
893 		.stream_name = "Hdmi2",
894 		.dpcm_playback = 1,
895 		.init = NULL,
896 		.trigger = {
897 			SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
898 		.nonatomic = 1,
899 		.dynamic = 1,
900 		SND_SOC_DAILINK_REG(hdmi2, dummy, platform),
901 	},
902 	[KBL_DPCM_AUDIO_HDMI3_PB] = {
903 		.name = "Kbl HDMI Port3",
904 		.stream_name = "Hdmi3",
905 		.trigger = {
906 			SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
907 		.dpcm_playback = 1,
908 		.init = NULL,
909 		.nonatomic = 1,
910 		.dynamic = 1,
911 		SND_SOC_DAILINK_REG(hdmi3, dummy, platform),
912 	},
913 
914 	/* Back End DAI links */
915 	{
916 		/* SSP0 - Codec */
917 		.name = "SSP0-Codec",
918 		.id = 0,
919 		.no_pcm = 1,
920 		.dai_fmt = SND_SOC_DAIFMT_DSP_B |
921 			SND_SOC_DAIFMT_NB_NF |
922 			SND_SOC_DAIFMT_CBC_CFC,
923 		.dpcm_playback = 1,
924 		.dpcm_capture = 1,
925 		.ignore_pmdown_time = 1,
926 		.be_hw_params_fixup = kabylake_ssp_fixup,
927 		.ops = &kabylake_ssp0_ops,
928 		SND_SOC_DAILINK_REG(ssp0_pin, ssp0_codec),
929 	},
930 	{
931 		.name = "dmic01",
932 		.id = 1,
933 		.init = kabylake_dmic_init,
934 		.be_hw_params_fixup = kabylake_dmic_fixup,
935 		.ignore_suspend = 1,
936 		.dpcm_capture = 1,
937 		.no_pcm = 1,
938 		SND_SOC_DAILINK_REG(dmic_pin, dmic_codec, platform),
939 	},
940 	{
941 		.name = "iDisp1",
942 		.id = 2,
943 		.dpcm_playback = 1,
944 		.init = kabylake_hdmi1_init,
945 		.no_pcm = 1,
946 		SND_SOC_DAILINK_REG(idisp1_pin, idisp1_codec, platform),
947 	},
948 	{
949 		.name = "iDisp2",
950 		.id = 3,
951 		.init = kabylake_hdmi2_init,
952 		.dpcm_playback = 1,
953 		.no_pcm = 1,
954 		SND_SOC_DAILINK_REG(idisp2_pin, idisp2_codec, platform),
955 	},
956 	{
957 		.name = "iDisp3",
958 		.id = 4,
959 		.init = kabylake_hdmi3_init,
960 		.dpcm_playback = 1,
961 		.no_pcm = 1,
962 		SND_SOC_DAILINK_REG(idisp3_pin, idisp3_codec, platform),
963 	},
964 };
965 
966 static int kabylake_card_late_probe(struct snd_soc_card *card)
967 {
968 	struct kbl_codec_private *ctx = snd_soc_card_get_drvdata(card);
969 	struct kbl_hdmi_pcm *pcm;
970 	struct snd_soc_dapm_context *dapm = &card->dapm;
971 	struct snd_soc_component *component = NULL;
972 	int err, i = 0;
973 	char jack_name[NAME_SIZE];
974 
975 	list_for_each_entry(pcm, &ctx->hdmi_pcm_list, head) {
976 		component = pcm->codec_dai->component;
977 		snprintf(jack_name, sizeof(jack_name),
978 			"HDMI/DP, pcm=%d Jack", pcm->device);
979 		err = snd_soc_card_jack_new(card, jack_name,
980 					SND_JACK_AVOUT, &kabylake_hdmi[i]);
981 
982 		if (err)
983 			return err;
984 
985 		err = hdac_hdmi_jack_init(pcm->codec_dai, pcm->device,
986 						&kabylake_hdmi[i]);
987 		if (err < 0)
988 			return err;
989 
990 		i++;
991 	}
992 
993 	if (!component)
994 		return -EINVAL;
995 
996 
997 	err = hdac_hdmi_jack_port_init(component, &card->dapm);
998 
999 	if (err < 0)
1000 		return err;
1001 
1002 	err = snd_soc_dapm_disable_pin(dapm, "Left Spk");
1003 	if (err) {
1004 		dev_err(card->dev, "failed to disable Left Spk: %d\n", err);
1005 		return err;
1006 	}
1007 
1008 	err = snd_soc_dapm_disable_pin(dapm, "Right Spk");
1009 	if (err) {
1010 		dev_err(card->dev, "failed to disable Right Spk: %d\n", err);
1011 		return err;
1012 	}
1013 
1014 	return snd_soc_dapm_sync(dapm);
1015 }
1016 
1017 /* kabylake audio machine driver for SPT + DA7219 */
1018 static struct snd_soc_card kbl_audio_card_da7219_m98927 = {
1019 	.name = "kblda7219m98927",
1020 	.owner = THIS_MODULE,
1021 	.dai_link = kabylake_dais,
1022 	.num_links = ARRAY_SIZE(kabylake_dais),
1023 	.controls = kabylake_controls,
1024 	.num_controls = ARRAY_SIZE(kabylake_controls),
1025 	.dapm_widgets = kabylake_widgets,
1026 	.num_dapm_widgets = ARRAY_SIZE(kabylake_widgets),
1027 	.dapm_routes = kabylake_map,
1028 	.num_dapm_routes = ARRAY_SIZE(kabylake_map),
1029 	.codec_conf = max98927_codec_conf,
1030 	.num_configs = ARRAY_SIZE(max98927_codec_conf),
1031 	.fully_routed = true,
1032 	.late_probe = kabylake_card_late_probe,
1033 };
1034 
1035 /* kabylake audio machine driver for Maxim98927 */
1036 static struct snd_soc_card kbl_audio_card_max98927 = {
1037 	.name = "kblmax98927",
1038 	.owner = THIS_MODULE,
1039 	.dai_link = kabylake_max98_927_373_dais,
1040 	.num_links = ARRAY_SIZE(kabylake_max98_927_373_dais),
1041 	.controls = kabylake_controls,
1042 	.num_controls = ARRAY_SIZE(kabylake_controls),
1043 	.dapm_widgets = kabylake_widgets,
1044 	.num_dapm_widgets = ARRAY_SIZE(kabylake_widgets),
1045 	.dapm_routes = kabylake_map,
1046 	.num_dapm_routes = ARRAY_SIZE(kabylake_map),
1047 	.codec_conf = max98927_codec_conf,
1048 	.num_configs = ARRAY_SIZE(max98927_codec_conf),
1049 	.fully_routed = true,
1050 	.late_probe = kabylake_card_late_probe,
1051 };
1052 
1053 static struct snd_soc_card kbl_audio_card_da7219_m98373 = {
1054 	.name = "kblda7219m98373",
1055 	.owner = THIS_MODULE,
1056 	.dai_link = kabylake_dais,
1057 	.num_links = ARRAY_SIZE(kabylake_dais),
1058 	.controls = kabylake_controls,
1059 	.num_controls = ARRAY_SIZE(kabylake_controls),
1060 	.dapm_widgets = kabylake_widgets,
1061 	.num_dapm_widgets = ARRAY_SIZE(kabylake_widgets),
1062 	.dapm_routes = kabylake_map,
1063 	.num_dapm_routes = ARRAY_SIZE(kabylake_map),
1064 	.codec_conf = max98373_codec_conf,
1065 	.num_configs = ARRAY_SIZE(max98373_codec_conf),
1066 	.fully_routed = true,
1067 	.late_probe = kabylake_card_late_probe,
1068 };
1069 
1070 static struct snd_soc_card kbl_audio_card_max98373 = {
1071 	.name = "kblmax98373",
1072 	.owner = THIS_MODULE,
1073 	.dai_link = kabylake_max98_927_373_dais,
1074 	.num_links = ARRAY_SIZE(kabylake_max98_927_373_dais),
1075 	.controls = kabylake_controls,
1076 	.num_controls = ARRAY_SIZE(kabylake_controls),
1077 	.dapm_widgets = kabylake_widgets,
1078 	.num_dapm_widgets = ARRAY_SIZE(kabylake_widgets),
1079 	.dapm_routes = kabylake_map,
1080 	.num_dapm_routes = ARRAY_SIZE(kabylake_map),
1081 	.codec_conf = max98373_codec_conf,
1082 	.num_configs = ARRAY_SIZE(max98373_codec_conf),
1083 	.fully_routed = true,
1084 	.late_probe = kabylake_card_late_probe,
1085 };
1086 
1087 static int kabylake_audio_probe(struct platform_device *pdev)
1088 {
1089 	struct kbl_codec_private *ctx;
1090 	struct snd_soc_dai_link *kbl_dai_link;
1091 	struct snd_soc_dai_link_component **codecs;
1092 	int i;
1093 
1094 	ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL);
1095 	if (!ctx)
1096 		return -ENOMEM;
1097 
1098 	INIT_LIST_HEAD(&ctx->hdmi_pcm_list);
1099 
1100 	kabylake_audio_card =
1101 		(struct snd_soc_card *)pdev->id_entry->driver_data;
1102 
1103 	kbl_dai_link = kabylake_audio_card->dai_link;
1104 
1105 	/* Update codecs for SSP0 with max98373 codec info */
1106 	if (!strcmp(pdev->name, "kbl_da7219_max98373") ||
1107 		(!strcmp(pdev->name, "kbl_max98373"))) {
1108 		for (i = 0; i < kabylake_audio_card->num_links; ++i) {
1109 			if (strcmp(kbl_dai_link[i].name, "SSP0-Codec"))
1110 				continue;
1111 
1112 			codecs = &(kbl_dai_link[i].codecs);
1113 			*codecs = max98373_ssp0_codec_components;
1114 			kbl_dai_link[i].num_codecs =
1115 				ARRAY_SIZE(max98373_ssp0_codec_components);
1116 			break;
1117 		}
1118 	}
1119 	kabylake_audio_card->dev = &pdev->dev;
1120 	snd_soc_card_set_drvdata(kabylake_audio_card, ctx);
1121 
1122 	return devm_snd_soc_register_card(&pdev->dev, kabylake_audio_card);
1123 }
1124 
1125 static const struct platform_device_id kbl_board_ids[] = {
1126 	{
1127 		.name = "kbl_da7219_max98927",
1128 		.driver_data =
1129 			(kernel_ulong_t)&kbl_audio_card_da7219_m98927,
1130 	},
1131 	{
1132 		.name = "kbl_max98927",
1133 		.driver_data =
1134 			(kernel_ulong_t)&kbl_audio_card_max98927,
1135 	},
1136 	{
1137 		.name = "kbl_da7219_max98373",
1138 		.driver_data =
1139 			(kernel_ulong_t)&kbl_audio_card_da7219_m98373,
1140 	},
1141 	{
1142 		.name = "kbl_max98373",
1143 		.driver_data =
1144 			(kernel_ulong_t)&kbl_audio_card_max98373,
1145 	},
1146 	{ }
1147 };
1148 MODULE_DEVICE_TABLE(platform, kbl_board_ids);
1149 
1150 static struct platform_driver kabylake_audio = {
1151 	.probe = kabylake_audio_probe,
1152 	.driver = {
1153 		.name = "kbl_da7219_max98_927_373",
1154 		.pm = &snd_soc_pm_ops,
1155 	},
1156 	.id_table = kbl_board_ids,
1157 };
1158 
1159 module_platform_driver(kabylake_audio)
1160 
1161 /* Module information */
1162 MODULE_DESCRIPTION("Audio KabyLake Machine driver for MAX98927/MAX98373 & DA7219");
1163 MODULE_AUTHOR("Mac Chiang <mac.chiang@intel.com>");
1164 MODULE_LICENSE("GPL v2");
1165