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(); }
static inline void msm_mpm_write_barrier(void) { /* * By the time the read from memory returns, all previous * writes are guaranteed visible. */ msm_mpm_read(MSM_MPM_STATUS_REG_PENDING, 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 }