From 0e2551206496d902d50a2e69da3a2fc9f9eca80b Mon Sep 17 00:00:00 2001 From: Kai Vehmanen Date: Tue, 12 Nov 2024 18:39:16 +0200 Subject: [PATCH 1/7] ipc4: alh.h: handle hw variants directly in alh.h The alh.h headers have used SOF platform layer to handle differences between different Intel ALH generations. In the end the only difference is the encoding used for DAI index. Move the variation to ipc4/alh.h directly as this only affects Intel builds with ALH support. Signed-off-by: Kai Vehmanen --- src/include/ipc4/alh.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/include/ipc4/alh.h b/src/include/ipc4/alh.h index eaa6692210c3..c15578514b2a 100644 --- a/src/include/ipc4/alh.h +++ b/src/include/ipc4/alh.h @@ -36,10 +36,19 @@ #define IPC4_ALH_DAI_INDEX_OFFSET 0 #endif +#if defined(CONFIG_SOC_SERIES_INTEL_ADSP_CAVS) || \ + defined(CONFIG_SOC_INTEL_ACE15_MTPM) +#define IPC4_DAI_NUM_ALH_BI_DIR_LINKS 16 +#define IPC4_DAI_NUM_ALH_BI_DIR_LINKS_GROUP 4 +#else +#define IPC4_DAI_NUM_ALH_BI_DIR_LINKS 0 +#define IPC4_DAI_NUM_ALH_BI_DIR_LINKS_GROUP 0 +#endif + /* copier id = (group id << 4) + codec id + IPC4_ALH_DAI_INDEX_OFFSET * dai_index = (group id << 8) + codec id; */ -#define IPC4_ALH_DAI_INDEX(x) ((((x) & 0xF0) << DAI_NUM_ALH_BI_DIR_LINKS_GROUP) + \ +#define IPC4_ALH_DAI_INDEX(x) ((((x) & 0xF0) << IPC4_DAI_NUM_ALH_BI_DIR_LINKS_GROUP) + \ (((x) & 0xF) - IPC4_ALH_DAI_INDEX_OFFSET)) /* Multi-gateways addressing starts from IPC4_ALH_MULTI_GTW_BASE */ From afb64019c112ceb76ace8e65a327943d2c5cf8a7 Mon Sep 17 00:00:00 2001 From: Kai Vehmanen Date: Tue, 12 Nov 2024 18:20:06 +0200 Subject: [PATCH 2/7] audio: base_fw_intel: use DT for SSP/HDA properties Stop using platform layer to query number of SSP instances and number of HDA in/out DMA channels. The hardware specific information is already defined in device tree data, so no need to have same information duplicated in SOF platform layer. Signed-off-by: Kai Vehmanen --- src/audio/base_fw_intel.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/audio/base_fw_intel.c b/src/audio/base_fw_intel.c index 520894ec2d0a..37ddc396614f 100644 --- a/src/audio/base_fw_intel.c +++ b/src/audio/base_fw_intel.c @@ -47,6 +47,10 @@ struct ipc4_modules_info { #define PLATFORM_LPSRAM_EBB_COUNT (DT_REG_SIZE(DT_NODELABEL(sram1)) / SRAM_BANK_SIZE) #define PLATFORM_HPSRAM_EBB_COUNT (DT_REG_SIZE(DT_NODELABEL(sram0)) / SRAM_BANK_SIZE) +#define DT_NUM_SSP_BASE DT_NUM_INST_STATUS_OKAY(intel_ssp) +#define DT_NUM_HDA_IN DT_PROP(DT_INST(0, intel_adsp_hda_link_in), dma_channels) +#define DT_NUM_HDA_OUT DT_PROP(DT_INST(0, intel_adsp_hda_link_out), dma_channels) + LOG_MODULE_REGISTER(basefw_intel, CONFIG_SOF_LOG_LEVEL); int basefw_vendor_fw_config(uint32_t *data_offset, char *data) @@ -83,7 +87,7 @@ int basefw_vendor_hw_config(uint32_t *data_offset, char *data) tuple = tlv_next(tuple); /* 2 DMIC dais */ - value = DAI_NUM_SSP_BASE + DAI_NUM_HDA_IN + DAI_NUM_HDA_OUT + + value = DT_NUM_SSP_BASE + DT_NUM_HDA_IN + DT_NUM_HDA_OUT + DAI_NUM_ALH_BI_DIR_LINKS + 2; tlv_value_uint32_set(tuple, IPC4_GATEWAY_COUNT_HW_CFG, value); From ac4029f5bc1038766b3011bf92fbaa0a46e24883 Mon Sep 17 00:00:00 2001 From: Kai Vehmanen Date: Wed, 13 Nov 2024 15:14:24 +0200 Subject: [PATCH 3/7] audio: base_fw_intel: use alh.h instead of platform dai.h To calculate the gateway count in hardware config IPC response, ALH bidirection link count is needed. Instead of pulling this from the SOF platform layer, use the ipc4/alh.h directly as it now has this information. Signed-off-by: Kai Vehmanen --- src/audio/base_fw_intel.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/audio/base_fw_intel.c b/src/audio/base_fw_intel.c index 37ddc396614f..5c38d07960cc 100644 --- a/src/audio/base_fw_intel.c +++ b/src/audio/base_fw_intel.c @@ -24,6 +24,7 @@ #include #include +#include #include #include "copier/copier_gain.h" @@ -88,7 +89,7 @@ int basefw_vendor_hw_config(uint32_t *data_offset, char *data) tuple = tlv_next(tuple); /* 2 DMIC dais */ value = DT_NUM_SSP_BASE + DT_NUM_HDA_IN + DT_NUM_HDA_OUT + - DAI_NUM_ALH_BI_DIR_LINKS + 2; + IPC4_DAI_NUM_ALH_BI_DIR_LINKS + 2; tlv_value_uint32_set(tuple, IPC4_GATEWAY_COUNT_HW_CFG, value); tuple = tlv_next(tuple); From 57c15a04ee5f459283d84ecb3c3f966446ce16e8 Mon Sep 17 00:00:00 2001 From: Kai Vehmanen Date: Wed, 13 Nov 2024 10:40:41 +0200 Subject: [PATCH 4/7] audio: chain_dma: use devicetree definitions directly Stop using the SOF platform layer and directly pull the hardware properties from devicetree. Signed-off-by: Kai Vehmanen --- src/audio/chain_dma.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/audio/chain_dma.c b/src/audio/chain_dma.c index 77081b962bb3..d2cc14230ea9 100644 --- a/src/audio/chain_dma.c +++ b/src/audio/chain_dma.c @@ -30,8 +30,11 @@ #include #endif +#define DT_NUM_HDA_IN DT_PROP(DT_INST(0, intel_adsp_hda_link_in), dma_channels) +#define DT_NUM_HDA_OUT DT_PROP(DT_INST(0, intel_adsp_hda_link_out), dma_channels) + static const struct comp_driver comp_chain_dma; -static const uint32_t max_chain_number = DAI_NUM_HDA_OUT + DAI_NUM_HDA_IN; +static const uint32_t max_chain_number = DT_NUM_HDA_OUT + DT_NUM_HDA_IN; LOG_MODULE_REGISTER(chain_dma, CONFIG_SOF_LOG_LEVEL); @@ -405,10 +408,10 @@ static int get_connector_node_id(uint32_t dma_id, bool host_type, { uint8_t type = host_type ? ipc4_hda_host_output_class : ipc4_hda_link_output_class; - if (dma_id >= DAI_NUM_HDA_OUT) { + if (dma_id >= DT_NUM_HDA_OUT) { type = host_type ? ipc4_hda_host_input_class : ipc4_hda_link_input_class; - dma_id -= DAI_NUM_HDA_OUT; - if (dma_id >= DAI_NUM_HDA_IN) + dma_id -= DT_NUM_HDA_OUT; + if (dma_id >= DT_NUM_HDA_IN) return -EINVAL; } connector_node_id->dw = 0; From 21cd3f488a1ee32f380d2bbca41fa87e1522abf1 Mon Sep 17 00:00:00 2001 From: Kai Vehmanen Date: Wed, 13 Nov 2024 15:22:39 +0200 Subject: [PATCH 5/7] lib: dai: remove platform include from dai-zephyr.h Use of native Zephyr DAIs has no dependency to SOF platform definitions anymore, so this include can be removed. Signed-off-by: Kai Vehmanen --- src/include/sof/lib/dai-zephyr.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/include/sof/lib/dai-zephyr.h b/src/include/sof/lib/dai-zephyr.h index d7ef31b4fb21..84b834138eae 100644 --- a/src/include/sof/lib/dai-zephyr.h +++ b/src/include/sof/lib/dai-zephyr.h @@ -16,7 +16,6 @@ #ifndef __SOF_LIB_DAI_ZEPHYR_H__ #define __SOF_LIB_DAI_ZEPHYR_H__ -#include #include #include #include From 11f55f666ce156a44773e77ebd2fdf3769bd6278 Mon Sep 17 00:00:00 2001 From: Kai Vehmanen Date: Wed, 13 Nov 2024 10:34:56 +0200 Subject: [PATCH 6/7] platform: intel: remove lib/dai.h for all Intel platforms No longer needed for Zephyr builds, can be removed as unused. Signed-off-by: Kai Vehmanen --- src/platform/ace30/include/platform/lib/dai.h | 46 ---------------- .../lunarlake/include/platform/lib/dai.h | 46 ---------------- .../meteorlake/include/platform/lib/dai.h | 46 ---------------- .../tigerlake/include/platform/lib/dai.h | 54 ------------------- 4 files changed, 192 deletions(-) delete mode 100644 src/platform/ace30/include/platform/lib/dai.h delete mode 100644 src/platform/lunarlake/include/platform/lib/dai.h delete mode 100644 src/platform/meteorlake/include/platform/lib/dai.h delete mode 100644 src/platform/tigerlake/include/platform/lib/dai.h diff --git a/src/platform/ace30/include/platform/lib/dai.h b/src/platform/ace30/include/platform/lib/dai.h deleted file mode 100644 index cce32b808cf7..000000000000 --- a/src/platform/ace30/include/platform/lib/dai.h +++ /dev/null @@ -1,46 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause - * - * Copyright(c) 2022-2024 Intel Corporation. - * - * Author: Marcin Maka - */ - -#ifdef __SOF_LIB_DAI_H__ - -#ifndef __PLATFORM_LIB_DAI_H__ -#define __PLATFORM_LIB_DAI_H__ - -/* SSP */ - -/* - * Number of base and extended SSP ports must be defined separately - * since some HW registers are in two groups, one for base and one - * for extended. - */ - -/** \brief Number of 'base' SSP ports available */ -#define DAI_NUM_SSP_BASE 6 - -/* HD/A */ - -/** \brief Number of HD/A Link Outputs */ -#define DAI_NUM_HDA_OUT 9 - -/** \brief Number of HD/A Link Inputs */ -#define DAI_NUM_HDA_IN 11 - -/* ALH */ - -/** \brief Number of ALH bi-directional links */ -#define DAI_NUM_ALH_BI_DIR_LINKS 0 - -/** \brief Number of contiguous ALH bi-dir links */ -#define DAI_NUM_ALH_BI_DIR_LINKS_GROUP 0 - -#endif /* __PLATFORM_LIB_DAI_H__ */ - -#else - -#error "This file shouldn't be included from outside of sof/lib/dai.h" - -#endif /* __SOF_LIB_DAI_H__ */ diff --git a/src/platform/lunarlake/include/platform/lib/dai.h b/src/platform/lunarlake/include/platform/lib/dai.h deleted file mode 100644 index 3d52e0bc20bf..000000000000 --- a/src/platform/lunarlake/include/platform/lib/dai.h +++ /dev/null @@ -1,46 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause - * - * Copyright(c) 2023 Intel Corporation. All rights reserved. - * - * Author: Jaroslaw Stelter - */ - -#ifdef __SOF_LIB_DAI_H__ - -#ifndef __PLATFORM_LIB_DAI_H__ -#define __PLATFORM_LIB_DAI_H__ - -/* SSP */ - -/* - * Number of base and extended SSP ports must be defined separately - * since some HW registers are in two groups, one for base and one - * for extended. - */ - -/** \brief Number of 'base' SSP ports available */ -#define DAI_NUM_SSP_BASE 3 - -/* HD/A */ - -/** \brief Number of HD/A Link Outputs */ -#define DAI_NUM_HDA_OUT 9 - -/** \brief Number of HD/A Link Inputs */ -#define DAI_NUM_HDA_IN 11 - -/* ALH */ - -/** \brief Number of ALH bi-directional links */ -#define DAI_NUM_ALH_BI_DIR_LINKS 0 - -/** \brief Number of contiguous ALH bi-dir links */ -#define DAI_NUM_ALH_BI_DIR_LINKS_GROUP 0 - -#endif /* __PLATFORM_LIB_DAI_H__ */ - -#else - -#error "This file shouldn't be included from outside of sof/lib/dai.h" - -#endif /* __SOF_LIB_DAI_H__ */ diff --git a/src/platform/meteorlake/include/platform/lib/dai.h b/src/platform/meteorlake/include/platform/lib/dai.h deleted file mode 100644 index a1fc2dfff4e5..000000000000 --- a/src/platform/meteorlake/include/platform/lib/dai.h +++ /dev/null @@ -1,46 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause - * - * Copyright(c) 2022 Intel Corporation. All rights reserved. - * - * Author: Marcin Maka - */ - -#ifdef __SOF_LIB_DAI_H__ - -#ifndef __PLATFORM_LIB_DAI_H__ -#define __PLATFORM_LIB_DAI_H__ - -/* SSP */ - -/* - * Number of base and extended SSP ports must be defined separately - * since some HW registers are in two groups, one for base and one - * for extended. - */ - -/** \brief Number of 'base' SSP ports available */ -#define DAI_NUM_SSP_BASE 3 - -/* HD/A */ - -/** \brief Number of HD/A Link Outputs */ -#define DAI_NUM_HDA_OUT 9 - -/** \brief Number of HD/A Link Inputs */ -#define DAI_NUM_HDA_IN 10 - -/* ALH */ - -/** \brief Number of ALH bi-directional links */ -#define DAI_NUM_ALH_BI_DIR_LINKS 16 - -/** \brief Number of contiguous ALH bi-dir links */ -#define DAI_NUM_ALH_BI_DIR_LINKS_GROUP 4 - -#endif /* __PLATFORM_LIB_DAI_H__ */ - -#else - -#error "This file shouldn't be included from outside of sof/lib/dai.h" - -#endif /* __SOF_LIB_DAI_H__ */ diff --git a/src/platform/tigerlake/include/platform/lib/dai.h b/src/platform/tigerlake/include/platform/lib/dai.h deleted file mode 100644 index 048c9d56164f..000000000000 --- a/src/platform/tigerlake/include/platform/lib/dai.h +++ /dev/null @@ -1,54 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause - * - * Copyright(c) 2018 Intel Corporation. All rights reserved. - * - * Author: Marcin Maka - */ - -#ifdef __SOF_LIB_DAI_H__ - -#ifndef __PLATFORM_LIB_DAI_H__ -#define __PLATFORM_LIB_DAI_H__ - -/* TIGERLAKE */ - -/* SSP */ - -/* - * Number of base and extended SSP ports must be defined separately - * since some HW registers are in two groups, one for base and one - * for extended. - */ - -/** \brief Number of 'base' SSP ports available */ -#define DAI_NUM_SSP_BASE 6 - -/** \brief Number of 'extended' SSP ports available */ -#define DAI_NUM_SSP_EXT 0 - -/** \brief Number of SSP MCLKs available */ -#define DAI_NUM_SSP_MCLK 2 - -/* HD/A */ - -/** \brief Number of HD/A Link Outputs */ -#define DAI_NUM_HDA_OUT 9 - -/** \brief Number of HD/A Link Inputs */ -#define DAI_NUM_HDA_IN 7 - -/* ALH */ - -/** \brief Number of ALH bi-directional links */ -#define DAI_NUM_ALH_BI_DIR_LINKS 16 - -/** \brief Number of contiguous ALH bi-dir links */ -#define DAI_NUM_ALH_BI_DIR_LINKS_GROUP 4 - -#endif /* __PLATFORM_LIB_DAI_H__ */ - -#else - -#error "This file shouldn't be included from outside of sof/lib/dai.h" - -#endif /* __SOF_LIB_DAI_H__ */ From c9fd56ccc7c19f90affd7346f553fc4970baa11d Mon Sep 17 00:00:00 2001 From: Kai Vehmanen Date: Wed, 13 Nov 2024 13:43:15 +0200 Subject: [PATCH 7/7] platform: imx95: remove platform lib/dai.h No longer needed for Zephyr builds, can be removed as unused. Signed-off-by: Kai Vehmanen --- src/platform/imx95/include/platform/lib/dai.h | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 src/platform/imx95/include/platform/lib/dai.h diff --git a/src/platform/imx95/include/platform/lib/dai.h b/src/platform/imx95/include/platform/lib/dai.h deleted file mode 100644 index 4a64614f6092..000000000000 --- a/src/platform/imx95/include/platform/lib/dai.h +++ /dev/null @@ -1,19 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause - * - * Copyright 2024 NXP - */ - -#ifdef __SOF_LIB_DAI_H__ - -#ifndef __PLATFORM_LIB_DAI_H__ -#define __PLATFORM_LIB_DAI_H__ - -/* TODO: remove me whenever possible */ - -#endif /* __PLATFORM_LIB_DAI_H__ */ - -#else - -#error "This file shouldn't be included from outside of sof/lib/dai.h" - -#endif /* __SOF_LIB_DAI_H__ */