* [PATCH 1/7] ASoC: i.MX31ads: initialize only on correct machine
2010-11-04 16:05 [PATCH for -rc] i.MX updates Sascha Hauer
@ 2010-11-04 16:05 ` Sascha Hauer
2010-11-04 18:51 ` Mark Brown
2010-11-04 16:05 ` [PATCH 2/7] ASoC i.MX eukrea tlv320: Fix for multicomponent Sascha Hauer
` (7 subsequent siblings)
8 siblings, 1 reply; 13+ messages in thread
From: Sascha Hauer @ 2010-11-04 16:05 UTC (permalink / raw)
To: alsa-devel; +Cc: Sascha Hauer, Mark Brown, Liam Girdwood
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
sound/soc/imx/wm1133-ev1.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/sound/soc/imx/wm1133-ev1.c b/sound/soc/imx/wm1133-ev1.c
index 30fdb15..ef8e931 100644
--- a/sound/soc/imx/wm1133-ev1.c
+++ b/sound/soc/imx/wm1133-ev1.c
@@ -20,6 +20,7 @@
#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <sound/soc-dapm.h>
+#include <asm/mach-types.h>
#include <mach/audmux.h>
@@ -265,6 +266,9 @@ static int __init wm1133_ev1_audio_init(void)
int ret;
unsigned int ptcr, pdcr;
+ if (!machine_is_mx31ads())
+ return 0;
+
/* SSI0 mastered by port 5 */
ptcr = MXC_AUDMUX_V2_PTCR_SYN |
MXC_AUDMUX_V2_PTCR_TFSDIR |
--
1.7.2.3
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [PATCH 1/7] ASoC: i.MX31ads: initialize only on correct machine
2010-11-04 16:05 ` [PATCH 1/7] ASoC: i.MX31ads: initialize only on correct machine Sascha Hauer
@ 2010-11-04 18:51 ` Mark Brown
2010-11-05 9:16 ` Sascha Hauer
0 siblings, 1 reply; 13+ messages in thread
From: Mark Brown @ 2010-11-04 18:51 UTC (permalink / raw)
To: Sascha Hauer; +Cc: alsa-devel, Liam Girdwood
On Thu, Nov 04, 2010 at 05:05:39PM +0100, Sascha Hauer wrote:
> + if (!machine_is_mx31ads())
> + return 0;
> +
As previously discussed we need a better check than this - most of these
machines won't have a 1133-EV1 PMIC module on them. Better to convert
the driver to instantiate from a platform device...
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/7] ASoC: i.MX31ads: initialize only on correct machine
2010-11-04 18:51 ` Mark Brown
@ 2010-11-05 9:16 ` Sascha Hauer
2010-11-05 13:09 ` Mark Brown
0 siblings, 1 reply; 13+ messages in thread
From: Sascha Hauer @ 2010-11-05 9:16 UTC (permalink / raw)
To: Mark Brown; +Cc: alsa-devel, Liam Girdwood
On Thu, Nov 04, 2010 at 02:51:36PM -0400, Mark Brown wrote:
> On Thu, Nov 04, 2010 at 05:05:39PM +0100, Sascha Hauer wrote:
>
> > + if (!machine_is_mx31ads())
> > + return 0;
> > +
>
> As previously discussed we need a better check than this - most of these
> machines won't have a 1133-EV1 PMIC module on them. Better to convert
> the driver to instantiate from a platform device...
This does not solve the problem as we do not know when to register the
platform_device. I think what we need is a kernel parameter which can be
used to select the correct path in arch/arm/mach-mx3/mach-mx31ads.c
aswell. I will look into it. For now, can we just take this patch? It
at least fixes all other i.MX31 boards and leaves only the mx31ads to
work on.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/7] ASoC: i.MX31ads: initialize only on correct machine
2010-11-05 9:16 ` Sascha Hauer
@ 2010-11-05 13:09 ` Mark Brown
0 siblings, 0 replies; 13+ messages in thread
From: Mark Brown @ 2010-11-05 13:09 UTC (permalink / raw)
To: Sascha Hauer; +Cc: alsa-devel, Liam Girdwood
On Fri, Nov 05, 2010 at 10:16:24AM +0100, Sascha Hauer wrote:
> On Thu, Nov 04, 2010 at 02:51:36PM -0400, Mark Brown wrote:
> > As previously discussed we need a better check than this - most of these
> > machines won't have a 1133-EV1 PMIC module on them. Better to convert
> > the driver to instantiate from a platform device...
> This does not solve the problem as we do not know when to register the
> platform_device. I think what we need is a kernel parameter which can be
> used to select the correct path in arch/arm/mach-mx3/mach-mx31ads.c
It can be registered in the callback that's called immmediately after
the WM835x is probed on the machine driver.
> aswell. I will look into it. For now, can we just take this patch? It
> at least fixes all other i.MX31 boards and leaves only the mx31ads to
> work on.
I'd much rather get it fixed properly - it's not so urgent since it
really only only affects allyesconfig or allmodconfig type stuff with
people explicitly loading the driver.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 2/7] ASoC i.MX eukrea tlv320: Fix for multicomponent
2010-11-04 16:05 [PATCH for -rc] i.MX updates Sascha Hauer
2010-11-04 16:05 ` [PATCH 1/7] ASoC: i.MX31ads: initialize only on correct machine Sascha Hauer
@ 2010-11-04 16:05 ` Sascha Hauer
2010-11-04 16:05 ` [PATCH 3/7] ASoC i.MX phycore ac97: remove unnecessary includes Sascha Hauer
` (6 subsequent siblings)
8 siblings, 0 replies; 13+ messages in thread
From: Sascha Hauer @ 2010-11-04 16:05 UTC (permalink / raw)
To: alsa-devel; +Cc: Sascha Hauer, Mark Brown, Eric Bénard, Liam Girdwood
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Eric Bénard <eric@eukrea.com>
---
sound/soc/imx/eukrea-tlv320.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/soc/imx/eukrea-tlv320.c b/sound/soc/imx/eukrea-tlv320.c
index b596752..dd4fffd 100644
--- a/sound/soc/imx/eukrea-tlv320.c
+++ b/sound/soc/imx/eukrea-tlv320.c
@@ -34,8 +34,8 @@ static int eukrea_tlv320_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct snd_soc_dai *codec_dai = rtd->dai->codec_dai;
- struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;
+ struct snd_soc_dai *codec_dai = rtd->codec_dai;
+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
int ret;
ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S |
@@ -79,10 +79,10 @@ static struct snd_soc_ops eukrea_tlv320_snd_ops = {
static struct snd_soc_dai_link eukrea_tlv320_dai = {
.name = "tlv320aic23",
.stream_name = "TLV320AIC23",
- .codec_dai = "tlv320aic23-hifi",
+ .codec_dai_name = "tlv320aic23-hifi",
.platform_name = "imx-pcm-audio.0",
.codec_name = "tlv320aic23-codec.0-001a",
- .cpu_dai = "imx-ssi.0",
+ .cpu_dai_name = "imx-ssi.0",
.ops = &eukrea_tlv320_snd_ops,
};
--
1.7.2.3
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH 3/7] ASoC i.MX phycore ac97: remove unnecessary includes
2010-11-04 16:05 [PATCH for -rc] i.MX updates Sascha Hauer
2010-11-04 16:05 ` [PATCH 1/7] ASoC: i.MX31ads: initialize only on correct machine Sascha Hauer
2010-11-04 16:05 ` [PATCH 2/7] ASoC i.MX eukrea tlv320: Fix for multicomponent Sascha Hauer
@ 2010-11-04 16:05 ` Sascha Hauer
2010-11-04 16:05 ` [PATCH 4/7] ASoC i.MX: register dma audio device Sascha Hauer
` (5 subsequent siblings)
8 siblings, 0 replies; 13+ messages in thread
From: Sascha Hauer @ 2010-11-04 16:05 UTC (permalink / raw)
To: alsa-devel; +Cc: Sascha Hauer, Mark Brown, Liam Girdwood
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
sound/soc/imx/phycore-ac97.c | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)
diff --git a/sound/soc/imx/phycore-ac97.c b/sound/soc/imx/phycore-ac97.c
index 6a65dd7..cf46a17 100644
--- a/sound/soc/imx/phycore-ac97.c
+++ b/sound/soc/imx/phycore-ac97.c
@@ -20,9 +20,6 @@
#include <sound/soc-dapm.h>
#include <asm/mach-types.h>
-#include "../codecs/wm9712.h"
-#include "imx-ssi.h"
-
static struct snd_soc_card imx_phycore;
static struct snd_soc_ops imx_phycore_hifi_ops = {
--
1.7.2.3
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH 4/7] ASoC i.MX: register dma audio device
2010-11-04 16:05 [PATCH for -rc] i.MX updates Sascha Hauer
` (2 preceding siblings ...)
2010-11-04 16:05 ` [PATCH 3/7] ASoC i.MX phycore ac97: remove unnecessary includes Sascha Hauer
@ 2010-11-04 16:05 ` Sascha Hauer
2010-11-04 16:05 ` [PATCH 5/7] ASoC i.MX: switch to new DMA api Sascha Hauer
` (4 subsequent siblings)
8 siblings, 0 replies; 13+ messages in thread
From: Sascha Hauer @ 2010-11-04 16:05 UTC (permalink / raw)
To: alsa-devel; +Cc: Sascha Hauer, Mark Brown, Liam Girdwood
We have two different transfer methods on i.MX: FIQ and DMA. Since
the merge of the ASoC multicomponent support the DMA device is lost.
Add it again. Also, imx_ssi_dai_probe has to be called for !AC97
aswell.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
sound/soc/imx/imx-ssi.c | 44 +++++++++++++++++++++++++++++---------------
sound/soc/imx/imx-ssi.h | 1 +
2 files changed, 30 insertions(+), 15 deletions(-)
diff --git a/sound/soc/imx/imx-ssi.c b/sound/soc/imx/imx-ssi.c
index d4bd345..d2d98c7 100644
--- a/sound/soc/imx/imx-ssi.c
+++ b/sound/soc/imx/imx-ssi.c
@@ -439,7 +439,22 @@ void imx_pcm_free(struct snd_pcm *pcm)
}
EXPORT_SYMBOL_GPL(imx_pcm_free);
+static int imx_ssi_dai_probe(struct snd_soc_dai *dai)
+{
+ struct imx_ssi *ssi = dev_get_drvdata(dai->dev);
+ uint32_t val;
+
+ snd_soc_dai_set_drvdata(dai, ssi);
+
+ val = SSI_SFCSR_TFWM0(ssi->dma_params_tx.burstsize) |
+ SSI_SFCSR_RFWM0(ssi->dma_params_rx.burstsize);
+ writel(val, ssi->base + SSI_SFCSR);
+
+ return 0;
+}
+
static struct snd_soc_dai_driver imx_ssi_dai = {
+ .probe = imx_ssi_dai_probe,
.playback = {
.channels_min = 2,
.channels_max = 2,
@@ -455,20 +470,6 @@ static struct snd_soc_dai_driver imx_ssi_dai = {
.ops = &imx_ssi_pcm_dai_ops,
};
-static int imx_ssi_dai_probe(struct snd_soc_dai *dai)
-{
- struct imx_ssi *ssi = dev_get_drvdata(dai->dev);
- uint32_t val;
-
- snd_soc_dai_set_drvdata(dai, ssi);
-
- val = SSI_SFCSR_TFWM0(ssi->dma_params_tx.burstsize) |
- SSI_SFCSR_RFWM0(ssi->dma_params_rx.burstsize);
- writel(val, ssi->base + SSI_SFCSR);
-
- return 0;
-}
-
static struct snd_soc_dai_driver imx_ac97_dai = {
.probe = imx_ssi_dai_probe,
.ac97_control = 1,
@@ -677,7 +678,17 @@ static int imx_ssi_probe(struct platform_device *pdev)
goto failed_register;
}
- ssi->soc_platform_pdev = platform_device_alloc("imx-fiq-pcm-audio", pdev->id);
+ ssi->soc_platform_pdev_fiq = platform_device_alloc("imx-fiq-pcm-audio", pdev->id);
+ if (!ssi->soc_platform_pdev_fiq)
+ goto failed_pdev_fiq_alloc;
+ platform_set_drvdata(ssi->soc_platform_pdev_fiq, ssi);
+ ret = platform_device_add(ssi->soc_platform_pdev_fiq);
+ if (ret) {
+ dev_err(&pdev->dev, "failed to add platform device\n");
+ goto failed_pdev_fiq_add;
+ }
+
+ ssi->soc_platform_pdev = platform_device_alloc("imx-pcm-audio", pdev->id);
if (!ssi->soc_platform_pdev)
goto failed_pdev_alloc;
platform_set_drvdata(ssi->soc_platform_pdev, ssi);
@@ -692,6 +703,9 @@ static int imx_ssi_probe(struct platform_device *pdev)
failed_pdev_add:
platform_device_put(ssi->soc_platform_pdev);
failed_pdev_alloc:
+failed_pdev_fiq_add:
+ platform_device_put(ssi->soc_platform_pdev_fiq);
+failed_pdev_fiq_alloc:
snd_soc_unregister_dai(&pdev->dev);
failed_register:
failed_ac97:
diff --git a/sound/soc/imx/imx-ssi.h b/sound/soc/imx/imx-ssi.h
index 53b780d..4fc17da 100644
--- a/sound/soc/imx/imx-ssi.h
+++ b/sound/soc/imx/imx-ssi.h
@@ -212,6 +212,7 @@ struct imx_ssi {
int enabled;
struct platform_device *soc_platform_pdev;
+ struct platform_device *soc_platform_pdev_fiq;
};
struct snd_soc_platform *imx_ssi_fiq_init(struct platform_device *pdev,
--
1.7.2.3
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH 5/7] ASoC i.MX: switch to new DMA api
2010-11-04 16:05 [PATCH for -rc] i.MX updates Sascha Hauer
` (3 preceding siblings ...)
2010-11-04 16:05 ` [PATCH 4/7] ASoC i.MX: register dma audio device Sascha Hauer
@ 2010-11-04 16:05 ` Sascha Hauer
2010-11-04 16:05 ` [PATCH 6/7] phycore-ac97: add ac97 to cardname Sascha Hauer
` (3 subsequent siblings)
8 siblings, 0 replies; 13+ messages in thread
From: Sascha Hauer @ 2010-11-04 16:05 UTC (permalink / raw)
To: alsa-devel; +Cc: Sascha Hauer, Mark Brown, Liam Girdwood
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
sound/soc/imx/imx-pcm-dma-mx2.c | 221 +++++++++++++++++----------------------
sound/soc/imx/imx-ssi.h | 3 +
2 files changed, 101 insertions(+), 123 deletions(-)
diff --git a/sound/soc/imx/imx-pcm-dma-mx2.c b/sound/soc/imx/imx-pcm-dma-mx2.c
index fd493ee..671ef8d 100644
--- a/sound/soc/imx/imx-pcm-dma-mx2.c
+++ b/sound/soc/imx/imx-pcm-dma-mx2.c
@@ -20,6 +20,7 @@
#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>
@@ -27,165 +28,146 @@
#include <sound/pcm_params.h>
#include <sound/soc.h>
-#include <mach/dma-mx1-mx2.h>
+#include <mach/dma.h>
#include "imx-ssi.h"
struct imx_pcm_runtime_data {
- int sg_count;
- struct scatterlist *sg_list;
- int period;
+ int period_bytes;
int periods;
- unsigned long dma_addr;
int dma;
- struct snd_pcm_substream *substream;
unsigned long offset;
unsigned long size;
- unsigned long period_cnt;
void *buf;
int period_time;
+ struct dma_async_tx_descriptor *desc;
+ struct dma_chan *dma_chan;
+ struct imx_dma_data dma_data;
};
-/* Called by the DMA framework when a period has elapsed */
-static void imx_ssi_dma_progression(int channel, void *data,
- struct scatterlist *sg)
+static void audio_dma_irq(void *data)
{
- struct snd_pcm_substream *substream = data;
+ struct snd_pcm_substream *substream = (struct snd_pcm_substream *)data;
struct snd_pcm_runtime *runtime = substream->runtime;
struct imx_pcm_runtime_data *iprtd = runtime->private_data;
- if (!sg)
- return;
-
- runtime = iprtd->substream->runtime;
+ iprtd->offset += iprtd->period_bytes;
+ iprtd->offset %= iprtd->period_bytes * iprtd->periods;
- iprtd->offset = sg->dma_address - runtime->dma_addr;
-
- snd_pcm_period_elapsed(iprtd->substream);
+ snd_pcm_period_elapsed(substream);
}
-static void imx_ssi_dma_callback(int channel, void *data)
+static bool filter(struct dma_chan *chan, void *param)
{
- pr_err("%s shouldn't be called\n", __func__);
-}
+ struct imx_pcm_runtime_data *iprtd = param;
-static void snd_imx_dma_err_callback(int channel, void *data, int err)
-{
- struct snd_pcm_substream *substream = data;
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct imx_pcm_dma_params *dma_params =
- snd_soc_dai_get_dma_data(rtd->dai->cpu_dai, substream);
- struct snd_pcm_runtime *runtime = substream->runtime;
- struct imx_pcm_runtime_data *iprtd = runtime->private_data;
- int ret;
+ if (!imx_dma_is_general_purpose(chan))
+ return false;
- pr_err("DMA timeout on channel %d -%s%s%s%s\n",
- channel,
- err & IMX_DMA_ERR_BURST ? " burst" : "",
- err & IMX_DMA_ERR_REQUEST ? " request" : "",
- err & IMX_DMA_ERR_TRANSFER ? " transfer" : "",
- err & IMX_DMA_ERR_BUFFER ? " buffer" : "");
+ chan->private = &iprtd->dma_data;
- imx_dma_disable(iprtd->dma);
- ret = imx_dma_setup_sg(iprtd->dma, iprtd->sg_list, iprtd->sg_count,
- IMX_DMA_LENGTH_LOOP, dma_params->dma_addr,
- substream->stream == SNDRV_PCM_STREAM_PLAYBACK ?
- DMA_MODE_WRITE : DMA_MODE_READ);
- if (!ret)
- imx_dma_enable(iprtd->dma);
+ return true;
}
-static int imx_ssi_dma_alloc(struct snd_pcm_substream *substream)
+static int imx_ssi_dma_alloc(struct snd_pcm_substream *substream,
+ struct snd_pcm_hw_params *params)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct imx_pcm_dma_params *dma_params;
struct snd_pcm_runtime *runtime = substream->runtime;
struct imx_pcm_runtime_data *iprtd = runtime->private_data;
+ struct dma_slave_config slave_config;
+ dma_cap_mask_t mask;
+ enum dma_slave_buswidth buswidth;
int ret;
dma_params = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
- iprtd->dma = imx_dma_request_by_prio(DRV_NAME, DMA_PRIO_HIGH);
- if (iprtd->dma < 0) {
- pr_err("Failed to claim the audio DMA\n");
- return -ENODEV;
- }
+ iprtd->dma_data.peripheral_type = IMX_DMATYPE_SSI;
+ iprtd->dma_data.priority = DMA_PRIO_HIGH;
+ iprtd->dma_data.dma_request = dma_params->dma;
- ret = imx_dma_setup_handlers(iprtd->dma,
- imx_ssi_dma_callback,
- snd_imx_dma_err_callback, substream);
- if (ret)
- goto out;
+ /* Try to grab a DMA channel */
+ dma_cap_zero(mask);
+ dma_cap_set(DMA_SLAVE, mask);
+ iprtd->dma_chan = dma_request_channel(mask, filter, iprtd);
+ if (!iprtd->dma_chan)
+ return -EINVAL;
- ret = imx_dma_setup_progression_handler(iprtd->dma,
- imx_ssi_dma_progression);
- if (ret) {
- pr_err("Failed to setup the DMA handler\n");
- goto out;
+ switch (params_format(params)) {
+ case SNDRV_PCM_FORMAT_S16_LE:
+ buswidth = DMA_SLAVE_BUSWIDTH_2_BYTES;
+ break;
+ case SNDRV_PCM_FORMAT_S20_3LE:
+ case SNDRV_PCM_FORMAT_S24_LE:
+ buswidth = DMA_SLAVE_BUSWIDTH_4_BYTES;
+ break;
+ default:
+ return 0;
}
- ret = imx_dma_config_channel(iprtd->dma,
- IMX_DMA_MEMSIZE_16 | IMX_DMA_TYPE_FIFO,
- IMX_DMA_MEMSIZE_32 | IMX_DMA_TYPE_LINEAR,
- dma_params->dma, 1);
- if (ret < 0) {
- pr_err("Cannot configure DMA channel: %d\n", ret);
- goto out;
+ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ slave_config.direction = DMA_TO_DEVICE;
+ slave_config.dst_addr = dma_params->dma_addr;
+ slave_config.dst_addr_width = buswidth;
+ slave_config.dst_maxburst = dma_params->burstsize;
+ } else {
+ slave_config.direction = DMA_FROM_DEVICE;
+ slave_config.src_addr = dma_params->dma_addr;
+ slave_config.src_addr_width = buswidth;
+ slave_config.src_maxburst = dma_params->burstsize;
}
- imx_dma_config_burstlen(iprtd->dma, dma_params->burstsize * 2);
+ ret = dmaengine_slave_config(iprtd->dma_chan, &slave_config);
+ if (ret)
+ return ret;
return 0;
-out:
- imx_dma_free(iprtd->dma);
- return ret;
}
static int snd_imx_pcm_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
+ struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_pcm_runtime *runtime = substream->runtime;
struct imx_pcm_runtime_data *iprtd = runtime->private_data;
- int i;
unsigned long dma_addr;
+ struct dma_chan *chan;
+ struct imx_pcm_dma_params *dma_params;
+ int ret;
- imx_ssi_dma_alloc(substream);
+ dma_params = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
+ ret = imx_ssi_dma_alloc(substream, params);
+ if (ret)
+ return ret;
+ chan = iprtd->dma_chan;
iprtd->size = params_buffer_bytes(params);
iprtd->periods = params_periods(params);
- iprtd->period = params_period_bytes(params);
+ iprtd->period_bytes = params_period_bytes(params);
iprtd->offset = 0;
iprtd->period_time = HZ / (params_rate(params) /
params_period_size(params));
snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer);
- if (iprtd->sg_count != iprtd->periods) {
- kfree(iprtd->sg_list);
-
- iprtd->sg_list = kcalloc(iprtd->periods + 1,
- sizeof(struct scatterlist), GFP_KERNEL);
- if (!iprtd->sg_list)
- return -ENOMEM;
- iprtd->sg_count = iprtd->periods + 1;
- }
-
- sg_init_table(iprtd->sg_list, iprtd->sg_count);
dma_addr = runtime->dma_addr;
- for (i = 0; i < iprtd->periods; i++) {
- iprtd->sg_list[i].page_link = 0;
- iprtd->sg_list[i].offset = 0;
- iprtd->sg_list[i].dma_address = dma_addr;
- iprtd->sg_list[i].length = iprtd->period;
- dma_addr += iprtd->period;
+ iprtd->buf = (unsigned int *)substream->dma_buffer.area;
+
+ iprtd->desc = chan->device->device_prep_dma_cyclic(chan, dma_addr,
+ iprtd->period_bytes * iprtd->periods,
+ iprtd->period_bytes,
+ substream->stream == SNDRV_PCM_STREAM_PLAYBACK ?
+ DMA_TO_DEVICE : DMA_FROM_DEVICE);
+ if (!iprtd->desc) {
+ dev_err(&chan->dev->device, "cannot prepare slave dma\n");
+ return -EINVAL;
}
- /* close the loop */
- iprtd->sg_list[iprtd->sg_count - 1].offset = 0;
- iprtd->sg_list[iprtd->sg_count - 1].length = 0;
- iprtd->sg_list[iprtd->sg_count - 1].page_link =
- ((unsigned long) iprtd->sg_list | 0x01) & ~0x02;
+ iprtd->desc->callback = audio_dma_irq;
+ iprtd->desc->callback_param = substream;
+
return 0;
}
@@ -194,41 +176,21 @@ static int snd_imx_pcm_hw_free(struct snd_pcm_substream *substream)
struct snd_pcm_runtime *runtime = substream->runtime;
struct imx_pcm_runtime_data *iprtd = runtime->private_data;
- if (iprtd->dma >= 0) {
- imx_dma_free(iprtd->dma);
- iprtd->dma = -EINVAL;
+ if (iprtd->dma_chan) {
+ dma_release_channel(iprtd->dma_chan);
+ iprtd->dma_chan = NULL;
}
- kfree(iprtd->sg_list);
- iprtd->sg_list = NULL;
-
return 0;
}
static int snd_imx_pcm_prepare(struct snd_pcm_substream *substream)
{
- struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct imx_pcm_dma_params *dma_params;
- struct imx_pcm_runtime_data *iprtd = runtime->private_data;
- int err;
dma_params = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
- iprtd->substream = substream;
- iprtd->buf = (unsigned int *)substream->dma_buffer.area;
- iprtd->period_cnt = 0;
-
- pr_debug("%s: buf: %p period: %d periods: %d\n",
- __func__, iprtd->buf, iprtd->period, iprtd->periods);
-
- err = imx_dma_setup_sg(iprtd->dma, iprtd->sg_list, iprtd->sg_count,
- IMX_DMA_LENGTH_LOOP, dma_params->dma_addr,
- substream->stream == SNDRV_PCM_STREAM_PLAYBACK ?
- DMA_MODE_WRITE : DMA_MODE_READ);
- if (err)
- return err;
-
return 0;
}
@@ -241,14 +203,14 @@ static int snd_imx_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_RESUME:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
- imx_dma_enable(iprtd->dma);
+ dmaengine_submit(iprtd->desc);
break;
case SNDRV_PCM_TRIGGER_STOP:
case SNDRV_PCM_TRIGGER_SUSPEND:
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
- imx_dma_disable(iprtd->dma);
+ dmaengine_terminate_all(iprtd->dma_chan);
break;
default:
@@ -263,6 +225,9 @@ static snd_pcm_uframes_t snd_imx_pcm_pointer(struct snd_pcm_substream *substream
struct snd_pcm_runtime *runtime = substream->runtime;
struct imx_pcm_runtime_data *iprtd = runtime->private_data;
+ pr_debug("%s: %ld %ld\n", __func__, iprtd->offset,
+ bytes_to_frames(substream->runtime, iprtd->offset));
+
return bytes_to_frames(substream->runtime, iprtd->offset);
}
@@ -279,7 +244,7 @@ static struct snd_pcm_hardware snd_imx_hardware = {
.channels_max = 2,
.buffer_bytes_max = IMX_SSI_DMABUF_SIZE,
.period_bytes_min = 128,
- .period_bytes_max = 16 * 1024,
+ .period_bytes_max = 65535, /* Limited by SDMA engine */
.periods_min = 2,
.periods_max = 255,
.fifo_size = 0,
@@ -304,11 +269,23 @@ static int snd_imx_open(struct snd_pcm_substream *substream)
}
snd_soc_set_runtime_hwparams(substream, &snd_imx_hardware);
+
+ return 0;
+}
+
+static int snd_imx_close(struct snd_pcm_substream *substream)
+{
+ struct snd_pcm_runtime *runtime = substream->runtime;
+ struct imx_pcm_runtime_data *iprtd = runtime->private_data;
+
+ kfree(iprtd);
+
return 0;
}
static struct snd_pcm_ops imx_pcm_ops = {
.open = snd_imx_open,
+ .close = snd_imx_close,
.ioctl = snd_pcm_lib_ioctl,
.hw_params = snd_imx_pcm_hw_params,
.hw_free = snd_imx_pcm_hw_free,
@@ -340,7 +317,6 @@ static struct platform_driver imx_pcm_driver = {
.name = "imx-pcm-audio",
.owner = THIS_MODULE,
},
-
.probe = imx_soc_platform_probe,
.remove = __devexit_p(imx_soc_platform_remove),
};
@@ -356,4 +332,3 @@ static void __exit snd_imx_pcm_exit(void)
platform_driver_unregister(&imx_pcm_driver);
}
module_exit(snd_imx_pcm_exit);
-
diff --git a/sound/soc/imx/imx-ssi.h b/sound/soc/imx/imx-ssi.h
index 4fc17da..a4406a1 100644
--- a/sound/soc/imx/imx-ssi.h
+++ b/sound/soc/imx/imx-ssi.h
@@ -185,6 +185,9 @@
#define DRV_NAME "imx-ssi"
+#include <linux/dmaengine.h>
+#include <mach/dma.h>
+
struct imx_pcm_dma_params {
int dma;
unsigned long dma_addr;
--
1.7.2.3
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH 6/7] phycore-ac97: add ac97 to cardname
2010-11-04 16:05 [PATCH for -rc] i.MX updates Sascha Hauer
` (4 preceding siblings ...)
2010-11-04 16:05 ` [PATCH 5/7] ASoC i.MX: switch to new DMA api Sascha Hauer
@ 2010-11-04 16:05 ` Sascha Hauer
2010-11-04 16:05 ` [PATCH 7/7] ASoC: i.MX: we can do mono Sascha Hauer
` (2 subsequent siblings)
8 siblings, 0 replies; 13+ messages in thread
From: Sascha Hauer @ 2010-11-04 16:05 UTC (permalink / raw)
To: alsa-devel; +Cc: Sascha Hauer, Mark Brown, Liam Girdwood
We have different codecs on the pcm038 (ac97 wm9712 and mc13783).
To make alsactl restore work correctly these should have different
names.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
sound/soc/imx/phycore-ac97.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/sound/soc/imx/phycore-ac97.c b/sound/soc/imx/phycore-ac97.c
index cf46a17..39f2373 100644
--- a/sound/soc/imx/phycore-ac97.c
+++ b/sound/soc/imx/phycore-ac97.c
@@ -38,7 +38,7 @@ static struct snd_soc_dai_link imx_phycore_dai_ac97[] = {
};
static struct snd_soc_card imx_phycore = {
- .name = "PhyCORE-audio",
+ .name = "PhyCORE-ac97-audio",
.dai_link = imx_phycore_dai_ac97,
.num_links = ARRAY_SIZE(imx_phycore_dai_ac97),
};
--
1.7.2.3
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH 7/7] ASoC: i.MX: we can do mono
2010-11-04 16:05 [PATCH for -rc] i.MX updates Sascha Hauer
` (5 preceding siblings ...)
2010-11-04 16:05 ` [PATCH 6/7] phycore-ac97: add ac97 to cardname Sascha Hauer
@ 2010-11-04 16:05 ` Sascha Hauer
2010-11-05 8:28 ` [PATCH for -rc] i.MX updates Liam Girdwood
2010-11-05 13:17 ` Mark Brown
8 siblings, 0 replies; 13+ messages in thread
From: Sascha Hauer @ 2010-11-04 16:05 UTC (permalink / raw)
To: alsa-devel; +Cc: Sascha Hauer, Mark Brown, Liam Girdwood
Whether we can do mono or not depends on the codec. No need
to limit this in the ssi driver.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
sound/soc/imx/imx-ssi.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/imx/imx-ssi.c b/sound/soc/imx/imx-ssi.c
index d2d98c7..ad21f81 100644
--- a/sound/soc/imx/imx-ssi.c
+++ b/sound/soc/imx/imx-ssi.c
@@ -456,13 +456,13 @@ static int imx_ssi_dai_probe(struct snd_soc_dai *dai)
static struct snd_soc_dai_driver imx_ssi_dai = {
.probe = imx_ssi_dai_probe,
.playback = {
- .channels_min = 2,
+ .channels_min = 1,
.channels_max = 2,
.rates = SNDRV_PCM_RATE_8000_96000,
.formats = SNDRV_PCM_FMTBIT_S16_LE,
},
.capture = {
- .channels_min = 2,
+ .channels_min = 1,
.channels_max = 2,
.rates = SNDRV_PCM_RATE_8000_96000,
.formats = SNDRV_PCM_FMTBIT_S16_LE,
--
1.7.2.3
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [PATCH for -rc] i.MX updates
2010-11-04 16:05 [PATCH for -rc] i.MX updates Sascha Hauer
` (6 preceding siblings ...)
2010-11-04 16:05 ` [PATCH 7/7] ASoC: i.MX: we can do mono Sascha Hauer
@ 2010-11-05 8:28 ` Liam Girdwood
2010-11-05 13:17 ` Mark Brown
8 siblings, 0 replies; 13+ messages in thread
From: Liam Girdwood @ 2010-11-05 8:28 UTC (permalink / raw)
To: Sascha Hauer; +Cc: alsa-devel, Mark Brown
On Thu, 2010-11-04 at 17:05 +0100, Sascha Hauer wrote:
> Hi,
>
> The following series has some multicomponent fixes for i.MX. Also, since
> the SDMA driver is merged, we also switch the i.MX DMA driver to the new API.
>
> Sascha
>
I'm fine with this too after Mark's comments have been addressed.
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
--
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH for -rc] i.MX updates
2010-11-04 16:05 [PATCH for -rc] i.MX updates Sascha Hauer
` (7 preceding siblings ...)
2010-11-05 8:28 ` [PATCH for -rc] i.MX updates Liam Girdwood
@ 2010-11-05 13:17 ` Mark Brown
8 siblings, 0 replies; 13+ messages in thread
From: Mark Brown @ 2010-11-05 13:17 UTC (permalink / raw)
To: Sascha Hauer; +Cc: alsa-devel, Liam Girdwood
On Thu, Nov 04, 2010 at 05:05:38PM +0100, Sascha Hauer wrote:
> ASoC i.MX eukrea tlv320: Fix for multicomponent
> ASoC i.MX phycore ac97: remove unnecessary includes
> ASoC i.MX: register dma audio device
> ASoC i.MX: switch to new DMA api
> phycore-ac97: add ac97 to cardname
Applied these for 2.6.37.
> ASoC: i.MX: we can do mono
And this for 2.6.38, thanks!
^ permalink raw reply [flat|nested] 13+ messages in thread