xref: /openbmc/linux/sound/soc/intel/boards/bxt_rt298.c (revision 0c874100)
1 /*
2  * Intel Broxton-P I2S Machine Driver
3  *
4  * Copyright (C) 2014-2016, Intel Corporation. All rights reserved.
5  *
6  * Modified from:
7  *   Intel Skylake I2S Machine driver
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License version
11  * 2 as published by the Free Software Foundation.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  */
18 
19 #include <linux/module.h>
20 #include <linux/platform_device.h>
21 #include <sound/core.h>
22 #include <sound/pcm.h>
23 #include <sound/soc.h>
24 #include <sound/jack.h>
25 #include <sound/pcm_params.h>
26 #include "../../codecs/hdac_hdmi.h"
27 #include "../../codecs/rt298.h"
28 
29 /* Headset jack detection DAPM pins */
30 static struct snd_soc_jack broxton_headset;
31 static struct snd_soc_jack broxton_hdmi[3];
32 
33 struct bxt_hdmi_pcm {
34 	struct list_head head;
35 	struct snd_soc_dai *codec_dai;
36 	int device;
37 };
38 
39 struct bxt_rt286_private {
40 	struct list_head hdmi_pcm_list;
41 };
42 
43 enum {
44 	BXT_DPCM_AUDIO_PB = 0,
45 	BXT_DPCM_AUDIO_CP,
46 	BXT_DPCM_AUDIO_REF_CP,
47 	BXT_DPCM_AUDIO_DMIC_CP,
48 	BXT_DPCM_AUDIO_HDMI1_PB,
49 	BXT_DPCM_AUDIO_HDMI2_PB,
50 	BXT_DPCM_AUDIO_HDMI3_PB,
51 };
52 
53 static struct snd_soc_jack_pin broxton_headset_pins[] = {
54 	{
55 		.pin = "Mic Jack",
56 		.mask = SND_JACK_MICROPHONE,
57 	},
58 	{
59 		.pin = "Headphone Jack",
60 		.mask = SND_JACK_HEADPHONE,
61 	},
62 };
63 
64 static const struct snd_kcontrol_new broxton_controls[] = {
65 	SOC_DAPM_PIN_SWITCH("Speaker"),
66 	SOC_DAPM_PIN_SWITCH("Headphone Jack"),
67 	SOC_DAPM_PIN_SWITCH("Mic Jack"),
68 };
69 
70 static const struct snd_soc_dapm_widget broxton_widgets[] = {
71 	SND_SOC_DAPM_HP("Headphone Jack", NULL),
72 	SND_SOC_DAPM_SPK("Speaker", NULL),
73 	SND_SOC_DAPM_MIC("Mic Jack", NULL),
74 	SND_SOC_DAPM_MIC("DMIC2", NULL),
75 	SND_SOC_DAPM_MIC("SoC DMIC", NULL),
76 	SND_SOC_DAPM_SPK("HDMI1", NULL),
77 	SND_SOC_DAPM_SPK("HDMI2", NULL),
78 	SND_SOC_DAPM_SPK("HDMI3", NULL),
79 };
80 
81 static const struct snd_soc_dapm_route broxton_rt298_map[] = {
82 	/* speaker */
83 	{"Speaker", NULL, "SPOR"},
84 	{"Speaker", NULL, "SPOL"},
85 
86 	/* HP jack connectors - unknown if we have jack detect */
87 	{"Headphone Jack", NULL, "HPO Pin"},
88 
89 	/* other jacks */
90 	{"MIC1", NULL, "Mic Jack"},
91 
92 	/* digital mics */
93 	{"DMIC1 Pin", NULL, "DMIC2"},
94 	{"DMic", NULL, "SoC DMIC"},
95 
96 	{"HDMI1", NULL, "hif5-0 Output"},
97 	{"HDMI2", NULL, "hif6-0 Output"},
98 	{"HDMI2", NULL, "hif7-0 Output"},
99 
100 	/* CODEC BE connections */
101 	{ "AIF1 Playback", NULL, "ssp5 Tx"},
102 	{ "ssp5 Tx", NULL, "codec0_out"},
103 	{ "ssp5 Tx", NULL, "codec1_out"},
104 
105 	{ "codec0_in", NULL, "ssp5 Rx" },
106 	{ "ssp5 Rx", NULL, "AIF1 Capture" },
107 
108 	{ "dmic01_hifi", NULL, "DMIC01 Rx" },
109 	{ "DMIC01 Rx", NULL, "Capture" },
110 
111 	{ "hifi3", NULL, "iDisp3 Tx"},
112 	{ "iDisp3 Tx", NULL, "iDisp3_out"},
113 	{ "hifi2", NULL, "iDisp2 Tx"},
114 	{ "iDisp2 Tx", NULL, "iDisp2_out"},
115 	{ "hifi1", NULL, "iDisp1 Tx"},
116 	{ "iDisp1 Tx", NULL, "iDisp1_out"},
117 };
118 
119 static const struct snd_soc_dapm_route geminilake_rt298_map[] = {
120 	/* speaker */
121 	{"Speaker", NULL, "SPOR"},
122 	{"Speaker", NULL, "SPOL"},
123 
124 	/* HP jack connectors - unknown if we have jack detect */
125 	{"Headphone Jack", NULL, "HPO Pin"},
126 
127 	/* other jacks */
128 	{"MIC1", NULL, "Mic Jack"},
129 
130 	/* digital mics */
131 	{"DMIC1 Pin", NULL, "DMIC2"},
132 	{"DMic", NULL, "SoC DMIC"},
133 
134 	{"HDMI1", NULL, "hif5-0 Output"},
135 	{"HDMI2", NULL, "hif6-0 Output"},
136 	{"HDMI2", NULL, "hif7-0 Output"},
137 
138 	/* CODEC BE connections */
139 	{ "AIF1 Playback", NULL, "ssp2 Tx"},
140 	{ "ssp2 Tx", NULL, "codec0_out"},
141 	{ "ssp2 Tx", NULL, "codec1_out"},
142 
143 	{ "codec0_in", NULL, "ssp2 Rx" },
144 	{ "ssp2 Rx", NULL, "AIF1 Capture" },
145 
146 	{ "dmic01_hifi", NULL, "DMIC01 Rx" },
147 	{ "DMIC01 Rx", NULL, "Capture" },
148 
149 	{ "dmic_voice", NULL, "DMIC16k Rx" },
150 	{ "DMIC16k Rx", NULL, "Capture" },
151 
152 	{ "hifi3", NULL, "iDisp3 Tx"},
153 	{ "iDisp3 Tx", NULL, "iDisp3_out"},
154 	{ "hifi2", NULL, "iDisp2 Tx"},
155 	{ "iDisp2 Tx", NULL, "iDisp2_out"},
156 	{ "hifi1", NULL, "iDisp1 Tx"},
157 	{ "iDisp1 Tx", NULL, "iDisp1_out"},
158 };
159 
160 static int broxton_rt298_fe_init(struct snd_soc_pcm_runtime *rtd)
161 {
162 	struct snd_soc_dapm_context *dapm;
163 	struct snd_soc_component *component = rtd->cpu_dai->component;
164 
165 	dapm = snd_soc_component_get_dapm(component);
166 	snd_soc_dapm_ignore_suspend(dapm, "Reference Capture");
167 
168 	return 0;
169 }
170 
171 static int broxton_rt298_codec_init(struct snd_soc_pcm_runtime *rtd)
172 {
173 	struct snd_soc_component *component = rtd->codec_dai->component;
174 	int ret = 0;
175 
176 	ret = snd_soc_card_jack_new(rtd->card, "Headset",
177 		SND_JACK_HEADSET | SND_JACK_BTN_0,
178 		&broxton_headset,
179 		broxton_headset_pins, ARRAY_SIZE(broxton_headset_pins));
180 
181 	if (ret)
182 		return ret;
183 
184 	rt298_mic_detect(component, &broxton_headset);
185 
186 	snd_soc_dapm_ignore_suspend(&rtd->card->dapm, "SoC DMIC");
187 
188 	return 0;
189 }
190 
191 static int broxton_hdmi_init(struct snd_soc_pcm_runtime *rtd)
192 {
193 	struct bxt_rt286_private *ctx = snd_soc_card_get_drvdata(rtd->card);
194 	struct snd_soc_dai *dai = rtd->codec_dai;
195 	struct bxt_hdmi_pcm *pcm;
196 
197 	pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL);
198 	if (!pcm)
199 		return -ENOMEM;
200 
201 	pcm->device = BXT_DPCM_AUDIO_HDMI1_PB + dai->id;
202 	pcm->codec_dai = dai;
203 
204 	list_add_tail(&pcm->head, &ctx->hdmi_pcm_list);
205 
206 	return 0;
207 }
208 
209 static int broxton_ssp5_fixup(struct snd_soc_pcm_runtime *rtd,
210 			struct snd_pcm_hw_params *params)
211 {
212 	struct snd_interval *rate = hw_param_interval(params,
213 					SNDRV_PCM_HW_PARAM_RATE);
214 	struct snd_interval *channels = hw_param_interval(params,
215 					SNDRV_PCM_HW_PARAM_CHANNELS);
216 	struct snd_mask *fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
217 
218 	/* The ADSP will covert the FE rate to 48k, stereo */
219 	rate->min = rate->max = 48000;
220 	channels->min = channels->max = 2;
221 
222 	/* set SSP5 to 24 bit */
223 	snd_mask_none(fmt);
224 	snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S24_LE);
225 
226 	return 0;
227 }
228 
229 static int broxton_rt298_hw_params(struct snd_pcm_substream *substream,
230 	struct snd_pcm_hw_params *params)
231 {
232 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
233 	struct snd_soc_dai *codec_dai = rtd->codec_dai;
234 	int ret;
235 
236 	ret = snd_soc_dai_set_sysclk(codec_dai, RT298_SCLK_S_PLL,
237 					19200000, SND_SOC_CLOCK_IN);
238 	if (ret < 0) {
239 		dev_err(rtd->dev, "can't set codec sysclk configuration\n");
240 		return ret;
241 	}
242 
243 	return ret;
244 }
245 
246 static const struct snd_soc_ops broxton_rt298_ops = {
247 	.hw_params = broxton_rt298_hw_params,
248 };
249 
250 static const unsigned int rates[] = {
251 	48000,
252 };
253 
254 static const struct snd_pcm_hw_constraint_list constraints_rates = {
255 	.count = ARRAY_SIZE(rates),
256 	.list  = rates,
257 	.mask = 0,
258 };
259 
260 static int broxton_dmic_fixup(struct snd_soc_pcm_runtime *rtd,
261 				struct snd_pcm_hw_params *params)
262 {
263 	struct snd_interval *channels = hw_param_interval(params,
264 						SNDRV_PCM_HW_PARAM_CHANNELS);
265 	channels->min = channels->max = 4;
266 
267 	return 0;
268 }
269 
270 static const unsigned int channels_dmic[] = {
271 	1, 2, 3, 4,
272 };
273 
274 static const struct snd_pcm_hw_constraint_list constraints_dmic_channels = {
275 	.count = ARRAY_SIZE(channels_dmic),
276 	.list = channels_dmic,
277 	.mask = 0,
278 };
279 
280 static int broxton_dmic_startup(struct snd_pcm_substream *substream)
281 {
282 	struct snd_pcm_runtime *runtime = substream->runtime;
283 
284 	runtime->hw.channels_max = 4;
285 	snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
286 					&constraints_dmic_channels);
287 
288 	return snd_pcm_hw_constraint_list(substream->runtime, 0,
289 				SNDRV_PCM_HW_PARAM_RATE, &constraints_rates);
290 }
291 
292 static const struct snd_soc_ops broxton_dmic_ops = {
293 	.startup = broxton_dmic_startup,
294 };
295 
296 static const unsigned int channels[] = {
297 	2,
298 };
299 
300 static const struct snd_pcm_hw_constraint_list constraints_channels = {
301 	.count = ARRAY_SIZE(channels),
302 	.list = channels,
303 	.mask = 0,
304 };
305 
306 static int bxt_fe_startup(struct snd_pcm_substream *substream)
307 {
308 	struct snd_pcm_runtime *runtime = substream->runtime;
309 
310 	/*
311 	 * on this platform for PCM device we support:
312 	 *      48Khz
313 	 *      stereo
314 	 *	16-bit audio
315 	 */
316 
317 	runtime->hw.channels_max = 2;
318 	snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
319 				&constraints_channels);
320 
321 	runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE;
322 	snd_pcm_hw_constraint_msbits(runtime, 0, 16, 16);
323 	snd_pcm_hw_constraint_list(runtime, 0,
324 				SNDRV_PCM_HW_PARAM_RATE, &constraints_rates);
325 
326 	return 0;
327 }
328 
329 static const struct snd_soc_ops broxton_rt286_fe_ops = {
330 	.startup = bxt_fe_startup,
331 };
332 
333 /* broxton digital audio interface glue - connects codec <--> CPU */
334 static struct snd_soc_dai_link broxton_rt298_dais[] = {
335 	/* Front End DAI links */
336 	[BXT_DPCM_AUDIO_PB] =
337 	{
338 		.name = "Bxt Audio Port",
339 		.stream_name = "Audio",
340 		.cpu_dai_name = "System Pin",
341 		.platform_name = "0000:00:0e.0",
342 		.nonatomic = 1,
343 		.dynamic = 1,
344 		.codec_name = "snd-soc-dummy",
345 		.codec_dai_name = "snd-soc-dummy-dai",
346 		.init = broxton_rt298_fe_init,
347 		.trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
348 		.dpcm_playback = 1,
349 		.ops = &broxton_rt286_fe_ops,
350 	},
351 	[BXT_DPCM_AUDIO_CP] =
352 	{
353 		.name = "Bxt Audio Capture Port",
354 		.stream_name = "Audio Record",
355 		.cpu_dai_name = "System Pin",
356 		.platform_name = "0000:00:0e.0",
357 		.nonatomic = 1,
358 		.dynamic = 1,
359 		.codec_name = "snd-soc-dummy",
360 		.codec_dai_name = "snd-soc-dummy-dai",
361 		.trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
362 		.dpcm_capture = 1,
363 		.ops = &broxton_rt286_fe_ops,
364 	},
365 	[BXT_DPCM_AUDIO_REF_CP] =
366 	{
367 		.name = "Bxt Audio Reference cap",
368 		.stream_name = "refcap",
369 		.cpu_dai_name = "Reference Pin",
370 		.codec_name = "snd-soc-dummy",
371 		.codec_dai_name = "snd-soc-dummy-dai",
372 		.platform_name = "0000:00:0e.0",
373 		.init = NULL,
374 		.dpcm_capture = 1,
375 		.nonatomic = 1,
376 		.dynamic = 1,
377 	},
378 	[BXT_DPCM_AUDIO_DMIC_CP] =
379 	{
380 		.name = "Bxt Audio DMIC cap",
381 		.stream_name = "dmiccap",
382 		.cpu_dai_name = "DMIC Pin",
383 		.codec_name = "snd-soc-dummy",
384 		.codec_dai_name = "snd-soc-dummy-dai",
385 		.platform_name = "0000:00:0e.0",
386 		.init = NULL,
387 		.dpcm_capture = 1,
388 		.nonatomic = 1,
389 		.dynamic = 1,
390 		.ops = &broxton_dmic_ops,
391 	},
392 	[BXT_DPCM_AUDIO_HDMI1_PB] =
393 	{
394 		.name = "Bxt HDMI Port1",
395 		.stream_name = "Hdmi1",
396 		.cpu_dai_name = "HDMI1 Pin",
397 		.codec_name = "snd-soc-dummy",
398 		.codec_dai_name = "snd-soc-dummy-dai",
399 		.platform_name = "0000:00:0e.0",
400 		.dpcm_playback = 1,
401 		.init = NULL,
402 		.nonatomic = 1,
403 		.dynamic = 1,
404 	},
405 	[BXT_DPCM_AUDIO_HDMI2_PB] =
406 	{
407 		.name = "Bxt HDMI Port2",
408 		.stream_name = "Hdmi2",
409 		.cpu_dai_name = "HDMI2 Pin",
410 		.codec_name = "snd-soc-dummy",
411 		.codec_dai_name = "snd-soc-dummy-dai",
412 		.platform_name = "0000:00:0e.0",
413 		.dpcm_playback = 1,
414 		.init = NULL,
415 		.nonatomic = 1,
416 		.dynamic = 1,
417 	},
418 	[BXT_DPCM_AUDIO_HDMI3_PB] =
419 	{
420 		.name = "Bxt HDMI Port3",
421 		.stream_name = "Hdmi3",
422 		.cpu_dai_name = "HDMI3 Pin",
423 		.codec_name = "snd-soc-dummy",
424 		.codec_dai_name = "snd-soc-dummy-dai",
425 		.platform_name = "0000:00:0e.0",
426 		.dpcm_playback = 1,
427 		.init = NULL,
428 		.nonatomic = 1,
429 		.dynamic = 1,
430 	},
431 	/* Back End DAI links */
432 	{
433 		/* SSP5 - Codec */
434 		.name = "SSP5-Codec",
435 		.id = 0,
436 		.cpu_dai_name = "SSP5 Pin",
437 		.platform_name = "0000:00:0e.0",
438 		.no_pcm = 1,
439 		.codec_name = "i2c-INT343A:00",
440 		.codec_dai_name = "rt298-aif1",
441 		.init = broxton_rt298_codec_init,
442 		.dai_fmt = SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_NB_NF |
443 						SND_SOC_DAIFMT_CBS_CFS,
444 		.ignore_pmdown_time = 1,
445 		.be_hw_params_fixup = broxton_ssp5_fixup,
446 		.ops = &broxton_rt298_ops,
447 		.dpcm_playback = 1,
448 		.dpcm_capture = 1,
449 	},
450 	{
451 		.name = "dmic01",
452 		.id = 1,
453 		.cpu_dai_name = "DMIC01 Pin",
454 		.codec_name = "dmic-codec",
455 		.codec_dai_name = "dmic-hifi",
456 		.platform_name = "0000:00:0e.0",
457 		.be_hw_params_fixup = broxton_dmic_fixup,
458 		.ignore_suspend = 1,
459 		.dpcm_capture = 1,
460 		.no_pcm = 1,
461 	},
462 	{
463 		.name = "dmic16k",
464 		.id = 2,
465 		.cpu_dai_name = "DMIC16k Pin",
466 		.codec_name = "dmic-codec",
467 		.codec_dai_name = "dmic-hifi",
468 		.platform_name = "0000:00:0e.0",
469 		.be_hw_params_fixup = broxton_dmic_fixup,
470 		.ignore_suspend = 1,
471 		.dpcm_capture = 1,
472 		.no_pcm = 1,
473 	},
474 	{
475 		.name = "iDisp1",
476 		.id = 3,
477 		.cpu_dai_name = "iDisp1 Pin",
478 		.codec_name = "ehdaudio0D2",
479 		.codec_dai_name = "intel-hdmi-hifi1",
480 		.platform_name = "0000:00:0e.0",
481 		.init = broxton_hdmi_init,
482 		.dpcm_playback = 1,
483 		.no_pcm = 1,
484 	},
485 	{
486 		.name = "iDisp2",
487 		.id = 4,
488 		.cpu_dai_name = "iDisp2 Pin",
489 		.codec_name = "ehdaudio0D2",
490 		.codec_dai_name = "intel-hdmi-hifi2",
491 		.platform_name = "0000:00:0e.0",
492 		.init = broxton_hdmi_init,
493 		.dpcm_playback = 1,
494 		.no_pcm = 1,
495 	},
496 	{
497 		.name = "iDisp3",
498 		.id = 5,
499 		.cpu_dai_name = "iDisp3 Pin",
500 		.codec_name = "ehdaudio0D2",
501 		.codec_dai_name = "intel-hdmi-hifi3",
502 		.platform_name = "0000:00:0e.0",
503 		.init = broxton_hdmi_init,
504 		.dpcm_playback = 1,
505 		.no_pcm = 1,
506 	},
507 };
508 
509 #define NAME_SIZE	32
510 static int bxt_card_late_probe(struct snd_soc_card *card)
511 {
512 	struct bxt_rt286_private *ctx = snd_soc_card_get_drvdata(card);
513 	struct bxt_hdmi_pcm *pcm;
514 	struct snd_soc_component *component = NULL;
515 	int err, i = 0;
516 	char jack_name[NAME_SIZE];
517 
518 	list_for_each_entry(pcm, &ctx->hdmi_pcm_list, head) {
519 		component = pcm->codec_dai->component;
520 		snprintf(jack_name, sizeof(jack_name),
521 			"HDMI/DP, pcm=%d Jack", pcm->device);
522 		err = snd_soc_card_jack_new(card, jack_name,
523 					SND_JACK_AVOUT, &broxton_hdmi[i],
524 					NULL, 0);
525 
526 		if (err)
527 			return err;
528 
529 		err = hdac_hdmi_jack_init(pcm->codec_dai, pcm->device,
530 						&broxton_hdmi[i]);
531 		if (err < 0)
532 			return err;
533 
534 		i++;
535 	}
536 
537 	if (!component)
538 		return -EINVAL;
539 
540 	return hdac_hdmi_jack_port_init(component, &card->dapm);
541 }
542 
543 
544 /* broxton audio machine driver for SPT + RT298S */
545 static struct snd_soc_card broxton_rt298 = {
546 	.name = "broxton-rt298",
547 	.dai_link = broxton_rt298_dais,
548 	.num_links = ARRAY_SIZE(broxton_rt298_dais),
549 	.controls = broxton_controls,
550 	.num_controls = ARRAY_SIZE(broxton_controls),
551 	.dapm_widgets = broxton_widgets,
552 	.num_dapm_widgets = ARRAY_SIZE(broxton_widgets),
553 	.dapm_routes = broxton_rt298_map,
554 	.num_dapm_routes = ARRAY_SIZE(broxton_rt298_map),
555 	.fully_routed = true,
556 	.late_probe = bxt_card_late_probe,
557 
558 };
559 
560 static struct snd_soc_card geminilake_rt298 = {
561 	.name = "geminilake-rt298",
562 	.dai_link = broxton_rt298_dais,
563 	.num_links = ARRAY_SIZE(broxton_rt298_dais),
564 	.controls = broxton_controls,
565 	.num_controls = ARRAY_SIZE(broxton_controls),
566 	.dapm_widgets = broxton_widgets,
567 	.num_dapm_widgets = ARRAY_SIZE(broxton_widgets),
568 	.dapm_routes = geminilake_rt298_map,
569 	.num_dapm_routes = ARRAY_SIZE(geminilake_rt298_map),
570 	.fully_routed = true,
571 	.late_probe = bxt_card_late_probe,
572 };
573 
574 static int broxton_audio_probe(struct platform_device *pdev)
575 {
576 	struct bxt_rt286_private *ctx;
577 	struct snd_soc_card *card =
578 			(struct snd_soc_card *)pdev->id_entry->driver_data;
579 	int i;
580 
581 	for (i = 0; i < ARRAY_SIZE(broxton_rt298_dais); i++) {
582 		if (!strncmp(card->dai_link[i].codec_name, "i2c-INT343A:00",
583 						I2C_NAME_SIZE)) {
584 			if (!strncmp(card->name, "broxton-rt298",
585 						PLATFORM_NAME_SIZE)) {
586 				card->dai_link[i].name = "SSP5-Codec";
587 				card->dai_link[i].cpu_dai_name = "SSP5 Pin";
588 			} else if (!strncmp(card->name, "geminilake-rt298",
589 						PLATFORM_NAME_SIZE)) {
590 				card->dai_link[i].name = "SSP2-Codec";
591 				card->dai_link[i].cpu_dai_name = "SSP2 Pin";
592 			}
593 		}
594 	}
595 
596 	ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL);
597 	if (!ctx)
598 		return -ENOMEM;
599 
600 	INIT_LIST_HEAD(&ctx->hdmi_pcm_list);
601 
602 	card->dev = &pdev->dev;
603 	snd_soc_card_set_drvdata(card, ctx);
604 
605 	return devm_snd_soc_register_card(&pdev->dev, card);
606 }
607 
608 static const struct platform_device_id bxt_board_ids[] = {
609 	{ .name = "bxt_alc298s_i2s", .driver_data =
610 				(unsigned long)&broxton_rt298 },
611 	{ .name = "glk_alc298s_i2s", .driver_data =
612 				(unsigned long)&geminilake_rt298 },
613 	{}
614 };
615 
616 static struct platform_driver broxton_audio = {
617 	.probe = broxton_audio_probe,
618 	.driver = {
619 		.name = "bxt_alc298s_i2s",
620 		.pm = &snd_soc_pm_ops,
621 	},
622 	.id_table = bxt_board_ids,
623 };
624 module_platform_driver(broxton_audio)
625 
626 /* Module information */
627 MODULE_AUTHOR("Ramesh Babu <Ramesh.Babu@intel.com>");
628 MODULE_AUTHOR("Senthilnathan Veppur <senthilnathanx.veppur@intel.com>");
629 MODULE_DESCRIPTION("Intel SST Audio for Broxton");
630 MODULE_LICENSE("GPL v2");
631 MODULE_ALIAS("platform:bxt_alc298s_i2s");
632 MODULE_ALIAS("platform:glk_alc298s_i2s");
633