-
Notifications
You must be signed in to change notification settings - Fork 140
SoundWire: Call Prepare command for Simplified_CP_SM #5625
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
base: topic/sof-dev
Are you sure you want to change the base?
SoundWire: Call Prepare command for Simplified_CP_SM #5625
Conversation
|
Can one of the admins verify this patch?
|
|
test this please |
c9bf96f to
9c35901
Compare
|
The change looks good to me. However, there is a typo in the commit message. The Channel Prepare State Machine in the spec is Figure 141 not 114 |
|
Yeah we should probably test this, seems a bit weird to be writing the prepares for a simple device. |
|
If the device requires Prepare, it should not be Simplified_CP_SM. The problem I see with this pull request is that it would be valid to remove this code, according to the SoundWire specification. I think it at least needs a comment in the code to say that writing Prepare=1 on Simplified_CP_SM is a workaround for some peripherals. So someone changing the code in future knows that it is a workaround that must not be removed. |
|
Hi @rfvirgil
I'd like to clarify the implementation based on the MIPI SoundWire specification v1-2 from TI's interpretation. In our TI device implementation, we utilize the Prepare0/Prepare1 input. Please correct me if there is some misunderstanding here.
I'll add a clear comment explaining that this implementation follows the specification requirement for state transitions in Simplified_CP_SM, noting that while the values may be "write-ignored" by some peripherals, the command itself is still necessary for proper state machine operation. |
I think this is the bit Richard is somewhat skeptical about. It seems very reasonable to interpret the "Read-only / write-ignored" as the host may write the prepare bits, making your change allowed by the specification I think. It seems very hard, however, to interpret that as the host shall write the prepare bits, which appears to be how your commit message is worded. Would be good to understand why the device can't just use the full prepare state machine as Richard asks, if it needs the prepare signals that would seem the obvious fix. I guess it doesn't update the NF flag properly? From the Cirrus side, testing this with our hardware it seems fine, but would be good to hear back from Realtek as well, since it is quite a scary change. |
We have a complex situation as the same ACPI table is used between Windows and Linux OSes. |
|
Hmm... yes it is a requirement that an IRQ is raised on the prep/deprep, so I guess that does force the use of the simplified state machine. Well as noted the change doesn't affect our devices so its ok with us, would still be good to hear back from Realtek on if they are ok with this, as I think they might use the simple process more than we do. |
I tested this PR with some codecs. It seems fine. |
As defined in the MIPI SoundWire specification v1-2 for Simplified Channel Prepare State Machine (Simplified_CP_SM): * Figure 141 for the Simplified_CP_SM in the specification shows the "Ready" state (NF=0, P=1) that can be reached via "Prepare0 OR Prepare1" transitions. * Table 115 (Stimulus to the Channel Prepare State Machine) indicates that Prepare0 and Prepare1 are read-only/"write-ignored" bits for Simplified_CP_SM. In TI device implementations, we've found that some devices with Simplified_CP_SM still benefit from receiving the Prepare command. This patch modifies the code to: 1. Send the Prepare command to all devices, including those with Simplified_CP_SM 2. Ignore errors returned by devices with Simplified_CP_SM that might not support this command This approach maintains compatibility with all devices while ensuring proper functionality of dataport operations for devices that can make use of the Prepare command despite using Simplified_CP_SM. Signed-off-by: Niranjan H Y <niranjan.hy@ti.com>
9c35901 to
a00b799
Compare
|
Thank you @bardliao @shumingfan @charleskeepax, @rfvirgil for review/testing. |
|
Hello All, I have tested this patch with ALC712-VB codec. I have observed Channel prepare timeout results in port prepare failures during headphone playback audio use case. If i revert this patch, no port prepare timeouts are observed. |
|
ch_prep_timeout_2212_logs_rtk.txt |
I referred old patch which is part of patch series shared by TI team, where below changes are missing .
} Will retest with updated patch . |
|
Tested with updated patch. Everything is working fine. |
As defined in the MIPI SoundWire specification v1-2 for Simplified Channel Prepare State Machine (Simplified_CP_SM)
So, the “write-ignored” in informative section indicate it would be device’s choice to ignore. If device is not making any use of Prepare0/Prepare1 input from Host controller it can ignore. Given in TI device implementation we make full use of Prepare0/Prepare1, the prepare command should be sent.
The fix ensures compliance with the specification while maintaining proper functionality of dataport operations as per the spec. The commit ensures that even when using "simplified-channelprepare-sm", the channel prepare ("DPN_PrepareCtrl") function is properly called as mandated by the specification.