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

i.MX RT685's HiFi 4 DSP support #77814

Draft
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

VitekST
Copy link
Contributor

@VitekST VitekST commented Aug 30, 2024

This PR introduces support for the Xtensa LX6 augmented with the HiFi 4 DSP extension on the i.MX RT685, this time compatible with HWMv2.

It instantiates drivers for basic peripherals (GPIO, Flexcomm UART), as well as peripherals responsible for audio (Flexcomm I2S, DMA). Audio playback and capture is enabled and functional. Hardware initialisation, code loading and run control from the CM33 side is also taken care of.

PR created as a draft, as it depends on work in #77674.

@zephyrbot
Copy link
Collaborator

zephyrbot commented Aug 30, 2024

The following west manifest projects have changed revision in this Pull Request:

Name Old Revision New Revision Diff
hal_nxp zephyrproject-rtos/hal_nxp@605560a zephyrproject-rtos/hal_nxp#432 zephyrproject-rtos/hal_nxp#432/files

DNM label due to: 1 project with PR revision

Note: This message is automatically posted and updated by the Manifest GitHub Action.

@zephyrbot zephyrbot added manifest manifest-hal_nxp DNM This PR should not be merged (Do Not Merge) labels Aug 30, 2024
@VitekST VitekST force-pushed the feature/rt685-hifi4-support branch from 938d2f1 to 756aeb0 Compare August 30, 2024 14:52
case DMA_ATTR_BUFFER_ADDRESS_ALIGNMENT:
*value = 4;
return 0;

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should go with break instead of return 0 and add the return 0 at the bottom of the function.

reg = <0x24000000 DT_SIZE_K(64)>;
type = <NXP_RTXXX_ADSP_REGION_DATA>;
};*/

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't have commented code in the final version. So you should remove this. One can look at the history and see the changes.

