diff options
author | Mark Brown <broonie@linaro.org> | 2014-01-02 08:01:49 -0500 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-01-02 08:01:49 -0500 |
commit | 30010a279657144f7de0a94f89896e4e2d3bbb75 (patch) | |
tree | 0377b1aa5789f9cda445d4dc753f61a7235dcc6d | |
parent | 802eee95bde72fd0cd0f3a5b2098375a487d1eda (diff) | |
parent | 14c3aa98397b3b4e67b042f388f4ad0f9b18250e (diff) |
Merge remote-tracking branch 'asoc/fix/fsl' into asoc-linus
-rw-r--r-- | sound/soc/fsl/Kconfig | 1 | ||||
-rw-r--r-- | sound/soc/fsl/imx-spdif.c | 84 |
2 files changed, 21 insertions, 64 deletions
diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig index b7ab71f2ccc1..8c10b8f80ace 100644 --- a/sound/soc/fsl/Kconfig +++ b/sound/soc/fsl/Kconfig | |||
@@ -197,7 +197,6 @@ config SND_SOC_IMX_SPDIF | |||
197 | tristate "SoC Audio support for i.MX boards with S/PDIF" | 197 | tristate "SoC Audio support for i.MX boards with S/PDIF" |
198 | select SND_SOC_IMX_PCM_DMA | 198 | select SND_SOC_IMX_PCM_DMA |
199 | select SND_SOC_FSL_SPDIF | 199 | select SND_SOC_FSL_SPDIF |
200 | select SND_SOC_SPDIF | ||
201 | select REGMAP_MMIO | 200 | select REGMAP_MMIO |
202 | help | 201 | help |
203 | SoC Audio support for i.MX boards with S/PDIF | 202 | SoC Audio support for i.MX boards with S/PDIF |
diff --git a/sound/soc/fsl/imx-spdif.c b/sound/soc/fsl/imx-spdif.c index 8499d5292f08..e656245d24c9 100644 --- a/sound/soc/fsl/imx-spdif.c +++ b/sound/soc/fsl/imx-spdif.c | |||
@@ -14,17 +14,15 @@ | |||
14 | #include <sound/soc.h> | 14 | #include <sound/soc.h> |
15 | 15 | ||
16 | struct imx_spdif_data { | 16 | struct imx_spdif_data { |
17 | struct snd_soc_dai_link dai[2]; | 17 | struct snd_soc_dai_link dai; |
18 | struct snd_soc_card card; | 18 | struct snd_soc_card card; |
19 | struct platform_device *txdev; | ||
20 | struct platform_device *rxdev; | ||
21 | }; | 19 | }; |
22 | 20 | ||
23 | static int imx_spdif_audio_probe(struct platform_device *pdev) | 21 | static int imx_spdif_audio_probe(struct platform_device *pdev) |
24 | { | 22 | { |
25 | struct device_node *spdif_np, *np = pdev->dev.of_node; | 23 | struct device_node *spdif_np, *np = pdev->dev.of_node; |
26 | struct imx_spdif_data *data; | 24 | struct imx_spdif_data *data; |
27 | int ret = 0, num_links = 0; | 25 | int ret = 0; |
28 | 26 | ||
29 | spdif_np = of_parse_phandle(np, "spdif-controller", 0); | 27 | spdif_np = of_parse_phandle(np, "spdif-controller", 0); |
30 | if (!spdif_np) { | 28 | if (!spdif_np) { |
@@ -40,69 +38,42 @@ static int imx_spdif_audio_probe(struct platform_device *pdev) | |||
40 | goto end; | 38 | goto end; |
41 | } | 39 | } |
42 | 40 | ||
43 | if (of_property_read_bool(np, "spdif-out")) { | 41 | data->dai.name = "S/PDIF PCM"; |
44 | data->dai[num_links].name = "S/PDIF TX"; | 42 | data->dai.stream_name = "S/PDIF PCM"; |
45 | data->dai[num_links].stream_name = "S/PDIF PCM Playback"; | 43 | data->dai.codec_dai_name = "snd-soc-dummy-dai"; |
46 | data->dai[num_links].codec_dai_name = "dit-hifi"; | 44 | data->dai.codec_name = "snd-soc-dummy"; |
47 | data->dai[num_links].codec_name = "spdif-dit"; | 45 | data->dai.cpu_of_node = spdif_np; |
48 | data->dai[num_links].cpu_of_node = spdif_np; | 46 | data->dai.platform_of_node = spdif_np; |
49 | data->dai[num_links].platform_of_node = spdif_np; | 47 | data->dai.playback_only = true; |
50 | num_links++; | 48 | data->dai.capture_only = true; |
51 | |||
52 | data->txdev = platform_device_register_simple("spdif-dit", -1, NULL, 0); | ||
53 | if (IS_ERR(data->txdev)) { | ||
54 | ret = PTR_ERR(data->txdev); | ||
55 | dev_err(&pdev->dev, "register dit failed: %d\n", ret); | ||
56 | goto end; | ||
57 | } | ||
58 | } | ||
59 | 49 | ||
60 | if (of_property_read_bool(np, "spdif-in")) { | 50 | if (of_property_read_bool(np, "spdif-out")) |
61 | data->dai[num_links].name = "S/PDIF RX"; | 51 | data->dai.capture_only = false; |
62 | data->dai[num_links].stream_name = "S/PDIF PCM Capture"; | 52 | |
63 | data->dai[num_links].codec_dai_name = "dir-hifi"; | 53 | if (of_property_read_bool(np, "spdif-in")) |
64 | data->dai[num_links].codec_name = "spdif-dir"; | 54 | data->dai.playback_only = false; |
65 | data->dai[num_links].cpu_of_node = spdif_np; | ||
66 | data->dai[num_links].platform_of_node = spdif_np; | ||
67 | num_links++; | ||
68 | |||
69 | data->rxdev = platform_device_register_simple("spdif-dir", -1, NULL, 0); | ||
70 | if (IS_ERR(data->rxdev)) { | ||
71 | ret = PTR_ERR(data->rxdev); | ||
72 | dev_err(&pdev->dev, "register dir failed: %d\n", ret); | ||
73 | goto error_dit; | ||
74 | } | ||
75 | } | ||
76 | 55 | ||
77 | if (!num_links) { | 56 | if (data->dai.playback_only && data->dai.capture_only) { |
78 | dev_err(&pdev->dev, "no enabled S/PDIF DAI link\n"); | 57 | dev_err(&pdev->dev, "no enabled S/PDIF DAI link\n"); |
79 | goto error_dir; | 58 | goto end; |
80 | } | 59 | } |
81 | 60 | ||
82 | data->card.dev = &pdev->dev; | 61 | data->card.dev = &pdev->dev; |
83 | data->card.num_links = num_links; | 62 | data->card.dai_link = &data->dai; |
84 | data->card.dai_link = data->dai; | 63 | data->card.num_links = 1; |
85 | 64 | ||
86 | ret = snd_soc_of_parse_card_name(&data->card, "model"); | 65 | ret = snd_soc_of_parse_card_name(&data->card, "model"); |
87 | if (ret) | 66 | if (ret) |
88 | goto error_dir; | 67 | goto end; |
89 | 68 | ||
90 | ret = devm_snd_soc_register_card(&pdev->dev, &data->card); | 69 | ret = devm_snd_soc_register_card(&pdev->dev, &data->card); |
91 | if (ret) { | 70 | if (ret) { |
92 | dev_err(&pdev->dev, "snd_soc_register_card failed: %d\n", ret); | 71 | dev_err(&pdev->dev, "snd_soc_register_card failed: %d\n", ret); |
93 | goto error_dir; | 72 | goto end; |
94 | } | 73 | } |
95 | 74 | ||
96 | platform_set_drvdata(pdev, data); | 75 | platform_set_drvdata(pdev, data); |
97 | 76 | ||
98 | goto end; | ||
99 | |||
100 | error_dir: | ||
101 | if (data->rxdev) | ||
102 | platform_device_unregister(data->rxdev); | ||
103 | error_dit: | ||
104 | if (data->txdev) | ||
105 | platform_device_unregister(data->txdev); | ||
106 | end: | 77 | end: |
107 | if (spdif_np) | 78 | if (spdif_np) |
108 | of_node_put(spdif_np); | 79 | of_node_put(spdif_np); |
@@ -110,18 +81,6 @@ end: | |||
110 | return ret; | 81 | return ret; |
111 | } | 82 | } |
112 | 83 | ||
113 | static int imx_spdif_audio_remove(struct platform_device *pdev) | ||
114 | { | ||
115 | struct imx_spdif_data *data = platform_get_drvdata(pdev); | ||
116 | |||
117 | if (data->rxdev) | ||
118 | platform_device_unregister(data->rxdev); | ||
119 | if (data->txdev) | ||
120 | platform_device_unregister(data->txdev); | ||
121 | |||
122 | return 0; | ||
123 | } | ||
124 | |||
125 | static const struct of_device_id imx_spdif_dt_ids[] = { | 84 | static const struct of_device_id imx_spdif_dt_ids[] = { |
126 | { .compatible = "fsl,imx-audio-spdif", }, | 85 | { .compatible = "fsl,imx-audio-spdif", }, |
127 | { /* sentinel */ } | 86 | { /* sentinel */ } |
@@ -135,7 +94,6 @@ static struct platform_driver imx_spdif_driver = { | |||
135 | .of_match_table = imx_spdif_dt_ids, | 94 | .of_match_table = imx_spdif_dt_ids, |
136 | }, | 95 | }, |
137 | .probe = imx_spdif_audio_probe, | 96 | .probe = imx_spdif_audio_probe, |
138 | .remove = imx_spdif_audio_remove, | ||
139 | }; | 97 | }; |
140 | 98 | ||
141 | module_platform_driver(imx_spdif_driver); | 99 | module_platform_driver(imx_spdif_driver); |