Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nxp: Add SAI driver with the DAI interface #65187

Merged
merged 4 commits into from
Dec 20, 2023
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
18 changes: 18 additions & 0 deletions drivers/clock_control/clock_control_mcux_ccm_rev2.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,24 @@ static int mcux_ccm_get_subsys_rate(const struct device *dev,
break;
#endif

#if defined(CONFIG_SOC_MIMX93_A55) && defined(CONFIG_DAI_NXP_SAI)
case IMX_CCM_SAI1_CLK:
case IMX_CCM_SAI2_CLK:
case IMX_CCM_SAI3_CLK:
clock_root = kCLOCK_Root_Sai1 + instance;
uint32_t mux = CLOCK_GetRootClockMux(clock_root);
uint32_t divider = CLOCK_GetRootClockDiv(clock_root);

/* assumption: SAI's SRC is AUDIO_PLL */
if (mux != 1) {
return -EINVAL;
}

/* assumption: AUDIO_PLL's frequency is 393216000 Hz */
*rate = 393216000 / divider;

return 0;
#endif
default:
return -EINVAL;
}
Expand Down
1 change: 1 addition & 0 deletions drivers/dai/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ add_subdirectory_ifdef(CONFIG_DAI_INTEL_SSP intel/ssp)
add_subdirectory_ifdef(CONFIG_DAI_INTEL_ALH intel/alh)
add_subdirectory_ifdef(CONFIG_DAI_INTEL_DMIC intel/dmic)
add_subdirectory_ifdef(CONFIG_DAI_INTEL_HDA intel/hda)
add_subdirectory_ifdef(CONFIG_DAI_NXP_SAI nxp/sai)
1 change: 1 addition & 0 deletions drivers/dai/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@ source "drivers/dai/intel/ssp/Kconfig.ssp"
source "drivers/dai/intel/alh/Kconfig.alh"
source "drivers/dai/intel/dmic/Kconfig.dmic"
source "drivers/dai/intel/hda/Kconfig.hda"
source "drivers/dai/nxp/sai/Kconfig.sai"

endif # DAI
5 changes: 5 additions & 0 deletions drivers/dai/nxp/sai/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright 2023 NXP
# SPDX-License-Identifier: Apache-2.0

zephyr_library()
zephyr_library_sources(sai.c)
30 changes: 30 additions & 0 deletions drivers/dai/nxp/sai/Kconfig.sai
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright 2023 NXP
# SPDX-License-Identifier: Apache-2.0

config DAI_NXP_SAI
bool "NXP Synchronous Audio Interface (SAI) driver"
default y
depends on DT_HAS_NXP_DAI_SAI_ENABLED
help
Select this to enable NXP SAI driver.

if DAI_NXP_SAI

config SAI_HAS_MCLK_CONFIG_OPTION
bool "Set if SAI has MCLK configuration options"
default n
help
Select this if the SAI IP allows configuration
of the master clock. Master clock configuration
refers to enabling/disabling the master clock,
setting the signal as input or output or dividing
the master clock output.

config SAI_FIFO_WORD_SIZE
int "Size (in bytes) of a FIFO word"
default 4
help
Use this to set the size (in bytes) of a SAI
FIFO word.

endif # DAI_NXP_SAI
Loading
Loading