msm: ipa: Fix to release IPA clock during ap suspend

When AP is going to suspend, there is a possibility that
IPA clock is released twice due to sps_release_resource being
called from 2 different contexts. Make a change to protect
sps_release_resource to make sure IPA clock is released
only once.

Change-Id: I2d7d74e48ce80aa18cab2d42191db8d5edb4a076
Acked-by: Chaitanya Pratapa <cpratapa@qti.qualcomm.com>
Signed-off-by: Sridhar Ancha <sancha@codeaurora.org>
This commit is contained in:
Sridhar Ancha 2016-04-11 14:43:29 +05:30 committed by Jeevan Shriram
parent 7d371f05d0
commit 615ca55d1c
2 changed files with 7 additions and 0 deletions

View file

@ -3473,6 +3473,7 @@ static int apps_cons_request_resource(void)
static void ipa_sps_release_resource(struct work_struct *work) static void ipa_sps_release_resource(struct work_struct *work)
{ {
mutex_lock(&ipa_ctx->sps_pm.sps_pm_lock);
/* check whether still need to decrease client usage */ /* check whether still need to decrease client usage */
if (atomic_read(&ipa_ctx->sps_pm.dec_clients)) { if (atomic_read(&ipa_ctx->sps_pm.dec_clients)) {
if (atomic_read(&ipa_ctx->sps_pm.eot_activity)) { if (atomic_read(&ipa_ctx->sps_pm.eot_activity)) {
@ -3484,6 +3485,7 @@ static void ipa_sps_release_resource(struct work_struct *work)
} }
} }
atomic_set(&ipa_ctx->sps_pm.eot_activity, 0); atomic_set(&ipa_ctx->sps_pm.eot_activity, 0);
mutex_unlock(&ipa_ctx->sps_pm.sps_pm_lock);
} }
int ipa_create_apps_resource(void) int ipa_create_apps_resource(void)
@ -3946,6 +3948,9 @@ static int ipa_init(const struct ipa_plat_drv_res *resource_p,
wakeup_source_init(&ipa_ctx->w_lock, "IPA_WS"); wakeup_source_init(&ipa_ctx->w_lock, "IPA_WS");
spin_lock_init(&ipa_ctx->wakelock_ref_cnt.spinlock); spin_lock_init(&ipa_ctx->wakelock_ref_cnt.spinlock);
/* Initialize the SPS PM lock. */
mutex_init(&ipa_ctx->sps_pm.sps_pm_lock);
/* Initialize IPA RM (resource manager) */ /* Initialize IPA RM (resource manager) */
result = ipa_rm_initialize(); result = ipa_rm_initialize();
if (result) { if (result) {

View file

@ -1111,10 +1111,12 @@ struct ipa_uc_wdi_ctx {
* @dec_clients: true if need to decrease active clients count * @dec_clients: true if need to decrease active clients count
* @eot_activity: represent EOT interrupt activity to determine to reset * @eot_activity: represent EOT interrupt activity to determine to reset
* the inactivity timer * the inactivity timer
* @sps_pm_lock: Lock to protect the sps_pm functionality.
*/ */
struct ipa_sps_pm { struct ipa_sps_pm {
atomic_t dec_clients; atomic_t dec_clients;
atomic_t eot_activity; atomic_t eot_activity;
struct mutex sps_pm_lock;
}; };
/** /**