drivers: i2s: Fix I2S channel count.

Fixes incorrect channel count in case of I2S format.

Signed-off-by: Chris Desjardins <chris@arch-embedded.com>
This commit is contained in:
Chris Desjardins 2024-07-09 09:30:26 +02:00 committed by Carles Cufí
parent c37a48acbc
commit 34f09e3bd5

View file

@ -191,8 +191,10 @@ static int i2s_stm32_configure(const struct device *dev, enum i2s_dir dir,
* When I2S data format is selected parameter channels is ignored, * When I2S data format is selected parameter channels is ignored,
* number of words in a frame is always 2. * number of words in a frame is always 2.
*/ */
const uint32_t num_channels = i2s_cfg->format & I2S_FMT_DATA_FORMAT_MASK const uint32_t num_channels =
? 2U : i2s_cfg->channels; ((i2s_cfg->format & I2S_FMT_DATA_FORMAT_MASK) == I2S_FMT_DATA_FORMAT_I2S)
? 2U
: i2s_cfg->channels;
struct stream *stream; struct stream *stream;
uint32_t bit_clk_freq; uint32_t bit_clk_freq;
bool enable_mck; bool enable_mck;