Skip to content

Commit ce5e811

Browse files
krzkvinodkoul
authored andcommitted
soundwire: qcom: allow multi-link on newer devices
Newer Qualcomm SoCs like X1E80100 might come with four speakers spread over two Soundwire controllers, thus they need a multi-link Soundwire stream runtime. Cc: Mark Brown <[email protected]> Cc: [email protected] Reviewed-by: Pierre-Louis Bossart <[email protected]> Signed-off-by: Krzysztof Kozlowski <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent b18c25a commit ce5e811

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

drivers/soundwire/qcom.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -905,6 +905,18 @@ static int qcom_swrm_init(struct qcom_swrm_ctrl *ctrl)
905905
return 0;
906906
}
907907

908+
static int qcom_swrm_read_prop(struct sdw_bus *bus)
909+
{
910+
struct qcom_swrm_ctrl *ctrl = to_qcom_sdw(bus);
911+
912+
if (ctrl->version >= SWRM_VERSION_2_0_0) {
913+
bus->multi_link = true;
914+
bus->hw_sync_min_links = 3;
915+
}
916+
917+
return 0;
918+
}
919+
908920
static enum sdw_command_response qcom_swrm_xfer_msg(struct sdw_bus *bus,
909921
struct sdw_msg *msg)
910922
{
@@ -1056,6 +1068,7 @@ static const struct sdw_master_port_ops qcom_swrm_port_ops = {
10561068
};
10571069

10581070
static const struct sdw_master_ops qcom_swrm_ops = {
1071+
.read_prop = qcom_swrm_read_prop,
10591072
.xfer_msg = qcom_swrm_xfer_msg,
10601073
.pre_bank_switch = qcom_swrm_pre_bank_switch,
10611074
};
@@ -1173,6 +1186,15 @@ static int qcom_swrm_stream_alloc_ports(struct qcom_swrm_ctrl *ctrl,
11731186

11741187
mutex_lock(&ctrl->port_lock);
11751188
list_for_each_entry(m_rt, &stream->master_list, stream_node) {
1189+
/*
1190+
* For streams with multiple masters:
1191+
* Allocate ports only for devices connected to this master.
1192+
* Such devices will have ports allocated by their own master
1193+
* and its qcom_swrm_stream_alloc_ports() call.
1194+
*/
1195+
if (ctrl->bus.id != m_rt->bus->id)
1196+
continue;
1197+
11761198
if (m_rt->direction == SDW_DATA_DIR_RX) {
11771199
maxport = ctrl->num_dout_ports;
11781200
port_mask = &ctrl->dout_port_mask;

0 commit comments

Comments
 (0)