Add support of MediaTek mt8186 to SOF
Subsystems (4)
cover Add support of MediaTek mt8186 to SOF
Add support of MediaTek mt8186 SoC DSP to SOF.
This series is taken from thesofproject/linux/tree/topic/sof-dev-rebase.
Tinghan Shen (4):
ASoC: SOF: mediatek: Add mt8186 hardware support
ASoC: SOF: mediatek: Add mt8186 sof fw loader and dsp ops
ASoC: SOF: mediatek: Add mt8186 dsp clock support
ASoC: SOF: mediatek: Add DSP system PM callback for mt8186
sound/soc/sof/mediatek/Kconfig | 9 + sound/soc/sof/mediatek/Makefile | 1 + sound/soc/sof/mediatek/adsp_helper.h | 8 + sound/soc/sof/mediatek/mt8186/Makefile | 4 + sound/soc/sof/mediatek/mt8186/mt8186-clk.c | 101 +++++ sound/soc/sof/mediatek/mt8186/mt8186-clk.h | 24 + sound/soc/sof/mediatek/mt8186/mt8186-loader.c | 53 +++ sound/soc/sof/mediatek/mt8186/mt8186.c | 413 ++++++++++++++++++ sound/soc/sof/mediatek/mt8186/mt8186.h | 80 ++++ 9 files changed, 693 insertions(+) create mode 100644 sound/soc/sof/mediatek/mt8186/Makefile create mode 100644 sound/soc/sof/mediatek/mt8186/mt8186-clk.c create mode 100644 sound/soc/sof/mediatek/mt8186/mt8186-clk.h create mode 100644 sound/soc/sof/mediatek/mt8186/mt8186-loader.c create mode 100644 sound/soc/sof/mediatek/mt8186/mt8186.c create mode 100644 sound/soc/sof/mediatek/mt8186/mt8186.h
Signature · 7 lines
2.18.0 _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek
PATCH 1/4 ASoC: SOF: mediatek: Add mt8186 hardware support
Add support of SOF on Mediatek mt8186 SoC.
MT8186 has 2 Cortex A76 cores paired with 6 Cortex A55 cores. It also has Cadence HiFi-5 DSP single core. The IPC communication between AP and DSP is based on shared DRAM and mailbox interrupt.
--- sound/soc/sof/mediatek/Kconfig | 9 + sound/soc/sof/mediatek/Makefile | 1 + sound/soc/sof/mediatek/adsp_helper.h | 8 + sound/soc/sof/mediatek/mt8186/Makefile | 4 + sound/soc/sof/mediatek/mt8186/mt8186.c | 352 +++++++++++++++++++++++++ sound/soc/sof/mediatek/mt8186/mt8186.h | 77 ++++++ 6 files changed, 451 insertions(+) create mode 100644 sound/soc/sof/mediatek/mt8186/Makefile create mode 100644 sound/soc/sof/mediatek/mt8186/mt8186.c create mode 100644 sound/soc/sof/mediatek/mt8186/mt8186.h
sound/soc/sof/mediatek/Kconfig +9 -0
@@ -21,6 +21,15 @@ config SND_SOC_SOF_MTK_COMMON This option is not user-selectable but automagically handled by 'select' statements at a higher level +config SND_SOC_SOF_MT8186 + tristate "SOF support for MT8186 audio DSP" + select SND_SOC_SOF_MTK_COMMON + help + This adds support for Sound Open Firmware for Mediatek platforms + using the mt8186 processors. + Say Y if you have such a device. + If unsure select "N". + config SND_SOC_SOF_MT8195 tristate "SOF support for MT8195 audio DSP" select SND_SOC_SOF_MTK_COMMON
sound/soc/sof/mediatek/Makefile +1 -0
@@ -1,2 +1,3 @@ # SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) obj-$(CONFIG_SND_SOC_SOF_MT8195) += mt8195/ +obj-$(CONFIG_SND_SOC_SOF_MT8186) += mt8186/
sound/soc/sof/mediatek/adsp_helper.h +8 -0
@@ -29,6 +29,14 @@ struct mtk_adsp_chip_info {void __iomem *shared_dram;/* part of va_dram */ phys_addr_t adsp_bootup_addr;int dram_offset;/*dram offset between system and dsp view*/ + +phys_addr_t pa_secreg; +u32 secregsize; +void __iomem *va_secreg; + +phys_addr_t pa_busreg; +u32 busregsize; +void __iomem *va_busreg; };struct adsp_priv {
sound/soc/sof/mediatek/mt8186/Makefile new file +4 -0
@@ -0,0 +1,4 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) +snd-sof-mt8186-objs := mt8186.o +obj-$(CONFIG_SND_SOC_SOF_MT8186) += snd-sof-mt8186.o +
sound/soc/sof/mediatek/mt8186/mt8186.c new file +352 -0
352 lines not on this page · raw message
sound/soc/sof/mediatek/mt8186/mt8186.h new file +77 -0
77 lines not on this page · raw message
Signature · 1 line
2.18.0
PATCH 2/4 ASoC: SOF: mediatek: Add mt8186 sof fw loader and dsp ops
In reply to Tinghan ShenAdd mt8186-loader module with ops callback to load and run firmware on mt8186 SoC.
--- sound/soc/sof/mediatek/mt8186/Makefile | 2 +- sound/soc/sof/mediatek/mt8186/mt8186-loader.c | 53 +++++++++++++++++++ sound/soc/sof/mediatek/mt8186/mt8186.c | 18 +++++++ sound/soc/sof/mediatek/mt8186/mt8186.h | 3 ++ 4 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 sound/soc/sof/mediatek/mt8186/mt8186-loader.c
sound/soc/sof/mediatek/mt8186/Makefile +1 -1
@@ -1,4 +1,4 @@ # SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) -snd-sof-mt8186-objs := mt8186.o +snd-sof-mt8186-objs := mt8186.o mt8186-loader.o obj-$(CONFIG_SND_SOC_SOF_MT8186) += snd-sof-mt8186.o
sound/soc/sof/mediatek/mt8186/mt8186-loader.c new file +53 -0
53 lines not on this page · raw message
sound/soc/sof/mediatek/mt8186/mt8186.c +18 -0
@@ -204,6 +204,17 @@ static int adsp_shared_base_ioremap(struct platform_device *pdev, void *data)return 0 ; } +static int mt8186_run (struct snd_sof_dev *sdev) +{ +u32 adsp_bootup_addr; + + adsp_bootup_addr =SRAM_PHYS_BASE_FROM_DSP_VIEW ; +dev_dbg (sdev->dev,"HIFIxDSP boot from base : 0x%08X\n" , adsp_bootup_addr); +sof_hifixdsp_boot_sequence (sdev, adsp_bootup_addr); + +return 0 ; +} +static int mt8186_dsp_probe (struct snd_sof_dev *sdev) { struct platform_device *pdev = container_of(sdev->dev, struct platform_device, dev);
@@ -272,6 +283,7 @@ static int mt8186_dsp_probe(struct snd_sof_dev *sdev)static int mt8186_dsp_remove (struct snd_sof_dev *sdev) { +sof_hifixdsp_shutdown (sdev);adsp_sram_power_off (sdev);return 0 ;
@@ -289,6 +301,9 @@ static struct snd_sof_dsp_ops sof_mt8186_ops = { .probe = mt8186_dsp_probe, .remove = mt8186_dsp_remove, +/* DSP core boot */ + .run = mt8186_run, +/* Block IO */ .block_read = sof_block_read, .block_write = sof_block_write,
@@ -302,6 +317,9 @@ static struct snd_sof_dsp_ops sof_mt8186_ops = {/* misc */ .get_bar_index = mt8186_get_bar_index, +/* firmware loading */ + .load_firmware = snd_sof_load_firmware_memcpy, +/* Firmware ops */ .dsp_arch_ops = &sof_xtensa_arch_ops,
sound/soc/sof/mediatek/mt8186/mt8186.h +3 -0
@@ -10,6 +10,7 @@#define __MT8186_Hstruct mtk_adsp_chip_info ; +struct snd_sof_dev ;#define DSP_REG_BAR 4#define DSP_SECREG_BAR 5
@@ -74,4 +75,6 @@ struct mtk_adsp_chip_info;#define SIZE_SHARED_DRAM_UL 0x40000/*Shared buffer for Uplink*/ #define TOTAL_SIZE_SHARED_DRAM_FROM_TAIL (SIZE_SHARED_DRAM_DL + SIZE_SHARED_DRAM_UL) +void sof_hifixdsp_boot_sequence (struct snd_sof_dev *sdev,u32 boot_addr); +void sof_hifixdsp_shutdown (struct snd_sof_dev *sdev);#endif
Signature · 1 line
2.18.0
PATCH 3/4 ASoC: SOF: mediatek: Add mt8186 dsp clock support
In reply to Tinghan ShenAdd adsp clock on/off support on mt8186 SoC.
--- sound/soc/sof/mediatek/mt8186/Makefile | 2 +- sound/soc/sof/mediatek/mt8186/mt8186-clk.c | 101 +++++++++++++++++++++ sound/soc/sof/mediatek/mt8186/mt8186-clk.h | 24 +++++ sound/soc/sof/mediatek/mt8186/mt8186.c | 15 +++ 4 files changed, 141 insertions(+), 1 deletion(-) create mode 100644 sound/soc/sof/mediatek/mt8186/mt8186-clk.c create mode 100644 sound/soc/sof/mediatek/mt8186/mt8186-clk.h
sound/soc/sof/mediatek/mt8186/Makefile +1 -1
@@ -1,4 +1,4 @@ # SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) -snd-sof-mt8186-objs := mt8186.o mt8186-loader.o +snd-sof-mt8186-objs := mt8186.o mt8186-clk.o mt8186-loader.o obj-$(CONFIG_SND_SOC_SOF_MT8186) += snd-sof-mt8186.o
sound/soc/sof/mediatek/mt8186/mt8186-clk.c new file +101 -0
101 lines not on this page · raw message
sound/soc/sof/mediatek/mt8186/mt8186-clk.h new file +24 -0
@@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */ + +/* +* Copyright (c) 2022 MediaTek Corporation. All rights reserved. +* +* Header file for the mt8186 DSP clock definition +*/ + +#ifndef __MT8186_CLK_H +#define __MT8186_CLK_H + +struct snd_sof_dev ; + +/* DSP clock */ +enum adsp_clk_id { +CLK_TOP_AUDIODSP , +CLK_TOP_ADSP_BUS , +ADSP_CLK_MAX +}; + +int mt8186_adsp_init_clock (struct snd_sof_dev *sdev); +int adsp_clock_on (struct snd_sof_dev *sdev); +void adsp_clock_off (struct snd_sof_dev *sdev); +#endif
sound/soc/sof/mediatek/mt8186/mt8186.c +15 -0
@@ -25,6 +25,7 @@#include "../../sof-audio.h" #include "../adsp_helper.h" #include "mt8186.h" +#include "mt8186-clk.h" static int platform_parse_resource (struct platform_device *pdev,void *data) {
@@ -276,6 +277,19 @@ static int mt8186_dsp_probe(struct snd_sof_dev *sdev)return ret; } +/* enable adsp clock before touching registers */ + ret =mt8186_adsp_init_clock (sdev); +if (ret) { +dev_err (sdev->dev,"mt8186_adsp_init_clock failed\n" ); +return ret; + } + + ret =adsp_clock_on (sdev); +if (ret) { +dev_err (sdev->dev,"adsp_clock_on fail!\n" ); +return ret; + } +adsp_sram_power_on (sdev);return 0 ;
@@ -285,6 +299,7 @@ static int mt8186_dsp_remove(struct snd_sof_dev *sdev) {sof_hifixdsp_shutdown (sdev);adsp_sram_power_off (sdev); +adsp_clock_off (sdev);return 0 ; }
Signature · 1 line
2.18.0
PATCH 4/4 ASoC: SOF: mediatek: Add DSP system PM callback for mt8186
In reply to Tinghan ShenAdd DSP system PM callback for suspend and resume
--- sound/soc/sof/mediatek/mt8186/mt8186.c | 28 ++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
sound/soc/sof/mediatek/mt8186/mt8186.c +28 -0
@@ -304,6 +304,30 @@ static int mt8186_dsp_remove(struct snd_sof_dev *sdev)return 0 ; } +static int mt8186_dsp_suspend (struct snd_sof_dev *sdev,u32 target_state) +{ +sof_hifixdsp_shutdown (sdev); +adsp_sram_power_off (sdev); +adsp_clock_off (sdev); + +return 0 ; +} + +static int mt8186_dsp_resume (struct snd_sof_dev *sdev) +{ +int ret; + + ret =adsp_clock_on (sdev); +if (ret) { +dev_err (sdev->dev,"adsp_clock_on fail!\n" ); +return ret; + } + +adsp_sram_power_on (sdev); + +return ret; +} +/* on mt8186 there is 1 to 1 match between type and BAR idx */ static int mt8186_get_bar_index (struct snd_sof_dev *sdev,u32 type) {
@@ -338,6 +362,10 @@ static struct snd_sof_dsp_ops sof_mt8186_ops = {/* Firmware ops */ .dsp_arch_ops = &sof_xtensa_arch_ops, +/* PM */ + .suspend = mt8186_dsp_suspend, + .resume = mt8186_dsp_resume, +/* ALSA HW info flags */ .hw_info =SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID |
Signature · 1 line
2.18.0
Mark Brown
maintainerQuoted 10 lines · Tinghan Shen
Add support of MediaTek mt8186 SoC DSP to SOF.
This series is taken from thesofproject/linux/tree/topic/sof-dev-rebase.Tinghan Shen (4):
ASoC: SOF: mediatek: Add mt8186 hardware support
ASoC: SOF: mediatek: Add mt8186 sof fw loader and dsp ops
ASoC: SOF: mediatek: Add mt8186 dsp clock support
ASoC: SOF: mediatek: Add DSP system PM callback for mt8186[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/4] ASoC: SOF: mediatek: Add mt8186 hardware support
commit: 1f0214a86de87011ecb96f22545dd6e5c7324cd7
[2/4] ASoC: SOF: mediatek: Add mt8186 sof fw loader and dsp ops
commit: 570c14dc92d5dc6f732cb74fa691ef909d182710
[3/4] ASoC: SOF: mediatek: Add mt8186 dsp clock support
commit: 210b3ab932f7a08d8b912c497ca0ca86f712814f
[4/4] ASoC: SOF: mediatek: Add DSP system PM callback for mt8186
commit: 0e0b83cc7ec7fc5e6695aa6ebbb0961e26096105All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark