slimbus: Fix channel concurrent usage during reconfiguration sequence
Reconfiguration sequence can lead to changes in channel segment distribution and state. Since multiple clients can use 1 channel, make sure channels cannot be manipulated when reconfiguration sequence is in progress, and make sure that client doesn't send reconfiguration sequence when no changes are pending to be sent in the sequence from it. CRs-Fixed: 383406 Change-Id: Ib5f0bc32f67f51f118fa417a2e580c8dc87ef0d0 Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
This commit is contained in:
committed by
Stephen Boyd
parent
09c46a44df
commit
9bde29db50
@@ -2516,6 +2516,18 @@ int slim_reconfigure_now(struct slim_device *sb)
|
||||
u32 segdist;
|
||||
struct slim_pending_ch *pch;
|
||||
|
||||
/*
|
||||
* If there are no pending changes from this client, avoid sending
|
||||
* the reconfiguration sequence
|
||||
*/
|
||||
if (sb->pending_msgsl == sb->cur_msgsl &&
|
||||
list_empty(&sb->mark_define) &&
|
||||
list_empty(&sb->mark_removal) &&
|
||||
list_empty(&sb->mark_suspend)) {
|
||||
pr_debug("SLIM_CL: skip reconfig sequence");
|
||||
return 0;
|
||||
}
|
||||
|
||||
mutex_lock(&ctrl->sched.m_reconf);
|
||||
mutex_lock(&ctrl->m_ctrl);
|
||||
ctrl->sched.pending_msgsl += sb->pending_msgsl - sb->cur_msgsl;
|
||||
@@ -2538,7 +2550,6 @@ int slim_reconfigure_now(struct slim_device *sb)
|
||||
struct slim_ich *slc = &ctrl->chans[pch->chan];
|
||||
slc->state = SLIM_CH_SUSPENDED;
|
||||
}
|
||||
mutex_unlock(&ctrl->m_ctrl);
|
||||
|
||||
ret = slim_allocbw(sb, &subframe, &clkgear);
|
||||
|
||||
@@ -2688,7 +2699,6 @@ int slim_reconfigure_now(struct slim_device *sb)
|
||||
NULL, 0, 3, NULL, 0, NULL);
|
||||
dev_dbg(&ctrl->dev, "reconfig now:ret:%d\n", ret);
|
||||
if (!ret) {
|
||||
mutex_lock(&ctrl->m_ctrl);
|
||||
ctrl->sched.subfrmcode = subframe;
|
||||
ctrl->clkgear = clkgear;
|
||||
ctrl->sched.msgsl = ctrl->sched.pending_msgsl;
|
||||
@@ -2700,7 +2710,6 @@ int slim_reconfigure_now(struct slim_device *sb)
|
||||
}
|
||||
|
||||
revert_reconfig:
|
||||
mutex_lock(&ctrl->m_ctrl);
|
||||
/* Revert channel changes */
|
||||
slim_chan_changes(sb, true);
|
||||
mutex_unlock(&ctrl->m_ctrl);
|
||||
|
||||
Reference in New Issue
Block a user