forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
kernel/sound/soc/pxa/mioa701_wm9713.c
....@@ -1,20 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Handles the Mitac mioa701 SoC system
34 *
45 * Copyright (C) 2008 Robert Jarzmik
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation in version 2 of the License.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License
16
- * along with this program; if not, write to the Free Software
17
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
186 *
197 * This is a little schema of the sound interconnections :
208 *
....@@ -63,14 +51,14 @@
6351 unsigned short reg;
6452
6553 if (power) {
66
- reg = snd_soc_component_read32(component, AC97_GPIO_CFG);
54
+ reg = snd_soc_component_read(component, AC97_GPIO_CFG);
6755 snd_soc_component_write(component, AC97_GPIO_CFG, reg | 0x0100);
68
- reg = snd_soc_component_read32(component, AC97_GPIO_PULL);
56
+ reg = snd_soc_component_read(component, AC97_GPIO_PULL);
6957 snd_soc_component_write(component, AC97_GPIO_PULL, reg | (1<<15));
7058 } else {
71
- reg = snd_soc_component_read32(component, AC97_GPIO_CFG);
59
+ reg = snd_soc_component_read(component, AC97_GPIO_CFG);
7260 snd_soc_component_write(component, AC97_GPIO_CFG, reg & ~0x0100);
73
- reg = snd_soc_component_read32(component, AC97_GPIO_PULL);
61
+ reg = snd_soc_component_read(component, AC97_GPIO_PULL);
7462 snd_soc_component_write(component, AC97_GPIO_PULL, reg & ~(1<<15));
7563 }
7664
....@@ -84,8 +72,8 @@
8472 struct snd_soc_pcm_runtime *rtd;
8573 struct snd_soc_component *component;
8674
87
- rtd = snd_soc_get_pcm_runtime(card, card->dai_link[0].name);
88
- component = rtd->codec_dai->component;
75
+ rtd = snd_soc_get_pcm_runtime(card, &card->dai_link[0]);
76
+ component = asoc_rtd_to_codec(rtd, 0)->component;
8977 return rear_amp_power(component, SND_SOC_DAPM_EVENT_ON(event));
9078 }
9179
....@@ -129,7 +117,7 @@
129117
130118 static int mioa701_wm9713_init(struct snd_soc_pcm_runtime *rtd)
131119 {
132
- struct snd_soc_component *component = rtd->codec_dai->component;
120
+ struct snd_soc_component *component = asoc_rtd_to_codec(rtd, 0)->component;
133121
134122 /* Prepare GPIO8 for rear speaker amplifier */
135123 snd_soc_component_update_bits(component, AC97_GPIO_CFG, 0x100, 0x100);
....@@ -142,25 +130,29 @@
142130
143131 static struct snd_soc_ops mioa701_ops;
144132
133
+SND_SOC_DAILINK_DEFS(ac97,
134
+ DAILINK_COMP_ARRAY(COMP_CPU("pxa2xx-ac97")),
135
+ DAILINK_COMP_ARRAY(COMP_CODEC("wm9713-codec", "wm9713-hifi")),
136
+ DAILINK_COMP_ARRAY(COMP_PLATFORM("pxa-pcm-audio")));
137
+
138
+SND_SOC_DAILINK_DEFS(ac97_aux,
139
+ DAILINK_COMP_ARRAY(COMP_CPU("pxa2xx-ac97-aux")),
140
+ DAILINK_COMP_ARRAY(COMP_CODEC("wm9713-codec", "wm9713-aux")),
141
+ DAILINK_COMP_ARRAY(COMP_PLATFORM("pxa-pcm-audio")));
142
+
145143 static struct snd_soc_dai_link mioa701_dai[] = {
146144 {
147145 .name = "AC97",
148146 .stream_name = "AC97 HiFi",
149
- .cpu_dai_name = "pxa2xx-ac97",
150
- .codec_dai_name = "wm9713-hifi",
151
- .codec_name = "wm9713-codec",
152147 .init = mioa701_wm9713_init,
153
- .platform_name = "pxa-pcm-audio",
154148 .ops = &mioa701_ops,
149
+ SND_SOC_DAILINK_REG(ac97),
155150 },
156151 {
157152 .name = "AC97 Aux",
158153 .stream_name = "AC97 Aux",
159
- .cpu_dai_name = "pxa2xx-ac97-aux",
160
- .codec_dai_name = "wm9713-aux",
161
- .codec_name = "wm9713-codec",
162
- .platform_name = "pxa-pcm-audio",
163154 .ops = &mioa701_ops,
155
+ SND_SOC_DAILINK_REG(ac97_aux),
164156 },
165157 };
166158