Esempio n. 1
0
void msm_mpm_exit_sleep(bool from_idle)
{
	unsigned long pending;
	int i;
	int k;

	for (i = 0; i < MSM_MPM_REG_WIDTH; i++) {
		pending = msm_mpm_read(MSM_MPM_STATUS_REG_PENDING, i);

		if (MSM_MPM_DEBUG_PENDING_IRQ & msm_mpm_debug_mask)
			pr_info("%s: pending.%d: 0x%08lx", __func__,
					i, pending);

		k = find_first_bit(&pending, 32);
		while (k < 32) {
			unsigned int mpm_irq = 32 * i + k;
			unsigned int apps_irq = msm_mpm_get_irq_m2a(mpm_irq);
			struct irq_desc *desc = apps_irq ?
				irq_to_desc(apps_irq) : NULL;

			if (desc && !irqd_is_level_type(&desc->irq_data)) {
				irq_set_pending(apps_irq);
				if (from_idle)
					check_irq_resend(desc, apps_irq);
			}

			k = find_next_bit(&pending, 32, k + 1);
		}
	}

	msm_mpm_clear();
}
Esempio n. 2
0
static int __init msm_mpm_early_init(void)
{
	uint8_t mpm_irq;
	uint16_t apps_irq;

	for (mpm_irq = 0; msm_mpm_is_valid_mpm_irq(mpm_irq); mpm_irq++) {
		apps_irq = msm_mpm_get_irq_m2a(mpm_irq);
		if (apps_irq && msm_mpm_is_valid_apps_irq(apps_irq))
			msm_mpm_set_irq_a2m(apps_irq, mpm_irq);
	}

	return 0;
}
Esempio n. 3
0
void msm_mpm_exit_sleep(bool from_idle)
{
	unsigned long pending;
	int i;
	int k;

	for (i = 0; i < MSM_MPM_REG_WIDTH; i++) {
		pending = msm_mpm_read(MSM_MPM_STATUS_REG_PENDING, i);

		if ((MSM_MPM_DEBUG_PENDING_IRQ & msm_mpm_debug_mask) ||
			((!from_idle) && (MSM_MPM_DEBUG_SUSPEND_PENDING_IRQ & msm_mpm_debug_mask)))
			pr_info("%s: pending.%d: 0x%08lx\n", __func__,
				i, pending);

		k = find_first_bit(&pending, 32);
		while (k < 32) {
			unsigned int mpm_irq = 32 * i + k;
			unsigned int apps_irq = msm_mpm_get_irq_m2a(mpm_irq);
			struct irq_desc *desc = apps_irq ?
						irq_to_desc(apps_irq) : NULL;

			/*
			 * This function is called when only CPU 0 is
			 * running and when both preemption and irqs
			 * are disabled.  There is no need to lock desc.
			 */
			if (desc && (desc->status & IRQ_TYPE_EDGE_BOTH)) {
				desc->status |= IRQ_PENDING;
				if (from_idle)
					check_irq_resend(desc, apps_irq);
			}

			k = find_next_bit(&pending, 32, k + 1);
		}
	}

	msm_mpm_set(!from_idle);
}
void msm_mpm_exit_sleep(bool from_idle)
{
#ifndef CONFIG_PM_LOG_SIM_TEST
	unsigned long pending;
	int i;
	int k;

	for (i = 0; i < MSM_MPM_REG_WIDTH; i++) {
		pending = msm_mpm_read(MSM_MPM_STATUS_REG_PENDING, i);

		if (MSM_MPM_DEBUG_PENDING_IRQ & msm_mpm_debug_mask)
			pr_info("%s: pending.%d: 0x%08lx", __func__,
					i, pending);

#ifdef CONFIG_PM_LOG
		pmlog_update_status(i, pending);
#endif //CONFIG_PM_LOG
		k = find_first_bit(&pending, 32);
		while (k < 32) {
			unsigned int mpm_irq = 32 * i + k;
			unsigned int apps_irq = msm_mpm_get_irq_m2a(mpm_irq);
			struct irq_desc *desc = apps_irq ?
				irq_to_desc(apps_irq) : NULL;
			//Print wake up irq to debug power consumption
			/* Terry Cheng, 20120607, Needn't show wake up reason when waking from idle thread {*/
			if(!from_idle)
				printk("mpm_irq = %d, apps_irq = %d\n", mpm_irq, apps_irq);
			/* } Terry Cheng, 20120607, Needn't show wake up reason when waking from idle thread */
			if (desc && !irqd_is_level_type(&desc->irq_data)) {
				irq_set_pending(apps_irq);
				if (from_idle)
					check_irq_resend(desc, apps_irq);
			}

			k = find_next_bit(&pending, 32, k + 1);
		}
	}

	msm_mpm_clear();
#else
	unsigned long pending;
	int i;
	uint rand_interrupt;
	uint rand_which;

	srandom32((uint)jiffies);
	rand_interrupt = random32();
	rand_which = random32();

	//update wake up source
	pending = rand_interrupt % 32;
	pending = 1 << pending;
	i = rand_which % 2;
	//pending = pending % 31;
	
	pr_info("%s: pending.%d: 0x%08lx", __func__, i, pending);		
#ifdef CONFIG_PM_LOG
	pmlog_update_status(i, pending);
#endif	//CONFIG_PM_LOG
	return;	
#endif //CONFIG_PM_LOG_SIM_TEST	
}