Skip to contentSkip to conversation

soundwire: only compute port params in specific stream states

PATCH Applied Bard Liao 2 participants 2 messages May 8, 2025 – May 14, 2025

Subsystems (2)
lore
Share & tools
lore

Bard Liao

author maintainer
#0 lore raw

PATCH 1/1 soundwire: only compute port params in specific stream states

Currently, sdw_compute_master_ports() is blindly called for every single Manager runtime. However, we should not take into account the stream's bandwidth if the stream is just allocated or already deprepared.

Fixes 25befdf32aa4 ("soundwire: generic_bandwidth_allocation: count the bandwidth of active streams only")
---
 drivers/soundwire/generic_bandwidth_allocation.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/soundwire/generic_bandwidth_allocation.c +7 -0
index 1cfaccf43eac..c18f0c16f929 100644
@@ -204,6 +204,13 @@ static void _sdw_compute_port_params(struct sdw_bus *bus,
 			port_bo = 1;
 
 			list_for_each_entry(m_rt, &bus->m_rt_list, bus_node) {
+				/*
+				 * Only runtimes with CONFIGURED, PREPARED, ENABLED, and DISABLED
+				 * states should be included in the bandwidth calculation.
+				 */
+				if (m_rt->stream->state > SDW_STREAM_DISABLED ||
+				    m_rt->stream->state < SDW_STREAM_CONFIGURED)
+					continue;
 				sdw_compute_master_ports(m_rt, &params[i], &port_bo, hstop);
 			}
 
Signature · 1 line
2.43.0
maintainer Applied
#1 lore raw
Quoted 5 lines · Bard Liao

Currently, sdw_compute_master_ports() is blindly called for every single Manager runtime. However, we should not take into account the stream's bandwidth if the stream is just allocated or already deprepared.

Applied, thanks!

[1/1] soundwire: only compute port params in specific stream states

      commit: 62ada17a6217a50fbd1b23f10899890f56effc97

Best regards,

Signature · 1 line
~Vinod