brcm2708: update to latest patches from RPi foundation
[openwrt/staging/wigyori.git] / target / linux / brcm2708 / patches-4.19 / 950-0459-staging-bcm2835-audio-Use-coherent-device-buffers.patch
1 From 94f44e5e684f35345de973b7df022ce1d4d124fa Mon Sep 17 00:00:00 2001
2 From: Takashi Iwai <tiwai@suse.de>
3 Date: Tue, 4 Sep 2018 17:58:54 +0200
4 Subject: [PATCH 459/773] staging: bcm2835-audio: Use coherent device buffers
5
6 commit ad29c6e6cbf6f2af7362b043adad51a3be3d39c7 upstream.
7
8 The memory access to the pages allocated with
9 SNDRV_DMA_TYPE_CONTINUOUS are basically non-coherent, and it becomes a
10 problem when a process accesses via mmap.
11
12 For the more consistent access, use the device coherent memory, just
13 by replacing the call pattern in the allocator helpers.
14
15 The only point we need to be careful for is the device object passed
16 there; since bcm2835-audio driver creates fake devices and each card
17 is created on top of that, we need to pass its parent device as the
18 real device object.
19
20 Signed-off-by: Takashi Iwai <tiwai@suse.de>
21 Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
22 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
23 ---
24 .../vc04_services/bcm2835-audio/bcm2835-pcm.c | 12 ++++++------
25 1 file changed, 6 insertions(+), 6 deletions(-)
26
27 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c
28 +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c
29 @@ -345,8 +345,8 @@ int snd_bcm2835_new_pcm(struct bcm2835_c
30
31 /* pre-allocation of buffers */
32 /* NOTE: this may fail */
33 - snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS,
34 - snd_dma_continuous_data(GFP_KERNEL),
35 + snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
36 + chip->card->dev->parent,
37 snd_bcm2835_playback_hw.buffer_bytes_max,
38 snd_bcm2835_playback_hw.buffer_bytes_max);
39
40 @@ -371,8 +371,8 @@ int snd_bcm2835_new_spdif_pcm(struct bcm
41
42 /* pre-allocation of buffers */
43 /* NOTE: this may fail */
44 - snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS,
45 - snd_dma_continuous_data(GFP_KERNEL),
46 + snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
47 + chip->card->dev->parent,
48 snd_bcm2835_playback_spdif_hw.buffer_bytes_max, snd_bcm2835_playback_spdif_hw.buffer_bytes_max);
49
50 return 0;
51 @@ -404,8 +404,8 @@ int snd_bcm2835_new_simple_pcm(struct bc
52
53 snd_pcm_lib_preallocate_pages_for_all(
54 pcm,
55 - SNDRV_DMA_TYPE_CONTINUOUS,
56 - snd_dma_continuous_data(GFP_KERNEL),
57 + SNDRV_DMA_TYPE_DEV,
58 + chip->card->dev->parent,
59 snd_bcm2835_playback_hw.buffer_bytes_max,
60 snd_bcm2835_playback_hw.buffer_bytes_max);
61