@@ -264,17 +264,17 @@ static int wm8904_in_update(
static int wm8904_in_volume_config(const struct device *dev, audio_channel_t channel, int volume)
{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bugfix unrelated to the original goal of this PR. Please create another PR for it. Also please fix warnings like this:

image

@dbaluta
Copy link
Collaborator

dbaluta commented Sep 16, 2024

@VitekST excellent work. Since this PR is still in draft and depending on other PR I think we can create separate PR for unrelated code here:

So, we can move in seperate PRs following patches:

  1. dma_mcux_lpc: add host directions, DMA driver ctx, getter func
  2. drivers: wm8904: Fix audio input configuration
  3. Maybe some more which I cannot figure out right now.

A PR with more than 7-8 patches will be very hard to review and get traction from community. Lets put the patches PR by PR :) starting from simple ones.

Copy link

This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time.

@github-actions github-actions bot added the Stale label Nov 16, 2024
@github-actions github-actions bot closed this Nov 30, 2024
@dleach02 dleach02 reopened this Dec 9, 2024
@dleach02 dleach02 removed the Stale label Dec 9, 2024
@fabiobaltieri fabiobaltieri added DNM (manifest) This PR should not be merged (controlled by action-manifest) and removed DNM This PR should not be merged (Do Not Merge) labels Feb 4, 2025
@VitekST VitekST force-pushed the feature/rt685-hifi4-support branch from 756aeb0 to 306164a Compare February 5, 2025 15:33
@VitekST VitekST force-pushed the feature/rt685-hifi4-support branch 3 times, most recently from 68ea788 to 2c5d96a Compare February 13, 2025 14:29
Add support for HOST_TO_MEMORY, MEMORY_TO_HOST directions (aliases of
MEMORY_TO_MEMORY). Implement dma_mcux_lpc_get_attribute function. Fix
missing DMA driver context.

Signed-off-by: Vit Stanicek <[email protected]>
Add drivers/interrupt_controller/intc_nxp_pint/power.h abstracting
EnableDeepSleepIRQ and DisableDeepSleepIRQ invocations from
intc_nxp_pint.c. Modify intc_nxp_pint.c to use that file.

fsl_power.c and fsl_power.h can't be built on the
mimxrt685/mimxrt685s/hifi4 target, so it's excluded from it in hal_nxp.

Signed-off-by: Vit Stanicek <[email protected]>
Support for the i.MX RT685's HiFi 4 DSP domain required changes in the
hal_nxp repo, thus point it to to the HEAD of PR bearing the required
changes.

Temporary.

Signed-off-by: Vit Stanicek <[email protected]>
Add SoC definitions and a linker file for the HiFi 4 DSP on the NXP i.MX
RT685 microcontroller.

Also modify the West manifest - support depends on a different branch of
the Zephyr NXP HAL, which includes some files that were missing when
compiling for the DSP and omits some files that can't compile for the
DSP.

Signed-off-by: Vit Stanicek <[email protected]>
Add a basic device tree for the HiFi 4 DSP on the NXP i.MX RT685
microcontroller.

While no peripherals are instantiated, Zephyr is able to technically run
on this target.

Signed-off-by: Vit Stanicek <[email protected]>
Add board definitions for the HiFi 4 DSP located on the MIMXRT685-EVK.
Also add a basic board-level DT to get Zephyr to technically run.

Signed-off-by: Vit Stanicek <[email protected]>
Add init code - responsible for clock attachment of peripherals
responsible for audio playback (DMA, Flexcomms in I2S mode, ...) and for
INPUTMUX settings (IRQ line routing).

Signed-off-by: Vit Stanicek <[email protected]>
Modify HiFi 4 domain's DT to instantiate GPIO peripherals and the 0th
Flexcomm peripheral in UART mode. Also instantiate associated
peripherals - Pinctrl, Clkctl, PINT.

Signed-off-by: Vit Stanicek <[email protected]>
@VitekST VitekST force-pushed the feature/rt685-hifi4-support branch from 2c5d96a to 15f5282 Compare February 20, 2025 12:34
Add the nxp,rtxxx-adsp-ctrl driver. Responsibility of this driver is to
load code executed by Xtensa-family cores on NXP i.MX RTxxx
microcontrollers and to control their run.

Signed-off-by: Vit Stanicek <[email protected]>
Instantiate the nxp,rtxxx-adsp-ctrl driver to enable DSP code upload and
run control.

Signed-off-by: Vit Stanicek <[email protected]>
Instantiate the MU driver (mbox_nxp_imx_mu.c) for both the CM33 domain
and the HiFi4 domain of the NXP i.MX RT685.

Signed-off-by: Vit Stanicek <[email protected]>
Instantiate Flexcomm #1, Flexcomm #3, DMA #1 and I3C - these are
peripherals responsible for audio playback and capture on the i.MX
RT685's HiFi 4 domain.

Signed-off-by: Vit Stanicek <[email protected]>
Add initialisation code for the HiFi 4 DSP domain of the mimxrt685_evk
board. Responsible for setting up signal sharing between Flexcomm #1 and
Flexcomm #3 peripherals both in the I2S mode (simultaneous audio
playback and capture).

Signed-off-by: Vit Stanicek <[email protected]>
Instantiate, configure and enable Flexcomm #1, Flexcomm #3, DMA, I3C for
audio capture and playback on mimxrt685_evk's HiFi 4 DSP domain. Add
pinmux definitions for those.

Signed-off-by: Vit Stanicek <[email protected]>
Rework linker file for mimxrt685s/hifi4 - clarify region names, fix
nonsensical text region size. Move hifi4 data and text regions from
ITCM/DTCM to the main SRAM (partitions 28 and 29). Modify load regions
and cut memory allocation for mimxrt685s/cm33 to prevent overlaps.

This change was motivated by the DSP's ITCM and DTCM not being big
enough for Zephyr audio applications.

Signed-off-by: Vit Stanicek <[email protected]>
@VitekST VitekST force-pushed the feature/rt685-hifi4-support branch from 15f5282 to a3341f5 Compare February 27, 2025 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DNM (manifest) This PR should not be merged (controlled by action-manifest) manifest manifest-hal_nxp
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants