Skip to content

Commit b0b6990

Browse files
committed
[nrf fromlist] tests: drivers: i2s: Add test for 8ch, 32bit, 48k TDM
Add test case where TDM is thested with 8 channels, 32 bit workd size, 48k sample rate. Upstream PR #: 95249 Signed-off-by: Sebastian Głąb <[email protected]>
1 parent dc15a79 commit b0b6990

File tree

3 files changed

+58
-1
lines changed

3 files changed

+58
-1
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
* Copyright (c) 2025 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
&audiopll {
8+
status = "okay";
9+
frequency = <NRFS_AUDIOPLL_FREQ_AUDIO_48K>;
10+
};
11+
12+
&tdm130 {
13+
mck-frequency = <12288000>;
14+
mck-clock-source = "ACLK";
15+
sck-clock-source = "ACLK";
16+
};

tests/drivers/i2s/i2s_additional/src/main.c

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ ZTEST(i2s_additional, test_02b_four_channels)
519519
#endif /* CONFIG_I2S_TEST_FOUR_CHANNELS_UNSUPPORTED */
520520
}
521521

522-
/** @brief Test I2S transfer with eight channels.
522+
/** @brief Test I2S transfer with eight channels, 16 bit and 44.1 kHz.
523523
*/
524524
ZTEST(i2s_additional, test_02c_eight_channels)
525525
{
@@ -549,6 +549,38 @@ ZTEST(i2s_additional, test_02c_eight_channels)
549549
#endif /* CONFIG_I2S_TEST_EIGHT_CHANNELS_UNSUPPORTED */
550550
}
551551

552+
/** @brief Test I2S transfer with eight channels, 32 bit and 48 kHz.
553+
*/
554+
ZTEST(i2s_additional, test_02d_eight_channels)
555+
{
556+
struct i2s_config i2s_cfg = default_i2s_cfg;
557+
558+
i2s_cfg.channels = 8;
559+
i2s_cfg.word_size = 32;
560+
i2s_cfg.frame_clk_freq = 48000;
561+
562+
#if defined(CONFIG_I2S_TEST_EIGHT_CHANNELS_UNSUPPORTED)
563+
int ret;
564+
565+
ret = i2s_configure(dev_i2s, I2S_DIR_TX, &i2s_cfg);
566+
zassert_equal(ret, -EINVAL, "Unexpected result %d", ret);
567+
#else /* CONFIG_I2S_TEST_EIGHT_CHANNELS_UNSUPPORTED */
568+
569+
/* Select format that supports eight channels. */
570+
#if !defined(CONFIG_I2S_TEST_DATA_FORMAT_PCM_LONG_UNSUPPORTED)
571+
i2s_cfg.format = I2S_FMT_DATA_FORMAT_PCM_LONG;
572+
TC_PRINT("Selected format is I2S_FMT_DATA_FORMAT_PCM_LONG\n");
573+
#elif !defined(CONFIG_I2S_TEST_DATA_FORMAT_PCM_SHORT_UNSUPPORTED)
574+
i2s_cfg.format = I2S_FMT_DATA_FORMAT_PCM_SHORT;
575+
TC_PRINT("Selected format is I2S_FMT_DATA_FORMAT_PCM_SHORT\n");
576+
#else
577+
#error "Don't know what format supports eight channels."
578+
#endif
579+
580+
i2s_dir_both_transfer_long(&i2s_cfg);
581+
#endif /* CONFIG_I2S_TEST_EIGHT_CHANNELS_UNSUPPORTED */
582+
}
583+
552584
/** @brief Test I2S transfer with format I2S_FMT_DATA_FORMAT_I2S
553585
*/
554586
ZTEST(i2s_additional, test_03a_format_i2s)

tests/drivers/i2s/i2s_additional/testcase.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,15 @@ tests:
3131
integration_platforms:
3232
- nrf54h20dk/nrf54h20/cpuapp
3333

34+
drivers.i2s.additional.gpio_loopback.54h.aclk:
35+
harness_config:
36+
fixture: i2s_loopback
37+
extra_args: EXTRA_DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_aclk.overlay"
38+
platform_allow:
39+
- nrf54h20dk/nrf54h20/cpuapp
40+
integration_platforms:
41+
- nrf54h20dk/nrf54h20/cpuapp
42+
3443
drivers.i2s.additional.gpio_loopback.aclk:
3544
harness_config:
3645
fixture: gpio_loopback

0 commit comments

Comments
 (0)