Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

alsa-info.sh: log SoundWire devices reported in ACPI #264

Closed
wants to merge 1 commit into from

Conversation

plbossart
Copy link
Contributor

Track SoundWire devices reported in ACPI, this will help detect missing or invalid configurations.

For now we only filter information from Realtek, Cirrus Logic and TI, based on the manufacturer ID of their devices.

Example log for the classic RT711/RT1316x2/RT714 configuration.

!!ACPI SoundWire Device Status Information
!!---------------

Realtek 0x000030025d071101
Realtek 0x000331025d131601
Realtek 0x000230025d131601
Realtek 0x000130025d071401

@plbossart
Copy link
Contributor Author

@charleskeepax
Copy link

Looks fine to me, although has a few hairy edges. It may return non-soundwire devices, and also given the ACPI often includes plenty of unused devices the results can be a bit misleading. But all that said I think its a net win and I don't have an obvious better solution.

@plbossart
Copy link
Contributor Author

@charleskeepax the risk of returning non-SoundWire devices is mitigated by the filter with the MIPI manufacturer ID. We can't blindly use _ADR since it's also used for I2C/SPI and others. But the MIPI manufacturer ID is rather specific.

One can argue that this may catch other non-SoundWire MIPI IP (CSI?) but I don't have any specific knowledge of how they use ACPI, if at all.

I also added information in the kernel with thesofproject/linux#4927 btw, but alsa-info is usually the first information that comes our way.

@bardliao
Copy link

LGTM

ACPI_ADR=$(cat $f 2>/dev/null);
if [[ "$ACPI_ADR" -ne 0 ]]; then
case $ACPI_ADR in
*025d*) echo "Realtek $ACPI_ADR" >>$TEMPDIR/sdwstatus.tmp;;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the first "match all (*)" rule intentional? I guess it may be 0x there if the vendor is not stored in last four hex characters.

Copy link
Contributor Author

@plbossart plbossart Apr 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have limited shell scripting skills.

The ADR is as follows, the manufacturer ID is in boldface: 0x000030025d071101

The position of the manufacturer ID is fixed per the MIPI DisCo spec. So we could skip all 000030 6 characters I guess. The part ID is the 4 chars to the right of the manufacturer ID, i.e. 0711

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The matching pattern is described here . It should be something like 0x??????025d* for your case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

script updated as suggested, thanks @perexg

Track SoundWire devices reported in ACPI, this will help detect
missing or invalid configurations.

For now we only filter information from Realtek, Cirrus Logic and TI,
based on the manufacturer ID of their devices.

Example log for the classic RT711/RT1316x2/RT714 configuration.

!!ACPI SoundWire Device Status Information
!!---------------

Realtek 0x000030025d071101
Realtek 0x000331025d131601
Realtek 0x000230025d131601
Realtek 0x000130025d071401

As noted by reviewers, the script reports everything exposed in
ACPI. In practice some of the devices listed may not be physically
populated in hardware, or be listed as attached on a link that's
disabled by the manager. The drivers can cope with this case, it's not
technically an error.

Signed-off-by: Pierre-Louis Bossart <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants