aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sound/soc/fsl/imx-pcm-fiq.c21
1 files changed, 2 insertions, 19 deletions
diff --git a/sound/soc/fsl/imx-pcm-fiq.c b/sound/soc/fsl/imx-pcm-fiq.c
index 34043c55f2a6..94720a6dd7b6 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;
@@ -54,7 +52,6 @@ static enum hrtimer_restart snd_hrtimer_callback(struct hrtimer *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; 53 struct snd_pcm_runtime *runtime = substream->runtime;
56 struct pt_regs regs; 54 struct pt_regs regs;
57 unsigned long delta;
58 55
59 if (!atomic_read(&iprtd->running)) 56 if (!atomic_read(&iprtd->running))
60 return HRTIMER_NORESTART; 57 return HRTIMER_NORESTART;
@@ -66,19 +63,7 @@ static enum hrtimer_restart snd_hrtimer_callback(struct hrtimer *hrt)
66 else 63 else
67 iprtd->offset = regs.ARM_r9 & 0xffff; 64 iprtd->offset = regs.ARM_r9 & 0xffff;
68 65
69 /* How much data have we transferred since the last period report? */ 66 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 67
83 hrtimer_forward_now(hrt, ns_to_ktime(iprtd->poll_time_ns)); 68 hrtimer_forward_now(hrt, ns_to_ktime(iprtd->poll_time_ns));
84 69
@@ -95,11 +80,9 @@ static int snd_imx_pcm_hw_params(struct snd_pcm_substream *substream,
95 struct snd_pcm_runtime *runtime = substream->runtime; 80 struct snd_pcm_runtime *runtime = substream->runtime;
96 struct imx_pcm_runtime_data *iprtd = runtime->private_data; 81 struct imx_pcm_runtime_data *iprtd = runtime->private_data;
97 82
98 iprtd->size = params_buffer_bytes(params);
99 iprtd->periods = params_periods(params); 83 iprtd->periods = params_periods(params);
100 iprtd->period = params_period_bytes(params) ; 84 iprtd->period = params_period_bytes(params);
101 iprtd->offset = 0; 85 iprtd->offset = 0;
102 iprtd->last_offset = 0;
103 iprtd->poll_time_ns = 1000000000 / params_rate(params) * 86 iprtd->poll_time_ns = 1000000000 / params_rate(params) *
104 params_period_size(params); 87 params_period_size(params);
105 snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer); 88 snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer);