From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> To: alsa-devel@alsa-project.org Cc: linux-kernel@vger.kernel.org, tiwai@suse.de, broonie@kernel.org, vkoul@kernel.org, gregkh@linuxfoundation.org, jank@cadence.com, srinivas.kandagatla@linaro.org, Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>, Sanyog Kale <sanyog.r.kale@intel.com> Subject: [PATCH v2 01/15] soundwire: intel: filter SoundWire controller device search Date: Wed, 22 May 2019 14:47:17 -0500 [thread overview] Message-ID: <20190522194732.25704-2-pierre-louis.bossart@linux.intel.com> (raw) In-Reply-To: <20190522194732.25704-1-pierre-louis.bossart@linux.intel.com> The convention is that the SoundWire controller device is a child of the HDAudio controller. However there can be more than one child exposed in the DSDT table, and the current namespace walk returns the last (incorrect) device. Intel documentation states that bits 28..31 of the _ADR field represent the link type, with SoundWire assigned the value 4. Add a filter and terminate early when a valid _ADR is provided, otherwise keep iterating to find the next child. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> --- drivers/soundwire/intel_init.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/drivers/soundwire/intel_init.c b/drivers/soundwire/intel_init.c index d3d6b54c5791..771a53a5c033 100644 --- a/drivers/soundwire/intel_init.c +++ b/drivers/soundwire/intel_init.c @@ -14,6 +14,7 @@ #include <linux/soundwire/sdw_intel.h> #include "intel.h" +#define SDW_LINK_TYPE 4 /* from Intel ACPI documentation */ #define SDW_MAX_LINKS 4 #define SDW_SHIM_LCAP 0x0 #define SDW_SHIM_BASE 0x2C000 @@ -150,6 +151,12 @@ static acpi_status sdw_intel_acpi_cb(acpi_handle handle, u32 level, { struct sdw_intel_res *res = cdata; struct acpi_device *adev; + acpi_status status; + u64 adr; + + status = acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL, &adr); + if (ACPI_FAILURE(status)) + return AE_OK; /* keep going */ if (acpi_bus_get_device(handle, &adev)) { pr_err("%s: Couldn't find ACPI handle\n", __func__); @@ -157,7 +164,19 @@ static acpi_status sdw_intel_acpi_cb(acpi_handle handle, u32 level, } res->handle = handle; - return AE_OK; + + /* + * On some Intel platforms, multiple children of the HDAS + * device can be found, but only one of them is the SoundWire + * controller. The SNDW device is always exposed with + * Name(_ADR, 0x40000000), with bits 31..28 representing the + * SoundWire link so filter accordingly + */ + if ((adr & GENMASK(31, 28)) >> 28 != SDW_LINK_TYPE) + return AE_OK; /* keep going */ + + /* device found, stop namespace walk */ + return AE_CTRL_TERMINATE; } /** -- 2.20.1
WARNING: multiple messages have this Message-ID (diff)
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> To: alsa-devel@alsa-project.org Cc: tiwai@suse.de, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>, vkoul@kernel.org, broonie@kernel.org, srinivas.kandagatla@linaro.org, jank@cadence.com, Sanyog Kale <sanyog.r.kale@intel.com> Subject: [PATCH v2 01/15] soundwire: intel: filter SoundWire controller device search Date: Wed, 22 May 2019 14:47:17 -0500 [thread overview] Message-ID: <20190522194732.25704-2-pierre-louis.bossart@linux.intel.com> (raw) In-Reply-To: <20190522194732.25704-1-pierre-louis.bossart@linux.intel.com> The convention is that the SoundWire controller device is a child of the HDAudio controller. However there can be more than one child exposed in the DSDT table, and the current namespace walk returns the last (incorrect) device. Intel documentation states that bits 28..31 of the _ADR field represent the link type, with SoundWire assigned the value 4. Add a filter and terminate early when a valid _ADR is provided, otherwise keep iterating to find the next child. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> --- drivers/soundwire/intel_init.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/drivers/soundwire/intel_init.c b/drivers/soundwire/intel_init.c index d3d6b54c5791..771a53a5c033 100644 --- a/drivers/soundwire/intel_init.c +++ b/drivers/soundwire/intel_init.c @@ -14,6 +14,7 @@ #include <linux/soundwire/sdw_intel.h> #include "intel.h" +#define SDW_LINK_TYPE 4 /* from Intel ACPI documentation */ #define SDW_MAX_LINKS 4 #define SDW_SHIM_LCAP 0x0 #define SDW_SHIM_BASE 0x2C000 @@ -150,6 +151,12 @@ static acpi_status sdw_intel_acpi_cb(acpi_handle handle, u32 level, { struct sdw_intel_res *res = cdata; struct acpi_device *adev; + acpi_status status; + u64 adr; + + status = acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL, &adr); + if (ACPI_FAILURE(status)) + return AE_OK; /* keep going */ if (acpi_bus_get_device(handle, &adev)) { pr_err("%s: Couldn't find ACPI handle\n", __func__); @@ -157,7 +164,19 @@ static acpi_status sdw_intel_acpi_cb(acpi_handle handle, u32 level, } res->handle = handle; - return AE_OK; + + /* + * On some Intel platforms, multiple children of the HDAS + * device can be found, but only one of them is the SoundWire + * controller. The SNDW device is always exposed with + * Name(_ADR, 0x40000000), with bits 31..28 representing the + * SoundWire link so filter accordingly + */ + if ((adr & GENMASK(31, 28)) >> 28 != SDW_LINK_TYPE) + return AE_OK; /* keep going */ + + /* device found, stop namespace walk */ + return AE_CTRL_TERMINATE; } /** -- 2.20.1
next prev parent reply other threads:[~2019-05-22 19:48 UTC|newest] Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-05-22 19:47 [PATCH v2 00/15] soundwire: corrections to ACPI/DisCo/Intel support Pierre-Louis Bossart 2019-05-22 19:47 ` Pierre-Louis Bossart [this message] 2019-05-22 19:47 ` [PATCH v2 01/15] soundwire: intel: filter SoundWire controller device search Pierre-Louis Bossart 2019-05-22 19:47 ` [PATCH v2 02/15] soundwire: mipi_disco: fix master/link error Pierre-Louis Bossart 2019-05-22 19:47 ` [PATCH v2 03/15] soundwire: add port-related definitions Pierre-Louis Bossart 2019-05-22 19:47 ` [PATCH v2 04/15] soundwire: remove master data port properties Pierre-Louis Bossart 2019-05-22 19:47 ` [PATCH v2 05/15] soundwire: mipi-disco: remove master_count property for masters Pierre-Louis Bossart 2019-05-22 19:47 ` [PATCH v2 06/15] soundwire: rename 'freq' fields Pierre-Louis Bossart 2019-05-22 19:47 ` [PATCH v2 07/15] soundwire: mipi-disco: fix clock stop modes Pierre-Louis Bossart 2019-05-22 19:47 ` [PATCH v2 08/15] soundwire: clarify comment Pierre-Louis Bossart 2019-05-22 19:47 ` [PATCH v2 09/15] soundwire: rename/clarify MIPI DisCo properties Pierre-Louis Bossart 2019-05-22 19:47 ` [PATCH v2 10/15] soundwire: cadence_master: use rate_limited dynamic debug Pierre-Louis Bossart 2019-05-22 19:47 ` [PATCH v2 11/15] soundwire: cadence_master: log Slave status mask on errors Pierre-Louis Bossart 2019-05-22 19:47 ` [PATCH v2 12/15] soundwire: cadence_master: check the number of bidir PDIs Pierre-Louis Bossart 2019-05-22 19:47 ` [PATCH v2 13/15] soundwire: Intel: add log for number of PCM and PDM PDIs Pierre-Louis Bossart 2019-05-22 19:47 ` [PATCH v2 14/15] soundwire: fix typo in comments Pierre-Louis Bossart 2019-05-22 19:47 ` [PATCH v2 15/15] soundwire: intel_init: add checks on link numbers Pierre-Louis Bossart 2019-05-27 5:23 ` [PATCH v2 00/15] soundwire: corrections to ACPI/DisCo/Intel support Vinod Koul
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=20190522194732.25704-2-pierre-louis.bossart@linux.intel.com \ --to=pierre-louis.bossart@linux.intel.com \ --cc=alsa-devel@alsa-project.org \ --cc=broonie@kernel.org \ --cc=gregkh@linuxfoundation.org \ --cc=jank@cadence.com \ --cc=linux-kernel@vger.kernel.org \ --cc=sanyog.r.kale@intel.com \ --cc=srinivas.kandagatla@linaro.org \ --cc=tiwai@suse.de \ --cc=vkoul@kernel.org \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.