brcm2708: update linux 4.4 patches to latest version
[openwrt/svn-archive/archive.git] / target / linux / brcm2708 / patches-4.4 / 0018-bcm2835-i2s-Register-PCM-device.patch
1 From fae43fcaa20df1d39c09c98372100bb1dedd6090 Mon Sep 17 00:00:00 2001
2 From: Matthias Reichl <hias@horus.com>
3 Date: Sun, 11 Oct 2015 15:35:20 +0200
4 Subject: [PATCH 018/170] bcm2835-i2s: Register PCM device
5
6 Code ported from bcm2708-i2s driver in Raspberry Pi tree.
7
8 RPi commit ba46b4935a23aa2caac1855ead52a035d4776680 ("ASoC: Add
9 support for BCM2708")
10
11 This driver adds support for digital audio (I2S)
12 for the BCM2708 SoC that is used by the
13 Raspberry Pi. External audio codecs can be
14 connected to the Raspberry Pi via P5 header.
15
16 It relies on cyclic DMA engine support for BCM2708.
17
18 Signed-off-by: Florian Meier <florian.meier@koalo.de>
19
20 Signed-off-by: Matthias Reichl <hias@horus.com>
21 ---
22 sound/soc/bcm/bcm2835-i2s.c | 23 ++++++++++++++++++++++-
23 1 file changed, 22 insertions(+), 1 deletion(-)
24
25 --- a/sound/soc/bcm/bcm2835-i2s.c
26 +++ b/sound/soc/bcm/bcm2835-i2s.c
27 @@ -799,6 +799,25 @@ static const struct snd_soc_component_dr
28 .name = "bcm2835-i2s-comp",
29 };
30
31 +static const struct snd_pcm_hardware bcm2835_pcm_hardware = {
32 + .info = SNDRV_PCM_INFO_INTERLEAVED |
33 + SNDRV_PCM_INFO_JOINT_DUPLEX,
34 + .formats = SNDRV_PCM_FMTBIT_S16_LE |
35 + SNDRV_PCM_FMTBIT_S24_LE |
36 + SNDRV_PCM_FMTBIT_S32_LE,
37 + .period_bytes_min = 32,
38 + .period_bytes_max = 64 * PAGE_SIZE,
39 + .periods_min = 2,
40 + .periods_max = 255,
41 + .buffer_bytes_max = 128 * PAGE_SIZE,
42 +};
43 +
44 +static const struct snd_dmaengine_pcm_config bcm2835_dmaengine_pcm_config = {
45 + .prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config,
46 + .pcm_hardware = &bcm2835_pcm_hardware,
47 + .prealloc_buffer_size = 256 * PAGE_SIZE,
48 +};
49 +
50 static int bcm2835_i2s_probe(struct platform_device *pdev)
51 {
52 struct bcm2835_i2s_dev *dev;
53 @@ -870,7 +889,9 @@ static int bcm2835_i2s_probe(struct plat
54 return ret;
55 }
56
57 - ret = devm_snd_dmaengine_pcm_register(&pdev->dev, NULL, 0);
58 + ret = devm_snd_dmaengine_pcm_register(&pdev->dev,
59 + &bcm2835_dmaengine_pcm_config,
60 + SND_DMAENGINE_PCM_FLAG_COMPAT);
61 if (ret) {
62 dev_err(&pdev->dev, "Could not register PCM: %d\n", ret);
63 return ret;