Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions tests/drivers/i2s/i2s_additional/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@ config I2S_TEST_EIGHT_CHANNELS_UNSUPPORTED
When set to 'y', test will check that i2s_configure() returns -EINVAL.
When set to 'n', test will do the transmission.

config I2S_TEST_EIGHT_CHANNELS_32B_48K_UNSUPPORTED
bool "Skip test with 8 channels, 32 bit word size and 48k sample rate"
depends on !I2S_TEST_EIGHT_CHANNELS_UNSUPPORTED
help
Skip test that is challenging due to high data throughput.
When set to 'y', test will be skipped.
When set to 'n', test will do the transmission.

config I2S_TEST_DATA_FORMAT_I2S_UNSUPPORTED
bool "I2S_FMT_DATA_FORMAT_I2S is not supported by the driver"
help
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* Copyright (c) 2025 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/

&audiopll {
status = "okay";
frequency = <NRFS_AUDIOPLL_FREQ_AUDIO_48K>;
};

&tdm130 {
mck-frequency = <12288000>;
mck-clock-source = "ACLK";
sck-clock-source = "ACLK";
};
43 changes: 40 additions & 3 deletions tests/drivers/i2s/i2s_additional/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ LOG_MODULE_REGISTER(i2s_add, LOG_LEVEL_INF);
#define NUMBER_OF_CHANNELS 2
#define FRAME_CLK_FREQ 44100

#define NUM_BLOCKS 20
#define NUM_BLOCKS 4
#define TIMEOUT 1000

#define SAMPLES_COUNT 64
Expand Down Expand Up @@ -519,9 +519,9 @@ ZTEST(i2s_additional, test_02b_four_channels)
#endif /* CONFIG_I2S_TEST_FOUR_CHANNELS_UNSUPPORTED */
}

/** @brief Test I2S transfer with eight channels.
/** @brief Test I2S transfer with eight channels, 16 bit and 44.1 kHz.
*/
ZTEST(i2s_additional, test_02c_eight_channels)
ZTEST(i2s_additional, test_02c_eight_channels_default)
{
struct i2s_config i2s_cfg = default_i2s_cfg;

Expand Down Expand Up @@ -549,6 +549,43 @@ ZTEST(i2s_additional, test_02c_eight_channels)
#endif /* CONFIG_I2S_TEST_EIGHT_CHANNELS_UNSUPPORTED */
}

/** @brief Test I2S transfer with eight channels, 32 bit and 48 kHz.
*/
ZTEST(i2s_additional, test_02d_eight_channels_high_throughput)
{
struct i2s_config i2s_cfg = default_i2s_cfg;

i2s_cfg.channels = 8;
i2s_cfg.word_size = 32;
i2s_cfg.frame_clk_freq = 48000;

#if defined(CONFIG_I2S_TEST_EIGHT_CHANNELS_UNSUPPORTED)
int ret;

ret = i2s_configure(dev_i2s, I2S_DIR_TX, &i2s_cfg);
zassert_equal(ret, -EINVAL, "Unexpected result %d", ret);
#else /* CONFIG_I2S_TEST_EIGHT_CHANNELS_UNSUPPORTED */

#if defined(CONFIG_I2S_TEST_EIGHT_CHANNELS_32B_48K_UNSUPPORTED)
/* Skip this test if driver supports 8ch but fails in this configuration. */
ztest_test_skip();
#endif

/* Select format that supports eight channels. */
#if !defined(CONFIG_I2S_TEST_DATA_FORMAT_PCM_LONG_UNSUPPORTED)
i2s_cfg.format = I2S_FMT_DATA_FORMAT_PCM_LONG;
TC_PRINT("Selected format is I2S_FMT_DATA_FORMAT_PCM_LONG\n");
#elif !defined(CONFIG_I2S_TEST_DATA_FORMAT_PCM_SHORT_UNSUPPORTED)
i2s_cfg.format = I2S_FMT_DATA_FORMAT_PCM_SHORT;
TC_PRINT("Selected format is I2S_FMT_DATA_FORMAT_PCM_SHORT\n");
#else
#error "Don't know what format supports eight channels."
#endif

i2s_dir_both_transfer_long(&i2s_cfg);
#endif /* CONFIG_I2S_TEST_EIGHT_CHANNELS_UNSUPPORTED */
}

/** @brief Test I2S transfer with format I2S_FMT_DATA_FORMAT_I2S
*/
ZTEST(i2s_additional, test_03a_format_i2s)
Expand Down
11 changes: 11 additions & 0 deletions tests/drivers/i2s/i2s_additional/testcase.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,17 @@ tests:
drivers.i2s.additional.gpio_loopback.54h:
harness_config:
fixture: i2s_loopback
extra_configs:
- CONFIG_I2S_TEST_EIGHT_CHANNELS_32B_48K_UNSUPPORTED=y
platform_allow:
- nrf54h20dk/nrf54h20/cpuapp
integration_platforms:
- nrf54h20dk/nrf54h20/cpuapp

drivers.i2s.additional.gpio_loopback.54h.aclk:
harness_config:
fixture: i2s_loopback
extra_args: EXTRA_DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_aclk.overlay"
platform_allow:
- nrf54h20dk/nrf54h20/cpuapp
integration_platforms:
Expand Down