[PATCH v6 0/4] ACPI: NHLT: Access and query helpers

Cezary Rojewski
2024-03-08T07:30:54Z

The goal of this patchset is to refactor existing interface of
Non HDAudio Link Table (NHLT) table so it becomes useful for the Intel
AudioDSP sound-drivers. Right now the useful duplicate resides in
sound/hda/intel-nhlt.c.

The API takes form of query functions that help access device or
audio-format configuration space. This information can be then utilized
by a sound-driver to perform necessary programming and facilitate
streaming over I2S/PDM interfaces. Once the series is merged, existing
sound-drivers can move from utilizing sound/hda/intel-nhlt.c to this
very code and ultimately the former file can be removed.

Paired with equivalent change on ACPICA [1].

-

Non HDAudio Link Table (NHLT) is designed to separate hardware-related
description (registers) from AudioDSP firmware-related one i.e.:
pipelines and modules that together make up the audio stream on Intel
DSPs. This task is important as same set of hardware registers can be
used with different topologies and vice versa, same topology could be
utilized with different set of hardware. As the hardware registers
description is directly tied to specific platform, intention is to have
such description part of low-level firmware e.g.: BIOS.

The initial design has been provided in early Sky Lake (SKL) days. The
audio architecture goes by the name cAVS. SKL is a representative of
cAVS 1.5. The table helps describe endpoint capabilities ever since.
While Raptor Lake (RPL) is the last of cAVS architecture - cAVS 2.5 to
be precise - its successor, the ACE architecture which begun with
Meteor Lake (MTL) inherited the design for all I2S and PDM
configurations. These two configurations are the primary targets for
NHLT table.

Due to naming conflicts with existing code, several structs are named
'nhlt2' rather than 'nhlt'. Last patch cleans the situation up.

Changes in v6:
- added comments explaining usage of LINKTYPE and DEVICETYPE constants

Changes in v5:
- split find_endpoint/fmtcfg() into tb-less and tb-aware variants.
This is to make API scale with 2+ NHLTs and removes the need for
acpi_gbl_nhlt to be accessible globally.
- acpi_nhlt_device_config now a union that encompasses all device_config
types.

Changes in v4:
- relocated ACPI_NHLT kconfig in the drivers/acpi/Kconfig to a more
relevant area within the file

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

[1]: https://github.com/acpica/acpica/pull/912

Cezary Rojewski (4):
ACPI: NHLT: Reintroduce types the table consists of
ACPI: NHLT: Introduce API for the table
ACPI: NHLT: Drop redundant types
ACPI: NHLT: Streamline struct naming

drivers/acpi/Kconfig | 3 +
drivers/acpi/Makefile | 1 +
drivers/acpi/nhlt.c | 284 +++++++++++++++++++++++++++++++++++++++
include/acpi/actbl2.h | 299 +++++++++++++++++-------------------------
include/acpi/nhlt.h | 180 +++++++++++++++++++++++++
5 files changed, 585 insertions(+), 182 deletions(-)
create mode 100644 drivers/acpi/nhlt.c
create mode 100644 include/acpi/nhlt.h

--
2.25.1