]> Git Repo - linux.git/commitdiff
soundwire: generic_bandwidth_allocation: count the bandwidth of active streams only
authorBard Liao <[email protected]>
Wed, 18 Dec 2024 08:01:55 +0000 (16:01 +0800)
committerVinod Koul <[email protected]>
Mon, 23 Dec 2024 06:30:34 +0000 (12:00 +0530)
sdw_compute_group_params() should only count payload bandwidth of the
active streams which is in the ENABLED and DISABLED state in the bus.
And add the payload bandwidth of the stream that calls
sdw_compute_group_params() in sdw_prepare_stream().

Signed-off-by: Bard Liao <[email protected]>
Reviewed-by: Ranjani Sridharan <[email protected]>
Reviewed-by: Péter Ujfalusi <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Vinod Koul <[email protected]>
drivers/soundwire/generic_bandwidth_allocation.c

index 062e7488b2263b78eaa8e20538f6b83e6632d48b..59965f43c2fb0e3335855902ad8b8649f7208e53 100644 (file)
@@ -188,6 +188,19 @@ static int sdw_compute_group_params(struct sdw_bus *bus,
        }
 
        list_for_each_entry(m_rt, &bus->m_rt_list, bus_node) {
+               if (m_rt->stream == stream) {
+                       /* Only runtime during prepare should be added */
+                       if (stream->state != SDW_STREAM_CONFIGURED)
+                               continue;
+               } else {
+                       /*
+                        * Include runtimes with running (ENABLED state) and paused (DISABLED state)
+                        * streams
+                        */
+                       if (m_rt->stream->state != SDW_STREAM_ENABLED &&
+                           m_rt->stream->state != SDW_STREAM_DISABLED)
+                               continue;
+               }
                list_for_each_entry(p_rt, &m_rt->port_list, port_node) {
                        rate = m_rt->stream->params.rate;
                        bps = m_rt->stream->params.bps;
This page took 0.068537 seconds and 4 git commands to generate.