* [PATCH 1/8] ASoC: generic-dmaengine-pcm: Add support for half-duplex
@ 2013-04-20 17:29 Lars-Peter Clausen
2013-04-20 17:29 ` [PATCH 2/8] ASoC: mxs-pcm: Set SNDRV_PCM_INFO_HALF_DUPLEX Lars-Peter Clausen
` (8 more replies)
0 siblings, 9 replies; 20+ messages in thread
From: Lars-Peter Clausen @ 2013-04-20 17:29 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood
Cc: alsa-devel, Rajeev Kumar, Ryan Mallon, Hartley Sweeten,
Lars-Peter Clausen, Shawn Guo
Some platforms which are half-duplex share the same DMA channel between the
playback and capture stream. Add support for this to the generic dmaengine PCM
driver.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
include/sound/dmaengine_pcm.h | 5 ++++
sound/soc/soc-generic-dmaengine-pcm.c | 43 ++++++++++++++++++++++++-----------
2 files changed, 35 insertions(+), 13 deletions(-)
diff --git a/include/sound/dmaengine_pcm.h b/include/sound/dmaengine_pcm.h
index b1d1150..f11c35c 100644
--- a/include/sound/dmaengine_pcm.h
+++ b/include/sound/dmaengine_pcm.h
@@ -91,6 +91,11 @@ void snd_dmaengine_pcm_set_config_from_dai_data(
* bytes that are still left to transfer.
*/
#define SND_DMAENGINE_PCM_FLAG_NO_RESIDUE BIT(2)
+/*
+ * The PCM is half duplex and the DMA channel is shared between capture and
+ * playback.
+ */
+#define SND_DMAENGINE_PCM_FLAG_HALF_DUPLEX BIT(3)
/**
* struct snd_dmaengine_pcm_config - Configuration data for dmaengine based PCM
diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c
index ae0c37e..5fd5ed4 100644
--- a/sound/soc/soc-generic-dmaengine-pcm.c
+++ b/sound/soc/soc-generic-dmaengine-pcm.c
@@ -29,7 +29,7 @@ struct dmaengine_pcm {
struct dma_chan *chan[SNDRV_PCM_STREAM_CAPTURE + 1];
const struct snd_dmaengine_pcm_config *config;
struct snd_soc_platform platform;
- bool compat;
+ unsigned int flags;
};
static struct dmaengine_pcm *soc_platform_to_pcm(struct snd_soc_platform *p)
@@ -128,6 +128,9 @@ static struct dma_chan *dmaengine_pcm_compat_request_channel(
{
struct dmaengine_pcm *pcm = soc_platform_to_pcm(rtd->platform);
+ 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);
@@ -148,7 +151,7 @@ static int dmaengine_pcm_new(struct snd_soc_pcm_runtime *rtd)
if (!substream)
continue;
- if (!pcm->chan[i] && pcm->compat) {
+ if (!pcm->chan[i] && (pcm->flags & SND_DMAENGINE_PCM_FLAG_COMPAT)) {
pcm->chan[i] = dmaengine_pcm_compat_request_channel(rtd,
substream);
}
@@ -215,6 +218,25 @@ static const char * const dmaengine_pcm_dma_channel_names[] = {
[SNDRV_PCM_STREAM_CAPTURE] = "rx",
};
+static void dmaengine_pcm_request_chan_of(struct dmaengine_pcm *pcm,
+ struct device_node *of_node)
+{
+ unsigned int i;
+
+ if ((pcm->flags & SND_DMAENGINE_PCM_FLAG_NO_DT) || !of_node)
+ return;
+
+ if (pcm->flags & SND_DMAENGINE_PCM_FLAG_HALF_DUPLEX) {
+ pcm->chan[0] = of_dma_request_slave_channel(of_node, "tx_rx");
+ pcm->chan[1] = pcm->chan[0];
+ } else {
+ for (i = SNDRV_PCM_STREAM_PLAYBACK; i <= SNDRV_PCM_STREAM_CAPTURE; i++) {
+ pcm->chan[i] = of_dma_request_slave_channel(of_node,
+ dmaengine_pcm_dma_channel_names[i]);
+ }
+ }
+}
+
/**
* snd_dmaengine_pcm_register - Register a dmaengine based PCM device
* @dev: The parent device for the PCM device
@@ -225,23 +247,15 @@ int snd_dmaengine_pcm_register(struct device *dev,
const struct snd_dmaengine_pcm_config *config, unsigned int flags)
{
struct dmaengine_pcm *pcm;
- unsigned int i;
pcm = kzalloc(sizeof(*pcm), GFP_KERNEL);
if (!pcm)
return -ENOMEM;
pcm->config = config;
+ pcm->flags = flags;
- if (flags & SND_DMAENGINE_PCM_FLAG_COMPAT)
- pcm->compat = true;
-
- if (!(flags & SND_DMAENGINE_PCM_FLAG_NO_DT) && dev->of_node) {
- for (i = SNDRV_PCM_STREAM_PLAYBACK; i <= SNDRV_PCM_STREAM_CAPTURE; i++) {
- pcm->chan[i] = of_dma_request_slave_channel(dev->of_node,
- dmaengine_pcm_dma_channel_names[i]);
- }
- }
+ dmaengine_pcm_request_chan_of(pcm, dev->of_node);
if (flags & SND_DMAENGINE_PCM_FLAG_NO_RESIDUE)
return snd_soc_add_platform(dev, &pcm->platform,
@@ -272,8 +286,11 @@ void snd_dmaengine_pcm_unregister(struct device *dev)
pcm = soc_platform_to_pcm(platform);
for (i = SNDRV_PCM_STREAM_PLAYBACK; i <= SNDRV_PCM_STREAM_CAPTURE; i++) {
- if (pcm->chan[i])
+ if (pcm->chan[i]) {
dma_release_channel(pcm->chan[i]);
+ if (pcm->flags & SND_DMAENGINE_PCM_FLAG_HALF_DUPLEX)
+ break;
+ }
}
snd_soc_remove_platform(platform);
--
1.8.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 2/8] ASoC: mxs-pcm: Set SNDRV_PCM_INFO_HALF_DUPLEX
2013-04-20 17:29 [PATCH 1/8] ASoC: generic-dmaengine-pcm: Add support for half-duplex Lars-Peter Clausen
@ 2013-04-20 17:29 ` Lars-Peter Clausen
2013-04-22 10:28 ` Mark Brown
2013-04-20 17:29 ` [PATCH 3/8] ASoC: mxs: Setup dma data in DAI probe Lars-Peter Clausen
` (7 subsequent siblings)
8 siblings, 1 reply; 20+ messages in thread
From: Lars-Peter Clausen @ 2013-04-20 17:29 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood
Cc: alsa-devel, Rajeev Kumar, Ryan Mallon, Hartley Sweeten,
Lars-Peter Clausen, Shawn Guo
The MXS SAIF is only half-duplex so set the SNDRV_PCM_INFO_HALF_DUPLEX flag for
the PCM in order to prevent playback and capture from running at the same time.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
sound/soc/mxs/mxs-pcm.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sound/soc/mxs/mxs-pcm.c b/sound/soc/mxs/mxs-pcm.c
index 7bceb16..907cdb1 100644
--- a/sound/soc/mxs/mxs-pcm.c
+++ b/sound/soc/mxs/mxs-pcm.c
@@ -43,7 +43,8 @@ static struct snd_pcm_hardware snd_mxs_hardware = {
SNDRV_PCM_INFO_MMAP_VALID |
SNDRV_PCM_INFO_PAUSE |
SNDRV_PCM_INFO_RESUME |
- SNDRV_PCM_INFO_INTERLEAVED,
+ SNDRV_PCM_INFO_INTERLEAVED |
+ SNDRV_PCM_INFO_HALF_DUPLEX,
.formats = SNDRV_PCM_FMTBIT_S16_LE |
SNDRV_PCM_FMTBIT_S20_3LE |
SNDRV_PCM_FMTBIT_S24_LE,
--
1.8.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 3/8] ASoC: mxs: Setup dma data in DAI probe
2013-04-20 17:29 [PATCH 1/8] ASoC: generic-dmaengine-pcm: Add support for half-duplex Lars-Peter Clausen
2013-04-20 17:29 ` [PATCH 2/8] ASoC: mxs-pcm: Set SNDRV_PCM_INFO_HALF_DUPLEX Lars-Peter Clausen
@ 2013-04-20 17:29 ` Lars-Peter Clausen
2013-04-22 10:28 ` Mark Brown
2013-04-20 17:29 ` [PATCH 4/8] ASoC: mxs: Use generic dmaengine PCM Lars-Peter Clausen
` (6 subsequent siblings)
8 siblings, 1 reply; 20+ messages in thread
From: Lars-Peter Clausen @ 2013-04-20 17:29 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood
Cc: alsa-devel, Rajeev Kumar, Ryan Mallon, Hartley Sweeten,
Lars-Peter Clausen, Shawn Guo
This allows us to access the DAI DMA data when we create the PCM. We'll use
this when converting mxs to generic DMA engine PCM driver.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
sound/soc/mxs/mxs-saif.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sound/soc/mxs/mxs-saif.c b/sound/soc/mxs/mxs-saif.c
index f13bd87..d796a39 100644
--- a/sound/soc/mxs/mxs-saif.c
+++ b/sound/soc/mxs/mxs-saif.c
@@ -369,7 +369,6 @@ static int mxs_saif_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *cpu_dai)
{
struct mxs_saif *saif = snd_soc_dai_get_drvdata(cpu_dai);
- snd_soc_dai_set_dma_data(cpu_dai, substream, &saif->dma_param);
/* clear error status to 0 for each re-open */
saif->fifo_underrun = 0;
@@ -605,6 +604,8 @@ static int mxs_saif_dai_probe(struct snd_soc_dai *dai)
struct mxs_saif *saif = dev_get_drvdata(dai->dev);
snd_soc_dai_set_drvdata(dai, saif);
+ dai->playback_dma_data = &saif->dma_param;
+ dai->capture_dma_data = &saif->dma_param;
return 0;
}
--
1.8.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 4/8] ASoC: mxs: Use generic dmaengine PCM
2013-04-20 17:29 [PATCH 1/8] ASoC: generic-dmaengine-pcm: Add support for half-duplex Lars-Peter Clausen
2013-04-20 17:29 ` [PATCH 2/8] ASoC: mxs-pcm: Set SNDRV_PCM_INFO_HALF_DUPLEX Lars-Peter Clausen
2013-04-20 17:29 ` [PATCH 3/8] ASoC: mxs: Setup dma data in DAI probe Lars-Peter Clausen
@ 2013-04-20 17:29 ` Lars-Peter Clausen
2013-04-22 10:29 ` Mark Brown
2013-04-20 17:29 ` [PATCH 5/8] ASoC: ep93xx: Setup dma data in DAI probe Lars-Peter Clausen
` (5 subsequent siblings)
8 siblings, 1 reply; 20+ messages in thread
From: Lars-Peter Clausen @ 2013-04-20 17:29 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood
Cc: alsa-devel, Rajeev Kumar, Ryan Mallon, Hartley Sweeten,
Lars-Peter Clausen, Shawn Guo
Use the generic dmaengine PCM driver instead of a custom implementation.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
Changes since v1:
Set SND_DMAENGINE_PCM_FLAG_HALF_DUPLEX to reflect that the DMA channel is
shared between playback and capture
---
sound/soc/mxs/Kconfig | 2 +-
sound/soc/mxs/mxs-pcm.c | 136 ++++--------------------------------------------
2 files changed, 12 insertions(+), 126 deletions(-)
diff --git a/sound/soc/mxs/Kconfig b/sound/soc/mxs/Kconfig
index b6fa776..78d321c 100644
--- a/sound/soc/mxs/Kconfig
+++ b/sound/soc/mxs/Kconfig
@@ -1,7 +1,7 @@
menuconfig SND_MXS_SOC
tristate "SoC Audio for Freescale MXS CPUs"
depends on ARCH_MXS
- select SND_SOC_DMAENGINE_PCM
+ select SND_SOC_GENERIC_DMAENGINE_PCM
help
Say Y or M if you want to add support for codecs attached to
the MXS SAIF interface.
diff --git a/sound/soc/mxs/mxs-pcm.c b/sound/soc/mxs/mxs-pcm.c
index 907cdb1..b41fffc 100644
--- a/sound/soc/mxs/mxs-pcm.c
+++ b/sound/soc/mxs/mxs-pcm.c
@@ -18,27 +18,18 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#include <linux/clk.h>
-#include <linux/delay.h>
#include <linux/device.h>
-#include <linux/dma-mapping.h>
#include <linux/init.h>
-#include <linux/interrupt.h>
#include <linux/module.h>
-#include <linux/platform_device.h>
-#include <linux/slab.h>
-#include <linux/dmaengine.h>
#include <sound/core.h>
-#include <sound/initval.h>
#include <sound/pcm.h>
-#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <sound/dmaengine_pcm.h>
#include "mxs-pcm.h"
-static struct snd_pcm_hardware snd_mxs_hardware = {
+static const struct snd_pcm_hardware snd_mxs_hardware = {
.info = SNDRV_PCM_INFO_MMAP |
SNDRV_PCM_INFO_MMAP_VALID |
SNDRV_PCM_INFO_PAUSE |
@@ -56,7 +47,6 @@ static struct snd_pcm_hardware snd_mxs_hardware = {
.periods_max = 52,
.buffer_bytes_max = 64 * 1024,
.fifo_size = 32,
-
};
static bool filter(struct dma_chan *chan, void *param)
@@ -74,129 +64,25 @@ static bool filter(struct dma_chan *chan, void *param)
return true;
}
-static int snd_mxs_pcm_hw_params(struct snd_pcm_substream *substream,
- struct snd_pcm_hw_params *params)
-{
- snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer);
-
- return 0;
-}
-
-static int snd_mxs_open(struct snd_pcm_substream *substream)
-{
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
-
- snd_soc_set_runtime_hwparams(substream, &snd_mxs_hardware);
-
- return snd_dmaengine_pcm_open_request_chan(substream, filter,
- snd_soc_dai_get_dma_data(rtd->cpu_dai, substream));
-}
-
-static int snd_mxs_pcm_mmap(struct snd_pcm_substream *substream,
- struct vm_area_struct *vma)
-{
- struct snd_pcm_runtime *runtime = substream->runtime;
-
- return dma_mmap_writecombine(substream->pcm->card->dev, vma,
- runtime->dma_area,
- runtime->dma_addr,
- runtime->dma_bytes);
-}
-
-static struct snd_pcm_ops mxs_pcm_ops = {
- .open = snd_mxs_open,
- .close = snd_dmaengine_pcm_close_release_chan,
- .ioctl = snd_pcm_lib_ioctl,
- .hw_params = snd_mxs_pcm_hw_params,
- .trigger = snd_dmaengine_pcm_trigger,
- .pointer = snd_dmaengine_pcm_pointer_no_residue,
- .mmap = snd_mxs_pcm_mmap,
-};
-
-static int mxs_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream)
-{
- struct snd_pcm_substream *substream = pcm->streams[stream].substream;
- struct snd_dma_buffer *buf = &substream->dma_buffer;
- size_t size = snd_mxs_hardware.buffer_bytes_max;
-
- buf->dev.type = SNDRV_DMA_TYPE_DEV;
- buf->dev.dev = pcm->card->dev;
- buf->private_data = NULL;
- buf->area = dma_alloc_writecombine(pcm->card->dev, size,
- &buf->addr, GFP_KERNEL);
- if (!buf->area)
- return -ENOMEM;
- buf->bytes = size;
-
- return 0;
-}
-
-static u64 mxs_pcm_dmamask = DMA_BIT_MASK(32);
-static int mxs_pcm_new(struct snd_soc_pcm_runtime *rtd)
-{
- struct snd_card *card = rtd->card->snd_card;
- struct snd_pcm *pcm = rtd->pcm;
- int ret = 0;
-
- if (!card->dev->dma_mask)
- card->dev->dma_mask = &mxs_pcm_dmamask;
- if (!card->dev->coherent_dma_mask)
- card->dev->coherent_dma_mask = DMA_BIT_MASK(32);
-
- if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
- ret = mxs_pcm_preallocate_dma_buffer(pcm,
- SNDRV_PCM_STREAM_PLAYBACK);
- if (ret)
- goto out;
- }
-
- if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
- ret = mxs_pcm_preallocate_dma_buffer(pcm,
- SNDRV_PCM_STREAM_CAPTURE);
- if (ret)
- goto out;
- }
-
-out:
- return ret;
-}
-
-static void mxs_pcm_free(struct snd_pcm *pcm)
-{
- struct snd_pcm_substream *substream;
- struct snd_dma_buffer *buf;
- int stream;
-
- for (stream = 0; stream < 2; stream++) {
- substream = pcm->streams[stream].substream;
- if (!substream)
- continue;
-
- buf = &substream->dma_buffer;
- if (!buf->area)
- continue;
-
- dma_free_writecombine(pcm->card->dev, buf->bytes,
- buf->area, buf->addr);
- buf->area = NULL;
- }
-}
-
-static struct snd_soc_platform_driver mxs_soc_platform = {
- .ops = &mxs_pcm_ops,
- .pcm_new = mxs_pcm_new,
- .pcm_free = mxs_pcm_free,
+static const struct snd_dmaengine_pcm_config mxs_dmaengine_pcm_config = {
+ .pcm_hardware = &snd_mxs_hardware,
+ .compat_filter_fn = filter,
+ .prealloc_buffer_size = 64 * 1024,
};
int mxs_pcm_platform_register(struct device *dev)
{
- return snd_soc_register_platform(dev, &mxs_soc_platform);
+ return snd_dmaengine_pcm_register(dev, &mxs_dmaengine_pcm_config,
+ SND_DMAENGINE_PCM_FLAG_NO_RESIDUE |
+ SND_DMAENGINE_PCM_FLAG_NO_DT |
+ SND_DMAENGINE_PCM_FLAG_COMPAT |
+ SND_DMAENGINE_PCM_FLAG_HALF_DUPLEX);
}
EXPORT_SYMBOL_GPL(mxs_pcm_platform_register);
void mxs_pcm_platform_unregister(struct device *dev)
{
- snd_soc_unregister_platform(dev);
+ snd_dmaengine_pcm_unregister(dev);
}
EXPORT_SYMBOL_GPL(mxs_pcm_platform_unregister);
--
1.8.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 5/8] ASoC: ep93xx: Setup dma data in DAI probe
2013-04-20 17:29 [PATCH 1/8] ASoC: generic-dmaengine-pcm: Add support for half-duplex Lars-Peter Clausen
` (2 preceding siblings ...)
2013-04-20 17:29 ` [PATCH 4/8] ASoC: mxs: Use generic dmaengine PCM Lars-Peter Clausen
@ 2013-04-20 17:29 ` Lars-Peter Clausen
2013-05-13 7:27 ` Lars-Peter Clausen
2013-05-13 14:21 ` Mark Brown
2013-04-20 17:29 ` [PATCH 6/8] ASoC: ep93xx: Use generic dmaengine PCM Lars-Peter Clausen
` (4 subsequent siblings)
8 siblings, 2 replies; 20+ messages in thread
From: Lars-Peter Clausen @ 2013-04-20 17:29 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood
Cc: alsa-devel, Rajeev Kumar, Ryan Mallon, Hartley Sweeten,
Lars-Peter Clausen, Shawn Guo
This allows us to access the DAI DMA data when we create the PCM. We'll use
this when converting ep39xx to generic DMA engine PCM driver.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
Changes since v1:
* Fix a mis-rebase which mixed up bits from this patch with the next one
---
sound/soc/cirrus/ep93xx-ac97.c | 14 ++++----------
sound/soc/cirrus/ep93xx-i2s.c | 14 ++++----------
2 files changed, 8 insertions(+), 20 deletions(-)
diff --git a/sound/soc/cirrus/ep93xx-ac97.c b/sound/soc/cirrus/ep93xx-ac97.c
index 8d30886..38cf335 100644
--- a/sound/soc/cirrus/ep93xx-ac97.c
+++ b/sound/soc/cirrus/ep93xx-ac97.c
@@ -314,22 +314,15 @@ static int ep93xx_ac97_trigger(struct snd_pcm_substream *substream,
return 0;
}
-static int ep93xx_ac97_startup(struct snd_pcm_substream *substream,
- struct snd_soc_dai *dai)
+static int ep93xx_ac97_dai_probe(struct snd_soc_dai *dai)
{
- struct ep93xx_dma_data *dma_data;
+ dai->playback_dma_data = &ep93xx_ac97_pcm_out;
+ dai->capture_dma_data = &ep93xx_ac97_pcm_in;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
- dma_data = &ep93xx_ac97_pcm_out;
- else
- dma_data = &ep93xx_ac97_pcm_in;
-
- snd_soc_dai_set_dma_data(dai, substream, dma_data);
return 0;
}
static const struct snd_soc_dai_ops ep93xx_ac97_dai_ops = {
- .startup = ep93xx_ac97_startup,
.trigger = ep93xx_ac97_trigger,
};
@@ -337,6 +330,7 @@ static struct snd_soc_dai_driver ep93xx_ac97_dai = {
.name = "ep93xx-ac97",
.id = 0,
.ac97_control = 1,
+ .probe = ep93xx_ac97_dai_probe,
.playback = {
.stream_name = "AC97 Playback",
.channels_min = 2,
diff --git a/sound/soc/cirrus/ep93xx-i2s.c b/sound/soc/cirrus/ep93xx-i2s.c
index 83075b3..e17b905 100644
--- a/sound/soc/cirrus/ep93xx-i2s.c
+++ b/sound/soc/cirrus/ep93xx-i2s.c
@@ -60,7 +60,6 @@ struct ep93xx_i2s_info {
struct clk *mclk;
struct clk *sclk;
struct clk *lrclk;
- struct ep93xx_dma_data *dma_data;
void __iomem *regs;
};
@@ -139,15 +138,11 @@ static void ep93xx_i2s_disable(struct ep93xx_i2s_info *info, int stream)
}
}
-static int ep93xx_i2s_startup(struct snd_pcm_substream *substream,
- struct snd_soc_dai *dai)
+static int ep93xx_i2s_dai_probe(struct snd_soc_dai *dai)
{
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct ep93xx_i2s_info *info = snd_soc_dai_get_drvdata(dai);
- struct snd_soc_dai *cpu_dai = rtd->cpu_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];
- snd_soc_dai_set_dma_data(cpu_dai, substream,
- &info->dma_data[substream->stream]);
return 0;
}
@@ -338,7 +333,6 @@ static int ep93xx_i2s_resume(struct snd_soc_dai *dai)
#endif
static const struct snd_soc_dai_ops ep93xx_i2s_dai_ops = {
- .startup = ep93xx_i2s_startup,
.shutdown = ep93xx_i2s_shutdown,
.hw_params = ep93xx_i2s_hw_params,
.set_sysclk = ep93xx_i2s_set_sysclk,
@@ -349,6 +343,7 @@ static const struct snd_soc_dai_ops ep93xx_i2s_dai_ops = {
static struct snd_soc_dai_driver ep93xx_i2s_dai = {
.symmetric_rates= 1,
+ .probe = ep93xx_i2s_dai_probe,
.suspend = ep93xx_i2s_suspend,
.resume = ep93xx_i2s_resume,
.playback = {
@@ -403,7 +398,6 @@ static int ep93xx_i2s_probe(struct platform_device *pdev)
}
dev_set_drvdata(&pdev->dev, info);
- info->dma_data = ep93xx_i2s_dma_data;
err = snd_soc_register_dai(&pdev->dev, &ep93xx_i2s_dai);
if (err)
--
1.8.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 6/8] ASoC: ep93xx: Use generic dmaengine PCM
2013-04-20 17:29 [PATCH 1/8] ASoC: generic-dmaengine-pcm: Add support for half-duplex Lars-Peter Clausen
` (3 preceding siblings ...)
2013-04-20 17:29 ` [PATCH 5/8] ASoC: ep93xx: Setup dma data in DAI probe Lars-Peter Clausen
@ 2013-04-20 17:29 ` Lars-Peter Clausen
2013-05-06 19:41 ` Mark Brown
2013-04-20 17:29 ` [PATCH 7/8] ASoC: spear: Setup dma data in DAI probe Lars-Peter Clausen
` (3 subsequent siblings)
8 siblings, 1 reply; 20+ messages in thread
From: Lars-Peter Clausen @ 2013-04-20 17:29 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood
Cc: alsa-devel, Rajeev Kumar, Ryan Mallon, Hartley Sweeten,
Lars-Peter Clausen, Shawn Guo
Use the generic dmaengine PCM driver instead of a custom implementation.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
sound/soc/cirrus/Kconfig | 2 +-
sound/soc/cirrus/ep93xx-pcm.c | 138 ++++--------------------------------------
2 files changed, 12 insertions(+), 128 deletions(-)
diff --git a/sound/soc/cirrus/Kconfig b/sound/soc/cirrus/Kconfig
index 88143db..2c20f01 100644
--- a/sound/soc/cirrus/Kconfig
+++ b/sound/soc/cirrus/Kconfig
@@ -1,7 +1,7 @@
config SND_EP93XX_SOC
tristate "SoC Audio support for the Cirrus Logic EP93xx series"
depends on ARCH_EP93XX && SND_SOC
- select SND_SOC_DMAENGINE_PCM
+ select SND_SOC_GENERIC_DMAENGINE_PCM
help
Say Y or M if you want to add support for codecs attached to
the EP93xx I2S or AC97 interfaces.
diff --git a/sound/soc/cirrus/ep93xx-pcm.c b/sound/soc/cirrus/ep93xx-pcm.c
index 4880326..0e9f56e 100644
--- a/sound/soc/cirrus/ep93xx-pcm.c
+++ b/sound/soc/cirrus/ep93xx-pcm.c
@@ -14,20 +14,14 @@
#include <linux/module.h>
#include <linux/init.h>
-#include <linux/device.h>
-#include <linux/slab.h>
+#include <linux/platform_device.h>
#include <linux/dmaengine.h>
-#include <linux/dma-mapping.h>
-#include <sound/core.h>
#include <sound/pcm.h>
-#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <sound/dmaengine_pcm.h>
#include <linux/platform_data/dma-ep93xx.h>
-#include <mach/hardware.h>
-#include <mach/ep93xx-regs.h>
static const struct snd_pcm_hardware ep93xx_pcm_hardware = {
.info = (SNDRV_PCM_INFO_MMAP |
@@ -63,134 +57,24 @@ static bool ep93xx_pcm_dma_filter(struct dma_chan *chan, void *filter_param)
return false;
}
-static int ep93xx_pcm_open(struct snd_pcm_substream *substream)
-{
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
-
- snd_soc_set_runtime_hwparams(substream, &ep93xx_pcm_hardware);
-
- return snd_dmaengine_pcm_open_request_chan(substream,
- ep93xx_pcm_dma_filter,
- snd_soc_dai_get_dma_data(rtd->cpu_dai, substream));
-}
-
-static int ep93xx_pcm_hw_params(struct snd_pcm_substream *substream,
- struct snd_pcm_hw_params *params)
-{
- snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer);
-
- return 0;
-}
-
-static int ep93xx_pcm_hw_free(struct snd_pcm_substream *substream)
-{
- snd_pcm_set_runtime_buffer(substream, NULL);
- return 0;
-}
-
-static int ep93xx_pcm_mmap(struct snd_pcm_substream *substream,
- struct vm_area_struct *vma)
-{
- struct snd_pcm_runtime *runtime = substream->runtime;
-
- return dma_mmap_writecombine(substream->pcm->card->dev, vma,
- runtime->dma_area,
- runtime->dma_addr,
- runtime->dma_bytes);
-}
-
-static struct snd_pcm_ops ep93xx_pcm_ops = {
- .open = ep93xx_pcm_open,
- .close = snd_dmaengine_pcm_close_release_chan,
- .ioctl = snd_pcm_lib_ioctl,
- .hw_params = ep93xx_pcm_hw_params,
- .hw_free = ep93xx_pcm_hw_free,
- .trigger = snd_dmaengine_pcm_trigger,
- .pointer = snd_dmaengine_pcm_pointer_no_residue,
- .mmap = ep93xx_pcm_mmap,
-};
-
-static int ep93xx_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream)
-{
- struct snd_pcm_substream *substream = pcm->streams[stream].substream;
- struct snd_dma_buffer *buf = &substream->dma_buffer;
- size_t size = ep93xx_pcm_hardware.buffer_bytes_max;
-
- buf->dev.type = SNDRV_DMA_TYPE_DEV;
- buf->dev.dev = pcm->card->dev;
- buf->private_data = NULL;
- buf->area = dma_alloc_writecombine(pcm->card->dev, size,
- &buf->addr, GFP_KERNEL);
- buf->bytes = size;
-
- return (buf->area == NULL) ? -ENOMEM : 0;
-}
-
-static void ep93xx_pcm_free_dma_buffers(struct snd_pcm *pcm)
-{
- struct snd_pcm_substream *substream;
- struct snd_dma_buffer *buf;
- int stream;
-
- for (stream = 0; stream < 2; stream++) {
- substream = pcm->streams[stream].substream;
- if (!substream)
- continue;
-
- buf = &substream->dma_buffer;
- if (!buf->area)
- continue;
-
- dma_free_writecombine(pcm->card->dev, buf->bytes, buf->area,
- buf->addr);
- buf->area = NULL;
- }
-}
-
-static u64 ep93xx_pcm_dmamask = DMA_BIT_MASK(32);
-
-static int ep93xx_pcm_new(struct snd_soc_pcm_runtime *rtd)
-{
- struct snd_card *card = rtd->card->snd_card;
- struct snd_pcm *pcm = rtd->pcm;
- int ret = 0;
-
- if (!card->dev->dma_mask)
- card->dev->dma_mask = &ep93xx_pcm_dmamask;
- if (!card->dev->coherent_dma_mask)
- card->dev->coherent_dma_mask = DMA_BIT_MASK(32);
-
- if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
- ret = ep93xx_pcm_preallocate_dma_buffer(pcm,
- SNDRV_PCM_STREAM_PLAYBACK);
- if (ret)
- return ret;
- }
-
- if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
- ret = ep93xx_pcm_preallocate_dma_buffer(pcm,
- SNDRV_PCM_STREAM_CAPTURE);
- if (ret)
- return ret;
- }
-
- return 0;
-}
-
-static struct snd_soc_platform_driver ep93xx_soc_platform = {
- .ops = &ep93xx_pcm_ops,
- .pcm_new = &ep93xx_pcm_new,
- .pcm_free = &ep93xx_pcm_free_dma_buffers,
+static const struct snd_dmaengine_pcm_config ep93xx_dmaengine_pcm_config = {
+ .pcm_hardware = &ep93xx_pcm_hardware,
+ .compat_filter_fn = ep93xx_pcm_dma_filter,
+ .prealloc_buffer_size = 131072,
};
static int ep93xx_soc_platform_probe(struct platform_device *pdev)
{
- return snd_soc_register_platform(&pdev->dev, &ep93xx_soc_platform);
+ return snd_dmaengine_pcm_register(&pdev->dev,
+ &ep93xx_dmaengine_pcm_config,
+ SND_DMAENGINE_PCM_FLAG_NO_RESIDUE |
+ SND_DMAENGINE_PCM_FLAG_NO_DT |
+ SND_DMAENGINE_PCM_FLAG_COMPAT);
}
static int ep93xx_soc_platform_remove(struct platform_device *pdev)
{
- snd_soc_unregister_platform(&pdev->dev);
+ snd_dmaengine_pcm_unregister(&pdev->dev);
return 0;
}
--
1.8.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 7/8] ASoC: spear: Setup dma data in DAI probe
2013-04-20 17:29 [PATCH 1/8] ASoC: generic-dmaengine-pcm: Add support for half-duplex Lars-Peter Clausen
` (4 preceding siblings ...)
2013-04-20 17:29 ` [PATCH 6/8] ASoC: ep93xx: Use generic dmaengine PCM Lars-Peter Clausen
@ 2013-04-20 17:29 ` Lars-Peter Clausen
2013-05-06 19:41 ` Mark Brown
2013-04-20 17:29 ` [PATCH 8/8] ASoC: spear: Use generic dmaengine PCM Lars-Peter Clausen
` (2 subsequent siblings)
8 siblings, 1 reply; 20+ messages in thread
From: Lars-Peter Clausen @ 2013-04-20 17:29 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood
Cc: alsa-devel, Rajeev Kumar, Ryan Mallon, Hartley Sweeten,
Lars-Peter Clausen, Shawn Guo
This allows us to access the DAI DMA data when we create the PCM. We'll use
this when converting spear to generic DMA engine PCM driver.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
sound/soc/spear/spdif_in.c | 12 ++++--------
sound/soc/spear/spdif_out.c | 7 ++++---
2 files changed, 8 insertions(+), 11 deletions(-)
diff --git a/sound/soc/spear/spdif_in.c b/sound/soc/spear/spdif_in.c
index c7c4b20..70c8eb1 100644
--- a/sound/soc/spear/spdif_in.c
+++ b/sound/soc/spear/spdif_in.c
@@ -49,15 +49,12 @@ static void spdif_in_configure(struct spdif_in_dev *host)
writel(0xF, host->io_base + SPDIF_IN_IRQ_MASK);
}
-static int spdif_in_startup(struct snd_pcm_substream *substream,
- struct snd_soc_dai *cpu_dai)
+static int spdif_in_dai_probe(struct snd_soc_dai *dai)
{
- struct spdif_in_dev *host = snd_soc_dai_get_drvdata(cpu_dai);
+ struct spdif_in_dev *host = snd_soc_dai_get_drvdata(dai);
- if (substream->stream != SNDRV_PCM_STREAM_CAPTURE)
- return -EINVAL;
+ dai->capture_dma_data = &host->dma_params;
- snd_soc_dai_set_dma_data(cpu_dai, substream, (void *)&host->dma_params);
return 0;
}
@@ -70,7 +67,6 @@ static void spdif_in_shutdown(struct snd_pcm_substream *substream,
return;
writel(0x0, host->io_base + SPDIF_IN_IRQ_MASK);
- snd_soc_dai_set_dma_data(dai, substream, NULL);
}
static void spdif_in_format(struct spdif_in_dev *host, u32 format)
@@ -151,13 +147,13 @@ static int spdif_in_trigger(struct snd_pcm_substream *substream, int cmd,
}
static struct snd_soc_dai_ops spdif_in_dai_ops = {
- .startup = spdif_in_startup,
.shutdown = spdif_in_shutdown,
.trigger = spdif_in_trigger,
.hw_params = spdif_in_hw_params,
};
struct snd_soc_dai_driver spdif_in_dai = {
+ .probe = spdif_in_dai_probe,
.capture = {
.channels_min = 2,
.channels_max = 2,
diff --git a/sound/soc/spear/spdif_out.c b/sound/soc/spear/spdif_out.c
index 5eac4cd..1996c1c 100644
--- a/sound/soc/spear/spdif_out.c
+++ b/sound/soc/spear/spdif_out.c
@@ -62,8 +62,6 @@ static int spdif_out_startup(struct snd_pcm_substream *substream,
if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK)
return -EINVAL;
- snd_soc_dai_set_dma_data(cpu_dai, substream, (void *)&host->dma_params);
-
ret = clk_enable(host->clk);
if (ret)
return ret;
@@ -84,7 +82,6 @@ static void spdif_out_shutdown(struct snd_pcm_substream *substream,
clk_disable(host->clk);
host->running = false;
- snd_soc_dai_set_dma_data(dai, substream, NULL);
}
static void spdif_out_clock(struct spdif_out_dev *host, u32 core_freq,
@@ -245,6 +242,10 @@ static const struct snd_kcontrol_new spdif_out_controls[] = {
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;
+
return snd_soc_add_dai_controls(dai, spdif_out_controls,
ARRAY_SIZE(spdif_out_controls));
}
--
1.8.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 8/8] ASoC: spear: Use generic dmaengine PCM
2013-04-20 17:29 [PATCH 1/8] ASoC: generic-dmaengine-pcm: Add support for half-duplex Lars-Peter Clausen
` (5 preceding siblings ...)
2013-04-20 17:29 ` [PATCH 7/8] ASoC: spear: Setup dma data in DAI probe Lars-Peter Clausen
@ 2013-04-20 17:29 ` Lars-Peter Clausen
2013-05-06 19:41 ` Mark Brown
2013-04-21 7:14 ` [PATCH 1/8] ASoC: generic-dmaengine-pcm: Add support for half-duplex Shawn Guo
2013-04-22 10:28 ` Mark Brown
8 siblings, 1 reply; 20+ messages in thread
From: Lars-Peter Clausen @ 2013-04-20 17:29 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood
Cc: alsa-devel, Rajeev Kumar, Ryan Mallon, Hartley Sweeten,
Lars-Peter Clausen, Shawn Guo
Use the generic dmaengine PCM driver instead of a custom implementation.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
sound/soc/spear/spear_pcm.c | 152 +++++---------------------------------------
1 file changed, 15 insertions(+), 137 deletions(-)
diff --git a/sound/soc/spear/spear_pcm.c b/sound/soc/spear/spear_pcm.c
index d653763..4707f2b 100644
--- a/sound/soc/spear/spear_pcm.c
+++ b/sound/soc/spear/spear_pcm.c
@@ -13,19 +13,13 @@
#include <linux/module.h>
#include <linux/dmaengine.h>
-#include <linux/dma-mapping.h>
-#include <linux/init.h>
#include <linux/platform_device.h>
-#include <linux/scatterlist.h>
-#include <linux/slab.h>
-#include <sound/core.h>
#include <sound/dmaengine_pcm.h>
#include <sound/pcm.h>
-#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <sound/spear_dma.h>
-struct snd_pcm_hardware spear_pcm_hardware = {
+static const struct snd_pcm_hardware spear_pcm_hardware = {
.info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER |
SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID |
SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME),
@@ -37,149 +31,33 @@ struct snd_pcm_hardware spear_pcm_hardware = {
.fifo_size = 0, /* fifo size in bytes */
};
-static int spear_pcm_hw_params(struct snd_pcm_substream *substream,
- struct snd_pcm_hw_params *params)
+static struct dma_chan *spear_pcm_request_chan(struct snd_soc_pcm_runtime *rtd,
+ struct snd_pcm_substream *substream)
{
- snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer);
+ struct spear_dma_data *dma_data;
- return 0;
-}
-
-static int spear_pcm_hw_free(struct snd_pcm_substream *substream)
-{
- snd_pcm_set_runtime_buffer(substream, NULL);
-
- return 0;
-}
-
-static int spear_pcm_open(struct snd_pcm_substream *substream)
-{
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
-
- struct spear_dma_data *dma_data = (struct spear_dma_data *)
- snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
- int ret;
-
- ret = snd_soc_set_runtime_hwparams(substream, &spear_pcm_hardware);
- if (ret)
- return ret;
+ dma_data = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
- return snd_dmaengine_pcm_open_request_chan(substream, dma_data->filter,
- dma_data);
+ return snd_dmaengine_pcm_request_channel(dma_data->filter, dma_data);
}
-static int spear_pcm_mmap(struct snd_pcm_substream *substream,
- struct vm_area_struct *vma)
-{
- struct snd_pcm_runtime *runtime = substream->runtime;
-
- return dma_mmap_writecombine(substream->pcm->card->dev, vma,
- runtime->dma_area, runtime->dma_addr,
- runtime->dma_bytes);
-}
-
-static struct snd_pcm_ops spear_pcm_ops = {
- .open = spear_pcm_open,
- .close = snd_dmaengine_pcm_close_release_chan,
- .ioctl = snd_pcm_lib_ioctl,
- .hw_params = spear_pcm_hw_params,
- .hw_free = spear_pcm_hw_free,
- .trigger = snd_dmaengine_pcm_trigger,
- .pointer = snd_dmaengine_pcm_pointer,
- .mmap = spear_pcm_mmap,
-};
-
-static int
-spear_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream,
- size_t size)
-{
- struct snd_pcm_substream *substream = pcm->streams[stream].substream;
- struct snd_dma_buffer *buf = &substream->dma_buffer;
-
- buf->dev.type = SNDRV_DMA_TYPE_DEV;
- buf->dev.dev = pcm->card->dev;
- buf->private_data = NULL;
-
- buf->area = dma_alloc_writecombine(pcm->card->dev, size,
- &buf->addr, GFP_KERNEL);
- if (!buf->area)
- return -ENOMEM;
-
- dev_info(buf->dev.dev,
- " preallocate_dma_buffer: area=%p, addr=%p, size=%d\n",
- (void *)buf->area, (void *)buf->addr, size);
-
- buf->bytes = size;
- return 0;
-}
-
-static void spear_pcm_free(struct snd_pcm *pcm)
-{
- struct snd_pcm_substream *substream;
- struct snd_dma_buffer *buf;
- int stream;
-
- for (stream = 0; stream < 2; stream++) {
- substream = pcm->streams[stream].substream;
- if (!substream)
- continue;
-
- buf = &substream->dma_buffer;
- if (!buf || !buf->area)
- continue;
-
- dma_free_writecombine(pcm->card->dev, buf->bytes,
- buf->area, buf->addr);
- buf->area = NULL;
- }
-}
-
-static u64 spear_pcm_dmamask = DMA_BIT_MASK(32);
-
-static int spear_pcm_new(struct snd_soc_pcm_runtime *rtd)
-{
- struct snd_card *card = rtd->card->snd_card;
- int ret;
-
- if (!card->dev->dma_mask)
- card->dev->dma_mask = &spear_pcm_dmamask;
- if (!card->dev->coherent_dma_mask)
- card->dev->coherent_dma_mask = DMA_BIT_MASK(32);
-
- if (rtd->cpu_dai->driver->playback.channels_min) {
- ret = spear_pcm_preallocate_dma_buffer(rtd->pcm,
- SNDRV_PCM_STREAM_PLAYBACK,
- spear_pcm_hardware.buffer_bytes_max);
- if (ret)
- return ret;
- }
-
- if (rtd->cpu_dai->driver->capture.channels_min) {
- ret = spear_pcm_preallocate_dma_buffer(rtd->pcm,
- SNDRV_PCM_STREAM_CAPTURE,
- spear_pcm_hardware.buffer_bytes_max);
- if (ret)
- return ret;
- }
-
- return 0;
-}
-
-struct snd_soc_platform_driver spear_soc_platform = {
- .ops = &spear_pcm_ops,
- .pcm_new = spear_pcm_new,
- .pcm_free = spear_pcm_free,
+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,
};
static int spear_soc_platform_probe(struct platform_device *pdev)
{
- return snd_soc_register_platform(&pdev->dev, &spear_soc_platform);
+ return snd_dmaengine_pcm_register(&pdev->dev,
+ &spear_dmaengine_pcm_config,
+ SND_DMAENGINE_PCM_FLAG_NO_DT |
+ SND_DMAENGINE_PCM_FLAG_COMPAT);
}
static int spear_soc_platform_remove(struct platform_device *pdev)
{
- snd_soc_unregister_platform(&pdev->dev);
-
+ snd_dmaengine_pcm_unregister(&pdev->dev);
return 0;
}
--
1.8.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH 1/8] ASoC: generic-dmaengine-pcm: Add support for half-duplex
2013-04-20 17:29 [PATCH 1/8] ASoC: generic-dmaengine-pcm: Add support for half-duplex Lars-Peter Clausen
` (6 preceding siblings ...)
2013-04-20 17:29 ` [PATCH 8/8] ASoC: spear: Use generic dmaengine PCM Lars-Peter Clausen
@ 2013-04-21 7:14 ` Shawn Guo
2013-04-22 10:28 ` Mark Brown
8 siblings, 0 replies; 20+ messages in thread
From: Shawn Guo @ 2013-04-21 7:14 UTC (permalink / raw)
To: Lars-Peter Clausen
Cc: alsa-devel, Rajeev Kumar, Ryan Mallon, Liam Girdwood,
Hartley Sweeten, Mark Brown
On Sat, Apr 20, 2013 at 07:29:00PM +0200, Lars-Peter Clausen wrote:
> Some platforms which are half-duplex share the same DMA channel between the
> playback and capture stream. Add support for this to the generic dmaengine PCM
> driver.
>
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Patch 1 ~ 4,
Tested-by: Shawn Guo <shawn.guo@linaro.org>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 1/8] ASoC: generic-dmaengine-pcm: Add support for half-duplex
2013-04-20 17:29 [PATCH 1/8] ASoC: generic-dmaengine-pcm: Add support for half-duplex Lars-Peter Clausen
` (7 preceding siblings ...)
2013-04-21 7:14 ` [PATCH 1/8] ASoC: generic-dmaengine-pcm: Add support for half-duplex Shawn Guo
@ 2013-04-22 10:28 ` Mark Brown
8 siblings, 0 replies; 20+ messages in thread
From: Mark Brown @ 2013-04-22 10:28 UTC (permalink / raw)
To: Lars-Peter Clausen
Cc: alsa-devel, Rajeev Kumar, Ryan Mallon, Liam Girdwood,
Hartley Sweeten, Shawn Guo
[-- Attachment #1.1: Type: text/plain, Size: 255 bytes --]
On Sat, Apr 20, 2013 at 07:29:00PM +0200, Lars-Peter Clausen wrote:
> Some platforms which are half-duplex share the same DMA channel between the
> playback and capture stream. Add support for this to the generic dmaengine PCM
> driver.
Applied, thanks.
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 2/8] ASoC: mxs-pcm: Set SNDRV_PCM_INFO_HALF_DUPLEX
2013-04-20 17:29 ` [PATCH 2/8] ASoC: mxs-pcm: Set SNDRV_PCM_INFO_HALF_DUPLEX Lars-Peter Clausen
@ 2013-04-22 10:28 ` Mark Brown
0 siblings, 0 replies; 20+ messages in thread
From: Mark Brown @ 2013-04-22 10:28 UTC (permalink / raw)
To: Lars-Peter Clausen
Cc: alsa-devel, Rajeev Kumar, Ryan Mallon, Liam Girdwood,
Hartley Sweeten, Shawn Guo
[-- Attachment #1.1: Type: text/plain, Size: 250 bytes --]
On Sat, Apr 20, 2013 at 07:29:01PM +0200, Lars-Peter Clausen wrote:
> The MXS SAIF is only half-duplex so set the SNDRV_PCM_INFO_HALF_DUPLEX flag for
> the PCM in order to prevent playback and capture from running at the same time.
Applied, thanks.
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 3/8] ASoC: mxs: Setup dma data in DAI probe
2013-04-20 17:29 ` [PATCH 3/8] ASoC: mxs: Setup dma data in DAI probe Lars-Peter Clausen
@ 2013-04-22 10:28 ` Mark Brown
0 siblings, 0 replies; 20+ messages in thread
From: Mark Brown @ 2013-04-22 10:28 UTC (permalink / raw)
To: Lars-Peter Clausen
Cc: alsa-devel, Rajeev Kumar, Ryan Mallon, Liam Girdwood,
Hartley Sweeten, Shawn Guo
[-- Attachment #1.1: Type: text/plain, Size: 225 bytes --]
On Sat, Apr 20, 2013 at 07:29:02PM +0200, Lars-Peter Clausen wrote:
> This allows us to access the DAI DMA data when we create the PCM. We'll use
> this when converting mxs to generic DMA engine PCM driver.
Applied, thanks.
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 4/8] ASoC: mxs: Use generic dmaengine PCM
2013-04-20 17:29 ` [PATCH 4/8] ASoC: mxs: Use generic dmaengine PCM Lars-Peter Clausen
@ 2013-04-22 10:29 ` Mark Brown
0 siblings, 0 replies; 20+ messages in thread
From: Mark Brown @ 2013-04-22 10:29 UTC (permalink / raw)
To: Lars-Peter Clausen
Cc: alsa-devel, Rajeev Kumar, Ryan Mallon, Liam Girdwood,
Hartley Sweeten, Shawn Guo
[-- Attachment #1.1: Type: text/plain, Size: 161 bytes --]
On Sat, Apr 20, 2013 at 07:29:03PM +0200, Lars-Peter Clausen wrote:
> Use the generic dmaengine PCM driver instead of a custom implementation.
Applied, thanks.
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 6/8] ASoC: ep93xx: Use generic dmaengine PCM
2013-04-20 17:29 ` [PATCH 6/8] ASoC: ep93xx: Use generic dmaengine PCM Lars-Peter Clausen
@ 2013-05-06 19:41 ` Mark Brown
0 siblings, 0 replies; 20+ messages in thread
From: Mark Brown @ 2013-05-06 19:41 UTC (permalink / raw)
To: Lars-Peter Clausen
Cc: alsa-devel, Rajeev Kumar, Ryan Mallon, Liam Girdwood,
Hartley Sweeten, Shawn Guo
[-- Attachment #1.1: Type: text/plain, Size: 161 bytes --]
On Sat, Apr 20, 2013 at 07:29:05PM +0200, Lars-Peter Clausen wrote:
> Use the generic dmaengine PCM driver instead of a custom implementation.
Applied, thanks.
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 7/8] ASoC: spear: Setup dma data in DAI probe
2013-04-20 17:29 ` [PATCH 7/8] ASoC: spear: Setup dma data in DAI probe Lars-Peter Clausen
@ 2013-05-06 19:41 ` Mark Brown
0 siblings, 0 replies; 20+ messages in thread
From: Mark Brown @ 2013-05-06 19:41 UTC (permalink / raw)
To: Lars-Peter Clausen
Cc: alsa-devel, Rajeev Kumar, Ryan Mallon, Liam Girdwood,
Hartley Sweeten, Shawn Guo
[-- Attachment #1.1: Type: text/plain, Size: 227 bytes --]
On Sat, Apr 20, 2013 at 07:29:06PM +0200, Lars-Peter Clausen wrote:
> This allows us to access the DAI DMA data when we create the PCM. We'll use
> this when converting spear to generic DMA engine PCM driver.
Applied, thanks.
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 8/8] ASoC: spear: Use generic dmaengine PCM
2013-04-20 17:29 ` [PATCH 8/8] ASoC: spear: Use generic dmaengine PCM Lars-Peter Clausen
@ 2013-05-06 19:41 ` Mark Brown
0 siblings, 0 replies; 20+ messages in thread
From: Mark Brown @ 2013-05-06 19:41 UTC (permalink / raw)
To: Lars-Peter Clausen
Cc: alsa-devel, Rajeev Kumar, Ryan Mallon, Liam Girdwood,
Hartley Sweeten, Shawn Guo
[-- Attachment #1.1: Type: text/plain, Size: 161 bytes --]
On Sat, Apr 20, 2013 at 07:29:07PM +0200, Lars-Peter Clausen wrote:
> Use the generic dmaengine PCM driver instead of a custom implementation.
Applied, thanks.
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 5/8] ASoC: ep93xx: Setup dma data in DAI probe
2013-04-20 17:29 ` [PATCH 5/8] ASoC: ep93xx: Setup dma data in DAI probe Lars-Peter Clausen
@ 2013-05-13 7:27 ` Lars-Peter Clausen
2013-05-13 13:33 ` Mark Brown
2013-05-13 14:21 ` Mark Brown
1 sibling, 1 reply; 20+ messages in thread
From: Lars-Peter Clausen @ 2013-05-13 7:27 UTC (permalink / raw)
To: Mark Brown
Cc: alsa-devel, Rajeev Kumar, Ryan Mallon, Liam Girdwood,
Hartley Sweeten, Shawn Guo
On 04/20/2013 07:29 PM, Lars-Peter Clausen wrote:
> This allows us to access the DAI DMA data when we create the PCM. We'll use
> this when converting ep39xx to generic DMA engine PCM driver.
>
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
>
Hi Mark,
it looks like this patch was lost. The next one in this series which has a
dependency on this one was applied though. Should I resend the patch?
- Lars
> ---
> Changes since v1:
> * Fix a mis-rebase which mixed up bits from this patch with the next one
> ---
> sound/soc/cirrus/ep93xx-ac97.c | 14 ++++----------
> sound/soc/cirrus/ep93xx-i2s.c | 14 ++++----------
> 2 files changed, 8 insertions(+), 20 deletions(-)
>
> diff --git a/sound/soc/cirrus/ep93xx-ac97.c b/sound/soc/cirrus/ep93xx-ac97.c
> index 8d30886..38cf335 100644
> --- a/sound/soc/cirrus/ep93xx-ac97.c
> +++ b/sound/soc/cirrus/ep93xx-ac97.c
> @@ -314,22 +314,15 @@ static int ep93xx_ac97_trigger(struct snd_pcm_substream *substream,
> return 0;
> }
>
> -static int ep93xx_ac97_startup(struct snd_pcm_substream *substream,
> - struct snd_soc_dai *dai)
> +static int ep93xx_ac97_dai_probe(struct snd_soc_dai *dai)
> {
> - struct ep93xx_dma_data *dma_data;
> + dai->playback_dma_data = &ep93xx_ac97_pcm_out;
> + dai->capture_dma_data = &ep93xx_ac97_pcm_in;
>
> - if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
> - dma_data = &ep93xx_ac97_pcm_out;
> - else
> - dma_data = &ep93xx_ac97_pcm_in;
> -
> - snd_soc_dai_set_dma_data(dai, substream, dma_data);
> return 0;
> }
>
> static const struct snd_soc_dai_ops ep93xx_ac97_dai_ops = {
> - .startup = ep93xx_ac97_startup,
> .trigger = ep93xx_ac97_trigger,
> };
>
> @@ -337,6 +330,7 @@ static struct snd_soc_dai_driver ep93xx_ac97_dai = {
> .name = "ep93xx-ac97",
> .id = 0,
> .ac97_control = 1,
> + .probe = ep93xx_ac97_dai_probe,
> .playback = {
> .stream_name = "AC97 Playback",
> .channels_min = 2,
> diff --git a/sound/soc/cirrus/ep93xx-i2s.c b/sound/soc/cirrus/ep93xx-i2s.c
> index 83075b3..e17b905 100644
> --- a/sound/soc/cirrus/ep93xx-i2s.c
> +++ b/sound/soc/cirrus/ep93xx-i2s.c
> @@ -60,7 +60,6 @@ struct ep93xx_i2s_info {
> struct clk *mclk;
> struct clk *sclk;
> struct clk *lrclk;
> - struct ep93xx_dma_data *dma_data;
> void __iomem *regs;
> };
>
> @@ -139,15 +138,11 @@ static void ep93xx_i2s_disable(struct ep93xx_i2s_info *info, int stream)
> }
> }
>
> -static int ep93xx_i2s_startup(struct snd_pcm_substream *substream,
> - struct snd_soc_dai *dai)
> +static int ep93xx_i2s_dai_probe(struct snd_soc_dai *dai)
> {
> - struct snd_soc_pcm_runtime *rtd = substream->private_data;
> - struct ep93xx_i2s_info *info = snd_soc_dai_get_drvdata(dai);
> - struct snd_soc_dai *cpu_dai = rtd->cpu_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];
>
> - snd_soc_dai_set_dma_data(cpu_dai, substream,
> - &info->dma_data[substream->stream]);
> return 0;
> }
>
> @@ -338,7 +333,6 @@ static int ep93xx_i2s_resume(struct snd_soc_dai *dai)
> #endif
>
> static const struct snd_soc_dai_ops ep93xx_i2s_dai_ops = {
> - .startup = ep93xx_i2s_startup,
> .shutdown = ep93xx_i2s_shutdown,
> .hw_params = ep93xx_i2s_hw_params,
> .set_sysclk = ep93xx_i2s_set_sysclk,
> @@ -349,6 +343,7 @@ static const struct snd_soc_dai_ops ep93xx_i2s_dai_ops = {
>
> static struct snd_soc_dai_driver ep93xx_i2s_dai = {
> .symmetric_rates= 1,
> + .probe = ep93xx_i2s_dai_probe,
> .suspend = ep93xx_i2s_suspend,
> .resume = ep93xx_i2s_resume,
> .playback = {
> @@ -403,7 +398,6 @@ static int ep93xx_i2s_probe(struct platform_device *pdev)
> }
>
> dev_set_drvdata(&pdev->dev, info);
> - info->dma_data = ep93xx_i2s_dma_data;
>
> err = snd_soc_register_dai(&pdev->dev, &ep93xx_i2s_dai);
> if (err)
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 5/8] ASoC: ep93xx: Setup dma data in DAI probe
2013-05-13 7:27 ` Lars-Peter Clausen
@ 2013-05-13 13:33 ` Mark Brown
0 siblings, 0 replies; 20+ messages in thread
From: Mark Brown @ 2013-05-13 13:33 UTC (permalink / raw)
To: Lars-Peter Clausen
Cc: alsa-devel, Rajeev Kumar, Ryan Mallon, Liam Girdwood,
Hartley Sweeten, Shawn Guo
[-- Attachment #1.1: Type: text/plain, Size: 572 bytes --]
On Mon, May 13, 2013 at 09:27:09AM +0200, Lars-Peter Clausen wrote:
> On 04/20/2013 07:29 PM, Lars-Peter Clausen wrote:
> > This allows us to access the DAI DMA data when we create the PCM. We'll use
> > this when converting ep39xx to generic DMA engine PCM driver.
> it looks like this patch was lost. The next one in this series which has a
> dependency on this one was applied though. Should I resend the patch?
You need to rebase it into the current code, if it's been discared it's
a result of the rebase into v3.10-rc1 - I didn't have to do any fixups
for ep83xx.
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 5/8] ASoC: ep93xx: Setup dma data in DAI probe
2013-04-20 17:29 ` [PATCH 5/8] ASoC: ep93xx: Setup dma data in DAI probe Lars-Peter Clausen
2013-05-13 7:27 ` Lars-Peter Clausen
@ 2013-05-13 14:21 ` Mark Brown
2013-05-13 18:47 ` Lars-Peter Clausen
1 sibling, 1 reply; 20+ messages in thread
From: Mark Brown @ 2013-05-13 14:21 UTC (permalink / raw)
To: Lars-Peter Clausen
Cc: alsa-devel, Rajeev Kumar, Ryan Mallon, Liam Girdwood,
Hartley Sweeten, Shawn Guo
[-- Attachment #1.1: Type: text/plain, Size: 330 bytes --]
On Sat, Apr 20, 2013 at 07:29:04PM +0200, Lars-Peter Clausen wrote:
> This allows us to access the DAI DMA data when we create the PCM. We'll use
> this when converting ep39xx to generic DMA engine PCM driver.
Hrm, it seems to still apply against the current code so I did that.
Hopefully the tooling worked OK but please check.
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 5/8] ASoC: ep93xx: Setup dma data in DAI probe
2013-05-13 14:21 ` Mark Brown
@ 2013-05-13 18:47 ` Lars-Peter Clausen
0 siblings, 0 replies; 20+ messages in thread
From: Lars-Peter Clausen @ 2013-05-13 18:47 UTC (permalink / raw)
To: Mark Brown
Cc: alsa-devel, Rajeev Kumar, Ryan Mallon, Liam Girdwood,
Hartley Sweeten, Shawn Guo
On 05/13/2013 04:21 PM, Mark Brown wrote:
> On Sat, Apr 20, 2013 at 07:29:04PM +0200, Lars-Peter Clausen wrote:
>> This allows us to access the DAI DMA data when we create the PCM. We'll use
>> this when converting ep39xx to generic DMA engine PCM driver.
>
> Hrm, it seems to still apply against the current code so I did that.
> Hopefully the tooling worked OK but please check.
Looks fine, the only other change was the removal of
platform_set_drvdata(..., NULL).
^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2013-05-13 18:48 UTC | newest]
Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-20 17:29 [PATCH 1/8] ASoC: generic-dmaengine-pcm: Add support for half-duplex Lars-Peter Clausen
2013-04-20 17:29 ` [PATCH 2/8] ASoC: mxs-pcm: Set SNDRV_PCM_INFO_HALF_DUPLEX Lars-Peter Clausen
2013-04-22 10:28 ` Mark Brown
2013-04-20 17:29 ` [PATCH 3/8] ASoC: mxs: Setup dma data in DAI probe Lars-Peter Clausen
2013-04-22 10:28 ` Mark Brown
2013-04-20 17:29 ` [PATCH 4/8] ASoC: mxs: Use generic dmaengine PCM Lars-Peter Clausen
2013-04-22 10:29 ` Mark Brown
2013-04-20 17:29 ` [PATCH 5/8] ASoC: ep93xx: Setup dma data in DAI probe Lars-Peter Clausen
2013-05-13 7:27 ` Lars-Peter Clausen
2013-05-13 13:33 ` Mark Brown
2013-05-13 14:21 ` Mark Brown
2013-05-13 18:47 ` Lars-Peter Clausen
2013-04-20 17:29 ` [PATCH 6/8] ASoC: ep93xx: Use generic dmaengine PCM Lars-Peter Clausen
2013-05-06 19:41 ` Mark Brown
2013-04-20 17:29 ` [PATCH 7/8] ASoC: spear: Setup dma data in DAI probe Lars-Peter Clausen
2013-05-06 19:41 ` Mark Brown
2013-04-20 17:29 ` [PATCH 8/8] ASoC: spear: Use generic dmaengine PCM Lars-Peter Clausen
2013-05-06 19:41 ` Mark Brown
2013-04-21 7:14 ` [PATCH 1/8] ASoC: generic-dmaengine-pcm: Add support for half-duplex Shawn Guo
2013-04-22 10:28 ` Mark Brown
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.