The goal of this patchset is to enhance existing interface of NonHDAudioLinkTable (NHLT), that is, accessing device and format configuration spaces as well as adding query functions for finding specific endpoints and format configurations. Once that is done, existing sound-drivers can move from utilizing sound/hda/intel-nhlt.c to this very code and ultimately the former file can be removed. It's important to highlight that currently presented implementation is not final and intention is to first transfer sound-driver to new API and then provide incremental updates to internal code in drivers/acpi/nhlt.c to improve reliability and safety. Series starts with addition of devcfg-access helpers. The main reasoning for adding access function is inability for a user to predict whether given space (device config) is valid or not. While inheritance in the specification is allowed, e.g.: mic_devcfg being inherited by mic_vendor_devcfg, until size is verified, one shall not be accessing fields which are not guaranteed by the spec. The only field guaranteed is "capabilities_size". The xxx_devcfg structs added here kind of duplicate few existing ones in actbl2.h. This is mainly motivated by usage improvements - simplicity, shorten wording. Intention is to have them replacing existing actbl2.h members in the future. Follow up is the declaration of acpi_gbl_NHLT. Motivation is to make sound-drivers life easier i.e.: release them from storing pointer to the first NHLT in the system internally. Such drivers may utilize acpi_gbl_NHLT when querying endpoints and formats instead. Table manipulation functions and macros serve as a base for the follow-up query functions. So called query functions represent standard operations performed by user (a sound driver) when attempting to open an audio stream. These more or less mimic what's present in sound/hda/intel-nhlt.c. Changes in v3: - uncapitalized acpi_gbl_NHLT - fixed compilation problems when CONFIG_ACPI_NHLT is disabled - dropped Reviewed-by tags in the 2/4 patch due to above, those were not one-line changes Changes in v2: - minor wording improvements in kernel-doc for patch 3/4 - dropped parentheses around loop cursors in for_each_nhlt_*() macros - readability improvements in compound if-statements within query functions - dropped NULL-checks in query functions Cezary Rojewski (4): ACPI: NHLT: Device configuration access interface ACPI: NHLT: Introduce acpi_gbl_nhlt ACPI: NHLT: Table manipulation helpers ACPI: NHLT: Add query functions drivers/acpi/Kconfig | 3 + drivers/acpi/Makefile | 1 + drivers/acpi/nhlt.c | 221 ++++++++++++++++++++++++++++++++++++++++++ include/acpi/actbl2.h | 28 ++++++ include/acpi/nhlt.h | 212 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 465 insertions(+) create mode 100644 drivers/acpi/nhlt.c create mode 100644 include/acpi/nhlt.h -- 2.25.1