2 * Intel Kabylake I2S Machine Driver with MAXIM98927
5 * Copyright (C) 2017, Intel Corporation. All rights reserved.
8 * Intel Skylake I2S Machine driver
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License version
12 * 2 as published by the Free Software Foundation.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
20 #include <linux/module.h>
21 #include <linux/platform_device.h>
22 #include <sound/core.h>
23 #include <sound/jack.h>
24 #include <sound/pcm.h>
25 #include <sound/pcm_params.h>
26 #include <sound/soc.h>
27 #include "../../codecs/rt5663.h"
28 #include "../../codecs/hdac_hdmi.h"
29 #include "../skylake/skl.h"
31 #define KBL_REALTEK_CODEC_DAI "rt5663-aif"
32 #define KBL_MAXIM_CODEC_DAI "max98927-aif1"
33 #define DMIC_CH(p) p->list[p->count-1]
34 #define MAXIM_DEV0_NAME "i2c-MX98927:00"
35 #define MAXIM_DEV1_NAME "i2c-MX98927:01"
37 static struct snd_soc_card *kabylake_audio_card;
38 static const struct snd_pcm_hw_constraint_list *dmic_constraints;
39 static struct snd_soc_jack skylake_hdmi[3];
42 struct list_head head;
43 struct snd_soc_dai *codec_dai;
47 struct kbl_rt5663_private {
48 struct snd_soc_jack kabylake_headset;
49 struct list_head hdmi_pcm_list;
53 KBL_DPCM_AUDIO_PB = 0,
56 KBL_DPCM_AUDIO_ECHO_REF_CP,
57 KBL_DPCM_AUDIO_REF_CP,
58 KBL_DPCM_AUDIO_DMIC_CP,
59 KBL_DPCM_AUDIO_HDMI1_PB,
60 KBL_DPCM_AUDIO_HDMI2_PB,
61 KBL_DPCM_AUDIO_HDMI3_PB,
64 static const struct snd_kcontrol_new kabylake_controls[] = {
65 SOC_DAPM_PIN_SWITCH("Headphone Jack"),
66 SOC_DAPM_PIN_SWITCH("Headset Mic"),
67 SOC_DAPM_PIN_SWITCH("Left Spk"),
68 SOC_DAPM_PIN_SWITCH("Right Spk"),
71 static const struct snd_soc_dapm_widget kabylake_widgets[] = {
72 SND_SOC_DAPM_HP("Headphone Jack", NULL),
73 SND_SOC_DAPM_MIC("Headset Mic", NULL),
74 SND_SOC_DAPM_SPK("Left Spk", NULL),
75 SND_SOC_DAPM_SPK("Right Spk", NULL),
76 SND_SOC_DAPM_MIC("SoC DMIC", NULL),
77 SND_SOC_DAPM_SPK("DP", NULL),
78 SND_SOC_DAPM_SPK("HDMI", NULL),
82 static const struct snd_soc_dapm_route kabylake_map[] = {
83 /* HP jack connectors - unknown if we have jack detection */
84 { "Headphone Jack", NULL, "HPOL" },
85 { "Headphone Jack", NULL, "HPOR" },
88 { "Left Spk", NULL, "Left BE_OUT" },
89 { "Right Spk", NULL, "Right BE_OUT" },
92 { "IN1P", NULL, "Headset Mic" },
93 { "IN1N", NULL, "Headset Mic" },
94 { "DMic", NULL, "SoC DMIC" },
96 { "HDMI", NULL, "hif5 Output" },
97 { "DP", NULL, "hif6 Output" },
99 /* CODEC BE connections */
100 { "Left HiFi Playback", NULL, "ssp0 Tx" },
101 { "Right HiFi Playback", NULL, "ssp0 Tx" },
102 { "ssp0 Tx", NULL, "spk_out" },
104 { "AIF Playback", NULL, "ssp1 Tx" },
105 { "ssp1 Tx", NULL, "hs_out" },
107 { "hs_in", NULL, "ssp1 Rx" },
108 { "ssp1 Rx", NULL, "AIF Capture" },
111 { "dmic01_hifi", NULL, "DMIC01 Rx" },
112 { "DMIC01 Rx", NULL, "DMIC AIF" },
114 { "hifi3", NULL, "iDisp3 Tx"},
115 { "iDisp3 Tx", NULL, "iDisp3_out"},
116 { "hifi2", NULL, "iDisp2 Tx"},
117 { "iDisp2 Tx", NULL, "iDisp2_out"},
118 { "hifi1", NULL, "iDisp1 Tx"},
119 { "iDisp1 Tx", NULL, "iDisp1_out"},
123 KBL_DPCM_AUDIO_5663_PB = 0,
124 KBL_DPCM_AUDIO_5663_CP,
125 KBL_DPCM_AUDIO_5663_HDMI1_PB,
126 KBL_DPCM_AUDIO_5663_HDMI2_PB,
129 static const struct snd_kcontrol_new kabylake_5663_controls[] = {
130 SOC_DAPM_PIN_SWITCH("Headphone Jack"),
131 SOC_DAPM_PIN_SWITCH("Headset Mic"),
134 static const struct snd_soc_dapm_widget kabylake_5663_widgets[] = {
135 SND_SOC_DAPM_HP("Headphone Jack", NULL),
136 SND_SOC_DAPM_MIC("Headset Mic", NULL),
137 SND_SOC_DAPM_SPK("DP", NULL),
138 SND_SOC_DAPM_SPK("HDMI", NULL),
141 static const struct snd_soc_dapm_route kabylake_5663_map[] = {
142 { "Headphone Jack", NULL, "HPOL" },
143 { "Headphone Jack", NULL, "HPOR" },
146 { "IN1P", NULL, "Headset Mic" },
147 { "IN1N", NULL, "Headset Mic" },
149 { "HDMI", NULL, "hif5 Output" },
150 { "DP", NULL, "hif6 Output" },
152 /* CODEC BE connections */
153 { "AIF Playback", NULL, "ssp1 Tx" },
154 { "ssp1 Tx", NULL, "codec1_out" },
156 { "codec0_in", NULL, "ssp1 Rx" },
157 { "ssp1 Rx", NULL, "AIF Capture" },
159 { "hifi2", NULL, "iDisp2 Tx"},
160 { "iDisp2 Tx", NULL, "iDisp2_out"},
161 { "hifi1", NULL, "iDisp1 Tx"},
162 { "iDisp1 Tx", NULL, "iDisp1_out"},
165 static struct snd_soc_codec_conf max98927_codec_conf[] = {
167 .dev_name = MAXIM_DEV0_NAME,
168 .name_prefix = "Right",
171 .dev_name = MAXIM_DEV1_NAME,
172 .name_prefix = "Left",
176 static struct snd_soc_dai_link_component max98927_codec_components[] = {
178 .name = MAXIM_DEV0_NAME,
179 .dai_name = KBL_MAXIM_CODEC_DAI,
182 .name = MAXIM_DEV1_NAME,
183 .dai_name = KBL_MAXIM_CODEC_DAI,
187 static int kabylake_rt5663_fe_init(struct snd_soc_pcm_runtime *rtd)
190 struct snd_soc_dapm_context *dapm;
191 struct snd_soc_component *component = rtd->cpu_dai->component;
193 dapm = snd_soc_component_get_dapm(component);
194 ret = snd_soc_dapm_ignore_suspend(dapm, "Reference Capture");
196 dev_err(rtd->dev, "Ref Cap ignore suspend failed %d\n", ret);
203 static int kabylake_rt5663_codec_init(struct snd_soc_pcm_runtime *rtd)
206 struct kbl_rt5663_private *ctx = snd_soc_card_get_drvdata(rtd->card);
207 struct snd_soc_codec *codec = rtd->codec;
210 * Headset buttons map to the google Reference headset.
211 * These can be configured by userspace.
213 ret = snd_soc_card_jack_new(kabylake_audio_card, "Headset Jack",
214 SND_JACK_HEADSET | SND_JACK_BTN_0 | SND_JACK_BTN_1 |
215 SND_JACK_BTN_2 | SND_JACK_BTN_3, &ctx->kabylake_headset,
218 dev_err(rtd->dev, "Headset Jack creation failed %d\n", ret);
221 rt5663_set_jack_detect(codec, &ctx->kabylake_headset);
225 static int kabylake_rt5663_max98927_codec_init(struct snd_soc_pcm_runtime *rtd)
229 ret = kabylake_rt5663_codec_init(rtd);
233 ret = snd_soc_dapm_ignore_suspend(&rtd->card->dapm, "SoC DMIC");
235 dev_err(rtd->dev, "SoC DMIC ignore suspend failed %d\n", ret);
242 static int kabylake_hdmi_init(struct snd_soc_pcm_runtime *rtd, int device)
244 struct kbl_rt5663_private *ctx = snd_soc_card_get_drvdata(rtd->card);
245 struct snd_soc_dai *dai = rtd->codec_dai;
246 struct kbl_hdmi_pcm *pcm;
248 pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL);
252 pcm->device = device;
253 pcm->codec_dai = dai;
255 list_add_tail(&pcm->head, &ctx->hdmi_pcm_list);
260 static int kabylake_hdmi1_init(struct snd_soc_pcm_runtime *rtd)
262 return kabylake_hdmi_init(rtd, KBL_DPCM_AUDIO_HDMI1_PB);
265 static int kabylake_hdmi2_init(struct snd_soc_pcm_runtime *rtd)
267 return kabylake_hdmi_init(rtd, KBL_DPCM_AUDIO_HDMI2_PB);
270 static int kabylake_hdmi3_init(struct snd_soc_pcm_runtime *rtd)
272 return kabylake_hdmi_init(rtd, KBL_DPCM_AUDIO_HDMI3_PB);
275 static int kabylake_5663_hdmi1_init(struct snd_soc_pcm_runtime *rtd)
277 return kabylake_hdmi_init(rtd, KBL_DPCM_AUDIO_5663_HDMI1_PB);
280 static int kabylake_5663_hdmi2_init(struct snd_soc_pcm_runtime *rtd)
282 return kabylake_hdmi_init(rtd, KBL_DPCM_AUDIO_5663_HDMI2_PB);
285 static unsigned int rates[] = {
289 static struct snd_pcm_hw_constraint_list constraints_rates = {
290 .count = ARRAY_SIZE(rates),
295 static unsigned int channels[] = {
299 static struct snd_pcm_hw_constraint_list constraints_channels = {
300 .count = ARRAY_SIZE(channels),
305 static int kbl_fe_startup(struct snd_pcm_substream *substream)
307 struct snd_pcm_runtime *runtime = substream->runtime;
310 * On this platform for PCM device we support,
316 runtime->hw.channels_max = 2;
317 snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
318 &constraints_channels);
320 runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE;
321 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);
329 static const struct snd_soc_ops kabylake_rt5663_fe_ops = {
330 .startup = kbl_fe_startup,
333 static int kabylake_ssp_fixup(struct snd_soc_pcm_runtime *rtd,
334 struct snd_pcm_hw_params *params)
336 struct snd_interval *rate = hw_param_interval(params,
337 SNDRV_PCM_HW_PARAM_RATE);
338 struct snd_interval *channels = hw_param_interval(params,
339 SNDRV_PCM_HW_PARAM_CHANNELS);
340 struct snd_mask *fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
342 /* The ADSP will convert the FE rate to 48k, stereo */
343 rate->min = rate->max = 48000;
344 channels->min = channels->max = 2;
345 /* set SSP1 to 24 bit */
347 snd_mask_set(fmt, SNDRV_PCM_FORMAT_S24_LE);
352 static int kabylake_rt5663_hw_params(struct snd_pcm_substream *substream,
353 struct snd_pcm_hw_params *params)
355 struct snd_soc_pcm_runtime *rtd = substream->private_data;
356 struct snd_soc_dai *codec_dai = rtd->codec_dai;
359 ret = snd_soc_dai_set_sysclk(codec_dai,
360 RT5663_SCLK_S_MCLK, 24576000, SND_SOC_CLOCK_IN);
361 /* use ASRC for internal clocks, as PLL rate isn't multiple of BCLK */
362 rt5663_sel_asrc_clk_src(codec_dai->codec, RT5663_DA_STEREO_FILTER, 1);
365 dev_err(rtd->dev, "snd_soc_dai_set_sysclk err = %d\n", ret);
370 static struct snd_soc_ops kabylake_rt5663_ops = {
371 .hw_params = kabylake_rt5663_hw_params,
374 static int kabylake_dmic_fixup(struct snd_soc_pcm_runtime *rtd,
375 struct snd_pcm_hw_params *params)
377 struct snd_interval *channels = hw_param_interval(params,
378 SNDRV_PCM_HW_PARAM_CHANNELS);
380 if (params_channels(params) == 2 || DMIC_CH(dmic_constraints) == 2)
381 channels->min = channels->max = 2;
383 channels->min = channels->max = 4;
388 static unsigned int channels_dmic[] = {
392 static struct snd_pcm_hw_constraint_list constraints_dmic_channels = {
393 .count = ARRAY_SIZE(channels_dmic),
394 .list = channels_dmic,
398 static const unsigned int dmic_2ch[] = {
402 static const struct snd_pcm_hw_constraint_list constraints_dmic_2ch = {
403 .count = ARRAY_SIZE(dmic_2ch),
408 static int kabylake_dmic_startup(struct snd_pcm_substream *substream)
410 struct snd_pcm_runtime *runtime = substream->runtime;
412 runtime->hw.channels_max = DMIC_CH(dmic_constraints);
413 snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
416 return snd_pcm_hw_constraint_list(substream->runtime, 0,
417 SNDRV_PCM_HW_PARAM_RATE, &constraints_rates);
420 static struct snd_soc_ops kabylake_dmic_ops = {
421 .startup = kabylake_dmic_startup,
424 static unsigned int rates_16000[] = {
428 static struct snd_pcm_hw_constraint_list constraints_16000 = {
429 .count = ARRAY_SIZE(rates_16000),
433 static const unsigned int ch_mono[] = {
437 static const struct snd_pcm_hw_constraint_list constraints_refcap = {
438 .count = ARRAY_SIZE(ch_mono),
442 static int kabylake_refcap_startup(struct snd_pcm_substream *substream)
444 substream->runtime->hw.channels_max = 1;
445 snd_pcm_hw_constraint_list(substream->runtime, 0,
446 SNDRV_PCM_HW_PARAM_CHANNELS,
447 &constraints_refcap);
449 return snd_pcm_hw_constraint_list(substream->runtime, 0,
450 SNDRV_PCM_HW_PARAM_RATE,
454 static struct snd_soc_ops skylaye_refcap_ops = {
455 .startup = kabylake_refcap_startup,
458 /* kabylake digital audio interface glue - connects codec <--> CPU */
459 static struct snd_soc_dai_link kabylake_dais[] = {
460 /* Front End DAI links */
461 [KBL_DPCM_AUDIO_PB] = {
462 .name = "Kbl Audio Port",
463 .stream_name = "Audio",
464 .cpu_dai_name = "System Pin",
465 .platform_name = "0000:00:1f.3",
467 .codec_name = "snd-soc-dummy",
468 .codec_dai_name = "snd-soc-dummy-dai",
470 .init = kabylake_rt5663_fe_init,
472 SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
474 .ops = &kabylake_rt5663_fe_ops,
476 [KBL_DPCM_AUDIO_CP] = {
477 .name = "Kbl Audio Capture Port",
478 .stream_name = "Audio Record",
479 .cpu_dai_name = "System Pin",
480 .platform_name = "0000:00:1f.3",
482 .codec_name = "snd-soc-dummy",
483 .codec_dai_name = "snd-soc-dummy-dai",
486 SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
488 .ops = &kabylake_rt5663_fe_ops,
490 [KBL_DPCM_AUDIO_HS_PB] = {
491 .name = "Kbl Audio Headset Playback",
492 .stream_name = "Headset Audio",
493 .cpu_dai_name = "System Pin2",
494 .codec_name = "snd-soc-dummy",
495 .codec_dai_name = "snd-soc-dummy-dai",
496 .platform_name = "0000:00:1f.3",
501 [KBL_DPCM_AUDIO_ECHO_REF_CP] = {
502 .name = "Kbl Audio Echo Reference cap",
503 .stream_name = "Echoreference Capture",
504 .cpu_dai_name = "Echoref Pin",
505 .codec_name = "snd-soc-dummy",
506 .codec_dai_name = "snd-soc-dummy-dai",
507 .platform_name = "0000:00:1f.3",
512 [KBL_DPCM_AUDIO_REF_CP] = {
513 .name = "Kbl Audio Reference cap",
514 .stream_name = "Wake on Voice",
515 .cpu_dai_name = "Reference Pin",
516 .codec_name = "snd-soc-dummy",
517 .codec_dai_name = "snd-soc-dummy-dai",
518 .platform_name = "0000:00:1f.3",
523 .ops = &skylaye_refcap_ops,
525 [KBL_DPCM_AUDIO_DMIC_CP] = {
526 .name = "Kbl Audio DMIC cap",
527 .stream_name = "dmiccap",
528 .cpu_dai_name = "DMIC Pin",
529 .codec_name = "snd-soc-dummy",
530 .codec_dai_name = "snd-soc-dummy-dai",
531 .platform_name = "0000:00:1f.3",
536 .ops = &kabylake_dmic_ops,
538 [KBL_DPCM_AUDIO_HDMI1_PB] = {
539 .name = "Kbl HDMI Port1",
540 .stream_name = "Hdmi1",
541 .cpu_dai_name = "HDMI1 Pin",
542 .codec_name = "snd-soc-dummy",
543 .codec_dai_name = "snd-soc-dummy-dai",
544 .platform_name = "0000:00:1f.3",
548 SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
552 [KBL_DPCM_AUDIO_HDMI2_PB] = {
553 .name = "Kbl HDMI Port2",
554 .stream_name = "Hdmi2",
555 .cpu_dai_name = "HDMI2 Pin",
556 .codec_name = "snd-soc-dummy",
557 .codec_dai_name = "snd-soc-dummy-dai",
558 .platform_name = "0000:00:1f.3",
562 SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
566 [KBL_DPCM_AUDIO_HDMI3_PB] = {
567 .name = "Kbl HDMI Port3",
568 .stream_name = "Hdmi3",
569 .cpu_dai_name = "HDMI3 Pin",
570 .codec_name = "snd-soc-dummy",
571 .codec_dai_name = "snd-soc-dummy-dai",
572 .platform_name = "0000:00:1f.3",
574 SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
581 /* Back End DAI links */
584 .name = "SSP0-Codec",
586 .cpu_dai_name = "SSP0 Pin",
587 .platform_name = "0000:00:1f.3",
589 .codecs = max98927_codec_components,
590 .num_codecs = ARRAY_SIZE(max98927_codec_components),
591 .dai_fmt = SND_SOC_DAIFMT_I2S |
592 SND_SOC_DAIFMT_NB_NF |
593 SND_SOC_DAIFMT_CBS_CFS,
594 .ignore_pmdown_time = 1,
595 .be_hw_params_fixup = kabylake_ssp_fixup,
600 .name = "SSP1-Codec",
602 .cpu_dai_name = "SSP1 Pin",
603 .platform_name = "0000:00:1f.3",
605 .codec_name = "i2c-10EC5663:00",
606 .codec_dai_name = KBL_REALTEK_CODEC_DAI,
607 .init = kabylake_rt5663_max98927_codec_init,
608 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
609 SND_SOC_DAIFMT_CBS_CFS,
610 .ignore_pmdown_time = 1,
611 .be_hw_params_fixup = kabylake_ssp_fixup,
612 .ops = &kabylake_rt5663_ops,
619 .cpu_dai_name = "DMIC01 Pin",
620 .codec_name = "dmic-codec",
621 .codec_dai_name = "dmic-hifi",
622 .platform_name = "0000:00:1f.3",
623 .be_hw_params_fixup = kabylake_dmic_fixup,
631 .cpu_dai_name = "iDisp1 Pin",
632 .codec_name = "ehdaudio0D2",
633 .codec_dai_name = "intel-hdmi-hifi1",
634 .platform_name = "0000:00:1f.3",
636 .init = kabylake_hdmi1_init,
642 .cpu_dai_name = "iDisp2 Pin",
643 .codec_name = "ehdaudio0D2",
644 .codec_dai_name = "intel-hdmi-hifi2",
645 .platform_name = "0000:00:1f.3",
646 .init = kabylake_hdmi2_init,
653 .cpu_dai_name = "iDisp3 Pin",
654 .codec_name = "ehdaudio0D2",
655 .codec_dai_name = "intel-hdmi-hifi3",
656 .platform_name = "0000:00:1f.3",
657 .init = kabylake_hdmi3_init,
663 static struct snd_soc_dai_link kabylake_5663_dais[] = {
664 /* Front End DAI links */
665 [KBL_DPCM_AUDIO_5663_PB] = {
666 .name = "Kbl Audio Port",
667 .stream_name = "Audio",
668 .cpu_dai_name = "System Pin",
669 .platform_name = "0000:00:1f.3",
671 .codec_name = "snd-soc-dummy",
672 .codec_dai_name = "snd-soc-dummy-dai",
675 SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
677 .ops = &kabylake_rt5663_fe_ops,
679 [KBL_DPCM_AUDIO_5663_CP] = {
680 .name = "Kbl Audio Capture Port",
681 .stream_name = "Audio Record",
682 .cpu_dai_name = "System Pin",
683 .platform_name = "0000:00:1f.3",
685 .codec_name = "snd-soc-dummy",
686 .codec_dai_name = "snd-soc-dummy-dai",
689 SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
691 .ops = &kabylake_rt5663_fe_ops,
693 [KBL_DPCM_AUDIO_5663_HDMI1_PB] = {
694 .name = "Kbl HDMI Port1",
695 .stream_name = "Hdmi1",
696 .cpu_dai_name = "HDMI1 Pin",
697 .codec_name = "snd-soc-dummy",
698 .codec_dai_name = "snd-soc-dummy-dai",
699 .platform_name = "0000:00:1f.3",
703 SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
707 [KBL_DPCM_AUDIO_5663_HDMI2_PB] = {
708 .name = "Kbl HDMI Port2",
709 .stream_name = "Hdmi2",
710 .cpu_dai_name = "HDMI2 Pin",
711 .codec_name = "snd-soc-dummy",
712 .codec_dai_name = "snd-soc-dummy-dai",
713 .platform_name = "0000:00:1f.3",
717 SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
722 /* Back End DAI links */
725 .name = "SSP1-Codec",
727 .cpu_dai_name = "SSP1 Pin",
728 .platform_name = "0000:00:1f.3",
730 .codec_name = "i2c-10EC5663:00",
731 .codec_dai_name = KBL_REALTEK_CODEC_DAI,
732 .init = kabylake_rt5663_codec_init,
733 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
734 SND_SOC_DAIFMT_CBS_CFS,
735 .ignore_pmdown_time = 1,
736 .be_hw_params_fixup = kabylake_ssp_fixup,
737 .ops = &kabylake_rt5663_ops,
744 .cpu_dai_name = "iDisp1 Pin",
745 .codec_name = "ehdaudio0D2",
746 .codec_dai_name = "intel-hdmi-hifi1",
747 .platform_name = "0000:00:1f.3",
749 .init = kabylake_5663_hdmi1_init,
755 .cpu_dai_name = "iDisp2 Pin",
756 .codec_name = "ehdaudio0D2",
757 .codec_dai_name = "intel-hdmi-hifi2",
758 .platform_name = "0000:00:1f.3",
759 .init = kabylake_5663_hdmi2_init,
766 static int kabylake_card_late_probe(struct snd_soc_card *card)
768 struct kbl_rt5663_private *ctx = snd_soc_card_get_drvdata(card);
769 struct kbl_hdmi_pcm *pcm;
771 char jack_name[NAME_SIZE];
773 list_for_each_entry(pcm, &ctx->hdmi_pcm_list, head) {
774 snprintf(jack_name, sizeof(jack_name),
775 "HDMI/DP, pcm=%d Jack", pcm->device);
776 err = snd_soc_card_jack_new(card, jack_name,
777 SND_JACK_AVOUT, &skylake_hdmi[i],
783 err = hdac_hdmi_jack_init(pcm->codec_dai, pcm->device,
794 /* kabylake audio machine driver for SPT + RT5663 */
795 static struct snd_soc_card kabylake_audio_card_rt5663_m98927 = {
796 .name = "kblrt5663max",
797 .owner = THIS_MODULE,
798 .dai_link = kabylake_dais,
799 .num_links = ARRAY_SIZE(kabylake_dais),
800 .controls = kabylake_controls,
801 .num_controls = ARRAY_SIZE(kabylake_controls),
802 .dapm_widgets = kabylake_widgets,
803 .num_dapm_widgets = ARRAY_SIZE(kabylake_widgets),
804 .dapm_routes = kabylake_map,
805 .num_dapm_routes = ARRAY_SIZE(kabylake_map),
806 .codec_conf = max98927_codec_conf,
807 .num_configs = ARRAY_SIZE(max98927_codec_conf),
808 .fully_routed = true,
809 .late_probe = kabylake_card_late_probe,
812 /* kabylake audio machine driver for RT5663 */
813 static struct snd_soc_card kabylake_audio_card_rt5663 = {
815 .owner = THIS_MODULE,
816 .dai_link = kabylake_5663_dais,
817 .num_links = ARRAY_SIZE(kabylake_5663_dais),
818 .controls = kabylake_5663_controls,
819 .num_controls = ARRAY_SIZE(kabylake_5663_controls),
820 .dapm_widgets = kabylake_5663_widgets,
821 .num_dapm_widgets = ARRAY_SIZE(kabylake_5663_widgets),
822 .dapm_routes = kabylake_5663_map,
823 .num_dapm_routes = ARRAY_SIZE(kabylake_5663_map),
824 .fully_routed = true,
825 .late_probe = kabylake_card_late_probe,
828 static int kabylake_audio_probe(struct platform_device *pdev)
830 struct kbl_rt5663_private *ctx;
831 struct skl_machine_pdata *pdata;
833 ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_ATOMIC);
837 INIT_LIST_HEAD(&ctx->hdmi_pcm_list);
839 kabylake_audio_card =
840 (struct snd_soc_card *)pdev->id_entry->driver_data;
842 kabylake_audio_card->dev = &pdev->dev;
843 snd_soc_card_set_drvdata(kabylake_audio_card, ctx);
845 pdata = dev_get_drvdata(&pdev->dev);
847 dmic_constraints = pdata->dmic_num == 2 ?
848 &constraints_dmic_2ch : &constraints_dmic_channels;
850 return devm_snd_soc_register_card(&pdev->dev, kabylake_audio_card);
853 static const struct platform_device_id kbl_board_ids[] = {
855 .name = "kbl_rt5663",
856 .driver_data = (kernel_ulong_t)&kabylake_audio_card_rt5663,
859 .name = "kbl_rt5663_m98927",
861 (kernel_ulong_t)&kabylake_audio_card_rt5663_m98927,
866 static struct platform_driver kabylake_audio = {
867 .probe = kabylake_audio_probe,
869 .name = "kbl_rt5663_m98927",
870 .pm = &snd_soc_pm_ops,
872 .id_table = kbl_board_ids,
875 module_platform_driver(kabylake_audio)
877 /* Module information */
878 MODULE_DESCRIPTION("Audio Machine driver-RT5663 & MAX98927 in I2S mode");
879 MODULE_AUTHOR("Naveen M <naveen.m@intel.com>");
880 MODULE_AUTHOR("Harsha Priya <harshapriya.n@intel.com>");
881 MODULE_LICENSE("GPL v2");
882 MODULE_ALIAS("platform:kbl_rt5663");
883 MODULE_ALIAS("platform:kbl_rt5663_m98927");