]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
ASoC: Intel: common: filter ACPI devices with _STA return value
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Fri, 4 Mar 2016 03:36:34 +0000 (21:36 -0600)
committerMark Brown <broonie@kernel.org>
Sat, 5 Mar 2016 04:05:18 +0000 (13:05 +0900)
BIOS vendors typically list multiple audio codecs in the DSDT
table and enable the relevant one by changing the return value
of the _STA method.

With the current code, all devices are reported by
acpi_dev_present(), regardless of the _STA return values. This
causes errors on probe with the wrong machine driver being loaded.

This patch essentially reverts 'commit 6f08cbdaac5a
("ASoC: Intel: Use acpi_dev_present()")' and adds code to
force the evaluation of the _STA method.

A better solution might be to make sure the ACPI subsystem only
reports devices with a _STA value of 0xf but apparently it's
problematic so dealing with this in the audio subsystem directly.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/intel/common/sst-match-acpi.c

index c429e2226d401ee29a8c4fc4b2ba474f0f3fe699..cf2c27cd865197d2dcb6806db4c7e9c299fb87d3 100644 (file)
 
 #include "sst-acpi.h"
 
+static acpi_status sst_acpi_mach_match(acpi_handle handle, u32 level,
+                                      void *context, void **ret)
+{
+       unsigned long long sta;
+       acpi_status status;
+
+       *(bool *)context = true;
+       status = acpi_evaluate_integer(handle, "_STA", NULL, &sta);
+       if (ACPI_FAILURE(status) || !(sta & ACPI_STA_DEVICE_PRESENT))
+               *(bool *)context = false;
+
+       return AE_OK;
+}
+
 struct sst_acpi_mach *sst_acpi_find_machine(struct sst_acpi_mach *machines)
 {
        struct sst_acpi_mach *mach;
+       bool found = false;
 
        for (mach = machines; mach->id[0]; mach++)
-               if (acpi_dev_present(mach->id))
+               if (ACPI_SUCCESS(acpi_get_devices(mach->id,
+                                                 sst_acpi_mach_match,
+                                                 &found, NULL)) && found)
                        return mach;
-
        return NULL;
 }
 EXPORT_SYMBOL_GPL(sst_acpi_find_machine);