Skip to content

ASoC: SOF: ipc4: support runtime codec capability discovery - #6044

Draft
lgirdwood wants to merge 1 commit into
thesofproject:topic/sof-devfrom
lgirdwood:topic/sof-runtime-codec-info
Draft

lgirdwood wants to merge 1 commit into
thesofproject:topic/sof-devfrom
lgirdwood:topic/sof-runtime-codec-info

Conversation

@lgirdwood

Copy link
Copy Markdown
Member

Summary

Upgrade IPC4 firmware codec capability discovery in the Linux SOF host driver to query runtime codec information via SOF_IPC4_FW_PARAM_SOF_INFO_GET (37) as LLEXT libraries are loaded or reloaded, while retaining boot-time FW_CONFIG (SOF_IPC4_SOF_CODEC_INFO) fallback for backwards compatibility with older firmware.

Companion SOF firmware PR: thesofproject/sof#11472

Changes

  • include/sound/sof/ipc4/header.h: Added SOF_IPC4_FW_PARAM_SOF_INFO_GET = 37, SOF_IPC4_SOF_CAPS = 1, and SOF_IPC4_SOF_CAP_RUNTIME_SOF_INFO.
  • sound/soc/sof/ipc4-priv.h & sound/soc/sof/ipc4.c: Added codec_info_mutex (protecting runtime replacement and compress reads of ipc4_data->codec_info, freed in sof_ipc4_exit()) and sof_info_runtime_supported.
  • sound/soc/sof/ipc4-loader.c:
    • Updated sof_ipc4_parse_sof_info() with TLV bounds validation, SOF_IPC4_SOF_CAPS capability parsing, and mutex-protected replacement of ipc4_data->codec_info.
    • Added sof_ipc4_query_sof_info() to fetch updated TLVs via SOF_IPC4_FW_PARAM_SOF_INFO_GET when sof_info_runtime_supported is advertised, invoked from sof_ipc4_query_fw_configuration(), sof_ipc4_load_library(), and sof_ipc4_reload_fw_libraries().
  • sound/soc/sof/ipc4-compress.c:
    • Added sof_ipc4_compr_refresh_codec_info() and called it in sof_ipc4_compr_get_caps() and before sof_ipc4_compr_codec_supported() in sof_ipc4_compr_set_params().
    • Protected codec_info accesses with codec_info_mutex and removed the redundant second snd_sof_boot_dsp_firmware() call in sof_ipc4_compr_set_params().

Backwards Compatibility

  • New kernel + older firmware: Firmware without SOF_IPC4_SOF_CAP_RUNTIME_SOF_INFO skips SOF_IPC4_FW_PARAM_SOF_INFO_GET IPCs and uses the SOF_IPC4_SOF_CODEC_INFO tuple parsed from boot-time FW_CONFIG.
  • Older kernel + new firmware: Newer firmware continues emitting SOF_IPC4_SOF_CODEC_INFO during FW_CONFIG, and older kernels ignore SOF_IPC4_SOF_CAPS.

Verification

  • scripts/checkpatch.pl on the commit: 0 errors, 0 warnings.
  • make M=sound/soc/sof compiled cleanly with 0 warnings/errors.
  • Live hardware testing on DSP targets has not yet been run (hence Draft PR).

…cy fallback

Add support for runtime IPC4 SOF info discovery via
SOF_IPC4_FW_PARAM_SOF_INFO_GET (37) gated by the SOF_IPC4_SOF_CAPS
capability bit SOF_IPC4_SOF_CAP_RUNTIME_SOF_INFO:

- Protect cached firmware codec_info with codec_info_mutex across loader
  updates and compress capability queries.
- Query SOF info TLVs after firmware boot, on LLEXT library load/reload,
  and before compress capability/parameter checks when the firmware
  advertises SOF_IPC4_SOF_CAP_RUNTIME_SOF_INFO.
- Preserve boot-time FW_CONFIG SOF_IPC4_SOF_CODEC_INFO parsing so newer
  kernels work seamlessly with older firmware that does not implement
  runtime SOF_INFO queries.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants