brcm2708: update linux 4.4 patches to latest version
[openwrt/openwrt.git] / target / linux / brcm2708 / patches-4.4 / 0015-bcm2835-i2s-add-24bit-support-update-bclk_ratio-to-m.patch
1 From 002e593baa098b480ee0b6990ab3e43c6b36aac0 Mon Sep 17 00:00:00 2001
2 From: Matthias Reichl <hias@horus.com>
3 Date: Sun, 11 Oct 2015 15:21:16 +0200
4 Subject: [PATCH] bcm2835-i2s: add 24bit support, update bclk_ratio to more
5 correct values
6
7 Code ported from bcm2708-i2s driver in Raspberry Pi tree.
8
9 RPi commit 62c05a0b5328d9376d39c9e74da10b8a2465c234 ("ASoC: BCM2708:
10 Add 24 bit support")
11
12 This adds 24 bit support to the I2S driver of the BCM2708.
13 Besides enabling the 24 bit flags, it includes two bug fixes:
14
15 MMAP is not supported. Claiming this leads to strange issues
16 when the format of driver and file do not match.
17
18 The datasheet states that the width extension bit should be set
19 for widths greater than 24, but greater or equal would be correct.
20 This follows from the definition of the width field.
21
22 Signed-off-by: Florian Meier <florian.meier@koalo.de>
23
24 RPi commit 3e8c672bc4e92d457aa4654bbb4cfd79a18a2327 ("bcm2708-i2s:
25 Update bclk_ratio to more correct values")
26
27 Discussion about blck_ratio affecting sound quality:
28 https://github.com/raspberrypi/linux/issues/681
29
30 Signed-off-by: Matthias Reichl <hias@horus.com>
31 ---
32 sound/soc/bcm/bcm2835-i2s.c | 12 +++++++++---
33 1 file changed, 9 insertions(+), 3 deletions(-)
34
35 --- a/sound/soc/bcm/bcm2835-i2s.c
36 +++ b/sound/soc/bcm/bcm2835-i2s.c
37 @@ -340,11 +340,15 @@ static int bcm2835_i2s_hw_params(struct
38 switch (params_format(params)) {
39 case SNDRV_PCM_FORMAT_S16_LE:
40 data_length = 16;
41 - bclk_ratio = 40;
42 + bclk_ratio = 50;
43 + break;
44 + case SNDRV_PCM_FORMAT_S24_LE:
45 + data_length = 24;
46 + bclk_ratio = 50;
47 break;
48 case SNDRV_PCM_FORMAT_S32_LE:
49 data_length = 32;
50 - bclk_ratio = 80;
51 + bclk_ratio = 100;
52 break;
53 default:
54 return -EINVAL;
55 @@ -420,7 +424,7 @@ static int bcm2835_i2s_hw_params(struct
56 /* Setup the frame format */
57 format = BCM2835_I2S_CHEN;
58
59 - if (data_length > 24)
60 + if (data_length >= 24)
61 format |= BCM2835_I2S_CHWEX;
62
63 format |= BCM2835_I2S_CHWID((data_length-8)&0xf);
64 @@ -711,6 +715,7 @@ static struct snd_soc_dai_driver bcm2835
65 .channels_max = 2,
66 .rates = SNDRV_PCM_RATE_8000_192000,
67 .formats = SNDRV_PCM_FMTBIT_S16_LE
68 + | SNDRV_PCM_FMTBIT_S24_LE
69 | SNDRV_PCM_FMTBIT_S32_LE
70 },
71 .capture = {
72 @@ -718,6 +723,7 @@ static struct snd_soc_dai_driver bcm2835
73 .channels_max = 2,
74 .rates = SNDRV_PCM_RATE_8000_192000,
75 .formats = SNDRV_PCM_FMTBIT_S16_LE
76 + | SNDRV_PCM_FMTBIT_S24_LE
77 | SNDRV_PCM_FMTBIT_S32_LE
78 },
79 .ops = &bcm2835_i2s_dai_ops,