From 953f35f13062bd3b018af2ad19558034c6f12aa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Thu, 23 Sep 2021 12:34:57 +0200 Subject: [PATCH] drivers: i2s_nrfx: Do not enforce two channels for I2S format MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove unnecessary condition that effectively limits the usability of the I2S format to two channels mode only. Although the description of the `i2s_config` structure contains a remark that for the I2S format the specified number of channels is ignored and always two are used, in fact only one other in-tree driver (i2s_sam_ssc) applies such limitation. The nRF I2S hardware has no problem with handling the I2S format with audio data for only one channel, so there is no need for having this limitation in the driver, and without such mode of operation of the driver it is impossible to feed it with PCM data directly from the PDM peripheral working in one channel mode. Signed-off-by: Andrzej Głąbek --- drivers/i2s/i2s_nrfx.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/i2s/i2s_nrfx.c b/drivers/i2s/i2s_nrfx.c index c4f1e57d30a..8f87413adcd 100644 --- a/drivers/i2s/i2s_nrfx.c +++ b/drivers/i2s/i2s_nrfx.c @@ -465,9 +465,7 @@ static int i2s_nrfx_configure(const struct device *dev, enum i2s_dir dir, return -EINVAL; } - if (i2s_cfg->channels == 2 || - (i2s_cfg->format & I2S_FMT_DATA_FORMAT_MASK) - == I2S_FMT_DATA_FORMAT_I2S) { + if (i2s_cfg->channels == 2) { nrfx_cfg.channels = NRF_I2S_CHANNELS_STEREO; } else if (i2s_cfg->channels == 1) { nrfx_cfg.channels = NRF_I2S_CHANNELS_LEFT;