Skip to content

Commit dc1318d

Browse files
nordic-seglnordicjm
authored andcommitted
[nrf fromtree] tests: drivers: audio: dmic_api: Enable test on nRF54L20pdk
Add test configuration on DMIC nodes that are compatible with 'nordic_nrf_pdm'. Add missing DTS definitions in a board overlay. Signed-off-by: Sebastian Głąb <[email protected]> (cherry picked from commit 22d9f0c)
1 parent 42c5718 commit dc1318d

File tree

2 files changed

+37
-3
lines changed

2 files changed

+37
-3
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Copyright (c) 2025 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/ {
8+
aliases {
9+
dmic-dev = &pdm20;
10+
};
11+
};
12+
13+
&pinctrl {
14+
pdm20_default_alt: pdm20_default_alt {
15+
group1 {
16+
psels = <NRF_PSEL(PDM_CLK, 1, 10)>,
17+
<NRF_PSEL(PDM_DIN, 1, 11)>;
18+
};
19+
};
20+
};
21+
22+
dmic_dev: &pdm20 {
23+
status = "okay";
24+
pinctrl-0 = <&pdm20_default_alt>;
25+
pinctrl-names = "default";
26+
clock-source = "PCLK32M";
27+
};

tests/drivers/audio/dmic_api/src/main.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,21 @@ static const struct device *dmic_dev = DEVICE_DT_GET(DT_ALIAS(dmic_dev));
2121
#define BYTES_PER_SAMPLE sizeof(int16_t)
2222
#define SLAB_ALIGN 4
2323
#define MAX_SAMPLE_RATE 48000
24+
#elif DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_pdm)
25+
#define PDM_CHANNELS 2
26+
#define SAMPLE_BIT_WIDTH 16
27+
#define BYTES_PER_SAMPLE sizeof(int16_t)
28+
#define SLAB_ALIGN 4
29+
#define MAX_SAMPLE_RATE 48000
30+
#else
31+
#error "Unsupported DMIC device"
32+
#endif
33+
2434
/* Milliseconds to wait for a block to be read. */
2535
#define READ_TIMEOUT 1000
2636
/* Size of a block for 100 ms of audio data. */
2737
#define BLOCK_SIZE(_sample_rate, _number_of_channels) \
2838
(BYTES_PER_SAMPLE * (_sample_rate / 10) * _number_of_channels)
29-
#else
30-
#error "Unsupported DMIC device"
31-
#endif
3239

3340
/* Driver will allocate blocks from this slab to receive audio data into them.
3441
* Application, after getting a given block from the driver and processing its

0 commit comments

Comments
 (0)