ASoC: Intel: avs: Add support for MalibouLake configuration
Cezary Rojewski
maintainerv3 cover ASoC: Intel: avs: Add support for MalibouLake configuration
The avs-driver is the go-to driver for Intel Automotive. MalibouLake (MBL) and RedondoLake (RDL) are representatives of the project. These inherit majority of the featureset from RaptorLake-M (RPL-M) and AlderLake-N (ADL-N) respectively. The onboard codec for these is TI's pcm3168a.
In summary, the patchset:
- modifies existing pcm3168a.c to be x86/ACPI friendly
- updates the DSP firmware booting sequence for cAVS 2.5 platforms to improve its behaviour on some specific revisions/steppings of the hardware
- adds new machine board driver, avs_pcm3168a
- adds selector entry for RPL-M devices in intel-dspcfg
While there 'ALSA: hda:' patch within the list, I'd prefer the patchset to go through Mark's tree to avoid conflicts with follow ups to this one.
Longer version:
Currently the pcm3168a is supported on ARM/DT (ti/j721e-evm.c being the only user). To make it x86/ACPI friendly, add relevant ACPI-match table and relax driver's probing conditions.
The default format is 2ch, 24-bits, 48000kHz. As per specification, 24-bits are supported by the chip and it works in production in contrary to what the existing code suggests. A fix is provided to align the code with the spec.
Now, a single DSP firmware binary covers a wide range of platforms - a single one covers AlderLake, RaptorLake and all their derevatires except for AlderLake-N based due to MEU differences. While most of the hardware capabilities are read by the firmware during runtime, some information is not accessible from the DSP level. Provide the HDAudio controller revision/stepping information to the firmware to address that.
With that done, expand number of modules supported with WovHostModule (WHM). WHM is a processing module which is tailored for ultra-low-power scenarios. From software perspective, as most of its config is similar to the Copier module, code reuse is advised. To make the reuse possible, existing gateway configuration code is refactor - not only to add support for WHM but also make it easier to understand. Multiple smaller functions instead of all-in-one one.
Changes in v3:
- fixed compilation under X86=n, found out by IKP
Note: no users of cpuid() seem to be honoring COMPILE_TEST currently. In future I'll try to get rid of ugly #ifdef in tgl.c, but that's not in scope of the MBL series
- removed redundant hw_params() op from the pcm3168a board. Not needed for MBL where the codec has its own SYSCLK source
Changes in v2:
- added missing MODULE_DESCRIPTION() to avs_pcm3168a
Amadeusz Sławiński (1):
ASoC: Intel: avs: Configure basefw on TGL-based platforms
Cezary Rojewski (10):
ASoC: codecs: pcm3168a: Add ACPI match table
ASoC: codecs: pcm3168a: Relax probing conditions
ASoC: codecs: pcm3168a: Allow for 24-bit in provider mode
ASoC: Intel: avs: Add pcm3168a machine board
ASoC: Intel: avs: pcm3168a board selection
ASoC: Intel: avs: Move DSP-boot steps into individual functions
ASoC: Intel: avs: New gateway configuration mechanism
ASoC: Intel: avs: Remove unused gateway configuration code
ASoC: Intel: avs: Add WHM module support
ALSA: hda: Select avs-driver by default on MBL
include/uapi/sound/intel/avs/tokens.h | 7 + sound/hda/intel-dsp-config.c | 4 + sound/soc/codecs/pcm3168a-i2c.c | 9 + sound/soc/codecs/pcm3168a.c | 11 +- sound/soc/intel/avs/avs.h | 1 + sound/soc/intel/avs/board_selection.c | 17 +- sound/soc/intel/avs/boards/Kconfig | 10 + sound/soc/intel/avs/boards/Makefile | 2 + sound/soc/intel/avs/boards/pcm3168a.c | 143 ++++++++++++++ sound/soc/intel/avs/loader.c | 64 ++++-- sound/soc/intel/avs/messages.c | 38 ++++ sound/soc/intel/avs/messages.h | 22 +++ sound/soc/intel/avs/path.c | 271 +++++++++++++++----------- sound/soc/intel/avs/tgl.c | 33 ++++ sound/soc/intel/avs/topology.c | 42 ++++ sound/soc/intel/avs/topology.h | 11 +- 16 files changed, 544 insertions(+), 141 deletions(-) create mode 100644 sound/soc/intel/avs/boards/pcm3168a.c
Signature · 1 line
2.25.1
Cezary Rojewski
maintainerPATCH v3 1/11 ASoC: codecs: pcm3168a: Add ACPI match table
Support ACPI-based systems by adding relevant match table.
--- sound/soc/codecs/pcm3168a-i2c.c | 9 +++++++++ 1 file changed, 9 insertions(+)
sound/soc/codecs/pcm3168a-i2c.c +9 -0
@@ -10,6 +10,7 @@#include <linux/i2c.h> #include <linux/init.h> #include <linux/module.h> +#include <linux/mod_devicetable.h> #include <sound/soc.h>
@@ -37,6 +38,13 @@ static const struct i2c_device_id pcm3168a_i2c_id[] = { };MODULE_DEVICE_TABLE (i2c, pcm3168a_i2c_id); +static const struct acpi_device_id pcm3168a_acpi_match[] = { + {"PCM3168A" }, + {"104C3168" }, + {} +}; +MODULE_DEVICE_TABLE (acpi, pcm3168a_acpi_match); +static const struct of_device_id pcm3168a_of_match[] = { { .compatible ="ti,pcm3168a" , }, { }
@@ -49,6 +57,7 @@ static struct i2c_driver pcm3168a_i2c_driver = { .id_table = pcm3168a_i2c_id, .driver = { .name = "pcm3168a", + .acpi_match_table = pcm3168a_acpi_match, .of_match_table = pcm3168a_of_match, .pm = &pcm3168a_pm_ops, },
Signature · 1 line
2.25.1
Cezary Rojewski
maintainerPATCH v3 2/11 ASoC: codecs: pcm3168a: Relax probing conditions
In reply to Cezary RojewskiOn ACPI-based systems with Intel MalibouLake there is no "scki" clock entry defined. Make that initialization part optional and default to 24.576 MHz rate if not set. The rate is the default for both TI and Intel devices.
--- sound/soc/codecs/pcm3168a.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
sound/soc/codecs/pcm3168a.c +4 -1
@@ -743,7 +743,7 @@ int pcm3168a_probe(struct device *dev, struct regmap *regmap)return dev_err_probe (dev,PTR_ERR (pcm3168a->gpio_rst),"failed to acquire RST gpio\n" ); - pcm3168a->scki =devm_clk_get (dev,"scki" ); + pcm3168a->scki =devm_clk_get_optional (dev,"scki" );if (IS_ERR (pcm3168a->scki))return dev_err_probe (dev,PTR_ERR (pcm3168a->scki),"failed to acquire clock 'scki'\n" );
@@ -755,6 +755,9 @@ int pcm3168a_probe(struct device *dev, struct regmap *regmap) } pcm3168a->sysclk =clk_get_rate (pcm3168a->scki); +/* Fallback to the default if no clk entry available. */ +if (!pcm3168a->sysclk) + pcm3168a->sysclk =24576000 ;for (i =0 ; i <ARRAY_SIZE (pcm3168a->supplies); i++) pcm3168a->supplies[i].supply = pcm3168a_supply_names[i];
Signature · 1 line
2.25.1
Cezary Rojewski
maintainerPATCH v3 3/11 ASoC: codecs: pcm3168a: Allow for 24-bit in provider mode
In reply to Cezary RojewskiAs per codec device specification, 24-bit is allowed in provider mode. Update the code to reflect that.
--- sound/soc/codecs/pcm3168a.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
sound/soc/codecs/pcm3168a.c +3 -3
@@ -493,9 +493,9 @@ static int pcm3168a_hw_params(struct snd_pcm_substream *substream, }break ;case 24 : -if (provider_mode || (format ==SND_SOC_DAIFMT_DSP_A ) || - (format ==SND_SOC_DAIFMT_DSP_B )) { -dev_err (component->dev,"24-bit slots not supported in provider mode, or consumer mode using DSP\n" ); +if (!provider_mode && ((format ==SND_SOC_DAIFMT_DSP_A ) || + (format ==SND_SOC_DAIFMT_DSP_B ))) { +dev_err (component->dev,"24-bit slots not supported in consumer mode using DSP\n" );return -EINVAL ; }break ;
Signature · 1 line
2.25.1
Cezary Rojewski
maintainerPATCH v3 4/11 ASoC: Intel: avs: Add pcm3168a machine board
In reply to Cezary RojewskiTo support AVS-pcm3168a configuration add machine board connecting AVS platform component driver with pcm3168a codec one.
--- sound/soc/intel/avs/boards/Kconfig | 10 ++ sound/soc/intel/avs/boards/Makefile | 2 + sound/soc/intel/avs/boards/pcm3168a.c | 143 ++++++++++++++++++++++++++ 3 files changed, 155 insertions(+) create mode 100644 sound/soc/intel/avs/boards/pcm3168a.c
sound/soc/intel/avs/boards/Kconfig +10 -0
@@ -87,6 +87,16 @@ config SND_SOC_INTEL_AVS_MACH_NAU8825 Say Y or m if you have such a device. This is a recommended option. If unsure select "N". +config SND_SOC_INTEL_AVS_MACH_PCM3168A + tristate "pcm3168a I2S board" + depends on I2C + depends on MFD_INTEL_LPSS || COMPILE_TEST + select SND_SOC_PCM3168A_I2C + help + This adds support for AVS with PCM3168A I2C codec configuration. + Say Y or m if you have such a device. This is a recommended option. + If unsure select "N". + config SND_SOC_INTEL_AVS_MACH_PROBE tristate "Probing (data) board" depends on DEBUG_FS
sound/soc/intel/avs/boards/Makefile +2 -0
@@ -9,6 +9,7 @@ snd-soc-avs-max98927-y := max98927.o snd-soc-avs-max98357a-y := max98357a.o snd-soc-avs-max98373-y := max98373.o snd-soc-avs-nau8825-y := nau8825.o +snd-soc-avs-pcm3168a-y := pcm3168a.o snd-soc-avs-probe-y := probe.o snd-soc-avs-rt274-y := rt274.o snd-soc-avs-rt286-y := rt286.o
@@ -27,6 +28,7 @@ obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_MAX98927) += snd-soc-avs-max98927.o obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_MAX98357A) += snd-soc-avs-max98357a.o obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_MAX98373) += snd-soc-avs-max98373.o obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_NAU8825) += snd-soc-avs-nau8825.o +obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_PCM3168A) += snd-soc-avs-pcm3168a.o obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_PROBE) += snd-soc-avs-probe.o obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_RT274) += snd-soc-avs-rt274.o obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_RT286) += snd-soc-avs-rt286.o
sound/soc/intel/avs/boards/pcm3168a.c new file +143 -0
143 lines not on this page · raw message
Signature · 1 line
2.25.1
Cezary Rojewski
maintainerPATCH v3 5/11 ASoC: Intel: avs: pcm3168a board selection
In reply to Cezary RojewskiPopulate board table with avs_pcm3168a machine driver for RPL-M-based and ADL-N-based platforms with pcm3168a codec onboard to allow the sound card to enumerate.
While at it, drop comma the terminator entries to align with the coding standard.
--- sound/soc/intel/avs/board_selection.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
sound/soc/intel/avs/board_selection.c +15 -2
@@ -312,6 +312,18 @@ static struct snd_soc_acpi_mach avs_tgl_i2s_machines[] = { {}, }; +static struct snd_soc_acpi_mach avs_mbl_i2s_machines[] = { + { + .id ="PCM3168A" , + .drv_name ="avs_pcm3168a" , + .mach_params = { + .i2s_link_mask =AVS_SSP (0 ) |AVS_SSP (2 ), + }, + .tplg_filename ="pcm3168a-tplg.bin" , + }, + {} +}; +static struct snd_soc_acpi_mach avs_test_i2s_machines[] = { { .drv_name ="avs_i2s_test" ,
@@ -378,10 +390,11 @@ static const struct avs_acpi_boards i2s_boards[] = {AVS_MACH_ENTRY (HDA_ICL_LP , avs_icl_i2s_machines),AVS_MACH_ENTRY (HDA_TGL_LP , avs_tgl_i2s_machines),AVS_MACH_ENTRY (HDA_EHL_0 , avs_tgl_i2s_machines), +AVS_MACH_ENTRY (HDA_ADL_N , avs_mbl_i2s_machines),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_tgl_i2s_machines), - {}, + AVS_MACH_ENTRY(HDA_RPL_M, avs_mbl_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 v3 6/11 ASoC: Intel: avs: Move DSP-boot steps into individual functions
In reply to Cezary RojewskiTo make DSP-boot code more readable, move each logical step into an individual function and add the configure step which will be utilized by follow up changes. To summarize, the steps are: loading the firmware code, configuring the base firmware and, allocating driver resources based on FW and HW capabilities.
--- sound/soc/intel/avs/avs.h | 1 + sound/soc/intel/avs/loader.c | 64 ++++++++++++++++++++++++++---------- 2 files changed, 48 insertions(+), 17 deletions(-)
sound/soc/intel/avs/avs.h +1 -0
@@ -51,6 +51,7 @@ struct avs_dsp_ops {int (*const load_basefw)(struct avs_dev *,struct firmware *);int (*const load_lib)(struct avs_dev *,struct firmware *,u32 );int (*const transfer_mods)(struct avs_dev *,bool ,struct avs_module_entry *,u32 ); +int (*const config_basefw)(struct avs_dev *);int (*const enable_logs)(struct avs_dev *,enum avs_log_enable ,u32 ,u32 ,unsigned long ,u32 *);int (*const log_buffer_offset)(struct avs_dev *,u32 );
sound/soc/intel/avs/loader.c +47 -17
88 lines not on this page · raw message
Signature · 1 line
2.25.1
Cezary Rojewski
maintainerPATCH v3 7/11 ASoC: Intel: avs: Configure basefw on TGL-based platforms
In reply to Cezary RojewskiFrom: Amadeusz Sławiński <[email protected]>
The AudioDSP firmware requires additional information about the configuration on selected devices. That information is unaccessible from the DSP side and shall be sent before any streaming starts.
To achieve the goal, introduce FW_CONFIG_SET request. FW_CONFIG_SET message allows driver to modify firmware's configuration. Multiple parameters can be modified at once, thanks to payload being an array of TLVs.
--- sound/soc/intel/avs/messages.c | 38 ++++++++++++++++++++++++++++++++++ sound/soc/intel/avs/messages.h | 9 ++++++++ sound/soc/intel/avs/tgl.c | 33 +++++++++++++++++++++++++++++ 3 files changed, 80 insertions(+)
sound/soc/intel/avs/messages.c +38 -0
@@ -510,6 +510,44 @@ int avs_ipc_get_fw_config(struct avs_dev *adev, struct avs_fw_cfg *cfg)return ret; } +int avs_ipc_set_fw_config (struct avs_dev *adev,size_t num_tlvs, ...) +{ +struct avs_tlv *tlv; +void *payload; +size_t offset; +va_list args; +int ret, i; + + payload =kzalloc (AVS_MAILBOX_SIZE ,GFP_KERNEL ); +if (!payload) +return -ENOMEM ; + +va_start (args, num_tlvs); +for (offset = i =0 ; i < num_tlvs && offset <AVS_MAILBOX_SIZE -sizeof (*tlv); i++) { + tlv = (struct avs_tlv *)(payload + offset); + tlv->type =va_arg (args, u32); + tlv->length =va_arg (args, u32); + + offset +=sizeof (*tlv) + tlv->length; +if (offset >AVS_MAILBOX_SIZE ) +break ; + + memcpy(tlv->value, va_arg(args, u8*), tlv->length); + } + +if (i == num_tlvs) + ret =avs_ipc_set_large_config (adev,AVS_BASEFW_MOD_ID ,AVS_BASEFW_INST_ID , +AVS_BASEFW_FIRMWARE_CONFIG , payload, offset); +else + ret = -ERANGE ; + +va_end (args); +kfree (payload); +if (ret) +dev_err (adev->dev,"set fw cfg failed: %d\n" , ret); +return ret; +} +int avs_ipc_get_hw_config (struct avs_dev *adev,struct avs_hw_cfg *cfg) {struct avs_tlv *tlv;
sound/soc/intel/avs/messages.h +9 -0
@@ -451,6 +451,8 @@ enum avs_fw_cfg_params {AVS_FW_CFG_RESERVED ,AVS_FW_CFG_POWER_GATING_POLICY ,AVS_FW_CFG_ASSERT_MODE , +AVS_FW_CFG_RESERVED2 , + AVS_FW_CFG_BUS_HARDWARE_ID, }; struct avs_fw_cfg {
@@ -475,7 +477,14 @@ struct avs_fw_cfg {u32 power_gating_policy; }; +struct avs_bus_hwid { +u32 device; +u32 subsystem; +u8 revision; +}; +int avs_ipc_get_fw_config (struct avs_dev *adev,struct avs_fw_cfg *cfg); +int avs_ipc_set_fw_config (struct avs_dev *adev,size_t num_tlvs, ...);enum avs_hw_cfg_params {AVS_HW_CFG_AVS_VER ,
sound/soc/intel/avs/tgl.c +33 -0
@@ -6,7 +6,11 @@// Amadeusz Slawinski <[email protected]> // +#include <linux/pci.h> #include "avs.h" +#include "messages.h" + +#define CPUID_TSC_LEAF 0x15static int avs_tgl_dsp_core_power (struct avs_dev *adev,u32 core_mask,bool power) {
@@ -35,6 +39,34 @@ static int avs_tgl_dsp_core_stall(struct avs_dev *adev, u32 core_mask, bool stalreturn avs_dsp_core_stall (adev, core_mask, stall); } +static int avs_tgl_config_basefw (struct avs_dev *adev) +{ +struct pci_dev *pci = adev->base.pci; +struct avs_bus_hwid hwid; +int ret; +#ifdef CONFIG_X86 +unsigned int ecx; + +#include <asm/cpuid.h> + ecx =cpuid_ecx (CPUID_TSC_LEAF ); +if (ecx) { + ret =avs_ipc_set_fw_config (adev,1 ,AVS_FW_CFG_XTAL_FREQ_HZ ,sizeof (ecx), &ecx); +if (ret) +return AVS_IPC_RET (ret); + } +#endif + + hwid.device = pci->device; + hwid.subsystem = pci->subsystem_vendor | (pci->subsystem_device <<16 ); + hwid.revision = pci->revision; + + ret =avs_ipc_set_fw_config (adev,1 ,AVS_FW_CFG_BUS_HARDWARE_ID ,sizeof (hwid), &hwid); +if (ret) +return AVS_IPC_RET (ret); + +return 0 ; +} +const struct avs_dsp_ops avs_tgl_dsp_ops = { .power = avs_tgl_dsp_core_power, .reset = avs_tgl_dsp_core_reset,
@@ -44,6 +76,7 @@ const struct avs_dsp_ops avs_tgl_dsp_ops = { .load_basefw = avs_icl_load_basefw, .load_lib = avs_hda_load_library, .transfer_mods = avs_hda_transfer_modules, + .config_basefw = avs_tgl_config_basefw, .log_buffer_offset = avs_icl_log_buffer_offset, .log_buffer_status = avs_apl_log_buffer_status, .coredump = avs_apl_coredump,
Signature · 1 line
2.25.1
Cezary Rojewski
maintainerPATCH v3 8/11 ASoC: Intel: avs: New gateway configuration mechanism
In reply to Cezary RojewskiCreation of a module which contains gateway configuration consists of few additional steps, namely:
- assigning ID (node_id) for the gateway
- attaching hardware configuration from the NHLT table (optional)
By splitting the steps into separate functions code becomes easier to read and understand. Any redundancy created by this patch will be addressed by follow up changes.
--- sound/soc/intel/avs/path.c | 150 +++++++++++++++++++++++++++++++++++++ 1 file changed, 150 insertions(+)
sound/soc/intel/avs/path.c +150 -0
@@ -115,6 +115,156 @@ avs_path_find_variant(struct avs_dev *adev,return NULL ; } +static void avs_init_node_id (union avs_connector_node_id *node_id, +struct avs_tplg_modcfg_ext *te,u32 dma_id) +{ + node_id->val =0 ; + node_id->dma_type = te->copier.dma_type; + +switch (node_id->dma_type) { +case AVS_DMA_DMIC_LINK_INPUT : +case AVS_DMA_I2S_LINK_OUTPUT : +case AVS_DMA_I2S_LINK_INPUT : +/* Gateway's virtual index is statically assigned in the topology. */ + node_id->vindex = te->copier.vindex.val; +break ; + +case AVS_DMA_HDA_HOST_OUTPUT : +case AVS_DMA_HDA_HOST_INPUT : +/* Gateway's virtual index is dynamically assigned with DMA ID */ + node_id->vindex = dma_id; +break ; + +case AVS_DMA_HDA_LINK_OUTPUT : +case AVS_DMA_HDA_LINK_INPUT : + node_id->vindex = te->copier.vindex.val | dma_id; +break ; + +default : + *node_id =INVALID_NODE_ID ; +break ; + } +} + +/* Every BLOB contains at least gateway attributes. */ +static struct acpi_nhlt_config *default_blob = (struct acpi_nhlt_config *)&(u32 [2 ]) {4 }; + +static struct acpi_nhlt_config * +avs_nhlt_config_or_default (struct avs_dev *adev,struct avs_tplg_module *t) +{ +struct acpi_nhlt_format_config *fmtcfg; +struct avs_tplg_modcfg_ext *te; +struct avs_audio_format *fmt; +int link_type, dev_type; +int bus_id, dir; + + te = t->cfg_ext; + +switch (te->copier.dma_type) { +case AVS_DMA_I2S_LINK_OUTPUT : + link_type =ACPI_NHLT_LINKTYPE_SSP ; + dev_type =ACPI_NHLT_DEVICETYPE_CODEC ; + bus_id = te->copier.vindex.i2s.instance; + dir =SNDRV_PCM_STREAM_PLAYBACK ; + fmt = te->copier.out_fmt; +break ; + +case AVS_DMA_I2S_LINK_INPUT : + link_type =ACPI_NHLT_LINKTYPE_SSP ; + dev_type =ACPI_NHLT_DEVICETYPE_CODEC ; + bus_id = te->copier.vindex.i2s.instance; + dir =SNDRV_PCM_STREAM_CAPTURE ; + fmt = t->in_fmt; +break ; + +case AVS_DMA_DMIC_LINK_INPUT : + link_type =ACPI_NHLT_LINKTYPE_PDM ; + dev_type =-1 ;/* ignored */ + bus_id =0 ; + dir =SNDRV_PCM_STREAM_CAPTURE ; + fmt = t->in_fmt; +break ; + +default : +return default_blob; + } + +/* Override format selection if necessary. */ +if (te->copier.blob_fmt) + fmt = te->copier.blob_fmt; + + fmtcfg =acpi_nhlt_find_fmtcfg (link_type, dev_type, dir, bus_id, + fmt->num_channels, fmt->sampling_freq, fmt->valid_bit_depth, + fmt->bit_depth); +if (!fmtcfg) { +dev_warn (adev->dev,"Endpoint format configuration not found.\n" ); +return ERR_PTR (-ENOENT ); + } + +if (fmtcfg->config.capabilities_size < default_blob->capabilities_size) +return ERR_PTR (-ETOOSMALL ); +/* The firmware expects the payload to be DWORD-aligned. */ +if (fmtcfg->config.capabilities_size %sizeof (u32)) +return ERR_PTR (-EINVAL ); + +return &fmtcfg->config; +} + +static int avs_fill_gtw_config (struct avs_dev *adev,struct avs_copier_gtw_cfg *gtw, +struct avs_tplg_module *t,size_t *cfg_size) +{ +struct acpi_nhlt_config *blob; +size_t gtw_size; + + blob =avs_nhlt_config_or_default (adev, t); +if (IS_ERR (blob)) +return PTR_ERR (blob); + + gtw_size = blob->capabilities_size; +if (*cfg_size + gtw_size >AVS_MAILBOX_SIZE ) +return -E2BIG ; + + gtw->config_length = gtw_size /sizeof (u32); +memcpy (gtw->config.blob, blob->capabilities, blob->capabilities_size); + *cfg_size += gtw_size; + +return 0 ; +} + +static __maybe_unused int avs_copier_create2 (struct avs_dev *adev,struct avs_path_module *mod) +{ +struct avs_tplg_module *t = mod->template; +struct avs_tplg_modcfg_ext *te; +struct avs_copier_cfg *cfg; +size_t cfg_size; +u32 dma_id; +int ret; + + te = t->cfg_ext; + cfg = adev->modcfg_buf; + dma_id = mod->owner->owner->dma_id; + cfg_size = offsetof(struct avs_copier_cfg, gtw_cfg.config); + + ret =avs_fill_gtw_config (adev, &cfg->gtw_cfg, t, &cfg_size); +if (ret) +return ret; + + cfg->base.cpc = t->cfg_base->cpc; + cfg->base.ibs = t->cfg_base->ibs; + cfg->base.obs = t->cfg_base->obs; + cfg->base.is_pages = t->cfg_base->is_pages; + cfg->base.audio_fmt = *t->in_fmt; + cfg->out_fmt = *te->copier.out_fmt; + cfg->feature_mask = te->copier.feature_mask; +avs_init_node_id (&cfg->gtw_cfg.node_id, te, dma_id); + cfg->gtw_cfg.dma_buffer_size = te->copier.dma_buffer_size; + mod->gtw_attrs = cfg->gtw_cfg.config.attrs; + + ret =avs_dsp_init_module (adev, mod->module_id, mod->owner->instance_id, t->core_id, + t->domain, cfg, cfg_size, &mod->instance_id); +return ret; +} +__maybe_unused static bool avs_dma_type_is_host (u32 dma_type) {
Signature · 1 line
2.25.1
Cezary Rojewski
maintainerPATCH v3 9/11 ASoC: Intel: avs: Remove unused gateway configuration code
In reply to Cezary RojewskiSwitch to new copier module constructor and remove code that becomes unused because of that.
--- sound/soc/intel/avs/path.c | 149 +-------------------------------- sound/soc/intel/avs/topology.h | 2 - 2 files changed, 1 insertion(+), 150 deletions(-)
sound/soc/intel/avs/path.c +1 -148
@@ -231,7 +231,7 @@ static int avs_fill_gtw_config(struct avs_dev *adev, struct avs_copier_gtw_cfg *return 0 ; } -static __maybe_unused int avs_copier_create2 (struct avs_dev *adev,struct avs_path_module *mod) +static int avs_copier_create (struct avs_dev *adev,struct avs_path_module *mod) {struct avs_tplg_module *t = mod->template;struct avs_tplg_modcfg_ext *te;
@@ -265,153 +265,6 @@ static __maybe_unused int avs_copier_create2(struct avs_dev *adev, struct avs_pareturn ret; } -__maybe_unused -static bool avs_dma_type_is_host (u32 dma_type) -{ -return dma_type ==AVS_DMA_HDA_HOST_OUTPUT || - dma_type ==AVS_DMA_HDA_HOST_INPUT ; -} - -__maybe_unused -static bool avs_dma_type_is_link (u32 dma_type) -{ -return !avs_dma_type_is_host (dma_type); -} - -__maybe_unused -static bool avs_dma_type_is_output (u32 dma_type) -{ -return dma_type ==AVS_DMA_HDA_HOST_OUTPUT || - dma_type ==AVS_DMA_HDA_LINK_OUTPUT || - dma_type ==AVS_DMA_I2S_LINK_OUTPUT ; -} - -__maybe_unused -static bool avs_dma_type_is_input (u32 dma_type) -{ -return !avs_dma_type_is_output (dma_type); -} - -static int avs_copier_create (struct avs_dev *adev,struct avs_path_module *mod) -{ -struct avs_tplg_module *t = mod->template; -struct avs_copier_cfg *cfg; -struct acpi_nhlt_format_config *ep_blob; -struct acpi_nhlt_endpoint *ep; -union avs_connector_node_id node_id = {0 }; -size_t cfg_size, data_size; -void *data =NULL ; -u32 dma_type; -int ret; - - data_size =sizeof (cfg->gtw_cfg.config); - dma_type = t->cfg_ext->copier.dma_type; - node_id.dma_type = dma_type; - -switch (dma_type) { -struct avs_audio_format *fmt; -int direction; - -case AVS_DMA_I2S_LINK_OUTPUT : -case AVS_DMA_I2S_LINK_INPUT : -if (avs_dma_type_is_input (dma_type)) - direction =SNDRV_PCM_STREAM_CAPTURE ; -else - direction =SNDRV_PCM_STREAM_PLAYBACK ; - -if (t->cfg_ext->copier.blob_fmt) - fmt = t->cfg_ext->copier.blob_fmt; -else if (direction ==SNDRV_PCM_STREAM_CAPTURE ) - fmt = t->in_fmt; -else - fmt = t->cfg_ext->copier.out_fmt; - - ep =acpi_nhlt_find_endpoint (ACPI_NHLT_LINKTYPE_SSP , -ACPI_NHLT_DEVICETYPE_CODEC , direction, - t->cfg_ext->copier.vindex.i2s.instance); - ep_blob =acpi_nhlt_endpoint_find_fmtcfg (ep, fmt->num_channels, fmt->sampling_freq, - fmt->valid_bit_depth, fmt->bit_depth); -if (!ep_blob) { -dev_err (adev->dev,"no I2S ep_blob found\n" ); -return -ENOENT ; - } - - data = ep_blob->config.capabilities; - data_size = ep_blob->config.capabilities_size; -/* I2S gateway's vindex is statically assigned in topology */ - node_id.vindex = t->cfg_ext->copier.vindex.val; - -break ; - -case AVS_DMA_DMIC_LINK_INPUT : - direction =SNDRV_PCM_STREAM_CAPTURE ; - -if (t->cfg_ext->copier.blob_fmt) - fmt = t->cfg_ext->copier.blob_fmt; -else - fmt = t->in_fmt; - - ep =acpi_nhlt_find_endpoint (ACPI_NHLT_LINKTYPE_PDM ,-1 , direction,0 ); - ep_blob =acpi_nhlt_endpoint_find_fmtcfg (ep, fmt->num_channels, fmt->sampling_freq, - fmt->valid_bit_depth, fmt->bit_depth); -if (!ep_blob) { -dev_err (adev->dev,"no DMIC ep_blob found\n" ); -return -ENOENT ; - } - - data = ep_blob->config.capabilities; - data_size = ep_blob->config.capabilities_size; -/* DMIC gateway's vindex is statically assigned in topology */ - node_id.vindex = t->cfg_ext->copier.vindex.val; - -break ; - -case AVS_DMA_HDA_HOST_OUTPUT : -case AVS_DMA_HDA_HOST_INPUT : -/* HOST gateway's vindex is dynamically assigned with DMA id */ - node_id.vindex = mod->owner->owner->dma_id; -break ; - -case AVS_DMA_HDA_LINK_OUTPUT : -case AVS_DMA_HDA_LINK_INPUT : - node_id.vindex = t->cfg_ext->copier.vindex.val | - mod->owner->owner->dma_id; -break ; - -case INVALID_OBJECT_ID : -default : - node_id =INVALID_NODE_ID ; -break ; - } - - cfg_size = offsetof(struct avs_copier_cfg, gtw_cfg.config) + data_size; -if (cfg_size >AVS_MAILBOX_SIZE ) -return -EINVAL ; - - cfg = adev->modcfg_buf; -memset (cfg,0 , cfg_size); - cfg->base.cpc = t->cfg_base->cpc; - cfg->base.ibs = t->cfg_base->ibs; - cfg->base.obs = t->cfg_base->obs; - cfg->base.is_pages = t->cfg_base->is_pages; - cfg->base.audio_fmt = *t->in_fmt; - cfg->out_fmt = *t->cfg_ext->copier.out_fmt; - cfg->feature_mask = t->cfg_ext->copier.feature_mask; - cfg->gtw_cfg.node_id = node_id; - cfg->gtw_cfg.dma_buffer_size = t->cfg_ext->copier.dma_buffer_size; -/* config_length in DWORDs */ - cfg->gtw_cfg.config_length =DIV_ROUND_UP (data_size,4 ); -if (data) -memcpy (&cfg->gtw_cfg.config.blob, data, data_size); - - mod->gtw_attrs = cfg->gtw_cfg.config.attrs; - - ret =avs_dsp_init_module (adev, mod->module_id, mod->owner->instance_id, - t->core_id, t->domain, cfg, cfg_size, - &mod->instance_id); -return ret; -} -static struct avs_control_data *avs_get_module_control (struct avs_path_module *mod) {struct avs_tplg_module *t = mod->template;
sound/soc/intel/avs/topology.h +0 -2
@@ -74,8 +74,6 @@ struct avs_tplg_modcfg_ext {union avs_virtual_index vindex;u32 dma_type;u32 dma_buffer_size; -u32 config_length; -/* config_data part of priv data */ } copier;struct {u32 out_channel_config;
Signature · 1 line
2.25.1
Cezary Rojewski
maintainerPATCH v3 10/11 ASoC: Intel: avs: Add WHM module support
In reply to Cezary RojewskiWovHostModule (WHM) is used in wake-on-voice scenarios to optimize power consumption. It combines capabilities of Copier, KeyPhraseBuffer, WakeOnVoice and Muxer modules.
--- include/uapi/sound/intel/avs/tokens.h | 7 +++++ sound/soc/intel/avs/messages.h | 13 +++++++++ sound/soc/intel/avs/path.c | 36 +++++++++++++++++++++++ sound/soc/intel/avs/topology.c | 42 +++++++++++++++++++++++++++ sound/soc/intel/avs/topology.h | 9 ++++++ 5 files changed, 107 insertions(+)
include/uapi/sound/intel/avs/tokens.h +7 -0
@@ -77,6 +77,13 @@ enum avs_tplg_token {AVS_TKN_MODCFG_UPDOWN_MIX_CHAN_MAP_U32 =430 ,AVS_TKN_MODCFG_EXT_NUM_INPUT_PINS_U16 =431 ,AVS_TKN_MODCFG_EXT_NUM_OUTPUT_PINS_U16 =432 , +AVS_TKN_MODCFG_WHM_REF_AFMT_ID_U32 =433 , +AVS_TKN_MODCFG_WHM_OUT_AFMT_ID_U32 =434 , +AVS_TKN_MODCFG_WHM_WAKE_TICK_PERIOD_U32 =435 , +AVS_TKN_MODCFG_WHM_VINDEX_U8 =436 , +AVS_TKN_MODCFG_WHM_DMA_TYPE_U32 =437 , +AVS_TKN_MODCFG_WHM_DMABUFF_SIZE_U32 =438 , +AVS_TKN_MODCFG_WHM_BLOB_AFMT_ID_U32 =439 ,/* struct avs_tplg_pplcfg */ AVS_TKN_PPLCFG_ID_U32 = 1401,
sound/soc/intel/avs/messages.h +13 -0
@@ -652,6 +652,9 @@ int avs_ipc_set_system_time(struct avs_dev *adev);#define AVS_INTELWOV_MOD_UUID \ GUID_INIT(0xEC774FA9, 0x28D3, 0x424A, 0x90, 0xE4, 0x69, 0xF9, 0x84, 0xF1, 0xEE, 0xB7) +#define AVS_WOVHOSTM_MOD_UUID \ + GUID_INIT(0xF9ED62B7, 0x092E, 0x4A90, 0x8F, 0x4D, 0x82, 0xDA, 0xA8, 0xB3, 0x8F, 0x3B) +/* channel map */ enum avs_channel_index {AVS_CHANNEL_LEFT =0 ,
@@ -881,6 +884,16 @@ struct avs_wov_cfg { } __packed;static_assert (sizeof (struct avs_wov_cfg ) ==44 ); +struct avs_whm_cfg { +struct avs_modcfg_base base; +/* Audio format for output pin 0 */ +struct avs_audio_format ref_fmt; +struct avs_audio_format out_fmt; +u32 wake_tick_period; +struct avs_copier_gtw_cfg gtw_cfg; +} __packed; +static_assert (sizeof (struct avs_whm_cfg ) ==108 ); +/* Module runtime parameters */ enum avs_copier_runtime_param {
sound/soc/intel/avs/path.c +36 -0
@@ -265,6 +265,41 @@ static int avs_copier_create(struct avs_dev *adev, struct avs_path_module *mod)return ret; } +static int avs_whm_create (struct avs_dev *adev,struct avs_path_module *mod) +{ +struct avs_tplg_module *t = mod->template; +struct avs_tplg_modcfg_ext *te; +struct avs_whm_cfg *cfg; +size_t cfg_size; +u32 dma_id; +int ret; + + te = t->cfg_ext; + cfg = adev->modcfg_buf; + dma_id = mod->owner->owner->dma_id; + cfg_size = offsetof(struct avs_whm_cfg, gtw_cfg.config); + + ret =avs_fill_gtw_config (adev, &cfg->gtw_cfg, t, &cfg_size); +if (ret) +return ret; + + cfg->base.cpc = t->cfg_base->cpc; + cfg->base.ibs = t->cfg_base->ibs; + cfg->base.obs = t->cfg_base->obs; + cfg->base.is_pages = t->cfg_base->is_pages; + cfg->base.audio_fmt = *t->in_fmt; + cfg->ref_fmt = *te->whm.ref_fmt; + cfg->out_fmt = *te->whm.out_fmt; + cfg->wake_tick_period = te->whm.wake_tick_period; +avs_init_node_id (&cfg->gtw_cfg.node_id, te, dma_id); + cfg->gtw_cfg.dma_buffer_size = te->whm.dma_buffer_size; + mod->gtw_attrs = cfg->gtw_cfg.config.attrs; + + ret =avs_dsp_init_module (adev, mod->module_id, mod->owner->instance_id, t->core_id, + t->domain, cfg, cfg_size, &mod->instance_id); +return ret; +} +static struct avs_control_data *avs_get_module_control (struct avs_path_module *mod) {struct avs_tplg_module *t = mod->template;
@@ -536,6 +571,7 @@ static struct avs_module_create avs_module_create[] = { { &AVS_ASRC_MOD_UUID, avs_asrc_create }, { &AVS_INTELWOV_MOD_UUID, avs_wov_create }, { &AVS_PROBE_MOD_UUID, avs_probe_create }, + { &AVS_WOVHOSTM_MOD_UUID, avs_whm_create }, };static int avs_path_module_type_create (struct avs_dev *adev,struct avs_path_module *mod)
sound/soc/intel/avs/topology.c +42 -0
48 lines not on this page · raw message
sound/soc/intel/avs/topology.h +9 -0
@@ -75,6 +75,15 @@ struct avs_tplg_modcfg_ext {u32 dma_type;u32 dma_buffer_size; } copier; +struct { +struct avs_audio_format *ref_fmt; +struct avs_audio_format *out_fmt; +u32 wake_tick_period; +union avs_virtual_index vindex; +u32 dma_type; +u32 dma_buffer_size; +struct avs_audio_format *blob_fmt;/* optional override */ + } whm;struct {u32 out_channel_config;u32 coefficients_select;
Signature · 1 line
2.25.1
Cezary Rojewski
maintainerPATCH v3 11/11 ALSA: hda: Select avs-driver by default on MBL
In reply to Cezary RojewskiThe avs-driver is the recommended solution for MalibouLake (MBL, also known as RPL-M) platform.
--- sound/hda/intel-dsp-config.c | 4 ++++ 1 file changed, 4 insertions(+)
sound/hda/intel-dsp-config.c +4 -0
@@ -108,6 +108,10 @@ static const struct config_entry config_table[] = { {} } }, + { + .flags = FLAG_SST, + .device = PCI_DEVICE_ID_INTEL_HDA_RPL_M, + }, #endif#if IS_ENABLED (CONFIG_SND_SOC_SOF_APOLLOLAKE ) {
Signature · 1 line
2.25.1
Mark Brown
maintainerQuoted 9 lines · Cezary Rojewski
The avs-driver is the go-to driver for Intel Automotive. MalibouLake (MBL) and RedondoLake (RDL) are representatives of the project. These inherit majority of the featureset from RaptorLake-M (RPL-M) and AlderLake-N (ADL-N) respectively. The onboard codec for these is TI's pcm3168a.
In summary, the patchset:
[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[01/11] ASoC: codecs: pcm3168a: Add ACPI match table
commit: dc561ab16d8be9cbe8f07a49a7b2f5428fbcfeea
[02/11] ASoC: codecs: pcm3168a: Relax probing conditions
commit: e92f042642aed6f6206caace892d9df2d0166841
[03/11] ASoC: codecs: pcm3168a: Allow for 24-bit in provider mode
commit: 7d92a38d67e5d937b64b20aa4fd14451ee1772f3
[04/11] ASoC: Intel: avs: Add pcm3168a machine board
commit: 79ebb596201c86712fe38b0ef73d25d07b932664
[05/11] ASoC: Intel: avs: pcm3168a board selection
commit: b9fb91692af881736f8fa1741fa0dbadf07d99ee
[06/11] ASoC: Intel: avs: Move DSP-boot steps into individual functions
commit: e995c51903384be1c7aead246dc30cb5244179ac
[07/11] ASoC: Intel: avs: Configure basefw on TGL-based platforms
commit: cbe37a4d2b3c25d2e2a94097e09b6d87461b8833
[08/11] ASoC: Intel: avs: New gateway configuration mechanism
commit: f0173cbe7fa79eafbdf32eed32337209f84ddacd
[09/11] ASoC: Intel: avs: Remove unused gateway configuration code
commit: 320155a61f7fc810a915644e9e2a451bdcea90b1
[10/11] ASoC: Intel: avs: Add WHM module support
commit: 4343af66b8e1df1d3a2e6f1f8612506cb45b2afd
[11/11] ALSA: hda: Select avs-driver by default on MBL
commit: 856366dc924a9561dae39f252b45dfd6cc6895ceAll 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