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

Commit 121d32db authored by Ravinder Konka's avatar Ravinder Konka
Browse files

msm: ipa: Fix to release the IPA clock



There is a possibility we receive back to back suspend
interrupts and enable IPA clocks twice. if the work is
already scheduled to release the SPS resource then subsequent
work will not be queued and as a result IPA client count
will always be greater than 0. Make a change to not to honor
back to back suspend interrupts.

Change-Id: I5f09cd2a2e4f0b1881940040405dfd258757285e
Acked-by: default avatarChaitanya Pratapa <cpratapa@qti.qualcomm.com>
Signed-off-by: default avatarRavinder Konka <rkonka@codeaurora.org>
parent ad9fe5a4
Loading
Loading
Loading
Loading
+12 −5
Original line number Diff line number Diff line
@@ -3017,9 +3017,15 @@ void ipa_suspend_handler(enum ipa_irq_type interrupt,
				 * pipe will be unsuspended as part of
				 * enabling IPA clocks
				 */
				if (!atomic_read(
					&ipa_ctx->sps_pm.dec_clients)
					) {
					ipa_inc_client_enable_clks();
				ipa_ctx->sps_pm.dec_clients = true;
					atomic_set(
						&ipa_ctx->sps_pm.dec_clients,
						1);
					ipa_sps_process_irq_schedule_rel();
				}
			} else {
				resource = ipa2_get_rm_resource_from_ep(i);
				res = ipa_rm_request_resource_with_timer(
@@ -3082,11 +3088,12 @@ static int apps_cons_request_resource(void)
static void ipa_sps_release_resource(struct work_struct *work)
{
	/* check whether still need to decrease client usage */
	if (ipa_ctx->sps_pm.dec_clients) {
	if (atomic_read(&ipa_ctx->sps_pm.dec_clients)) {
		if (atomic_read(&ipa_ctx->sps_pm.eot_activity)) {
			IPADBG("EOT pending Re-scheduling\n");
			ipa_sps_process_irq_schedule_rel();
		} else {
			ipa_ctx->sps_pm.dec_clients = false;
			atomic_set(&ipa_ctx->sps_pm.dec_clients, 0);
			ipa_dec_client_disable_clks();
		}
	}
+1 −1
Original line number Diff line number Diff line
@@ -1067,7 +1067,7 @@ struct ipa_uc_wdi_ctx {
 *  the inactivity timer
 */
struct ipa_sps_pm {
	bool dec_clients;
	atomic_t dec_clients;
	atomic_t eot_activity;
};

+12 −5
Original line number Diff line number Diff line
@@ -2985,9 +2985,15 @@ void ipa3_suspend_handler(enum ipa_irq_type interrupt,
				 * pipe will be unsuspended as part of
				 * enabling IPA clocks
				 */
				if (!atomic_read(
					&ipa3_ctx->transport_pm.dec_clients)
					) {
					ipa3_inc_client_enable_clks();
				ipa3_ctx->transport_pm.dec_clients = true;
					atomic_set(
					&ipa3_ctx->transport_pm.dec_clients,
					1);
					ipa3_sps_process_irq_schedule_rel();
				}
			} else {
				resource = ipa3_get_rm_resource_from_ep(i);
				res =
@@ -3051,11 +3057,12 @@ static int ipa3_apps_cons_request_resource(void)
static void ipa3_sps_release_resource(struct work_struct *work)
{
	/* check whether still need to decrease client usage */
	if (ipa3_ctx->transport_pm.dec_clients) {
	if (atomic_read(&ipa3_ctx->transport_pm.dec_clients)) {
		if (atomic_read(&ipa3_ctx->transport_pm.eot_activity)) {
			IPADBG("EOT pending Re-scheduling\n");
			ipa3_sps_process_irq_schedule_rel();
		} else {
			ipa3_ctx->transport_pm.dec_clients = false;
			atomic_set(&ipa3_ctx->transport_pm.dec_clients, 0);
			ipa3_dec_client_disable_clks();
		}
	}
+1 −1
Original line number Diff line number Diff line
@@ -1209,7 +1209,7 @@ struct ipa3_transport_pm {
	spinlock_t lock;
	bool res_granted;
	bool res_rel_in_prog;
	bool dec_clients;
	atomic_t dec_clients;
	atomic_t eot_activity;
};