ASoC: SOF: Intel: reset link_mask before adding new bits#5646
ASoC: SOF: Intel: reset link_mask before adding new bits#5646ujfalusi merged 1 commit intothesofproject:topic/sof-devfrom
Conversation
e96ecb5 to
036b144
Compare
sound/soc/sof/intel/hda.c
Outdated
| return NULL; | ||
|
|
||
| /* Get link mask and link number */ | ||
| link_mask = 0; |
There was a problem hiding this comment.
so are you saying that setting link_mask to during init implies a peripheral connect on link 0?
Also you have a typo in "at lease" ->"at least"
There was a problem hiding this comment.
The link_mask here will be set to mach->mach_params.link_mask. Each bit represents a link with a peripheral connected. For example, link_mask = 0xc means link 2 and 3 are enabled and with at least a peripheral connected.
Fixed the typo of the commit message.
036b144 to
a217204
Compare
sound/soc/sof/intel/hda.c
Outdated
| return NULL; | ||
|
|
||
| /* Get link mask and link number */ | ||
| link_mask = 0; |
There was a problem hiding this comment.
I would mention that the local link_mask is used for two different purposes and needs to be initialized before each use?
sound/soc/sof/intel/hda.c
Outdated
| return NULL; | ||
|
|
||
| /* Get link mask and link number */ | ||
| link_mask = 0; |
There was a problem hiding this comment.
@bardliao I think you need to change to a new variable here instead of using link_mask. The link_mask variable is used for checking which links are enabled in ACPI and this one checks if there's a peripheral at any of the links.
The link_mask variable is not changed after setting to hdev->info.link_mask until it is used for another purpose to get the used SoundWire links and set to mach->mach_params.links. Besides, the link_mask variable should be reset before any link id is added to the link_mask. To fix the issue above and avoid confusing, use the hdev->info.link_mask variable directly to check if the SoundWire link is enabled. Fixes: 5226d19 ("ASoC: SOF: Intel: use sof_sdw as default SDW machine driver") Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
a217204 to
823d5b8
Compare
link_mask is set to hdev->info.link_mask at the beginning of hda_sdw_machine_select(). However, some SDW links may not have any peripheral connected. We should reset it to 0 before adding the link id bits to the link_mask. Otherwise, the link_index will not start with 0 if the link_mask include any link that without peripheral.
Fixes: 5226d19 ("ASoC: SOF: Intel: use sof_sdw as default SDW machine driver")