ASoC: SOF: Platform updates for AMD and Mediatek
Subsystems (5)
cover ASoC: SOF: Platform updates for AMD and Mediatek
From: Daniel Baluta <[email protected]>
This patchseries adds Renoir ACP HW support and Mediatek MT8195 platform.
Notes:
- I first send the meditatek support in a previous emails but it failed to apply because there are some dependencies on AMD patches related to DAI ids.
Ajit Kumar Pandey (12):
ASoC: SOF: amd: Add Renoir ACP HW support
ASoC: SOF: amd: Add helper callbacks for ACP's DMA configuration
ASoC: SOF: amd: Add fw loader and renoir dsp ops to load firmware
ASoC: SOF: amd: Add IPC support for ACP IP block
ASoC: SOF: amd: Add dai driver dsp ops callback for Renoir
ASoC: SOF: amd: Add PCM stream callback for Renoir dai's
ASoC: amd: Add module to determine ACP configuration
ASoC: SOF: amd: Add machine driver dsp ops for Renoir platform
ASoC: SOF: amd: Add Renoir PCI driver interface
ASoC: amd: acp-config: Remove legacy acpi based machine struct
ASoC: SOF: topology: Add support for AMD ACP DAIs
ASoC: SOF: amd: Add support for SOF firmware authentication
V sujith kumar Reddy (1):
ASoC: SOF: amd: Add trace logger support
YC Hung (8):
ASoC: SOF: mediatek: Add mt8195 hardware support
ASoC: SOF: tokens: add token for Mediatek AFE
ASoC: SOF: topology: Add support for Mediatek AFE DAI
ASoC: SOF: mediatek: Add fw loader and mt8195 dsp ops to load firmware
ASoC: SOF: Add mt8195 device descriptor
ASoC: SOF: mediatek: Add dai driver dsp ops callback for mt8195
ASoC: SOF: mediatek: Add mt8195 dsp clock support
ASoC: SOF: mediatek: Add DSP system PM callback for mt8195
include/sound/sof/dai-amd.h | 21 + include/sound/sof/dai-mediatek.h | 23 + include/sound/sof/dai.h | 10 + include/uapi/sound/sof/tokens.h | 5 + sound/soc/amd/Kconfig | 6 + sound/soc/amd/Makefile | 2 + sound/soc/amd/acp-config.c | 71 +++ sound/soc/amd/mach-config.h | 28 ++ sound/soc/sof/Kconfig | 4 +- sound/soc/sof/Makefile | 2 + sound/soc/sof/amd/Kconfig | 33 ++ sound/soc/sof/amd/Makefile | 11 + sound/soc/sof/amd/acp-dsp-offset.h | 78 +++ sound/soc/sof/amd/acp-ipc.c | 187 ++++++++ sound/soc/sof/amd/acp-loader.c | 199 ++++++++ sound/soc/sof/amd/acp-pcm.c | 82 ++++ sound/soc/sof/amd/acp-stream.c | 181 +++++++ sound/soc/sof/amd/acp-trace.c | 84 ++++ sound/soc/sof/amd/acp.c | 446 ++++++++++++++++++ sound/soc/sof/amd/acp.h | 226 +++++++++ sound/soc/sof/amd/pci-rn.c | 165 +++++++ sound/soc/sof/amd/renoir.c | 185 ++++++++ sound/soc/sof/mediatek/Kconfig | 33 ++ sound/soc/sof/mediatek/Makefile | 2 + sound/soc/sof/mediatek/adsp_helper.h | 49 ++ sound/soc/sof/mediatek/mediatek-ops.h | 8 + sound/soc/sof/mediatek/mt8195/Makefile | 3 + sound/soc/sof/mediatek/mt8195/mt8195-clk.c | 158 +++++++ sound/soc/sof/mediatek/mt8195/mt8195-clk.h | 28 ++ sound/soc/sof/mediatek/mt8195/mt8195-loader.c | 56 +++ sound/soc/sof/mediatek/mt8195/mt8195.c | 437 +++++++++++++++++ sound/soc/sof/mediatek/mt8195/mt8195.h | 158 +++++++ sound/soc/sof/pcm.c | 48 ++ sound/soc/sof/sof-of-dev.c | 13 + sound/soc/sof/topology.c | 168 +++++++ 35 files changed, 3209 insertions(+), 1 deletion(-) create mode 100644 include/sound/sof/dai-amd.h create mode 100644 include/sound/sof/dai-mediatek.h create mode 100644 sound/soc/amd/acp-config.c create mode 100644 sound/soc/amd/mach-config.h create mode 100644 sound/soc/sof/amd/Kconfig create mode 100644 sound/soc/sof/amd/Makefile create mode 100644 sound/soc/sof/amd/acp-dsp-offset.h create mode 100644 sound/soc/sof/amd/acp-ipc.c create mode 100644 sound/soc/sof/amd/acp-loader.c create mode 100644 sound/soc/sof/amd/acp-pcm.c create mode 100644 sound/soc/sof/amd/acp-stream.c create mode 100644 sound/soc/sof/amd/acp-trace.c create mode 100644 sound/soc/sof/amd/acp.c create mode 100644 sound/soc/sof/amd/acp.h create mode 100644 sound/soc/sof/amd/pci-rn.c create mode 100644 sound/soc/sof/amd/renoir.c create mode 100644 sound/soc/sof/mediatek/Kconfig create mode 100644 sound/soc/sof/mediatek/Makefile create mode 100644 sound/soc/sof/mediatek/adsp_helper.h create mode 100644 sound/soc/sof/mediatek/mediatek-ops.h create mode 100644 sound/soc/sof/mediatek/mt8195/Makefile create mode 100644 sound/soc/sof/mediatek/mt8195/mt8195-clk.c create mode 100644 sound/soc/sof/mediatek/mt8195/mt8195-clk.h create mode 100644 sound/soc/sof/mediatek/mt8195/mt8195-loader.c create mode 100644 sound/soc/sof/mediatek/mt8195/mt8195.c create mode 100644 sound/soc/sof/mediatek/mt8195/mt8195.h
Signature · 1 line
2.27.0
PATCH 1/21 ASoC: SOF: amd: Add Renoir ACP HW support
From: Ajit Kumar Pandey <[email protected]>
This patch initializes ACP HW block to support SOF on AMD Renoir platform.
--- sound/soc/sof/Kconfig | 1 + sound/soc/sof/Makefile | 1 + sound/soc/sof/amd/Kconfig | 30 ++++++++ sound/soc/sof/amd/Makefile | 11 +++ sound/soc/sof/amd/acp-dsp-offset.h | 20 +++++ sound/soc/sof/amd/acp.c | 118 +++++++++++++++++++++++++++++ sound/soc/sof/amd/acp.h | 36 +++++++++ sound/soc/sof/amd/renoir.c | 34 +++++++++ 8 files changed, 251 insertions(+) create mode 100644 sound/soc/sof/amd/Kconfig create mode 100644 sound/soc/sof/amd/Makefile create mode 100644 sound/soc/sof/amd/acp-dsp-offset.h create mode 100644 sound/soc/sof/amd/acp.c create mode 100644 sound/soc/sof/amd/acp.h create mode 100644 sound/soc/sof/amd/renoir.c
sound/soc/sof/Kconfig +1 -0
@@ -223,6 +223,7 @@ config SND_SOC_SOF_PROBE_WORK_QUEUE When selected, the probe is handled in two steps, for example to avoid lockdeps if request_module is used in the probe. +source "sound/soc/sof/amd/Kconfig" source "sound/soc/sof/imx/Kconfig" source "sound/soc/sof/intel/Kconfig" source "sound/soc/sof/xtensa/Kconfig"
sound/soc/sof/Makefile +1 -0
@@ -22,4 +22,5 @@ obj-$(CONFIG_SND_SOC_SOF_PCI_DEV) += snd-sof-pci.o obj-$(CONFIG_SND_SOC_SOF_INTEL_TOPLEVEL) += intel/ obj-$(CONFIG_SND_SOC_SOF_IMX_TOPLEVEL) += imx/ +obj-$(CONFIG_SND_SOC_SOF_AMD_TOPLEVEL) += amd/ obj-$(CONFIG_SND_SOC_SOF_XTENSA) += xtensa/
sound/soc/sof/amd/Kconfig new file +30 -0
@@ -0,0 +1,30 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) +# This file is provided under a dual BSD/GPLv2 license. When using or +# redistributing this file, you may do so under either license. +# +# Copyright(c) 2021 Advanced Micro Devices, Inc. All rights reserved. + +config SND_SOC_SOF_AMD_TOPLEVEL + tristate "SOF support for AMD audio DSPs" + depends on X86 || COMPILE_TEST + help + This adds support for Sound Open Firmware for AMD platforms. + Say Y if you have such a device. + If unsure select "N". + +if SND_SOC_SOF_AMD_TOPLEVEL + +config SND_SOC_SOF_AMD_COMMON + tristate + select SND_SOC_SOF + help + This option is not user-selectable but automatically handled by + 'select' statements at a higher level + +config SND_SOC_SOF_AMD_RENOIR + tristate "SOF support for RENOIR" + select SND_SOC_SOF_AMD_COMMON + help + Select this option for SOF support on AMD Renoir platform + +endif
sound/soc/sof/amd/Makefile new file +11 -0
@@ -0,0 +1,11 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) +# This file is provided under a dual BSD/GPLv2 license. When using or +# redistributing this file, you may do so under either license. +# +# Copyright(c) 2021 Advanced Micro Devices, Inc. All rights reserved. + +snd-sof-amd-acp-objs := acp.o +snd-sof-amd-renoir-objs := renoir.o + +obj-$(CONFIG_SND_SOC_SOF_AMD_COMMON) += snd-sof-amd-acp.o +obj-$(CONFIG_SND_SOC_SOF_AMD_RENOIR) +=snd-sof-amd-renoir.o
sound/soc/sof/amd/acp-dsp-offset.h new file +20 -0
@@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */ +/* +* This file is provided under a dual BSD/GPLv2 license. When using or +* redistributing this file, you may do so under either license. +* +* Copyright(c) 2021 Advanced Micro Devices, Inc. All rights reserved. +* +* Author: Ajit Kumar Pandey <[email protected]> +*/ + +#ifndef _ACP_DSP_IP_OFFSET_H +#define _ACP_DSP_IP_OFFSET_H + +#define ACP_SOFT_RESET 0x1000 + +/* Registers from ACP_PGFSM block */ +#define ACP_PGFSM_CONTROL 0x141C +#define ACP_PGFSM_STATUS 0x1420 + +#endif
sound/soc/sof/amd/acp.c new file +118 -0
118 lines not on this page · raw message
sound/soc/sof/amd/acp.h new file +36 -0
@@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */ +/* +* This file is provided under a dual BSD/GPLv2 license. When using or +* redistributing this file, you may do so under either license. +* +* Copyright(c) 2021 Advanced Micro Devices, Inc. All rights reserved. +* +* Author: Ajit Kumar Pandey <[email protected]> +*/ + +#ifndef __SOF_AMD_ACP_H +#define __SOF_AMD_ACP_H + +#define ACP_DSP_BAR 0 + +#define ACP_REG_POLL_INTERVAL 500 +#define ACP_REG_POLL_TIMEOUT_US 2000 + +#define ACP_PGFSM_CNTL_POWER_ON_MASK 0x01 +#define ACP_PGFSM_STATUS_MASK 0x03 +#define ACP_POWERED_ON 0x00 +#define ACP_ASSERT_RESET 0x01 +#define ACP_RELEASE_RESET 0x00 +#define ACP_SOFT_RESET_DONE_MASK 0x00010001 + +/* Common device data struct for ACP devices */ +struct acp_dev_data { +struct snd_sof_dev *dev; +}; + +/* ACP device probe/remove */ +int amd_sof_acp_probe (struct snd_sof_dev *sdev); +int amd_sof_acp_remove (struct snd_sof_dev *sdev); + +extern const struct snd_sof_dsp_ops sof_renoir_ops; +#endif
sound/soc/sof/amd/renoir.c new file +34 -0
@@ -0,0 +1,34 @@ +// SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) +// +// This file is provided under a dual BSD/GPLv2 license. When using or +// redistributing this file, you may do so under either license. +// +// Copyright(c) 2021 Advanced Micro Devices, Inc. +// +// Authors: Ajit Kumar Pandey <[email protected]> + +/* +* Hardware interface for Audio DSP on Renoir platform +*/ + +#include <linux/platform_device.h> +#include <linux/module.h> + +#include "../ops.h" +#include "acp.h" + +/* AMD Renoir DSP ops */ +const struct snd_sof_dsp_ops sof_renoir_ops = { +/* probe and remove */ + .probe = amd_sof_acp_probe, + .remove = amd_sof_acp_remove, + +/* Register IO */ + .write = sof_io_write, + .read = sof_io_read, +}; +EXPORT_SYMBOL (sof_renoir_ops); + +MODULE_IMPORT_NS (SND_SOC_SOF_AMD_COMMON ); +MODULE_DESCRIPTION ("RENOIR SOF Driver" ); +MODULE_LICENSE ("Dual BSD/GPL" );
Signature · 1 line
2.27.0
PATCH 2/21 ASoC: SOF: amd: Add helper callbacks for ACP's DMA configuration
In reply to Daniel BalutaFrom: Ajit Kumar Pandey <[email protected]>
ACP DMA is used for loading SOF firmware into DSP memory and data transfer from system memory to DSP memory. Add helper callbacks to initialize and configure ACP DMA block for fw loading.
--- sound/soc/sof/amd/acp-dsp-offset.h | 47 ++++++ sound/soc/sof/amd/acp.c | 222 ++++++++++++++++++++++++++++- sound/soc/sof/amd/acp.h | 91 ++++++++++++ 3 files changed, 359 insertions(+), 1 deletion(-)
sound/soc/sof/amd/acp-dsp-offset.h +47 -0
@@ -11,10 +11,57 @@#ifndef _ACP_DSP_IP_OFFSET_H#define _ACP_DSP_IP_OFFSET_H +/* Registers from ACP_DMA_0 block */ +#define ACP_DMA_CNTL_0 0x00 +#define ACP_DMA_DSCR_STRT_IDX_0 0x20 +#define ACP_DMA_DSCR_CNT_0 0x40 +#define ACP_DMA_PRIO_0 0x60 +#define ACP_DMA_CUR_DSCR_0 0x80 +#define ACP_DMA_ERR_STS_0 0xC0 +#define ACP_DMA_DESC_BASE_ADDR 0xE0 +#define ACP_DMA_DESC_MAX_NUM_DSCR 0xE4 +#define ACP_DMA_CH_STS 0xE8 +#define ACP_DMA_CH_GROUP 0xEC +#define ACP_DMA_CH_RST_STS 0xF0 + +/* Registers from ACP_AXI2AXIATU block */ +#define ACPAXI2AXI_ATU_PAGE_SIZE_GRP_1 0xC00 +#define ACPAXI2AXI_ATU_BASE_ADDR_GRP_1 0xC04 +#define ACPAXI2AXI_ATU_PAGE_SIZE_GRP_2 0xC08 +#define ACPAXI2AXI_ATU_BASE_ADDR_GRP_2 0xC0C +#define ACPAXI2AXI_ATU_PAGE_SIZE_GRP_3 0xC10 +#define ACPAXI2AXI_ATU_BASE_ADDR_GRP_3 0xC14 +#define ACPAXI2AXI_ATU_PAGE_SIZE_GRP_4 0xC18 +#define ACPAXI2AXI_ATU_BASE_ADDR_GRP_4 0xC1C +#define ACPAXI2AXI_ATU_PAGE_SIZE_GRP_5 0xC20 +#define ACPAXI2AXI_ATU_BASE_ADDR_GRP_5 0xC24 +#define ACPAXI2AXI_ATU_PAGE_SIZE_GRP_6 0xC28 +#define ACPAXI2AXI_ATU_BASE_ADDR_GRP_6 0xC2C +#define ACPAXI2AXI_ATU_PAGE_SIZE_GRP_7 0xC30 +#define ACPAXI2AXI_ATU_BASE_ADDR_GRP_7 0xC34 +#define ACPAXI2AXI_ATU_PAGE_SIZE_GRP_8 0xC38 +#define ACPAXI2AXI_ATU_BASE_ADDR_GRP_8 0xC3C +#define ACPAXI2AXI_ATU_CTRL 0xC40#define ACP_SOFT_RESET 0x1000/* Registers from ACP_PGFSM block */ #define ACP_PGFSM_CONTROL 0x141C#define ACP_PGFSM_STATUS 0x1420 +/* Registers from ACP_INTR block */ +#define ACP_DSP_SW_INTR_CNTL 0x1814 +#define ACP_ERROR_STATUS 0x18C4 + +/* Registers from ACP_SHA block */ +#define ACP_SHA_DSP_FW_QUALIFIER 0x1C70 +#define ACP_SHA_DMA_CMD 0x1CB0 +#define ACP_SHA_MSG_LENGTH 0x1CB4 +#define ACP_SHA_DMA_STRT_ADDR 0x1CB8 +#define ACP_SHA_DMA_DESTINATION_ADDR 0x1CBC +#define ACP_SHA_DMA_CMD_STS 0x1CC0 +#define ACP_SHA_DMA_ERR_STATUS 0x1CC4 +#define ACP_SHA_TRANSFER_BYTE_CNT 0x1CC8 + +#define ACP_SCRATCH_REG_0 0x10000 +#endif
sound/soc/sof/amd/acp.c +221 -1
240 lines not on this page · raw message
sound/soc/sof/amd/acp.h +91 -0
108 lines not on this page · raw message
Signature · 1 line
2.27.0
PATCH 3/21 ASoC: SOF: amd: Add fw loader and renoir dsp ops to load firmware
In reply to Daniel BalutaFrom: Ajit Kumar Pandey <[email protected]>
Add acp-loader module with ops callback to load and run firmware on ACP DSP block on Renoir platform.
--- sound/soc/sof/amd/Makefile | 2 +- sound/soc/sof/amd/acp-dsp-offset.h | 3 + sound/soc/sof/amd/acp-loader.c | 199 +++++++++++++++++++++++++++++ sound/soc/sof/amd/acp.h | 27 ++++ sound/soc/sof/amd/renoir.c | 15 +++ 5 files changed, 245 insertions(+), 1 deletion(-) create mode 100644 sound/soc/sof/amd/acp-loader.c
sound/soc/sof/amd/Makefile +1 -1
@@ -4,7 +4,7 @@ # # Copyright(c) 2021 Advanced Micro Devices, Inc. All rights reserved. -snd-sof-amd-acp-objs := acp.o +snd-sof-amd-acp-objs := acp.o acp-loader.o snd-sof-amd-renoir-objs := renoir.o obj-$(CONFIG_SND_SOC_SOF_AMD_COMMON) += snd-sof-amd-acp.o
sound/soc/sof/amd/acp-dsp-offset.h +3 -0
@@ -24,6 +24,9 @@#define ACP_DMA_CH_GROUP 0xEC#define ACP_DMA_CH_RST_STS 0xF0 +/* Registers from ACP_DSP_0 block */ +#define ACP_DSP0_RUNSTALL 0x414 +/* Registers from ACP_AXI2AXIATU block */ #define ACPAXI2AXI_ATU_PAGE_SIZE_GRP_1 0xC00#define ACPAXI2AXI_ATU_BASE_ADDR_GRP_1 0xC04
sound/soc/sof/amd/acp-loader.c new file +199 -0
199 lines not on this page · raw message
sound/soc/sof/amd/acp.h +27 -0
@@ -11,6 +11,8 @@#ifndef __SOF_AMD_ACP_H#define __SOF_AMD_ACP_H +#include "../sof-priv.h" +#define ACP_DSP_BAR 0#define ACP_REG_POLL_INTERVAL 500
@@ -39,6 +41,13 @@#define ACP_MAX_DESC 128#define ACPBUS_REG_BASE_OFFSET ACP_DMA_CNTL_0 +#define ACP_DEFAULT_DRAM_LENGTH 0x00080000 +#define ACP_SCRATCH_MEMORY_ADDRESS 0x02050000 +#define ACP_SYSTEM_MEMORY_WINDOW 0x4000000 +#define ACP_IRAM_BASE_ADDRESS 0x000000 +#define ACP_DATA_RAM_BASE_ADDRESS 0x01000000 +#define ACP_DRAM_PAGE_COUNT 128 +struct acp_atu_grp_pte {u32 low;u32 high;
@@ -106,6 +115,13 @@ struct scratch_reg_conf {/* Common device data struct for ACP devices */ struct acp_dev_data {struct snd_sof_dev *dev; +unsigned int fw_bin_size; +unsigned int fw_data_bin_size; +u32 fw_bin_page_count; +dma_addr_t sha_dma_addr; +u8 *bin_buf; +dma_addr_t dma_addr; +u8 *data_buf;struct dma_descriptor dscr_info[ACP_MAX_DESC ]; };
@@ -123,5 +139,16 @@ int configure_and_run_sha_dma(struct acp_dev_data *adata, void *image_addr,int amd_sof_acp_probe (struct snd_sof_dev *sdev);int amd_sof_acp_remove (struct snd_sof_dev *sdev); +/* DSP Loader callbacks */ +int acp_sof_dsp_run (struct snd_sof_dev *sdev); +int acp_dsp_pre_fw_run (struct snd_sof_dev *sdev); +int acp_get_bar_index (struct snd_sof_dev *sdev,u32 type); + +/* Block IO callbacks */ +int acp_dsp_block_write (struct snd_sof_dev *sdev,enum snd_sof_fw_blk_type blk_type, +u32 offset,void *src,size_t size); +int acp_dsp_block_read (struct snd_sof_dev *sdev,enum snd_sof_fw_blk_type blk_type, +u32 offset,void *dest,size_t size); +extern const struct snd_sof_dsp_ops sof_renoir_ops;#endif
sound/soc/sof/amd/renoir.c +15 -0
@@ -26,6 +26,21 @@ const struct snd_sof_dsp_ops sof_renoir_ops = {/* Register IO */ .write = sof_io_write, .read = sof_io_read, + +/* Block IO */ + .block_read = acp_dsp_block_read, + .block_write = acp_dsp_block_write, + +/* Module loading */ + .load_module = snd_sof_parse_module_memcpy, + +/*Firmware loading */ + .load_firmware = snd_sof_load_firmware_memcpy, + .pre_fw_run = acp_dsp_pre_fw_run, + .get_bar_index = acp_get_bar_index, + +/* DSP core boot */ + .run = acp_sof_dsp_run, };EXPORT_SYMBOL (sof_renoir_ops);
Signature · 1 line
2.27.0
PATCH 4/21 ASoC: SOF: amd: Add IPC support for ACP IP block
In reply to Daniel BalutaFrom: Ajit Kumar Pandey <[email protected]>
Add IPC module for generic ACP block and exposed ops callback for to synchronize SOF IPC message between host and DSP
--- sound/soc/sof/amd/Makefile | 2 +- sound/soc/sof/amd/acp-dsp-offset.h | 2 + sound/soc/sof/amd/acp-ipc.c | 187 +++++++++++++++++++++++++++++ sound/soc/sof/amd/acp.c | 44 ++++++- sound/soc/sof/amd/acp.h | 15 +++ sound/soc/sof/amd/renoir.c | 8 ++ 6 files changed, 256 insertions(+), 2 deletions(-) create mode 100644 sound/soc/sof/amd/acp-ipc.c
sound/soc/sof/amd/Makefile +1 -1
@@ -4,7 +4,7 @@ # # Copyright(c) 2021 Advanced Micro Devices, Inc. All rights reserved. -snd-sof-amd-acp-objs := acp.o acp-loader.o +snd-sof-amd-acp-objs := acp.o acp-loader.o acp-ipc.o snd-sof-amd-renoir-objs := renoir.o obj-$(CONFIG_SND_SOC_SOF_AMD_COMMON) += snd-sof-amd-acp.o
sound/soc/sof/amd/acp-dsp-offset.h +2 -0
@@ -53,6 +53,8 @@/* Registers from ACP_INTR block */ #define ACP_DSP_SW_INTR_CNTL 0x1814 +#define ACP_DSP_SW_INTR_STAT 0x1818 +#define ACP_SW_INTR_TRIG 0x181C#define ACP_ERROR_STATUS 0x18C4/* Registers from ACP_SHA block */
sound/soc/sof/amd/acp-ipc.c new file +187 -0
187 lines not on this page · raw message
sound/soc/sof/amd/acp.c +43 -1
64 lines not on this page · raw message
sound/soc/sof/amd/acp.h +15 -0
@@ -48,6 +48,8 @@#define ACP_DATA_RAM_BASE_ADDRESS 0x01000000#define ACP_DRAM_PAGE_COUNT 128 +#define ACP_DSP_TO_HOST_IRQ 0x04 +struct acp_atu_grp_pte {u32 low;u32 high;
@@ -150,5 +152,18 @@ int acp_dsp_block_write(struct snd_sof_dev *sdev, enum snd_sof_fw_blk_type blk_tint acp_dsp_block_read (struct snd_sof_dev *sdev,enum snd_sof_fw_blk_type blk_type,u32 offset,void *dest,size_t size); +/* IPC callbacks */ +irqreturn_t acp_sof_ipc_irq_thread (int irq,void *context); +int acp_sof_ipc_msg_data (struct snd_sof_dev *sdev,struct snd_pcm_substream *substream, +void *p,size_t sz); +int acp_sof_ipc_send_msg (struct snd_sof_dev *sdev, +struct snd_sof_ipc_msg *msg); +int acp_sof_ipc_get_mailbox_offset (struct snd_sof_dev *sdev); +int acp_sof_ipc_get_window_offset (struct snd_sof_dev *sdev,u32 id); +int acp_sof_ipc_pcm_params (struct snd_sof_dev *sdev,struct snd_pcm_substream *substream, +const struct sof_ipc_pcm_params_reply *reply); +void acp_mailbox_write (struct snd_sof_dev *sdev,u32 offset,void *message,size_t bytes); +void acp_mailbox_read (struct snd_sof_dev *sdev,u32 offset,void *message,size_t bytes); +extern const struct snd_sof_dsp_ops sof_renoir_ops;#endif
sound/soc/sof/amd/renoir.c +8 -0
@@ -41,6 +41,14 @@ const struct snd_sof_dsp_ops sof_renoir_ops = {/* DSP core boot */ .run = acp_sof_dsp_run, + +/*IPC */ + .send_msg = acp_sof_ipc_send_msg, + .ipc_msg_data = acp_sof_ipc_msg_data, + .ipc_pcm_params = acp_sof_ipc_pcm_params, + .get_mailbox_offset = acp_sof_ipc_get_mailbox_offset, + .irq_thread = acp_sof_ipc_irq_thread, + .fw_ready = sof_fw_ready, };EXPORT_SYMBOL (sof_renoir_ops);
Signature · 1 line
2.27.0
PATCH 5/21 ASoC: SOF: amd: Add dai driver dsp ops callback for Renoir
In reply to Daniel BalutaFrom: Ajit Kumar Pandey <[email protected]>
Add dsp ops callback to register I2S and DMIC sof dai's with ALSA
--- sound/soc/sof/amd/acp-dsp-offset.h | 2 + sound/soc/sof/amd/renoir.c | 91 ++++++++++++++++++++++++++++++ 2 files changed, 93 insertions(+)
sound/soc/sof/amd/acp-dsp-offset.h +2 -0
@@ -47,6 +47,8 @@#define ACPAXI2AXI_ATU_CTRL 0xC40#define ACP_SOFT_RESET 0x1000 +#define ACP_I2S_PIN_CONFIG 0x1400 +/* Registers from ACP_PGFSM block */ #define ACP_PGFSM_CONTROL 0x141C#define ACP_PGFSM_STATUS 0x1420
sound/soc/sof/amd/renoir.c +91 -0
104 lines not on this page · raw message
Signature · 1 line
2.27.0
PATCH 6/21 ASoC: SOF: amd: Add PCM stream callback for Renoir dai's
In reply to Daniel BalutaFrom: Ajit Kumar Pandey <[email protected]>
Add module to support ALSA pcm stream configurations for ACP I2S and DMIC endpoints
--- sound/soc/sof/amd/Makefile | 2 +- sound/soc/sof/amd/acp-pcm.c | 82 +++++++++++++++ sound/soc/sof/amd/acp-stream.c | 181 +++++++++++++++++++++++++++++++++ sound/soc/sof/amd/acp.c | 2 + sound/soc/sof/amd/acp.h | 28 +++++ sound/soc/sof/amd/renoir.c | 11 ++ 6 files changed, 305 insertions(+), 1 deletion(-) create mode 100644 sound/soc/sof/amd/acp-pcm.c create mode 100644 sound/soc/sof/amd/acp-stream.c
sound/soc/sof/amd/Makefile +1 -1
@@ -4,7 +4,7 @@ # # Copyright(c) 2021 Advanced Micro Devices, Inc. All rights reserved. -snd-sof-amd-acp-objs := acp.o acp-loader.o acp-ipc.o +snd-sof-amd-acp-objs := acp.o acp-loader.o acp-ipc.o acp-pcm.o acp-stream.o snd-sof-amd-renoir-objs := renoir.o obj-$(CONFIG_SND_SOC_SOF_AMD_COMMON) += snd-sof-amd-acp.o
sound/soc/sof/amd/acp-pcm.c new file +82 -0
82 lines not on this page · raw message
sound/soc/sof/amd/acp-stream.c new file +181 -0
181 lines not on this page · raw message
sound/soc/sof/amd/acp.c +2 -0
@@ -363,6 +363,8 @@ int amd_sof_acp_probe(struct snd_sof_dev *sdev)acp_memory_init (sdev); +acp_dsp_stream_init (sdev); +return 0 ; }EXPORT_SYMBOL_NS (amd_sof_acp_probe,SND_SOC_SOF_AMD_COMMON );
sound/soc/sof/amd/acp.h +28 -0
@@ -13,6 +13,8 @@#include "../sof-priv.h" +#define ACP_MAX_STREAM 8 +#define ACP_DSP_BAR 0#define ACP_REG_POLL_INTERVAL 500
@@ -114,6 +116,17 @@ struct scratch_reg_conf {unsigned int reserve[]; }; +struct acp_dsp_stream { +struct list_head list; +struct snd_sof_dev *sdev; +struct snd_pcm_substream *substream; +struct snd_dma_buffer *dmab; +int num_pages; +int stream_tag; +int active; +unsigned int reg_offset; +}; +/* Common device data struct for ACP devices */ struct acp_dev_data {struct snd_sof_dev *dev;
@@ -125,6 +138,7 @@ struct acp_dev_data {dma_addr_t dma_addr;u8 *data_buf;struct dma_descriptor dscr_info[ACP_MAX_DESC ]; +struct acp_dsp_stream stream_buf[ACP_MAX_STREAM ]; };void memcpy_to_scratch (struct snd_sof_dev *sdev,u32 offset,unsigned int *src,size_t bytes);
@@ -165,5 +179,19 @@ int acp_sof_ipc_pcm_params(struct snd_sof_dev *sdev, struct snd_pcm_substream *svoid acp_mailbox_write (struct snd_sof_dev *sdev,u32 offset,void *message,size_t bytes);void acp_mailbox_read (struct snd_sof_dev *sdev,u32 offset,void *message,size_t bytes); +/* ACP - DSP stream callbacks */ +int acp_dsp_stream_config (struct snd_sof_dev *sdev,struct acp_dsp_stream *stream); +int acp_dsp_stream_init (struct snd_sof_dev *sdev); +struct acp_dsp_stream *acp_dsp_stream_get (struct snd_sof_dev *sdev,int tag); +int acp_dsp_stream_put (struct snd_sof_dev *sdev,struct acp_dsp_stream *acp_stream); + +/* +* DSP PCM Operations. +*/ +int acp_pcm_open (struct snd_sof_dev *sdev,struct snd_pcm_substream *substream); +int acp_pcm_close (struct snd_sof_dev *sdev,struct snd_pcm_substream *substream); +int acp_pcm_hw_params (struct snd_sof_dev *sdev,struct snd_pcm_substream *substream, +struct snd_pcm_hw_params *params,struct sof_ipc_stream_params *ipc_params); +extern const struct snd_sof_dsp_ops sof_renoir_ops;#endif
sound/soc/sof/amd/renoir.c +11 -0
@@ -140,6 +140,17 @@ const struct snd_sof_dsp_ops sof_renoir_ops = {/* DAI drivers */ .drv = renoir_sof_dai, .num_drv = ARRAY_SIZE(renoir_sof_dai), + +/* stream callbacks */ + .pcm_open = acp_pcm_open, + .pcm_close = acp_pcm_close, + .pcm_hw_params = acp_pcm_hw_params, + + .hw_info =SNDRV_PCM_INFO_MMAP | +SNDRV_PCM_INFO_MMAP_VALID | +SNDRV_PCM_INFO_INTERLEAVED | +SNDRV_PCM_INFO_PAUSE | +SNDRV_PCM_INFO_NO_PERIOD_WAKEUP , };EXPORT_SYMBOL (sof_renoir_ops);
Signature · 1 line
2.27.0
PATCH 7/21 ASoC: amd: Add module to determine ACP configuration
In reply to Daniel BalutaFrom: Ajit Kumar Pandey <[email protected]>
ACP hw block configuration differs across various distributions and hence it's required to register different drivers module for distributions. For now we support three ACP drivers:
* ACP without SOF use case
* ACP with SOF use case
* ACP with SOF use case for DMIC and non SOF for I2S endpoints
As all above driver registers with common PCI ID for ACP hw block we need code to determine ACP configuration and auto select driver module. This patch expose function that return configuration flag based on dmi checks for a system. ACP driver module probe register platform device based on such configuration flag to avoid conflict with other ACP drivers probed for same PCI ID.
--- sound/soc/amd/Kconfig | 6 +++ sound/soc/amd/Makefile | 2 + sound/soc/amd/acp-config.c | 81 +++++++++++++++++++++++++++++++++++++ sound/soc/amd/mach-config.h | 29 +++++++++++++ 4 files changed, 118 insertions(+) create mode 100644 sound/soc/amd/acp-config.c create mode 100644 sound/soc/amd/mach-config.h
sound/soc/amd/Kconfig +6 -0
@@ -96,4 +96,10 @@ config SND_SOC_AMD_YC_MACH Say m if you have such a device. If unsure select "N". +config SND_AMD_ACP_CONFIG + tristate "AMD ACP configuration selection" + help + This option adds an auto detection to determine which ACP + driver modules to use + source "sound/soc/amd/acp/Kconfig"
sound/soc/amd/Makefile +2 -0
@@ -3,6 +3,7 @@ acp_audio_dma-objs := acp-pcm-dma.o snd-soc-acp-da7219mx98357-mach-objs := acp-da7219-max98357a.o snd-soc-acp-rt5645-mach-objs := acp-rt5645.o snd-soc-acp-rt5682-mach-objs := acp3x-rt5682-max9836.o +snd-acp-config-objs := acp-config.o obj-$(CONFIG_SND_SOC_AMD_ACP) += acp_audio_dma.o obj-$(CONFIG_SND_SOC_AMD_CZ_DA7219MX98357_MACH) += snd-soc-acp-da7219mx98357-mach.o
@@ -13,3 +14,4 @@ obj-$(CONFIG_SND_SOC_AMD_RENOIR) += renoir/ obj-$(CONFIG_SND_SOC_AMD_ACP5x) += vangogh/ obj-$(CONFIG_SND_SOC_AMD_ACP6x) += yc/ obj-$(CONFIG_SND_SOC_AMD_ACP_COMMON) += acp/ +obj-$(CONFIG_SND_AMD_ACP_CONFIG) += snd-acp-config.o
sound/soc/amd/acp-config.c new file +81 -0
81 lines not on this page · raw message
sound/soc/amd/mach-config.h new file +29 -0
@@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */ +/* +* This file is provided under a dual BSD/GPLv2 license. When using or +* redistributing this file, you may do so under either license. +* +* Copyright(c) 2021 Advanced Micro Devices, Inc. All rights reserved. +* +* Author: Ajit Kumar Pandey <[email protected]> +*/ +#ifndef __AMD_MACH_CONFIG_H +#define __AMD_MACH_CONFIG_H + +#include <sound/soc-acpi.h> + +#define FLAG_AMD_SOF BIT(1) +#define FLAG_AMD_SOF_ONLY_DMIC BIT(2) + +#define ACP_PCI_DEV_ID 0x15E2 + +extern struct snd_soc_acpi_mach snd_soc_acpi_amd_sof_machines[]; +extern struct snd_soc_acpi_mach snd_soc_acpi_amd_acp_machines[]; + +struct config_entry { +u32 flags; +u16 device; +const struct dmi_system_id *dmi_table; +}; + +#endif
Signature · 1 line
2.27.0
Re: [PATCH 07/21] ASoC: amd: Add module to determine ACP configuration
Hi Daniel,
Quoted 17 lines · Daniel Baluta
From: Ajit Kumar Pandey <[email protected]>
ACP hw block configuration differs across various distributions and hence it's required to register different drivers module for distributions. For now we support three ACP drivers:
* ACP without SOF use case
* ACP with SOF use case
* ACP with SOF use case for DMIC and non SOF for I2S endpointsAs all above driver registers with common PCI ID for ACP hw block we need code to determine ACP configuration and auto select driver module. This patch expose function that return configuration flag based on dmi checks for a system. ACP driver module probe register platform device based on such configuration flag to avoid conflict with other ACP drivers probed for same PCI ID.
Quoted 4 lines
Signed-off-by Ajit Kumar Pandey <[email protected]>Reviewed-by Bard Liao <[email protected]>Reviewed-by Kai Vehmanen <[email protected]>Signed-off-by Daniel Baluta <[email protected]>
Thanks for your patch, which is now commit f1bdd8d385a80356 ("ASoC:
amd: Add module to determine ACP configuration") in sound-asoc/for-next.
sound/soc/amd/Kconfig config SND_SOC_AMD_YC_MACH · line 100
Quoted 8 lines
sound/soc/amd/Kconfig +2
-0@@ -96,4 +96,10 @@ config SND_SOC_AMD_YC_MACH Say m if you have such a device. If unsure select "N". +config SND_AMD_ACP_CONFIG + tristate "AMD ACP configuration selection"
This definitely needs proper dependencies, to prevent asking the user about this when configuring a kernel without AMD Audio ACP support.
I would have sent a patch, but...
Quoted 18 lines
sound/soc/amd/Kconfig +4
-0+ help + This option adds an auto detection to determine which ACP + driver modules to use + source "sound/soc/amd/acp/Kconfig"sound/soc/amd/acp-config.c new file +9
-0@@ -0,0 +1,81 @@ +// SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) +// +// This file is provided under a dual BSD/GPLv2 license. When using or +// redistributing this file, you may do so under either license. +// +// Copyright(c) 2021 Advanced Micro Devices, Inc. +// +// Authors: Ajit Kumar Pandey <[email protected]> +//
sound/soc/amd/acp-config.c line 19
Quoted 10 lines
sound/soc/amd/acp-config.c new file +10
-0+ +/* ACP machine configuration module */ + +#include <linux/acpi.h> +#include <linux/bits.h> +#include <linux/dmi.h> +#include <linux/module.h> +#include <linux/pci.h> + +#include "../sof/amd/acp.h"
This doesn't seem to use anything from this header file?
Quoted 38 lines
sound/soc/amd/acp-config.c new file +38
-0+#include "mach-config.h" + +static int acp_quirk_data; + +static const struct config_entry config_table[] = { + { + .flags =FLAG_AMD_SOF , + .device =ACP_PCI_DEV_ID , + .dmi_table = (const struct dmi_system_id []) { + { + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"AMD" ), +DMI_MATCH (DMI_PRODUCT_NAME ,"Majolica-CZN" ), + }, + }, + {} + }, + }, +}; + +int snd_amd_acp_find_config (struct pci_dev *pci) +{ +const struct config_entry *table = config_table; +u16 device = pci->device; +int i; + +for (i =0 ; i <ARRAY_SIZE (config_table); i++, table++) { +if (table->device != device) +continue ; +if (table->dmi_table && !dmi_check_system (table->dmi_table)) +continue ; + acp_quirk_data = table->flags; +return table->flags; + } + +return 0 ; +} +EXPORT_SYMBOL (snd_amd_acp_find_config);
sound/soc/amd/acp-config.c line 79
Quoted 10 lines
sound/soc/amd/acp-config.c new file +9
-0+struct snd_soc_acpi_mach snd_soc_acpi_amd_acp_machines[] = { + { + .id ="AMDI1019" , + .drv_name ="renoir-acp" , + .pdata = (void *)&acp_quirk_data, + }, + {}, +}; +EXPORT_SYMBOL (snd_soc_acpi_amd_acp_machines);
These symbols are only used from sound/soc/sof/amd/pci-rn.c.
Why is this code living under sound/soc/amd/, while the ACP code is under sound/soc/amd/acp/?
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Re: [PATCH 07/21] ASoC: amd: Add module to determine ACP configuration
Quoted 9 lines
Quoted 9 lines
sound/soc/amd/Kconfig +0
-0@@ -96,4 +96,10 @@ config SND_SOC_AMD_YC_MACH Say m if you have such a device. If unsure select "N".
Quoted 7 lines
sound/soc/amd/Kconfig config SND_SOC_AMD_YC_MACH · line 100
Quoted 2 lines
sound/soc/amd/Kconfig +2
-0+config SND_AMD_ACP_CONFIG + tristate "AMD ACP configuration selection"This definitely needs proper dependencies, to prevent asking the user about this when configuring a kernel without AMD Audio ACP support.
I would have sent a patch, but...
There's indeed a missing dependency that was fixed in
https://github.com/thesofproject/linux/pull/3284
Daniel, you may want to squash it in an update?
To Geert's point, there may be an additional need to add a
depends on SND_SOC_AMD_ACP
There are also a set of
SND_SOC_AMD_ACPyx options, not sure if any applies as a dependency here?
Mark Brown
maintainerRe: [PATCH 07/21] ASoC: amd: Add module to determine ACP configuration
Quoted 7 lines · Pierre-Louis Bossart
To Geert's point, there may be an additional need to add a
depends on
SND_SOC_AMD_ACPThere are also a set of
SND_SOC_AMD_ACPyxoptions, not sure if any applies as a dependency here?
Or put them in an if block (IIRC I thought they were which was why the dependency wasn't needed but I don't know what I was looking at if I did check that).
Re: [PATCH 07/21] ASoC: amd: Add module to determine ACP configuration
Quoted 7 lines · Mark Brown
Quoted 3 lines · Pierre-Louis Bossart
To Geert's point, there may be an additional need to add a
depends on
SND_SOC_AMD_ACP
Quoted 7 lines
Quoted 3 lines
There are also a set of
SND_SOC_AMD_ACPyxoptions, not sure if any applies as a dependency here?Or put them in an if block (IIRC I thought they were which was why the dependency wasn't needed but I don't know what I was looking at if I did check that).
There will be some delays in handling this as I'm in vacation until next Monday.
Re: [PATCH 07/21] ASoC: amd: Add module to determine ACP configuration
In reply to Mark BrownHi Mark,
Quoted 5 lines · Mark Brown
Quoted 3 lines · Pierre-Louis Bossart
To Geert's point, there may be an additional need to add a
depends on
SND_SOC_AMD_ACP
Quoted 7 lines
Quoted 3 lines
There are also a set of
SND_SOC_AMD_ACPyxoptions, not sure if any applies as a dependency here?Or put them in an if block (IIRC I thought they were which was why the dependency wasn't needed but I don't know what I was looking at if I did check that).
Probably you were looking at sound/soc/amd/acp/Kconfig, where all the other ACP options live, and where you had applied my earlier patch to wrap everything in a big "if".
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
PATCH 8/21 ASoC: SOF: amd: Add machine driver dsp ops for Renoir platform
In reply to Daniel BalutaFrom: Ajit Kumar Pandey <[email protected]>
Add dsp ops callback to select and register machine driver.
--- sound/soc/sof/amd/renoir.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
sound/soc/sof/amd/renoir.c +22 -0
@@ -104,6 +104,23 @@ static struct snd_soc_dai_driver renoir_sof_dai[] = { }, }; +static void amd_sof_machine_select (struct snd_sof_dev *sdev) +{ +struct snd_sof_pdata *sof_pdata = sdev->pdata; +const struct sof_dev_desc *desc = sof_pdata->desc; +struct snd_soc_acpi_mach *mach; + + mach =snd_soc_acpi_find_machine (desc->machines); +if (!mach) { +dev_warn (sdev->dev,"No matching ASoC machine driver found\n" ); +return ; + } + + sof_pdata->tplg_filename = mach->sof_tplg_filename; + sof_pdata->fw_filename = mach->fw_filename; + sof_pdata->machine = mach; +} +/* AMD Renoir DSP ops */ const struct snd_sof_dsp_ops sof_renoir_ops = {/* probe and remove */
@@ -151,6 +168,11 @@ const struct snd_sof_dsp_ops sof_renoir_ops = {SNDRV_PCM_INFO_INTERLEAVED |SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_NO_PERIOD_WAKEUP, + +/* Machine driver callbacks */ + .machine_select = amd_sof_machine_select, + .machine_register = sof_machine_register, + .machine_unregister = sof_machine_unregister, };EXPORT_SYMBOL (sof_renoir_ops);
Signature · 7 lines
2.27.0 _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek
PATCH 9/21 ASoC: SOF: amd: Add Renoir PCI driver interface
In reply to Daniel BalutaFrom: Ajit Kumar Pandey <[email protected]>
Add PCI driver module to enable sof pci device support for Renoir. If machine flag set to FLAG_SOF_ONLY_DMIC this pci driver register platform device for non dsp based I2S platform device. If machine flag is not enabled for SOF pci probe will return without invoking sof device probe and registration
--- sound/soc/sof/amd/Kconfig | 5 +- sound/soc/sof/amd/Makefile | 2 +- sound/soc/sof/amd/acp.h | 3 + sound/soc/sof/amd/pci-rn.c | 160 +++++++++++++++++++++++++++++++++++++ 4 files changed, 168 insertions(+), 2 deletions(-) create mode 100644 sound/soc/sof/amd/pci-rn.c
sound/soc/sof/amd/Kconfig +4 -1
@@ -17,14 +17,17 @@ if SND_SOC_SOF_AMD_TOPLEVEL config SND_SOC_SOF_AMD_COMMON tristate select SND_SOC_SOF + select SND_SOC_SOF_PCI_DEV + select SND_AMD_ACP_CONFIG + select SND_SOC_ACPI if ACPI help This option is not user-selectable but automatically handled by 'select' statements at a higher level config SND_SOC_SOF_AMD_RENOIR tristate "SOF support for RENOIR" + depends on SND_SOC_SOF_PCI select SND_SOC_SOF_AMD_COMMON help Select this option for SOF support on AMD Renoir platform - endif
sound/soc/sof/amd/Makefile +1 -1
@@ -5,7 +5,7 @@ # Copyright(c) 2021 Advanced Micro Devices, Inc. All rights reserved. snd-sof-amd-acp-objs := acp.o acp-loader.o acp-ipc.o acp-pcm.o acp-stream.o -snd-sof-amd-renoir-objs := renoir.o +snd-sof-amd-renoir-objs := pci-rn.o renoir.o obj-$(CONFIG_SND_SOC_SOF_AMD_COMMON) += snd-sof-amd-acp.o obj-$(CONFIG_SND_SOC_SOF_AMD_RENOIR) +=snd-sof-amd-renoir.o
sound/soc/sof/amd/acp.h +3 -0
@@ -194,4 +194,7 @@ int acp_pcm_hw_params(struct snd_sof_dev *sdev, struct snd_pcm_substream *substr struct snd_pcm_hw_params *params, struct sof_ipc_stream_params *ipc_params);extern const struct snd_sof_dsp_ops sof_renoir_ops; + +/* Machine configuration */ +int snd_amd_acp_find_config (struct pci_dev *pci);#endif
sound/soc/sof/amd/pci-rn.c new file +160 -0
160 lines not on this page · raw message
Signature · 1 line
2.27.0
PATCH 10/21 ASoC: amd: acp-config: Remove legacy acpi based machine struct
In reply to Daniel BalutaFrom: Ajit Kumar Pandey <[email protected]>
We have moved legacy based machine struct into platform driver to resolve module dependency with non-SOF ALSA build, hence removed it from acp-config driver module.
--- sound/soc/amd/acp-config.c | 10 ---------- sound/soc/amd/mach-config.h | 1 - 2 files changed, 11 deletions(-)
sound/soc/amd/acp-config.c +0 -10
@@ -68,14 +68,4 @@ struct snd_soc_acpi_mach snd_soc_acpi_amd_sof_machines[] = { };EXPORT_SYMBOL (snd_soc_acpi_amd_sof_machines); -struct snd_soc_acpi_mach snd_soc_acpi_amd_acp_machines[] = { - { - .id ="AMDI1019" , - .drv_name ="renoir-acp" , - .pdata = (void *)&acp_quirk_data, - }, - {}, -}; -EXPORT_SYMBOL (snd_soc_acpi_amd_acp_machines); -MODULE_LICENSE ("Dual BSD/GPL" );
sound/soc/amd/mach-config.h +0 -1
@@ -18,7 +18,6 @@#define ACP_PCI_DEV_ID 0x15E2extern struct snd_soc_acpi_mach snd_soc_acpi_amd_sof_machines[]; -extern struct snd_soc_acpi_mach snd_soc_acpi_amd_acp_machines[];struct config_entry {u32 flags;
Signature · 1 line
2.27.0
PATCH 11/21 ASoC: SOF: topology: Add support for AMD ACP DAIs
In reply to Daniel BalutaFrom: Ajit Kumar Pandey <[email protected]>
Add new sof dais and config to pass topology file configuration to SOF firmware running on ACP's DSP core. ACP firmware support I2S_BT, I2S_SP and DMIC controller hence add three new dais to the list of supported sof_dais
--- include/sound/sof/dai-amd.h | 21 +++++++ include/sound/sof/dai.h | 7 +++ sound/soc/sof/pcm.c | 36 ++++++++++++ sound/soc/sof/topology.c | 109 ++++++++++++++++++++++++++++++++++++ 4 files changed, 173 insertions(+) create mode 100644 include/sound/sof/dai-amd.h
include/sound/sof/dai-amd.h new file +21 -0
@@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */ +/* +* This file is provided under a dual BSD/GPLv2 license. When using or +* redistributing this file, you may do so under either license. +* +* Copyright(c) 2021 Advanced Micro Devices, Inc.. All rights reserved. +*/ + +#ifndef __INCLUDE_SOUND_SOF_DAI_AMD_H__ +#define __INCLUDE_SOUND_SOF_DAI_AMD_H__ + +#include <sound/sof/header.h> + +/* ACP Configuration Request - SOF_IPC_DAI_AMD_CONFIG */ +struct sof_ipc_dai_acp_params { +struct sof_ipc_hdr hdr; + +uint32_t fsync_rate;/* FSYNC frequency in Hz */ +uint32_t tdm_slots; +} __packed; +#endif
include/sound/sof/dai.h +7 -0
@@ -12,6 +12,7 @@#include <sound/sof/header.h> #include <sound/sof/dai-intel.h> #include <sound/sof/dai-imx.h> +#include <sound/sof/dai-amd.h> /* * DAI Configuration.
@@ -66,6 +67,9 @@ enum sof_ipc_dai_type {SOF_DAI_INTEL_ALH ,/**< Intel ALH */ SOF_DAI_IMX_SAI ,/**< i.MX SAI */ SOF_DAI_IMX_ESAI ,/**< i.MX ESAI */ +SOF_DAI_AMD_BT ,/**< AMD ACP BT*/ +SOF_DAI_AMD_SP ,/**< AMD ACP SP */ + SOF_DAI_AMD_DMIC, /**< AMD ACP DMIC */ };/* general purpose DAI configuration */
@@ -90,6 +94,9 @@ struct sof_ipc_dai_config {struct sof_ipc_dai_alh_params alh;struct sof_ipc_dai_esai_params esai;struct sof_ipc_dai_sai_params sai; +struct sof_ipc_dai_acp_params acpbt; +struct sof_ipc_dai_acp_params acpsp; +struct sof_ipc_dai_acp_params acpdmic; }; } __packed;
sound/soc/sof/pcm.c +36 -0
@@ -826,6 +826,42 @@ int sof_pcm_dai_link_fixup(struct snd_soc_pcm_runtime *rtd, struct snd_pcm_hw_pa"channels_min: %d channels_max: %d\n" , channels->min, channels->max);break ; +case SOF_DAI_AMD_BT : + rate->min = dai->dai_config->acpbt.fsync_rate; + rate->max = dai->dai_config->acpbt.fsync_rate; + channels->min = dai->dai_config->acpbt.tdm_slots; + channels->max = dai->dai_config->acpbt.tdm_slots; + +dev_dbg (component->dev, +"AMD_BT rate_min: %d rate_max: %d\n" , rate->min, rate->max); +dev_dbg (component->dev, +"AMD_BT channels_min: %d channels_max: %d\n" , + channels->min, channels->max); +break ; +case SOF_DAI_AMD_SP : + rate->min = dai->dai_config->acpsp.fsync_rate; + rate->max = dai->dai_config->acpsp.fsync_rate; + channels->min = dai->dai_config->acpsp.tdm_slots; + channels->max = dai->dai_config->acpsp.tdm_slots; + +dev_dbg (component->dev, +"AMD_SP rate_min: %d rate_max: %d\n" , rate->min, rate->max); +dev_dbg (component->dev, +"AMD_SP channels_min: %d channels_max: %d\n" , + channels->min, channels->max); +break ; +case SOF_DAI_AMD_DMIC : + rate->min = dai->dai_config->acpdmic.fsync_rate; + rate->max = dai->dai_config->acpdmic.fsync_rate; + channels->min = dai->dai_config->acpdmic.tdm_slots; + channels->max = dai->dai_config->acpdmic.tdm_slots; + +dev_dbg (component->dev, +"AMD_DMIC rate_min: %d rate_max: %d\n" , rate->min, rate->max); +dev_dbg (component->dev, +"AMD_DMIC channels_min: %d channels_max: %d\n" , + channels->min, channels->max); +break ;default :dev_err (component->dev,"error: invalid DAI type %d\n" , dai->dai_config->type);
sound/soc/sof/topology.c +109 -0
127 lines not on this page · raw message
Signature · 7 lines
2.27.0 _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek
PATCH 12/21 ASoC: SOF: amd: Add trace logger support
In reply to Daniel BalutaFrom: V sujith kumar Reddy <[email protected]>
Add trace support and configure trace stream for ACP firmware.
--- sound/soc/sof/amd/Makefile | 2 +- sound/soc/sof/amd/acp-trace.c | 84 +++++++++++++++++++++++++++++++++++ sound/soc/sof/amd/acp.h | 5 +++ sound/soc/sof/amd/renoir.c | 4 ++ 4 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 sound/soc/sof/amd/acp-trace.c
sound/soc/sof/amd/Makefile +1 -1
@@ -4,7 +4,7 @@ # # Copyright(c) 2021 Advanced Micro Devices, Inc. All rights reserved. -snd-sof-amd-acp-objs := acp.o acp-loader.o acp-ipc.o acp-pcm.o acp-stream.o +snd-sof-amd-acp-objs := acp.o acp-loader.o acp-ipc.o acp-pcm.o acp-stream.o acp-trace.o snd-sof-amd-renoir-objs := pci-rn.o renoir.o obj-$(CONFIG_SND_SOC_SOF_AMD_COMMON) += snd-sof-amd-acp.o
sound/soc/sof/amd/acp-trace.c new file +84 -0
84 lines not on this page · raw message
sound/soc/sof/amd/acp.h +5 -0
@@ -139,6 +139,7 @@ struct acp_dev_data {u8 *data_buf;struct dma_descriptor dscr_info[ACP_MAX_DESC ];struct acp_dsp_stream stream_buf[ACP_MAX_STREAM ]; +struct acp_dsp_stream *dtrace_stream; };void memcpy_to_scratch (struct snd_sof_dev *sdev,u32 offset,unsigned int *src,size_t bytes);
@@ -197,4 +198,8 @@ extern const struct snd_sof_dsp_ops sof_renoir_ops;/* Machine configuration */ int snd_amd_acp_find_config (struct pci_dev *pci); + +/* Trace */ +int acp_sof_trace_init (struct snd_sof_dev *sdev,u32 *stream_tag); +int acp_sof_trace_release (struct snd_sof_dev *sdev);#endif
sound/soc/sof/amd/renoir.c +4 -0
@@ -173,6 +173,10 @@ const struct snd_sof_dsp_ops sof_renoir_ops = { .machine_select = amd_sof_machine_select, .machine_register = sof_machine_register, .machine_unregister = sof_machine_unregister, + +/* Trace Logger */ + .trace_init = acp_sof_trace_init, + .trace_release = acp_sof_trace_release, };EXPORT_SYMBOL (sof_renoir_ops);
Signature · 7 lines
2.27.0 _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek
PATCH 13/21 ASoC: SOF: amd: Add support for SOF firmware authentication
In reply to Daniel BalutaFrom: Ajit Kumar Pandey <[email protected]>
Add callback to notify PSP after loading firmware on DSP. PSP will validate the loaded firmware and set qualifier bit to run firmware on secured AMD systems.
--- sound/soc/sof/amd/acp-dsp-offset.h | 4 ++ sound/soc/sof/amd/acp.c | 66 +++++++++++++++++++++++++++++- sound/soc/sof/amd/acp.h | 21 ++++++++++ sound/soc/sof/amd/pci-rn.c | 5 +++ 4 files changed, 95 insertions(+), 1 deletion(-)
sound/soc/sof/amd/acp-dsp-offset.h +4 -0
@@ -54,6 +54,9 @@#define ACP_PGFSM_STATUS 0x1420/* Registers from ACP_INTR block */ +#define ACP_EXTERNAL_INTR_ENB 0x1800 +#define ACP_EXTERNAL_INTR_CNTL 0x1804 +#define ACP_EXTERNAL_INTR_STAT 0x1808#define ACP_DSP_SW_INTR_CNTL 0x1814#define ACP_DSP_SW_INTR_STAT 0x1818#define ACP_SW_INTR_TRIG 0x181C
@@ -68,6 +71,7 @@#define ACP_SHA_DMA_CMD_STS 0x1CC0#define ACP_SHA_DMA_ERR_STATUS 0x1CC4#define ACP_SHA_TRANSFER_BYTE_CNT 0x1CC8 +#define ACP_SHA_PSP_ACK 0x1C74#define ACP_SCRATCH_REG_0 0x10000
sound/soc/sof/amd/acp.c +65 -1
120 lines not on this page · raw message
sound/soc/sof/amd/acp.h +21 -0
@@ -52,6 +52,15 @@#define ACP_DSP_TO_HOST_IRQ 0x04 +#define HOST_BRIDGE_CZN 0x1630 +#define ACP_SHA_STAT 0x8000 +#define ACP_PSP_TIMEOUT_COUNTER 5 +#define ACP_EXT_INTR_ERROR_STAT 0x20000000 +#define MP0_C2PMSG_26_REG 0x03810570 +#define MBOX_ACP_SHA_DMA_COMMAND 0x330000 +#define MBOX_READY_MASK 0x80000000 +#define MBOX_STATUS_MASK 0xFFFF +struct acp_atu_grp_pte {u32 low;u32 high;
@@ -140,6 +149,7 @@ struct acp_dev_data {struct dma_descriptor dscr_info[ACP_MAX_DESC ];struct acp_dsp_stream stream_buf[ACP_MAX_STREAM ];struct acp_dsp_stream *dtrace_stream; +struct pci_dev *smn_dev; };void memcpy_to_scratch (struct snd_sof_dev *sdev,u32 offset,unsigned int *src,size_t bytes);
@@ -202,4 +212,15 @@ int snd_amd_acp_find_config(struct pci_dev *pci);/* Trace */ int acp_sof_trace_init (struct snd_sof_dev *sdev,u32 *stream_tag);int acp_sof_trace_release (struct snd_sof_dev *sdev); + +struct sof_amd_acp_desc { +unsigned int host_bridge_id; +}; + +static inline const struct sof_amd_acp_desc *get_chip_info (struct snd_sof_pdata *pdata) +{ +const struct sof_dev_desc *desc = pdata->desc; + +return desc->chip_info; +}#endif
sound/soc/sof/amd/pci-rn.c +5 -0
@@ -43,12 +43,17 @@ static const struct resource renoir_res[] = { }, }; +static const struct sof_amd_acp_desc renoir_chip_info = { + .host_bridge_id =HOST_BRIDGE_CZN , +}; +static const struct sof_dev_desc renoir_desc = { .machines = snd_soc_acpi_amd_sof_machines, .resindex_lpe_base =0 , .resindex_pcicfg_base =-1 , .resindex_imr_base =-1 , .irqindex_host_ipc =-1 , + .chip_info = &renoir_chip_info, .default_fw_path ="amd/sof" , .default_tplg_path ="amd/sof-tplg" , .default_fw_filename ="sof-rn.ri" ,
Signature · 7 lines
2.27.0 _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek
Re: [PATCH 13/21] ASoC: SOF: amd: Add support for SOF firmware authentication
Quoted 7 lines · Daniel Baluta
From: Ajit Kumar Pandey <[email protected]>
Add callback to notify PSP after loading firmware on DSP. PSP will validate the loaded firmware and set qualifier bit to run firmware on secured AMD systems.
Quoted 5 lines
Signed-off-by Julian Schroeder <[email protected]>Signed-off-by Ajit Kumar Pandey <[email protected]>Reviewed-by Pierre-Louis Bossart <[email protected]>Reviewed-by Ranjani Sridharan <[email protected]>Reviewed-by Curtis Malainey <[email protected]>
Sorry github must be attached to the wrong email, please use
Quoted 230 lines
Signed-off-by Daniel Baluta <[email protected]>--- sound/soc/sof/amd/acp-dsp-offset.h | 4 ++ sound/soc/sof/amd/acp.c | 66 +++++++++++++++++++++++++++++- sound/soc/sof/amd/acp.h | 21 ++++++++++ sound/soc/sof/amd/pci-rn.c | 5 +++ 4 files changed, 95 insertions(+), 1 deletion(-)sound/soc/sof/amd/acp-dsp-offset.h +4
-0@@ -54,6 +54,9 @@#define ACP_PGFSM_STATUS 0x1420/* Registers from ACP_INTR block */ +#define ACP_EXTERNAL_INTR_ENB 0x1800 +#define ACP_EXTERNAL_INTR_CNTL 0x1804 +#define ACP_EXTERNAL_INTR_STAT 0x1808#define ACP_DSP_SW_INTR_CNTL 0x1814#define ACP_DSP_SW_INTR_STAT 0x1818#define ACP_SW_INTR_TRIG 0x181C@@ -68,6 +71,7 @@#define ACP_SHA_DMA_CMD_STS 0x1CC0#define ACP_SHA_DMA_ERR_STATUS 0x1CC4#define ACP_SHA_TRANSFER_BYTE_CNT 0x1CC8 +#define ACP_SHA_PSP_ACK 0x1C74#define ACP_SCRATCH_REG_0 0x10000sound/soc/sof/amd/acp.c +65
-1@@ -20,6 +20,22 @@#include "acp.h" #include "acp-dsp-offset.h" +static int smn_write (struct pci_dev *dev,u32 smn_addr,u32 data) +{ +pci_write_config_dword (dev,0x60 , smn_addr); +pci_write_config_dword (dev,0x64 , data); + +return 0 ; +} + +static int smn_read (struct pci_dev *dev,u32 smn_addr,u32 *data) +{ +pci_write_config_dword (dev,0x60 , smn_addr); +pci_read_config_dword (dev,0x64 , data); + +return 0 ; +} +static void configure_acp_groupregisters (struct acp_dev_data *adata) {struct snd_sof_dev *sdev = adata->dev;@@ -135,6 +151,25 @@ int configure_and_run_dma(struct acp_dev_data *adata, unsigned int src_addr,return ret; } +static int psp_fw_validate (struct acp_dev_data *adata) +{ +struct snd_sof_dev *sdev = adata->dev; +int timeout; +u32 data; + +smn_write (adata->smn_dev,MP0_C2PMSG_26_REG ,MBOX_ACP_SHA_DMA_COMMAND ); + +for (timeout =ACP_PSP_TIMEOUT_COUNTER ; timeout >0 ; timeout--) { +msleep (20 ); +smn_read (adata->smn_dev,MP0_C2PMSG_26_REG , &data); +if (data &MBOX_READY_MASK ) +return 0 ; + } + +dev_err (sdev->dev,"FW validation timedout: status %x\n" , data &MBOX_STATUS_MASK ); +return -ETIMEDOUT ; +} +int configure_and_run_sha_dma (struct acp_dev_data *adata,void *image_addr,unsigned int start_addr,unsigned int dest_addr,unsigned int image_length)@@ -174,7 +209,9 @@ int configure_and_run_sha_dma(struct acp_dev_data *adata, void *image_addr,return ret; } -snd_sof_dsp_write (sdev,ACP_DSP_BAR ,ACP_SHA_DSP_FW_QUALIFIER ,DSP_FW_RUN_ENABLE ); + ret =psp_fw_validate (adata); +if (ret) +return ret; fw_qualifier =snd_sof_dsp_read (sdev,ACP_DSP_BAR ,ACP_SHA_DSP_FW_QUALIFIER );if (!(fw_qualifier &DSP_FW_RUN_ENABLE )) {@@ -238,6 +275,13 @@ static irqreturn_t acp_irq_thread(int irq, void *context)struct snd_sof_dev *sdev = context;unsigned int val; + val =snd_sof_dsp_read (sdev,ACP_DSP_BAR ,ACP_EXTERNAL_INTR_STAT ); +if (val &ACP_SHA_STAT ) { +/* Clear SHA interrupt raised by PSP */ +snd_sof_dsp_write (sdev,ACP_DSP_BAR ,ACP_EXTERNAL_INTR_STAT , val); +return IRQ_HANDLED ; + } + val =snd_sof_dsp_read (sdev,ACP_DSP_BAR ,ACP_DSP_SW_INTR_STAT );if (val &ACP_DSP_TO_HOST_IRQ ) {sof_ops (sdev)->irq_thread (irq, sdev);@@ -326,6 +370,7 @@ int amd_sof_acp_probe(struct snd_sof_dev *sdev) {struct pci_dev *pci =to_pci_dev (sdev->dev);struct acp_dev_data *adata; +const struct sof_amd_acp_desc *chip;unsigned int addr;int ret;@@ -346,18 +391,32 @@ int amd_sof_acp_probe(struct snd_sof_dev *sdev) sdev->pdata->hw_pdata = adata; + chip =get_chip_info (sdev->pdata); +if (!chip) { +dev_err (sdev->dev,"no such device supported, chip id:%x\n" , pci->device); +return -EIO ; + } + + adata->smn_dev =pci_get_device (PCI_VENDOR_ID_AMD , chip->host_bridge_id,NULL ); +if (!adata->smn_dev) { +dev_err (sdev->dev,"Failed to get host bridge device\n" ); +return -ENODEV ; + } + sdev->ipc_irq = pci->irq; ret =request_threaded_irq (sdev->ipc_irq, acp_irq_handler, acp_irq_thread,IRQF_SHARED ,"AudioDSP" , sdev);if (ret <0 ) {dev_err (sdev->dev,"failed to register IRQ %d\n" , sdev->ipc_irq); +pci_dev_put (adata->smn_dev);return ret; } ret =acp_init (sdev);if (ret <0 ) {free_irq (sdev->ipc_irq, sdev); +pci_dev_put (adata->smn_dev);return ret; }@@ -371,6 +430,11 @@ EXPORT_SYMBOL_NS(amd_sof_acp_probe, SND_SOC_SOF_AMD_COMMON);int amd_sof_acp_remove (struct snd_sof_dev *sdev) { +struct acp_dev_data *adata = sdev->pdata->hw_pdata; + +if (adata->smn_dev) +pci_dev_put (adata->smn_dev); +if (sdev->ipc_irq)free_irq (sdev->ipc_irq, sdev);sound/soc/sof/amd/acp.h +21
-0@@ -52,6 +52,15 @@#define ACP_DSP_TO_HOST_IRQ 0x04 +#define HOST_BRIDGE_CZN 0x1630 +#define ACP_SHA_STAT 0x8000 +#define ACP_PSP_TIMEOUT_COUNTER 5 +#define ACP_EXT_INTR_ERROR_STAT 0x20000000 +#define MP0_C2PMSG_26_REG 0x03810570 +#define MBOX_ACP_SHA_DMA_COMMAND 0x330000 +#define MBOX_READY_MASK 0x80000000 +#define MBOX_STATUS_MASK 0xFFFF +struct acp_atu_grp_pte {u32 low;u32 high;@@ -140,6 +149,7 @@ struct acp_dev_data {struct dma_descriptor dscr_info[ACP_MAX_DESC ];struct acp_dsp_stream stream_buf[ACP_MAX_STREAM ];struct acp_dsp_stream *dtrace_stream; +struct pci_dev *smn_dev; };void memcpy_to_scratch (struct snd_sof_dev *sdev,u32 offset,unsigned int *src,size_t bytes);@@ -202,4 +212,15 @@ int snd_amd_acp_find_config(struct pci_dev *pci);/* Trace */ int acp_sof_trace_init (struct snd_sof_dev *sdev,u32 *stream_tag);int acp_sof_trace_release (struct snd_sof_dev *sdev); + +struct sof_amd_acp_desc { +unsigned int host_bridge_id; +}; + +static inline const struct sof_amd_acp_desc *get_chip_info (struct snd_sof_pdata *pdata) +{ +const struct sof_dev_desc *desc = pdata->desc; + +return desc->chip_info; +}#endif sound/soc/sof/amd/pci-rn.c +5
-1@@ -43,12 +43,17 @@ static const struct resource renoir_res[] = { }, }; +static const struct sof_amd_acp_desc renoir_chip_info = { + .host_bridge_id =HOST_BRIDGE_CZN , +}; +static const struct sof_dev_desc renoir_desc = { .machines = snd_soc_acpi_amd_sof_machines, .resindex_lpe_base =0 , .resindex_pcicfg_base =-1 , .resindex_imr_base =-1 , .irqindex_host_ipc =-1 , + .chip_info = &renoir_chip_info, .default_fw_path ="amd/sof" , .default_tplg_path ="amd/sof-tplg" , .default_fw_filename ="sof-rn.ri" , --2.27.0
PATCH 14/21 ASoC: SOF: mediatek: Add mt8195 hardware support
In reply to Daniel BalutaFrom: YC Hung <[email protected]>
This patch initialize to support SOF on Mediatek mt8195 platform. MT8195 has four Cortex A78 cores paired with four Cortex A55 cores. It also has Cadence HiFi-4 DSP single core. There are shared DRAM and mailbox interrupt between AP and DSP to use for IPC communication.
--- sound/soc/sof/Kconfig | 1 + sound/soc/sof/Makefile | 1 + sound/soc/sof/mediatek/Kconfig | 33 +++ sound/soc/sof/mediatek/Makefile | 2 + sound/soc/sof/mediatek/adsp_helper.h | 49 ++++ sound/soc/sof/mediatek/mediatek-ops.h | 8 + sound/soc/sof/mediatek/mt8195/Makefile | 3 + sound/soc/sof/mediatek/mt8195/mt8195.c | 334 +++++++++++++++++++++++++ sound/soc/sof/mediatek/mt8195/mt8195.h | 155 ++++++++++++ 9 files changed, 586 insertions(+) create mode 100644 sound/soc/sof/mediatek/Kconfig create mode 100644 sound/soc/sof/mediatek/Makefile create mode 100644 sound/soc/sof/mediatek/adsp_helper.h create mode 100644 sound/soc/sof/mediatek/mediatek-ops.h create mode 100644 sound/soc/sof/mediatek/mt8195/Makefile create mode 100644 sound/soc/sof/mediatek/mt8195/mt8195.c create mode 100644 sound/soc/sof/mediatek/mt8195/mt8195.h
sound/soc/sof/Kconfig +1 -0
@@ -226,6 +226,7 @@ config SND_SOC_SOF_PROBE_WORK_QUEUE source "sound/soc/sof/amd/Kconfig" source "sound/soc/sof/imx/Kconfig" source "sound/soc/sof/intel/Kconfig" +source "sound/soc/sof/mediatek/Kconfig" source "sound/soc/sof/xtensa/Kconfig" endif
sound/soc/sof/Makefile +1 -0
@@ -24,3 +24,4 @@ obj-$(CONFIG_SND_SOC_SOF_INTEL_TOPLEVEL) += intel/ obj-$(CONFIG_SND_SOC_SOF_IMX_TOPLEVEL) += imx/ obj-$(CONFIG_SND_SOC_SOF_AMD_TOPLEVEL) += amd/ obj-$(CONFIG_SND_SOC_SOF_XTENSA) += xtensa/ +obj-$(CONFIG_SND_SOC_SOF_MTK_TOPLEVEL) += mediatek/
sound/soc/sof/mediatek/Kconfig new file +33 -0
@@ -0,0 +1,33 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) + +config SND_SOC_SOF_MTK_TOPLEVEL + bool "SOF support for MTK audio DSPs" + depends on ARM64 || COMPILE_TEST + depends on SND_SOC_SOF_OF + help + This adds support for Sound Open Firmware for Mediatek platforms. + It is top level for all mediatek platforms. + Say Y if you have such a device. + If unsure select "N". + +if SND_SOC_SOF_MTK_TOPLEVEL +config SND_SOC_SOF_MTK_COMMON + tristate + select SND_SOC_SOF_OF_DEV + select SND_SOC_SOF + select SND_SOC_SOF_XTENSA + select SND_SOC_SOF_COMPRESS + help + This option is not user-selectable but automagically handled by + 'select' statements at a higher level + +config SND_SOC_SOF_MT8195 + tristate "SOF support for MT8195 audio DSP" + select SND_SOC_SOF_MTK_COMMON + help + This adds support for Sound Open Firmware for Mediatek platforms + using the mt8195 processors. + Say Y if you have such a device. + If unsure select "N". + +endif ## SND_SOC_SOF_MTK_TOPLEVEL
sound/soc/sof/mediatek/Makefile new file +2 -0
@@ -0,0 +1,2 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) +obj-$(CONFIG_SND_SOC_SOF_MT8195) += mt8195/
sound/soc/sof/mediatek/adsp_helper.h new file +49 -0
49 lines not on this page · raw message
sound/soc/sof/mediatek/mediatek-ops.h new file +8 -0
@@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */ + +#ifndef __MEDIATEK_OPS_H__ +#define __MEDIATEK_OPS_H__ + +extern const struct snd_sof_dsp_ops sof_mt8195_ops; + +#endif
sound/soc/sof/mediatek/mt8195/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) +snd-sof-mt8195-objs := mt8195.o +obj-$(CONFIG_SND_SOC_SOF_MT8195) += snd-sof-mt8195.o
sound/soc/sof/mediatek/mt8195/mt8195.c new file +334 -0
334 lines not on this page · raw message
sound/soc/sof/mediatek/mt8195/mt8195.h new file +155 -0
155 lines not on this page · raw message
Signature · 7 lines
2.27.0 _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek
PATCH 15/21 ASoC: SOF: tokens: add token for Mediatek AFE
In reply to Daniel BalutaFrom: YC Hung <[email protected]>
Add the definition for Mediatek audio front end(AFE) tokens,include AFE sampling rate, channels, and format.
--- include/uapi/sound/sof/tokens.h | 5 +++++ 1 file changed, 5 insertions(+)
include/uapi/sound/sof/tokens.h +5 -0
@@ -140,4 +140,9 @@#define SOF_TKN_INTEL_HDA_RATE 1500#define SOF_TKN_INTEL_HDA_CH 1501 +/* AFE */ +#define SOF_TKN_MEDIATEK_AFE_RATE 1600 +#define SOF_TKN_MEDIATEK_AFE_CH 1601 +#define SOF_TKN_MEDIATEK_AFE_FORMAT 1602 +#endif
Signature · 7 lines
2.27.0 _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek
PATCH 16/21 ASoC: SOF: topology: Add support for Mediatek AFE DAI
In reply to Daniel BalutaFrom: YC Hung <[email protected]>
Add new sof dai and config to pass topology file configuration to SOF firmware running on Mediatek platform DSP core. Add mediatek audio front end(AFE) to the list of supported sof_dais
--- include/sound/sof/dai-mediatek.h | 23 +++++++++++++ include/sound/sof/dai.h | 3 ++ sound/soc/sof/pcm.c | 12 +++++++ sound/soc/sof/topology.c | 59 ++++++++++++++++++++++++++++++++ 4 files changed, 97 insertions(+) create mode 100644 include/sound/sof/dai-mediatek.h
include/sound/sof/dai-mediatek.h new file +23 -0
@@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */ +/* +* Copyright(c) 2021 Mediatek Corporation. All rights reserved. +* +* Author: Bo Pan <[email protected]> +*/ + +#ifndef __INCLUDE_SOUND_SOF_DAI_MEDIATEK_H__ +#define __INCLUDE_SOUND_SOF_DAI_MEDIATEK_H__ + +#include <sound/sof/header.h> + +struct sof_ipc_dai_mtk_afe_params { +struct sof_ipc_hdr hdr; +u32 channels; +u32 rate; +u32 format; +u32 stream_id; +u32 reserved[4 ];/* reserve for future */ +} __packed; + +#endif +
include/sound/sof/dai.h +3 -0
@@ -13,6 +13,7 @@#include <sound/sof/dai-intel.h> #include <sound/sof/dai-imx.h> #include <sound/sof/dai-amd.h> +#include <sound/sof/dai-mediatek.h> /* * DAI Configuration.
@@ -70,6 +71,7 @@ enum sof_ipc_dai_type {SOF_DAI_AMD_BT ,/**< AMD ACP BT*/ SOF_DAI_AMD_SP ,/**< AMD ACP SP */ SOF_DAI_AMD_DMIC ,/**< AMD ACP DMIC */ + SOF_DAI_MEDIATEK_AFE, /**< Mediatek AFE */ };/* general purpose DAI configuration */
@@ -97,6 +99,7 @@ struct sof_ipc_dai_config {struct sof_ipc_dai_acp_params acpbt;struct sof_ipc_dai_acp_params acpsp;struct sof_ipc_dai_acp_params acpdmic; +struct sof_ipc_dai_mtk_afe_params afe; }; } __packed;
sound/soc/sof/pcm.c +12 -0
@@ -808,6 +808,18 @@ int sof_pcm_dai_link_fixup(struct snd_soc_pcm_runtime *rtd, struct snd_pcm_hw_pa channels->min = dai->dai_config->esai.tdm_slots; channels->max = dai->dai_config->esai.tdm_slots; +dev_dbg (component->dev, +"rate_min: %d rate_max: %d\n" , rate->min, rate->max); +dev_dbg (component->dev, +"channels_min: %d channels_max: %d\n" , + channels->min, channels->max); +break ; +case SOF_DAI_MEDIATEK_AFE : + rate->min = dai->dai_config->afe.rate; + rate->max = dai->dai_config->afe.rate; + channels->min = dai->dai_config->afe.channels; + channels->max = dai->dai_config->afe.channels; +dev_dbg (component->dev,"rate_min: %d rate_max: %d\n" , rate->min, rate->max); dev_dbg(component->dev,
sound/soc/sof/topology.c +59 -0
83 lines not on this page · raw message
Signature · 7 lines
2.27.0 _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek
Mark Brown
maintainerRe: [PATCH 16/21] ASoC: SOF: topology: Add support for Mediatek AFE DAI
Quoted 5 lines · Daniel Baluta
From: YC Hung <[email protected]>
Add new sof dai and config to pass topology file configuration to SOF firmware running on Mediatek platform DSP core. Add mediatek audio front end(AFE) to the list of supported
sof_dais
This breaks an x86 allmodconfig build:
/mnt/kernel/sound/soc/sof/mediatek/mt8195/mt8195.c: In function 'mt8195_run':/mnt/kernel/sound/soc/sof/mediatek/mt8195/mt8195.c:207:2: error: implicit declaration of function 'sof_hifixdsp_boot_sequence' [-Werror=implicit-function-declaration]
207 | sof_hifixdsp_boot_sequence(sdev, adsp_bootup_addr);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
At top level:
/mnt/kernel/sound/soc/sof/mediatek/mt8195/mt8195.c:201:12: error: 'mt8195_run' defined but not used [-Werror=unused-function]
201 | static int mt8195_run(struct snd_sof_dev *sdev)
| ^~~~~~~~~~cc1: all warnings being treated as errors
_boot_sequence is added in "ASoC: SOF: mediatek: Add fw loader and mt8195 dsp ops to load firmware" which is later in the series.
mt8195_run should be either global, a static inline or not declared in the header at all.
Daniel Baluta
maintainerRe: [PATCH 16/21] ASoC: SOF: topology: Add support for Mediatek AFE DAI
Quoted 16 lines · Mark Brown
Quoted 5 lines · Daniel Baluta
From: YC Hung <[email protected]>
Add new sof dai and config to pass topology file configuration to SOF firmware running on Mediatek platform DSP core. Add mediatek audio front end(AFE) to the list of supported
sof_daisThis breaks an x86 allmodconfig build:
/mnt/kernel/sound/soc/sof/mediatek/mt8195/mt8195.c: In function 'mt8195_run':/mnt/kernel/sound/soc/sof/mediatek/mt8195/mt8195.c:207:2: error: implicit declaration of function 'sof_hifixdsp_boot_sequence' [-Werror=implicit-function-declaration]207 | sof_hifixdsp_boot_sequence(sdev, adsp_bootup_addr); | ^~~~~~~~~~~~~~~~~~~~~~~~~~ At top level: /mnt/kernel/sound/soc/sof/mediatek/mt8195/mt8195.c:201:12: error: 'mt8195_run' defined but not used [-Werror=unused-function] 201 | static int mt8195_run(struct snd_sof_dev *sdev) | ^~~~~~~~~~
Quoted 7 lines
cc1: all warnings being treated as errors
_boot_sequenceis added in "ASoC: SOF: mediatek: Add fw loader and mt8195 dsp ops to load firmware" which is later in the series.
mt8195_runshould be either global, a static inline or not declared in the header at all.
YC,
Please send a fix for this on top of topic/sof-dev. I will take care of the squash and resend.
Re: [PATCH 16/21] ASoC: SOF: topology: Add support for Mediatek AFE DAI
Hi Mark,
I noticed that you already applied this. Should I resend the entire series or just a fixup?
Quoted 24 lines · Daniel Baluta
Quoted 21 lines · Mark Brown
Quoted 5 lines · Daniel Baluta
From: YC Hung <[email protected]>
Add new sof dai and config to pass topology file configuration to SOF firmware running on Mediatek platform DSP core. Add mediatek audio front end(AFE) to the list of supported
sof_daisThis breaks an x86 allmodconfig build:
/mnt/kernel/sound/soc/sof/mediatek/mt8195/mt8195.c: In function 'mt8195_run':/mnt/kernel/sound/soc/sof/mediatek/mt8195/mt8195.c:207:2: error: implicit declaration of function 'sof_hifixdsp_boot_sequence' [-Werror=implicit-function-declaration]207 | sof_hifixdsp_boot_sequence(sdev, adsp_bootup_addr); | ^~~~~~~~~~~~~~~~~~~~~~~~~~ At top level: /mnt/kernel/sound/soc/sof/mediatek/mt8195/mt8195.c:201:12: error: 'mt8195_run' defined but not used [-Werror=unused-function] 201 | static int mt8195_run(struct snd_sof_dev *sdev) | ^~~~~~~~~~cc1: all warnings being treated as errors
_boot_sequenceis added in "ASoC: SOF: mediatek: Add fw loader and mt8195 dsp ops to load firmware" which is later in the series.
Quoted 11 lines
Quoted 2 lines
mt8195_runshould be either global, a static inline or not declared in the header at all.YC,
Please send a fix for this on top of topic/sof-dev. I will take care of the squash and resend.
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
Re: [PATCH 16/21] ASoC: SOF: topology: Add support for Mediatek AFE DAI
Quoted 5 lines · Daniel Baluta
Hi Mark,
I noticed that you already applied this. Should I resend the entire series or just a fixup?
Later edit: All good. You applied only the AMD patches. Sorry for the noise.
Will fix and resend the MTK patches.
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
PATCH 17/21 ASoC: SOF: mediatek: Add fw loader and mt8195 dsp ops to load firmware
In reply to Daniel BalutaFrom: YC Hung <[email protected]>
Add mt8195-loader module with ops callback to load and run firmware on mt8195 platform.
--- sound/soc/sof/mediatek/mt8195/Makefile | 2 +- sound/soc/sof/mediatek/mt8195/mt8195-loader.c | 56 +++++++++++++++++++ sound/soc/sof/mediatek/mt8195/mt8195.c | 8 +++ sound/soc/sof/mediatek/mt8195/mt8195.h | 3 + 4 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 sound/soc/sof/mediatek/mt8195/mt8195-loader.c
sound/soc/sof/mediatek/mt8195/Makefile +1 -1
@@ -1,3 +1,3 @@ # SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) -snd-sof-mt8195-objs := mt8195.o +snd-sof-mt8195-objs := mt8195.o mt8195-loader.o obj-$(CONFIG_SND_SOC_SOF_MT8195) += snd-sof-mt8195.o
sound/soc/sof/mediatek/mt8195/mt8195-loader.c new file +56 -0
56 lines not on this page · raw message
sound/soc/sof/mediatek/mt8195/mt8195.c +8 -0
@@ -305,6 +305,9 @@ const struct snd_sof_dsp_ops sof_mt8195_ops = { .probe = mt8195_dsp_probe, .remove = mt8195_dsp_remove, +/* DSP core boot */ + .run = mt8195_run, +/* Block IO */ .block_read = sof_block_read, .block_write = sof_block_write,
@@ -318,6 +321,11 @@ const struct snd_sof_dsp_ops sof_mt8195_ops = {/* misc */ .get_bar_index = mt8195_get_bar_index, +/* module loading */ + .load_module = snd_sof_parse_module_memcpy, +/* firmware loading */ + .load_firmware = snd_sof_load_firmware_memcpy, +/* Firmware ops */ .dsp_arch_ops = &sof_xtensa_arch_ops,
sound/soc/sof/mediatek/mt8195/mt8195.h +3 -0
@@ -10,6 +10,7 @@#define __MT8195_Hstruct mtk_adsp_chip_info ; +struct snd_sof_dev ;#define DSP_REG_BASE 0x10803000#define SCP_CFGREG_BASE 0x10724000
@@ -152,4 +153,6 @@ struct mtk_adsp_chip_info;#define DRAM_REMAP_SHIFT 12#define DRAM_REMAP_MASK (BIT(DRAM_REMAP_SHIFT) - 1) +void sof_hifixdsp_boot_sequence (struct snd_sof_dev *sdev,u32 boot_addr); +void sof_hifixdsp_shutdown (struct snd_sof_dev *sdev);#endif
Signature · 7 lines
2.27.0 _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek
PATCH 18/21 ASoC: SOF: Add mt8195 device descriptor
In reply to Daniel BalutaFrom: YC Hung <[email protected]>
Add SOF device and DT descriptor for Mediatek mt8195 platform.
--- sound/soc/sof/Kconfig | 2 +- sound/soc/sof/sof-of-dev.c | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-)
sound/soc/sof/Kconfig +1 -1
@@ -43,7 +43,7 @@ config SND_SOC_SOF_OF select SND_SOC_SOF help This adds support for Device Tree enumeration. This option is - required to enable i.MX8 devices. + required to enable i.MX8 or Mediatek devices. Say Y if you need this option. If unsure select "N". config SND_SOC_SOF_COMPRESS
sound/soc/sof/sof-of-dev.c +13 -0
@@ -13,6 +13,7 @@#include "ops.h" #include "imx/imx-ops.h" +#include "mediatek/mediatek-ops.h" static char *fw_path;module_param (fw_path, charp,0444 );
@@ -50,6 +51,15 @@ static struct sof_dev_desc sof_of_imx8mp_desc = { .ops = &sof_imx8m_ops, };#endif +#if IS_ENABLED (CONFIG_SND_SOC_SOF_MT8195 ) +static const struct sof_dev_desc sof_of_mt8195_desc = { + .default_fw_path ="mediatek/sof" , + .default_tplg_path ="mediatek/sof-tplg" , + .default_fw_filename ="sof-mt8195.ri" , + .nocodec_tplg_filename ="sof-mt8195-nocodec.tplg" , + .ops = &sof_mt8195_ops, +}; +#endif static const struct dev_pm_ops sof_of_pm = { .prepare = snd_sof_prepare,
@@ -130,6 +140,9 @@ static const struct of_device_id sof_of_ids[] = {#endif #if IS_ENABLED(CONFIG_SND_SOC_SOF_IMX8M) { .compatible = "fsl,imx8mp-dsp", .data = &sof_of_imx8mp_desc}, +#endif +#if IS_ENABLED(CONFIG_SND_SOC_SOF_MT8195) + { .compatible = "mediatek,mt8195-dsp", .data = &sof_of_mt8195_desc}, #endif { } };
Signature · 7 lines
2.27.0 _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek
PATCH 19/21 ASoC: SOF: mediatek: Add dai driver dsp ops callback for mt8195
In reply to Daniel BalutaFrom: YC Hung <[email protected]>
Add dsp ops callback to register AFE DL2/DL3/UL4/UL5 sof dai's with ALSA
--- sound/soc/sof/mediatek/mt8195/mt8195.c | 35 ++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)
sound/soc/sof/mediatek/mt8195/mt8195.c +35 -0
@@ -299,6 +299,37 @@ static int mt8195_get_bar_index(struct snd_sof_dev *sdev, u32 type)return type; } +static struct snd_soc_dai_driver mt8195_dai[] = { +{ + .name ="SOF_DL2" , + .playback = { + .channels_min =1 , + .channels_max =2 , + }, +}, +{ + .name ="SOF_DL3" , + .playback = { + .channels_min =1 , + .channels_max =2 , + }, +}, +{ + .name ="SOF_UL4" , + .capture = { + .channels_min =1 , + .channels_max =2 , + }, +}, +{ + .name ="SOF_UL5" , + .capture = { + .channels_min =1 , + .channels_max =2 , + }, +}, +}; +/* mt8195 ops */ const struct snd_sof_dsp_ops sof_mt8195_ops = {/* probe and remove */
@@ -329,6 +360,10 @@ const struct snd_sof_dsp_ops sof_mt8195_ops = {/* Firmware ops */ .dsp_arch_ops = &sof_xtensa_arch_ops, +/* DAI drivers */ + .drv = mt8195_dai, + .num_drv = ARRAY_SIZE(mt8195_dai), +/* ALSA HW info flags */ .hw_info =SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID |
Signature · 7 lines
2.27.0 _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek
PATCH 20/21 ASoC: SOF: mediatek: Add mt8195 dsp clock support
In reply to Daniel BalutaFrom: YC Hung <[email protected]>
Add adsp clock on/off support on mt8195 platform.
--- sound/soc/sof/mediatek/adsp_helper.h | 2 +- sound/soc/sof/mediatek/mt8195/Makefile | 2 +- sound/soc/sof/mediatek/mt8195/mt8195-clk.c | 158 +++++++++++++++++++++ sound/soc/sof/mediatek/mt8195/mt8195-clk.h | 28 ++++ sound/soc/sof/mediatek/mt8195/mt8195.c | 22 ++- 5 files changed, 208 insertions(+), 4 deletions(-) create mode 100644 sound/soc/sof/mediatek/mt8195/mt8195-clk.c create mode 100644 sound/soc/sof/mediatek/mt8195/mt8195-clk.h
sound/soc/sof/mediatek/adsp_helper.h +1 -1
@@ -39,7 +39,7 @@ struct adsp_priv {struct mbox_controller *adsp_mbox;struct mtk_adsp_chip_info *adsp; - +struct clk **clk;u32 (*ap2adsp_addr)(u32 addr,void *data);u32 (*adsp2ap_addr)(u32 addr,void *data);
sound/soc/sof/mediatek/mt8195/Makefile +1 -1
@@ -1,3 +1,3 @@ # SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) -snd-sof-mt8195-objs := mt8195.o mt8195-loader.o +snd-sof-mt8195-objs := mt8195.o mt8195-clk.o mt8195-loader.o obj-$(CONFIG_SND_SOC_SOF_MT8195) += snd-sof-mt8195.o
sound/soc/sof/mediatek/mt8195/mt8195-clk.c new file +158 -0
158 lines not on this page · raw message
sound/soc/sof/mediatek/mt8195/mt8195-clk.h new file +28 -0
@@ -0,0 +1,28 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +/* +* Copyright (c) 2021 MediaTek Corporation. All rights reserved. +* +* Header file for the mt8195 DSP clock definition +*/ + +#ifndef __MT8195_CLK_H +#define __MT8195_CLK_H + +struct snd_sof_dev ; + +/*DSP clock*/ +enum adsp_clk_id { +CLK_TOP_ADSP , +CLK_TOP_CLK26M , +CLK_TOP_AUDIO_LOCAL_BUS , +CLK_TOP_MAINPLL_D7_D2 , +CLK_SCP_ADSP_AUDIODSP , +CLK_TOP_AUDIO_H , +ADSP_CLK_MAX +}; + +int mt8195_adsp_init_clock (struct snd_sof_dev *sdev); +int adsp_clock_on (struct snd_sof_dev *sdev); +int adsp_clock_off (struct snd_sof_dev *sdev); +#endif
sound/soc/sof/mediatek/mt8195/mt8195.c +20 -2
@@ -25,6 +25,7 @@#include "../adsp_helper.h" #include "../mediatek-ops.h" #include "mt8195.h" +#include "mt8195-clk.h" static int platform_parse_resource (struct platform_device *pdev,void *data) {
@@ -231,10 +232,22 @@ static int mt8195_dsp_probe(struct snd_sof_dev *sdev)if (ret)return ret; + ret =mt8195_adsp_init_clock (sdev); +if (ret) { +dev_err (sdev->dev,"mt8195_adsp_init_clock failed\n" ); +return -EINVAL ; + } + + ret =adsp_clock_on (sdev); +if (ret) { +dev_err (sdev->dev,"adsp_clock_on fail!\n" ); +return -EINVAL ; + } + ret =adsp_sram_power_on (sdev->dev, true);if (ret) {dev_err (sdev->dev,"adsp_sram_power_on fail!\n" ); -return ret; + goto exit_clk_disable; } ret =adsp_memory_remap_init (&pdev->dev, priv->adsp);
@@ -282,6 +295,8 @@ static int mt8195_dsp_probe(struct snd_sof_dev *sdev) err_adsp_sram_power_off:adsp_sram_power_on (&pdev->dev, false); +exit_clk_disable: +adsp_clock_off (sdev);return ret; }
@@ -290,7 +305,10 @@ static int mt8195_dsp_remove(struct snd_sof_dev *sdev) { struct platform_device *pdev = container_of(sdev->dev, struct platform_device, dev); -return adsp_sram_power_on (&pdev->dev, false); +adsp_sram_power_on (&pdev->dev, false); +adsp_clock_off (sdev); + +return 0 ; }/* on mt8195 there is 1 to 1 match between type and BAR idx */
Signature · 7 lines
2.27.0 _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek
PATCH 21/21 ASoC: SOF: mediatek: Add DSP system PM callback for mt8195
In reply to Daniel BalutaFrom: YC Hung <[email protected]>
Add DSP system PM callback for suspend and resume
--- sound/soc/sof/mediatek/mt8195/mt8195.c | 42 ++++++++++++++++++++++++++ 1 file changed, 42 insertions(+)
sound/soc/sof/mediatek/mt8195/mt8195.c +42 -0
@@ -311,6 +311,44 @@ static int mt8195_dsp_remove(struct snd_sof_dev *sdev)return 0 ; } +static int mt8195_dsp_suspend (struct snd_sof_dev *sdev,u32 target_state) +{ + struct platform_device *pdev = container_of(sdev->dev, struct platform_device, dev); +int ret; + +/* stall and reset dsp */ +sof_hifixdsp_shutdown (sdev); + +/* power down adsp sram */ + ret =adsp_sram_power_on (&pdev->dev, false); +if (ret) { +dev_err (sdev->dev,"adsp_sram_power_off fail!\n" ); +return ret; + } + +/* turn off adsp clock */ +return adsp_clock_off (sdev); +} + +static int mt8195_dsp_resume (struct snd_sof_dev *sdev) +{ +int ret; + +/* turn on adsp clock */ + ret =adsp_clock_on (sdev); +if (ret) { +dev_err (sdev->dev,"adsp_clock_on fail!\n" ); +return ret; + } + +/* power on adsp sram */ + ret =adsp_sram_power_on (sdev->dev, true); +if (ret) +dev_err (sdev->dev,"adsp_sram_power_on fail!\n" ); + +return ret; +} +/* on mt8195 there is 1 to 1 match between type and BAR idx */ static int mt8195_get_bar_index (struct snd_sof_dev *sdev,u32 type) {
@@ -382,6 +420,10 @@ const struct snd_sof_dsp_ops sof_mt8195_ops = { .drv = mt8195_dai, .num_drv = ARRAY_SIZE(mt8195_dai), +/* PM */ + .suspend = mt8195_dsp_suspend, + .resume = mt8195_dsp_resume, +/* ALSA HW info flags */ .hw_info =SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID |
Signature · 7 lines
2.27.0 _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek
Mark Brown
maintainerQuoted 11 lines · Daniel Baluta
From: Daniel Baluta <[email protected]>
This patchseries adds Renoir ACP HW support and Mediatek MT8195 platform.
Notes:
- I first send the meditatek support in a previous emails but it failed to apply because there are some dependencies on AMD patches related to DAI ids.[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[01/21] ASoC: SOF: amd: Add Renoir ACP HW support
commit: 846aef1d7cc05651e27c17c3b4e2b5ce5cdec97b
[02/21] ASoC: SOF: amd: Add helper callbacks for ACP's DMA configuration
commit: 0e44572a28a49109eae23af1545c658b86c4bf00
[03/21] ASoC: SOF: amd: Add fw loader and renoir dsp ops to load firmware
commit: 7e51a9e38ab204eba2844b8773486392d7444435
[04/21] ASoC: SOF: amd: Add IPC support for ACP IP block
commit: 738a2b5e2cc9fd63d48faac11c8d60a5a2313a9d
[05/21] ASoC: SOF: amd: Add dai driver dsp ops callback for Renoir
commit: bda93076d184ad80a8cab09bf29ace7692de18f7
[06/21] ASoC: SOF: amd: Add PCM stream callback for Renoir dai's
commit: e8afccf8fb75bae9c3292a0e51593af92839415e
[07/21] ASoC: amd: Add module to determine ACP configuration
commit: f1bdd8d385a803565024c8feeedc17bf86aac4f5
[08/21] ASoC: SOF: amd: Add machine driver dsp ops for Renoir platform
commit: 11ddd4e371810017faf7ff7cb2349f321e50d1d3
[09/21] ASoC: SOF: amd: Add Renoir PCI driver interface
commit: ec25a3b14261fcb05568a1fec15ca68152e9d208
[10/21] ASoC: amd: acp-config: Remove legacy acpi based machine struct
commit: 63fba90fc88b6cee9f8bead761a419169ecda6cc
[11/21] ASoC: SOF: topology: Add support for AMD ACP DAIs
commit: efb931cdc4b94a0f7ed17a76844f08cef1bdffe5
[12/21] ASoC: SOF: amd: Add trace logger support
commit: 4627421fb883928af5220c66a304bed1f9b77e8d
[13/21] ASoC: SOF: amd: Add support for SOF firmware authentication
commit: f063eba3e7a6aeec8e2abb00469e70c51432453b[14/21] ASoC: SOF: mediatek: Add mt8195 hardware support
(no commit info)
[15/21] ASoC: SOF: tokens: add token for Mediatek AFE
(no commit info)
[16/21] ASoC: SOF: topology: Add support for Mediatek AFE DAI
(no commit info)
[17/21] ASoC: SOF: mediatek: Add fw loader and mt8195 dsp ops to load firmware
(no commit info)
[18/21] ASoC: SOF: Add mt8195 device descriptor
(no commit info)
[19/21] ASoC: SOF: mediatek: Add dai driver dsp ops callback for mt8195
(no commit info)
[20/21] ASoC: SOF: mediatek: Add mt8195 dsp clock support
(no commit info)
[21/21] ASoC: SOF: mediatek: Add DSP system PM callback for mt8195
(no commit info)
All 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