Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit af0f1b34 authored by Sridhar Ancha's avatar Sridhar Ancha
Browse files

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: default avatarChaitanya Pratapa <cpratapa@qti.qualcomm.com>
Signed-off-by: default avatarSridhar Ancha <sancha@codeaurora.org>
parent f295d9e7
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -3454,6 +3454,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)) {
@@ -3465,6 +3466,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)
@@ -4132,6 +4134,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;
+2 −0
Original line number Diff line number Diff line
@@ -1320,6 +1320,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;
@@ -1327,6 +1328,7 @@ struct ipa3_transport_pm {
	bool res_rel_in_prog;
	atomic_t dec_clients;
	atomic_t eot_activity;
	struct mutex transport_pm_mutex;
};

/**