@@ -237,9 +237,7 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream,
237
237
unsigned int sampling_rate = params_rate (params );
238
238
unsigned int data_length , data_delay , bclk_ratio ;
239
239
unsigned int ch1pos , ch2pos , mode , format ;
240
- unsigned int previous_ftxp , previous_frxp ;
241
240
uint32_t csreg ;
242
- bool packed ;
243
241
244
242
/*
245
243
* If a stream is already enabled,
@@ -322,46 +320,26 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream,
322
320
return - EINVAL ;
323
321
}
324
322
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 );
336
331
337
332
/* 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
-
344
333
mode = 0 ;
345
334
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 ;
365
343
}
366
344
367
345
mode |= BCM2835_I2S_FLEN (bclk_ratio - 1 );
0 commit comments