forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-31 f70575805708cabdedea7498aaa3f710fde4d920
kernel/sound/soc/atmel/tse850-pcm5142.c
....@@ -1,44 +1,38 @@
1
-/*
2
- * TSE-850 audio - ASoC driver for the Axentia TSE-850 with a PCM5142 codec
3
- *
4
- * Copyright (C) 2016 Axentia Technologies AB
5
- *
6
- * Author: Peter Rosin <peda@axentia.se>
7
- *
8
- * This program is free software; you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License version 2 as
10
- * published by the Free Software Foundation.
11
- */
12
-
13
-/*
14
- * loop1 relays
15
- * IN1 +---o +------------+ o---+ OUT1
16
- * \ /
17
- * + +
18
- * | / |
19
- * +--o +--. |
20
- * | add | |
21
- * | V |
22
- * | .---. |
23
- * DAC +----------->|Sum|---+
24
- * | '---' |
25
- * | |
26
- * + +
27
- *
28
- * IN2 +---o--+------------+--o---+ OUT2
29
- * loop2 relays
30
- *
31
- * The 'loop1' gpio pin controlls two relays, which are either in loop
32
- * position, meaning that input and output are directly connected, or
33
- * they are in mixer position, meaning that the signal is passed through
34
- * the 'Sum' mixer. Similarly for 'loop2'.
35
- *
36
- * In the above, the 'loop1' relays are inactive, thus feeding IN1 to the
37
- * mixer (if 'add' is active) and feeding the mixer output to OUT1. The
38
- * 'loop2' relays are active, short-cutting the TSE-850 from channel 2.
39
- * IN1, IN2, OUT1 and OUT2 are TSE-850 connectors and DAC is the PCB name
40
- * of the (filtered) output from the PCM5142 codec.
41
- */
1
+// SPDX-License-Identifier: GPL-2.0
2
+//
3
+// TSE-850 audio - ASoC driver for the Axentia TSE-850 with a PCM5142 codec
4
+//
5
+// Copyright (C) 2016 Axentia Technologies AB
6
+//
7
+// Author: Peter Rosin <peda@axentia.se>
8
+//
9
+// loop1 relays
10
+// IN1 +---o +------------+ o---+ OUT1
11
+// \ /
12
+// + +
13
+// | / |
14
+// +--o +--. |
15
+// | add | |
16
+// | V |
17
+// | .---. |
18
+// DAC +----------->|Sum|---+
19
+// | '---' |
20
+// | |
21
+// + +
22
+//
23
+// IN2 +---o--+------------+--o---+ OUT2
24
+// loop2 relays
25
+//
26
+// The 'loop1' gpio pin controls two relays, which are either in loop
27
+// position, meaning that input and output are directly connected, or
28
+// they are in mixer position, meaning that the signal is passed through
29
+// the 'Sum' mixer. Similarly for 'loop2'.
30
+//
31
+// In the above, the 'loop1' relays are inactive, thus feeding IN1 to the
32
+// mixer (if 'add' is active) and feeding the mixer output to OUT1. The
33
+// 'loop2' relays are active, short-cutting the TSE-850 from channel 2.
34
+// IN1, IN2, OUT1 and OUT2 are TSE-850 connectors and DAC is the PCB name
35
+// of the (filtered) output from the PCM5142 codec.
4236
4337 #include <linux/clk.h>
4438 #include <linux/gpio.h>
....@@ -123,8 +117,8 @@
123117 return snd_soc_dapm_put_enum_double(kctrl, ucontrol);
124118 }
125119
126
-int tse850_get_mix(struct snd_kcontrol *kctrl,
127
- struct snd_ctl_elem_value *ucontrol)
120
+static int tse850_get_mix(struct snd_kcontrol *kctrl,
121
+ struct snd_ctl_elem_value *ucontrol)
128122 {
129123 struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kctrl);
130124 struct snd_soc_card *card = dapm->card;
....@@ -135,8 +129,8 @@
135129 return 0;
136130 }
137131
138
-int tse850_put_mix(struct snd_kcontrol *kctrl,
139
- struct snd_ctl_elem_value *ucontrol)
132
+static int tse850_put_mix(struct snd_kcontrol *kctrl,
133
+ struct snd_ctl_elem_value *ucontrol)
140134 {
141135 struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kctrl);
142136 struct snd_soc_card *card = dapm->card;
....@@ -157,8 +151,8 @@
157151 return 1;
158152 }
159153
160
-int tse850_get_ana(struct snd_kcontrol *kctrl,
161
- struct snd_ctl_elem_value *ucontrol)
154
+static int tse850_get_ana(struct snd_kcontrol *kctrl,
155
+ struct snd_ctl_elem_value *ucontrol)
162156 {
163157 struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kctrl);
164158 struct snd_soc_card *card = dapm->card;
....@@ -190,8 +184,8 @@
190184 return 0;
191185 }
192186
193
-int tse850_put_ana(struct snd_kcontrol *kctrl,
194
- struct snd_ctl_elem_value *ucontrol)
187
+static int tse850_put_ana(struct snd_kcontrol *kctrl,
188
+ struct snd_ctl_elem_value *ucontrol)
195189 {
196190 struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kctrl);
197191 struct snd_soc_card *card = dapm->card;
....@@ -300,13 +294,18 @@
300294 { "DAC", NULL, "OUTL" },
301295 };
302296
297
+SND_SOC_DAILINK_DEFS(pcm,
298
+ DAILINK_COMP_ARRAY(COMP_EMPTY()),
299
+ DAILINK_COMP_ARRAY(COMP_CODEC(NULL, "pcm512x-hifi")),
300
+ DAILINK_COMP_ARRAY(COMP_EMPTY()));
301
+
303302 static struct snd_soc_dai_link tse850_dailink = {
304303 .name = "TSE-850",
305304 .stream_name = "TSE-850-PCM",
306
- .codec_dai_name = "pcm512x-hifi",
307305 .dai_fmt = SND_SOC_DAIFMT_I2S
308306 | SND_SOC_DAIFMT_NB_NF
309307 | SND_SOC_DAIFMT_CBM_CFS,
308
+ SND_SOC_DAILINK_REG(pcm),
310309 };
311310
312311 static struct snd_soc_card tse850_card = {
....@@ -337,8 +336,8 @@
337336 dev_err(&pdev->dev, "failed to get cpu dai\n");
338337 return -EINVAL;
339338 }
340
- dailink->cpu_of_node = cpu_np;
341
- dailink->platform_of_node = cpu_np;
339
+ dailink->cpus->of_node = cpu_np;
340
+ dailink->platforms->of_node = cpu_np;
342341 of_node_put(cpu_np);
343342
344343 codec_np = of_parse_phandle(np, "axentia,audio-codec", 0);
....@@ -346,7 +345,7 @@
346345 dev_err(&pdev->dev, "failed to get codec info\n");
347346 return -EINVAL;
348347 }
349
- dailink->codec_of_node = codec_np;
348
+ dailink->codecs->of_node = codec_np;
350349 of_node_put(codec_np);
351350
352351 return 0;
....@@ -452,4 +451,4 @@
452451 /* Module information */
453452 MODULE_AUTHOR("Peter Rosin <peda@axentia.se>");
454453 MODULE_DESCRIPTION("ALSA SoC driver for TSE-850 with PCM5142 codec");
455
-MODULE_LICENSE("GPL");
454
+MODULE_LICENSE("GPL v2");