kernel: refresh patches
[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 --- a/sound/soc/bcm/bcm2708-i2s.c
22 +++ b/sound/soc/bcm/bcm2708-i2s.c
23 @@ -346,6 +346,10 @@ static int bcm2708_i2s_hw_params(struct
24 data_length = 16;
25 bclk_ratio = 40;
26 break;
27 + case SNDRV_PCM_FORMAT_S24_LE:
28 + data_length = 24;
29 + bclk_ratio = 40;
30 + break;
31 case SNDRV_PCM_FORMAT_S32_LE:
32 data_length = 32;
33 bclk_ratio = 80;
34 @@ -424,7 +428,7 @@ static int bcm2708_i2s_hw_params(struct
35 /* Setup the frame format */
36 format = BCM2708_I2S_CHEN;
37
38 - if (data_length > 24)
39 + if (data_length >= 24)
40 format |= BCM2708_I2S_CHWEX;
41
42 format |= BCM2708_I2S_CHWID((data_length-8)&0xf);
43 @@ -714,6 +718,7 @@ static struct snd_soc_dai_driver bcm2708
44 .channels_max = 2,
45 .rates = SNDRV_PCM_RATE_8000_192000,
46 .formats = SNDRV_PCM_FMTBIT_S16_LE
47 + | SNDRV_PCM_FMTBIT_S24_LE
48 | SNDRV_PCM_FMTBIT_S32_LE
49 },
50 .capture = {
51 @@ -721,6 +726,7 @@ static struct snd_soc_dai_driver bcm2708
52 .channels_max = 2,
53 .rates = SNDRV_PCM_RATE_8000_192000,
54 .formats = SNDRV_PCM_FMTBIT_S16_LE
55 + | SNDRV_PCM_FMTBIT_S24_LE
56 | SNDRV_PCM_FMTBIT_S32_LE
57 },
58 .ops = &bcm2708_i2s_dai_ops,
59 @@ -810,11 +816,10 @@ static void bcm2708_i2s_setup_gpio(void)
60 }
61
62 static const struct snd_pcm_hardware bcm2708_pcm_hardware = {
63 - .info = SNDRV_PCM_INFO_MMAP |
64 - SNDRV_PCM_INFO_MMAP_VALID |
65 - SNDRV_PCM_INFO_INTERLEAVED |
66 + .info = SNDRV_PCM_INFO_INTERLEAVED |
67 SNDRV_PCM_INFO_JOINT_DUPLEX,
68 .formats = SNDRV_PCM_FMTBIT_S16_LE |
69 + SNDRV_PCM_FMTBIT_S24_LE |
70 SNDRV_PCM_FMTBIT_S32_LE,
71 .period_bytes_min = 32,
72 .period_bytes_max = 64 * PAGE_SIZE,