summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSridhar Ancha <sancha@codeaurora.org>2016-04-11 14:43:29 +0530
committerJeevan Shriram <jshriram@codeaurora.org>2016-05-03 15:49:40 -0700
commit615ca55d1cb93b6cbea92f14be05f1611b494565 (patch)
tree09956ff52b7a2393126303c44fc687511c6d737d
parent7d371f05d03dcc771a1491034d2c8b517caee360 (diff)
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>
-rw-r--r--drivers/platform/msm/ipa/ipa_v2/ipa.c5
-rw-r--r--drivers/platform/msm/ipa/ipa_v2/ipa_i.h2
2 files changed, 7 insertions, 0 deletions
diff --git a/drivers/platform/msm/ipa/ipa_v2/ipa.c b/drivers/platform/msm/ipa/ipa_v2/ipa.c
index 06f8ab6e3e94..feb6225470ab 100644
--- a/drivers/platform/msm/ipa/ipa_v2/ipa.c
+++ b/drivers/platform/msm/ipa/ipa_v2/ipa.c
@@ -3473,6 +3473,7 @@ static int apps_cons_request_resource(void)
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 */
if (atomic_read(&ipa_ctx->sps_pm.dec_clients)) {
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);
+ mutex_unlock(&ipa_ctx->sps_pm.sps_pm_lock);
}
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");
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) */
result = ipa_rm_initialize();
if (result) {
diff --git a/drivers/platform/msm/ipa/ipa_v2/ipa_i.h b/drivers/platform/msm/ipa/ipa_v2/ipa_i.h
index ce2ffc8f1cee..7d5daf202112 100644
--- a/drivers/platform/msm/ipa/ipa_v2/ipa_i.h
+++ b/drivers/platform/msm/ipa/ipa_v2/ipa_i.h
@@ -1111,10 +1111,12 @@ struct ipa_uc_wdi_ctx {
* @dec_clients: true if need to decrease active clients count
* @eot_activity: represent EOT interrupt activity to determine to reset
* the inactivity timer
+ * @sps_pm_lock: Lock to protect the sps_pm functionality.
*/
struct ipa_sps_pm {
atomic_t dec_clients;
atomic_t eot_activity;
+ struct mutex sps_pm_lock;
};
/**