disp: msm: sde: check power event before set clk rate

Clock rate can be set from debugfs, and this can attempt to
set clock rate even when display power is not enabled.
Set clock rate should check the last power event first.

Change-Id: Ibf01753a288e5a3003928664c99aa6dbf26350d6
Signed-off-by: Nilaan Gunabalachandran <ngunabal@codeaurora.org>
This commit is contained in:
Nilaan Gunabalachandran
2019-11-25 14:41:21 -05:00
committed by Gerrit - the friendly Code Review server
parent 8274efd919
commit 42b9fb5937
3 changed files with 18 additions and 4 deletions

View File

@@ -48,8 +48,10 @@ static void sde_power_event_trigger_locked(struct sde_power_handle *phandle,
struct sde_power_event *event;
list_for_each_entry(event, &phandle->event_list, list) {
if (event->event_type & event_type)
if (event->event_type & event_type) {
event->cb_fnc(event_type, event->usr);
phandle->last_event_handled = event_type;
}
}
}
@@ -768,6 +770,15 @@ int sde_power_clk_set_rate(struct sde_power_handle *phandle, char *clock_name,
pr_err("invalid input power handle\n");
return -EINVAL;
}
mutex_lock(&phandle->phandle_lock);
if (phandle->last_event_handled & SDE_POWER_EVENT_POST_DISABLE) {
pr_debug("invalid power state %u\n",
phandle->last_event_handled);
mutex_unlock(&phandle->phandle_lock);
return -EINVAL;
}
mp = &phandle->mp;
for (i = 0; i < mp->num_clk; i++) {
@@ -781,6 +792,7 @@ int sde_power_clk_set_rate(struct sde_power_handle *phandle, char *clock_name,
break;
}
}
mutex_unlock(&phandle->phandle_lock);
return rc;
}