Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: Intel: avs: Honor NHLT override when setting up a path

In case topology provides NHLT configuration, use it instead of relying
on the table in ACPI tree. Only gateway-related modules e.g.: Copier
care about the process. For those the order of fetching for hardware
configuration becomes:

1) check if NHLT override is set,
2) check if NHLT descriptor override is set,
3) use NHLT from ACPI directly

Such approach ensures no conflicts exist between 1) and 2) and that 1)
always takes precedence.

Co-developed-by: Amadeusz Sławiński <amade@asmblr.net>
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://patch.msgid.link/20251115180627.3589520-3-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Cezary Rojewski and committed by
Mark Brown
d5c8b790 dd9896d4

+18 -4
+1
include/uapi/sound/intel/avs/tokens.h
··· 125 125 AVS_TKN_MOD_KCONTROL_ID_U32 = 1707, 126 126 AVS_TKN_MOD_INIT_CONFIG_NUM_IDS_U32 = 1708, 127 127 AVS_TKN_MOD_INIT_CONFIG_ID_U32 = 1709, 128 + AVS_TKN_MOD_NHLT_CONFIG_ID_U32 = 1710, 128 129 129 130 /* struct avs_tplg_path_template */ 130 131 AVS_TKN_PATH_TMPL_ID_U32 = 1801,
+9 -4
sound/soc/intel/avs/path.c
··· 210 210 continue; 211 211 } 212 212 213 - blob = avs_nhlt_config_or_default(adev, module_template); 214 - if (IS_ERR(blob)) 215 - continue; 213 + if (!module_template->nhlt_config) { 214 + blob = avs_nhlt_config_or_default(adev, module_template); 215 + if (IS_ERR(blob)) 216 + continue; 217 + } 216 218 217 219 rlist[i] = path_template->fe_fmt->sampling_freq; 218 220 clist[i] = path_template->fe_fmt->num_channels; ··· 384 382 struct acpi_nhlt_config *blob; 385 383 size_t gtw_size; 386 384 387 - blob = avs_nhlt_config_or_default(adev, t); 385 + if (t->nhlt_config) 386 + blob = t->nhlt_config->blob; 387 + else 388 + blob = avs_nhlt_config_or_default(adev, t); 388 389 if (IS_ERR(blob)) 389 390 return PTR_ERR(blob); 390 391
+7
sound/soc/intel/avs/topology.c
··· 350 350 AVS_DEFINE_PTR_PARSER(modcfg_ext, struct avs_tplg_modcfg_ext, modcfgs_ext); 351 351 AVS_DEFINE_PTR_PARSER(pplcfg, struct avs_tplg_pplcfg, pplcfgs); 352 352 AVS_DEFINE_PTR_PARSER(binding, struct avs_tplg_binding, bindings); 353 + AVS_DEFINE_PTR_PARSER(nhlt_config, struct avs_tplg_nhlt_config, nhlt_configs); 353 354 354 355 static int 355 356 parse_audio_format_bitfield(struct snd_soc_component *comp, void *elem, void *object, u32 offset) ··· 1200 1199 .type = SND_SOC_TPLG_TUPLE_TYPE_WORD, 1201 1200 .offset = offsetof(struct avs_tplg_module, num_config_ids), 1202 1201 .parse = avs_parse_byte_token, 1202 + }, 1203 + { 1204 + .token = AVS_TKN_MOD_NHLT_CONFIG_ID_U32, 1205 + .type = SND_SOC_TPLG_TUPLE_TYPE_WORD, 1206 + .offset = offsetof(struct avs_tplg_module, nhlt_config), 1207 + .parse = avs_parse_nhlt_config_ptr, 1203 1208 }, 1204 1209 }; 1205 1210
+1
sound/soc/intel/avs/topology.h
··· 223 223 u32 ctl_id; 224 224 u32 num_config_ids; 225 225 u32 *config_ids; 226 + struct avs_tplg_nhlt_config *nhlt_config; 226 227 227 228 struct avs_tplg_pipeline *owner; 228 229 /* Pipeline modules management. */