Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <broonie@kernel.org>
Cc: alsa-devel@alsa-project.org
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20240405144141.47217-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Krzysztof Kozlowski and committed by
Vinod Koul
ce5e811e b18c25af

+22
+22
drivers/soundwire/qcom.c
··· 905 905 return 0; 906 906 } 907 907 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 + 908 920 static enum sdw_command_response qcom_swrm_xfer_msg(struct sdw_bus *bus, 909 921 struct sdw_msg *msg) 910 922 { ··· 1068 1056 }; 1069 1057 1070 1058 static const struct sdw_master_ops qcom_swrm_ops = { 1059 + .read_prop = qcom_swrm_read_prop, 1071 1060 .xfer_msg = qcom_swrm_xfer_msg, 1072 1061 .pre_bank_switch = qcom_swrm_pre_bank_switch, 1073 1062 }; ··· 1186 1173 1187 1174 mutex_lock(&ctrl->port_lock); 1188 1175 list_for_each_entry(m_rt, &stream->master_list, stream_node) { 1176 + /* 1177 + * For streams with multiple masters: 1178 + * Allocate ports only for devices connected to this master. 1179 + * Such devices will have ports allocated by their own master 1180 + * and its qcom_swrm_stream_alloc_ports() call. 1181 + */ 1182 + if (ctrl->bus.id != m_rt->bus->id) 1183 + continue; 1184 + 1189 1185 if (m_rt->direction == SDW_DATA_DIR_RX) { 1190 1186 maxport = ctrl->num_dout_ports; 1191 1187 port_mask = &ctrl->dout_port_mask;