diff options
author | Stephen Warren <swarren@nvidia.com> | 2013-12-10 14:35:24 -0500 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-12-18 13:55:02 -0500 |
commit | ede38884ac25ed78e43f3480056670963a9980f0 (patch) | |
tree | 9c9c434b532a9f0faf4b248b1d2d6c8afcb40785 | |
parent | d71b3ef44f9e5cfda2499768f6420b784845af06 (diff) |
ASoC: SPEAr: get rid of spear-pcm-audio struct device
Modify the SPEAr PCM driver so that it's a utility library that can be
registered on each DAI, rather than a separate struct device. This is
more in line with how many recent DT-converted platforms operate, and
avoids the need for yet another struct device.
This is also required as a pre-cursor to removing
spear_pcm_request_chan().
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r-- | sound/soc/spear/spdif_in.c | 9 | ||||
-rw-r--r-- | sound/soc/spear/spdif_out.c | 10 | ||||
-rw-r--r-- | sound/soc/spear/spear_pcm.c | 18 | ||||
-rw-r--r-- | sound/soc/spear/spear_pcm.h | 22 |
4 files changed, 41 insertions, 18 deletions
diff --git a/sound/soc/spear/spdif_in.c b/sound/soc/spear/spdif_in.c index 21a8c954af1c..4627110f3441 100644 --- a/sound/soc/spear/spdif_in.c +++ b/sound/soc/spear/spdif_in.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <sound/spear_dma.h> | 24 | #include <sound/spear_dma.h> |
25 | #include <sound/spear_spdif.h> | 25 | #include <sound/spear_spdif.h> |
26 | #include "spdif_in_regs.h" | 26 | #include "spdif_in_regs.h" |
27 | #include "spear_pcm.h" | ||
27 | 28 | ||
28 | struct spdif_in_params { | 29 | struct spdif_in_params { |
29 | u32 format; | 30 | u32 format; |
@@ -257,8 +258,12 @@ static int spdif_in_probe(struct platform_device *pdev) | |||
257 | return ret; | 258 | return ret; |
258 | } | 259 | } |
259 | 260 | ||
260 | return devm_snd_soc_register_component(&pdev->dev, &spdif_in_component, | 261 | ret = devm_snd_soc_register_component(&pdev->dev, &spdif_in_component, |
261 | &spdif_in_dai, 1); | 262 | &spdif_in_dai, 1); |
263 | if (ret) | ||
264 | return ret; | ||
265 | |||
266 | return devm_spear_pcm_platform_register(&pdev->dev); | ||
262 | } | 267 | } |
263 | 268 | ||
264 | static struct platform_driver spdif_in_driver = { | 269 | static struct platform_driver spdif_in_driver = { |
diff --git a/sound/soc/spear/spdif_out.c b/sound/soc/spear/spdif_out.c index b6ef6f78dc78..731a1e0cfeaa 100644 --- a/sound/soc/spear/spdif_out.c +++ b/sound/soc/spear/spdif_out.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <sound/spear_dma.h> | 22 | #include <sound/spear_dma.h> |
23 | #include <sound/spear_spdif.h> | 23 | #include <sound/spear_spdif.h> |
24 | #include "spdif_out_regs.h" | 24 | #include "spdif_out_regs.h" |
25 | #include "spear_pcm.h" | ||
25 | 26 | ||
26 | struct spdif_out_params { | 27 | struct spdif_out_params { |
27 | u32 rate; | 28 | u32 rate; |
@@ -280,6 +281,7 @@ static int spdif_out_probe(struct platform_device *pdev) | |||
280 | struct spdif_out_dev *host; | 281 | struct spdif_out_dev *host; |
281 | struct spear_spdif_platform_data *pdata; | 282 | struct spear_spdif_platform_data *pdata; |
282 | struct resource *res; | 283 | struct resource *res; |
284 | int ret; | ||
283 | 285 | ||
284 | host = devm_kzalloc(&pdev->dev, sizeof(*host), GFP_KERNEL); | 286 | host = devm_kzalloc(&pdev->dev, sizeof(*host), GFP_KERNEL); |
285 | if (!host) { | 287 | if (!host) { |
@@ -306,8 +308,12 @@ static int spdif_out_probe(struct platform_device *pdev) | |||
306 | 308 | ||
307 | dev_set_drvdata(&pdev->dev, host); | 309 | dev_set_drvdata(&pdev->dev, host); |
308 | 310 | ||
309 | return devm_snd_soc_register_component(&pdev->dev, &spdif_out_component, | 311 | ret = devm_snd_soc_register_component(&pdev->dev, &spdif_out_component, |
310 | &spdif_out_dai, 1); | 312 | &spdif_out_dai, 1); |
313 | if (ret) | ||
314 | return ret; | ||
315 | |||
316 | return devm_spear_pcm_platform_register(&pdev->dev); | ||
311 | } | 317 | } |
312 | 318 | ||
313 | #ifdef CONFIG_PM | 319 | #ifdef CONFIG_PM |
diff --git a/sound/soc/spear/spear_pcm.c b/sound/soc/spear/spear_pcm.c index 9a02141666ea..f288724961da 100644 --- a/sound/soc/spear/spear_pcm.c +++ b/sound/soc/spear/spear_pcm.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <sound/pcm.h> | 18 | #include <sound/pcm.h> |
19 | #include <sound/soc.h> | 19 | #include <sound/soc.h> |
20 | #include <sound/spear_dma.h> | 20 | #include <sound/spear_dma.h> |
21 | #include "spear_pcm.h" | ||
21 | 22 | ||
22 | static const struct snd_pcm_hardware spear_pcm_hardware = { | 23 | static const struct snd_pcm_hardware spear_pcm_hardware = { |
23 | .info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | | 24 | .info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | |
@@ -47,26 +48,15 @@ static const struct snd_dmaengine_pcm_config spear_dmaengine_pcm_config = { | |||
47 | .prealloc_buffer_size = 16 * 1024, | 48 | .prealloc_buffer_size = 16 * 1024, |
48 | }; | 49 | }; |
49 | 50 | ||
50 | static int spear_soc_platform_probe(struct platform_device *pdev) | 51 | int devm_spear_pcm_platform_register(struct device *dev) |
51 | { | 52 | { |
52 | return devm_snd_dmaengine_pcm_register(&pdev->dev, | 53 | return devm_snd_dmaengine_pcm_register(dev, |
53 | &spear_dmaengine_pcm_config, | 54 | &spear_dmaengine_pcm_config, |
54 | SND_DMAENGINE_PCM_FLAG_NO_DT | | 55 | SND_DMAENGINE_PCM_FLAG_NO_DT | |
55 | SND_DMAENGINE_PCM_FLAG_COMPAT); | 56 | SND_DMAENGINE_PCM_FLAG_COMPAT); |
56 | } | 57 | } |
57 | 58 | EXPORT_SYMBOL_GPL(devm_spear_pcm_platform_register); | |
58 | static struct platform_driver spear_pcm_driver = { | ||
59 | .driver = { | ||
60 | .name = "spear-pcm-audio", | ||
61 | .owner = THIS_MODULE, | ||
62 | }, | ||
63 | |||
64 | .probe = spear_soc_platform_probe, | ||
65 | }; | ||
66 | |||
67 | module_platform_driver(spear_pcm_driver); | ||
68 | 59 | ||
69 | MODULE_AUTHOR("Rajeev Kumar <rajeev-dlh.kumar@st.com>"); | 60 | MODULE_AUTHOR("Rajeev Kumar <rajeev-dlh.kumar@st.com>"); |
70 | MODULE_DESCRIPTION("SPEAr PCM DMA module"); | 61 | MODULE_DESCRIPTION("SPEAr PCM DMA module"); |
71 | MODULE_LICENSE("GPL"); | 62 | MODULE_LICENSE("GPL"); |
72 | MODULE_ALIAS("platform:spear-pcm-audio"); | ||
diff --git a/sound/soc/spear/spear_pcm.h b/sound/soc/spear/spear_pcm.h new file mode 100644 index 000000000000..631e2aa1fb33 --- /dev/null +++ b/sound/soc/spear/spear_pcm.h | |||
@@ -0,0 +1,22 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms and conditions of the GNU General Public License, | ||
6 | * version 2, as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
11 | * more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
16 | |||
17 | #ifndef __SPEAR_PCM_H__ | ||
18 | #define __SPEAR_PCM_H__ | ||
19 | |||
20 | int devm_spear_pcm_platform_register(struct device *dev); | ||
21 | |||
22 | #endif | ||