.. | .. |
---|
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. |
---|
42 | 36 | |
---|
43 | 37 | #include <linux/clk.h> |
---|
44 | 38 | #include <linux/gpio.h> |
---|
.. | .. |
---|
123 | 117 | return snd_soc_dapm_put_enum_double(kctrl, ucontrol); |
---|
124 | 118 | } |
---|
125 | 119 | |
---|
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) |
---|
128 | 122 | { |
---|
129 | 123 | struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kctrl); |
---|
130 | 124 | struct snd_soc_card *card = dapm->card; |
---|
.. | .. |
---|
135 | 129 | return 0; |
---|
136 | 130 | } |
---|
137 | 131 | |
---|
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) |
---|
140 | 134 | { |
---|
141 | 135 | struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kctrl); |
---|
142 | 136 | struct snd_soc_card *card = dapm->card; |
---|
.. | .. |
---|
157 | 151 | return 1; |
---|
158 | 152 | } |
---|
159 | 153 | |
---|
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) |
---|
162 | 156 | { |
---|
163 | 157 | struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kctrl); |
---|
164 | 158 | struct snd_soc_card *card = dapm->card; |
---|
.. | .. |
---|
190 | 184 | return 0; |
---|
191 | 185 | } |
---|
192 | 186 | |
---|
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) |
---|
195 | 189 | { |
---|
196 | 190 | struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kctrl); |
---|
197 | 191 | struct snd_soc_card *card = dapm->card; |
---|
.. | .. |
---|
300 | 294 | { "DAC", NULL, "OUTL" }, |
---|
301 | 295 | }; |
---|
302 | 296 | |
---|
| 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 | + |
---|
303 | 302 | static struct snd_soc_dai_link tse850_dailink = { |
---|
304 | 303 | .name = "TSE-850", |
---|
305 | 304 | .stream_name = "TSE-850-PCM", |
---|
306 | | - .codec_dai_name = "pcm512x-hifi", |
---|
307 | 305 | .dai_fmt = SND_SOC_DAIFMT_I2S |
---|
308 | 306 | | SND_SOC_DAIFMT_NB_NF |
---|
309 | 307 | | SND_SOC_DAIFMT_CBM_CFS, |
---|
| 308 | + SND_SOC_DAILINK_REG(pcm), |
---|
310 | 309 | }; |
---|
311 | 310 | |
---|
312 | 311 | static struct snd_soc_card tse850_card = { |
---|
.. | .. |
---|
337 | 336 | dev_err(&pdev->dev, "failed to get cpu dai\n"); |
---|
338 | 337 | return -EINVAL; |
---|
339 | 338 | } |
---|
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; |
---|
342 | 341 | of_node_put(cpu_np); |
---|
343 | 342 | |
---|
344 | 343 | codec_np = of_parse_phandle(np, "axentia,audio-codec", 0); |
---|
.. | .. |
---|
346 | 345 | dev_err(&pdev->dev, "failed to get codec info\n"); |
---|
347 | 346 | return -EINVAL; |
---|
348 | 347 | } |
---|
349 | | - dailink->codec_of_node = codec_np; |
---|
| 348 | + dailink->codecs->of_node = codec_np; |
---|
350 | 349 | of_node_put(codec_np); |
---|
351 | 350 | |
---|
352 | 351 | return 0; |
---|
.. | .. |
---|
452 | 451 | /* Module information */ |
---|
453 | 452 | MODULE_AUTHOR("Peter Rosin <peda@axentia.se>"); |
---|
454 | 453 | MODULE_DESCRIPTION("ALSA SoC driver for TSE-850 with PCM5142 codec"); |
---|
455 | | -MODULE_LICENSE("GPL"); |
---|
| 454 | +MODULE_LICENSE("GPL v2"); |
---|