[alsa-devel] [PATCH 0/5] ASoC: remove dmaengine compat_request_channel
From: Stephen Warren swarren@nvidia.com
This series removes almost all users of the ASoC dmaengine compat_request_channel() function, and its implementation.
The ux500 driver still uses compat_request_channel. I believe that Lars-Peter is working on removing its use from that driver. That patch or series would need to be inserted between 4/5 and 5/5 in this series.
This series is based on ASoC's topic/dma branch.
I have only compile-tested these patches.
Stephen Warren (5): ASoC: ep93xx: get rid of ep93xx-pcm-audio struct device ASoC: ep93xx: remove custom DMA alloc compat function ASoC: SPEAr: get rid of spear-pcm-audio struct device ASoC: SPEAr: remove custom DMA alloc compat function ASoC: dmaengine: remove compat_request_channel
include/sound/dmaengine_pcm.h | 3 --- include/sound/spear_dma.h | 1 - sound/soc/cirrus/edb93xx.c | 2 +- sound/soc/cirrus/ep93xx-ac97.c | 21 ++++++++++++++++-- sound/soc/cirrus/ep93xx-i2s.c | 23 +++++++++++++++++-- sound/soc/cirrus/ep93xx-pcm.c | 39 +++++++------------------------- sound/soc/cirrus/ep93xx-pcm.h | 24 ++++++++++++++++++++ sound/soc/cirrus/simone.c | 2 +- sound/soc/cirrus/snappercl15.c | 2 +- sound/soc/soc-generic-dmaengine-pcm.c | 3 --- sound/soc/spear/spdif_in.c | 25 +++++++++++++++++---- sound/soc/spear/spdif_out.c | 26 ++++++++++++++++++---- sound/soc/spear/spear_pcm.c | 42 ++++++++++------------------------- sound/soc/spear/spear_pcm.h | 26 ++++++++++++++++++++++ 14 files changed, 156 insertions(+), 83 deletions(-) create mode 100644 sound/soc/cirrus/ep93xx-pcm.h create mode 100644 sound/soc/spear/spear_pcm.h
From: Stephen Warren swarren@nvidia.com
Modify the ep93xx 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.
Signed-off-by: Stephen Warren swarren@nvidia.com --- sound/soc/cirrus/edb93xx.c | 2 +- sound/soc/cirrus/ep93xx-ac97.c | 9 +++++++++ sound/soc/cirrus/ep93xx-i2s.c | 9 +++++++++ sound/soc/cirrus/ep93xx-pcm.c | 26 ++++++++------------------ sound/soc/cirrus/ep93xx-pcm.h | 24 ++++++++++++++++++++++++ sound/soc/cirrus/simone.c | 2 +- sound/soc/cirrus/snappercl15.c | 2 +- 7 files changed, 53 insertions(+), 21 deletions(-) create mode 100644 sound/soc/cirrus/ep93xx-pcm.h
diff --git a/sound/soc/cirrus/edb93xx.c b/sound/soc/cirrus/edb93xx.c index c43fb214558a..4f900efc437c 100644 --- a/sound/soc/cirrus/edb93xx.c +++ b/sound/soc/cirrus/edb93xx.c @@ -63,7 +63,7 @@ static struct snd_soc_ops edb93xx_ops = { static struct snd_soc_dai_link edb93xx_dai = { .name = "CS4271", .stream_name = "CS4271 HiFi", - .platform_name = "ep93xx-pcm-audio", + .platform_name = "ep93xx-i2s", .cpu_dai_name = "ep93xx-i2s", .codec_name = "spi0.0", .codec_dai_name = "cs4271-hifi", diff --git a/sound/soc/cirrus/ep93xx-ac97.c b/sound/soc/cirrus/ep93xx-ac97.c index efa75b5086a4..e45f0fd2f6b8 100644 --- a/sound/soc/cirrus/ep93xx-ac97.c +++ b/sound/soc/cirrus/ep93xx-ac97.c @@ -24,6 +24,8 @@
#include <linux/platform_data/dma-ep93xx.h>
+#include "ep93xx-pcm.h" + /* * Per channel (1-4) registers. */ @@ -394,8 +396,14 @@ static int ep93xx_ac97_probe(struct platform_device *pdev) if (ret) goto fail;
+ err = ep93xx_pcm_platform_register(&pdev->dev); + if (err) + goto fail_unregister; + return 0;
+fail_unregister: + snd_soc_unregister_component(&pdev->dev); fail: ep93xx_ac97_info = NULL; snd_soc_set_ac97_ops(NULL); @@ -406,6 +414,7 @@ static int ep93xx_ac97_remove(struct platform_device *pdev) { struct ep93xx_ac97_info *info = platform_get_drvdata(pdev);
+ ep93xx_pcm_platform_unregister(&pdev->dev); snd_soc_unregister_component(&pdev->dev);
/* disable the AC97 controller */ diff --git a/sound/soc/cirrus/ep93xx-i2s.c b/sound/soc/cirrus/ep93xx-i2s.c index a57643d6402f..cc43ed2dbca5 100644 --- a/sound/soc/cirrus/ep93xx-i2s.c +++ b/sound/soc/cirrus/ep93xx-i2s.c @@ -30,6 +30,8 @@ #include <mach/ep93xx-regs.h> #include <linux/platform_data/dma-ep93xx.h>
+#include "ep93xx-pcm.h" + #define EP93XX_I2S_TXCLKCFG 0x00 #define EP93XX_I2S_RXCLKCFG 0x04 #define EP93XX_I2S_GLCTRL 0x0C @@ -405,8 +407,14 @@ static int ep93xx_i2s_probe(struct platform_device *pdev) if (err) goto fail_put_lrclk;
+ err = ep93xx_pcm_platform_register(&pdev->dev); + if (err) + goto fail_unregister; + return 0;
+fail_unregister: + snd_soc_unregister_component(&pdev->dev); fail_put_lrclk: clk_put(info->lrclk); fail_put_sclk: @@ -421,6 +429,7 @@ static int ep93xx_i2s_remove(struct platform_device *pdev) { struct ep93xx_i2s_info *info = dev_get_drvdata(&pdev->dev);
+ ep93xx_pcm_platform_unregister(&pdev->dev); snd_soc_unregister_component(&pdev->dev); clk_put(info->lrclk); clk_put(info->sclk); diff --git a/sound/soc/cirrus/ep93xx-pcm.c b/sound/soc/cirrus/ep93xx-pcm.c index cfe517e68009..144278aa65f9 100644 --- a/sound/soc/cirrus/ep93xx-pcm.c +++ b/sound/soc/cirrus/ep93xx-pcm.c @@ -23,6 +23,8 @@
#include <linux/platform_data/dma-ep93xx.h>
+#include "ep93xx-pcm.h" + static const struct snd_pcm_hardware ep93xx_pcm_hardware = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID | @@ -76,34 +78,22 @@ static const struct snd_dmaengine_pcm_config ep93xx_dmaengine_pcm_config = { .prealloc_buffer_size = 131072, };
-static int ep93xx_soc_platform_probe(struct platform_device *pdev) +int ep93xx_pcm_platform_register(struct device *dev) { - return snd_dmaengine_pcm_register(&pdev->dev, + return snd_dmaengine_pcm_register(dev, &ep93xx_dmaengine_pcm_config, SND_DMAENGINE_PCM_FLAG_NO_RESIDUE | SND_DMAENGINE_PCM_FLAG_NO_DT | SND_DMAENGINE_PCM_FLAG_COMPAT); } +EXPORT_SYMBOL_GPL(ep93xx_pcm_platform_register);
-static int ep93xx_soc_platform_remove(struct platform_device *pdev) +void ep93xx_pcm_platform_unregister(struct device *dev) { - snd_dmaengine_pcm_unregister(&pdev->dev); - return 0; + snd_dmaengine_pcm_unregister(dev); } - -static struct platform_driver ep93xx_pcm_driver = { - .driver = { - .name = "ep93xx-pcm-audio", - .owner = THIS_MODULE, - }, - - .probe = ep93xx_soc_platform_probe, - .remove = ep93xx_soc_platform_remove, -}; - -module_platform_driver(ep93xx_pcm_driver); +EXPORT_SYMBOL_GPL(ep93xx_pcm_platform_unregister);
MODULE_AUTHOR("Ryan Mallon"); MODULE_DESCRIPTION("EP93xx ALSA PCM interface"); MODULE_LICENSE("GPL"); -MODULE_ALIAS("platform:ep93xx-pcm-audio"); diff --git a/sound/soc/cirrus/ep93xx-pcm.h b/sound/soc/cirrus/ep93xx-pcm.h new file mode 100644 index 000000000000..5ee1afce931f --- /dev/null +++ b/sound/soc/cirrus/ep93xx-pcm.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/. + */ + +#ifndef __EP93XX_PCM_H__ +#define __EP93XX_PCM_H__ + +int ep93xx_pcm_platform_register(struct device *dev); +void ep93xx_pcm_platform_unregister(struct device *dev); + +#endif + diff --git a/sound/soc/cirrus/simone.c b/sound/soc/cirrus/simone.c index 4d094d00c34a..822a19a89e74 100644 --- a/sound/soc/cirrus/simone.c +++ b/sound/soc/cirrus/simone.c @@ -27,7 +27,7 @@ static struct snd_soc_dai_link simone_dai = { .cpu_dai_name = "ep93xx-ac97", .codec_dai_name = "ac97-hifi", .codec_name = "ac97-codec", - .platform_name = "ep93xx-pcm-audio", + .platform_name = "ep93xx-ac97", };
static struct snd_soc_card snd_soc_simone = { diff --git a/sound/soc/cirrus/snappercl15.c b/sound/soc/cirrus/snappercl15.c index 69041074f2c1..29238a7476dd 100644 --- a/sound/soc/cirrus/snappercl15.c +++ b/sound/soc/cirrus/snappercl15.c @@ -83,7 +83,7 @@ static struct snd_soc_dai_link snappercl15_dai = { .cpu_dai_name = "ep93xx-i2s", .codec_dai_name = "tlv320aic23-hifi", .codec_name = "tlv320aic23-codec.0-001a", - .platform_name = "ep93xx-pcm-audio", + .platform_name = "ep93xx-i2s", .init = snappercl15_tlv320aic23_init, .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_IF | SND_SOC_DAIFMT_CBS_CFS,
On 12/09/2013 09:24 PM, Stephen Warren wrote: [...]
-static int ep93xx_soc_platform_probe(struct platform_device *pdev) +int ep93xx_pcm_platform_register(struct device *dev) {
- return snd_dmaengine_pcm_register(&pdev->dev,
- return snd_dmaengine_pcm_register(dev,
This will have a conflict with the "ASoC: ep93xx: Use devm_snd_dmaengine_pcm_register()" patch from the topic/ep93xx branch. Otherwise the patch looks fine to me.
&ep93xx_dmaengine_pcm_config, SND_DMAENGINE_PCM_FLAG_NO_RESIDUE | SND_DMAENGINE_PCM_FLAG_NO_DT | SND_DMAENGINE_PCM_FLAG_COMPAT);
} +EXPORT_SYMBOL_GPL(ep93xx_pcm_platform_register);
On 12/09/2013 01:44 PM, Lars-Peter Clausen wrote:
On 12/09/2013 09:24 PM, Stephen Warren wrote: [...]
-static int ep93xx_soc_platform_probe(struct platform_device *pdev) +int ep93xx_pcm_platform_register(struct device *dev) {
- return snd_dmaengine_pcm_register(&pdev->dev,
- return snd_dmaengine_pcm_register(dev,
This will have a conflict with the "ASoC: ep93xx: Use devm_snd_dmaengine_pcm_register()" patch from the topic/ep93xx branch.
That's true. The conflict isn't conceptually that hard to resolve, but probably a lot more than you want to do in a merge. I guess the way to resolve it is to merge topic/ep93xx and topic/spear into topic/dma, then to apply these patches on top. If that sounds good, I can rebase them and resend.
... although that said, I'll need topic/dma as a dependency for that Tegra DMA controller rework, and I'm not sure I want to pick up these ep93xx/spear changes there, so I wonder if we should hold off doing the merge and applying these patches until I've pulled in topic/dma, or perhaps a separate topic branch is needed for this cleanup?
On 12/10/2013 12:50 AM, Stephen Warren wrote:
On 12/09/2013 01:44 PM, Lars-Peter Clausen wrote:
On 12/09/2013 09:24 PM, Stephen Warren wrote: [...]
-static int ep93xx_soc_platform_probe(struct platform_device *pdev) +int ep93xx_pcm_platform_register(struct device *dev) {
- return snd_dmaengine_pcm_register(&pdev->dev,
- return snd_dmaengine_pcm_register(dev,
This will have a conflict with the "ASoC: ep93xx: Use devm_snd_dmaengine_pcm_register()" patch from the topic/ep93xx branch.
That's true. The conflict isn't conceptually that hard to resolve, but probably a lot more than you want to do in a merge. I guess the way to resolve it is to merge topic/ep93xx and topic/spear into topic/dma, then to apply these patches on top. If that sounds good, I can rebase them and resend.
I'd assume that the first two patches from this series go into topic/ep93xx and the second two into topic/spear and the last one will have to wait for ux500 anyway.
... although that said, I'll need topic/dma as a dependency for that Tegra DMA controller rework, and I'm not sure I want to pick up these ep93xx/spear changes there, so I wonder if we should hold off doing the merge and applying these patches until I've pulled in topic/dma, or perhaps a separate topic branch is needed for this cleanup?
On Tue, Dec 10, 2013 at 08:47:14AM +0100, Lars-Peter Clausen wrote:
I'd assume that the first two patches from this series go into topic/ep93xx and the second two into topic/spear and the last one will have to wait for ux500 anyway.
Yes.
On 12/10/2013 03:23 AM, Mark Brown wrote:
On Tue, Dec 10, 2013 at 08:47:14AM +0100, Lars-Peter Clausen wrote:
I'd assume that the first two patches from this series go into topic/ep93xx and the second two into topic/spear and the last one will have to wait for ux500 anyway.
Yes.
OK, so you plan on merging topic/dma into topic/ep93xx and topic/spear then? Since this series does depend on patches in topic/dma.
On Tue, Dec 10, 2013 at 09:56:39AM -0700, Stephen Warren wrote:
On 12/10/2013 03:23 AM, Mark Brown wrote:
Yes.
OK, so you plan on merging topic/dma into topic/ep93xx and topic/spear then? Since this series does depend on patches in topic/dma.
Yes, that's how I normally handle these things - merge the core branch into the relevant driver branch. The final removal is going to be stuck due to the ux500 anyway.
On Mon, Dec 09, 2013 at 04:50:22PM -0700, Stephen Warren wrote:
On 12/09/2013 01:44 PM, Lars-Peter Clausen wrote:
This will have a conflict with the "ASoC: ep93xx: Use devm_snd_dmaengine_pcm_register()" patch from the topic/ep93xx branch.
That's true. The conflict isn't conceptually that hard to resolve, but probably a lot more than you want to do in a merge. I guess the way to resolve it is to merge topic/ep93xx and topic/spear into topic/dma, then to apply these patches on top. If that sounds good, I can rebase them and resend.
Please always submit against -next or at least check that that's going to work and comment on the result, it makes life easier. Remember that all the topic branches are constantly merged together, it's important that that works smoothly.
On Mon, Dec 09, 2013 at 01:24:12PM -0700, Stephen Warren wrote:
From: Stephen Warren swarren@nvidia.com
Modify the ep93xx 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.
Please CC driver maintainers, adding Hartley and Ryan.
Signed-off-by: Stephen Warren swarren@nvidia.com
sound/soc/cirrus/edb93xx.c | 2 +- sound/soc/cirrus/ep93xx-ac97.c | 9 +++++++++ sound/soc/cirrus/ep93xx-i2s.c | 9 +++++++++ sound/soc/cirrus/ep93xx-pcm.c | 26 ++++++++------------------ sound/soc/cirrus/ep93xx-pcm.h | 24 ++++++++++++++++++++++++ sound/soc/cirrus/simone.c | 2 +- sound/soc/cirrus/snappercl15.c | 2 +- 7 files changed, 53 insertions(+), 21 deletions(-) create mode 100644 sound/soc/cirrus/ep93xx-pcm.h
diff --git a/sound/soc/cirrus/edb93xx.c b/sound/soc/cirrus/edb93xx.c index c43fb214558a..4f900efc437c 100644 --- a/sound/soc/cirrus/edb93xx.c +++ b/sound/soc/cirrus/edb93xx.c @@ -63,7 +63,7 @@ static struct snd_soc_ops edb93xx_ops = { static struct snd_soc_dai_link edb93xx_dai = { .name = "CS4271", .stream_name = "CS4271 HiFi",
- .platform_name = "ep93xx-pcm-audio",
- .platform_name = "ep93xx-i2s", .cpu_dai_name = "ep93xx-i2s", .codec_name = "spi0.0", .codec_dai_name = "cs4271-hifi",
diff --git a/sound/soc/cirrus/ep93xx-ac97.c b/sound/soc/cirrus/ep93xx-ac97.c index efa75b5086a4..e45f0fd2f6b8 100644 --- a/sound/soc/cirrus/ep93xx-ac97.c +++ b/sound/soc/cirrus/ep93xx-ac97.c @@ -24,6 +24,8 @@
#include <linux/platform_data/dma-ep93xx.h>
+#include "ep93xx-pcm.h"
/*
- Per channel (1-4) registers.
*/ @@ -394,8 +396,14 @@ static int ep93xx_ac97_probe(struct platform_device *pdev) if (ret) goto fail;
- err = ep93xx_pcm_platform_register(&pdev->dev);
- if (err)
goto fail_unregister;
- return 0;
+fail_unregister:
- snd_soc_unregister_component(&pdev->dev);
fail: ep93xx_ac97_info = NULL; snd_soc_set_ac97_ops(NULL); @@ -406,6 +414,7 @@ static int ep93xx_ac97_remove(struct platform_device *pdev) { struct ep93xx_ac97_info *info = platform_get_drvdata(pdev);
ep93xx_pcm_platform_unregister(&pdev->dev); snd_soc_unregister_component(&pdev->dev);
/* disable the AC97 controller */
diff --git a/sound/soc/cirrus/ep93xx-i2s.c b/sound/soc/cirrus/ep93xx-i2s.c index a57643d6402f..cc43ed2dbca5 100644 --- a/sound/soc/cirrus/ep93xx-i2s.c +++ b/sound/soc/cirrus/ep93xx-i2s.c @@ -30,6 +30,8 @@ #include <mach/ep93xx-regs.h> #include <linux/platform_data/dma-ep93xx.h>
+#include "ep93xx-pcm.h"
#define EP93XX_I2S_TXCLKCFG 0x00 #define EP93XX_I2S_RXCLKCFG 0x04 #define EP93XX_I2S_GLCTRL 0x0C @@ -405,8 +407,14 @@ static int ep93xx_i2s_probe(struct platform_device *pdev) if (err) goto fail_put_lrclk;
- err = ep93xx_pcm_platform_register(&pdev->dev);
- if (err)
goto fail_unregister;
- return 0;
+fail_unregister:
- snd_soc_unregister_component(&pdev->dev);
fail_put_lrclk: clk_put(info->lrclk); fail_put_sclk: @@ -421,6 +429,7 @@ static int ep93xx_i2s_remove(struct platform_device *pdev) { struct ep93xx_i2s_info *info = dev_get_drvdata(&pdev->dev);
- ep93xx_pcm_platform_unregister(&pdev->dev); snd_soc_unregister_component(&pdev->dev); clk_put(info->lrclk); clk_put(info->sclk);
diff --git a/sound/soc/cirrus/ep93xx-pcm.c b/sound/soc/cirrus/ep93xx-pcm.c index cfe517e68009..144278aa65f9 100644 --- a/sound/soc/cirrus/ep93xx-pcm.c +++ b/sound/soc/cirrus/ep93xx-pcm.c @@ -23,6 +23,8 @@
#include <linux/platform_data/dma-ep93xx.h>
+#include "ep93xx-pcm.h"
static const struct snd_pcm_hardware ep93xx_pcm_hardware = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID | @@ -76,34 +78,22 @@ static const struct snd_dmaengine_pcm_config ep93xx_dmaengine_pcm_config = { .prealloc_buffer_size = 131072, };
-static int ep93xx_soc_platform_probe(struct platform_device *pdev) +int ep93xx_pcm_platform_register(struct device *dev) {
- return snd_dmaengine_pcm_register(&pdev->dev,
- return snd_dmaengine_pcm_register(dev, &ep93xx_dmaengine_pcm_config, SND_DMAENGINE_PCM_FLAG_NO_RESIDUE | SND_DMAENGINE_PCM_FLAG_NO_DT | SND_DMAENGINE_PCM_FLAG_COMPAT);
} +EXPORT_SYMBOL_GPL(ep93xx_pcm_platform_register);
-static int ep93xx_soc_platform_remove(struct platform_device *pdev) +void ep93xx_pcm_platform_unregister(struct device *dev) {
- snd_dmaengine_pcm_unregister(&pdev->dev);
- return 0;
- snd_dmaengine_pcm_unregister(dev);
}
-static struct platform_driver ep93xx_pcm_driver = {
- .driver = {
.name = "ep93xx-pcm-audio",
.owner = THIS_MODULE,
- },
- .probe = ep93xx_soc_platform_probe,
- .remove = ep93xx_soc_platform_remove,
-};
-module_platform_driver(ep93xx_pcm_driver); +EXPORT_SYMBOL_GPL(ep93xx_pcm_platform_unregister);
MODULE_AUTHOR("Ryan Mallon"); MODULE_DESCRIPTION("EP93xx ALSA PCM interface"); MODULE_LICENSE("GPL"); -MODULE_ALIAS("platform:ep93xx-pcm-audio"); diff --git a/sound/soc/cirrus/ep93xx-pcm.h b/sound/soc/cirrus/ep93xx-pcm.h new file mode 100644 index 000000000000..5ee1afce931f --- /dev/null +++ b/sound/soc/cirrus/ep93xx-pcm.h @@ -0,0 +1,24 @@ +/*
- Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved.
- This program is free software; you can redistribute it and/or modify it
- under the terms and conditions of the GNU General Public License,
- version 2, as published by the Free Software Foundation.
- This program is distributed in the hope it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see http://www.gnu.org/licenses/.
- */
+#ifndef __EP93XX_PCM_H__ +#define __EP93XX_PCM_H__
+int ep93xx_pcm_platform_register(struct device *dev); +void ep93xx_pcm_platform_unregister(struct device *dev);
+#endif
diff --git a/sound/soc/cirrus/simone.c b/sound/soc/cirrus/simone.c index 4d094d00c34a..822a19a89e74 100644 --- a/sound/soc/cirrus/simone.c +++ b/sound/soc/cirrus/simone.c @@ -27,7 +27,7 @@ static struct snd_soc_dai_link simone_dai = { .cpu_dai_name = "ep93xx-ac97", .codec_dai_name = "ac97-hifi", .codec_name = "ac97-codec",
- .platform_name = "ep93xx-pcm-audio",
- .platform_name = "ep93xx-ac97",
};
static struct snd_soc_card snd_soc_simone = { diff --git a/sound/soc/cirrus/snappercl15.c b/sound/soc/cirrus/snappercl15.c index 69041074f2c1..29238a7476dd 100644 --- a/sound/soc/cirrus/snappercl15.c +++ b/sound/soc/cirrus/snappercl15.c @@ -83,7 +83,7 @@ static struct snd_soc_dai_link snappercl15_dai = { .cpu_dai_name = "ep93xx-i2s", .codec_dai_name = "tlv320aic23-hifi", .codec_name = "tlv320aic23-codec.0-001a",
- .platform_name = "ep93xx-pcm-audio",
- .platform_name = "ep93xx-i2s", .init = snappercl15_tlv320aic23_init, .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_IF | SND_SOC_DAIFMT_CBS_CFS,
-- 1.8.1.5
On 12/10/2013 03:26 AM, Mark Brown wrote:
On Mon, Dec 09, 2013 at 01:24:12PM -0700, Stephen Warren wrote:
From: Stephen Warren swarren@nvidia.com
Modify the ep93xx 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.
Please CC driver maintainers, adding Hartley and Ryan.
A MAINTAINERS entry would be useful; get_maintainers on this patch only finds MAINTAINERS entries for ASoC itself, and a jumble of other commit signers, with a distribution of committers so it's not obvious who might be the driver maintainer.
From: Stephen Warren swarren@nvidia.com
ep93xx_compat_request_channel() is almost identical to dmaengine_pcm_compat_request_channel(), with the exception that the latter:
a) Assumes that the DAI DMA data is a struct snd_dmaengine_dai_dma_data pointer rather than some custom type.
b) dma_data->filter_data rather than dma_data should be passed to snd_dmaengine_pcm_request_channel() as the filter data.
Make minor changes to the ep93xx DAI drivers so that those two conditions are met. This allows removal of the custom .compat_request_channel().
Signed-off-by: Stephen Warren swarren@nvidia.com --- sound/soc/cirrus/ep93xx-ac97.c | 16 ++++++++++++---- sound/soc/cirrus/ep93xx-i2s.c | 14 ++++++++++++-- sound/soc/cirrus/ep93xx-pcm.c | 13 ------------- 3 files changed, 24 insertions(+), 19 deletions(-)
diff --git a/sound/soc/cirrus/ep93xx-ac97.c b/sound/soc/cirrus/ep93xx-ac97.c index e45f0fd2f6b8..f434b6ebb1d6 100644 --- a/sound/soc/cirrus/ep93xx-ac97.c +++ b/sound/soc/cirrus/ep93xx-ac97.c @@ -19,6 +19,7 @@ #include <linux/slab.h>
#include <sound/core.h> +#include <sound/dmaengine_pcm.h> #include <sound/ac97_codec.h> #include <sound/soc.h>
@@ -97,6 +98,8 @@ struct ep93xx_ac97_info { struct device *dev; void __iomem *regs; struct completion done; + struct snd_dmaengine_dai_dma_data dma_params_rx; + struct snd_dmaengine_dai_dma_data dma_params_tx; };
/* currently ALSA only supports a single AC97 device */ @@ -317,8 +320,13 @@ static int ep93xx_ac97_trigger(struct snd_pcm_substream *substream,
static int ep93xx_ac97_dai_probe(struct snd_soc_dai *dai) { - dai->playback_dma_data = &ep93xx_ac97_pcm_out; - dai->capture_dma_data = &ep93xx_ac97_pcm_in; + struct ep93xx_ac97_info *info = snd_soc_dai_get_drvdata(dai); + + info->dma_params_tx.filter_data = &ep93xx_ac97_pcm_out; + info->dma_params_rx.filter_data = &ep93xx_ac97_pcm_in; + + dai->playback_dma_data = &info->dma_params_tx; + dai->capture_dma_data = &info->dma_params_rx;
return 0; } @@ -396,8 +404,8 @@ static int ep93xx_ac97_probe(struct platform_device *pdev) if (ret) goto fail;
- err = ep93xx_pcm_platform_register(&pdev->dev); - if (err) + ret = ep93xx_pcm_platform_register(&pdev->dev); + if (ret) goto fail_unregister;
return 0; diff --git a/sound/soc/cirrus/ep93xx-i2s.c b/sound/soc/cirrus/ep93xx-i2s.c index cc43ed2dbca5..d21a359f4011 100644 --- a/sound/soc/cirrus/ep93xx-i2s.c +++ b/sound/soc/cirrus/ep93xx-i2s.c @@ -21,6 +21,7 @@ #include <linux/io.h>
#include <sound/core.h> +#include <sound/dmaengine_pcm.h> #include <sound/pcm.h> #include <sound/pcm_params.h> #include <sound/initval.h> @@ -63,6 +64,8 @@ struct ep93xx_i2s_info { struct clk *sclk; struct clk *lrclk; void __iomem *regs; + struct snd_dmaengine_dai_dma_data dma_params_rx; + struct snd_dmaengine_dai_dma_data dma_params_tx; };
static struct ep93xx_dma_data ep93xx_i2s_dma_data[] = { @@ -142,8 +145,15 @@ static void ep93xx_i2s_disable(struct ep93xx_i2s_info *info, int stream)
static int ep93xx_i2s_dai_probe(struct snd_soc_dai *dai) { - dai->playback_dma_data = &ep93xx_i2s_dma_data[SNDRV_PCM_STREAM_PLAYBACK]; - dai->capture_dma_data = &ep93xx_i2s_dma_data[SNDRV_PCM_STREAM_CAPTURE]; + struct ep93xx_i2s_info *info = snd_soc_dai_get_drvdata(dai); + + info->dma_params_tx.filter_data = + &ep93xx_i2s_dma_data[SNDRV_PCM_STREAM_PLAYBACK]; + info->dma_params_rx.filter_data = + &ep93xx_i2s_dma_data[SNDRV_PCM_STREAM_CAPTURE]; + + dai->playback_dma_data = &info->dma_params_tx; + dai->capture_dma_data = &info->dma_params_rx;
return 0; } diff --git a/sound/soc/cirrus/ep93xx-pcm.c b/sound/soc/cirrus/ep93xx-pcm.c index 144278aa65f9..856862932fdf 100644 --- a/sound/soc/cirrus/ep93xx-pcm.c +++ b/sound/soc/cirrus/ep93xx-pcm.c @@ -59,22 +59,9 @@ static bool ep93xx_pcm_dma_filter(struct dma_chan *chan, void *filter_param) return false; }
-static struct dma_chan *ep93xx_compat_request_channel( - struct snd_soc_pcm_runtime *rtd, - struct snd_pcm_substream *substream) -{ - struct snd_dmaengine_dai_dma_data *dma_data; - - dma_data = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); - - return snd_dmaengine_pcm_request_channel(ep93xx_pcm_dma_filter, - dma_data); -} - static const struct snd_dmaengine_pcm_config ep93xx_dmaengine_pcm_config = { .pcm_hardware = &ep93xx_pcm_hardware, .compat_filter_fn = ep93xx_pcm_dma_filter, - .compat_request_channel = ep93xx_compat_request_channel, .prealloc_buffer_size = 131072, };
On Mon, Dec 09, 2013 at 01:24:13PM -0700, Stephen Warren wrote:
From: Stephen Warren swarren@nvidia.com
ep93xx_compat_request_channel() is almost identical to dmaengine_pcm_compat_request_channel(), with the exception that the latter:
a) Assumes that the DAI DMA data is a struct snd_dmaengine_dai_dma_data pointer rather than some custom type.
b) dma_data->filter_data rather than dma_data should be passed to snd_dmaengine_pcm_request_channel() as the filter data.
Make minor changes to the ep93xx DAI drivers so that those two conditions are met. This allows removal of the custom .compat_request_channel().
Adding Hartley and Ryan.
Signed-off-by: Stephen Warren swarren@nvidia.com
sound/soc/cirrus/ep93xx-ac97.c | 16 ++++++++++++---- sound/soc/cirrus/ep93xx-i2s.c | 14 ++++++++++++-- sound/soc/cirrus/ep93xx-pcm.c | 13 ------------- 3 files changed, 24 insertions(+), 19 deletions(-)
diff --git a/sound/soc/cirrus/ep93xx-ac97.c b/sound/soc/cirrus/ep93xx-ac97.c index e45f0fd2f6b8..f434b6ebb1d6 100644 --- a/sound/soc/cirrus/ep93xx-ac97.c +++ b/sound/soc/cirrus/ep93xx-ac97.c @@ -19,6 +19,7 @@ #include <linux/slab.h>
#include <sound/core.h> +#include <sound/dmaengine_pcm.h> #include <sound/ac97_codec.h> #include <sound/soc.h>
@@ -97,6 +98,8 @@ struct ep93xx_ac97_info { struct device *dev; void __iomem *regs; struct completion done;
- struct snd_dmaengine_dai_dma_data dma_params_rx;
- struct snd_dmaengine_dai_dma_data dma_params_tx;
};
/* currently ALSA only supports a single AC97 device */ @@ -317,8 +320,13 @@ static int ep93xx_ac97_trigger(struct snd_pcm_substream *substream,
static int ep93xx_ac97_dai_probe(struct snd_soc_dai *dai) {
- dai->playback_dma_data = &ep93xx_ac97_pcm_out;
- dai->capture_dma_data = &ep93xx_ac97_pcm_in;
struct ep93xx_ac97_info *info = snd_soc_dai_get_drvdata(dai);
info->dma_params_tx.filter_data = &ep93xx_ac97_pcm_out;
info->dma_params_rx.filter_data = &ep93xx_ac97_pcm_in;
dai->playback_dma_data = &info->dma_params_tx;
dai->capture_dma_data = &info->dma_params_rx;
return 0;
} @@ -396,8 +404,8 @@ static int ep93xx_ac97_probe(struct platform_device *pdev) if (ret) goto fail;
- err = ep93xx_pcm_platform_register(&pdev->dev);
- if (err)
ret = ep93xx_pcm_platform_register(&pdev->dev);
if (ret) goto fail_unregister;
return 0;
diff --git a/sound/soc/cirrus/ep93xx-i2s.c b/sound/soc/cirrus/ep93xx-i2s.c index cc43ed2dbca5..d21a359f4011 100644 --- a/sound/soc/cirrus/ep93xx-i2s.c +++ b/sound/soc/cirrus/ep93xx-i2s.c @@ -21,6 +21,7 @@ #include <linux/io.h>
#include <sound/core.h> +#include <sound/dmaengine_pcm.h> #include <sound/pcm.h> #include <sound/pcm_params.h> #include <sound/initval.h> @@ -63,6 +64,8 @@ struct ep93xx_i2s_info { struct clk *sclk; struct clk *lrclk; void __iomem *regs;
- struct snd_dmaengine_dai_dma_data dma_params_rx;
- struct snd_dmaengine_dai_dma_data dma_params_tx;
};
static struct ep93xx_dma_data ep93xx_i2s_dma_data[] = { @@ -142,8 +145,15 @@ static void ep93xx_i2s_disable(struct ep93xx_i2s_info *info, int stream)
static int ep93xx_i2s_dai_probe(struct snd_soc_dai *dai) {
- dai->playback_dma_data = &ep93xx_i2s_dma_data[SNDRV_PCM_STREAM_PLAYBACK];
- dai->capture_dma_data = &ep93xx_i2s_dma_data[SNDRV_PCM_STREAM_CAPTURE];
struct ep93xx_i2s_info *info = snd_soc_dai_get_drvdata(dai);
info->dma_params_tx.filter_data =
&ep93xx_i2s_dma_data[SNDRV_PCM_STREAM_PLAYBACK];
info->dma_params_rx.filter_data =
&ep93xx_i2s_dma_data[SNDRV_PCM_STREAM_CAPTURE];
dai->playback_dma_data = &info->dma_params_tx;
dai->capture_dma_data = &info->dma_params_rx;
return 0;
} diff --git a/sound/soc/cirrus/ep93xx-pcm.c b/sound/soc/cirrus/ep93xx-pcm.c index 144278aa65f9..856862932fdf 100644 --- a/sound/soc/cirrus/ep93xx-pcm.c +++ b/sound/soc/cirrus/ep93xx-pcm.c @@ -59,22 +59,9 @@ static bool ep93xx_pcm_dma_filter(struct dma_chan *chan, void *filter_param) return false; }
-static struct dma_chan *ep93xx_compat_request_channel(
- struct snd_soc_pcm_runtime *rtd,
- struct snd_pcm_substream *substream)
-{
- struct snd_dmaengine_dai_dma_data *dma_data;
- dma_data = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
- return snd_dmaengine_pcm_request_channel(ep93xx_pcm_dma_filter,
dma_data);
-}
static const struct snd_dmaengine_pcm_config ep93xx_dmaengine_pcm_config = { .pcm_hardware = &ep93xx_pcm_hardware, .compat_filter_fn = ep93xx_pcm_dma_filter,
- .compat_request_channel = ep93xx_compat_request_channel, .prealloc_buffer_size = 131072,
};
-- 1.8.1.5
From: Stephen Warren swarren@nvidia.com
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 --- sound/soc/spear/spdif_in.c | 17 +++++++++++++++-- sound/soc/spear/spdif_out.c | 18 ++++++++++++++++-- sound/soc/spear/spear_pcm.c | 25 +++++++------------------ sound/soc/spear/spear_pcm.h | 24 ++++++++++++++++++++++++ 4 files changed, 62 insertions(+), 22 deletions(-) create mode 100644 sound/soc/spear/spear_pcm.h
diff --git a/sound/soc/spear/spdif_in.c b/sound/soc/spear/spdif_in.c index 21a8c954af1c..c1cfd333d81c 100644 --- a/sound/soc/spear/spdif_in.c +++ b/sound/soc/spear/spdif_in.c @@ -24,6 +24,7 @@ #include <sound/spear_dma.h> #include <sound/spear_spdif.h> #include "spdif_in_regs.h" +#include "spear_pcm.h"
struct spdif_in_params { u32 format; @@ -257,12 +258,24 @@ static int spdif_in_probe(struct platform_device *pdev) return ret; }
- return devm_snd_soc_register_component(&pdev->dev, &spdif_in_component, - &spdif_in_dai, 1); + ret = devm_snd_soc_register_component(&pdev->dev, &spdif_in_component, + &spdif_in_dai, 1); + if (ret) + return ret; + + return spear_pcm_platform_register(&pdev->dev); +} + +static int spdif_in_remove(struct platform_device *pdev) +{ + spear_pcm_platform_unregister(&pdev->dev); + + return 0; }
static struct platform_driver spdif_in_driver = { .probe = spdif_in_probe, + .remove = spdif_in_remove, .driver = { .name = "spdif-in", .owner = THIS_MODULE, diff --git a/sound/soc/spear/spdif_out.c b/sound/soc/spear/spdif_out.c index b6ef6f78dc78..ad3d5d684f0c 100644 --- a/sound/soc/spear/spdif_out.c +++ b/sound/soc/spear/spdif_out.c @@ -22,6 +22,7 @@ #include <sound/spear_dma.h> #include <sound/spear_spdif.h> #include "spdif_out_regs.h" +#include "spear_pcm.h"
struct spdif_out_params { u32 rate; @@ -280,6 +281,7 @@ static int spdif_out_probe(struct platform_device *pdev) struct spdif_out_dev *host; struct spear_spdif_platform_data *pdata; struct resource *res; + int ret;
host = devm_kzalloc(&pdev->dev, sizeof(*host), GFP_KERNEL); if (!host) { @@ -306,8 +308,19 @@ static int spdif_out_probe(struct platform_device *pdev)
dev_set_drvdata(&pdev->dev, host);
- return devm_snd_soc_register_component(&pdev->dev, &spdif_out_component, - &spdif_out_dai, 1); + ret = devm_snd_soc_register_component(&pdev->dev, &spdif_out_component, + &spdif_out_dai, 1); + if (ret) + return ret; + + return spear_pcm_platform_register(&pdev->dev); +} + +static int spdif_out_remove(struct platform_device *pdev) +{ + spear_pcm_platform_unregister(&pdev->dev); + + return 0; }
#ifdef CONFIG_PM @@ -348,6 +361,7 @@ static SIMPLE_DEV_PM_OPS(spdif_out_dev_pm_ops, spdif_out_suspend, \
static struct platform_driver spdif_out_driver = { .probe = spdif_out_probe, + .remove = spdif_out_remove, .driver = { .name = "spdif-out", .owner = THIS_MODULE, diff --git a/sound/soc/spear/spear_pcm.c b/sound/soc/spear/spear_pcm.c index 4707f2b862c3..e849f28e10c2 100644 --- a/sound/soc/spear/spear_pcm.c +++ b/sound/soc/spear/spear_pcm.c @@ -18,6 +18,7 @@ #include <sound/pcm.h> #include <sound/soc.h> #include <sound/spear_dma.h> +#include "spear_pcm.h"
static const struct snd_pcm_hardware spear_pcm_hardware = { .info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | @@ -47,33 +48,21 @@ static const struct snd_dmaengine_pcm_config spear_dmaengine_pcm_config = { .prealloc_buffer_size = 16 * 1024, };
-static int spear_soc_platform_probe(struct platform_device *pdev) +int spear_pcm_platform_register(struct device *dev) { - return snd_dmaengine_pcm_register(&pdev->dev, + return snd_dmaengine_pcm_register(dev, &spear_dmaengine_pcm_config, SND_DMAENGINE_PCM_FLAG_NO_DT | SND_DMAENGINE_PCM_FLAG_COMPAT); } +EXPORT_SYMBOL_GPL(spear_pcm_platform_register);
-static int spear_soc_platform_remove(struct platform_device *pdev) +void spear_pcm_platform_unregister(struct device *dev) { - snd_dmaengine_pcm_unregister(&pdev->dev); - return 0; + snd_dmaengine_pcm_unregister(dev); } - -static struct platform_driver spear_pcm_driver = { - .driver = { - .name = "spear-pcm-audio", - .owner = THIS_MODULE, - }, - - .probe = spear_soc_platform_probe, - .remove = spear_soc_platform_remove, -}; - -module_platform_driver(spear_pcm_driver); +EXPORT_SYMBOL_GPL(spear_pcm_platform_unregister);
MODULE_AUTHOR("Rajeev Kumar rajeev-dlh.kumar@st.com"); MODULE_DESCRIPTION("SPEAr PCM DMA module"); MODULE_LICENSE("GPL"); -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..0ece110eb3d6 --- /dev/null +++ b/sound/soc/spear/spear_pcm.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/. + */ + +#ifndef __SPEAR_PCM_H__ +#define __SPEAR_PCM_H__ + +int spear_pcm_platform_register(struct device *dev); +void spear_pcm_platform_unregister(struct device *dev); + +#endif +
On 12/09/2013 09:24 PM, Stephen Warren wrote: [...]
-static int spear_soc_platform_probe(struct platform_device *pdev) +int spear_pcm_platform_register(struct device *dev) {
- return snd_dmaengine_pcm_register(&pdev->dev,
- return snd_dmaengine_pcm_register(dev,
Same conflict as with the ep93xx patch.
&spear_dmaengine_pcm_config, SND_DMAENGINE_PCM_FLAG_NO_DT | SND_DMAENGINE_PCM_FLAG_COMPAT);
} +EXPORT_SYMBOL_GPL(spear_pcm_platform_register);
From: Stephen Warren swarren@nvidia.com
spear_pcm_request_chan() is almost identical to dmaengine_pcm_compat_request_channel(), with the exception that the latter:
a) Assumes that the DAI DMA data is a struct snd_dmaengine_dai_dma_data pointer rather than some custom type.
b) dma_data->filter_data rather than dma_data should be passed to snd_dmaengine_pcm_request_channel() as the filter data.
Make minor changes to the SPEAr DAI drivers so that those two conditions are met. This allows removal of the custom .compat_request_channel().
Signed-off-by: Stephen Warren swarren@nvidia.com --- include/sound/spear_dma.h | 1 - sound/soc/spear/spdif_in.c | 10 +++++++--- sound/soc/spear/spdif_out.c | 10 +++++++--- sound/soc/spear/spear_pcm.c | 21 +++++++-------------- sound/soc/spear/spear_pcm.h | 4 +++- 5 files changed, 24 insertions(+), 22 deletions(-)
diff --git a/include/sound/spear_dma.h b/include/sound/spear_dma.h index 1b365bfdfb37..65aca51fe255 100644 --- a/include/sound/spear_dma.h +++ b/include/sound/spear_dma.h @@ -29,7 +29,6 @@ struct spear_dma_data { dma_addr_t addr; u32 max_burst; enum dma_slave_buswidth addr_width; - bool (*filter)(struct dma_chan *chan, void *slave); };
#endif /* SPEAR_DMA_H */ diff --git a/sound/soc/spear/spdif_in.c b/sound/soc/spear/spdif_in.c index c1cfd333d81c..8c003b769bf1 100644 --- a/sound/soc/spear/spdif_in.c +++ b/sound/soc/spear/spdif_in.c @@ -18,6 +18,7 @@ #include <linux/ioport.h> #include <linux/module.h> #include <linux/platform_device.h> +#include <sound/dmaengine_pcm.h> #include <sound/pcm.h> #include <sound/pcm_params.h> #include <sound/soc.h> @@ -38,6 +39,8 @@ struct spdif_in_dev { struct device *dev; void (*reset_perip)(void); int irq; + struct snd_dmaengine_dai_dma_data dma_params_rx; + struct snd_dmaengine_pcm_config config; };
static void spdif_in_configure(struct spdif_in_dev *host) @@ -54,7 +57,8 @@ static int spdif_in_dai_probe(struct snd_soc_dai *dai) { struct spdif_in_dev *host = snd_soc_dai_get_drvdata(dai);
- dai->capture_dma_data = &host->dma_params; + host->dma_params_rx.filter_data = &host->dma_params; + dai->capture_dma_data = &host->dma_params_rx;
return 0; } @@ -245,7 +249,6 @@ static int spdif_in_probe(struct platform_device *pdev) host->dma_params.addr = res_fifo->start; host->dma_params.max_burst = 16; host->dma_params.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; - host->dma_params.filter = pdata->filter; host->reset_perip = pdata->reset_perip;
host->dev = &pdev->dev; @@ -263,7 +266,8 @@ static int spdif_in_probe(struct platform_device *pdev) if (ret) return ret;
- return spear_pcm_platform_register(&pdev->dev); + return spear_pcm_platform_register(&pdev->dev, &host->config, + pdata->filter); }
static int spdif_in_remove(struct platform_device *pdev) diff --git a/sound/soc/spear/spdif_out.c b/sound/soc/spear/spdif_out.c index ad3d5d684f0c..e8aed8902141 100644 --- a/sound/soc/spear/spdif_out.c +++ b/sound/soc/spear/spdif_out.c @@ -18,6 +18,7 @@ #include <linux/ioport.h> #include <linux/module.h> #include <linux/platform_device.h> +#include <sound/dmaengine_pcm.h> #include <sound/soc.h> #include <sound/spear_dma.h> #include <sound/spear_spdif.h> @@ -36,6 +37,8 @@ struct spdif_out_dev { struct spdif_out_params saved_params; u32 running; void __iomem *io_base; + struct snd_dmaengine_dai_dma_data dma_params_tx; + struct snd_dmaengine_pcm_config config; };
static void spdif_out_configure(struct spdif_out_dev *host) @@ -245,7 +248,8 @@ static int spdif_soc_dai_probe(struct snd_soc_dai *dai) { struct spdif_out_dev *host = snd_soc_dai_get_drvdata(dai);
- dai->playback_dma_data = &host->dma_params; + host->dma_params_tx.filter_data = &host->dma_params; + dai->playback_dma_data = &host->dma_params_tx;
return snd_soc_add_dai_controls(dai, spdif_out_controls, ARRAY_SIZE(spdif_out_controls)); @@ -304,7 +308,6 @@ static int spdif_out_probe(struct platform_device *pdev) host->dma_params.addr = res->start + SPDIF_OUT_FIFO_DATA; host->dma_params.max_burst = 16; host->dma_params.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; - host->dma_params.filter = pdata->filter;
dev_set_drvdata(&pdev->dev, host);
@@ -313,7 +316,8 @@ static int spdif_out_probe(struct platform_device *pdev) if (ret) return ret;
- return spear_pcm_platform_register(&pdev->dev); + return spear_pcm_platform_register(&pdev->dev, &host->config, + pdata->filter); }
static int spdif_out_remove(struct platform_device *pdev) diff --git a/sound/soc/spear/spear_pcm.c b/sound/soc/spear/spear_pcm.c index e849f28e10c2..c7a9718d04c1 100644 --- a/sound/soc/spear/spear_pcm.c +++ b/sound/soc/spear/spear_pcm.c @@ -32,26 +32,19 @@ static const struct snd_pcm_hardware spear_pcm_hardware = { .fifo_size = 0, /* fifo size in bytes */ };
-static struct dma_chan *spear_pcm_request_chan(struct snd_soc_pcm_runtime *rtd, - struct snd_pcm_substream *substream) -{ - struct spear_dma_data *dma_data; - - dma_data = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); - - return snd_dmaengine_pcm_request_channel(dma_data->filter, dma_data); -} - static const struct snd_dmaengine_pcm_config spear_dmaengine_pcm_config = { .pcm_hardware = &spear_pcm_hardware, - .compat_request_channel = spear_pcm_request_chan, .prealloc_buffer_size = 16 * 1024, };
-int spear_pcm_platform_register(struct device *dev) +int spear_pcm_platform_register(struct device *dev, + struct snd_dmaengine_pcm_config *config, + bool (*filter)(struct dma_chan *chan, void *slave)) { - return snd_dmaengine_pcm_register(dev, - &spear_dmaengine_pcm_config, + *config = spear_dmaengine_pcm_config; + config->compat_filter_fn = filter; + + return snd_dmaengine_pcm_register(dev, config, SND_DMAENGINE_PCM_FLAG_NO_DT | SND_DMAENGINE_PCM_FLAG_COMPAT); } diff --git a/sound/soc/spear/spear_pcm.h b/sound/soc/spear/spear_pcm.h index 0ece110eb3d6..5fdce092090d 100644 --- a/sound/soc/spear/spear_pcm.h +++ b/sound/soc/spear/spear_pcm.h @@ -17,7 +17,9 @@ #ifndef __SPEAR_PCM_H__ #define __SPEAR_PCM_H__
-int spear_pcm_platform_register(struct device *dev); +int spear_pcm_platform_register(struct device *dev, + struct snd_dmaengine_pcm_config *config, + bool (*filter)(struct dma_chan *chan, void *slave)); void spear_pcm_platform_unregister(struct device *dev);
#endif
On 12/09/2013 09:24 PM, Stephen Warren wrote:
From: Stephen Warren swarren@nvidia.com
spear_pcm_request_chan() is almost identical to dmaengine_pcm_compat_request_channel(), with the exception that the latter:
a) Assumes that the DAI DMA data is a struct snd_dmaengine_dai_dma_data pointer rather than some custom type.
b) dma_data->filter_data rather than dma_data should be passed to snd_dmaengine_pcm_request_channel() as the filter data.
Make minor changes to the SPEAr DAI drivers so that those two conditions are met. This allows removal of the custom .compat_request_channel().
Signed-off-by: Stephen Warren swarren@nvidia.com
include/sound/spear_dma.h | 1 - sound/soc/spear/spdif_in.c | 10 +++++++--- sound/soc/spear/spdif_out.c | 10 +++++++--- sound/soc/spear/spear_pcm.c | 21 +++++++-------------- sound/soc/spear/spear_pcm.h | 4 +++- 5 files changed, 24 insertions(+), 22 deletions(-)
diff --git a/include/sound/spear_dma.h b/include/sound/spear_dma.h index 1b365bfdfb37..65aca51fe255 100644 --- a/include/sound/spear_dma.h +++ b/include/sound/spear_dma.h @@ -29,7 +29,6 @@ struct spear_dma_data { dma_addr_t addr; u32 max_burst; enum dma_slave_buswidth addr_width;
- bool (*filter)(struct dma_chan *chan, void *slave);
};
Hm, that spear_dma_data struct looks pretty much like snd_dmaengine_dai_dma_data. It's a bit hard to say how it is used exactly since the receiver of that struct doesn't seem to be upstream. Rajeev, how is this used? The data in spear_dma_data looks like it should be passed to the DMA driver via dmaengine_slave_config() rather than while requesting the channel.
- Lars
On 12/10/2013 2:47 AM, Lars-Peter Clausen wrote:
On 12/09/2013 09:24 PM, Stephen Warren wrote:
From: Stephen Warrenswarren@nvidia.com
spear_pcm_request_chan() is almost identical to dmaengine_pcm_compat_request_channel(), with the exception that the latter:
a) Assumes that the DAI DMA data is a struct snd_dmaengine_dai_dma_data pointer rather than some custom type.
b) dma_data->filter_data rather than dma_data should be passed to snd_dmaengine_pcm_request_channel() as the filter data.
Make minor changes to the SPEAr DAI drivers so that those two conditions are met. This allows removal of the custom .compat_request_channel().
Signed-off-by: Stephen Warrenswarren@nvidia.com
include/sound/spear_dma.h | 1 - sound/soc/spear/spdif_in.c | 10 +++++++--- sound/soc/spear/spdif_out.c | 10 +++++++--- sound/soc/spear/spear_pcm.c | 21 +++++++-------------- sound/soc/spear/spear_pcm.h | 4 +++- 5 files changed, 24 insertions(+), 22 deletions(-)
diff --git a/include/sound/spear_dma.h b/include/sound/spear_dma.h index 1b365bfdfb37..65aca51fe255 100644 --- a/include/sound/spear_dma.h +++ b/include/sound/spear_dma.h @@ -29,7 +29,6 @@ struct spear_dma_data { dma_addr_t addr; u32 max_burst; enum dma_slave_buswidth addr_width;
- bool (*filter)(struct dma_chan *chan, void *slave); };
Hm, that spear_dma_data struct looks pretty much like snd_dmaengine_dai_dma_data. It's a bit hard to say how it is used exactly since the receiver of that struct doesn't seem to be upstream. Rajeev, how is this used? The data in spear_dma_data looks like it should be passed to the DMA driver via dmaengine_slave_config() rather than while requesting the channel.
- Lars
.
The structure spear_dma_data is used to initialize dma parameters received from platform data which is required for dma slave configuration.
~Rajeev
On 12/10/2013 07:30 AM, Rajeev kumar wrote:
On 12/10/2013 2:47 AM, Lars-Peter Clausen wrote:
On 12/09/2013 09:24 PM, Stephen Warren wrote:
From: Stephen Warrenswarren@nvidia.com
spear_pcm_request_chan() is almost identical to dmaengine_pcm_compat_request_channel(), with the exception that the latter:
a) Assumes that the DAI DMA data is a struct snd_dmaengine_dai_dma_data pointer rather than some custom type.
b) dma_data->filter_data rather than dma_data should be passed to snd_dmaengine_pcm_request_channel() as the filter data.
Make minor changes to the SPEAr DAI drivers so that those two conditions are met. This allows removal of the custom .compat_request_channel().
Signed-off-by: Stephen Warrenswarren@nvidia.com
include/sound/spear_dma.h | 1 - sound/soc/spear/spdif_in.c | 10 +++++++--- sound/soc/spear/spdif_out.c | 10 +++++++--- sound/soc/spear/spear_pcm.c | 21 +++++++-------------- sound/soc/spear/spear_pcm.h | 4 +++- 5 files changed, 24 insertions(+), 22 deletions(-)
diff --git a/include/sound/spear_dma.h b/include/sound/spear_dma.h index 1b365bfdfb37..65aca51fe255 100644 --- a/include/sound/spear_dma.h +++ b/include/sound/spear_dma.h @@ -29,7 +29,6 @@ struct spear_dma_data { dma_addr_t addr; u32 max_burst; enum dma_slave_buswidth addr_width;
- bool (*filter)(struct dma_chan *chan, void *slave); };
Hm, that spear_dma_data struct looks pretty much like snd_dmaengine_dai_dma_data. It's a bit hard to say how it is used exactly since the receiver of that struct doesn't seem to be upstream. Rajeev, how is this used? The data in spear_dma_data looks like it should be passed to the DMA driver via dmaengine_slave_config() rather than while requesting the channel.
- Lars
.
The structure spear_dma_data is used to initialize dma parameters received from platform data which is required for dma slave configuration.
Those parameters look like they should be configured using dmaengine_slave_config(). And not by passing them to the filter function.
- Lars
On 12/10/2013 1:15 PM, Lars-Peter Clausen wrote:
On 12/10/2013 07:30 AM, Rajeev kumar wrote:
On 12/10/2013 2:47 AM, Lars-Peter Clausen wrote:
On 12/09/2013 09:24 PM, Stephen Warren wrote:
From: Stephen Warrenswarren@nvidia.com
spear_pcm_request_chan() is almost identical to dmaengine_pcm_compat_request_channel(), with the exception that the latter:
a) Assumes that the DAI DMA data is a struct snd_dmaengine_dai_dma_data pointer rather than some custom type.
b) dma_data->filter_data rather than dma_data should be passed to snd_dmaengine_pcm_request_channel() as the filter data.
Make minor changes to the SPEAr DAI drivers so that those two conditions are met. This allows removal of the custom .compat_request_channel().
Signed-off-by: Stephen Warrenswarren@nvidia.com
include/sound/spear_dma.h | 1 - sound/soc/spear/spdif_in.c | 10 +++++++--- sound/soc/spear/spdif_out.c | 10 +++++++--- sound/soc/spear/spear_pcm.c | 21 +++++++-------------- sound/soc/spear/spear_pcm.h | 4 +++- 5 files changed, 24 insertions(+), 22 deletions(-)
diff --git a/include/sound/spear_dma.h b/include/sound/spear_dma.h index 1b365bfdfb37..65aca51fe255 100644 --- a/include/sound/spear_dma.h +++ b/include/sound/spear_dma.h @@ -29,7 +29,6 @@ struct spear_dma_data { dma_addr_t addr; u32 max_burst; enum dma_slave_buswidth addr_width;
- bool (*filter)(struct dma_chan *chan, void *slave); };
Hm, that spear_dma_data struct looks pretty much like snd_dmaengine_dai_dma_data. It's a bit hard to say how it is used exactly since the receiver of that struct doesn't seem to be upstream. Rajeev, how is this used? The data in spear_dma_data looks like it should be passed to the DMA driver via dmaengine_slave_config() rather than while requesting the channel.
- Lars
.
The structure spear_dma_data is used to initialize dma parameters received from platform data which is required for dma slave configuration.
Those parameters look like they should be configured using dmaengine_slave_config(). And not by passing them to the filter function.
- Lars
.
Yes these parameter will be configured through dmaengine_slave_config().
~Rajeev
On 12/10/2013 09:53 AM, Rajeev kumar wrote:
On 12/10/2013 1:15 PM, Lars-Peter Clausen wrote:
On 12/10/2013 07:30 AM, Rajeev kumar wrote:
On 12/10/2013 2:47 AM, Lars-Peter Clausen wrote:
On 12/09/2013 09:24 PM, Stephen Warren wrote:
From: Stephen Warrenswarren@nvidia.com
spear_pcm_request_chan() is almost identical to dmaengine_pcm_compat_request_channel(), with the exception that the latter:
a) Assumes that the DAI DMA data is a struct snd_dmaengine_dai_dma_data pointer rather than some custom type.
b) dma_data->filter_data rather than dma_data should be passed to snd_dmaengine_pcm_request_channel() as the filter data.
Make minor changes to the SPEAr DAI drivers so that those two conditions are met. This allows removal of the custom .compat_request_channel().
Signed-off-by: Stephen Warrenswarren@nvidia.com
include/sound/spear_dma.h | 1 - sound/soc/spear/spdif_in.c | 10 +++++++--- sound/soc/spear/spdif_out.c | 10 +++++++--- sound/soc/spear/spear_pcm.c | 21 +++++++-------------- sound/soc/spear/spear_pcm.h | 4 +++- 5 files changed, 24 insertions(+), 22 deletions(-)
diff --git a/include/sound/spear_dma.h b/include/sound/spear_dma.h index 1b365bfdfb37..65aca51fe255 100644 --- a/include/sound/spear_dma.h +++ b/include/sound/spear_dma.h @@ -29,7 +29,6 @@ struct spear_dma_data { dma_addr_t addr; u32 max_burst; enum dma_slave_buswidth addr_width;
- bool (*filter)(struct dma_chan *chan, void *slave); };
Hm, that spear_dma_data struct looks pretty much like snd_dmaengine_dai_dma_data. It's a bit hard to say how it is used exactly since the receiver of that struct doesn't seem to be upstream. Rajeev, how is this used? The data in spear_dma_data looks like it should be passed to the DMA driver via dmaengine_slave_config() rather than while requesting the channel.
- Lars
.
The structure spear_dma_data is used to initialize dma parameters received from platform data which is required for dma slave configuration.
Those parameters look like they should be configured using dmaengine_slave_config(). And not by passing them to the filter function.
- Lars
.
Yes these parameter will be configured through dmaengine_slave_config().
Ok, but this happens in the filter callback? Or is this piece just missing from the upstream driver at the moment? Do you think the code can be rewritten to use the generic snd_dmaengine_dai_dma_data struct?
Thanks, - Lars
On 12/10/2013 2:30 PM, Lars-Peter Clausen wrote:
On 12/10/2013 09:53 AM, Rajeev kumar wrote:
On 12/10/2013 1:15 PM, Lars-Peter Clausen wrote:
On 12/10/2013 07:30 AM, Rajeev kumar wrote:
On 12/10/2013 2:47 AM, Lars-Peter Clausen wrote:
On 12/09/2013 09:24 PM, Stephen Warren wrote:
From: Stephen Warrenswarren@nvidia.com
spear_pcm_request_chan() is almost identical to dmaengine_pcm_compat_request_channel(), with the exception that the latter:
a) Assumes that the DAI DMA data is a struct snd_dmaengine_dai_dma_data pointer rather than some custom type.
b) dma_data->filter_data rather than dma_data should be passed to snd_dmaengine_pcm_request_channel() as the filter data.
Make minor changes to the SPEAr DAI drivers so that those two conditions are met. This allows removal of the custom .compat_request_channel().
Signed-off-by: Stephen Warrenswarren@nvidia.com
include/sound/spear_dma.h | 1 - sound/soc/spear/spdif_in.c | 10 +++++++--- sound/soc/spear/spdif_out.c | 10 +++++++--- sound/soc/spear/spear_pcm.c | 21 +++++++-------------- sound/soc/spear/spear_pcm.h | 4 +++- 5 files changed, 24 insertions(+), 22 deletions(-)
diff --git a/include/sound/spear_dma.h b/include/sound/spear_dma.h index 1b365bfdfb37..65aca51fe255 100644 --- a/include/sound/spear_dma.h +++ b/include/sound/spear_dma.h @@ -29,7 +29,6 @@ struct spear_dma_data { dma_addr_t addr; u32 max_burst; enum dma_slave_buswidth addr_width;
- bool (*filter)(struct dma_chan *chan, void *slave); };
Hm, that spear_dma_data struct looks pretty much like snd_dmaengine_dai_dma_data. It's a bit hard to say how it is used exactly since the receiver of that struct doesn't seem to be upstream. Rajeev, how is this used? The data in spear_dma_data looks like it should be passed to the DMA driver via dmaengine_slave_config() rather than while requesting the channel.
- Lars
.
The structure spear_dma_data is used to initialize dma parameters received from platform data which is required for dma slave configuration.
Those parameters look like they should be configured using dmaengine_slave_config(). And not by passing them to the filter function.
- Lars
.
Yes these parameter will be configured through dmaengine_slave_config().
Ok, but this happens in the filter callback? Or is this piece just missing from the upstream driver at the moment? Do you think the code can be rewritten to use the generic snd_dmaengine_dai_dma_data struct?
Passing complete spear_dma_data is wrong in the filter callback, This needs to be modified. I will circulate a patch for this. The platform code for this also needs to be upstreamed.
Regards Rajeev
Thanks,
- Lars
.
From: Stephen Warren swarren@nvidia.com
struct snd_dmaengine_pcm_config's compat_request_channel field is no longer set anywhere. Remove it, and the code that implements it.
Signed-off-by: Stephen Warren swarren@nvidia.com --- Don't apply this until the last compat_request_channel usage is actually removed from the ux500 driver.
include/sound/dmaengine_pcm.h | 3 --- sound/soc/soc-generic-dmaengine-pcm.c | 3 --- 2 files changed, 6 deletions(-)
diff --git a/include/sound/dmaengine_pcm.h b/include/sound/dmaengine_pcm.h index eb73a3a39ec2..72463afef52b 100644 --- a/include/sound/dmaengine_pcm.h +++ b/include/sound/dmaengine_pcm.h @@ -130,9 +130,6 @@ struct snd_dmaengine_pcm_config { int (*prepare_slave_config)(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, struct dma_slave_config *slave_config); - struct dma_chan *(*compat_request_channel)( - struct snd_soc_pcm_runtime *rtd, - struct snd_pcm_substream *substream); dma_filter_fn compat_filter_fn; struct device *dma_dev; const char *chan_names[SNDRV_PCM_STREAM_LAST + 1]; diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c index 5b70c556fba3..6ce85371d2f7 100644 --- a/sound/soc/soc-generic-dmaengine-pcm.c +++ b/sound/soc/soc-generic-dmaengine-pcm.c @@ -180,9 +180,6 @@ static struct dma_chan *dmaengine_pcm_compat_request_channel( if ((pcm->flags & SND_DMAENGINE_PCM_FLAG_HALF_DUPLEX) && pcm->chan[0]) return pcm->chan[0];
- if (pcm->config->compat_request_channel) - return pcm->config->compat_request_channel(rtd, substream); - return snd_dmaengine_pcm_request_channel(pcm->config->compat_filter_fn, dma_data->filter_data); }
On 12/09/2013 09:24 PM, Stephen Warren wrote:
From: Stephen Warren swarren@nvidia.com
This series removes almost all users of the ASoC dmaengine compat_request_channel() function, and its implementation.
The ux500 driver still uses compat_request_channel. I believe that Lars-Peter is working on removing its use from that driver. That patch or series would need to be inserted between 4/5 and 5/5 in this series.
Lee is working on it, adding him to Cc.
This series is based on ASoC's topic/dma branch.
I have only compile-tested these patches.
Stephen Warren (5): ASoC: ep93xx: get rid of ep93xx-pcm-audio struct device ASoC: ep93xx: remove custom DMA alloc compat function ASoC: SPEAr: get rid of spear-pcm-audio struct device ASoC: SPEAr: remove custom DMA alloc compat function ASoC: dmaengine: remove compat_request_channel
include/sound/dmaengine_pcm.h | 3 --- include/sound/spear_dma.h | 1 - sound/soc/cirrus/edb93xx.c | 2 +- sound/soc/cirrus/ep93xx-ac97.c | 21 ++++++++++++++++-- sound/soc/cirrus/ep93xx-i2s.c | 23 +++++++++++++++++-- sound/soc/cirrus/ep93xx-pcm.c | 39 +++++++------------------------- sound/soc/cirrus/ep93xx-pcm.h | 24 ++++++++++++++++++++ sound/soc/cirrus/simone.c | 2 +- sound/soc/cirrus/snappercl15.c | 2 +- sound/soc/soc-generic-dmaengine-pcm.c | 3 --- sound/soc/spear/spdif_in.c | 25 +++++++++++++++++---- sound/soc/spear/spdif_out.c | 26 ++++++++++++++++++---- sound/soc/spear/spear_pcm.c | 42 ++++++++++------------------------- sound/soc/spear/spear_pcm.h | 26 ++++++++++++++++++++++ 14 files changed, 156 insertions(+), 83 deletions(-) create mode 100644 sound/soc/cirrus/ep93xx-pcm.h create mode 100644 sound/soc/spear/spear_pcm.h
On Mon, 09 Dec 2013, Lars-Peter Clausen wrote:
On 12/09/2013 09:24 PM, Stephen Warren wrote:
From: Stephen Warren swarren@nvidia.com
This series removes almost all users of the ASoC dmaengine compat_request_channel() function, and its implementation.
The ux500 driver still uses compat_request_channel. I believe that Lars-Peter is working on removing its use from that driver. That patch or series would need to be inserted between 4/5 and 5/5 in this series.
Lee is working on it, adding him to Cc.
Yes, please continue to leave this with me.
There is much to do with this driver. I just need to find some time.
This series is based on ASoC's topic/dma branch.
I have only compile-tested these patches.
Stephen Warren (5): ASoC: ep93xx: get rid of ep93xx-pcm-audio struct device ASoC: ep93xx: remove custom DMA alloc compat function ASoC: SPEAr: get rid of spear-pcm-audio struct device ASoC: SPEAr: remove custom DMA alloc compat function ASoC: dmaengine: remove compat_request_channel
include/sound/dmaengine_pcm.h | 3 --- include/sound/spear_dma.h | 1 - sound/soc/cirrus/edb93xx.c | 2 +- sound/soc/cirrus/ep93xx-ac97.c | 21 ++++++++++++++++-- sound/soc/cirrus/ep93xx-i2s.c | 23 +++++++++++++++++-- sound/soc/cirrus/ep93xx-pcm.c | 39 +++++++------------------------- sound/soc/cirrus/ep93xx-pcm.h | 24 ++++++++++++++++++++ sound/soc/cirrus/simone.c | 2 +- sound/soc/cirrus/snappercl15.c | 2 +- sound/soc/soc-generic-dmaengine-pcm.c | 3 --- sound/soc/spear/spdif_in.c | 25 +++++++++++++++++---- sound/soc/spear/spdif_out.c | 26 ++++++++++++++++++---- sound/soc/spear/spear_pcm.c | 42 ++++++++++------------------------- sound/soc/spear/spear_pcm.h | 26 ++++++++++++++++++++++ 14 files changed, 156 insertions(+), 83 deletions(-) create mode 100644 sound/soc/cirrus/ep93xx-pcm.h create mode 100644 sound/soc/spear/spear_pcm.h
participants (5)
-
Lars-Peter Clausen
-
Lee Jones
-
Mark Brown
-
Rajeev kumar
-
Stephen Warren