/*
  * Prepare interrupt susbsytem for entering sleep -- phase 2
  * Detect any pending interrupts and configure interrupt hardware.
  * Return value:
  * -EAGAIN: there are pending interrupt(s); interrupt configuration is not
  *		changed
  *	  0: Success
  */
int msm_gic_irq_enter_sleep2(bool modem_wake, int from_idle)
{
	if (from_idle && !modem_wake)
		return 0;

	/* edge triggered interrupt may get lost if this mode is used */
	WARN_ON_ONCE(!modem_wake && !from_idle);

	if (msm_gic_irq_debug_mask & IRQ_DEBUG_SLEEP)
		pr_info("%s interrupts pending\n", __func__);

	/* check the pending interrupts */
	if (msm_gic_spi_ppi_pending()) {
		if (msm_gic_irq_debug_mask & IRQ_DEBUG_SLEEP_ABORT)
			pr_info("%s aborted....\n", __func__);
		return -EAGAIN;
	}

	if (modem_wake) {
		/* save the contents of GIC CPU interface and Distributor
		 * Disable all the Interrupts, if we enter from idle pc
		 */
		msm_gic_save();
		irq_set_irq_type(MSM8625_INT_A9_M2A_6, IRQF_TRIGGER_RISING);
		enable_irq(MSM8625_INT_A9_M2A_6);
		pr_debug("%s going for sleep now\n", __func__);
	}

	return 0;
}
Ejemplo n.º 2
0
int msm_gic_irq_enter_sleep2(bool modem_wake, int from_idle)
{
	if (from_idle && !modem_wake)
		return 0;

	
	WARN_ON_ONCE(!modem_wake && !from_idle);

	if (msm_gic_irq_debug_mask & IRQ_DEBUG_SLEEP)
		pr_info("%s interrupts pending\n", __func__);

	
	if (msm_gic_spi_ppi_pending()) {
		if (msm_gic_irq_debug_mask & IRQ_DEBUG_SLEEP_ABORT)
			pr_info("%s aborted....\n", __func__);
		return -EAGAIN;
	}

	if (modem_wake) {
		msm_gic_save();
		irq_set_irq_type(MSM8625_INT_A9_M2A_6, IRQF_TRIGGER_RISING);
		enable_irq(MSM8625_INT_A9_M2A_6);
		pr_debug("%s going for sleep now\n", __func__);
	}

	return 0;
}