build: get rid of host.mk
[openwrt/staging/wigyori.git] / target / linux / brcm2708 / patches-4.9 / 0132-Revert-bcm2835-i2s-Changes-for-allowing-asymmetric-s.patch
1 From db51b292d97ecb021831ed380ce4e1152b1bd235 Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <phil@raspberrypi.org>
3 Date: Mon, 16 Jan 2017 21:02:26 +0000
4 Subject: [PATCH] Revert "bcm2835-i2s: Changes for allowing asymmetric sample
5 formats."
6
7 This reverts commit f5a6236a32e82068122301d246a94ca755d61704.
8
9 See: https://github.com/raspberrypi/linux/issues/1799
10
11 Signed-off-by: Phil Elwell <phil@raspberrypi.org>
12 ---
13 sound/soc/bcm/bcm2835-i2s.c | 54 ++++++++++++++-------------------------------
14 1 file changed, 16 insertions(+), 38 deletions(-)
15
16 --- a/sound/soc/bcm/bcm2835-i2s.c
17 +++ b/sound/soc/bcm/bcm2835-i2s.c
18 @@ -237,9 +237,7 @@ static int bcm2835_i2s_hw_params(struct
19 unsigned int sampling_rate = params_rate(params);
20 unsigned int data_length, data_delay, bclk_ratio;
21 unsigned int ch1pos, ch2pos, mode, format;
22 - unsigned int previous_ftxp, previous_frxp;
23 uint32_t csreg;
24 - bool packed;
25
26 /*
27 * If a stream is already enabled,
28 @@ -322,46 +320,26 @@ static int bcm2835_i2s_hw_params(struct
29 return -EINVAL;
30 }
31
32 - /* Set the format for the matching stream direction. */
33 - switch (substream->stream) {
34 - case SNDRV_PCM_STREAM_PLAYBACK:
35 - regmap_write(dev->i2s_regmap, BCM2835_I2S_TXC_A_REG, format);
36 - break;
37 - case SNDRV_PCM_STREAM_CAPTURE:
38 - regmap_write(dev->i2s_regmap, BCM2835_I2S_RXC_A_REG, format);
39 - break;
40 - default:
41 - return -EINVAL;
42 - }
43 + /*
44 + * Set format for both streams.
45 + * We cannot set another frame length
46 + * (and therefore word length) anyway,
47 + * so the format will be the same.
48 + */
49 + regmap_write(dev->i2s_regmap, BCM2835_I2S_RXC_A_REG, format);
50 + regmap_write(dev->i2s_regmap, BCM2835_I2S_TXC_A_REG, format);
51
52 /* Setup the I2S mode */
53 - /* Keep existing FTXP and FRXP values. */
54 - regmap_read(dev->i2s_regmap, BCM2835_I2S_MODE_A_REG, &mode);
55 -
56 - previous_ftxp = mode & BCM2835_I2S_FTXP;
57 - previous_frxp = mode & BCM2835_I2S_FRXP;
58 -
59 mode = 0;
60
61 - /*
62 - * Retain the frame packed mode (2 channels per 32 bit word)
63 - * of the other direction stream intact. The formats of each
64 - * direction can be different as long as the frame length is
65 - * shared for both.
66 - */
67 - packed = data_length <= 16;
68 -
69 - switch (substream->stream) {
70 - case SNDRV_PCM_STREAM_PLAYBACK:
71 - mode |= previous_frxp;
72 - mode |= packed ? BCM2835_I2S_FTXP : 0;
73 - break;
74 - case SNDRV_PCM_STREAM_CAPTURE:
75 - mode |= previous_ftxp;
76 - mode |= packed ? BCM2835_I2S_FRXP : 0;
77 - break;
78 - default:
79 - return -EINVAL;
80 + if (data_length <= 16) {
81 + /*
82 + * Use frame packed mode (2 channels per 32 bit word)
83 + * We cannot set another frame length in the second stream
84 + * (and therefore word length) anyway,
85 + * so the format will be the same.
86 + */
87 + mode |= BCM2835_I2S_FTXP | BCM2835_I2S_FRXP;
88 }
89
90 mode |= BCM2835_I2S_FLEN(bclk_ratio - 1);