diff options
author | Mark Brown <broonie@linaro.org> | 2013-11-04 01:04:19 -0500 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-11-04 01:04:19 -0500 |
commit | 97fa413305bf04a9c43c032099d1254455a997b3 (patch) | |
tree | 166e54f56cea5089b90e6d9359282835d4d865e2 /sound/soc/sh | |
parent | 07ad822c213d2d0d1a9c26fd06c85a60f62c194d (diff) | |
parent | 9ade09d6c62e48fba6c74ce3958ca1035dfd8427 (diff) |
Merge remote-tracking branch 'asoc/topic/rcar' into asoc-next
Diffstat (limited to 'sound/soc/sh')
-rw-r--r-- | sound/soc/sh/rcar/core.c | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c index b234ed663073..78c35b44fc04 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c | |||
@@ -94,6 +94,7 @@ | |||
94 | * | 94 | * |
95 | */ | 95 | */ |
96 | #include <linux/pm_runtime.h> | 96 | #include <linux/pm_runtime.h> |
97 | #include <linux/shdma-base.h> | ||
97 | #include "rsnd.h" | 98 | #include "rsnd.h" |
98 | 99 | ||
99 | #define RSND_RATES SNDRV_PCM_RATE_8000_96000 | 100 | #define RSND_RATES SNDRV_PCM_RATE_8000_96000 |
@@ -209,13 +210,6 @@ int rsnd_dma_available(struct rsnd_dma *dma) | |||
209 | return !!dma->chan; | 210 | return !!dma->chan; |
210 | } | 211 | } |
211 | 212 | ||
212 | static bool rsnd_dma_filter(struct dma_chan *chan, void *param) | ||
213 | { | ||
214 | chan->private = param; | ||
215 | |||
216 | return true; | ||
217 | } | ||
218 | |||
219 | int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma, | 213 | int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma, |
220 | int is_play, int id, | 214 | int is_play, int id, |
221 | int (*inquiry)(struct rsnd_dma *dma, | 215 | int (*inquiry)(struct rsnd_dma *dma, |
@@ -223,7 +217,9 @@ int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma, | |||
223 | int (*complete)(struct rsnd_dma *dma)) | 217 | int (*complete)(struct rsnd_dma *dma)) |
224 | { | 218 | { |
225 | struct device *dev = rsnd_priv_to_dev(priv); | 219 | struct device *dev = rsnd_priv_to_dev(priv); |
220 | struct dma_slave_config cfg; | ||
226 | dma_cap_mask_t mask; | 221 | dma_cap_mask_t mask; |
222 | int ret; | ||
227 | 223 | ||
228 | if (dma->chan) { | 224 | if (dma->chan) { |
229 | dev_err(dev, "it already has dma channel\n"); | 225 | dev_err(dev, "it already has dma channel\n"); |
@@ -233,15 +229,23 @@ int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma, | |||
233 | dma_cap_zero(mask); | 229 | dma_cap_zero(mask); |
234 | dma_cap_set(DMA_SLAVE, mask); | 230 | dma_cap_set(DMA_SLAVE, mask); |
235 | 231 | ||
236 | dma->slave.shdma_slave.slave_id = id; | 232 | dma->chan = dma_request_slave_channel_compat(mask, shdma_chan_filter, |
237 | 233 | (void *)id, dev, | |
238 | dma->chan = dma_request_channel(mask, rsnd_dma_filter, | 234 | is_play ? "tx" : "rx"); |
239 | &dma->slave.shdma_slave); | ||
240 | if (!dma->chan) { | 235 | if (!dma->chan) { |
241 | dev_err(dev, "can't get dma channel\n"); | 236 | dev_err(dev, "can't get dma channel\n"); |
242 | return -EIO; | 237 | return -EIO; |
243 | } | 238 | } |
244 | 239 | ||
240 | cfg.slave_id = id; | ||
241 | cfg.dst_addr = 0; /* use default addr when playback */ | ||
242 | cfg.src_addr = 0; /* use default addr when capture */ | ||
243 | cfg.direction = is_play ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM; | ||
244 | |||
245 | ret = dmaengine_slave_config(dma->chan, &cfg); | ||
246 | if (ret < 0) | ||
247 | goto rsnd_dma_init_err; | ||
248 | |||
245 | dma->dir = is_play ? DMA_TO_DEVICE : DMA_FROM_DEVICE; | 249 | dma->dir = is_play ? DMA_TO_DEVICE : DMA_FROM_DEVICE; |
246 | dma->priv = priv; | 250 | dma->priv = priv; |
247 | dma->inquiry = inquiry; | 251 | dma->inquiry = inquiry; |
@@ -249,6 +253,11 @@ int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma, | |||
249 | INIT_WORK(&dma->work, rsnd_dma_do_work); | 253 | INIT_WORK(&dma->work, rsnd_dma_do_work); |
250 | 254 | ||
251 | return 0; | 255 | return 0; |
256 | |||
257 | rsnd_dma_init_err: | ||
258 | rsnd_dma_quit(priv, dma); | ||
259 | |||
260 | return ret; | ||
252 | } | 261 | } |
253 | 262 | ||
254 | void rsnd_dma_quit(struct rsnd_priv *priv, | 263 | void rsnd_dma_quit(struct rsnd_priv *priv, |