alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: alsa-devel@alsa-project.org
Cc: tiwai@suse.de, broonie@kernel.org,
	Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Subject: [PATCH 2/6] ASoC: Intel: common: filter ACPI devices with _STA return value
Date: Thu,  3 Mar 2016 21:36:34 -0600	[thread overview]
Message-ID: <1457062599-10032-3-git-send-email-pierre-louis.bossart@linux.intel.com> (raw)
In-Reply-To: <1457062599-10032-1-git-send-email-pierre-louis.bossart@linux.intel.com>

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>
---
 sound/soc/intel/common/sst-match-acpi.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/sound/soc/intel/common/sst-match-acpi.c b/sound/soc/intel/common/sst-match-acpi.c
index 0b8ee04..7452360 100644
--- a/sound/soc/intel/common/sst-match-acpi.c
+++ b/sound/soc/intel/common/sst-match-acpi.c
@@ -16,14 +16,30 @@
 
 #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);
-- 
1.9.1

  parent reply	other threads:[~2016-03-04  3:36 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-04  3:36 [PATCH 0/6] Support for CherryTrail devices Pierre-Louis Bossart
2016-03-04  3:36 ` [PATCH 1/6] ASoC: Intel: allow for DW_DMAC_CORE as module Pierre-Louis Bossart
2016-03-05  4:03   ` Mark Brown
2016-03-07 17:49     ` Pierre-Louis Bossart
2016-03-09  2:43       ` Mark Brown
2016-03-09 17:06         ` Pierre-Louis Bossart
2016-03-09 17:19           ` Takashi Iwai
2016-03-10  5:45             ` Mark Brown
2016-03-04  3:36 ` Pierre-Louis Bossart [this message]
2016-03-05 12:25   ` Applied "ASoC: Intel: common: filter ACPI devices with _STA return value" to the asoc tree Mark Brown
2016-03-04  3:36 ` [PATCH 2/6] ASoC: Intel: filter ACPI devices based on _STA return value Pierre-Louis Bossart
2016-03-04  3:36 ` [PATCH 3/6] ASoC: Intel: common: add translation from HID to codec-name Pierre-Louis Bossart
2016-03-05 12:25   ` Applied "ASoC: Intel: common: add translation from HID to codec-name" to the asoc tree Mark Brown
2016-03-04  3:36 ` [PATCH 4/6] ASoC: Intel: bytcr_rt5640: change quirk position Pierre-Louis Bossart
2016-03-05 12:25   ` Applied "ASoC: Intel: bytcr_rt5640: change quirk position" to the asoc tree Mark Brown
2016-03-04  3:36 ` [PATCH 5/6] ASoC: Intel: bytcr_rt5640: use HID translation util Pierre-Louis Bossart
2016-03-05 12:25   ` Applied "ASoC: Intel: bytcr_rt5640: use HID translation util" to the asoc tree Mark Brown
2016-03-04  3:36 ` [PATCH 6/6] ASoC: Intel: Atom: add support for CHT w/ RT5640 Pierre-Louis Bossart
2016-03-05 12:24   ` Applied "ASoC: Intel: Atom: add support for CHT w/ RT5640" to the asoc tree Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1457062599-10032-3-git-send-email-pierre-louis.bossart@linux.intel.com \
    --to=pierre-louis.bossart@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).