Skip to content

Commit

Permalink
soundwire: stream: set DEPREPARED state earlier
Browse files Browse the repository at this point in the history
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.intel.com>
  • Loading branch information
plbossart committed Sep 12, 2024
1 parent 8d0bc43 commit d29894f
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion drivers/soundwire/stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -1656,15 +1656,24 @@ static int _sdw_deprepare_stream(struct sdw_stream_runtime *stream)
unsigned int multi_lane_bandwidth;
unsigned int bandwidth;
struct sdw_bus *bus;
int state = stream->state;
int ret = 0;

/*
* first mark the state as DEPREPARED so that it is not taken into account
* for bit allocation
*/
state = stream->state;
stream->state = SDW_STREAM_DEPREPARED;

list_for_each_entry(m_rt, &stream->master_list, stream_node) {
bus = m_rt->bus;
/* De-prepare port(s) */
ret = sdw_prep_deprep_ports(m_rt, false);
if (ret < 0) {
dev_err(bus->dev,
"De-prepare port(s) failed: %d\n", ret);
stream->state = state;
return ret;
}

Expand All @@ -1690,6 +1699,7 @@ static int _sdw_deprepare_stream(struct sdw_stream_runtime *stream)
if (ret < 0) {
dev_err(bus->dev, "Compute params failed: %d\n",
ret);
stream->state = state;
return ret;
}
}
Expand All @@ -1698,11 +1708,11 @@ static int _sdw_deprepare_stream(struct sdw_stream_runtime *stream)
ret = sdw_program_params(bus, false);
if (ret < 0) {
dev_err(bus->dev, "%s: Program params failed: %d\n", __func__, ret);
stream->state = state;
return ret;
}
}

stream->state = SDW_STREAM_DEPREPARED;
return do_bank_switch(stream);
}

Expand Down

0 comments on commit d29894f

Please sign in to comment.