Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

authored by

Pierre-Louis Bossart and committed by
Takashi Iwai
71dce222 8782ba96

+18 -9
+1 -1
include/linux/soundwire/sdw_intel.h
··· 227 227 /** 228 228 * struct sdw_intel_acpi_info - Soundwire Intel information found in ACPI tables 229 229 * @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 231 231 * @link_mask: bit-wise mask listing links enabled by BIOS menu 232 232 * 233 233 * this structure could be expanded to e.g. provide all the _ADR
+17 -8
sound/hda/intel-sdw-acpi.c
··· 57 57 { 58 58 struct acpi_device *adev = acpi_fetch_acpi_dev(info->handle); 59 59 struct fwnode_handle *fwnode; 60 + unsigned long list; 60 61 unsigned int i; 61 62 u32 count; 63 + u32 tmp; 62 64 int ret; 63 65 64 66 if (!adev) ··· 68 66 69 67 fwnode = acpi_fwnode_handle(adev); 70 68 71 - /* Found controller, find links supported */ 72 - ret = fwnode_property_read_u32(fwnode, "mipi-sdw-master-count", &count); 73 - 74 69 /* 70 + * Found controller, find links supported 71 + * 75 72 * In theory we could check the number of links supported in 76 73 * hardware, but in that step we cannot assume SoundWire IP is 77 74 * powered. ··· 81 80 * 82 81 * We will check the hardware capabilities in the startup() step 83 82 */ 84 - 83 + ret = fwnode_property_read_u32(fwnode, "mipi-sdw-manager-list", &tmp); 85 84 if (ret) { 86 - dev_err(&adev->dev, 87 - "Failed to read mipi-sdw-master-count: %d\n", ret); 88 - return ret; 85 + ret = fwnode_property_read_u32(fwnode, "mipi-sdw-master-count", &count); 86 + if (ret) { 87 + dev_err(&adev->dev, 88 + "Failed to read mipi-sdw-master-count: %d\n", 89 + ret); 90 + return ret; 91 + } 92 + list = GENMASK(count - 1, 0); 93 + } else { 94 + list = tmp; 95 + count = hweight32(list); 89 96 } 90 97 91 98 /* Check count is within bounds */ ··· 112 103 info->count = count; 113 104 info->link_mask = 0; 114 105 115 - for (i = 0; i < count; i++) { 106 + for_each_set_bit(i, &list, SDW_INTEL_MAX_LINKS) { 116 107 if (ctrl_link_mask && !(ctrl_link_mask & BIT(i))) { 117 108 dev_dbg(&adev->dev, 118 109 "Link %d masked, will not be enabled\n", i);