Skip to content

Commit 34f09e3

Browse files
cdesjardinscarlescufi
authored andcommitted
drivers: i2s: Fix I2S channel count.
Fixes incorrect channel count in case of I2S format. Signed-off-by: Chris Desjardins <chris@arch-embedded.com>
1 parent c37a48a commit 34f09e3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/i2s/i2s_ll_stm32.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,10 @@ static int i2s_stm32_configure(const struct device *dev, enum i2s_dir dir,
191191
* When I2S data format is selected parameter channels is ignored,
192192
* number of words in a frame is always 2.
193193
*/
194-
const uint32_t num_channels = i2s_cfg->format & I2S_FMT_DATA_FORMAT_MASK
195-
? 2U : i2s_cfg->channels;
194+
const uint32_t num_channels =
195+
((i2s_cfg->format & I2S_FMT_DATA_FORMAT_MASK) == I2S_FMT_DATA_FORMAT_I2S)
196+
? 2U
197+
: i2s_cfg->channels;
196198
struct stream *stream;
197199
uint32_t bit_clk_freq;
198200
bool enable_mck;

0 commit comments

Comments
 (0)