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