forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
kernel/sound/soc/pxa/zylonite.c
....@@ -1,14 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * zylonite.c -- SoC audio for Zylonite
34 *
45 * Copyright 2008 Wolfson Microelectronics PLC.
56 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
6
- *
7
- * This program is free software; you can redistribute it and/or
8
- * modify it under the terms of the GNU General Public License as
9
- * published by the Free Software Foundation; either version 2 of the
10
- * License, or (at your option) any later version.
11
- *
127 */
138
149 #include <linux/module.h>
....@@ -71,7 +66,7 @@
7166 static int zylonite_wm9713_init(struct snd_soc_pcm_runtime *rtd)
7267 {
7368 if (clk_pout)
74
- snd_soc_dai_set_pll(rtd->codec_dai, 0, 0,
69
+ snd_soc_dai_set_pll(asoc_rtd_to_codec(rtd, 0), 0, 0,
7570 clk_get_rate(pout), 0);
7671
7772 return 0;
....@@ -80,9 +75,9 @@
8075 static int zylonite_voice_hw_params(struct snd_pcm_substream *substream,
8176 struct snd_pcm_hw_params *params)
8277 {
83
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
84
- struct snd_soc_dai *codec_dai = rtd->codec_dai;
85
- struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
78
+ struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
79
+ struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
80
+ struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
8681 unsigned int wm9713_div = 0;
8782 int ret = 0;
8883 int rate = params_rate(params);
....@@ -127,34 +122,40 @@
127122 .hw_params = zylonite_voice_hw_params,
128123 };
129124
125
+SND_SOC_DAILINK_DEFS(ac97,
126
+ DAILINK_COMP_ARRAY(COMP_CPU("pxa2xx-ac97")),
127
+ DAILINK_COMP_ARRAY(COMP_CODEC("wm9713-codec", "wm9713-hifi")),
128
+ DAILINK_COMP_ARRAY(COMP_PLATFORM("pxa-pcm-audio")));
129
+
130
+SND_SOC_DAILINK_DEFS(ac97_aux,
131
+ DAILINK_COMP_ARRAY(COMP_CPU("pxa2xx-ac97-aux")),
132
+ DAILINK_COMP_ARRAY(COMP_CODEC("wm9713-codec", "wm9713-aux")),
133
+ DAILINK_COMP_ARRAY(COMP_PLATFORM("pxa-pcm-audio")));
134
+
135
+SND_SOC_DAILINK_DEFS(voice,
136
+ DAILINK_COMP_ARRAY(COMP_CPU("pxa-ssp-dai.2")),
137
+ DAILINK_COMP_ARRAY(COMP_CODEC("wm9713-codec", "wm9713-voice")),
138
+ DAILINK_COMP_ARRAY(COMP_PLATFORM("pxa-pcm-audio")));
139
+
130140 static struct snd_soc_dai_link zylonite_dai[] = {
131141 {
132142 .name = "AC97",
133143 .stream_name = "AC97 HiFi",
134
- .codec_name = "wm9713-codec",
135
- .platform_name = "pxa-pcm-audio",
136
- .cpu_dai_name = "pxa2xx-ac97",
137
- .codec_dai_name = "wm9713-hifi",
138144 .init = zylonite_wm9713_init,
145
+ SND_SOC_DAILINK_REG(ac97),
139146 },
140147 {
141148 .name = "AC97 Aux",
142149 .stream_name = "AC97 Aux",
143
- .codec_name = "wm9713-codec",
144
- .platform_name = "pxa-pcm-audio",
145
- .cpu_dai_name = "pxa2xx-ac97-aux",
146
- .codec_dai_name = "wm9713-aux",
150
+ SND_SOC_DAILINK_REG(ac97_aux),
147151 },
148152 {
149153 .name = "WM9713 Voice",
150154 .stream_name = "WM9713 Voice",
151
- .codec_name = "wm9713-codec",
152
- .platform_name = "pxa-pcm-audio",
153
- .cpu_dai_name = "pxa-ssp-dai.2",
154
- .codec_dai_name = "wm9713-voice",
155155 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
156156 SND_SOC_DAIFMT_CBS_CFS,
157157 .ops = &zylonite_voice_ops,
158
+ SND_SOC_DAILINK_REG(voice),
158159 },
159160 };
160161