@@ -541,18 +541,17 @@ static int i2s_mcux_config(const struct device *dev, enum i2s_dir dir,
541541 config .syncMode = dev_cfg -> rx_sync_mode ;
542542 }
543543
544- if (i2s_cfg -> options & I2S_OPT_FRAME_CLK_SLAVE ) {
545- if (i2s_cfg -> options & I2S_OPT_BIT_CLK_SLAVE ) {
546- config .masterSlave = kSAI_Slave ;
547- } else {
548- config .masterSlave = kSAI_Bclk_Master_FrameSync_Slave ;
549- }
544+ bool frame_clk_slave = i2s_cfg -> options & I2S_OPT_FRAME_CLK_SLAVE ;
545+ bool bit_clk_slave = i2s_cfg -> options & I2S_OPT_BIT_CLK_SLAVE ;
546+
547+ if (frame_clk_slave && bit_clk_slave ) {
548+ config .masterSlave = kSAI_Slave ;
549+ } else if (frame_clk_slave && !bit_clk_slave ) {
550+ config .masterSlave = kSAI_Bclk_Master_FrameSync_Slave ;
551+ } else if (!frame_clk_slave && bit_clk_slave ) {
552+ config .masterSlave = kSAI_Bclk_Slave_FrameSync_Master ;
550553 } else {
551- if (i2s_cfg -> options & I2S_OPT_BIT_CLK_SLAVE ) {
552- config .masterSlave = kSAI_Bclk_Slave_FrameSync_Master ;
553- } else {
554- config .masterSlave = kSAI_Master ;
555- }
554+ config .masterSlave = kSAI_Master ;
556555 }
557556
558557 /* clock signal polarity */
@@ -568,15 +567,13 @@ static int i2s_mcux_config(const struct device *dev, enum i2s_dir dir,
568567 ? kSAI_SampleOnRisingEdge
569568 : kSAI_SampleOnFallingEdge ;
570569 break ;
571-
572570 case I2S_FMT_CLK_IF_NB :
573571 /* Swap frame sync polarity */
574572 config .frameSync .frameSyncPolarity =
575573 (config .frameSync .frameSyncPolarity == kSAI_PolarityActiveHigh )
576574 ? kSAI_PolarityActiveLow
577575 : kSAI_PolarityActiveHigh ;
578576 break ;
579-
580577 case I2S_FMT_CLK_IF_IB :
581578 /* Swap frame sync and bclk polarity */
582579 config .frameSync .frameSyncPolarity =
0 commit comments