Commit 71dce222 authored by Pierre-Louis Bossart's avatar Pierre-Louis Bossart Committed by Takashi Iwai

ALSA/hda: intel-sdw-acpi: add support for sdw-manager-list property read

The DisCo for SoundWire 2.0 spec adds support for a new
sdw-manager-list property.  Add it in backwards-compatible mode with
'sdw-master-count', which assumed that all links between 0..count-1
exist.
Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: default avatarBard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20241001070611.63288-5-yung-chuan.liao@linux.intel.com
parent 8782ba96
...@@ -227,7 +227,7 @@ struct sdw_intel_ops { ...@@ -227,7 +227,7 @@ struct sdw_intel_ops {
/** /**
* struct sdw_intel_acpi_info - Soundwire Intel information found in ACPI tables * struct sdw_intel_acpi_info - Soundwire Intel information found in ACPI tables
* @handle: ACPI controller handle * @handle: ACPI controller handle
* @count: link count found with "sdw-master-count" property * @count: link count found with "sdw-master-count" or "sdw-manager-list" property
* @link_mask: bit-wise mask listing links enabled by BIOS menu * @link_mask: bit-wise mask listing links enabled by BIOS menu
* *
* this structure could be expanded to e.g. provide all the _ADR * this structure could be expanded to e.g. provide all the _ADR
......
...@@ -57,8 +57,10 @@ sdw_intel_scan_controller(struct sdw_intel_acpi_info *info) ...@@ -57,8 +57,10 @@ sdw_intel_scan_controller(struct sdw_intel_acpi_info *info)
{ {
struct acpi_device *adev = acpi_fetch_acpi_dev(info->handle); struct acpi_device *adev = acpi_fetch_acpi_dev(info->handle);
struct fwnode_handle *fwnode; struct fwnode_handle *fwnode;
unsigned long list;
unsigned int i; unsigned int i;
u32 count; u32 count;
u32 tmp;
int ret; int ret;
if (!adev) if (!adev)
...@@ -66,10 +68,9 @@ sdw_intel_scan_controller(struct sdw_intel_acpi_info *info) ...@@ -66,10 +68,9 @@ sdw_intel_scan_controller(struct sdw_intel_acpi_info *info)
fwnode = acpi_fwnode_handle(adev); fwnode = acpi_fwnode_handle(adev);
/* Found controller, find links supported */
ret = fwnode_property_read_u32(fwnode, "mipi-sdw-master-count", &count);
/* /*
* Found controller, find links supported
*
* In theory we could check the number of links supported in * In theory we could check the number of links supported in
* hardware, but in that step we cannot assume SoundWire IP is * hardware, but in that step we cannot assume SoundWire IP is
* powered. * powered.
...@@ -80,12 +81,20 @@ sdw_intel_scan_controller(struct sdw_intel_acpi_info *info) ...@@ -80,12 +81,20 @@ sdw_intel_scan_controller(struct sdw_intel_acpi_info *info)
* *
* We will check the hardware capabilities in the startup() step * We will check the hardware capabilities in the startup() step
*/ */
ret = fwnode_property_read_u32(fwnode, "mipi-sdw-manager-list", &tmp);
if (ret) {
ret = fwnode_property_read_u32(fwnode, "mipi-sdw-master-count", &count);
if (ret) { if (ret) {
dev_err(&adev->dev, dev_err(&adev->dev,
"Failed to read mipi-sdw-master-count: %d\n", ret); "Failed to read mipi-sdw-master-count: %d\n",
ret);
return ret; return ret;
} }
list = GENMASK(count - 1, 0);
} else {
list = tmp;
count = hweight32(list);
}
/* Check count is within bounds */ /* Check count is within bounds */
if (count > SDW_INTEL_MAX_LINKS) { if (count > SDW_INTEL_MAX_LINKS) {
...@@ -103,7 +112,7 @@ sdw_intel_scan_controller(struct sdw_intel_acpi_info *info) ...@@ -103,7 +112,7 @@ sdw_intel_scan_controller(struct sdw_intel_acpi_info *info)
info->count = count; info->count = count;
info->link_mask = 0; info->link_mask = 0;
for (i = 0; i < count; i++) { for_each_set_bit(i, &list, SDW_INTEL_MAX_LINKS) {
if (ctrl_link_mask && !(ctrl_link_mask & BIT(i))) { if (ctrl_link_mask && !(ctrl_link_mask & BIT(i))) {
dev_dbg(&adev->dev, dev_dbg(&adev->dev,
"Link %d masked, will not be enabled\n", i); "Link %d masked, will not be enabled\n", i);
......
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