Date: | 2012-01-15 01:02:17 (11 years 8 months ago) |
---|---|
Author: | Lars C. |
Commit: | f43b447b96282892ca629fbe4d5592e2e6b6cae6 |
Message: | ASoC: JZ4740: Enforce buffer size to be a multiple of period size Neither the driver nor the hardware cope very well with buffer sizes not a multiple of the period size and will cause auditable artifects. This patch adds a integer constraint to the number of periods to enforce the buffer size to be a multiple of the period size. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> |
Files: |
sound/soc/jz4740/jz4740-pcm.c (3 diffs) |
Change Details
sound/soc/jz4740/jz4740-pcm.c | ||
---|---|---|
62 | 62 | static void jz4740_pcm_start_transfer(struct jz4740_runtime_data *prtd, |
63 | 63 | struct snd_pcm_substream *substream) |
64 | 64 | { |
65 | unsigned long count; | |
66 | ||
67 | 65 | if (prtd->dma_pos == prtd->dma_end) |
68 | 66 | prtd->dma_pos = prtd->dma_start; |
69 | 67 | |
70 | if (prtd->dma_pos + prtd->dma_period > prtd->dma_end) | |
71 | count = prtd->dma_end - prtd->dma_pos; | |
72 | else | |
73 | count = prtd->dma_period; | |
74 | ||
75 | 68 | jz4740_dma_disable(prtd->dma); |
76 | 69 | |
77 | 70 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
... | ... | |
82 | 75 | jz4740_dma_set_dst_addr(prtd->dma, prtd->dma_pos); |
83 | 76 | } |
84 | 77 | |
85 | jz4740_dma_set_transfer_count(prtd->dma, count); | |
78 | jz4740_dma_set_transfer_count(prtd->dma, prtd->dma_period); | |
86 | 79 | |
87 | prtd->dma_pos += count; | |
80 | prtd->dma_pos += prtd->dma_period; | |
88 | 81 | |
89 | 82 | jz4740_dma_enable(prtd->dma); |
90 | 83 | } |
... | ... | |
214 | 207 | { |
215 | 208 | struct snd_pcm_runtime *runtime = substream->runtime; |
216 | 209 | struct jz4740_runtime_data *prtd; |
210 | int ret; | |
217 | 211 | |
218 | 212 | prtd = kzalloc(sizeof(*prtd), GFP_KERNEL); |
219 | 213 | if (prtd == NULL) |
220 | 214 | return -ENOMEM; |
221 | 215 | |
216 | ret = snd_pcm_hw_constraint_integer(runtime, | |
217 | SNDRV_PCM_HW_PARAM_PERIODS); | |
218 | if (ret) { | |
219 | kfree(prtd); | |
220 | return ret; | |
221 | } | |
222 | ||
222 | 223 | snd_soc_set_runtime_hwparams(substream, &jz4740_pcm_hardware); |
223 | 224 | |
224 | 225 | runtime->private_data = prtd; |
Branches:
ben-wpan
ben-wpan-stefan
5396a9238205f20f811ea57898980d3ca82df0b6
jz-2.6.34
jz-2.6.34-rc5
jz-2.6.34-rc6
jz-2.6.34-rc7
jz-2.6.35
jz-2.6.36
jz-2.6.37
jz-2.6.38
jz-2.6.39
jz-3.0
jz-3.1
jz-3.11
jz-3.12
jz-3.13
jz-3.15
jz-3.16
jz-3.18-dt
jz-3.2
jz-3.3
jz-3.4
jz-3.5
jz-3.6
jz-3.6-rc2-pwm
jz-3.9
jz-3.9-clk
jz-3.9-rc8
jz47xx
jz47xx-2.6.38
master
Tags:
od-2011-09-04
od-2011-09-18
v2.6.34-rc5
v2.6.34-rc6
v2.6.34-rc7
v3.9