Commit 063ff4e5 authored by Pierre-Louis Bossart's avatar Pierre-Louis Bossart Committed by Vinod Koul

soundwire: stream: enable hw_sync as needed by hardware

Use platform-specific information to decide when to use hw_sync, not
only a number of links > 1.
Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: default avatarBard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20200901150556.19432-8-yung-chuan.liao@linux.intel.comSigned-off-by: default avatarVinod Koul <vkoul@kernel.org>
parent 94eed661
...@@ -689,9 +689,9 @@ static int sdw_bank_switch(struct sdw_bus *bus, int m_rt_count) ...@@ -689,9 +689,9 @@ static int sdw_bank_switch(struct sdw_bus *bus, int m_rt_count)
/* /*
* Set the multi_link flag only when both the hardware supports * Set the multi_link flag only when both the hardware supports
* and there is a stream handled by multiple masters * and hardware-based sync is required
*/ */
multi_link = bus->multi_link && (m_rt_count > 1); multi_link = bus->multi_link && (m_rt_count >= bus->hw_sync_min_links);
if (multi_link) if (multi_link)
ret = sdw_transfer_defer(bus, wr_msg, &bus->defer_msg); ret = sdw_transfer_defer(bus, wr_msg, &bus->defer_msg);
...@@ -760,13 +760,16 @@ static int do_bank_switch(struct sdw_stream_runtime *stream) ...@@ -760,13 +760,16 @@ static int do_bank_switch(struct sdw_stream_runtime *stream)
const struct sdw_master_ops *ops; const struct sdw_master_ops *ops;
struct sdw_bus *bus; struct sdw_bus *bus;
bool multi_link = false; bool multi_link = false;
int m_rt_count;
int ret = 0; int ret = 0;
m_rt_count = stream->m_rt_count;
list_for_each_entry(m_rt, &stream->master_list, stream_node) { list_for_each_entry(m_rt, &stream->master_list, stream_node) {
bus = m_rt->bus; bus = m_rt->bus;
ops = bus->ops; ops = bus->ops;
if (bus->multi_link) { if (bus->multi_link && m_rt_count >= bus->hw_sync_min_links) {
multi_link = true; multi_link = true;
mutex_lock(&bus->msg_lock); mutex_lock(&bus->msg_lock);
} }
...@@ -787,7 +790,7 @@ static int do_bank_switch(struct sdw_stream_runtime *stream) ...@@ -787,7 +790,7 @@ static int do_bank_switch(struct sdw_stream_runtime *stream)
* synchronized across all Masters and happens later as a * synchronized across all Masters and happens later as a
* part of post_bank_switch ops. * part of post_bank_switch ops.
*/ */
ret = sdw_bank_switch(bus, stream->m_rt_count); ret = sdw_bank_switch(bus, m_rt_count);
if (ret < 0) { if (ret < 0) {
dev_err(bus->dev, "Bank switch failed: %d\n", ret); dev_err(bus->dev, "Bank switch failed: %d\n", ret);
goto error; goto error;
...@@ -813,7 +816,7 @@ static int do_bank_switch(struct sdw_stream_runtime *stream) ...@@ -813,7 +816,7 @@ static int do_bank_switch(struct sdw_stream_runtime *stream)
ret); ret);
goto error; goto error;
} }
} else if (bus->multi_link && stream->m_rt_count > 1) { } else if (multi_link) {
dev_err(bus->dev, dev_err(bus->dev,
"Post bank switch ops not implemented\n"); "Post bank switch ops not implemented\n");
goto error; goto error;
...@@ -831,7 +834,7 @@ static int do_bank_switch(struct sdw_stream_runtime *stream) ...@@ -831,7 +834,7 @@ static int do_bank_switch(struct sdw_stream_runtime *stream)
goto error; goto error;
} }
if (bus->multi_link) if (multi_link)
mutex_unlock(&bus->msg_lock); mutex_unlock(&bus->msg_lock);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment