Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions drivers/soundwire/stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ static int sdw_program_slave_port_params(struct sdw_bus *bus,
struct sdw_slave_prop *slave_prop = &s_rt->slave->prop;
u32 addr1, addr2, addr3, addr4, addr5, addr6;
struct sdw_dpn_prop *dpn_prop;
unsigned long time;
int ret;
u8 wbuf;

Expand All @@ -143,6 +144,21 @@ static int sdw_program_slave_port_params(struct sdw_bus *bus,
if (!dpn_prop)
return -EINVAL;

/*
* bus_lock was locked by each stream operation, and sdw_handle_slave_status will wait for
* the lock to check if the bus is assigned. We should unlock the lock to allow other
* function to access the lock while we are waiting for initialization_complete.
*/
mutex_unlock(&bus->bus_lock);
time = wait_for_completion_timeout(&s_rt->slave->initialization_complete,
msecs_to_jiffies(3000));
if (!time) {
dev_err(&s_rt->slave->dev, "%s Initialization not complete, timed out\n", __func__);

return -ETIMEDOUT;
}
mutex_lock(&bus->bus_lock);

@plbossart plbossart Sep 6, 2023 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the problem is that the detach could perfectly happen while you already started programming the first port register. There's nothing that tells us when the codec will lose sync. So I will assert that the electrical parts need to be fixed, there's no reason why the de-attach should happen other than a bad link

addr1 = SDW_DPN_PORTCTRL(t_params->port_num);
addr2 = SDW_DPN_BLOCKCTRL1(t_params->port_num);

Expand Down