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