soundwire: qcom: Add set_channel_map api support#21
Open
mohsRafi wants to merge 1 commit into
Open
Conversation
Add qcom_swrm_set_channel_map api to set the master channel mask for TX and RX paths based on the provided slots. Support for snd_soc_dai_set_channel_map() was previously added to the Qualcomm SoundWire master driver but later reverted due to multiple issues in the initial implementation. This change reintroduces set_channel_map support with a corrected and robust implementation. SoundWire master ports are 1-based hardware entities. The per-port configuration array (pconfig) is therefore allocated with an extra element where pconfig[0] is unused padding and valid ports are indexed from pconfig[1] to pconfig[nports]. The channel map logic is updated to follow this model and to use the runtime-detected number of master ports. The updated implementation also avoids out-of-bounds access when the number of channel slots exceeds the available master ports and prevents TX channel configuration from being overwritten when RX channel maps are also provided by storing TX and RX channel masks independently. With these changes, set_channel_map behaves safely across platforms with different SoundWire port counts and avoids the issues that led to the previous revert. Signed-off-by: Mohammad Rafi Shaik <mohammad.rafi.shaik@oss.qualcomm.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add qcom_swrm_set_channel_map api to set the master channel mask for TX and RX paths based on the provided slots.
Support for snd_soc_dai_set_channel_map() was previously added to the Qualcomm SoundWire master driver but later reverted due to multiple issues in the initial implementation.
This change reintroduces set_channel_map support with a corrected and robust implementation.
SoundWire master ports are 1-based hardware entities. The per-port configuration array (pconfig) is therefore allocated with an extra element where pconfig[0] is unused padding and valid ports are indexed from pconfig[1] to pconfig[nports]. The channel map logic is updated to follow this model and to use the runtime-detected number of master ports.
The updated implementation also avoids out-of-bounds access when the number of channel slots exceeds the available master ports and prevents TX channel configuration from being overwritten when RX channel maps are also provided by storing TX and RX channel masks independently. With these changes, set_channel_map behaves safely across platforms with different SoundWire port counts and avoids the issues that led to the previous revert.