Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Nicolin Chen <b42378@freescale.com>
To: Lars-Peter Clausen <lars@metafoo.de>
Cc: tiwai@suse.de, alsa-devel@alsa-project.org, broonie@kernel.org,
	lgirdwood@gmail.com
Subject: Re: [PATCH 1/2] ALSA: Add SoC on-chip internal memory support for DMA buffer allocation
Date: Wed, 16 Oct 2013 16:48:45 +0800	[thread overview]
Message-ID: <20131016084844.GA24805@MrMyself> (raw)
In-Reply-To: <525E5467.5090301@metafoo.de>

Hi Lars,

On Wed, Oct 16, 2013 at 10:55:03AM +0200, Lars-Peter Clausen wrote:
> > +void *snd_malloc_dev_iram(struct device *dev, size_t size, dma_addr_t *dma)
> > +{
> > +	struct gen_pool *pool = of_get_named_gen_pool(dev->of_node, "iram", 0);
> 
> dev will be the dma controller device not the audio controller device. This
> means the iram property needs to be specified on dma controller node and
> will be shared by all users of that controller. Is this the intention?

True.

> Also I think you need to check whether of_node is NULL before passing it to
> of_get_named_gen_pool.

Oh, you're right.

> 
> > +	unsigned long vaddr;
> > +
> > +	if (!pool)
> > +		return NULL;
> > +
> > +	vaddr = gen_pool_alloc(pool, size);
> > +	if (!vaddr)
> > +		return NULL;
> > +
> > +	if (dma)
> 
> This check will always be true.

I'll drop it and below as well.

Thank you.
Nicolin Chen

> 
> > +		*dma = gen_pool_virt_to_phys(pool, vaddr);
> > +
> > +	return (void *)vaddr;
> > +}
> > +
> > +/**
> > + * snd_free_dev_iram - free allocated specific memory from on-chip internal memory
> > + * @dev: DMA device pointer
> > + * @size: size in bytes of memory to free
> > + * @ptr: cpu-view address returned from snd_malloc_dev_iram
> > + * @dma: dma-view address returned from snd_malloc_dev_iram
> > + *
> > + * This function requires iram phandle provided via of_node
> > + */
> > +void snd_free_dev_iram(struct device *dev, size_t size, void *ptr, dma_addr_t dma)
> > +{
> > +	struct gen_pool *pool = of_get_named_gen_pool(dev->of_node, "iram", 0);
> > +	if (!pool)
> > +		return;
> > +
> > +	gen_pool_free(pool, (unsigned long)ptr, size);
> > +
> > +	ptr = NULL;
> 
> This ...
> 
> > +
> > +	if (dma)
> > +		dma = 0;
> 
> ... and this assignment are noops
> 
> > +}
> > +#endif /* CONFIG_OF */
> >  #endif /* CONFIG_HAS_DMA */
> 

      reply	other threads:[~2013-10-16  9:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-16  8:18 [PATCH 1/2] ALSA: Add SoC on-chip internal memory support for DMA buffer allocation Nicolin Chen
2013-10-16  8:18 ` [PATCH 2/2] ASoC: generic-dmaengine-pcm: Support on-chip internal memory for DMA buffer Nicolin Chen
2013-10-16  8:56   ` Lars-Peter Clausen
2013-10-16  8:51     ` Nicolin Chen
2013-10-16  8:55 ` [PATCH 1/2] ALSA: Add SoC on-chip internal memory support for DMA buffer allocation Lars-Peter Clausen
2013-10-16  8:48   ` Nicolin Chen [this message]

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=20131016084844.GA24805@MrMyself \
    --to=b42378@freescale.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=lars@metafoo.de \
    --cc=lgirdwood@gmail.com \
    --cc=tiwai@suse.de \
    /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