diff mbox series

[RESEND] soundwire: qcom: allow multi-link on newer devices

Message ID 20240403132716.325880-1-krzysztof.kozlowski@linaro.org
State Superseded
Headers show
Series [RESEND] soundwire: qcom: allow multi-link on newer devices | expand

Commit Message

Krzysztof Kozlowski April 3, 2024, 1:27 p.m. UTC
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>

---

Almost four months, so let's resend this one. Add Rb tag.
---
 drivers/soundwire/qcom.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

Comments

Vinod Koul April 5, 2024, 11:25 a.m. UTC | #1
On 03-04-24, 15:27, Krzysztof Kozlowski wrote:
> Newer Qualcomm SoCs like X1E80100 might come with four speakers spread
> over two Soundwire controllers, thus they need a multi-link Soundwire
> stream runtime.

This does on apply on sdw/next.

Pls rebase
Vinod Koul April 5, 2024, 11:54 a.m. UTC | #2
On 05-04-24, 16:55, Vinod Koul wrote:
> On 03-04-24, 15:27, Krzysztof Kozlowski wrote:
> > Newer Qualcomm SoCs like X1E80100 might come with four speakers spread
> > over two Soundwire controllers, thus they need a multi-link Soundwire
> > stream runtime.
> 
> This does on apply on sdw/next.

s/does/does not

> 
> Pls rebase
> 
> -- 
> ~Vinod
Krzysztof Kozlowski April 5, 2024, 2:41 p.m. UTC | #3
On 05/04/2024 13:25, Vinod Koul wrote:
> On 03-04-24, 15:27, Krzysztof Kozlowski wrote:
>> Newer Qualcomm SoCs like X1E80100 might come with four speakers spread
>> over two Soundwire controllers, thus they need a multi-link Soundwire
>> stream runtime.
> 
> This does on apply on sdw/next.
> 

That's my fault, I had some other old soundwire patches on that branch
(post bank switch delay), but I guess these aren't really needed.
Resending soon.

Best regards,
Krzysztof
Vinod Koul April 11, 2024, 5:48 p.m. UTC | #4
On Wed, 03 Apr 2024 15:27:16 +0200, Krzysztof Kozlowski wrote:
> Newer Qualcomm SoCs like X1E80100 might come with four speakers spread
> over two Soundwire controllers, thus they need a multi-link Soundwire
> stream runtime.
> 
> 

Applied, thanks!

[1/1] soundwire: qcom: allow multi-link on newer devices
      commit: ce5e811e069168898ae2ff02a90de68637ed7dc4

Best regards,
Vinod Koul April 12, 2024, 4:46 a.m. UTC | #5
On 11-04-24, 23:18, Vinod Koul wrote:
> 
> On Wed, 03 Apr 2024 15:27:16 +0200, Krzysztof Kozlowski wrote:
> > Newer Qualcomm SoCs like X1E80100 might come with four speakers spread
> > over two Soundwire controllers, thus they need a multi-link Soundwire
> > stream runtime.
> > 
> > 
> 
> Applied, thanks!
> 
> [1/1] soundwire: qcom: allow multi-link on newer devices
>       commit: ce5e811e069168898ae2ff02a90de68637ed7dc4

b4 messed up and sent this, not sure why.. V2 was applied
diff mbox series

Patch

diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
index 82b3ca5a405a..a97412c8671e 100644
--- a/drivers/soundwire/qcom.c
+++ b/drivers/soundwire/qcom.c
@@ -920,6 +920,18 @@  static int qcom_swrm_init(struct qcom_swrm_ctrl *ctrl)
 	return 0;
 }
 
+static int qcom_swrm_read_prop(struct sdw_bus *bus)
+{
+	struct qcom_swrm_ctrl *ctrl = to_qcom_sdw(bus);
+
+	if (ctrl->version >= SWRM_VERSION_2_0_0) {
+		bus->multi_link = true;
+		bus->hw_sync_min_links = 3;
+	}
+
+	return 0;
+}
+
 static enum sdw_command_response qcom_swrm_xfer_msg(struct sdw_bus *bus,
 						    struct sdw_msg *msg)
 {
@@ -1078,6 +1090,7 @@  static const struct sdw_master_port_ops qcom_swrm_port_ops = {
 };
 
 static const struct sdw_master_ops qcom_swrm_ops = {
+	.read_prop = qcom_swrm_read_prop,
 	.xfer_msg = qcom_swrm_xfer_msg,
 	.pre_bank_switch = qcom_swrm_pre_bank_switch,
 	.post_bank_switch = qcom_swrm_post_bank_switch,
@@ -1196,6 +1209,15 @@  static int qcom_swrm_stream_alloc_ports(struct qcom_swrm_ctrl *ctrl,
 
 	mutex_lock(&ctrl->port_lock);
 	list_for_each_entry(m_rt, &stream->master_list, stream_node) {
+		/*
+		 * For streams with multiple masters:
+		 * Allocate ports only for devices connected to this master.
+		 * Such devices will have ports allocated by their own master
+		 * and its qcom_swrm_stream_alloc_ports() call.
+		 */
+		if (ctrl->bus.id != m_rt->bus->id)
+			continue;
+
 		if (m_rt->direction == SDW_DATA_DIR_RX) {
 			maxport = ctrl->num_dout_ports;
 			port_mask = &ctrl->dout_port_mask;