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

SoundWire/hybrid allocation take2 #4428

Conversation

plbossart
Copy link
Member

Address upstream feedback from @vinodkoul and add callbacks rather than make the core logic more complicated.

The code is indeed cleaner with fewer if/else cases, and does not keep stuff we no longer need.

Compile-tested only for now.

…lback"

This reverts commit c5019e4.

Signed-off-by: Pierre-Louis Bossart <[email protected]>
This reverts commit 43bef8b.

Signed-off-by: Pierre-Louis Bossart <[email protected]>
This reverts commit f071bff.

Signed-off-by: Pierre-Louis Bossart <[email protected]>
@plbossart plbossart force-pushed the sdw/hybrid-allocation-take2 branch from 345ad6f to fd360c7 Compare June 16, 2023 14:09
The parameters are only the bus and the device number, manager ops may
need additional details on the type of peripheral connected, such as
whether it is wake-capable or not.

Signed-off-by: Pierre-Louis Bossart <[email protected]>
Rather than add logic in the core for vendor-specific usages, add
callbacks for vendor-specific device_number allocation and release.

This patch only moves the existing IDA-based allocator used only by
Intel to the intel_auxdevice.c file and does not change the
functionality. Follow-up patches will extend the behavior by modifying
the Intel callbacks.

Signed-off-by: Pierre-Louis Bossart <[email protected]>
…tion

The IDA-based allocation is useful to simplify debug, but it was also
introduced as a prerequisite to deal with the Intel Lunar Lake
hardware programming sequences: the wake-ups have to be handled with a
system-unique SDI address at the HDaudio controller level.

At the time, the restriction introduced by the IDA to 8 devices total
seemed perfectly fine, but recently hardware vendors created
configurations with more than 8 devices.

Add a new allocation strategy to allow for more than 8 devices using
information on the type of devices, and only use the IDA-based
allocation for devices capable of generating a wake.

Signed-off-by: Pierre-Louis Bossart <[email protected]>
@plbossart
Copy link
Member Author

Only failure is multiple_pause_resume, known firmware issue.

@plbossart
Copy link
Member Author

moving back to draft, we have a race condition discussed in #4426 (comment) which needs to be handled first.

@plbossart plbossart marked this pull request as draft June 20, 2023 08:02
Nothing in the SoundWire specification mandates that the Device Number
be constant or fixed. This patch adds a helper to dynamically change
the Device Number, either by re-running the bus allocation routine or
with a manual override to be used from a debugfs file.

Signed-off-by: Pierre-Louis Bossart <[email protected]>
This patch adds support for a debugfs file. Users can read the device
number and override the default for stress tests or for convenience,
e.g. to make sure devices always have the same device number no matter
which order they appear as ATTACHED on the bus.

Signed-off-by: Pierre-Louis Bossart <[email protected]>
@plbossart
Copy link
Member Author

@bardliao I added a tentative helper to change the device number on the fly. I tested it with debugfs

 echo 3 > /sys/kernel/debug/soundwire/master-2-2/sdw\:2\:025d\:1308\:00/device_number

this seems to work mostly but there ire issues with interrupts apparently. If you have time to test feedback is welcome. I am not sure how safe this is to change the device_number, if we can't make it work then we have an issue with the IDA stuff, it can be defeated by probe delays

[  126.971301] soundwire_cadence:cdns_update_slave_status_work: soundwire_intel soundwire_intel.link.2: Slave status change: 0x40
[  126.975485] soundwire_cadence:cdns_fill_msg_resp: soundwire_intel soundwire_intel.link.2: Msg ignored for Slave 1
[  126.975486] rt1308 sdw:2:025d:1308:00: SDW_SCP_INT1 read failed:-61
[  126.975524] rt1308 sdw:2:025d:1308:00: Slave 1 alert handling failed: -61
[  126.975588] soundwire_cadence:cdns_update_slave_status_work: soundwire_intel soundwire_intel.link.2: Slave status change: 0x4010
[  130.045932] soundwire_bus:sdw_bus_wait_for_clk_prep_deprep: soundwire sdw-master-2: clock stop prep/de-prep done slave:15

@bardliao
Copy link
Collaborator

@plbossart I didn't meet the same issue as you. It works when the original dev_num is 6.

[  351.364253] soundwire sdw-master-0: clock stop prep/de-prep done slave:15
[  351.365995] cdns_update_slave_status_work: 4 callbacks suppressed
[  351.366000] soundwire_intel soundwire_intel.link.0: Slave status change: 0x21000000

I verified playback worked after device number changed.
However, ida_free(&intel_peripheral_ida, slave->dev_num) will cause problem if the original dev_num is not 6. I think it is because the dev_num is not allocated by ida_alloc.
BTW, the original dev_num is 1 occasionally on my side.

@plbossart plbossart closed this Jun 27, 2023
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.

3 participants