.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (C) ST-Ericsson SA 2012 |
---|
3 | 4 | * |
---|
.. | .. |
---|
5 | 6 | * for ST-Ericsson. |
---|
6 | 7 | * |
---|
7 | 8 | * License terms: |
---|
8 | | - * |
---|
9 | | - * This program is free software; you can redistribute it and/or modify |
---|
10 | | - * it under the terms of the GNU General Public License version 2 as published |
---|
11 | | - * by the Free Software Foundation. |
---|
12 | 9 | */ |
---|
13 | 10 | |
---|
14 | 11 | #include <asm/mach-types.h> |
---|
.. | .. |
---|
27 | 24 | #include "mop500_ab8500.h" |
---|
28 | 25 | |
---|
29 | 26 | /* Define the whole MOP500 soundcard, linking platform to the codec-drivers */ |
---|
| 27 | +SND_SOC_DAILINK_DEFS(link1, |
---|
| 28 | + DAILINK_COMP_ARRAY(COMP_CPU("ux500-msp-i2s.1")), |
---|
| 29 | + DAILINK_COMP_ARRAY(COMP_CODEC("ab8500-codec.0", "ab8500-codec-dai.0")), |
---|
| 30 | + DAILINK_COMP_ARRAY(COMP_PLATFORM("ux500-msp-i2s.1"))); |
---|
| 31 | + |
---|
| 32 | +SND_SOC_DAILINK_DEFS(link2, |
---|
| 33 | + DAILINK_COMP_ARRAY(COMP_CPU("ux500-msp-i2s.3")), |
---|
| 34 | + DAILINK_COMP_ARRAY(COMP_CODEC("ab8500-codec.0", "ab8500-codec-dai.1")), |
---|
| 35 | + DAILINK_COMP_ARRAY(COMP_PLATFORM("ux500-msp-i2s.3"))); |
---|
| 36 | + |
---|
30 | 37 | static struct snd_soc_dai_link mop500_dai_links[] = { |
---|
31 | 38 | { |
---|
32 | 39 | .name = "ab8500_0", |
---|
33 | 40 | .stream_name = "ab8500_0", |
---|
34 | | - .cpu_dai_name = "ux500-msp-i2s.1", |
---|
35 | | - .codec_dai_name = "ab8500-codec-dai.0", |
---|
36 | | - .platform_name = "ux500-msp-i2s.1", |
---|
37 | | - .codec_name = "ab8500-codec.0", |
---|
38 | 41 | .init = mop500_ab8500_machine_init, |
---|
39 | 42 | .ops = mop500_ab8500_ops, |
---|
| 43 | + SND_SOC_DAILINK_REG(link1), |
---|
40 | 44 | }, |
---|
41 | 45 | { |
---|
42 | 46 | .name = "ab8500_1", |
---|
43 | 47 | .stream_name = "ab8500_1", |
---|
44 | | - .cpu_dai_name = "ux500-msp-i2s.3", |
---|
45 | | - .codec_dai_name = "ab8500-codec-dai.1", |
---|
46 | | - .platform_name = "ux500-msp-i2s.3", |
---|
47 | | - .codec_name = "ab8500-codec.0", |
---|
48 | 48 | .init = NULL, |
---|
49 | 49 | .ops = mop500_ab8500_ops, |
---|
| 50 | + SND_SOC_DAILINK_REG(link2), |
---|
50 | 51 | }, |
---|
51 | 52 | }; |
---|
52 | 53 | |
---|
.. | .. |
---|
62 | 63 | { |
---|
63 | 64 | int i; |
---|
64 | 65 | |
---|
65 | | - for (i = 0; i < 2; i++) { |
---|
66 | | - of_node_put(mop500_dai_links[i].cpu_of_node); |
---|
67 | | - of_node_put(mop500_dai_links[i].codec_of_node); |
---|
68 | | - } |
---|
| 66 | + for (i = 0; i < 2; i++) |
---|
| 67 | + of_node_put(mop500_dai_links[i].cpus->of_node); |
---|
| 68 | + |
---|
| 69 | + /* Both links use the same codec, which is refcounted only once */ |
---|
| 70 | + of_node_put(mop500_dai_links[0].codecs->of_node); |
---|
69 | 71 | } |
---|
70 | 72 | |
---|
71 | 73 | static int mop500_of_probe(struct platform_device *pdev, |
---|
.. | .. |
---|
80 | 82 | |
---|
81 | 83 | if (!(msp_np[0] && msp_np[1] && codec_np)) { |
---|
82 | 84 | dev_err(&pdev->dev, "Phandle missing or invalid\n"); |
---|
83 | | - mop500_of_node_put(); |
---|
| 85 | + for (i = 0; i < 2; i++) |
---|
| 86 | + of_node_put(msp_np[i]); |
---|
| 87 | + of_node_put(codec_np); |
---|
84 | 88 | return -EINVAL; |
---|
85 | 89 | } |
---|
86 | 90 | |
---|
87 | 91 | for (i = 0; i < 2; i++) { |
---|
88 | | - mop500_dai_links[i].cpu_of_node = msp_np[i]; |
---|
89 | | - mop500_dai_links[i].cpu_dai_name = NULL; |
---|
90 | | - mop500_dai_links[i].platform_of_node = msp_np[i]; |
---|
91 | | - mop500_dai_links[i].platform_name = NULL; |
---|
92 | | - mop500_dai_links[i].codec_of_node = codec_np; |
---|
93 | | - mop500_dai_links[i].codec_name = NULL; |
---|
| 92 | + mop500_dai_links[i].cpus->of_node = msp_np[i]; |
---|
| 93 | + mop500_dai_links[i].cpus->dai_name = NULL; |
---|
| 94 | + mop500_dai_links[i].platforms->of_node = msp_np[i]; |
---|
| 95 | + mop500_dai_links[i].platforms->name = NULL; |
---|
| 96 | + mop500_dai_links[i].codecs->of_node = codec_np; |
---|
| 97 | + mop500_dai_links[i].codecs->name = NULL; |
---|
94 | 98 | } |
---|
95 | 99 | |
---|
96 | 100 | snd_soc_of_parse_card_name(&mop500_card, "stericsson,card-name"); |
---|