Commit 40751808 authored by Mark Brown's avatar Mark Brown

ACPI/ALSA/soundwire: add acpi_get_local_u64_address()

Merge series from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>:

The acpi_get_local_address() helper assumes a 32-bit ADR is used. If
we want to use this helper for SoundWire/SDCA ASoC codecs, we need an
extension where the native 64-bits are used. This patchset suggests a
new helper, acpi_get_local_address() may be renamed if desired in a
folow-up patch.

The path of least resistance would be to merge this patchset in the
ASoC tree, since I have additional changes for ASoC/SDCA (SoundWire
Device Class) that depend on the new helper.

Pierre-Louis Bossart (3):
  ACPI: utils: introduce acpi_get_local_u64_address()
  soundwire: slave: simplify code with acpi_get_local_u64_address()
  ALSA: hda: intel-sdw-acpi: use acpi_get_local_u64_address()

 drivers/acpi/utils.c       | 22 ++++++++++++++++------
 drivers/soundwire/slave.c  | 13 ++++---------
 include/linux/acpi.h       |  1 +
 sound/hda/intel-sdw-acpi.c |  6 +++---
 4 files changed, 24 insertions(+), 18 deletions(-)

--
2.43.0
parents cb0ab640 9b7dc68e
......@@ -277,15 +277,25 @@ acpi_evaluate_integer(acpi_handle handle,
EXPORT_SYMBOL(acpi_evaluate_integer);
int acpi_get_local_address(acpi_handle handle, u32 *addr)
int acpi_get_local_u64_address(acpi_handle handle, u64 *addr)
{
unsigned long long adr;
acpi_status status;
status = acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL, &adr);
status = acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL, addr);
if (ACPI_FAILURE(status))
return -ENODATA;
return 0;
}
EXPORT_SYMBOL(acpi_get_local_u64_address);
int acpi_get_local_address(acpi_handle handle, u32 *addr)
{
u64 adr;
int ret;
ret = acpi_get_local_u64_address(handle, &adr);
if (ret < 0)
return ret;
*addr = (u32)adr;
return 0;
}
......
......@@ -97,18 +97,13 @@ static bool find_slave(struct sdw_bus *bus,
struct acpi_device *adev,
struct sdw_slave_id *id)
{
u64 addr;
unsigned int link_id;
acpi_status status;
status = acpi_evaluate_integer(adev->handle,
METHOD_NAME__ADR, NULL, &addr);
u64 addr;
int ret;
if (ACPI_FAILURE(status)) {
dev_err(bus->dev, "_ADR resolution failed: %x\n",
status);
ret = acpi_get_local_u64_address(adev->handle, &addr);
if (ret < 0)
return false;
}
if (bus->ops->override_adr)
addr = bus->ops->override_adr(bus, addr);
......
......@@ -761,6 +761,7 @@ static inline u64 acpi_arch_get_root_pointer(void)
}
#endif
int acpi_get_local_u64_address(acpi_handle handle, u64 *addr);
int acpi_get_local_address(acpi_handle handle, u32 *addr);
const char *acpi_get_subsystem_id(acpi_handle handle);
......
......@@ -125,11 +125,11 @@ static acpi_status sdw_intel_acpi_cb(acpi_handle handle, u32 level,
void *cdata, void **return_value)
{
struct sdw_intel_acpi_info *info = cdata;
acpi_status status;
u64 adr;
int ret;
status = acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL, &adr);
if (ACPI_FAILURE(status))
ret = acpi_get_local_u64_address(handle, &adr);
if (ret < 0)
return AE_OK; /* keep going */
if (!acpi_fetch_acpi_dev(handle)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment