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

Commit abbec11b authored by Amir Levy's avatar Amir Levy
Browse files

msm: ipa: add interface for restoring IPA suspend handler



Other drivers are able to remove existing suspend IRQ handler.
This change enables to restore the original suspend handler
which is registered on IPA initialization.

Change-Id: I88eec1c21b02424b1c09ff622d796b3e8d260931
Signed-off-by: default avatarAmir Levy <alevy@codeaurora.org>
parent 279ce12c
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -2288,6 +2288,23 @@ int ipa_remove_interrupt_handler(enum ipa_irq_type interrupt)
}
EXPORT_SYMBOL(ipa_remove_interrupt_handler);

/**
* ipa_restore_suspend_handler() - restores the original suspend IRQ handler
* as it was registered in the IPA init sequence.
* Return codes:
* 0: success
* -EPERM: failed to remove current handler or failed to add original handler
* */
int ipa_restore_suspend_handler(void)
{
	int ret;

	IPA_API_DISPATCH_RETURN(ipa_restore_suspend_handler);

	return ret;
}
EXPORT_SYMBOL(ipa_restore_suspend_handler);

/**
 * ipa_bam_reg_dump() - Dump selected BAM registers for IPA and DMA-BAM
 *
+2 −0
Original line number Diff line number Diff line
@@ -282,6 +282,8 @@ struct ipa_api_controller {

	int (*ipa_remove_interrupt_handler)(enum ipa_irq_type interrupt);

	int (*ipa_restore_suspend_handler)(void);

	void (*ipa_bam_reg_dump)(void);

	int (*ipa_get_ep_mapping)(enum ipa_client_type client);
+27 −0
Original line number Diff line number Diff line
@@ -3042,6 +3042,33 @@ void ipa_suspend_handler(enum ipa_irq_type interrupt,
	}
}

/**
* ipa2_restore_suspend_handler() - restores the original suspend IRQ handler
* as it was registered in the IPA init sequence.
* Return codes:
* 0: success
* -EPERM: failed to remove current handler or failed to add original handler
* */
int ipa2_restore_suspend_handler(void)
{
	int result = 0;

	result  = ipa2_remove_interrupt_handler(IPA_TX_SUSPEND_IRQ);
	if (result) {
		IPAERR("remove handler for suspend interrupt failed\n");
		return -EPERM;
	}

	result = ipa2_add_interrupt_handler(IPA_TX_SUSPEND_IRQ,
			ipa_suspend_handler, true, NULL);
	if (result) {
		IPAERR("register handler for suspend interrupt failed\n");
		result = -EPERM;
	}

	return result;
}

static int apps_cons_release_resource(void)
{
	return 0;
+1 −0
Original line number Diff line number Diff line
@@ -1967,4 +1967,5 @@ void ipa_suspend_apps_pipes(bool suspend);
void ipa_update_repl_threshold(enum ipa_client_type ipa_client);
void ipa_flow_control(enum ipa_client_type ipa_client, bool enable,
			uint32_t qmap_id);
int ipa2_restore_suspend_handler(void);
#endif /* _IPA_I_H_ */
+1 −0
Original line number Diff line number Diff line
@@ -278,6 +278,7 @@ int ipa2_remove_interrupt_handler(enum ipa_irq_type interrupt)
		return -EFAULT;
	}

	kfree(ipa_interrupt_to_cb[irq_num].private_data);
	ipa_interrupt_to_cb[irq_num].deferred_flag = false;
	ipa_interrupt_to_cb[irq_num].handler = NULL;
	ipa_interrupt_to_cb[irq_num].private_data = NULL;
Loading