linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: rizhao@nvidia.com (Richard Zhao)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 7/9] ASoC: tegra: move to generic DMA DT binding
Date: Tue, 30 Jul 2013 18:12:23 +0800	[thread overview]
Message-ID: <20130730101221.GO15855@rizhao-lap> (raw)
In-Reply-To: <51F2D4DD.9060308@wwwdotorg.org>

On Sat, Jul 27, 2013 at 03:58:21AM +0800, Stephen Warren wrote:
> On 07/23/2013 10:10 PM, Richard Zhao wrote:
> > - add tegra_dma_filter_data to specify dma info
> >   DMA DT binding needs the device that raise dma request and dma name
> >   to request a dma channel. tegra30_i2s is a special case. It should be ahub
> >   device and it also has dma name that cannot handled by ASoC dmaengine code.
> >   So we pass the info using filter data in snd_dmaengine_dai_dma_data.
> > - change i2s/ac97 drivers to use generic DT binding
> > - tegra30_i2s: alloc ahub tx/rx fifo at driver probe time
> 
> > diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c
> 
> I don't understand why the FIFO alloc/free had to move from
> startup()/shutdown() to probe()/remove().

The call path is:
[<c0520e38>] (dump_stack+0x78/0xbc) from [<c03bb854>] (tegra_pcm_request_chan+0x10/0x34)
[<c03bb854>] (tegra_pcm_request_chan+0x10/0x34) from [<c03b6c2c>] (dmaengine_pcm_new+0xe0/0x134)
[<c03b6c2c>] (dmaengine_pcm_new+0xe0/0x134) from [<c03b5824>] (soc_new_pcm+0x2f0/0x3cc)
[<c03b5824>] (soc_new_pcm+0x2f0/0x3cc) from [<c03aa1a0>] (soc_probe_link_dais+0x358/0x39c)
[<c03aa1a0>] (soc_probe_link_dais+0x358/0x39c) from [<c03ab334>] (snd_soc_instantiate_card+0x35c/0x7a0)
[<c03ab334>] (snd_soc_instantiate_card+0x35c/0x7a0) from [<c03ab9dc>] (snd_soc_register_card+0x264/0x330)
[<c03ab9dc>] (snd_soc_register_card+0x264/0x330) from [<c03be350>] (tegra_rt5640_probe+0xf4/0x17c)
[<c03be350>] (tegra_rt5640_probe+0xf4/0x17c) from [<c0294290>] (platform_drv_probe+0x18/0x1c)

So I need to request dma channel at probe time.

> This will prevent later
> changes from making the connectivity between the AHUB FIFOs and I2S
> modules more dynamic, which is kind of the whole point of the AHUB HW
> module.

That's because it's i2s driver to register pcm device rather not ahub.
Ideally dma channel is only bound to ahub.
> 
> > diff --git a/sound/soc/tegra/tegra_pcm.h b/sound/soc/tegra/tegra_pcm.h
> 
> > +#define TEGRA_DMA_NAME_MAX_LEN	10
> > +
> > +/*
> > + * Generic DMA DT binding needs the device that raise dma request and dma name
> > + * to request a dma channel. tegra30_i2s is a special case. It should be ahub
> > + * device and it also has dma name that cannot handled by ASoC dmaengine code.
> > + * So we pass the info using filter data in snd_dmaengine_dai_dma_data.
> > + */
> > +struct tegra_dma_filter_data {
> > +	struct device *dma_dev;
> > +	char dma_name[TEGRA_DMA_NAME_MAX_LEN];
> > +};
> 
> I agree with Lars-Peter's comment that it'd be better to enhance the
> ASoC dmaengine support to allow the channel name to be specified so we
> don't need to much custom code.

Not only dma-name but also dma client device for this case.

> And that should use "char *" not a
> fixed-length array.
Ok, then there' two solutions.

struct tegra30_i2s {
...
        struct snd_dmaengine_dai_dma_data capture_dma_data;
        char dma_rx_name[10];
        struct tegra_dma_filter_data filter_data_rx;
...
        struct snd_dmaengine_dai_dma_data playback_dma_data;
        char dma_tx_name[10];
        struct tegra_dma_filter_data filter_data_tx;
};

probe: i2s->filter_data_rx.dma_name = i2s.dma_rx_name

or

probe: i2s->filter_data_rx.dma_name = kasprintf(GFP_KERNEL, "channel%d" ...);
remove: kfree(i2s->filter_data_rx.dma.name)

Which one do you like?


Thanks for review!
Richard

  reply	other threads:[~2013-07-30 10:12 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-24  4:09 [PATCH 0/9] ARM: tegra: move to generic DMA DT binding Richard Zhao
2013-07-24  4:09 ` [PATCH 1/9] ARM: dts: add generic DMA DT binding for tegra apbdma Richard Zhao
2013-07-26 19:21   ` Stephen Warren
2013-07-30  2:54     ` Richard Zhao
2013-07-30 16:49       ` Stephen Warren
2013-08-01  2:49         ` Richard Zhao
2013-07-24  4:09 ` [PATCH 2/9] dma: tegra20-apbdma: move to generic device tree bindings Richard Zhao
2013-07-26 19:27   ` Stephen Warren
2013-07-30  3:06     ` Richard Zhao
2013-07-30 16:44       ` Stephen Warren
2013-07-31  3:52         ` Richard Zhao
2013-07-31 21:33           ` Stephen Warren
2013-07-24  4:09 ` [PATCH 3/9] spi: tegra114: move to generic dma DT binding Richard Zhao
2013-07-26 19:34   ` Stephen Warren
2013-07-30  3:15     ` Richard Zhao
2013-07-30 16:44       ` Stephen Warren
2013-07-24  4:09 ` [PATCH 4/9] spi: tegra20-slink: " Richard Zhao
2013-07-24  4:09 ` [PATCH 5/9] spi: tegra20-sflash: " Richard Zhao
2013-07-26 19:36   ` Stephen Warren
2013-07-30  3:16     ` Richard Zhao
2013-07-24  4:09 ` [PATCH 6/9] serial: tegra: " Richard Zhao
2013-07-26 19:39   ` Stephen Warren
2013-07-26 19:41     ` Stephen Warren
2013-07-30  3:31     ` Richard Zhao
2013-07-30 16:46       ` Stephen Warren
2013-07-31  3:45         ` Richard Zhao
2013-07-31 21:32           ` Stephen Warren
2013-08-01  3:30             ` Richard Zhao
2013-08-01  3:45               ` Stephen Warren
2013-07-24  4:10 ` [PATCH 7/9] ASoC: tegra: move to generic DMA " Richard Zhao
2013-07-24  6:58   ` Lars-Peter Clausen
2013-07-26 19:58   ` Stephen Warren
2013-07-30 10:12     ` Richard Zhao [this message]
2013-07-30 16:54       ` Stephen Warren
2013-07-24  4:10 ` [PATCH 8/9] ARM: dts: tegra: remove legacy nvidia, dma-request-selector properties Richard Zhao
2013-07-26 19:59   ` Stephen Warren
2013-07-30 10:16     ` [PATCH 8/9] ARM: dts: tegra: remove legacy nvidia,dma-request-selector properties Richard Zhao
2013-07-24  4:10 ` [PATCH 9/9] dma: tegra20-apbdma: remove legacy nvidia, dma-request-selector support Richard Zhao
2013-07-26 19:25 ` [PATCH 0/9] ARM: tegra: move to generic DMA DT binding Stephen Warren

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=20130730101221.GO15855@rizhao-lap \
    --to=rizhao@nvidia.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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).