forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 1f93a7dfd1f8d5ff7a5c53246c7534fe2332d6f4
kernel/sound/soc/intel/boards/kbl_rt5663_max98927.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Intel Kabylake I2S Machine Driver with MAXIM98927
34 * and RT5663 Codecs
....@@ -6,15 +7,6 @@
67 *
78 * Modified from:
89 * Intel Skylake I2S Machine driver
9
- *
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.
13
- *
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.
1810 */
1911
2012 #include <linux/input.h>
....@@ -25,9 +17,9 @@
2517 #include <sound/pcm.h>
2618 #include <sound/pcm_params.h>
2719 #include <sound/soc.h>
20
+#include <sound/soc-acpi.h>
2821 #include "../../codecs/rt5663.h"
2922 #include "../../codecs/hdac_hdmi.h"
30
-#include "../skylake/skl.h"
3123 #include <linux/clk.h>
3224 #include <linux/clk-provider.h>
3325 #include <linux/clkdev.h>
....@@ -237,23 +229,12 @@
237229
238230 static struct snd_soc_codec_conf max98927_codec_conf[] = {
239231 {
240
- .dev_name = MAXIM_DEV0_NAME,
232
+ .dlc = COMP_CODEC_CONF(MAXIM_DEV0_NAME),
241233 .name_prefix = "Right",
242234 },
243235 {
244
- .dev_name = MAXIM_DEV1_NAME,
236
+ .dlc = COMP_CODEC_CONF(MAXIM_DEV1_NAME),
245237 .name_prefix = "Left",
246
- },
247
-};
248
-
249
-static struct snd_soc_dai_link_component max98927_codec_components[] = {
250
- { /* Left */
251
- .name = MAXIM_DEV0_NAME,
252
- .dai_name = KBL_MAXIM_CODEC_DAI,
253
- },
254
- { /* Right */
255
- .name = MAXIM_DEV1_NAME,
256
- .dai_name = KBL_MAXIM_CODEC_DAI,
257238 },
258239 };
259240
....@@ -261,7 +242,7 @@
261242 {
262243 int ret;
263244 struct snd_soc_dapm_context *dapm;
264
- struct snd_soc_component *component = rtd->cpu_dai->component;
245
+ struct snd_soc_component *component = asoc_rtd_to_cpu(rtd, 0)->component;
265246
266247 dapm = snd_soc_component_get_dapm(component);
267248 ret = snd_soc_dapm_ignore_suspend(dapm, "Reference Capture");
....@@ -277,7 +258,7 @@
277258 {
278259 int ret;
279260 struct kbl_rt5663_private *ctx = snd_soc_card_get_drvdata(rtd->card);
280
- struct snd_soc_component *component = rtd->codec_dai->component;
261
+ struct snd_soc_component *component = asoc_rtd_to_codec(rtd, 0)->component;
281262 struct snd_soc_jack *jack;
282263
283264 /*
....@@ -324,7 +305,7 @@
324305 static int kabylake_hdmi_init(struct snd_soc_pcm_runtime *rtd, int device)
325306 {
326307 struct kbl_rt5663_private *ctx = snd_soc_card_get_drvdata(rtd->card);
327
- struct snd_soc_dai *dai = rtd->codec_dai;
308
+ struct snd_soc_dai *dai = asoc_rtd_to_codec(rtd, 0);
328309 struct kbl_hdmi_pcm *pcm;
329310
330311 pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL);
....@@ -417,22 +398,45 @@
417398 {
418399 struct snd_interval *rate = hw_param_interval(params,
419400 SNDRV_PCM_HW_PARAM_RATE);
420
- struct snd_interval *channels = hw_param_interval(params,
401
+ struct snd_interval *chan = hw_param_interval(params,
421402 SNDRV_PCM_HW_PARAM_CHANNELS);
422403 struct snd_mask *fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
423
- struct snd_soc_dpcm *dpcm = container_of(
424
- params, struct snd_soc_dpcm, hw_params);
425
- struct snd_soc_dai_link *fe_dai_link = dpcm->fe->dai_link;
426
- struct snd_soc_dai_link *be_dai_link = dpcm->be->dai_link;
404
+ struct snd_soc_dpcm *dpcm, *rtd_dpcm = NULL;
405
+
406
+ /*
407
+ * The following loop will be called only for playback stream
408
+ * In this platform, there is only one playback device on every SSP
409
+ */
410
+ for_each_dpcm_fe(rtd, SNDRV_PCM_STREAM_PLAYBACK, dpcm) {
411
+ rtd_dpcm = dpcm;
412
+ break;
413
+ }
414
+
415
+ /*
416
+ * This following loop will be called only for capture stream
417
+ * In this platform, there is only one capture device on every SSP
418
+ */
419
+ for_each_dpcm_fe(rtd, SNDRV_PCM_STREAM_CAPTURE, dpcm) {
420
+ rtd_dpcm = dpcm;
421
+ break;
422
+ }
423
+
424
+ if (!rtd_dpcm)
425
+ return -EINVAL;
426
+
427
+ /*
428
+ * The above 2 loops are mutually exclusive based on the stream direction,
429
+ * thus rtd_dpcm variable will never be overwritten
430
+ */
427431
428432 /*
429433 * The ADSP will convert the FE rate to 48k, stereo, 24 bit
430434 */
431
- if (!strcmp(fe_dai_link->name, "Kbl Audio Port") ||
432
- !strcmp(fe_dai_link->name, "Kbl Audio Headset Playback") ||
433
- !strcmp(fe_dai_link->name, "Kbl Audio Capture Port")) {
435
+ if (!strcmp(rtd_dpcm->fe->dai_link->name, "Kbl Audio Port") ||
436
+ !strcmp(rtd_dpcm->fe->dai_link->name, "Kbl Audio Headset Playback") ||
437
+ !strcmp(rtd_dpcm->fe->dai_link->name, "Kbl Audio Capture Port")) {
434438 rate->min = rate->max = 48000;
435
- channels->min = channels->max = 2;
439
+ chan->min = chan->max = 2;
436440 snd_mask_none(fmt);
437441 snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S24_LE);
438442 }
....@@ -440,7 +444,7 @@
440444 * The speaker on the SSP0 supports S16_LE and not S24_LE.
441445 * thus changing the mask here
442446 */
443
- if (!strcmp(be_dai_link->name, "SSP0-Codec"))
447
+ if (!strcmp(rtd_dpcm->be->dai_link->name, "SSP0-Codec"))
444448 snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S16_LE);
445449
446450 return 0;
....@@ -449,8 +453,8 @@
449453 static int kabylake_rt5663_hw_params(struct snd_pcm_substream *substream,
450454 struct snd_pcm_hw_params *params)
451455 {
452
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
453
- struct snd_soc_dai *codec_dai = rtd->codec_dai;
456
+ struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
457
+ struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
454458 int ret;
455459
456460 /* use ASRC for internal clocks, as PLL rate isn't multiple of BCLK */
....@@ -473,13 +477,13 @@
473477 static int kabylake_dmic_fixup(struct snd_soc_pcm_runtime *rtd,
474478 struct snd_pcm_hw_params *params)
475479 {
476
- struct snd_interval *channels = hw_param_interval(params,
480
+ struct snd_interval *chan = hw_param_interval(params,
477481 SNDRV_PCM_HW_PARAM_CHANNELS);
478482
479483 if (params_channels(params) == 2 || DMIC_CH(dmic_constraints) == 2)
480
- channels->min = channels->max = 2;
484
+ chan->min = chan->max = 2;
481485 else
482
- channels->min = channels->max = 4;
486
+ chan->min = chan->max = 4;
483487
484488 return 0;
485489 }
....@@ -487,12 +491,11 @@
487491 static int kabylake_ssp0_hw_params(struct snd_pcm_substream *substream,
488492 struct snd_pcm_hw_params *params)
489493 {
490
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
494
+ struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
495
+ struct snd_soc_dai *codec_dai;
491496 int ret = 0, j;
492497
493
- for (j = 0; j < rtd->num_codecs; j++) {
494
- struct snd_soc_dai *codec_dai = rtd->codec_dais[j];
495
-
498
+ for_each_rtd_codec_dais(rtd, j, codec_dai) {
496499 if (!strcmp(codec_dai->component->name, MAXIM_DEV0_NAME)) {
497500 /*
498501 * Use channel 4 and 5 for the first amp
....@@ -587,9 +590,72 @@
587590 &constraints_16000);
588591 }
589592
590
-static struct snd_soc_ops skylaye_refcap_ops = {
593
+static struct snd_soc_ops skylake_refcap_ops = {
591594 .startup = kabylake_refcap_startup,
592595 };
596
+
597
+SND_SOC_DAILINK_DEF(dummy,
598
+ DAILINK_COMP_ARRAY(COMP_DUMMY()));
599
+
600
+SND_SOC_DAILINK_DEF(system,
601
+ DAILINK_COMP_ARRAY(COMP_CPU("System Pin")));
602
+
603
+SND_SOC_DAILINK_DEF(system2,
604
+ DAILINK_COMP_ARRAY(COMP_CPU("System Pin2")));
605
+
606
+SND_SOC_DAILINK_DEF(echoref,
607
+ DAILINK_COMP_ARRAY(COMP_CPU("Echoref Pin")));
608
+
609
+SND_SOC_DAILINK_DEF(reference,
610
+ DAILINK_COMP_ARRAY(COMP_CPU("Reference Pin")));
611
+
612
+SND_SOC_DAILINK_DEF(dmic,
613
+ DAILINK_COMP_ARRAY(COMP_CPU("DMIC Pin")));
614
+
615
+SND_SOC_DAILINK_DEF(hdmi1,
616
+ DAILINK_COMP_ARRAY(COMP_CPU("HDMI1 Pin")));
617
+
618
+SND_SOC_DAILINK_DEF(hdmi2,
619
+ DAILINK_COMP_ARRAY(COMP_CPU("HDMI2 Pin")));
620
+
621
+SND_SOC_DAILINK_DEF(hdmi3,
622
+ DAILINK_COMP_ARRAY(COMP_CPU("HDMI3 Pin")));
623
+
624
+SND_SOC_DAILINK_DEF(ssp0_pin,
625
+ DAILINK_COMP_ARRAY(COMP_CPU("SSP0 Pin")));
626
+SND_SOC_DAILINK_DEF(ssp0_codec,
627
+ DAILINK_COMP_ARRAY(
628
+ /* Left */ COMP_CODEC(MAXIM_DEV0_NAME, KBL_MAXIM_CODEC_DAI),
629
+ /* Right */ COMP_CODEC(MAXIM_DEV1_NAME, KBL_MAXIM_CODEC_DAI)));
630
+
631
+SND_SOC_DAILINK_DEF(ssp1_pin,
632
+ DAILINK_COMP_ARRAY(COMP_CPU("SSP1 Pin")));
633
+SND_SOC_DAILINK_DEF(ssp1_codec,
634
+ DAILINK_COMP_ARRAY(COMP_CODEC("i2c-10EC5663:00",
635
+ KBL_REALTEK_CODEC_DAI)));
636
+
637
+SND_SOC_DAILINK_DEF(dmic01_pin,
638
+ DAILINK_COMP_ARRAY(COMP_CPU("DMIC01 Pin")));
639
+SND_SOC_DAILINK_DEF(dmic_codec,
640
+ DAILINK_COMP_ARRAY(COMP_CODEC("dmic-codec", "dmic-hifi")));
641
+
642
+SND_SOC_DAILINK_DEF(idisp1_pin,
643
+ DAILINK_COMP_ARRAY(COMP_CPU("iDisp1 Pin")));
644
+SND_SOC_DAILINK_DEF(idisp1_codec,
645
+ DAILINK_COMP_ARRAY(COMP_CODEC("ehdaudio0D2", "intel-hdmi-hifi1")));
646
+
647
+SND_SOC_DAILINK_DEF(idisp2_pin,
648
+ DAILINK_COMP_ARRAY(COMP_CPU("iDisp2 Pin")));
649
+SND_SOC_DAILINK_DEF(idisp2_codec,
650
+ DAILINK_COMP_ARRAY(COMP_CODEC("ehdaudio0D2", "intel-hdmi-hifi2")));
651
+
652
+SND_SOC_DAILINK_DEF(idisp3_pin,
653
+ DAILINK_COMP_ARRAY(COMP_CPU("iDisp3 Pin")));
654
+SND_SOC_DAILINK_DEF(idisp3_codec,
655
+ DAILINK_COMP_ARRAY(COMP_CODEC("ehdaudio0D2", "intel-hdmi-hifi3")));
656
+
657
+SND_SOC_DAILINK_DEF(platform,
658
+ DAILINK_COMP_ARRAY(COMP_PLATFORM("0000:00:1f.3")));
593659
594660 /* kabylake digital audio interface glue - connects codec <--> CPU */
595661 static struct snd_soc_dai_link kabylake_dais[] = {
....@@ -597,121 +663,94 @@
597663 [KBL_DPCM_AUDIO_PB] = {
598664 .name = "Kbl Audio Port",
599665 .stream_name = "Audio",
600
- .cpu_dai_name = "System Pin",
601
- .platform_name = "0000:00:1f.3",
602666 .dynamic = 1,
603
- .codec_name = "snd-soc-dummy",
604
- .codec_dai_name = "snd-soc-dummy-dai",
605667 .nonatomic = 1,
606668 .init = kabylake_rt5663_fe_init,
607669 .trigger = {
608670 SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
609671 .dpcm_playback = 1,
610672 .ops = &kabylake_rt5663_fe_ops,
673
+ SND_SOC_DAILINK_REG(system, dummy, platform),
611674 },
612675 [KBL_DPCM_AUDIO_CP] = {
613676 .name = "Kbl Audio Capture Port",
614677 .stream_name = "Audio Record",
615
- .cpu_dai_name = "System Pin",
616
- .platform_name = "0000:00:1f.3",
617678 .dynamic = 1,
618
- .codec_name = "snd-soc-dummy",
619
- .codec_dai_name = "snd-soc-dummy-dai",
620679 .nonatomic = 1,
621680 .trigger = {
622681 SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
623682 .dpcm_capture = 1,
624683 .ops = &kabylake_rt5663_fe_ops,
684
+ SND_SOC_DAILINK_REG(system, dummy, platform),
625685 },
626686 [KBL_DPCM_AUDIO_HS_PB] = {
627687 .name = "Kbl Audio Headset Playback",
628688 .stream_name = "Headset Audio",
629
- .cpu_dai_name = "System Pin2",
630
- .codec_name = "snd-soc-dummy",
631
- .codec_dai_name = "snd-soc-dummy-dai",
632
- .platform_name = "0000:00:1f.3",
633689 .dpcm_playback = 1,
634690 .nonatomic = 1,
635691 .dynamic = 1,
692
+ SND_SOC_DAILINK_REG(system2, dummy, platform),
636693 },
637694 [KBL_DPCM_AUDIO_ECHO_REF_CP] = {
638695 .name = "Kbl Audio Echo Reference cap",
639696 .stream_name = "Echoreference Capture",
640
- .cpu_dai_name = "Echoref Pin",
641
- .codec_name = "snd-soc-dummy",
642
- .codec_dai_name = "snd-soc-dummy-dai",
643
- .platform_name = "0000:00:1f.3",
644697 .init = NULL,
645
- .capture_only = 1,
698
+ .dpcm_capture = 1,
646699 .nonatomic = 1,
700
+ SND_SOC_DAILINK_REG(echoref, dummy, platform),
647701 },
648702 [KBL_DPCM_AUDIO_REF_CP] = {
649703 .name = "Kbl Audio Reference cap",
650704 .stream_name = "Wake on Voice",
651
- .cpu_dai_name = "Reference Pin",
652
- .codec_name = "snd-soc-dummy",
653
- .codec_dai_name = "snd-soc-dummy-dai",
654
- .platform_name = "0000:00:1f.3",
655705 .init = NULL,
656706 .dpcm_capture = 1,
657707 .nonatomic = 1,
658708 .dynamic = 1,
659
- .ops = &skylaye_refcap_ops,
709
+ .ops = &skylake_refcap_ops,
710
+ SND_SOC_DAILINK_REG(reference, dummy, platform),
660711 },
661712 [KBL_DPCM_AUDIO_DMIC_CP] = {
662713 .name = "Kbl Audio DMIC cap",
663714 .stream_name = "dmiccap",
664
- .cpu_dai_name = "DMIC Pin",
665
- .codec_name = "snd-soc-dummy",
666
- .codec_dai_name = "snd-soc-dummy-dai",
667
- .platform_name = "0000:00:1f.3",
668715 .init = NULL,
669716 .dpcm_capture = 1,
670717 .nonatomic = 1,
671718 .dynamic = 1,
672719 .ops = &kabylake_dmic_ops,
720
+ SND_SOC_DAILINK_REG(dmic, dummy, platform),
673721 },
674722 [KBL_DPCM_AUDIO_HDMI1_PB] = {
675723 .name = "Kbl HDMI Port1",
676724 .stream_name = "Hdmi1",
677
- .cpu_dai_name = "HDMI1 Pin",
678
- .codec_name = "snd-soc-dummy",
679
- .codec_dai_name = "snd-soc-dummy-dai",
680
- .platform_name = "0000:00:1f.3",
681725 .dpcm_playback = 1,
682726 .init = NULL,
683727 .trigger = {
684728 SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
685729 .nonatomic = 1,
686730 .dynamic = 1,
731
+ SND_SOC_DAILINK_REG(hdmi1, dummy, platform),
687732 },
688733 [KBL_DPCM_AUDIO_HDMI2_PB] = {
689734 .name = "Kbl HDMI Port2",
690735 .stream_name = "Hdmi2",
691
- .cpu_dai_name = "HDMI2 Pin",
692
- .codec_name = "snd-soc-dummy",
693
- .codec_dai_name = "snd-soc-dummy-dai",
694
- .platform_name = "0000:00:1f.3",
695736 .dpcm_playback = 1,
696737 .init = NULL,
697738 .trigger = {
698739 SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
699740 .nonatomic = 1,
700741 .dynamic = 1,
742
+ SND_SOC_DAILINK_REG(hdmi2, dummy, platform),
701743 },
702744 [KBL_DPCM_AUDIO_HDMI3_PB] = {
703745 .name = "Kbl HDMI Port3",
704746 .stream_name = "Hdmi3",
705
- .cpu_dai_name = "HDMI3 Pin",
706
- .codec_name = "snd-soc-dummy",
707
- .codec_dai_name = "snd-soc-dummy-dai",
708
- .platform_name = "0000:00:1f.3",
709747 .trigger = {
710748 SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
711749 .dpcm_playback = 1,
712750 .init = NULL,
713751 .nonatomic = 1,
714752 .dynamic = 1,
753
+ SND_SOC_DAILINK_REG(hdmi3, dummy, platform),
715754 },
716755
717756 /* Back End DAI links */
....@@ -719,11 +758,7 @@
719758 /* SSP0 - Codec */
720759 .name = "SSP0-Codec",
721760 .id = 0,
722
- .cpu_dai_name = "SSP0 Pin",
723
- .platform_name = "0000:00:1f.3",
724761 .no_pcm = 1,
725
- .codecs = max98927_codec_components,
726
- .num_codecs = ARRAY_SIZE(max98927_codec_components),
727762 .dai_fmt = SND_SOC_DAIFMT_DSP_B |
728763 SND_SOC_DAIFMT_NB_NF |
729764 SND_SOC_DAIFMT_CBS_CFS,
....@@ -731,16 +766,13 @@
731766 .be_hw_params_fixup = kabylake_ssp_fixup,
732767 .dpcm_playback = 1,
733768 .ops = &kabylake_ssp0_ops,
769
+ SND_SOC_DAILINK_REG(ssp0_pin, ssp0_codec, platform),
734770 },
735771 {
736772 /* SSP1 - Codec */
737773 .name = "SSP1-Codec",
738774 .id = 1,
739
- .cpu_dai_name = "SSP1 Pin",
740
- .platform_name = "0000:00:1f.3",
741775 .no_pcm = 1,
742
- .codec_name = "i2c-10EC5663:00",
743
- .codec_dai_name = KBL_REALTEK_CODEC_DAI,
744776 .init = kabylake_rt5663_max98927_codec_init,
745777 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
746778 SND_SOC_DAIFMT_CBS_CFS,
....@@ -749,51 +781,40 @@
749781 .ops = &kabylake_rt5663_ops,
750782 .dpcm_playback = 1,
751783 .dpcm_capture = 1,
784
+ SND_SOC_DAILINK_REG(ssp1_pin, ssp1_codec, platform),
752785 },
753786 {
754787 .name = "dmic01",
755788 .id = 2,
756
- .cpu_dai_name = "DMIC01 Pin",
757
- .codec_name = "dmic-codec",
758
- .codec_dai_name = "dmic-hifi",
759
- .platform_name = "0000:00:1f.3",
760789 .be_hw_params_fixup = kabylake_dmic_fixup,
761790 .ignore_suspend = 1,
762791 .dpcm_capture = 1,
763792 .no_pcm = 1,
793
+ SND_SOC_DAILINK_REG(dmic01_pin, dmic_codec, platform),
764794 },
765795 {
766796 .name = "iDisp1",
767797 .id = 3,
768
- .cpu_dai_name = "iDisp1 Pin",
769
- .codec_name = "ehdaudio0D2",
770
- .codec_dai_name = "intel-hdmi-hifi1",
771
- .platform_name = "0000:00:1f.3",
772798 .dpcm_playback = 1,
773799 .init = kabylake_hdmi1_init,
774800 .no_pcm = 1,
801
+ SND_SOC_DAILINK_REG(idisp1_pin, idisp1_codec, platform),
775802 },
776803 {
777804 .name = "iDisp2",
778805 .id = 4,
779
- .cpu_dai_name = "iDisp2 Pin",
780
- .codec_name = "ehdaudio0D2",
781
- .codec_dai_name = "intel-hdmi-hifi2",
782
- .platform_name = "0000:00:1f.3",
783806 .init = kabylake_hdmi2_init,
784807 .dpcm_playback = 1,
785808 .no_pcm = 1,
809
+ SND_SOC_DAILINK_REG(idisp2_pin, idisp2_codec, platform),
786810 },
787811 {
788812 .name = "iDisp3",
789813 .id = 5,
790
- .cpu_dai_name = "iDisp3 Pin",
791
- .codec_name = "ehdaudio0D2",
792
- .codec_dai_name = "intel-hdmi-hifi3",
793
- .platform_name = "0000:00:1f.3",
794814 .init = kabylake_hdmi3_init,
795815 .dpcm_playback = 1,
796816 .no_pcm = 1,
817
+ SND_SOC_DAILINK_REG(idisp3_pin, idisp3_codec, platform),
797818 },
798819 };
799820
....@@ -802,58 +823,46 @@
802823 [KBL_DPCM_AUDIO_5663_PB] = {
803824 .name = "Kbl Audio Port",
804825 .stream_name = "Audio",
805
- .cpu_dai_name = "System Pin",
806
- .platform_name = "0000:00:1f.3",
807826 .dynamic = 1,
808
- .codec_name = "snd-soc-dummy",
809
- .codec_dai_name = "snd-soc-dummy-dai",
810827 .nonatomic = 1,
811828 .trigger = {
812829 SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
813830 .dpcm_playback = 1,
814831 .ops = &kabylake_rt5663_fe_ops,
832
+ SND_SOC_DAILINK_REG(system, dummy, platform),
815833 },
816834 [KBL_DPCM_AUDIO_5663_CP] = {
817835 .name = "Kbl Audio Capture Port",
818836 .stream_name = "Audio Record",
819
- .cpu_dai_name = "System Pin",
820
- .platform_name = "0000:00:1f.3",
821837 .dynamic = 1,
822
- .codec_name = "snd-soc-dummy",
823
- .codec_dai_name = "snd-soc-dummy-dai",
824838 .nonatomic = 1,
825839 .trigger = {
826840 SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
827841 .dpcm_capture = 1,
828842 .ops = &kabylake_rt5663_fe_ops,
843
+ SND_SOC_DAILINK_REG(system, dummy, platform),
829844 },
830845 [KBL_DPCM_AUDIO_5663_HDMI1_PB] = {
831846 .name = "Kbl HDMI Port1",
832847 .stream_name = "Hdmi1",
833
- .cpu_dai_name = "HDMI1 Pin",
834
- .codec_name = "snd-soc-dummy",
835
- .codec_dai_name = "snd-soc-dummy-dai",
836
- .platform_name = "0000:00:1f.3",
837848 .dpcm_playback = 1,
838849 .init = NULL,
839850 .trigger = {
840851 SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
841852 .nonatomic = 1,
842853 .dynamic = 1,
854
+ SND_SOC_DAILINK_REG(hdmi1, dummy, platform),
843855 },
844856 [KBL_DPCM_AUDIO_5663_HDMI2_PB] = {
845857 .name = "Kbl HDMI Port2",
846858 .stream_name = "Hdmi2",
847
- .cpu_dai_name = "HDMI2 Pin",
848
- .codec_name = "snd-soc-dummy",
849
- .codec_dai_name = "snd-soc-dummy-dai",
850
- .platform_name = "0000:00:1f.3",
851859 .dpcm_playback = 1,
852860 .init = NULL,
853861 .trigger = {
854862 SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
855863 .nonatomic = 1,
856864 .dynamic = 1,
865
+ SND_SOC_DAILINK_REG(hdmi2, dummy, platform),
857866 },
858867
859868 /* Back End DAI links */
....@@ -861,11 +870,7 @@
861870 /* SSP1 - Codec */
862871 .name = "SSP1-Codec",
863872 .id = 0,
864
- .cpu_dai_name = "SSP1 Pin",
865
- .platform_name = "0000:00:1f.3",
866873 .no_pcm = 1,
867
- .codec_name = "i2c-10EC5663:00",
868
- .codec_dai_name = KBL_REALTEK_CODEC_DAI,
869874 .init = kabylake_rt5663_codec_init,
870875 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
871876 SND_SOC_DAIFMT_CBS_CFS,
....@@ -874,28 +879,23 @@
874879 .ops = &kabylake_rt5663_ops,
875880 .dpcm_playback = 1,
876881 .dpcm_capture = 1,
882
+ SND_SOC_DAILINK_REG(ssp1_pin, ssp1_codec, platform),
877883 },
878884 {
879885 .name = "iDisp1",
880886 .id = 1,
881
- .cpu_dai_name = "iDisp1 Pin",
882
- .codec_name = "ehdaudio0D2",
883
- .codec_dai_name = "intel-hdmi-hifi1",
884
- .platform_name = "0000:00:1f.3",
885887 .dpcm_playback = 1,
886888 .init = kabylake_5663_hdmi1_init,
887889 .no_pcm = 1,
890
+ SND_SOC_DAILINK_REG(idisp1_pin, idisp1_codec, platform),
888891 },
889892 {
890893 .name = "iDisp2",
891894 .id = 2,
892
- .cpu_dai_name = "iDisp2 Pin",
893
- .codec_name = "ehdaudio0D2",
894
- .codec_dai_name = "intel-hdmi-hifi2",
895
- .platform_name = "0000:00:1f.3",
896895 .init = kabylake_5663_hdmi2_init,
897896 .dpcm_playback = 1,
898897 .no_pcm = 1,
898
+ SND_SOC_DAILINK_REG(idisp2_pin, idisp2_codec, platform),
899899 },
900900 };
901901
....@@ -970,7 +970,7 @@
970970 static int kabylake_audio_probe(struct platform_device *pdev)
971971 {
972972 struct kbl_rt5663_private *ctx;
973
- struct skl_machine_pdata *pdata;
973
+ struct snd_soc_acpi_mach *mach;
974974 int ret;
975975
976976 ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL);
....@@ -985,9 +985,9 @@
985985 kabylake_audio_card->dev = &pdev->dev;
986986 snd_soc_card_set_drvdata(kabylake_audio_card, ctx);
987987
988
- pdata = dev_get_drvdata(&pdev->dev);
989
- if (pdata)
990
- dmic_constraints = pdata->dmic_num == 2 ?
988
+ mach = pdev->dev.platform_data;
989
+ if (mach)
990
+ dmic_constraints = mach->mach_params.dmic_num == 2 ?
991991 &constraints_dmic_2ch : &constraints_dmic_channels;
992992
993993 ctx->mclk = devm_clk_get(&pdev->dev, "ssp1_mclk");