msm: ipa3: 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 contexts. Make a change to protect
sps_release_resource to make sure IPA clock is released
only once.

Change-Id: I39a806ee6c5c836928bc07295d17e12108836709
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-21 23:11:10 +05:30 committed by Gerrit - the friendly Code Review server
parent e379f786aa
commit baa5a76ae4
2 changed files with 6 additions and 0 deletions

View file

@ -3612,6 +3612,7 @@ static int ipa3_apps_cons_request_resource(void)
static void ipa3_sps_release_resource(struct work_struct *work)
{
mutex_lock(&ipa3_ctx->transport_pm.transport_pm_mutex);
/* check whether still need to decrease client usage */
if (atomic_read(&ipa3_ctx->transport_pm.dec_clients)) {
if (atomic_read(&ipa3_ctx->transport_pm.eot_activity)) {
@ -3623,6 +3624,7 @@ static void ipa3_sps_release_resource(struct work_struct *work)
}
}
atomic_set(&ipa3_ctx->transport_pm.eot_activity, 0);
mutex_unlock(&ipa3_ctx->transport_pm.transport_pm_mutex);
}
int ipa3_create_apps_resource(void)
@ -4402,6 +4404,8 @@ static int ipa3_pre_init(const struct ipa3_plat_drv_res *resource_p,
goto fail_create_transport_wq;
}
/* Initialize the SPS PM lock. */
mutex_init(&ipa3_ctx->transport_pm.transport_pm_mutex);
spin_lock_init(&ipa3_ctx->transport_pm.lock);
ipa3_ctx->transport_pm.res_granted = false;
ipa3_ctx->transport_pm.res_rel_in_prog = false;

View file

@ -974,6 +974,7 @@ struct ipa3_uc_wdi_ctx {
* @lock: lock for ensuring atomic operations
* @res_granted: true if SPS requested IPA resource and IPA granted it
* @res_rel_in_prog: true if releasing IPA resource is in progress
* @transport_pm_mutex: Mutex to protect the transport_pm functionality.
*/
struct ipa3_transport_pm {
spinlock_t lock;
@ -981,6 +982,7 @@ struct ipa3_transport_pm {
bool res_rel_in_prog;
atomic_t dec_clients;
atomic_t eot_activity;
struct mutex transport_pm_mutex;
};
/**