Skip to content

Commit 71dce22

Browse files
plbossarttiwai
authored andcommitted
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: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/20241001070611.63288-5-yung-chuan.liao@linux.intel.com
1 parent 8782ba9 commit 71dce22

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

include/linux/soundwire/sdw_intel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ struct sdw_intel_ops {
227227
/**
228228
* struct sdw_intel_acpi_info - Soundwire Intel information found in ACPI tables
229229
* @handle: ACPI controller handle
230-
* @count: link count found with "sdw-master-count" property
230+
* @count: link count found with "sdw-master-count" or "sdw-manager-list" property
231231
* @link_mask: bit-wise mask listing links enabled by BIOS menu
232232
*
233233
* this structure could be expanded to e.g. provide all the _ADR

sound/hda/intel-sdw-acpi.c

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,20 @@ sdw_intel_scan_controller(struct sdw_intel_acpi_info *info)
5757
{
5858
struct acpi_device *adev = acpi_fetch_acpi_dev(info->handle);
5959
struct fwnode_handle *fwnode;
60+
unsigned long list;
6061
unsigned int i;
6162
u32 count;
63+
u32 tmp;
6264
int ret;
6365

6466
if (!adev)
6567
return -EINVAL;
6668

6769
fwnode = acpi_fwnode_handle(adev);
6870

69-
/* Found controller, find links supported */
70-
ret = fwnode_property_read_u32(fwnode, "mipi-sdw-master-count", &count);
71-
7271
/*
72+
* Found controller, find links supported
73+
*
7374
* In theory we could check the number of links supported in
7475
* hardware, but in that step we cannot assume SoundWire IP is
7576
* powered.
@@ -80,11 +81,19 @@ sdw_intel_scan_controller(struct sdw_intel_acpi_info *info)
8081
*
8182
* We will check the hardware capabilities in the startup() step
8283
*/
83-
84+
ret = fwnode_property_read_u32(fwnode, "mipi-sdw-manager-list", &tmp);
8485
if (ret) {
85-
dev_err(&adev->dev,
86-
"Failed to read mipi-sdw-master-count: %d\n", ret);
87-
return ret;
86+
ret = fwnode_property_read_u32(fwnode, "mipi-sdw-master-count", &count);
87+
if (ret) {
88+
dev_err(&adev->dev,
89+
"Failed to read mipi-sdw-master-count: %d\n",
90+
ret);
91+
return ret;
92+
}
93+
list = GENMASK(count - 1, 0);
94+
} else {
95+
list = tmp;
96+
count = hweight32(list);
8897
}
8998

9099
/* Check count is within bounds */
@@ -103,7 +112,7 @@ sdw_intel_scan_controller(struct sdw_intel_acpi_info *info)
103112
info->count = count;
104113
info->link_mask = 0;
105114

106-
for (i = 0; i < count; i++) {
115+
for_each_set_bit(i, &list, SDW_INTEL_MAX_LINKS) {
107116
if (ctrl_link_mask && !(ctrl_link_mask & BIT(i))) {
108117
dev_dbg(&adev->dev,
109118
"Link %d masked, will not be enabled\n", i);

0 commit comments

Comments
 (0)