diff options
author | Shengjiu Wang <b02247@freescale.com> | 2014-04-14 02:58:05 -0400 |
---|---|---|
committer | Nitin Garg <nitin.garg@freescale.com> | 2014-04-16 09:58:20 -0400 |
commit | 405588f31e432e5c6634a0817e4d804ead87882b (patch) | |
tree | 373a0540b4a5ea45811ad2647a9242db1c0f8a6c | |
parent | bf7902d0cae3d90dfda6e9f6e463955dfde9c382 (diff) |
ENGR00307835-2 ASoC: dmaengine: Add two function for dmaengine_pcm
Add check_xrun and device_reset for dmaengine_pcm
Signed-off-by: Shengjiu Wang <b02247@freescale.com>
-rw-r--r-- | include/sound/dmaengine_pcm.h | 12 | ||||
-rw-r--r-- | sound/soc/soc-dmaengine-pcm.c | 13 |
2 files changed, 17 insertions, 8 deletions
diff --git a/include/sound/dmaengine_pcm.h b/include/sound/dmaengine_pcm.h index a4735fadf48d..745cde7976f7 100644 --- a/include/sound/dmaengine_pcm.h +++ b/include/sound/dmaengine_pcm.h | |||
@@ -61,6 +61,8 @@ struct dma_chan *snd_dmaengine_pcm_get_chan(struct snd_pcm_substream *substream) | |||
61 | * @slave_id: Slave requester id for the DMA channel. | 61 | * @slave_id: Slave requester id for the DMA channel. |
62 | * @filter_data: Custom DMA channel filter data, this will usually be used when | 62 | * @filter_data: Custom DMA channel filter data, this will usually be used when |
63 | * requesting the DMA channel. | 63 | * requesting the DMA channel. |
64 | * @check_xrun: check if hardware xrun happen in the cpu dai. | ||
65 | * @device_reset: if xrun happened, then do cpu dai reset. | ||
64 | */ | 66 | */ |
65 | struct snd_dmaengine_dai_dma_data { | 67 | struct snd_dmaengine_dai_dma_data { |
66 | dma_addr_t addr; | 68 | dma_addr_t addr; |
@@ -68,6 +70,16 @@ struct snd_dmaengine_dai_dma_data { | |||
68 | u32 maxburst; | 70 | u32 maxburst; |
69 | unsigned int slave_id; | 71 | unsigned int slave_id; |
70 | void *filter_data; | 72 | void *filter_data; |
73 | bool (*check_xrun)(struct snd_pcm_substream *substream); | ||
74 | void (*device_reset)(struct snd_pcm_substream *substream, bool stop); | ||
75 | }; | ||
76 | |||
77 | struct dmaengine_pcm_runtime_data { | ||
78 | struct dma_chan *dma_chan; | ||
79 | dma_cookie_t cookie; | ||
80 | |||
81 | unsigned int pos; | ||
82 | dma_async_tx_callback callback; | ||
71 | }; | 83 | }; |
72 | 84 | ||
73 | void snd_dmaengine_pcm_set_config_from_dai_data( | 85 | void snd_dmaengine_pcm_set_config_from_dai_data( |
diff --git a/sound/soc/soc-dmaengine-pcm.c b/sound/soc/soc-dmaengine-pcm.c index aa924d9b7986..f762ac0f9f1c 100644 --- a/sound/soc/soc-dmaengine-pcm.c +++ b/sound/soc/soc-dmaengine-pcm.c | |||
@@ -5,6 +5,7 @@ | |||
5 | * Based on: | 5 | * Based on: |
6 | * imx-pcm-dma-mx2.c, Copyright 2009 Sascha Hauer <s.hauer@pengutronix.de> | 6 | * imx-pcm-dma-mx2.c, Copyright 2009 Sascha Hauer <s.hauer@pengutronix.de> |
7 | * mxs-pcm.c, Copyright (C) 2011 Freescale Semiconductor, Inc. | 7 | * mxs-pcm.c, Copyright (C) 2011 Freescale Semiconductor, Inc. |
8 | * imx-pcm-dma.c, Copyright (C) 2014 Freescale Semiconductor, Inc. | ||
8 | * ep93xx-pcm.c, Copyright (C) 2006 Lennert Buytenhek <buytenh@wantstofly.org> | 9 | * ep93xx-pcm.c, Copyright (C) 2006 Lennert Buytenhek <buytenh@wantstofly.org> |
9 | * Copyright (C) 2006 Applied Data Systems | 10 | * Copyright (C) 2006 Applied Data Systems |
10 | * | 11 | * |
@@ -28,13 +29,6 @@ | |||
28 | 29 | ||
29 | #include <sound/dmaengine_pcm.h> | 30 | #include <sound/dmaengine_pcm.h> |
30 | 31 | ||
31 | struct dmaengine_pcm_runtime_data { | ||
32 | struct dma_chan *dma_chan; | ||
33 | dma_cookie_t cookie; | ||
34 | |||
35 | unsigned int pos; | ||
36 | }; | ||
37 | |||
38 | static inline struct dmaengine_pcm_runtime_data *substream_to_prtd( | 32 | static inline struct dmaengine_pcm_runtime_data *substream_to_prtd( |
39 | const struct snd_pcm_substream *substream) | 33 | const struct snd_pcm_substream *substream) |
40 | { | 34 | { |
@@ -166,7 +160,10 @@ static int dmaengine_pcm_prepare_and_submit(struct snd_pcm_substream *substream) | |||
166 | if (!desc) | 160 | if (!desc) |
167 | return -ENOMEM; | 161 | return -ENOMEM; |
168 | 162 | ||
169 | desc->callback = dmaengine_pcm_dma_complete; | 163 | if (prtd->callback) |
164 | desc->callback = prtd->callback; | ||
165 | else | ||
166 | desc->callback = dmaengine_pcm_dma_complete; | ||
170 | desc->callback_param = substream; | 167 | desc->callback_param = substream; |
171 | prtd->cookie = dmaengine_submit(desc); | 168 | prtd->cookie = dmaengine_submit(desc); |
172 | 169 | ||