hc
2024-05-11 04dd17822334871b23ea2862f7798fb0e0007777
kernel/sound/soc/samsung/lowland.c
....@@ -1,13 +1,8 @@
1
-/*
2
- * Lowland audio support
3
- *
4
- * Copyright 2011 Wolfson Microelectronics
5
- *
6
- * This program is free software; you can redistribute it and/or modify it
7
- * under the terms of the GNU General Public License as published by the
8
- * Free Software Foundation; either version 2 of the License, or (at your
9
- * option) any later version.
10
- */
1
+// SPDX-License-Identifier: GPL-2.0+
2
+//
3
+// Lowland audio support
4
+//
5
+// Copyright 2011 Wolfson Microelectronics
116
127 #include <sound/soc.h>
138 #include <sound/soc-dapm.h>
....@@ -37,7 +32,7 @@
3732
3833 static int lowland_wm5100_init(struct snd_soc_pcm_runtime *rtd)
3934 {
40
- struct snd_soc_component *component = rtd->codec_dai->component;
35
+ struct snd_soc_component *component = asoc_rtd_to_codec(rtd, 0)->component;
4136 int ret;
4237
4338 ret = snd_soc_component_set_sysclk(component, WM5100_CLK_SYSCLK,
....@@ -70,7 +65,7 @@
7065
7166 static int lowland_wm9081_init(struct snd_soc_pcm_runtime *rtd)
7267 {
73
- struct snd_soc_component *component = rtd->codec_dai->component;
68
+ struct snd_soc_component *component = asoc_rtd_to_codec(rtd, 0)->component;
7469
7570 snd_soc_dapm_nc_pin(&rtd->card->dapm, "LINEOUT");
7671
....@@ -87,45 +82,51 @@
8782 .channels_max = 2,
8883 };
8984
85
+SND_SOC_DAILINK_DEFS(cpu,
86
+ DAILINK_COMP_ARRAY(COMP_CPU("samsung-i2s.0")),
87
+ DAILINK_COMP_ARRAY(COMP_CODEC("wm5100.1-001a", "wm5100-aif1")),
88
+ DAILINK_COMP_ARRAY(COMP_PLATFORM("samsung-i2s.0")));
89
+
90
+SND_SOC_DAILINK_DEFS(baseband,
91
+ DAILINK_COMP_ARRAY(COMP_CPU("wm5100-aif2")),
92
+ DAILINK_COMP_ARRAY(COMP_CODEC("wm1250-ev1.1-0027", "wm1250-ev1")));
93
+
94
+SND_SOC_DAILINK_DEFS(speaker,
95
+ DAILINK_COMP_ARRAY(COMP_CPU("wm5100-aif3")),
96
+ DAILINK_COMP_ARRAY(COMP_CODEC("wm9081.1-006c", "wm9081-hifi")));
97
+
9098 static struct snd_soc_dai_link lowland_dai[] = {
9199 {
92100 .name = "CPU",
93101 .stream_name = "CPU",
94
- .cpu_dai_name = "samsung-i2s.0",
95
- .codec_dai_name = "wm5100-aif1",
96
- .platform_name = "samsung-i2s.0",
97
- .codec_name = "wm5100.1-001a",
98102 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
99103 SND_SOC_DAIFMT_CBM_CFM,
100104 .init = lowland_wm5100_init,
105
+ SND_SOC_DAILINK_REG(cpu),
101106 },
102107 {
103108 .name = "Baseband",
104109 .stream_name = "Baseband",
105
- .cpu_dai_name = "wm5100-aif2",
106
- .codec_dai_name = "wm1250-ev1",
107
- .codec_name = "wm1250-ev1.1-0027",
108110 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
109111 SND_SOC_DAIFMT_CBM_CFM,
110112 .ignore_suspend = 1,
113
+ SND_SOC_DAILINK_REG(baseband),
111114 },
112115 {
113116 .name = "Sub Speaker",
114117 .stream_name = "Sub Speaker",
115
- .cpu_dai_name = "wm5100-aif3",
116
- .codec_dai_name = "wm9081-hifi",
117
- .codec_name = "wm9081.1-006c",
118118 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
119119 SND_SOC_DAIFMT_CBM_CFM,
120120 .ignore_suspend = 1,
121121 .params = &sub_params,
122122 .init = lowland_wm9081_init,
123
+ SND_SOC_DAILINK_REG(speaker),
123124 },
124125 };
125126
126127 static struct snd_soc_codec_conf lowland_codec_conf[] = {
127128 {
128
- .dev_name = "wm9081.1-006c",
129
+ .dlc = COMP_CODEC_CONF("wm9081.1-006c"),
129130 .name_prefix = "Sub",
130131 },
131132 };
....@@ -183,8 +184,7 @@
183184
184185 ret = devm_snd_soc_register_card(&pdev->dev, card);
185186 if (ret)
186
- dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
187
- ret);
187
+ dev_err_probe(&pdev->dev, ret, "snd_soc_register_card() failed\n");
188188
189189 return ret;
190190 }