Skip to content

Commit f1b3dba

Browse files
plbossartvinodkoul
authored andcommitted
soundwire: stream: set DEPREPARED state earlier
The existing logic is problematic in that we deprepare all the ports, but still take into account the stream for bit allocation by just walking through the bus->m_rt list. This patch sets the state earlier, so that such DEPREPARED streams can be skipped in the bandwidth allocation (to be implemented in a follow-up patch). Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.dev> Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Link: https://lore.kernel.org/r/20241218080155.102405-5-yung-chuan.liao@linux.intel.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
1 parent b6a2e1b commit f1b3dba

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

drivers/soundwire/stream.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1643,15 +1643,23 @@ static int _sdw_deprepare_stream(struct sdw_stream_runtime *stream)
16431643
{
16441644
struct sdw_master_runtime *m_rt;
16451645
struct sdw_bus *bus;
1646+
int state = stream->state;
16461647
int ret = 0;
16471648

1649+
/*
1650+
* first mark the state as DEPREPARED so that it is not taken into account
1651+
* for bit allocation
1652+
*/
1653+
stream->state = SDW_STREAM_DEPREPARED;
1654+
16481655
list_for_each_entry(m_rt, &stream->master_list, stream_node) {
16491656
bus = m_rt->bus;
16501657
/* De-prepare port(s) */
16511658
ret = sdw_prep_deprep_ports(m_rt, false);
16521659
if (ret < 0) {
16531660
dev_err(bus->dev,
16541661
"De-prepare port(s) failed: %d\n", ret);
1662+
stream->state = state;
16551663
return ret;
16561664
}
16571665

@@ -1665,6 +1673,7 @@ static int _sdw_deprepare_stream(struct sdw_stream_runtime *stream)
16651673
if (ret < 0) {
16661674
dev_err(bus->dev, "Compute params failed: %d\n",
16671675
ret);
1676+
stream->state = state;
16681677
return ret;
16691678
}
16701679
}
@@ -1673,11 +1682,11 @@ static int _sdw_deprepare_stream(struct sdw_stream_runtime *stream)
16731682
ret = sdw_program_params(bus, false);
16741683
if (ret < 0) {
16751684
dev_err(bus->dev, "%s: Program params failed: %d\n", __func__, ret);
1685+
stream->state = state;
16761686
return ret;
16771687
}
16781688
}
16791689

1680-
stream->state = SDW_STREAM_DEPREPARED;
16811690
return do_bank_switch(stream);
16821691
}
16831692

0 commit comments

Comments
 (0)