From: Anton Vorontsov <avorontsov@ru.mvista.com>
To: Grant Likely <grant.likely@secretlab.ca>
Cc: Becky Bruce <Becky.Bruce@freescale.com>,
alsa-devel@alsa-project.org,
Mark Brown <broonie@opensource.wolfsonmicro.com>,
linuxppc-dev@ozlabs.org, Timur Tabi <timur@freescale.com>,
Liam Girdwood <lrg@slimlogic.co.uk>
Subject: Re: [PATCH] ASoC: fsl_dma: Pass the proper device for dma mapping routines
Date: Sun, 5 Apr 2009 12:52:43 +0400 [thread overview]
Message-ID: <20090405085243.GA16005@oksana.dev.rtsoft.ru> (raw)
In-Reply-To: <fa686aa40904042259h4c69e632x47a9e82393e8faef@mail.gmail.com>
On Sat, Apr 04, 2009 at 11:59:39PM -0600, Grant Likely wrote:
> Becky & Kumar,
>
> Considering these fixups, would it be advisable for the dma functions
> to climb up the dev->parent linkage when dma_ops are NULL?
pcm->dev->parent doesn't point to the proper device, so
this won't work.
> On Sat, Apr 4, 2009 at 12:33 PM, Anton Vorontsov
> <avorontsov@ru.mvista.com> wrote:
> > The driver should pass a device that specifies internal DMA ops, but
> > substream->pcm is just a logical device, and thus doesn't have arch-
> > specific dma callbacks, therefore following bug appears:
> >
> > Freescale Synchronous Serial Interface (SSI) ASoC Driver
> > ------------[ cut here ]------------
> > kernel BUG at arch/powerpc/include/asm/dma-mapping.h:237!
> > Oops: Exception in kernel mode, sig: 5 [#1]
> > ...
> > NIP [c02259c4] snd_malloc_dev_pages+0x58/0xac
> > LR [c0225c74] snd_dma_alloc_pages+0xf8/0x108
> > Call Trace:
> > [df02bde0] [df02be2c] 0xdf02be2c (unreliable)
> > [df02bdf0] [c0225c74] snd_dma_alloc_pages+0xf8/0x108
> > [df02be10] [c023a100] fsl_dma_new+0x68/0x124
> > [df02be20] [c02342ac] soc_new_pcm+0x1bc/0x234
> > [df02bea0] [c02343dc] snd_soc_new_pcms+0xb8/0x148
> > [df02bed0] [c023824c] cs4270_probe+0x34/0x124
> > [df02bef0] [c0232fe8] snd_soc_instantiate_card+0x1a4/0x2f4
> > [df02bf20] [c0233164] snd_soc_instantiate_cards+0x2c/0x68
> > [df02bf30] [c0234704] snd_soc_register_platform+0x60/0x80
> > [df02bf50] [c03d5664] fsl_soc_platform_init+0x18/0x28
> > ...
> >
> > This patch fixes the issue by using card's device instead.
> >
> > Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
> > ---
> > sound/soc/fsl/fsl_dma.c | 12 ++++++------
> > 1 files changed, 6 insertions(+), 6 deletions(-)
> >
> > diff --git a/sound/soc/fsl/fsl_dma.c b/sound/soc/fsl/fsl_dma.c
> > index b3eb857..835e43c 100644
> > --- a/sound/soc/fsl/fsl_dma.c
> > +++ b/sound/soc/fsl/fsl_dma.c
> > @@ -300,7 +300,7 @@ static int fsl_dma_new(struct snd_card *card, struct snd_soc_dai *dai,
> > if (!card->dev->coherent_dma_mask)
> > card->dev->coherent_dma_mask = fsl_dma_dmamask;
> >
> > - ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, pcm->dev,
> > + ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, card->dev,
> > fsl_dma_hardware.buffer_bytes_max,
> > &pcm->streams[0].substream->dma_buffer);
> > if (ret) {
> > @@ -310,7 +310,7 @@ static int fsl_dma_new(struct snd_card *card, struct snd_soc_dai *dai,
> > return -ENOMEM;
> > }
> >
> > - ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, pcm->dev,
> > + ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, card->dev,
> > fsl_dma_hardware.buffer_bytes_max,
> > &pcm->streams[1].substream->dma_buffer);
> > if (ret) {
> > @@ -418,7 +418,7 @@ static int fsl_dma_open(struct snd_pcm_substream *substream)
> > return -EBUSY;
> > }
> >
> > - dma_private = dma_alloc_coherent(substream->pcm->dev,
> > + dma_private = dma_alloc_coherent(substream->pcm->card->dev,
> > sizeof(struct fsl_dma_private), &ld_buf_phys, GFP_KERNEL);
> > if (!dma_private) {
> > dev_err(substream->pcm->card->dev,
> > @@ -445,7 +445,7 @@ static int fsl_dma_open(struct snd_pcm_substream *substream)
> > dev_err(substream->pcm->card->dev,
> > "can't register ISR for IRQ %u (ret=%i)\n",
> > dma_private->irq, ret);
> > - dma_free_coherent(substream->pcm->dev,
> > + dma_free_coherent(substream->pcm->card->dev,
> > sizeof(struct fsl_dma_private),
> > dma_private, dma_private->ld_buf_phys);
> > return ret;
> > @@ -761,13 +761,13 @@ static int fsl_dma_close(struct snd_pcm_substream *substream)
> > free_irq(dma_private->irq, dma_private);
> >
> > if (dma_private->ld_buf_phys) {
> > - dma_unmap_single(substream->pcm->dev,
> > + dma_unmap_single(substream->pcm->card->dev,
> > dma_private->ld_buf_phys,
> > sizeof(dma_private->link), DMA_TO_DEVICE);
> > }
> >
> > /* Deallocate the fsl_dma_private structure */
> > - dma_free_coherent(substream->pcm->dev,
> > + dma_free_coherent(substream->pcm->card->dev,
> > sizeof(struct fsl_dma_private),
> > dma_private, dma_private->ld_buf_phys);
> > substream->runtime->private_data = NULL;
> > --
> > 1.5.6.5
> > _______________________________________________
> > Linuxppc-dev mailing list
> > Linuxppc-dev@ozlabs.org
> > https://ozlabs.org/mailman/listinfo/linuxppc-dev
> >
>
>
>
> --
> Grant Likely, B.Sc., P.Eng.
> Secret Lab Technologies Ltd.
--
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2
next prev parent reply other threads:[~2009-04-05 8:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-04 18:33 [PATCH] ASoC: fsl_dma: Pass the proper device for dma mapping routines Anton Vorontsov
2009-04-05 5:59 ` Grant Likely
2009-04-05 8:52 ` Anton Vorontsov [this message]
2009-04-05 14:39 ` Grant Likely
2009-04-05 14:59 ` Kumar Gala
2009-04-05 19:18 ` Timur Tabi
2009-04-06 21:06 ` Timur Tabi
2009-04-06 22:38 ` [alsa-devel] " Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090405085243.GA16005@oksana.dev.rtsoft.ru \
--to=avorontsov@ru.mvista.com \
--cc=Becky.Bruce@freescale.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=grant.likely@secretlab.ca \
--cc=linuxppc-dev@ozlabs.org \
--cc=lrg@slimlogic.co.uk \
--cc=timur@freescale.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).