aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorMark Brown <broonie@linaro.org>2013-11-08 05:43:19 -0500
committerMark Brown <broonie@linaro.org>2013-11-08 05:43:19 -0500
commit3fec948ed815584e562e0aa02e7baf9f970c4910 (patch)
tree35f095a1ed0093821f5431dfd9e4ae1cc96e060c /sound
parent5196e6ffc253937a8f22121d28ac7192e7260793 (diff)
parent10227a94874435b038d5303ca05c1e158927084b (diff)
Merge remote-tracking branch 'asoc/fix/fsl' into asoc-linus
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/fsl/imx-pcm-fiq.c22
1 files changed, 2 insertions, 20 deletions
diff --git a/sound/soc/fsl/imx-pcm-fiq.c b/sound/soc/fsl/imx-pcm-fiq.c
index 34043c55f2a6..10e330514ed8 100644
--- a/sound/soc/fsl/imx-pcm-fiq.c
+++ b/sound/soc/fsl/imx-pcm-fiq.c
@@ -39,8 +39,6 @@ struct imx_pcm_runtime_data {
39 unsigned int period; 39 unsigned int period;
40 int periods; 40 int periods;
41 unsigned long offset; 41 unsigned long offset;
42 unsigned long last_offset;
43 unsigned long size;
44 struct hrtimer hrt; 42 struct hrtimer hrt;
45 int poll_time_ns; 43 int poll_time_ns;
46 struct snd_pcm_substream *substream; 44 struct snd_pcm_substream *substream;
@@ -52,9 +50,7 @@ static enum hrtimer_restart snd_hrtimer_callback(struct hrtimer *hrt)
52 struct imx_pcm_runtime_data *iprtd = 50 struct imx_pcm_runtime_data *iprtd =
53 container_of(hrt, struct imx_pcm_runtime_data, hrt); 51 container_of(hrt, struct imx_pcm_runtime_data, hrt);
54 struct snd_pcm_substream *substream = iprtd->substream; 52 struct snd_pcm_substream *substream = iprtd->substream;
55 struct snd_pcm_runtime *runtime = substream->runtime;
56 struct pt_regs regs; 53 struct pt_regs regs;
57 unsigned long delta;
58 54
59 if (!atomic_read(&iprtd->running)) 55 if (!atomic_read(&iprtd->running))
60 return HRTIMER_NORESTART; 56 return HRTIMER_NORESTART;
@@ -66,19 +62,7 @@ static enum hrtimer_restart snd_hrtimer_callback(struct hrtimer *hrt)
66 else 62 else
67 iprtd->offset = regs.ARM_r9 & 0xffff; 63 iprtd->offset = regs.ARM_r9 & 0xffff;
68 64
69 /* How much data have we transferred since the last period report? */ 65 snd_pcm_period_elapsed(substream);
70 if (iprtd->offset >= iprtd->last_offset)
71 delta = iprtd->offset - iprtd->last_offset;
72 else
73 delta = runtime->buffer_size + iprtd->offset
74 - iprtd->last_offset;
75
76 /* If we've transferred at least a period then report it and
77 * reset our poll time */
78 if (delta >= iprtd->period) {
79 snd_pcm_period_elapsed(substream);
80 iprtd->last_offset = iprtd->offset;
81 }
82 66
83 hrtimer_forward_now(hrt, ns_to_ktime(iprtd->poll_time_ns)); 67 hrtimer_forward_now(hrt, ns_to_ktime(iprtd->poll_time_ns));
84 68
@@ -95,11 +79,9 @@ static int snd_imx_pcm_hw_params(struct snd_pcm_substream *substream,
95 struct snd_pcm_runtime *runtime = substream->runtime; 79 struct snd_pcm_runtime *runtime = substream->runtime;
96 struct imx_pcm_runtime_data *iprtd = runtime->private_data; 80 struct imx_pcm_runtime_data *iprtd = runtime->private_data;
97 81
98 iprtd->size = params_buffer_bytes(params);
99 iprtd->periods = params_periods(params); 82 iprtd->periods = params_periods(params);
100 iprtd->period = params_period_bytes(params) ; 83 iprtd->period = params_period_bytes(params);
101 iprtd->offset = 0; 84 iprtd->offset = 0;
102 iprtd->last_offset = 0;
103 iprtd->poll_time_ns = 1000000000 / params_rate(params) * 85 iprtd->poll_time_ns = 1000000000 / params_rate(params) *
104 params_period_size(params); 86 params_period_size(params);
105 snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer); 87 snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer);