Skip to content

Commit fbd0add

Browse files
Phil Elwellpopcornmix
Phil Elwell
authored andcommitted
Revert "bcm2835-i2s: Changes for allowing asymmetric sample formats."
This reverts commit f5a6236. See: #1799 Signed-off-by: Phil Elwell <[email protected]>
1 parent 7152af0 commit fbd0add

File tree

1 file changed

+16
-38
lines changed

1 file changed

+16
-38
lines changed

sound/soc/bcm/bcm2835-i2s.c

Lines changed: 16 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -237,9 +237,7 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream,
237237
unsigned int sampling_rate = params_rate(params);
238238
unsigned int data_length, data_delay, bclk_ratio;
239239
unsigned int ch1pos, ch2pos, mode, format;
240-
unsigned int previous_ftxp, previous_frxp;
241240
uint32_t csreg;
242-
bool packed;
243241

244242
/*
245243
* If a stream is already enabled,
@@ -322,46 +320,26 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream,
322320
return -EINVAL;
323321
}
324322

325-
/* Set the format for the matching stream direction. */
326-
switch (substream->stream) {
327-
case SNDRV_PCM_STREAM_PLAYBACK:
328-
regmap_write(dev->i2s_regmap, BCM2835_I2S_TXC_A_REG, format);
329-
break;
330-
case SNDRV_PCM_STREAM_CAPTURE:
331-
regmap_write(dev->i2s_regmap, BCM2835_I2S_RXC_A_REG, format);
332-
break;
333-
default:
334-
return -EINVAL;
335-
}
323+
/*
324+
* Set format for both streams.
325+
* We cannot set another frame length
326+
* (and therefore word length) anyway,
327+
* so the format will be the same.
328+
*/
329+
regmap_write(dev->i2s_regmap, BCM2835_I2S_RXC_A_REG, format);
330+
regmap_write(dev->i2s_regmap, BCM2835_I2S_TXC_A_REG, format);
336331

337332
/* Setup the I2S mode */
338-
/* Keep existing FTXP and FRXP values. */
339-
regmap_read(dev->i2s_regmap, BCM2835_I2S_MODE_A_REG, &mode);
340-
341-
previous_ftxp = mode & BCM2835_I2S_FTXP;
342-
previous_frxp = mode & BCM2835_I2S_FRXP;
343-
344333
mode = 0;
345334

346-
/*
347-
* Retain the frame packed mode (2 channels per 32 bit word)
348-
* of the other direction stream intact. The formats of each
349-
* direction can be different as long as the frame length is
350-
* shared for both.
351-
*/
352-
packed = data_length <= 16;
353-
354-
switch (substream->stream) {
355-
case SNDRV_PCM_STREAM_PLAYBACK:
356-
mode |= previous_frxp;
357-
mode |= packed ? BCM2835_I2S_FTXP : 0;
358-
break;
359-
case SNDRV_PCM_STREAM_CAPTURE:
360-
mode |= previous_ftxp;
361-
mode |= packed ? BCM2835_I2S_FRXP : 0;
362-
break;
363-
default:
364-
return -EINVAL;
335+
if (data_length <= 16) {
336+
/*
337+
* Use frame packed mode (2 channels per 32 bit word)
338+
* We cannot set another frame length in the second stream
339+
* (and therefore word length) anyway,
340+
* so the format will be the same.
341+
*/
342+
mode |= BCM2835_I2S_FTXP | BCM2835_I2S_FRXP;
365343
}
366344

367345
mode |= BCM2835_I2S_FLEN(bclk_ratio - 1);

0 commit comments

Comments
 (0)