bb0dada77b8d8d517a9078f4a256722019ad8116
[openwrt/openwrt.git] / target / linux / brcm2708 / patches-3.14 / 0040-ASoC-BCM2708-Add-24-bit-support.patch
1 From 5b06b2affe65b243dd828aeac9f48854902b1823 Mon Sep 17 00:00:00 2001
2 From: Florian Meier <florian.meier@koalo.de>
3 Date: Fri, 6 Dec 2013 18:55:53 +0100
4 Subject: [PATCH 40/54] ASoC: BCM2708: Add 24 bit support
5
6 This adds 24 bit support to the I2S driver of the BCM2708.
7 Besides enabling the 24 bit flags, it includes two bug fixes:
8
9 MMAP is not supported. Claiming this leads to strange issues
10 when the format of driver and file do not match.
11
12 The datasheet states that the width extension bit should be set
13 for widths greater than 24, but greater or equal would be correct.
14 This follows from the definition of the width field.
15
16 Signed-off-by: Florian Meier <florian.meier@koalo.de>
17 ---
18 sound/soc/bcm/bcm2708-i2s.c | 13 +++++++++----
19 1 file changed, 9 insertions(+), 4 deletions(-)
20
21 diff --git a/sound/soc/bcm/bcm2708-i2s.c b/sound/soc/bcm/bcm2708-i2s.c
22 index ebaf3d6..a179216 100644
23 --- a/sound/soc/bcm/bcm2708-i2s.c
24 +++ b/sound/soc/bcm/bcm2708-i2s.c
25 @@ -346,6 +346,10 @@ static int bcm2708_i2s_hw_params(struct snd_pcm_substream *substream,
26 data_length = 16;
27 bclk_ratio = 40;
28 break;
29 + case SNDRV_PCM_FORMAT_S24_LE:
30 + data_length = 24;
31 + bclk_ratio = 40;
32 + break;
33 case SNDRV_PCM_FORMAT_S32_LE:
34 data_length = 32;
35 bclk_ratio = 80;
36 @@ -424,7 +428,7 @@ static int bcm2708_i2s_hw_params(struct snd_pcm_substream *substream,
37 /* Setup the frame format */
38 format = BCM2708_I2S_CHEN;
39
40 - if (data_length > 24)
41 + if (data_length >= 24)
42 format |= BCM2708_I2S_CHWEX;
43
44 format |= BCM2708_I2S_CHWID((data_length-8)&0xf);
45 @@ -714,6 +718,7 @@ static struct snd_soc_dai_driver bcm2708_i2s_dai = {
46 .channels_max = 2,
47 .rates = SNDRV_PCM_RATE_8000_192000,
48 .formats = SNDRV_PCM_FMTBIT_S16_LE
49 + | SNDRV_PCM_FMTBIT_S24_LE
50 | SNDRV_PCM_FMTBIT_S32_LE
51 },
52 .capture = {
53 @@ -721,6 +726,7 @@ static struct snd_soc_dai_driver bcm2708_i2s_dai = {
54 .channels_max = 2,
55 .rates = SNDRV_PCM_RATE_8000_192000,
56 .formats = SNDRV_PCM_FMTBIT_S16_LE
57 + | SNDRV_PCM_FMTBIT_S24_LE
58 | SNDRV_PCM_FMTBIT_S32_LE
59 },
60 .ops = &bcm2708_i2s_dai_ops,
61 @@ -810,11 +816,10 @@ static void bcm2708_i2s_setup_gpio(void)
62 }
63
64 static const struct snd_pcm_hardware bcm2708_pcm_hardware = {
65 - .info = SNDRV_PCM_INFO_MMAP |
66 - SNDRV_PCM_INFO_MMAP_VALID |
67 - SNDRV_PCM_INFO_INTERLEAVED |
68 + .info = SNDRV_PCM_INFO_INTERLEAVED |
69 SNDRV_PCM_INFO_JOINT_DUPLEX,
70 .formats = SNDRV_PCM_FMTBIT_S16_LE |
71 + SNDRV_PCM_FMTBIT_S24_LE |
72 SNDRV_PCM_FMTBIT_S32_LE,
73 .period_bytes_min = 32,
74 .period_bytes_max = 64 * PAGE_SIZE,
75 --
76 1.9.1
77