9b4f6d741b0855dc9eb57fe2e1d245bd8b88d610
[openwrt/staging/noltari.git] / target / linux / brcm2708 / patches-4.19 / 950-0388-Revert-bcm2835-interpolate-audio-delay.patch
1 From 83251570f16ec848694dac016cbdb55b1d28496d Mon Sep 17 00:00:00 2001
2 From: popcornmix <popcornmix@gmail.com>
3 Date: Mon, 29 Apr 2019 19:16:14 +0100
4 Subject: [PATCH] Revert "bcm2835: interpolate audio delay"
5
6 commit fb4b9f02986fcb5ae751106ef9b027806b5dd750 upstream.
7
8 This reverts commit fb8cc99f05687ca5565dc53a7ee0dd86aefad952.
9 ---
10 .../vc04_services/bcm2835-audio/bcm2835-pcm.c | 12 +-----------
11 .../staging/vc04_services/bcm2835-audio/bcm2835.h | 1 -
12 2 files changed, 1 insertion(+), 12 deletions(-)
13
14 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c
15 +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c
16 @@ -11,7 +11,7 @@
17 /* hardware definition */
18 static const struct snd_pcm_hardware snd_bcm2835_playback_hw = {
19 .info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER |
20 - SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_BATCH),
21 + SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID),
22 .formats = SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE,
23 .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000,
24 .rate_min = 8000,
25 @@ -81,8 +81,6 @@ void bcm2835_playback_fifo(struct bcm283
26 alsa_stream->pos %= alsa_stream->buffer_size;
27 }
28
29 - alsa_stream->interpolate_start = ktime_get_ns();
30 -
31 if (alsa_stream->substream) {
32 if (new_period)
33 snd_pcm_period_elapsed(alsa_stream->substream);
34 @@ -308,7 +306,6 @@ static int snd_bcm2835_pcm_prepare(struc
35 alsa_stream->buffer_size = snd_pcm_lib_buffer_bytes(substream);
36 alsa_stream->period_size = snd_pcm_lib_period_bytes(substream);
37 alsa_stream->pos = 0;
38 - alsa_stream->interpolate_start = ktime_get_ns();
39
40 audio_debug("buffer_size=%d, period_size=%d pos=%d frame_bits=%d\n",
41 alsa_stream->buffer_size, alsa_stream->period_size,
42 @@ -400,19 +397,12 @@ snd_bcm2835_pcm_pointer(struct snd_pcm_s
43 {
44 struct snd_pcm_runtime *runtime = substream->runtime;
45 struct bcm2835_alsa_stream *alsa_stream = runtime->private_data;
46 - u64 now = ktime_get_ns();
47
48 audio_debug("pcm_pointer... (%d) hwptr=%d appl=%d pos=%d\n", 0,
49 frames_to_bytes(runtime, runtime->status->hw_ptr),
50 frames_to_bytes(runtime, runtime->control->appl_ptr),
51 alsa_stream->pos);
52
53 - /* Give userspace better delay reporting by interpolating between GPU
54 - * notifications, assuming audio speed is close enough to the clock
55 - * used for ktime */
56 - if (alsa_stream->interpolate_start && alsa_stream->interpolate_start < now)
57 - runtime->delay = -(int)div_u64((now - alsa_stream->interpolate_start) * runtime->rate, 1000000000);
58 -
59 return snd_pcm_indirect_playback_pointer(substream,
60 &alsa_stream->pcm_indirect,
61 alsa_stream->pos);
62 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h
63 +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h
64 @@ -133,7 +133,6 @@ struct bcm2835_alsa_stream {
65 unsigned int pos;
66 unsigned int buffer_size;
67 unsigned int period_size;
68 - u64 interpolate_start;
69
70 atomic_t retrieved;
71 struct bcm2835_audio_instance *instance;