[PATCH 0/2] ALSA: hda: intel-sdw-acpi: fix controller detection
The SoundWire-related information provided by platform firmware (DSDT) hasn't changed since 2016, but with a recent change of device hierarchy we need to change how the controller is detected.
These patches were tested on existing devices and don't break anything, but are very much needed for newer devices (quirks already in Linus' branch for 5.16, see e.g. commit f55af7055cd4 ("ASoC: Intel: sof_sdw: Add support for SKU 0B12 product"). Unfortunately the BIOS changes happened *after* the initial patches were contributed.
Libin Yang (2): ALSA: hda: intel-sdw-acpi: harden detection of controller ALSA: hda: intel-sdw-acpi: go through HDAS ACPI at max depth of 2
sound/hda/intel-sdw-acpi.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
From: Libin Yang libin.yang@intel.com
The existing code currently sets a pointer to an ACPI handle before checking that it's actually a SoundWire controller. This can lead to issues where the graph walk continues and eventually fails, but the pointer was set already.
This patch changes the logic so that the information provided to the caller is set when a controller is found.
Reviewed-by: Péter Ujfalusi peter.ujfalusi@linux.intel.com Signed-off-by: Libin Yang libin.yang@intel.com Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com --- sound/hda/intel-sdw-acpi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/sound/hda/intel-sdw-acpi.c b/sound/hda/intel-sdw-acpi.c index c0123bc31c0d..ba8a872a2901 100644 --- a/sound/hda/intel-sdw-acpi.c +++ b/sound/hda/intel-sdw-acpi.c @@ -132,8 +132,6 @@ static acpi_status sdw_intel_acpi_cb(acpi_handle handle, u32 level, return AE_NOT_FOUND; }
- info->handle = handle; - /* * On some Intel platforms, multiple children of the HDAS * device can be found, but only one of them is the SoundWire @@ -144,6 +142,9 @@ static acpi_status sdw_intel_acpi_cb(acpi_handle handle, u32 level, if (FIELD_GET(GENMASK(31, 28), adr) != SDW_LINK_TYPE) return AE_OK; /* keep going */
+ /* found the correct SoundWire controller */ + info->handle = handle; + /* device found, stop namespace walk */ return AE_CTRL_TERMINATE; }
From: Libin Yang libin.yang@intel.com
In the HDAS ACPI scope, the SoundWire may not be the direct child of HDAS. It needs to go through the ACPI table at max depth of 2 to find the SoundWire device from HDAS.
Reviewed-by: Péter Ujfalusi peter.ujfalusi@linux.intel.com Signed-off-by: Libin Yang libin.yang@intel.com Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com --- sound/hda/intel-sdw-acpi.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/sound/hda/intel-sdw-acpi.c b/sound/hda/intel-sdw-acpi.c index ba8a872a2901..b7758dbe2371 100644 --- a/sound/hda/intel-sdw-acpi.c +++ b/sound/hda/intel-sdw-acpi.c @@ -165,8 +165,14 @@ int sdw_intel_acpi_scan(acpi_handle *parent_handle, acpi_status status;
info->handle = NULL; + /* + * In the HDAS ACPI scope, 'SNDW' may be either the child of + * 'HDAS' or the grandchild of 'HDAS'. So let's go through + * the ACPI from 'HDAS' at max depth of 2 to find the 'SNDW' + * device. + */ status = acpi_walk_namespace(ACPI_TYPE_DEVICE, - parent_handle, 1, + parent_handle, 2, sdw_intel_acpi_cb, NULL, info, NULL); if (ACPI_FAILURE(status) || info->handle == NULL)
On Wed, 15 Dec 2021 17:56:30 +0100, Pierre-Louis Bossart wrote:
The SoundWire-related information provided by platform firmware (DSDT) hasn't changed since 2016, but with a recent change of device hierarchy we need to change how the controller is detected.
These patches were tested on existing devices and don't break anything, but are very much needed for newer devices (quirks already in Linus' branch for 5.16, see e.g. commit f55af7055cd4 ("ASoC: Intel: sof_sdw: Add support for SKU 0B12 product"). Unfortunately the BIOS changes happened *after* the initial patches were contributed.
Libin Yang (2): ALSA: hda: intel-sdw-acpi: harden detection of controller ALSA: hda: intel-sdw-acpi: go through HDAS ACPI at max depth of 2
Sorry, this was delayed due to my vacation, and now I merged the submissions from Bard, which should be identical.
Takashi
participants (2)
-
Pierre-Louis Bossart
-
Takashi Iwai