drivers: i2s_nrfx: Do not enforce two channels for I2S format

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 <andrzej.glabek@nordicsemi.no>
This commit is contained in:
Andrzej Głąbek 2021-09-23 12:34:57 +02:00 committed by Christopher Friedt
commit 953f35f130

View file

@ -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;