Skip to content

soundwire: qcom: Add set_channel_map api support#21

Open
mohsRafi wants to merge 1 commit into
nandamajay:masterfrom
mohsRafi:Add_swr_set_channel_map_support
Open

soundwire: qcom: Add set_channel_map api support#21
mohsRafi wants to merge 1 commit into
nandamajay:masterfrom
mohsRafi:Add_swr_set_channel_map_support

Conversation

@mohsRafi
Copy link
Copy Markdown

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.

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>
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.

1 participant