drivers: audio: dmic: Add support for nRF PDM peripherals

Add a shim that allows using the nrfx PDM driver via the Zephyr API.
Add also missing devicetree nodes representing the PDM peripherals
in the nRF52 Series SoCs.
Extend the "nordic,nrf-pdm" binding with a new property that allows
specifying the clock source to be used by the PDM peripheral (so that
it is possible to use HFXO for better accuracy of the peripheral clock
or, in the nRF53 Series SoCs, to use the dedicated audio oscillator).

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
This commit is contained in:
Andrzej Głąbek
2021-08-19 17:11:46 +02:00
committed by Anas Nashif
parent 25f5601563
commit 1bf7c391b8
11 changed files with 658 additions and 0 deletions

View File

@@ -190,6 +190,7 @@
/drivers/*/*andes* @cwshu @Teng-Shih-Wei
/drivers/adc/ @anangl
/drivers/adc/adc_stm32.c @cybertale
/drivers/audio/*nrfx* @anangl
/drivers/bbram/* @yperess @sjg20 @jackrosenthal
/drivers/bluetooth/ @joerchan @jhedberg @Vudentz
/drivers/cache/ @carlocaione

View File

@@ -15,3 +15,4 @@ zephyr_library_sources_ifdef(CONFIG_AUDIO_INTEL_DMIC decimation/pdm_decim_int32_
zephyr_library_sources_ifdef(CONFIG_AUDIO_INTEL_DMIC decimation/pdm_decim_table.c)
zephyr_library_sources_ifdef(CONFIG_AUDIO_MPXXDTYY mpxxdtyy.c)
zephyr_library_sources_ifdef(CONFIG_AUDIO_MPXXDTYY mpxxdtyy-i2s.c)
zephyr_library_sources_ifdef(CONFIG_AUDIO_DMIC_NRFX_PDM dmic_nrfx_pdm.c)

View File

@@ -52,6 +52,7 @@ source "subsys/logging/Kconfig.template.log_config"
source "drivers/audio/Kconfig.intel_dmic"
source "drivers/audio/Kconfig.mpxxdtyy"
source "drivers/audio/Kconfig.dmic_pdm_nrfx"
endif # AUDIO_DMIC

View File

@@ -0,0 +1,13 @@
# Copyright (c) 2021 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
# Workaround for not being able to have commas in macro arguments
DT_COMPAT_NORDIC_NRF_PDM := nordic,nrf-pdm
config AUDIO_DMIC_NRFX_PDM
bool "nRF PDM nrfx driver"
depends on $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF_PDM))
default y
select NRFX_PDM
help
Enable support for nrfx PDM driver for nRF MCU series.

File diff suppressed because it is too large Load Diff

View File

@@ -226,6 +226,14 @@
#pwm-cells = <1>;
};
pdm0: pdm@4001d000 {
compatible = "nordic,nrf-pdm";
reg = <0x4001d000 0x1000>;
interrupts = <29 NRF_DEFAULT_IRQ_PRIORITY>;
status = "disabled";
label = "PDM_0";
};
flash_controller: flash-controller@4001e000 {
compatible = "nordic,nrf52-flash-controller";
reg = <0x4001e000 0x1000>;

View File

@@ -249,6 +249,14 @@
#pwm-cells = <1>;
};
pdm0: pdm@4001d000 {
compatible = "nordic,nrf-pdm";
reg = <0x4001d000 0x1000>;
interrupts = <29 NRF_DEFAULT_IRQ_PRIORITY>;
status = "disabled";
label = "PDM_0";
};
flash_controller: flash-controller@4001e000 {
compatible = "nordic,nrf52-flash-controller";
reg = <0x4001e000 0x1000>;

View File

@@ -308,6 +308,14 @@
#pwm-cells = <1>;
};
pdm0: pdm@4001d000 {
compatible = "nordic,nrf-pdm";
reg = <0x4001d000 0x1000>;
interrupts = <29 NRF_DEFAULT_IRQ_PRIORITY>;
status = "disabled";
label = "PDM_0";
};
flash_controller: flash-controller@4001e000 {
compatible = "nordic,nrf52-flash-controller";
reg = <0x4001e000 0x1000>;

View File

@@ -313,6 +313,14 @@
#pwm-cells = <1>;
};
pdm0: pdm@4001d000 {
compatible = "nordic,nrf-pdm";
reg = <0x4001d000 0x1000>;
interrupts = <29 NRF_DEFAULT_IRQ_PRIORITY>;
status = "disabled";
label = "PDM_0";
};
flash_controller: flash-controller@4001e000 {
compatible = "nordic,nrf52-flash-controller";
reg = <0x4001e000 0x1000>;

View File

@@ -308,6 +308,14 @@
#pwm-cells = <1>;
};
pdm0: pdm@4001d000 {
compatible = "nordic,nrf-pdm";
reg = <0x4001d000 0x1000>;
interrupts = <29 NRF_DEFAULT_IRQ_PRIORITY>;
status = "disabled";
label = "PDM_0";
};
flash_controller: flash-controller@4001e000 {
compatible = "nordic,nrf52-flash-controller";
reg = <0x4001e000 0x1000>;

View File

@@ -23,3 +23,30 @@ properties:
type: int
required: true
description: DIN pin
clock-source:
type: string
required: false
default: "PCLK32M_HFXO"
description: |
Clock source to be used by the PDM peripheral. The following options
are available:
- "PCLK32M": 32 MHz peripheral clock, synchronous to HFCLK
- "PCLK32M_HFXO": PCLK32M running off the 32 MHz crystal oscillator
(HFXO) for better clock accuracy and jitter performance
- "ACLK": Audio PLL clock with configurable frequency (frequency for
this clock must be set via the "hfclkaudio-frequency" property
in the "nordic,nrf-clock" node); this clock source is only available
in the nRF53 Series SoCs and it requires the use of HFXO
enum:
- "PCLK32M"
- "PCLK32M_HFXO"
- "ACLK"
queue-size:
type: int
required: false
default: 4
description: |
Size of the queue of received audio data blocks to be used
by the driver.