ASoC: Intel: avs: Add support for MTL-FCL platforms
Subsystems (4)
Cezary Rojewski
maintainercover ASoC: Intel: avs: Add support for MTL-FCL platforms
The patchset is fairly straightforward - add support for range of platforms starting from MeteorLake (MTL) up to upcoming FriscoLake (FCL). The cAVS architecture which all Intel AudioDSP followed for years ends with RaptorLake familty. Like all the major updates, this one received new name too - Audio Context Engine (ACE).
While the range of improvements and changes on the firmware/hardware side is large, software survives this evolution without need of any major refactoring. Additional hardware changes brought with LunarLake (LNL, ACE 2.0) call for update in PCM-area. The GPDMAs previously utilized for non-HDAudio transfer types are no longer there, everything is running through HDAudio LINK on the Back-End side now.
In terms of code, the MTL-support hosts largest number of new handlers - new IRQ and INT control and DSP-cores management. LNL-based and PTL-based platforms e.g.: FCL inherit majority of the operations from it. The inheritance in summary:
mtl.c <- lnl.c <- ptl.c
The functional update to HDAudio library is there to help avs-driver read certain capabilities directly from the hardware. Once the pointer to LINK is obtained, there is no need to call AudioDSP firmware to get the caps.
Amadeusz Sławiński (1):
ASoC: Intel: avs: Add boards definitions for ACE platforms
Cezary Rojewski (11):
ALSA: hda: Allow to fetch hlink by ID
ASoC: Intel: avs: Ignore Vendor-space manipulation for ACE
ASoC: Intel: avs: Read HW capabilities when possible
ASoC: Intel: avs: Relocate DSP status registers
ASoC: Intel: avs: MTL-based platforms support
ASoC: Intel: avs: LNL-based platforms support
ASoC: Intel: avs: PTL-based platforms support
ASoC: Intel: avs: PCM operations for LNL-based platforms
ASoC: Intel: avs: Dynamically assign ops for non-HDAudio DAIs
ASoC: Intel: avs: Conditionally add DMA config when creating Copier
ALSA: hda: Select avs-driver by default on FCL
include/linux/pci_ids.h | 1 + include/sound/hdaudio_ext.h | 6 + sound/hda/ext/hdac_ext_controller.c | 19 +++ sound/hda/intel-dsp-config.c | 4 + sound/soc/intel/avs/Makefile | 6 +- sound/soc/intel/avs/avs.h | 13 +- sound/soc/intel/avs/board_selection.c | 7 +- sound/soc/intel/avs/core.c | 109 ++++++++++++- sound/soc/intel/avs/dsp.c | 2 - sound/soc/intel/avs/lnl.c | 44 ++++++ sound/soc/intel/avs/loader.c | 11 +- sound/soc/intel/avs/messages.h | 29 ++++ sound/soc/intel/avs/mtl.c | 217 ++++++++++++++++++++++++++ sound/soc/intel/avs/path.c | 51 +++++- sound/soc/intel/avs/pcm.c | 133 ++++++++++++---- sound/soc/intel/avs/ptl.c | 98 ++++++++++++ sound/soc/intel/avs/registers.h | 40 ++++- 17 files changed, 737 insertions(+), 53 deletions(-) create mode 100644 sound/soc/intel/avs/lnl.c create mode 100644 sound/soc/intel/avs/mtl.c create mode 100644 sound/soc/intel/avs/ptl.c
Signature · 1 line
2.25.1
Cezary Rojewski
maintainerPATCH 1/12 ALSA: hda: Allow to fetch hlink by ID
Starting with LNL platform, Intel HDAudio Links carry IDs specifying non-HDAudio transfer type they help facilitate e.g.: 0xC0 for I2S as defined by AZX_REG_ML_LEPTR_ID_INTEL_SSP.
The mechanism accounts for LEPTR register as it is Reserved if LCAP.ALT for given Link equals 0.
--- include/sound/hdaudio_ext.h | 5 +++++ sound/hda/ext/hdac_ext_controller.c | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+)
include/sound/hdaudio_ext.h +5 -0
@@ -22,6 +22,7 @@ void snd_hdac_ext_bus_ppcap_enable(struct hdac_bus *chip, bool enable);void snd_hdac_ext_bus_ppcap_int_enable (struct hdac_bus *chip,bool enable);int snd_hdac_ext_bus_get_ml_capabilities (struct hdac_bus *bus); +struct hdac_ext_link *snd_hdac_ext_bus_get_hlink_by_id (struct hdac_bus *bus,u32 id);struct hdac_ext_link *snd_hdac_ext_bus_get_hlink_by_addr (struct hdac_bus *bus,int addr);struct hdac_ext_link *snd_hdac_ext_bus_get_hlink_by_name (struct hdac_bus *bus,const char *codec_name);
@@ -97,12 +98,16 @@ struct hdac_ext_link {void __iomem *ml_addr;/* link output stream reg pointer */ u32 lcaps;/* link capablities */ u16 lsdiid;/* link sdi identifier */ +u32 id;int ref_count;struct list_head list; }; +#define hdac_ext_link_alt (link) ((link)->lcaps & AZX_ML_HDA_LCAP_ALT) +#define hdac_ext_link_ofls (link) ((link)->lcaps & AZX_ML_HDA_LCAP_OFLS) +int snd_hdac_ext_bus_link_power_up (struct hdac_ext_link *hlink);int snd_hdac_ext_bus_link_power_down (struct hdac_ext_link *hlink);int snd_hdac_ext_bus_link_power_up_all (struct hdac_bus *bus);
sound/hda/ext/hdac_ext_controller.c +18 -0
@@ -9,6 +9,7 @@* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ +#include <linux/bitfield.h> #include <linux/delay.h> #include <linux/slab.h> #include <sound/hda_register.h>
@@ -81,6 +82,7 @@ int snd_hdac_ext_bus_get_ml_capabilities(struct hdac_bus *bus)int idx;u32 link_count;struct hdac_ext_link *hlink; +u32 leptr; link_count =readl (bus->mlcap +AZX_REG_ML_MLCD ) +1 ;
@@ -97,6 +99,11 @@ int snd_hdac_ext_bus_get_ml_capabilities(struct hdac_bus *bus) hlink->lcaps =readl (hlink->ml_addr +AZX_REG_ML_LCAP ); hlink->lsdiid =readw (hlink->ml_addr +AZX_REG_ML_LSDIID ); +if (hdac_ext_link_alt (hlink)) { + leptr =readl (hlink->ml_addr +AZX_REG_ML_LEPTR ); + hlink->id =FIELD_GET (AZX_REG_ML_LEPTR_ID , leptr); + } +/* since link in On, update the ref */ hlink->ref_count =1 ;
@@ -125,6 +132,17 @@ void snd_hdac_ext_link_free_all(struct hdac_bus *bus) }EXPORT_SYMBOL_GPL (snd_hdac_ext_link_free_all); +struct hdac_ext_link *snd_hdac_ext_bus_get_hlink_by_id (struct hdac_bus *bus,u32 id) +{ +struct hdac_ext_link *hlink; + +list_for_each_entry (hlink, &bus->hlink_list, list) +if (hdac_ext_link_alt (hlink) && hlink->id == id) +return hlink; +return NULL ; +} +EXPORT_SYMBOL_GPL (snd_hdac_ext_bus_get_hlink_by_id); +/** * snd_hdac_ext_bus_get_hlink_by_addr - get hlink at specified address * @bus: hlink's parent bus device
Signature · 1 line
2.25.1
Cezary Rojewski
maintainerPATCH 2/12 ASoC: Intel: avs: Ignore Vendor-space manipulation for ACE
In reply to Cezary RojewskiA number of Vendor Specific registers utilized on cAVS architecture (SkyLake till RaptorLake) are not present on ACE hardware (MeteorLake onward). Similarly, certain recommended procedures do not apply. Adjust existing code to be ACE-friendly.
--- sound/soc/intel/avs/avs.h | 1 + sound/soc/intel/avs/core.c | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-)
sound/soc/intel/avs/avs.h +1 -0
@@ -72,6 +72,7 @@ extern const struct avs_dsp_ops avs_tgl_dsp_ops;#define AVS_PLATATTR_CLDMA BIT_ULL(0)#define AVS_PLATATTR_IMR BIT_ULL(1) +#define AVS_PLATATTR_ACE BIT_ULL(2)#define avs_platattr_test (adev, attr) \ ((adev)->spec->attributes & AVS_PLATATTR_##attr)
sound/soc/intel/avs/core.c +10 -3
@@ -54,14 +54,17 @@ void avs_hda_power_gating_enable(struct avs_dev *adev, bool enable) {u32 value = enable ?0 : pgctl_mask; -avs_hda_update_config_dword (&adev->base.core,AZX_PCIREG_PGCTL , pgctl_mask, value); +if (!avs_platattr_test (adev,ACE )) +avs_hda_update_config_dword (&adev->base.core,AZX_PCIREG_PGCTL , pgctl_mask, value); }static void avs_hdac_clock_gating_enable (struct hdac_bus *bus,bool enable) { +struct avs_dev *adev =hdac_to_avs (bus);u32 value = enable ? cgctl_mask :0 ; -avs_hda_update_config_dword (bus,AZX_PCIREG_CGCTL , cgctl_mask, value); +if (!avs_platattr_test (adev,ACE )) +avs_hda_update_config_dword (bus,AZX_PCIREG_CGCTL , cgctl_mask, value); }void avs_hda_clock_gating_enable (struct avs_dev *adev,bool enable)
@@ -71,6 +74,8 @@ void avs_hda_clock_gating_enable(struct avs_dev *adev, bool enable)void avs_hda_l1sen_enable (struct avs_dev *adev,bool enable) { +if (avs_platattr_test (adev,ACE )) +return ;if (enable) {if (atomic_inc_and_test (&adev->l1sen_counter)) snd_hdac_chip_updatel(&adev->base.core, VS_EM2, AZX_VS_EM2_L1SEN,
@@ -99,6 +104,7 @@ static int avs_hdac_bus_init_streams(struct hdac_bus *bus)static bool avs_hdac_bus_init_chip (struct hdac_bus *bus,bool full_reset) { +struct avs_dev *adev =hdac_to_avs (bus);struct hdac_ext_link *hlink;bool ret;
@@ -114,7 +120,8 @@ static bool avs_hdac_bus_init_chip(struct hdac_bus *bus, bool full_reset)/* Set DUM bit to address incorrect position reporting for capture * streams. In order to do so, CTRL needs to be out of reset state */ -snd_hdac_chip_updatel (bus,VS_EM2 ,AZX_VS_EM2_DUM ,AZX_VS_EM2_DUM ); +if (!avs_platattr_test (adev,ACE )) +snd_hdac_chip_updatel (bus,VS_EM2 ,AZX_VS_EM2_DUM ,AZX_VS_EM2_DUM );return ret; }
Signature · 1 line
2.25.1
Cezary Rojewski
maintainerPATCH 3/12 ASoC: Intel: avs: Read HW capabilities when possible
In reply to Cezary RojewskiStarting with LunarLake (LNL) and onward, some hardware capabilities are visible to the sound driver directly. At the same time, these may no longer be visible to the AudioDSP firmware. Update resource allocation function to rely on the registers when possible.
--- include/sound/hdaudio_ext.h | 1 + sound/hda/ext/hdac_ext_controller.c | 1 + sound/soc/intel/avs/avs.h | 1 + sound/soc/intel/avs/loader.c | 9 +++++++++ 4 files changed, 12 insertions(+)
include/sound/hdaudio_ext.h +1 -0
@@ -99,6 +99,7 @@ struct hdac_ext_link {u32 lcaps;/* link capablities */ u16 lsdiid;/* link sdi identifier */ u32 id; +u8 slcount;int ref_count;
sound/hda/ext/hdac_ext_controller.c +1 -0
@@ -98,6 +98,7 @@ int snd_hdac_ext_bus_get_ml_capabilities(struct hdac_bus *bus) (AZX_ML_INTERVAL * idx); hlink->lcaps =readl (hlink->ml_addr +AZX_REG_ML_LCAP ); hlink->lsdiid =readw (hlink->ml_addr +AZX_REG_ML_LSDIID ); + hlink->slcount =FIELD_GET (AZX_ML_HDA_LCAP_SLCOUNT , hlink->lcaps) +1 ;if (hdac_ext_link_alt (hlink)) { leptr =readl (hlink->ml_addr +AZX_REG_ML_LEPTR );
sound/soc/intel/avs/avs.h +1 -0
@@ -73,6 +73,7 @@ extern const struct avs_dsp_ops avs_tgl_dsp_ops;#define AVS_PLATATTR_CLDMA BIT_ULL(0)#define AVS_PLATATTR_IMR BIT_ULL(1)#define AVS_PLATATTR_ACE BIT_ULL(2) +#define AVS_PLATATTR_ALTHDA BIT_ULL(3)#define avs_platattr_test (adev, attr) \ ((adev)->spec->attributes & AVS_PLATATTR_##attr)
sound/soc/intel/avs/loader.c +9 -0
@@ -683,6 +683,7 @@ int avs_dsp_boot_firmware(struct avs_dev *adev, bool purge)static int avs_dsp_alloc_resources (struct avs_dev *adev) { +struct hdac_ext_link *link;int ret, i; ret =avs_ipc_get_hw_config (adev, &adev->hw_cfg);
@@ -693,6 +694,14 @@ static int avs_dsp_alloc_resources(struct avs_dev *adev)if (ret)return AVS_IPC_RET (ret); +/* If hw allows, read capabilities directly from it. */ +if (avs_platattr_test (adev,ALTHDA )) { + link =snd_hdac_ext_bus_get_hlink_by_id (&adev->base.core, +AZX_REG_ML_LEPTR_ID_INTEL_SSP ); +if (link) + adev->hw_cfg.i2s_caps.ctrl_count = link->slcount; + } + adev->core_refs =devm_kcalloc (adev->dev, adev->hw_cfg.dsp_cores,sizeof (*adev->core_refs),GFP_KERNEL ); adev->lib_names = devm_kcalloc(adev->dev, adev->fw_cfg.max_libs_count,
Signature · 1 line
2.25.1
Cezary Rojewski
maintainerPATCH 4/12 ASoC: Intel: avs: Relocate DSP status registers
In reply to Cezary RojewskiThe firmware status and error registers are not part of SRAM on ACE platforms. As these registers take part in IPC on ACE and cAVS platforms both, relocate the field denoting their offset to Host-IPC descriptor.
In consequence, code remains cohesive with the ACE specs while still maintaining high readability for the cAVS platforms.
--- sound/soc/intel/avs/avs.h | 2 +- sound/soc/intel/avs/core.c | 18 +++++++++++++++--- sound/soc/intel/avs/loader.c | 2 +- sound/soc/intel/avs/registers.h | 2 +- 4 files changed, 18 insertions(+), 6 deletions(-)
sound/soc/intel/avs/avs.h +1 -1
@@ -81,7 +81,6 @@ extern const struct avs_dsp_ops avs_tgl_dsp_ops;struct avs_sram_spec {const u32 base_offset;const u32 window_size; -const u32 rom_status_offset; };struct avs_hipc_spec {
@@ -93,6 +92,7 @@ struct avs_hipc_spec {const u32 rsp_offset;const u32 rsp_busy_mask;const u32 ctl_offset; +const u32 sts_offset; };/* Platform specific descriptor */
sound/soc/intel/avs/core.c +15 -3
@@ -755,13 +755,11 @@ static const struct dev_pm_ops avs_dev_pm = {static const struct avs_sram_spec skl_sram_spec = { .base_offset =SKL_ADSP_SRAM_BASE_OFFSET , .window_size =SKL_ADSP_SRAM_WINDOW_SIZE , - .rom_status_offset =SKL_ADSP_SRAM_BASE_OFFSET , };static const struct avs_sram_spec apl_sram_spec = { .base_offset =APL_ADSP_SRAM_BASE_OFFSET , .window_size =APL_ADSP_SRAM_WINDOW_SIZE , - .rom_status_offset =APL_ADSP_SRAM_BASE_OFFSET , };static const struct avs_hipc_spec skl_hipc_spec = {
@@ -773,6 +771,19 @@ static const struct avs_hipc_spec skl_hipc_spec = { .rsp_offset = SKL_ADSP_REG_HIPCT, .rsp_busy_mask = SKL_ADSP_HIPCT_BUSY, .ctl_offset = SKL_ADSP_REG_HIPCCTL, + .sts_offset = SKL_ADSP_SRAM_BASE_OFFSET, +}; + +static const struct avs_hipc_spec apl_hipc_spec = { + .req_offset =SKL_ADSP_REG_HIPCI , + .req_ext_offset =SKL_ADSP_REG_HIPCIE , + .req_busy_mask =SKL_ADSP_HIPCI_BUSY , + .ack_offset =SKL_ADSP_REG_HIPCIE , + .ack_done_mask =SKL_ADSP_HIPCIE_DONE , + .rsp_offset =SKL_ADSP_REG_HIPCT , + .rsp_busy_mask =SKL_ADSP_HIPCT_BUSY , + .ctl_offset =SKL_ADSP_REG_HIPCCTL , + .sts_offset =APL_ADSP_SRAM_BASE_OFFSET , };static const struct avs_hipc_spec cnl_hipc_spec = {
@@ -784,6 +795,7 @@ static const struct avs_hipc_spec cnl_hipc_spec = { .rsp_offset = CNL_ADSP_REG_HIPCTDR, .rsp_busy_mask = CNL_ADSP_HIPCTDR_BUSY, .ctl_offset = CNL_ADSP_REG_HIPCCTL, + .sts_offset = APL_ADSP_SRAM_BASE_OFFSET, };static const struct avs_spec skl_desc = {
@@ -803,7 +815,7 @@ static const struct avs_spec apl_desc = { .core_init_mask = 3, .attributes = AVS_PLATATTR_IMR, .sram = &apl_sram_spec, - .hipc = &skl_hipc_spec, + .hipc = &apl_hipc_spec, };static const struct avs_spec cnl_desc = {
sound/soc/intel/avs/loader.c +1 -1
@@ -310,7 +310,7 @@ avs_hda_init_rom(struct avs_dev *adev, unsigned int dma_id, bool purge) }/* await ROM init */ - ret =snd_hdac_adsp_readl_poll (adev, spec->sram->rom_status_offset, reg, + ret =snd_hdac_adsp_readl_poll (adev, spec->hipc->sts_offset, reg, (reg &0xF ) ==AVS_ROM_INIT_DONE || (reg &0xF ) ==APL_ROM_FW_ENTERED ,AVS_ROM_INIT_POLLING_US ,APL_ROM_INIT_TIMEOUT_US );
sound/soc/intel/avs/registers.h +1 -1
@@ -74,7 +74,7 @@#define APL_ADSP_SRAM_WINDOW_SIZE 0x20000/* Constants used when accessing SRAM, space shared with firmware */ -#define AVS_FW_REG_BASE (adev) ((adev)->spec->sram->base_offset) +#define AVS_FW_REG_BASE (adev) ((adev)->spec->hipc->sts_offset)#define AVS_FW_REG_STATUS (adev) (AVS_FW_REG_BASE(adev) + 0x0)#define AVS_FW_REG_ERROR (adev) (AVS_FW_REG_BASE(adev) + 0x4)
Signature · 1 line
2.25.1
Cezary Rojewski
maintainerPATCH 5/12 ASoC: Intel: avs: MTL-based platforms support
In reply to Cezary RojewskiDefine handlers specific to ACE 1.x platforms, that is MTL, ARL and all variants based on this very version of AudioDSP architecture. Most operations are inherited from their predecessors with the major difference being AudioDSP cores management - replaced by DSP-domain power management.
Software has to ensure the DSP domain is both powered on and its power-gating disabled before it can be utilized for streaming.
--- sound/soc/intel/avs/Makefile | 6 +- sound/soc/intel/avs/avs.h | 6 + sound/soc/intel/avs/core.c | 30 +++++ sound/soc/intel/avs/dsp.c | 2 - sound/soc/intel/avs/mtl.c | 217 ++++++++++++++++++++++++++++++++ sound/soc/intel/avs/registers.h | 33 +++++ 6 files changed, 289 insertions(+), 5 deletions(-) create mode 100644 sound/soc/intel/avs/mtl.c
sound/soc/intel/avs/Makefile +3 -3
@@ -1,10 +1,10 @@ # SPDX-License-Identifier: GPL-2.0-only snd-soc-avs-y := dsp.o ipc.o messages.o utils.o core.o loader.o \ - topology.o path.o pcm.o board_selection.o control.o \ - sysfs.o + topology.o path.o pcm.o board_selection.o control.o \ + sysfs.o snd-soc-avs-y += cldma.o -snd-soc-avs-y += skl.o apl.o cnl.o icl.o tgl.o +snd-soc-avs-y += skl.o apl.o cnl.o icl.o tgl.o mtl.o snd-soc-avs-y += trace.o # tell define_trace.h where to find the trace header
sound/soc/intel/avs/avs.h +6 -0
@@ -69,6 +69,7 @@ extern const struct avs_dsp_ops avs_apl_dsp_ops;extern const struct avs_dsp_ops avs_cnl_dsp_ops;extern const struct avs_dsp_ops avs_icl_dsp_ops;extern const struct avs_dsp_ops avs_tgl_dsp_ops; +extern const struct avs_dsp_ops avs_mtl_dsp_ops;#define AVS_PLATATTR_CLDMA BIT_ULL(0)#define AVS_PLATATTR_IMR BIT_ULL(1)
@@ -267,8 +268,13 @@ void avs_ipc_block(struct avs_ipc *ipc);int avs_dsp_disable_d0ix (struct avs_dev *adev);int avs_dsp_enable_d0ix (struct avs_dev *adev); +int avs_mtl_core_power (struct avs_dev *adev,u32 core_mask,bool power); +int avs_mtl_core_reset (struct avs_dev *adev,u32 core_mask,bool power); +int avs_mtl_core_stall (struct avs_dev *adev,u32 core_mask,bool stall); +void avs_mtl_interrupt_control (struct avs_dev *adev,bool enable);void avs_skl_ipc_interrupt (struct avs_dev *adev);irqreturn_t avs_cnl_dsp_interrupt (struct avs_dev *adev); +irqreturn_t avs_mtl_dsp_interrupt (struct avs_dev *adev);int avs_apl_enable_logs (struct avs_dev *adev,enum avs_log_enable enable,u32 aging_period,u32 fifo_full_period,unsigned long resource_mask,u32 *priorities); int avs_icl_enable_logs(struct avs_dev *adev, enum avs_log_enable enable, u32 aging_period,
sound/soc/intel/avs/core.c +30 -0
@@ -762,6 +762,11 @@ static const struct avs_sram_spec apl_sram_spec = { .window_size = APL_ADSP_SRAM_WINDOW_SIZE, }; +static const struct avs_sram_spec mtl_sram_spec = { + .base_offset =MTL_ADSP_SRAM_BASE_OFFSET , + .window_size =MTL_ADSP_SRAM_WINDOW_SIZE , +}; +static const struct avs_hipc_spec skl_hipc_spec = { .req_offset =SKL_ADSP_REG_HIPCI , .req_ext_offset =SKL_ADSP_REG_HIPCIE ,
@@ -798,6 +803,18 @@ static const struct avs_hipc_spec cnl_hipc_spec = { .sts_offset = APL_ADSP_SRAM_BASE_OFFSET, }; +static const struct avs_hipc_spec mtl_hipc_spec = { + .req_offset = MTL_REG_HfIPCxIDR, + .req_ext_offset = MTL_REG_HfIPCxIDD, + .req_busy_mask = MTL_HfIPCxIDR_BUSY, + .ack_offset = MTL_REG_HfIPCxIDA, + .ack_done_mask = MTL_HfIPCxIDA_DONE, + .rsp_offset = MTL_REG_HfIPCxTDR, + .rsp_busy_mask = MTL_HfIPCxTDR_BUSY, + .ctl_offset = MTL_REG_HfIPCxCTL, + .sts_offset =MTL_REG_HfFLGP (0 ,0 ), +}; +static const struct avs_spec skl_desc = { .name ="skl" , .min_fw_version = {9 ,21 ,0 ,4732 },
@@ -865,6 +882,16 @@ AVS_TGL_BASED_SPEC(ehl, 30);AVS_TGL_BASED_SPEC (adl,35 );AVS_TGL_BASED_SPEC (adl_n,35 ); +static const struct avs_spec mtl_desc = { + .name ="mtl" , + .min_fw_version = {0 }, + .dsp_ops = &avs_mtl_dsp_ops, + .core_init_mask =1 , + .attributes =AVS_PLATATTR_IMR |AVS_PLATATTR_ACE , + .sram = &mtl_sram_spec, + .hipc = &mtl_hipc_spec, +}; +static const struct pci_device_id avs_ids[] = { {PCI_DEVICE_DATA (INTEL ,HDA_SKL_LP , &skl_desc) }, {PCI_DEVICE_DATA (INTEL ,HDA_SKL , &skl_desc) },
@@ -900,6 +927,8 @@ static const struct pci_device_id avs_ids[] = { { PCI_DEVICE_DATA(INTEL, HDA_RPL_P_1, &adl_desc) }, { PCI_DEVICE_DATA(INTEL, HDA_RPL_M, &adl_desc) }, { PCI_DEVICE_DATA(INTEL, HDA_RPL_PX, &adl_desc) }, + { PCI_DEVICE_DATA(INTEL, HDA_MTL, &mtl_desc) }, + { PCI_DEVICE_DATA(INTEL, HDA_ARL_S, &mtl_desc) }, { 0 } };MODULE_DEVICE_TABLE (pci, avs_ids);
@@ -931,3 +960,4 @@ MODULE_FIRMWARE("intel/tgl/dsp_basefw.bin");MODULE_FIRMWARE ("intel/ehl/dsp_basefw.bin" );MODULE_FIRMWARE ("intel/adl/dsp_basefw.bin" );MODULE_FIRMWARE ("intel/adl_n/dsp_basefw.bin" ); +MODULE_FIRMWARE ("intel/mtl/dsp_basefw.bin" );
sound/soc/intel/avs/dsp.c +0 -2
@@ -12,8 +12,6 @@#include "registers.h" #include "trace.h" -#define AVS_ADSPCS_INTERVAL_US 500 -#define AVS_ADSPCS_TIMEOUT_US 50000#define AVS_ADSPCS_DELAY_US 1000int avs_dsp_core_power (struct avs_dev *adev,u32 core_mask,bool power)
sound/soc/intel/avs/mtl.c new file +217 -0
217 lines not on this page · raw message
sound/soc/intel/avs/registers.h +33 -0
@@ -35,6 +35,8 @@#define AVS_ADSPCS_CSTALL_MASK (cm) ((cm) << 8)#define AVS_ADSPCS_SPA_MASK (cm) ((cm) << 16)#define AVS_ADSPCS_CPA_MASK (cm) ((cm) << 24) +#define AVS_ADSPCS_INTERVAL_US 500 +#define AVS_ADSPCS_TIMEOUT_US 10000#define AVS_MAIN_CORE_MASK BIT(0)#define AVS_ADSP_HIPCCTL_BUSY BIT(0)
@@ -67,11 +69,42 @@#define CNL_ADSP_HIPCIDR_BUSY BIT(31)#define CNL_ADSP_HIPCIDA_DONE BIT(31) +/* MTL Intel HOST Inter-Processor Communication Registers */ +#define MTL_HfIPC_BASE 0x73000 +#define MTL_REG_HfIPCxTDR (MTL_HfIPC_BASE + 0x200) +#define MTL_REG_HfIPCxTDA (MTL_HfIPC_BASE + 0x204) +#define MTL_REG_HfIPCxIDR (MTL_HfIPC_BASE + 0x210) +#define MTL_REG_HfIPCxIDA (MTL_HfIPC_BASE + 0x214) +#define MTL_REG_HfIPCxCTL (MTL_HfIPC_BASE + 0x228) +#define MTL_REG_HfIPCxTDD (MTL_HfIPC_BASE + 0x300) +#define MTL_REG_HfIPCxIDD (MTL_HfIPC_BASE + 0x380) + +#define MTL_HfIPCxTDR_BUSY BIT(31) +#define MTL_HfIPCxTDA_BUSY BIT(31) +#define MTL_HfIPCxIDR_BUSY BIT(31) +#define MTL_HfIPCxIDA_DONE BIT(31) + +#define MTL_HfFLV_BASE 0x162000 +#define MTL_REG_HfFLGP (x, y) (MTL_HfFLV_BASE + 0x1200 + (x) * 0x20 + (y) * 0x08) + +#define MTL_DWICTL_BASE 0x1800 +#define MTL_DWICTL_REG_INTENL (MTL_DWICTL_BASE + 0x0) +#define MTL_DWICTL_REG_FINALSTATUSL (MTL_DWICTL_BASE + 0x30) + +#define MTL_HfPMCCU_BASE 0x1D00 +#define MTL_REG_HfCLKCTL (MTL_HfPMCCU_BASE + 0x10) +#define MTL_REG_HfPWRCTL (MTL_HfPMCCU_BASE + 0x18) +#define MTL_REG_HfPWRSTS (MTL_HfPMCCU_BASE + 0x1C) +#define MTL_HfPWRCTL_WPDSPHPxPG BIT(0) +#define MTL_HfPWRSTS_DSPHPxPGS BIT(0) +/* Intel HD Audio SRAM windows base addresses */ #define SKL_ADSP_SRAM_BASE_OFFSET 0x8000#define SKL_ADSP_SRAM_WINDOW_SIZE 0x2000#define APL_ADSP_SRAM_BASE_OFFSET 0x80000#define APL_ADSP_SRAM_WINDOW_SIZE 0x20000 +#define MTL_ADSP_SRAM_BASE_OFFSET 0x180000 +#define MTL_ADSP_SRAM_WINDOW_SIZE 0x8000/* Constants used when accessing SRAM, space shared with firmware */ #define AVS_FW_REG_BASE (adev) ((adev)->spec->hipc->sts_offset)
Signature · 1 line
2.25.1
Cezary Rojewski
maintainerPATCH 6/12 ASoC: Intel: avs: LNL-based platforms support
In reply to Cezary RojewskiDefine handlers specific to ACE 2.x platforms, that is MTL, ARL and all variants based on this very version of AudioDSP architecture. Expect for minor changes to core handling flow, all operations are inherited from their predecessors.
--- sound/soc/intel/avs/Makefile | 2 +- sound/soc/intel/avs/avs.h | 1 + sound/soc/intel/avs/core.c | 24 ++++++++++++++++++ sound/soc/intel/avs/lnl.c | 44 +++++++++++++++++++++++++++++++++ sound/soc/intel/avs/registers.h | 1 + 5 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 sound/soc/intel/avs/lnl.c
sound/soc/intel/avs/Makefile +1 -1
@@ -4,7 +4,7 @@ snd-soc-avs-y := dsp.o ipc.o messages.o utils.o core.o loader.o \ topology.o path.o pcm.o board_selection.o control.o \ sysfs.o snd-soc-avs-y += cldma.o -snd-soc-avs-y += skl.o apl.o cnl.o icl.o tgl.o mtl.o +snd-soc-avs-y += skl.o apl.o cnl.o icl.o tgl.o mtl.o lnl.o snd-soc-avs-y += trace.o # tell define_trace.h where to find the trace header
sound/soc/intel/avs/avs.h +1 -0
@@ -70,6 +70,7 @@ extern const struct avs_dsp_ops avs_cnl_dsp_ops;extern const struct avs_dsp_ops avs_icl_dsp_ops;extern const struct avs_dsp_ops avs_tgl_dsp_ops;extern const struct avs_dsp_ops avs_mtl_dsp_ops; +extern const struct avs_dsp_ops avs_lnl_dsp_ops;#define AVS_PLATATTR_CLDMA BIT_ULL(0)#define AVS_PLATATTR_IMR BIT_ULL(1)
sound/soc/intel/avs/core.c +24 -0
@@ -815,6 +815,18 @@ static const struct avs_hipc_spec mtl_hipc_spec = { .sts_offset = MTL_REG_HfFLGP(0, 0), }; +static const struct avs_hipc_spec lnl_hipc_spec = { + .req_offset = MTL_REG_HfIPCxIDR, + .req_ext_offset = MTL_REG_HfIPCxIDD, + .req_busy_mask = MTL_HfIPCxIDR_BUSY, + .ack_offset = MTL_REG_HfIPCxIDA, + .ack_done_mask = MTL_HfIPCxIDA_DONE, + .rsp_offset = MTL_REG_HfIPCxTDR, + .rsp_busy_mask = MTL_HfIPCxTDR_BUSY, + .ctl_offset = MTL_REG_HfIPCxCTL, + .sts_offset =LNL_REG_HfDFR (0 ), +}; +static const struct avs_spec skl_desc = { .name ="skl" , .min_fw_version = {9 ,21 ,0 ,4732 },
@@ -892,6 +904,16 @@ static const struct avs_spec mtl_desc = { .hipc = &mtl_hipc_spec, }; +static const struct avs_spec lnl_desc = { + .name ="lnl" , + .min_fw_version = {0 }, + .dsp_ops = &avs_lnl_dsp_ops, + .core_init_mask =1 , + .attributes =AVS_PLATATTR_IMR |AVS_PLATATTR_ACE |AVS_PLATATTR_ALTHDA , + .sram = &mtl_sram_spec, + .hipc = &lnl_hipc_spec, +}; +static const struct pci_device_id avs_ids[] = { {PCI_DEVICE_DATA (INTEL ,HDA_SKL_LP , &skl_desc) }, {PCI_DEVICE_DATA (INTEL ,HDA_SKL , &skl_desc) },
@@ -929,6 +951,7 @@ static const struct pci_device_id avs_ids[] = { { PCI_DEVICE_DATA(INTEL, HDA_RPL_PX, &adl_desc) }, { PCI_DEVICE_DATA(INTEL, HDA_MTL, &mtl_desc) }, { PCI_DEVICE_DATA(INTEL, HDA_ARL_S, &mtl_desc) }, + { PCI_DEVICE_DATA(INTEL, HDA_LNL_P, &lnl_desc) }, { 0 } };MODULE_DEVICE_TABLE (pci, avs_ids);
@@ -961,3 +984,4 @@ MODULE_FIRMWARE("intel/ehl/dsp_basefw.bin");MODULE_FIRMWARE ("intel/adl/dsp_basefw.bin" );MODULE_FIRMWARE ("intel/adl_n/dsp_basefw.bin" );MODULE_FIRMWARE ("intel/mtl/dsp_basefw.bin" ); +MODULE_FIRMWARE ("intel/lnl/dsp_basefw.bin" );
sound/soc/intel/avs/lnl.c new file +44 -0
44 lines not on this page · raw message
sound/soc/intel/avs/registers.h +1 -0
@@ -86,6 +86,7 @@#define MTL_HfFLV_BASE 0x162000#define MTL_REG_HfFLGP (x, y) (MTL_HfFLV_BASE + 0x1200 + (x) * 0x20 + (y) * 0x08) +#define LNL_REG_HfDFR (x) (0x160200 + (x) * 0x8)#define MTL_DWICTL_BASE 0x1800#define MTL_DWICTL_REG_INTENL (MTL_DWICTL_BASE + 0x0)
Signature · 1 line
2.25.1
Cezary Rojewski
maintainerPATCH 7/12 ASoC: Intel: avs: PTL-based platforms support
In reply to Cezary RojewskiWith exception of the power() operation, all DSP operations are inherited from the platform predecessors.
--- include/linux/pci_ids.h | 1 + sound/soc/intel/avs/Makefile | 2 +- sound/soc/intel/avs/avs.h | 2 + sound/soc/intel/avs/core.c | 24 ++++++++ sound/soc/intel/avs/lnl.c | 2 +- sound/soc/intel/avs/ptl.c | 98 +++++++++++++++++++++++++++++++++ sound/soc/intel/avs/registers.h | 4 ++ 7 files changed, 131 insertions(+), 2 deletions(-) create mode 100644 sound/soc/intel/avs/ptl.c
include/linux/pci_ids.h +1 -0
@@ -3066,6 +3066,7 @@#define PCI_DEVICE_ID_INTEL_5100_21 0x65f5#define PCI_DEVICE_ID_INTEL_5100_22 0x65f6#define PCI_DEVICE_ID_INTEL_IOAT_SCNB 0x65ff +#define PCI_DEVICE_ID_INTEL_HDA_FCL 0x67a8#define PCI_DEVICE_ID_INTEL_82371SB_0 0x7000#define PCI_DEVICE_ID_INTEL_82371SB_1 0x7010#define PCI_DEVICE_ID_INTEL_82371SB_2 0x7020
sound/soc/intel/avs/Makefile +1 -1
@@ -4,7 +4,7 @@ snd-soc-avs-y := dsp.o ipc.o messages.o utils.o core.o loader.o \ topology.o path.o pcm.o board_selection.o control.o \ sysfs.o snd-soc-avs-y += cldma.o -snd-soc-avs-y += skl.o apl.o cnl.o icl.o tgl.o mtl.o lnl.o +snd-soc-avs-y += skl.o apl.o cnl.o icl.o tgl.o mtl.o lnl.o ptl.o snd-soc-avs-y += trace.o # tell define_trace.h where to find the trace header
sound/soc/intel/avs/avs.h +2 -0
@@ -71,6 +71,7 @@ extern const struct avs_dsp_ops avs_icl_dsp_ops;extern const struct avs_dsp_ops avs_tgl_dsp_ops;extern const struct avs_dsp_ops avs_mtl_dsp_ops;extern const struct avs_dsp_ops avs_lnl_dsp_ops; +extern const struct avs_dsp_ops avs_ptl_dsp_ops;#define AVS_PLATATTR_CLDMA BIT_ULL(0)#define AVS_PLATATTR_IMR BIT_ULL(1)
@@ -272,6 +273,7 @@ int avs_dsp_enable_d0ix(struct avs_dev *adev);int avs_mtl_core_power (struct avs_dev *adev,u32 core_mask,bool power);int avs_mtl_core_reset (struct avs_dev *adev,u32 core_mask,bool power);int avs_mtl_core_stall (struct avs_dev *adev,u32 core_mask,bool stall); +int avs_lnl_core_stall (struct avs_dev *adev,u32 core_mask,bool stall);void avs_mtl_interrupt_control (struct avs_dev *adev,bool enable);void avs_skl_ipc_interrupt (struct avs_dev *adev);irqreturn_t avs_cnl_dsp_interrupt (struct avs_dev *adev);
sound/soc/intel/avs/core.c +24 -0
@@ -914,6 +914,26 @@ static const struct avs_spec lnl_desc = { .hipc = &lnl_hipc_spec, }; +static const struct avs_spec ptl_desc = { + .name ="ptl" , + .min_fw_version = {0 }, + .dsp_ops = &avs_ptl_dsp_ops, + .core_init_mask =1 , + .attributes =AVS_PLATATTR_IMR |AVS_PLATATTR_ACE |AVS_PLATATTR_ALTHDA , + .sram = &mtl_sram_spec, + .hipc = &lnl_hipc_spec, +}; + +static const struct avs_spec fcl_desc = { + .name ="fcl" , + .min_fw_version = {0 }, + .dsp_ops = &avs_ptl_dsp_ops, + .core_init_mask =1 , + .attributes =AVS_PLATATTR_IMR |AVS_PLATATTR_ACE |AVS_PLATATTR_ALTHDA , + .sram = &mtl_sram_spec, + .hipc = &lnl_hipc_spec, +}; +static const struct pci_device_id avs_ids[] = { {PCI_DEVICE_DATA (INTEL ,HDA_SKL_LP , &skl_desc) }, {PCI_DEVICE_DATA (INTEL ,HDA_SKL , &skl_desc) },
@@ -952,6 +972,9 @@ static const struct pci_device_id avs_ids[] = { { PCI_DEVICE_DATA(INTEL, HDA_MTL, &mtl_desc) }, { PCI_DEVICE_DATA(INTEL, HDA_ARL_S, &mtl_desc) }, { PCI_DEVICE_DATA(INTEL, HDA_LNL_P, &lnl_desc) }, + { PCI_DEVICE_DATA(INTEL, HDA_PTL, &ptl_desc) }, + { PCI_DEVICE_DATA(INTEL, HDA_PTL_H, &ptl_desc) }, + { PCI_DEVICE_DATA(INTEL, HDA_FCL, &fcl_desc) }, { 0 } };MODULE_DEVICE_TABLE (pci, avs_ids);
@@ -985,3 +1008,4 @@ MODULE_FIRMWARE("intel/adl/dsp_basefw.bin");MODULE_FIRMWARE ("intel/adl_n/dsp_basefw.bin" );MODULE_FIRMWARE ("intel/mtl/dsp_basefw.bin" );MODULE_FIRMWARE ("intel/lnl/dsp_basefw.bin" ); +MODULE_FIRMWARE ("intel/ptl/dsp_basefw.bin" );
sound/soc/intel/avs/lnl.c +1 -1
@@ -10,7 +10,7 @@#include "avs.h" #include "registers.h" -static int avs_lnl_core_stall (struct avs_dev *adev,u32 core_mask,bool stall) +int avs_lnl_core_stall (struct avs_dev *adev,u32 core_mask,bool stall) {struct hdac_bus *bus = &adev->base.core;struct hdac_ext_link *hlink;
sound/soc/intel/avs/ptl.c new file +98 -0
98 lines not on this page · raw message
sound/soc/intel/avs/registers.h +4 -0
@@ -96,8 +96,12 @@#define MTL_REG_HfCLKCTL (MTL_HfPMCCU_BASE + 0x10)#define MTL_REG_HfPWRCTL (MTL_HfPMCCU_BASE + 0x18)#define MTL_REG_HfPWRSTS (MTL_HfPMCCU_BASE + 0x1C) +#define MTL_REG_HfPWRCTL2 (MTL_HfPMCCU_BASE + 0x20) +#define MTL_REG_HfPWRSTS2 (MTL_HfPMCCU_BASE + 0x24)#define MTL_HfPWRCTL_WPDSPHPxPG BIT(0)#define MTL_HfPWRSTS_DSPHPxPGS BIT(0) +#define MTL_HfPWRCTL2_WPDSPHPxPG BIT(0) +#define MTL_HfPWRSTS2_DSPHPxPGS BIT(0)/* Intel HD Audio SRAM windows base addresses */ #define SKL_ADSP_SRAM_BASE_OFFSET 0x8000
Signature · 1 line
2.25.1
Cezary Rojewski
maintainerPATCH 8/12 ASoC: Intel: avs: PCM operations for LNL-based platforms
In reply to Cezary RojewskiStarting from LNL platform the so-called non-HDAudio transfer types, e.g.: I2S/DMIC, utilize HDAudio LINK DMA rather than GPDMA for the data streaming. In essence, all transfer types now utilize HDAudio Link. Most of the existing code can be reused with the major difference being HDAudio Link query method:
- fetch the Link by codec.addr in standard HDAudio transfer case
- fetch the Link by LEPTR.ID in non-HDAudio transfer case
To make the unification happen, store pointer to the Link in dma_data and utilize it in the common code. And to avoid confusion in transfer-type naming between cAVS-ACE 1.x (SkyLake till MeteorLake) and ACE 2.0+ architecture (LunarLake onward), use:
- 'hda' for typical HDAudio transfer case
- 'nonhda' for non-HDAudio transfer case, cAVS-ACE 1.x
- 'althda' for non-HDAudio transfer case, ACE 2.0+
--- sound/soc/intel/avs/pcm.c | 116 ++++++++++++++++++++++++++++---------- 1 file changed, 85 insertions(+), 31 deletions(-)
sound/soc/intel/avs/pcm.c +85 -31
@@ -32,6 +32,7 @@ struct avs_dma_data { };struct work_struct period_elapsed_work; +struct hdac_ext_link *link;struct snd_pcm_substream *substream; };
@@ -278,32 +279,75 @@ static const struct snd_soc_dai_ops avs_dai_nonhda_be_ops = { .trigger = avs_dai_nonhda_be_trigger, }; -static int avs_dai_hda_be_startup (struct snd_pcm_substream *substream,struct snd_soc_dai *dai) +static int __avs_dai_hda_be_startup (struct snd_pcm_substream *substream,struct snd_soc_dai *dai, +struct hdac_ext_link *link) { -struct snd_soc_pcm_runtime *rtd =snd_soc_substream_to_rtd (substream);struct hdac_ext_stream *link_stream;struct avs_dma_data *data; -struct hda_codec *codec;int ret; ret =avs_dai_startup (substream, dai);if (ret)return ret; - codec =dev_to_hda_codec (snd_soc_rtd_to_codec (rtd,0 )->dev); - link_stream =snd_hdac_ext_stream_assign (&codec->bus->core, substream, + data =snd_soc_dai_get_dma_data (dai, substream); + link_stream =snd_hdac_ext_stream_assign (&data->adev->base.core, substream,HDAC_EXT_STREAM_TYPE_LINK );if (!link_stream) {avs_dai_shutdown (substream, dai);return -EBUSY ; } - data =snd_soc_dai_get_dma_data (dai, substream); data->link_stream = link_stream; - substream->runtime->private_data = link_stream; + data->link = link;return 0 ; } +static int avs_dai_hda_be_startup (struct snd_pcm_substream *substream,struct snd_soc_dai *dai) +{ +struct snd_soc_pcm_runtime *rtd =snd_soc_substream_to_rtd (substream); +struct hdac_ext_link *link; +struct avs_dma_data *data; +struct hda_codec *codec; +int ret; + + codec =dev_to_hda_codec (snd_soc_rtd_to_codec (rtd,0 )->dev); + + link =snd_hdac_ext_bus_get_hlink_by_addr (&codec->bus->core, codec->core.addr); +if (!link) +return -EINVAL ; + + ret =__avs_dai_hda_be_startup (substream, dai, link); +if (!ret) { + data =snd_soc_dai_get_dma_data (dai, substream); + substream->runtime->private_data = data->link_stream; + } + +return ret; +} + +static int avs_dai_i2shda_be_startup (struct snd_pcm_substream *substream,struct snd_soc_dai *dai) +{ +struct avs_dev *adev =to_avs_dev (dai->component->dev); +struct hdac_ext_link *link; + + link =snd_hdac_ext_bus_get_hlink_by_id (&adev->base.core,AZX_REG_ML_LEPTR_ID_INTEL_SSP ); +if (!link) +return -EINVAL ; +return __avs_dai_hda_be_startup (substream, dai, link); +} + +static int avs_dai_dmichda_be_startup (struct snd_pcm_substream *substream,struct snd_soc_dai *dai) +{ +struct avs_dev *adev =to_avs_dev (dai->component->dev); +struct hdac_ext_link *link; + + link =snd_hdac_ext_bus_get_hlink_by_id (&adev->base.core,AZX_REG_ML_LEPTR_ID_INTEL_DMIC ); +if (!link) +return -EINVAL ; +return __avs_dai_hda_be_startup (substream, dai, link); +} +static void avs_dai_hda_be_shutdown (struct snd_pcm_substream *substream,struct snd_soc_dai *dai) {struct avs_dma_data *data =snd_soc_dai_get_dma_data (dai, substream);
@@ -313,6 +357,14 @@ static void avs_dai_hda_be_shutdown(struct snd_pcm_substream *substream, structavs_dai_shutdown (substream, dai); } +static void avs_dai_althda_be_shutdown (struct snd_pcm_substream *substream,struct snd_soc_dai *dai) +{ +struct avs_dma_data *data =snd_soc_dai_get_dma_data (dai, substream); + +snd_hdac_ext_stream_release (data->link_stream,HDAC_EXT_STREAM_TYPE_LINK ); +avs_dai_shutdown (substream, dai); +} +static int avs_dai_hda_be_hw_params (struct snd_pcm_substream *substream,struct snd_pcm_hw_params *hw_params,struct snd_soc_dai *dai) {
@@ -328,13 +380,8 @@ static int avs_dai_hda_be_hw_params(struct snd_pcm_substream *substream,static int avs_dai_hda_be_hw_free (struct snd_pcm_substream *substream,struct snd_soc_dai *dai) { -struct avs_dma_data *data; -struct snd_soc_pcm_runtime *rtd =snd_soc_substream_to_rtd (substream);struct hdac_ext_stream *link_stream; -struct hdac_ext_link *link; -struct hda_codec *codec; - -dev_dbg (dai->dev,"%s: %s\n" , __func__, dai->name); +struct avs_dma_data *data; data =snd_soc_dai_get_dma_data (dai, substream);if (!data->path)
@@ -346,27 +393,19 @@ static int avs_dai_hda_be_hw_free(struct snd_pcm_substream *substream, struct sn data->path =NULL ;/* clear link <-> stream mapping */ - codec =dev_to_hda_codec (snd_soc_rtd_to_codec (rtd,0 )->dev); - link =snd_hdac_ext_bus_get_hlink_by_addr (&codec->bus->core, codec->core.addr); -if (!link) -return -EINVAL ; -if (substream->stream ==SNDRV_PCM_STREAM_PLAYBACK ) -snd_hdac_ext_bus_link_clear_stream_id (link,hdac_stream (link_stream)->stream_tag); +snd_hdac_ext_bus_link_clear_stream_id (data->link, +hdac_stream (link_stream)->stream_tag);return 0 ; }static int avs_dai_hda_be_prepare (struct snd_pcm_substream *substream,struct snd_soc_dai *dai) { -struct snd_soc_pcm_runtime *rtd =snd_soc_substream_to_rtd (substream);struct snd_pcm_runtime *runtime = substream->runtime;const struct snd_soc_pcm_stream *stream_info;struct hdac_ext_stream *link_stream; -struct hdac_ext_link *link;struct avs_dma_data *data; -struct hda_codec *codec; -struct hdac_bus *bus;unsigned int format_val;unsigned int bits;int ret;
@@ -377,23 +416,18 @@ static int avs_dai_hda_be_prepare(struct snd_pcm_substream *substream, struct snif (link_stream->link_prepared)return 0 ; - codec =dev_to_hda_codec (snd_soc_rtd_to_codec (rtd,0 )->dev); - bus = &codec->bus->core; stream_info =snd_soc_dai_get_pcm_stream (dai, substream->stream); bits =snd_hdac_stream_format_bits (runtime->format, runtime->subformat, stream_info->sig_bits); format_val =snd_hdac_stream_format (runtime->channels, bits, runtime->rate); -snd_hdac_ext_stream_decouple (bus, link_stream, true); +snd_hdac_ext_stream_decouple (&data->adev->base.core, link_stream, true);snd_hdac_ext_stream_reset (link_stream);snd_hdac_ext_stream_setup (link_stream, format_val); - link =snd_hdac_ext_bus_get_hlink_by_addr (bus, codec->core.addr); -if (!link) -return -EINVAL ; -if (substream->stream ==SNDRV_PCM_STREAM_PLAYBACK ) -snd_hdac_ext_bus_link_set_stream_id (link,hdac_stream (link_stream)->stream_tag); +snd_hdac_ext_bus_link_set_stream_id (data->link, +hdac_stream (link_stream)->stream_tag); ret =avs_dai_prepare (substream, dai);if (ret)
@@ -468,6 +502,26 @@ static const struct snd_soc_dai_ops avs_dai_hda_be_ops = { .trigger = avs_dai_hda_be_trigger, }; +__maybe_unused +static const struct snd_soc_dai_ops avs_dai_i2shda_be_ops = { + .startup = avs_dai_i2shda_be_startup, + .shutdown = avs_dai_althda_be_shutdown, + .hw_params = avs_dai_hda_be_hw_params, + .hw_free = avs_dai_hda_be_hw_free, + .prepare = avs_dai_hda_be_prepare, + .trigger = avs_dai_hda_be_trigger, +}; + +__maybe_unused +static const struct snd_soc_dai_ops avs_dai_dmichda_be_ops = { + .startup = avs_dai_dmichda_be_startup, + .shutdown = avs_dai_althda_be_shutdown, + .hw_params = avs_dai_hda_be_hw_params, + .hw_free = avs_dai_hda_be_hw_free, + .prepare = avs_dai_hda_be_prepare, + .trigger = avs_dai_hda_be_trigger, +}; +static int hw_rule_param_size (struct snd_pcm_hw_params *params,struct snd_pcm_hw_rule *rule) {struct snd_interval *interval =hw_param_interval (params, rule->var);
Signature · 1 line
2.25.1
Cezary Rojewski
maintainerPATCH 9/12 ASoC: Intel: avs: Dynamically assign ops for non-HDAudio DAIs
In reply to Cezary RojewskiProvide dynamic selection mechanism of DAI operations for the non-HDAudio DAIs so that both LunarLake+ platforms and their predecessors are supported.
--- sound/soc/intel/avs/pcm.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-)
sound/soc/intel/avs/pcm.c +16 -5
@@ -502,7 +502,6 @@ static const struct snd_soc_dai_ops avs_dai_hda_be_ops = { .trigger = avs_dai_hda_be_trigger, }; -__maybe_unused static const struct snd_soc_dai_ops avs_dai_i2shda_be_ops = { .startup = avs_dai_i2shda_be_startup, .shutdown = avs_dai_althda_be_shutdown,
@@ -512,7 +511,6 @@ static const struct snd_soc_dai_ops avs_dai_i2shda_be_ops = { .trigger = avs_dai_hda_be_trigger, }; -__maybe_unused static const struct snd_soc_dai_ops avs_dai_dmichda_be_ops = { .startup = avs_dai_dmichda_be_startup, .shutdown = avs_dai_althda_be_shutdown,
@@ -1359,7 +1357,6 @@ int avs_soc_component_register(struct device *dev, const char *name,static struct snd_soc_dai_driver dmic_cpu_dais[] = { { .name ="DMIC Pin" , - .ops = &avs_dai_nonhda_be_ops, .capture = { .stream_name ="DMIC Rx" , .channels_min =1 ,
@@ -1370,7 +1367,6 @@ static struct snd_soc_dai_driver dmic_cpu_dais[] = { }, { .name = "DMIC WoV Pin", - .ops = &avs_dai_nonhda_be_ops, .capture = { .stream_name = "DMIC WoV Rx", .channels_min = 1,
@@ -1383,12 +1379,20 @@ static struct snd_soc_dai_driver dmic_cpu_dais[] = {int avs_dmic_platform_register (struct avs_dev *adev,const char *name) { +const struct snd_soc_dai_ops *ops; + +if (avs_platattr_test (adev,ALTHDA )) + ops = &avs_dai_dmichda_be_ops; +else + ops = &avs_dai_nonhda_be_ops; + + dmic_cpu_dais[0 ].ops = ops; + dmic_cpu_dais[1 ].ops = ops;return avs_soc_component_register (adev->dev, name, &avs_component_driver, dmic_cpu_dais,ARRAY_SIZE (dmic_cpu_dais)); }static const struct snd_soc_dai_driver i2s_dai_template = { - .ops = &avs_dai_nonhda_be_ops, .playback = { .channels_min =1 , .channels_max =8 ,
@@ -1421,10 +1425,15 @@ int avs_i2s_platform_register(struct avs_dev *adev, const char *name, unsigned l unsigned long *tdms) {struct snd_soc_dai_driver *cpus, *dai; +const struct snd_soc_dai_ops *ops;size_t ssp_count, cpu_count;int i, j; ssp_count = adev->hw_cfg.i2s_caps.ctrl_count; +if (avs_platattr_test (adev,ALTHDA )) + ops = &avs_dai_i2shda_be_ops; +else + ops = &avs_dai_nonhda_be_ops; cpu_count =0 ;for_each_set_bit (i, &port_mask, ssp_count)
@@ -1452,6 +1461,7 @@ int avs_i2s_platform_register(struct avs_dev *adev, const char *name, unsigned lif (!dai->name || !dai->playback.stream_name || !dai->capture.stream_name)return -ENOMEM ; + dai->ops = ops; dai++; } }
@@ -1472,6 +1482,7 @@ int avs_i2s_platform_register(struct avs_dev *adev, const char *name, unsigned lif (!dai->name || !dai->playback.stream_name || !dai->capture.stream_name)return -ENOMEM ; + dai->ops = ops; dai++; } }
Signature · 1 line
2.25.1
Cezary Rojewski
maintainerPATCH 10/12 ASoC: Intel: avs: Conditionally add DMA config when creating Copier
In reply to Cezary RojewskiStarting from LunarLake (LNL) platform, non-HDAudio transfers e.g.:
I2S/DMIC utilize HDAudio LINK DMA instead of GPDMA for the data transfer. Implement avs_append_dma_cfg() to account for the changes made in LNL timeframe.
The handler checks the platform and transfer type before appending the DMA configuration to the module's payload so it can safely be called within the common initialization flow for Copier/WHM modules.
--- sound/soc/intel/avs/messages.h | 29 +++++++++++++++++++ sound/soc/intel/avs/path.c | 51 +++++++++++++++++++++++++++++++--- 2 files changed, 76 insertions(+), 4 deletions(-)
sound/soc/intel/avs/messages.h +29 -0
@@ -102,6 +102,8 @@ struct avs_tlv { } __packed;static_assert (sizeof (struct avs_tlv ) ==8 ); +#define avs_tlv_size (tlv) struct_size(tlv, value, (tlv)->length / 4) +enum avs_module_msg_type {AVS_MOD_INIT_INSTANCE =0 ,AVS_MOD_LARGE_CONFIG_GET =3 ,
@@ -786,6 +788,33 @@ union avs_gtw_attributes { } __packed;static_assert (sizeof (union avs_gtw_attributes ) ==4 ); +#define AVS_GTW_DMA_CONFIG_ID 0x1000 +#define AVS_DMA_METHOD_HDA 1 + +struct avs_dma_device_stream_channel_map { +u32 device_address; +u32 channel_map; +} __packed; +static_assert (sizeof (struct avs_dma_device_stream_channel_map ) ==8 ); + +struct avs_dma_stream_channel_map { +u32 device_count; +struct avs_dma_device_stream_channel_map map[16 ]; +} __packed; +static_assert (sizeof (struct avs_dma_stream_channel_map ) ==132 ); + +struct avs_dma_cfg { +u8 dma_method; +u8 pre_allocated; +u16 rsvd; +u32 dma_channel_id; +u32 stream_id; +struct avs_dma_stream_channel_map map; +u32 config_size; + u8 config[] __counted_by(config_size); +} __packed; +static_assert (sizeof (struct avs_dma_cfg ) ==148 ); +struct avs_copier_gtw_cfg {union avs_connector_node_id node_id;u32 dma_buffer_size;
sound/soc/intel/avs/path.c +47 -4
76 lines not on this page · raw message
Signature · 1 line
2.25.1
Cezary Rojewski
maintainerPATCH 11/12 ASoC: Intel: avs: Add boards definitions for ACE platforms
In reply to Cezary RojewskiFrom: Amadeusz Sławiński <[email protected]>
Reuse TGL definitions to define boards configurations for all the supported ACE platforms.
--- sound/soc/intel/avs/board_selection.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
sound/soc/intel/avs/board_selection.c +6 -1
@@ -394,7 +394,12 @@ static const struct avs_acpi_boards i2s_boards[] = {AVS_MACH_ENTRY (HDA_ADL_P , avs_tgl_i2s_machines),AVS_MACH_ENTRY (HDA_RPL_P_0 , avs_tgl_i2s_machines),AVS_MACH_ENTRY (HDA_RPL_M , avs_mbl_i2s_machines), - {} +AVS_MACH_ENTRY (HDA_MTL , avs_tgl_i2s_machines), +AVS_MACH_ENTRY (HDA_ARL_S , avs_tgl_i2s_machines), +AVS_MACH_ENTRY (HDA_LNL_P , avs_tgl_i2s_machines), +AVS_MACH_ENTRY (HDA_PTL , avs_tgl_i2s_machines), + AVS_MACH_ENTRY(HDA_FCL, avs_tgl_i2s_machines), + { }, };static const struct avs_acpi_boards *avs_get_i2s_boards (struct avs_dev *adev)
Signature · 1 line
2.25.1
Cezary Rojewski
maintainerPATCH 12/12 ALSA: hda: Select avs-driver by default on FCL
In reply to Cezary RojewskiThe avs-driver is the recommended solution for FriscoLake (FCL) platform.
--- sound/hda/intel-dsp-config.c | 4 ++++ 1 file changed, 4 insertions(+)
sound/hda/intel-dsp-config.c +4 -0
@@ -112,6 +112,10 @@ static const struct config_entry config_table[] = { .flags = FLAG_SST, .device = PCI_DEVICE_ID_INTEL_HDA_RPL_M, }, + { + .flags = FLAG_SST, + .device = PCI_DEVICE_ID_INTEL_HDA_FCL, + },#endif #if IS_ENABLED (CONFIG_SND_SOC_SOF_APOLLOLAKE ) {
Signature · 1 line
2.25.1
Girdwood, Liam R
NAKQuoted 10 lines · Cezary Rojewski
Cezary Rojewski (11):
ALSA: hda: Allow to fetch hlink by ID
ASoC: Intel: avs: Ignore Vendor-space manipulation for ACE
ASoC: Intel: avs: Read HW capabilities when possible
ASoC: Intel: avs: Relocate DSP status registers
ASoC: Intel: avs: MTL-based platforms support
ASoC: Intel: avs: LNL-based platforms support
ASoC: Intel: avs: PTL-based platforms support
ASoC: Intel: avs: PCM operations for LNL-based platforms
Sorry - AVS is not officially supported for MTL, LNL and PTL on Linux.
NAK.
The rest is fine.
Liam
Cezary Rojewski
maintainerQuoted 11 lines · Liam R
Quoted 10 lines · Cezary Rojewski
Cezary Rojewski (11):
ALSA: hda: Allow to fetch hlink by ID
ASoC: Intel: avs: Ignore Vendor-space manipulation for ACE
ASoC: Intel: avs: Read HW capabilities when possible
ASoC: Intel: avs: Relocate DSP status registers
ASoC: Intel: avs: MTL-based platforms support
ASoC: Intel: avs: LNL-based platforms support
ASoC: Intel: avs: PTL-based platforms support
ASoC: Intel: avs: PCM operations for LNL-based platforms
Quoted 3 lines
Sorry - AVS is not officially supported for MTL, LNL and PTL on Linux.
NAK.
FCL is a PTL-A, PTL-based platform. The driver is officially supported on the ACE architecture with clients utilizing it on distributions such as Android and Yocto. As software needs little to no changes to cover PTL alone it is preferable to have clear division: ace1.0 <- ace2.0 <- ace3.0. The code is maintainable and readable this way.
And then we have validation point. intel-dsp-config remains intact (no selection changes for MTL/LNL) but still leaves window for the AVS-validation to have high code coverage.
Unless you can bring technical arguments, 'NAK' does not apply. The requirements for the project state clearly - upstream the code for the architectures we do support.
Kind regards,
Czarek
Quoted 18 lines · Cezary Rojewski
Quoted 11 lines · Liam R
Quoted 10 lines · Cezary Rojewski
Cezary Rojewski (11):
ALSA: hda: Allow to fetch hlink by ID
ASoC: Intel: avs: Ignore Vendor-space manipulation for ACE
ASoC: Intel: avs: Read HW capabilities when possible
ASoC: Intel: avs: Relocate DSP status registers
ASoC: Intel: avs: MTL-based platforms support
ASoC: Intel: avs: LNL-based platforms support
ASoC: Intel: avs: PTL-based platforms support
ASoC: Intel: avs: PCM operations for LNL-based platformsQuoted 4 lines
Sorry - AVS is not officially supported for MTL, LNL and PTL on Linux.
NAK.
Quoted 8 lines
FCL is a PTL-A, PTL-based platform. The driver is officially supported
on the ACE architecture with clients utilizing it on distributions such
as Android and Yocto. As software needs little to no changes to cover PTL alone it is preferable to have clear division: ace1.0 <- ace2.0 <-
ace3.0. The code is maintainable and readable this way.
No argument with FCL or any non client devices.
If you do need to support IP versions, then use the correct non client product name and PCI IDs. Don't confuse users and claim client device names or IDs that you have no way to support.
Quoted 5 lines
And then we have validation point. intel-dsp-config remains intact (no
selection changes for MTL/LNL) but still leaves window for the AVS-validation to have high code coverage.
So this is for internal IP testing reasons and its best to carry these out of tree like everyone else does.
Quoted 6 lines
Unless you can bring technical arguments, 'NAK' does not apply. The requirements for the project state clearly - upstream the code for the
architectures we do support.
Sorry, we have not even crossed the threshold for a technical argument, this is an unsupported driver and an unsupported FW for these devices on Linux. Period.
The SOF FW and driver is the supported driver and FW for these devices on Linux.
Please do point me internally to where AVS is plan of record for Linux client MTL, LNL and PTL and I will approve.
Thanks
Liam
Quoted 3 lines
Kind regards,
Czarek
Cezary Rojewski
maintainerQuoted 28 lines · Liam R
Quoted 18 lines · Cezary Rojewski
Quoted 11 lines · Liam R
Quoted 10 lines · Cezary Rojewski
Cezary Rojewski (11):
ALSA: hda: Allow to fetch hlink by ID
ASoC: Intel: avs: Ignore Vendor-space manipulation for ACE
ASoC: Intel: avs: Read HW capabilities when possible
ASoC: Intel: avs: Relocate DSP status registers
ASoC: Intel: avs: MTL-based platforms support
ASoC: Intel: avs: LNL-based platforms support
ASoC: Intel: avs: PTL-based platforms support
ASoC: Intel: avs: PCM operations for LNL-based platformsQuoted 4 lines
Sorry - AVS is not officially supported for MTL, LNL and PTL on Linux.
NAK.
Quoted 8 lines
FCL is a PTL-A, PTL-based platform. The driver is officially supported
on the ACE architecture with clients utilizing it on distributions such
as Android and Yocto. As software needs little to no changes to cover PTL alone it is preferable to have clear division: ace1.0 <- ace2.0 <-
ace3.0. The code is maintainable and readable this way.
Quoted 1 line
No argument with FCL or any non client devices.
I see. So we're talking about pci_ids and their attached descriptors, and _not_ removing the functional code that enables avs-driver on ACE architecture?
The filenames/prefixes shall remain as-is given the driver's design - platform that starts given arch, becomes its namesake.
Kind regards,
Czarek
Quoted 33 lines · Cezary Rojewski
Quoted 32 lines · Liam R
Quoted 30 lines · Cezary Rojewski
Quoted 12 lines · Liam R
Quoted 11 lines · Cezary Rojewski
Cezary Rojewski (11):
ALSA: hda: Allow to fetch hlink by ID
ASoC: Intel: avs: Ignore Vendor-space manipulation for ACE
ASoC: Intel: avs: Read HW capabilities when possible
ASoC: Intel: avs: Relocate DSP status registers
ASoC: Intel: avs: MTL-based platforms support
ASoC: Intel: avs: LNL-based platforms support
ASoC: Intel: avs: PTL-based platforms support
ASoC: Intel: avs: PCM operations for LNL-based platformsQuoted 4 lines
Sorry - AVS is not officially supported for MTL, LNL and PTL on Linux.
NAK.
FCL is a PTL-A, PTL-based platform. The driver is officially supported
on the ACE architecture with clients utilizing it on distributions
such
as Android and Yocto. As software needs little to no changes to cover
PTL alone it is preferable to have clear division: ace1.0 <- ace2.0
<-
ace3.0. The code is maintainable and readable this way.
Quoted 5 lines
Quoted 1 line
No argument with FCL or any non client devices.
I see. So we're talking about
pci_idsand their attached descriptors, and _not_ removing the functional code that enables avs-driver on ACE architecture?
Yes, lets not cause any confusion with duplicated IDs or product names across different drivers. Not removing any AVS code :)
Quoted 4 lines
The filenames/prefixes shall remain as-is given the driver's design - platform that starts given arch, becomes its namesake.
No issue if you want to rename any IP code filename to e.g. ACE2 instead of LNL as this makes it obvious for anyone reading the code and you can add my Ack to that if wanted.
Thanks
Liam
Quoted 2 lines
Kind regards,
Czarek
Cezary Rojewski
maintainerQuoted 14 lines · Liam R
Quoted 12 lines · Cezary Rojewski
Quoted 12 lines
Quoted 11 lines
FCL is a PTL-A, PTL-based platform. The driver is officially supported
on the ACE architecture with clients utilizing it on distributions
such
as Android and Yocto. As software needs little to no changes to cover
PTL alone it is preferable to have clear division: ace1.0 <- ace2.0
<-
ace3.0. The code is maintainable and readable this way.
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
No argument with FCL or any non client devices.
I see. So we're talking about
pci_idsand their attached descriptors, and _not_ removing the functional code that enables avs-driver on ACE architecture?Yes, lets not cause any confusion with duplicated IDs or product names across different drivers. Not removing any AVS code :)
Ack.
Quoted 8 lines
Quoted 4 lines
The filenames/prefixes shall remain as-is given the driver's design - platform that starts given arch, becomes its namesake.
No issue if you want to rename any IP code filename to e.g. ACE2 instead of LNL as this makes it obvious for anyone reading the code and you can add my Ack to that if wanted.
I opted out of cavs15, cavs25, avs10 (just few examples but I bet the idea is visible) long time ago due to Pierre's feedback. Suggestion was: it is easier for the non-Intel people to understand the "architecture" concept for Intel AudioDSP if it's tied to platform name. As all the files within the avs/ folder follow that scheme now, I'm not keen going against that pattern now.
I can 3 commits adding mtl.c, lnl.c and ptl.c into a single commit, drop the pci_ids and their contexts so it aligns with your comment about leaving out the confusion. Does that suffice?
Kind regards,
Czarek
Quoted 4 lines · Cezary Rojewski
I can 3 commits adding
mtl.c,lnl.candptl.cinto a single commit, drop
thepci_idsand their contexts so it aligns with your comment about leaving out the confusion. Does that suffice?
Yes.
Thanks
Liam