All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: rcar: remove original filter from rsnd_dma_init()
@ 2013-10-29  7:52 Kuninori Morimoto
  2013-10-29  8:30 ` Lars-Peter Clausen
  2013-10-29 16:30 ` Mark Brown
  0 siblings, 2 replies; 4+ messages in thread
From: Kuninori Morimoto @ 2013-10-29  7:52 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Simon, Liam Girdwood, Kuninori Morimoto

Remove original filter from rsnd_dma_init(),
and use SH-DMA suitable filter.
This new style can be used from Device Tree.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/sh/rcar/core.c |   31 ++++++++++++++++++++-----------
 1 file changed, 20 insertions(+), 11 deletions(-)

diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index c3d7544..1f53563 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -94,6 +94,7 @@
  *
  */
 #include <linux/pm_runtime.h>
+#include <linux/shdma-base.h>
 #include "rsnd.h"
 
 #define RSND_RATES SNDRV_PCM_RATE_8000_96000
@@ -253,13 +254,6 @@ int rsnd_dma_available(struct rsnd_dma *dma)
 	return !!dma->chan;
 }
 
-static bool rsnd_dma_filter(struct dma_chan *chan, void *param)
-{
-	chan->private = param;
-
-	return true;
-}
-
 int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma,
 		  int is_play, int id,
 		  int (*inquiry)(struct rsnd_dma *dma,
@@ -267,7 +261,9 @@ int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma,
 		  int (*complete)(struct rsnd_dma *dma))
 {
 	struct device *dev = rsnd_priv_to_dev(priv);
+	struct dma_slave_config cfg;
 	dma_cap_mask_t mask;
+	int ret;
 
 	if (dma->chan) {
 		dev_err(dev, "it already has dma channel\n");
@@ -277,15 +273,23 @@ int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma,
 	dma_cap_zero(mask);
 	dma_cap_set(DMA_SLAVE, mask);
 
-	dma->slave.shdma_slave.slave_id = id;
-
-	dma->chan = dma_request_channel(mask, rsnd_dma_filter,
-					&dma->slave.shdma_slave);
+	dma->chan = dma_request_slave_channel_compat(mask, shdma_chan_filter,
+						     (void *)id, dev,
+						     is_play ? "tx" : "rx");
 	if (!dma->chan) {
 		dev_err(dev, "can't get dma channel\n");
 		return -EIO;
 	}
 
+	cfg.slave_id	= id;
+	cfg.dst_addr	= 0; /* use default addr when playback */
+	cfg.src_addr	= 0; /* use default addr when capture */
+	cfg.direction	= is_play ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
+
+	ret = dmaengine_slave_config(dma->chan, &cfg);
+	if (ret < 0)
+		goto rsnd_dma_init_err;
+
 	dma->dir = is_play ? DMA_TO_DEVICE : DMA_FROM_DEVICE;
 	dma->priv = priv;
 	dma->inquiry = inquiry;
@@ -293,6 +297,11 @@ int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma,
 	INIT_WORK(&dma->work, rsnd_dma_do_work);
 
 	return 0;
+
+rsnd_dma_init_err:
+	rsnd_dma_quit(priv, dma);
+
+	return ret;
 }
 
 void  rsnd_dma_quit(struct rsnd_priv *priv,
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ASoC: rcar: remove original filter from rsnd_dma_init()
  2013-10-29  7:52 [PATCH] ASoC: rcar: remove original filter from rsnd_dma_init() Kuninori Morimoto
@ 2013-10-29  8:30 ` Lars-Peter Clausen
  2013-10-29  9:56   ` Kuninori Morimoto
  2013-10-29 16:30 ` Mark Brown
  1 sibling, 1 reply; 4+ messages in thread
From: Lars-Peter Clausen @ 2013-10-29  8:30 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Linux-ALSA, Mark Brown, Liam Girdwood, Simon, Kuninori Morimoto

On 10/29/2013 08:52 AM, Kuninori Morimoto wrote:
> Remove original filter from rsnd_dma_init(),
> and use SH-DMA suitable filter.
> This new style can be used from Device Tree.
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
[...]
> +	dma->chan = dma_request_slave_channel_compat(mask, shdma_chan_filter,
> +						     (void *)id, dev,
> +						     is_play ? "tx" : "rx");
[...]

Just wondering, do you still need to support the non-DT case in your driver?

- Lars

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ASoC: rcar: remove original filter from rsnd_dma_init()
  2013-10-29  8:30 ` Lars-Peter Clausen
@ 2013-10-29  9:56   ` Kuninori Morimoto
  0 siblings, 0 replies; 4+ messages in thread
From: Kuninori Morimoto @ 2013-10-29  9:56 UTC (permalink / raw)
  To: Lars-Peter Clausen
  Cc: Linux-ALSA, Mark Brown, Liam Girdwood, Simon, Kuninori Morimoto


Hi Lars

> > Remove original filter from rsnd_dma_init(),
> > and use SH-DMA suitable filter.
> > This new style can be used from Device Tree.
> > 
> > Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> > ---
> [...]
> > +	dma->chan = dma_request_slave_channel_compat(mask, shdma_chan_filter,
> > +						     (void *)id, dev,
> > +						     is_play ? "tx" : "rx");
> [...]
> 
> Just wondering, do you still need to support the non-DT case in your driver?

Yes.
Actually our platform is still not 100% DT compatible yet.
So, we need DT / non-DT support


Best regards
---
Kuninori Morimoto

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ASoC: rcar: remove original filter from rsnd_dma_init()
  2013-10-29  7:52 [PATCH] ASoC: rcar: remove original filter from rsnd_dma_init() Kuninori Morimoto
  2013-10-29  8:30 ` Lars-Peter Clausen
@ 2013-10-29 16:30 ` Mark Brown
  1 sibling, 0 replies; 4+ messages in thread
From: Mark Brown @ 2013-10-29 16:30 UTC (permalink / raw)
  To: Kuninori Morimoto; +Cc: Linux-ALSA, Simon, Liam Girdwood, Kuninori Morimoto


[-- Attachment #1.1: Type: text/plain, Size: 213 bytes --]

On Tue, Oct 29, 2013 at 12:52:19AM -0700, Kuninori Morimoto wrote:
> Remove original filter from rsnd_dma_init(),
> and use SH-DMA suitable filter.
> This new style can be used from Device Tree.

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] 4+ messages in thread

end of thread, other threads:[~2013-10-29 16:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-29  7:52 [PATCH] ASoC: rcar: remove original filter from rsnd_dma_init() Kuninori Morimoto
2013-10-29  8:30 ` Lars-Peter Clausen
2013-10-29  9:56   ` Kuninori Morimoto
2013-10-29 16:30 ` 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.