1 // SPDX-License-Identifier: GPL-2.0
2 // Copyright(c) 2017-18 Intel Corporation.
3 
4 /*
5  * Intel Kabylake I2S Machine Driver with MAX98357A & DA7219 Codecs
6  *
7  * Modified from:
8  *   Intel Kabylake I2S Machine driver supporting MAXIM98927 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 "../skylake/skl.h"
23 #include "../../codecs/da7219-aad.h"
24 
25 #define KBL_DIALOG_CODEC_DAI "da7219-hifi"
26 #define KBL_MAXIM_CODEC_DAI "HiFi"
27 #define MAXIM_DEV0_NAME "MX98357A:00"
28 #define DUAL_CHANNEL 2
29 #define QUAD_CHANNEL 4
30 
31 static struct snd_soc_card *kabylake_audio_card;
32 static struct snd_soc_jack skylake_hdmi[3];
33 
34 struct kbl_hdmi_pcm {
35 	struct list_head head;
36 	struct snd_soc_dai *codec_dai;
37 	int device;
38 };
39 
40 struct kbl_codec_private {
41 	struct snd_soc_jack kabylake_headset;
42 	struct list_head hdmi_pcm_list;
43 };
44 
45 enum {
46 	KBL_DPCM_AUDIO_PB = 0,
47 	KBL_DPCM_AUDIO_CP,
48 	KBL_DPCM_AUDIO_DMIC_CP,
49 	KBL_DPCM_AUDIO_HDMI1_PB,
50 	KBL_DPCM_AUDIO_HDMI2_PB,
51 	KBL_DPCM_AUDIO_HDMI3_PB,
52 };
53 
54 static int platform_clock_control(struct snd_soc_dapm_widget *w,
55 					struct snd_kcontrol *k, int  event)
56 {
57 	struct snd_soc_dapm_context *dapm = w->dapm;
58 	struct snd_soc_card *card = dapm->card;
59 	struct snd_soc_dai *codec_dai;
60 	int ret = 0;
61 
62 	codec_dai = snd_soc_card_get_codec_dai(card, KBL_DIALOG_CODEC_DAI);
63 	if (!codec_dai) {
64 		dev_err(card->dev, "Codec dai not found; Unable to set/unset codec pll\n");
65 		return -EIO;
66 	}
67 
68 	if (SND_SOC_DAPM_EVENT_OFF(event)) {
69 		ret = snd_soc_dai_set_pll(codec_dai, 0,
70 				     DA7219_SYSCLK_MCLK, 0, 0);
71 		if (ret)
72 			dev_err(card->dev, "failed to stop PLL: %d\n", ret);
73 	} else if (SND_SOC_DAPM_EVENT_ON(event)) {
74 		ret = snd_soc_dai_set_pll(codec_dai, 0,	DA7219_SYSCLK_PLL_SRM,
75 				     0, DA7219_PLL_FREQ_OUT_98304);
76 		if (ret)
77 			dev_err(card->dev, "failed to start PLL: %d\n", ret);
78 	}
79 
80 	return ret;
81 }
82 
83 static const struct snd_kcontrol_new kabylake_controls[] = {
84 	SOC_DAPM_PIN_SWITCH("Headphone Jack"),
85 	SOC_DAPM_PIN_SWITCH("Headset Mic"),
86 	SOC_DAPM_PIN_SWITCH("Spk"),
87 };
88 
89 static const struct snd_soc_dapm_widget kabylake_widgets[] = {
90 	SND_SOC_DAPM_HP("Headphone Jack", NULL),
91 	SND_SOC_DAPM_MIC("Headset Mic", NULL),
92 	SND_SOC_DAPM_SPK("Spk", NULL),
93 	SND_SOC_DAPM_MIC("SoC DMIC", NULL),
94 	SND_SOC_DAPM_SPK("DP", NULL),
95 	SND_SOC_DAPM_SPK("HDMI", NULL),
96 	SND_SOC_DAPM_SUPPLY("Platform Clock", SND_SOC_NOPM, 0, 0,
97 			platform_clock_control, SND_SOC_DAPM_PRE_PMU |
98 			SND_SOC_DAPM_POST_PMD),
99 };
100 
101 static const struct snd_soc_dapm_route kabylake_map[] = {
102 	{ "Headphone Jack", NULL, "HPL" },
103 	{ "Headphone Jack", NULL, "HPR" },
104 
105 	/* speaker */
106 	{ "Spk", NULL, "Speaker" },
107 
108 	/* other jacks */
109 	{ "MIC", NULL, "Headset Mic" },
110 	{ "DMic", NULL, "SoC DMIC" },
111 
112 	{ "HDMI", NULL, "hif5 Output" },
113 	{ "DP", NULL, "hif6 Output" },
114 
115 	/* CODEC BE connections */
116 	{ "HiFi Playback", NULL, "ssp0 Tx" },
117 	{ "ssp0 Tx", NULL, "codec0_out" },
118 
119 	{ "Playback", NULL, "ssp1 Tx" },
120 	{ "ssp1 Tx", NULL, "codec1_out" },
121 
122 	{ "codec0_in", NULL, "ssp1 Rx" },
123 	{ "ssp1 Rx", NULL, "Capture" },
124 
125 	/* DMIC */
126 	{ "dmic01_hifi", NULL, "DMIC01 Rx" },
127 	{ "DMIC01 Rx", NULL, "DMIC AIF" },
128 
129 	{ "hifi1", NULL, "iDisp1 Tx" },
130 	{ "iDisp1 Tx", NULL, "iDisp1_out" },
131 	{ "hifi2", NULL, "iDisp2 Tx" },
132 	{ "iDisp2 Tx", NULL, "iDisp2_out" },
133 	{ "hifi3", NULL, "iDisp3 Tx"},
134 	{ "iDisp3 Tx", NULL, "iDisp3_out"},
135 
136 	{ "Headphone Jack", NULL, "Platform Clock" },
137 	{ "Headset Mic", NULL, "Platform Clock" },
138 };
139 
140 static int kabylake_ssp_fixup(struct snd_soc_pcm_runtime *rtd,
141 			struct snd_pcm_hw_params *params)
142 {
143 	struct snd_interval *rate = hw_param_interval(params,
144 			SNDRV_PCM_HW_PARAM_RATE);
145 	struct snd_interval *channels = hw_param_interval(params,
146 			SNDRV_PCM_HW_PARAM_CHANNELS);
147 	struct snd_mask *fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
148 
149 	/* The ADSP will convert the FE rate to 48k, stereo */
150 	rate->min = rate->max = 48000;
151 	channels->min = channels->max = DUAL_CHANNEL;
152 
153 	/* set SSP to 24 bit */
154 	snd_mask_none(fmt);
155 	snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S24_LE);
156 
157 	return 0;
158 }
159 
160 static int kabylake_da7219_codec_init(struct snd_soc_pcm_runtime *rtd)
161 {
162 	struct kbl_codec_private *ctx = snd_soc_card_get_drvdata(rtd->card);
163 	struct snd_soc_component *component = rtd->codec_dai->component;
164 	struct snd_soc_dai *codec_dai = rtd->codec_dai;
165 	struct snd_soc_jack *jack;
166 	int ret;
167 
168 	/* Configure sysclk for codec */
169 	ret = snd_soc_dai_set_sysclk(codec_dai, DA7219_CLKSRC_MCLK, 24576000,
170 						SND_SOC_CLOCK_IN);
171 	if (ret) {
172 		dev_err(rtd->dev, "can't set codec sysclk configuration\n");
173 		return ret;
174 	}
175 
176 	/*
177 	 * Headset buttons map to the google Reference headset.
178 	 * These can be configured by userspace.
179 	 */
180 	ret = snd_soc_card_jack_new(kabylake_audio_card, "Headset Jack",
181 			SND_JACK_HEADSET | SND_JACK_BTN_0 | SND_JACK_BTN_1 |
182 			SND_JACK_BTN_2 | SND_JACK_BTN_3 | SND_JACK_LINEOUT,
183 			&ctx->kabylake_headset, NULL, 0);
184 	if (ret) {
185 		dev_err(rtd->dev, "Headset Jack creation failed: %d\n", ret);
186 		return ret;
187 	}
188 
189 	jack = &ctx->kabylake_headset;
190 
191 	snd_jack_set_key(jack->jack, SND_JACK_BTN_0, KEY_MEDIA);
192 	snd_jack_set_key(jack->jack, SND_JACK_BTN_1, KEY_VOLUMEUP);
193 	snd_jack_set_key(jack->jack, SND_JACK_BTN_2, KEY_VOLUMEDOWN);
194 	snd_jack_set_key(jack->jack, SND_JACK_BTN_3, KEY_VOICECOMMAND);
195 	da7219_aad_jack_det(component, &ctx->kabylake_headset);
196 
197 	ret = snd_soc_dapm_ignore_suspend(&rtd->card->dapm, "SoC DMIC");
198 	if (ret)
199 		dev_err(rtd->dev, "SoC DMIC - Ignore suspend failed %d\n", ret);
200 
201 	return ret;
202 }
203 
204 static int kabylake_hdmi_init(struct snd_soc_pcm_runtime *rtd, int device)
205 {
206 	struct kbl_codec_private *ctx = snd_soc_card_get_drvdata(rtd->card);
207 	struct snd_soc_dai *dai = rtd->codec_dai;
208 	struct kbl_hdmi_pcm *pcm;
209 
210 	pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL);
211 	if (!pcm)
212 		return -ENOMEM;
213 
214 	pcm->device = device;
215 	pcm->codec_dai = dai;
216 
217 	list_add_tail(&pcm->head, &ctx->hdmi_pcm_list);
218 
219 	return 0;
220 }
221 
222 static int kabylake_hdmi1_init(struct snd_soc_pcm_runtime *rtd)
223 {
224 	return kabylake_hdmi_init(rtd, KBL_DPCM_AUDIO_HDMI1_PB);
225 }
226 
227 static int kabylake_hdmi2_init(struct snd_soc_pcm_runtime *rtd)
228 {
229 	return kabylake_hdmi_init(rtd, KBL_DPCM_AUDIO_HDMI2_PB);
230 }
231 
232 static int kabylake_hdmi3_init(struct snd_soc_pcm_runtime *rtd)
233 {
234 	return kabylake_hdmi_init(rtd, KBL_DPCM_AUDIO_HDMI3_PB);
235 }
236 
237 static int kabylake_da7219_fe_init(struct snd_soc_pcm_runtime *rtd)
238 {
239 	struct snd_soc_dapm_context *dapm;
240 	struct snd_soc_component *component = rtd->cpu_dai->component;
241 
242 	dapm = snd_soc_component_get_dapm(component);
243 	snd_soc_dapm_ignore_suspend(dapm, "Reference Capture");
244 
245 	return 0;
246 }
247 
248 static const unsigned int rates[] = {
249 	48000,
250 };
251 
252 static const struct snd_pcm_hw_constraint_list constraints_rates = {
253 	.count = ARRAY_SIZE(rates),
254 	.list  = rates,
255 	.mask = 0,
256 };
257 
258 static const unsigned int channels[] = {
259 	DUAL_CHANNEL,
260 };
261 
262 static const struct snd_pcm_hw_constraint_list constraints_channels = {
263 	.count = ARRAY_SIZE(channels),
264 	.list = channels,
265 	.mask = 0,
266 };
267 
268 static unsigned int channels_quad[] = {
269 	QUAD_CHANNEL,
270 };
271 
272 static struct snd_pcm_hw_constraint_list constraints_channels_quad = {
273 	.count = ARRAY_SIZE(channels_quad),
274 	.list = channels_quad,
275 	.mask = 0,
276 };
277 
278 static int kbl_fe_startup(struct snd_pcm_substream *substream)
279 {
280 	struct snd_pcm_runtime *runtime = substream->runtime;
281 
282 	/*
283 	 * On this platform for PCM device we support,
284 	 * 48Khz
285 	 * stereo
286 	 * 16 bit audio
287 	 */
288 
289 	runtime->hw.channels_max = DUAL_CHANNEL;
290 	snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
291 					   &constraints_channels);
292 
293 	runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE;
294 	snd_pcm_hw_constraint_msbits(runtime, 0, 16, 16);
295 
296 	snd_pcm_hw_constraint_list(runtime, 0,
297 				SNDRV_PCM_HW_PARAM_RATE, &constraints_rates);
298 
299 	return 0;
300 }
301 
302 static const struct snd_soc_ops kabylake_da7219_fe_ops = {
303 	.startup = kbl_fe_startup,
304 };
305 
306 static int kabylake_dmic_fixup(struct snd_soc_pcm_runtime *rtd,
307 		struct snd_pcm_hw_params *params)
308 {
309 	struct snd_interval *channels = hw_param_interval(params,
310 				SNDRV_PCM_HW_PARAM_CHANNELS);
311 
312 	/*
313 	 * set BE channel constraint as user FE channels
314 	 */
315 
316 	if (params_channels(params) == 2)
317 		channels->min = channels->max = 2;
318 	else
319 		channels->min = channels->max = 4;
320 
321 	return 0;
322 }
323 
324 static int kabylake_dmic_startup(struct snd_pcm_substream *substream)
325 {
326 	struct snd_pcm_runtime *runtime = substream->runtime;
327 
328 	runtime->hw.channels_min = runtime->hw.channels_max = QUAD_CHANNEL;
329 	snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
330 			&constraints_channels_quad);
331 
332 	return snd_pcm_hw_constraint_list(substream->runtime, 0,
333 			SNDRV_PCM_HW_PARAM_RATE, &constraints_rates);
334 }
335 
336 static struct snd_soc_ops kabylake_dmic_ops = {
337 	.startup = kabylake_dmic_startup,
338 };
339 
340 static const unsigned int rates_16000[] = {
341 	16000,
342 };
343 
344 static const struct snd_pcm_hw_constraint_list constraints_16000 = {
345 	.count = ARRAY_SIZE(rates_16000),
346 	.list  = rates_16000,
347 };
348 
349 static const unsigned int ch_mono[] = {
350 	1,
351 };
352 
353 /* kabylake digital audio interface glue - connects codec <--> CPU */
354 static struct snd_soc_dai_link kabylake_dais[] = {
355 	/* Front End DAI links */
356 	[KBL_DPCM_AUDIO_PB] = {
357 		.name = "Kbl Audio Port",
358 		.stream_name = "Audio",
359 		.cpu_dai_name = "System Pin",
360 		.platform_name = "0000:00:1f.3",
361 		.dynamic = 1,
362 		.codec_name = "snd-soc-dummy",
363 		.codec_dai_name = "snd-soc-dummy-dai",
364 		.nonatomic = 1,
365 		.init = kabylake_da7219_fe_init,
366 		.trigger = {
367 			SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
368 		.dpcm_playback = 1,
369 		.ops = &kabylake_da7219_fe_ops,
370 	},
371 	[KBL_DPCM_AUDIO_CP] = {
372 		.name = "Kbl Audio Capture Port",
373 		.stream_name = "Audio Record",
374 		.cpu_dai_name = "System Pin",
375 		.platform_name = "0000:00:1f.3",
376 		.dynamic = 1,
377 		.codec_name = "snd-soc-dummy",
378 		.codec_dai_name = "snd-soc-dummy-dai",
379 		.nonatomic = 1,
380 		.trigger = {
381 			SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
382 		.dpcm_capture = 1,
383 		.ops = &kabylake_da7219_fe_ops,
384 	},
385 	[KBL_DPCM_AUDIO_DMIC_CP] = {
386 		.name = "Kbl Audio DMIC cap",
387 		.stream_name = "dmiccap",
388 		.cpu_dai_name = "DMIC Pin",
389 		.codec_name = "snd-soc-dummy",
390 		.codec_dai_name = "snd-soc-dummy-dai",
391 		.platform_name = "0000:00:1f.3",
392 		.init = NULL,
393 		.dpcm_capture = 1,
394 		.nonatomic = 1,
395 		.dynamic = 1,
396 		.ops = &kabylake_dmic_ops,
397 	},
398 	[KBL_DPCM_AUDIO_HDMI1_PB] = {
399 		.name = "Kbl HDMI Port1",
400 		.stream_name = "Hdmi1",
401 		.cpu_dai_name = "HDMI1 Pin",
402 		.codec_name = "snd-soc-dummy",
403 		.codec_dai_name = "snd-soc-dummy-dai",
404 		.platform_name = "0000:00:1f.3",
405 		.dpcm_playback = 1,
406 		.init = NULL,
407 		.trigger = {
408 			SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
409 		.nonatomic = 1,
410 		.dynamic = 1,
411 	},
412 	[KBL_DPCM_AUDIO_HDMI2_PB] = {
413 		.name = "Kbl HDMI Port2",
414 		.stream_name = "Hdmi2",
415 		.cpu_dai_name = "HDMI2 Pin",
416 		.codec_name = "snd-soc-dummy",
417 		.codec_dai_name = "snd-soc-dummy-dai",
418 		.platform_name = "0000:00:1f.3",
419 		.dpcm_playback = 1,
420 		.init = NULL,
421 		.trigger = {
422 			SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
423 		.nonatomic = 1,
424 		.dynamic = 1,
425 	},
426 	[KBL_DPCM_AUDIO_HDMI3_PB] = {
427 		.name = "Kbl HDMI Port3",
428 		.stream_name = "Hdmi3",
429 		.cpu_dai_name = "HDMI3 Pin",
430 		.codec_name = "snd-soc-dummy",
431 		.codec_dai_name = "snd-soc-dummy-dai",
432 		.platform_name = "0000:00:1f.3",
433 		.trigger = {
434 			SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
435 		.dpcm_playback = 1,
436 		.init = NULL,
437 		.nonatomic = 1,
438 		.dynamic = 1,
439 	},
440 
441 	/* Back End DAI links */
442 	{
443 		/* SSP0 - Codec */
444 		.name = "SSP0-Codec",
445 		.id = 0,
446 		.cpu_dai_name = "SSP0 Pin",
447 		.platform_name = "0000:00:1f.3",
448 		.no_pcm = 1,
449 		.codec_name = MAXIM_DEV0_NAME,
450 		.codec_dai_name = KBL_MAXIM_CODEC_DAI,
451 		.dai_fmt = SND_SOC_DAIFMT_I2S |
452 			SND_SOC_DAIFMT_NB_NF |
453 			SND_SOC_DAIFMT_CBS_CFS,
454 		.ignore_pmdown_time = 1,
455 		.be_hw_params_fixup = kabylake_ssp_fixup,
456 		.dpcm_playback = 1,
457 	},
458 	{
459 		/* SSP1 - Codec */
460 		.name = "SSP1-Codec",
461 		.id = 1,
462 		.cpu_dai_name = "SSP1 Pin",
463 		.platform_name = "0000:00:1f.3",
464 		.no_pcm = 1,
465 		.codec_name = "i2c-DLGS7219:00",
466 		.codec_dai_name = KBL_DIALOG_CODEC_DAI,
467 		.init = kabylake_da7219_codec_init,
468 		.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
469 			SND_SOC_DAIFMT_CBS_CFS,
470 		.ignore_pmdown_time = 1,
471 		.be_hw_params_fixup = kabylake_ssp_fixup,
472 		.dpcm_playback = 1,
473 		.dpcm_capture = 1,
474 	},
475 	{
476 		.name = "dmic01",
477 		.id = 2,
478 		.cpu_dai_name = "DMIC01 Pin",
479 		.codec_name = "dmic-codec",
480 		.codec_dai_name = "dmic-hifi",
481 		.platform_name = "0000:00:1f.3",
482 		.be_hw_params_fixup = kabylake_dmic_fixup,
483 		.ignore_suspend = 1,
484 		.dpcm_capture = 1,
485 		.no_pcm = 1,
486 	},
487 	{
488 		.name = "iDisp1",
489 		.id = 3,
490 		.cpu_dai_name = "iDisp1 Pin",
491 		.codec_name = "ehdaudio0D2",
492 		.codec_dai_name = "intel-hdmi-hifi1",
493 		.platform_name = "0000:00:1f.3",
494 		.dpcm_playback = 1,
495 		.init = kabylake_hdmi1_init,
496 		.no_pcm = 1,
497 	},
498 	{
499 		.name = "iDisp2",
500 		.id = 4,
501 		.cpu_dai_name = "iDisp2 Pin",
502 		.codec_name = "ehdaudio0D2",
503 		.codec_dai_name = "intel-hdmi-hifi2",
504 		.platform_name = "0000:00:1f.3",
505 		.init = kabylake_hdmi2_init,
506 		.dpcm_playback = 1,
507 		.no_pcm = 1,
508 	},
509 	{
510 		.name = "iDisp3",
511 		.id = 5,
512 		.cpu_dai_name = "iDisp3 Pin",
513 		.codec_name = "ehdaudio0D2",
514 		.codec_dai_name = "intel-hdmi-hifi3",
515 		.platform_name = "0000:00:1f.3",
516 		.init = kabylake_hdmi3_init,
517 		.dpcm_playback = 1,
518 		.no_pcm = 1,
519 	},
520 };
521 
522 #define NAME_SIZE	32
523 static int kabylake_card_late_probe(struct snd_soc_card *card)
524 {
525 	struct kbl_codec_private *ctx = snd_soc_card_get_drvdata(card);
526 	struct kbl_hdmi_pcm *pcm;
527 	struct snd_soc_component *component = NULL;
528 	int err, i = 0;
529 	char jack_name[NAME_SIZE];
530 
531 	list_for_each_entry(pcm, &ctx->hdmi_pcm_list, head) {
532 		component = pcm->codec_dai->component;
533 		snprintf(jack_name, sizeof(jack_name),
534 			"HDMI/DP, pcm=%d Jack", pcm->device);
535 		err = snd_soc_card_jack_new(card, jack_name,
536 					SND_JACK_AVOUT, &skylake_hdmi[i],
537 					NULL, 0);
538 
539 		if (err)
540 			return err;
541 
542 		err = hdac_hdmi_jack_init(pcm->codec_dai, pcm->device,
543 				&skylake_hdmi[i]);
544 		if (err < 0)
545 			return err;
546 
547 		i++;
548 
549 	}
550 
551 	if (!component)
552 		return -EINVAL;
553 
554 	return hdac_hdmi_jack_port_init(component, &card->dapm);
555 }
556 
557 /* kabylake audio machine driver for SPT + DA7219 */
558 static struct snd_soc_card kabylake_audio_card_da7219_m98357a = {
559 	.name = "kblda7219max",
560 	.owner = THIS_MODULE,
561 	.dai_link = kabylake_dais,
562 	.num_links = ARRAY_SIZE(kabylake_dais),
563 	.controls = kabylake_controls,
564 	.num_controls = ARRAY_SIZE(kabylake_controls),
565 	.dapm_widgets = kabylake_widgets,
566 	.num_dapm_widgets = ARRAY_SIZE(kabylake_widgets),
567 	.dapm_routes = kabylake_map,
568 	.num_dapm_routes = ARRAY_SIZE(kabylake_map),
569 	.fully_routed = true,
570 	.late_probe = kabylake_card_late_probe,
571 };
572 
573 static int kabylake_audio_probe(struct platform_device *pdev)
574 {
575 	struct kbl_codec_private *ctx;
576 
577 	ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL);
578 	if (!ctx)
579 		return -ENOMEM;
580 
581 	INIT_LIST_HEAD(&ctx->hdmi_pcm_list);
582 
583 	kabylake_audio_card =
584 		(struct snd_soc_card *)pdev->id_entry->driver_data;
585 
586 	kabylake_audio_card->dev = &pdev->dev;
587 	snd_soc_card_set_drvdata(kabylake_audio_card, ctx);
588 	return devm_snd_soc_register_card(&pdev->dev, kabylake_audio_card);
589 }
590 
591 static const struct platform_device_id kbl_board_ids[] = {
592 	{
593 		.name = "kbl_da7219_max98357a",
594 		.driver_data =
595 			(kernel_ulong_t)&kabylake_audio_card_da7219_m98357a,
596 	},
597 	{ }
598 };
599 
600 static struct platform_driver kabylake_audio = {
601 	.probe = kabylake_audio_probe,
602 	.driver = {
603 		.name = "kbl_da7219_max98357a",
604 		.pm = &snd_soc_pm_ops,
605 	},
606 	.id_table = kbl_board_ids,
607 };
608 
609 module_platform_driver(kabylake_audio)
610 
611 /* Module information */
612 MODULE_DESCRIPTION("Audio Machine driver-DA7219 & MAX98357A in I2S mode");
613 MODULE_AUTHOR("Naveen Manohar <naveen.m@intel.com>");
614 MODULE_LICENSE("GPL v2");
615 MODULE_ALIAS("platform:kbl_da7219_max98357a");
616