void spm_dpidle_after_wfi(void)
{
#ifdef CONFIG_SMP
        //if (gpt_check_irq(GPT4)) {
        if (gpt_check_and_ack_irq(idle_gpt)) {
            /* waked up by WAKEUP_GPT */
            localtimer_set_next_event(1);
        } else {
            /* waked up by other wakeup source */
            unsigned int cnt, cmp;
            gpt_get_cnt(idle_gpt, &cnt);
            gpt_get_cmp(idle_gpt, &cmp);
            if (unlikely(cmp < cnt)) {
                idle_err("[%s]GPT%d: counter = %10u, compare = %10u\n", __func__,
                        idle_gpt + 1, cnt, cmp);
                BUG();
            }

            localtimer_set_next_event(cmp-cnt);
            stop_gpt(idle_gpt);
            //GPT_ClearCount(WAKEUP_GPT);
        }
#endif

    //clkmux_sel(MT_MUX_AUDINTBUS, 1, "Deepidle"); //mainpll
    clkmgr_faudintbus_sq2pll();
    bus_dcm_disable();

    dpidle_cnt[0]++;
}
void spm_dpidle_after_wfi(void)
{

#ifdef CONFIG_SMP
    //if (gpt_check_irq(GPT4)) {
    if (gpt_check_and_ack_irq(GPT4)) {
        /* waked up by WAKEUP_GPT */
        localtimer_set_next_event(1);
    } else {
        /* waked up by other wakeup source */
        unsigned int cnt, cmp;
        gpt_get_cnt(GPT4, &cnt);
        gpt_get_cmp(GPT4, &cmp);
        if (unlikely(cmp < cnt)) {
            idle_err("[%s]GPT%d: counter = %10u, compare = %10u\n", __func__,
                     GPT4 + 1, cnt, cmp);
            BUG();
        }

        localtimer_set_next_event(cmp-cnt);
        stop_gpt(GPT4);
        //GPT_ClearCount(WAKEUP_GPT);
        free_gpt(GPT4);

    }
#endif
    disable_clock(MT_CG_PMIC_SW_CG_AP, "DEEP_IDLE");
    clkmux_sel(MT_CLKMUX_AUD_INTBUS_SEL,g_clk_aud_intbus_sel,"Deep_Idle");

    dpidle_cnt[0]++;
}
void mcidle_after_wfi(int cpu)
{
#ifdef CONFIG_SMP
    unsigned int id = mcidle_gpt_percpu[cpu];
    //if (cpu != 0) {
    if (gpt_check_and_ack_irq(id)) {
        localtimer_set_next_event(1);
    } else {
        /* waked up by other wakeup source */
        unsigned int cnt, cmp;
        gpt_get_cnt(id, &cnt);
        gpt_get_cmp(id, &cmp);
        if (unlikely(cmp < cnt)) {
            idle_err("[%s]GPT%d: counter = %10u, compare = %10u\n", __func__,
                     id + 1, cnt, cmp);
            BUG();
        }

        localtimer_set_next_event(cmp-cnt);
        stop_gpt(id);

        free_gpt(id);

    }
    //}
#endif
    mcidle_cnt[cpu]++;
}
Exemplo n.º 4
0
void spm_dpidle_after_wfi(void)
{
#if 0
    idle_info("[%s]timer_left=%u, timer_left2=%u, delta=%u\n", 
        dpidle_timer_left, dpidle_timer_left2, dpidle_timer_left-dpidle_timer_left2);
#endif

    //if (gpt_check_irq(GPT4)) {
    if (gpt_check_and_ack_irq(GPT4)) {
        /* waked up by WAKEUP_GPT */
        localtimer_set_next_event(1);
    } else {
        /* waked up by other wakeup source */
        unsigned int cnt, cmp;
        gpt_get_cnt(GPT4, &cnt);
        gpt_get_cmp(GPT4, &cmp);
        if (unlikely(cmp < cnt)) {
            idle_err("[%s]GPT%d: counter = %10u, compare = %10u\n", __func__, 
                    GPT4 + 1, cnt, cmp);
            BUG();
        }

        localtimer_set_next_event(cmp-cnt);
        stop_gpt(GPT4);
        //GPT_ClearCount(WAKEUP_GPT);
    }

    faudintbus_sq2pll();

    bus_dcm_disable();
    
    dpidle_cnt[0]++;
}
Exemplo n.º 5
0
void spm_mcdi_after_wfi(int cpu)
{
    unsigned int id = mcidle_gpt_percpu[cpu];
    if (cpu != 0) {
        if (gpt_check_and_ack_irq(id)) {
            localtimer_set_next_event(1);
        } else {
            /* waked up by other wakeup source */
            unsigned int cnt, cmp;
            gpt_get_cnt(id, &cnt);
            gpt_get_cmp(id, &cmp);
            if (unlikely(cmp < cnt)) {
                printk("[%s]GPT%d: counter = %10u, compare = %10u\n", __func__, 
                        id + 1, cnt, cmp);
                BUG();
            }
        
            localtimer_set_next_event(cmp-cnt);
            stop_gpt(id);
#ifdef SPM_SUSPEND_GPT_EN
            free_gpt(id);
#endif
        }
    }

}
Exemplo n.º 6
0
void mcidle_after_wfi(int cpu)
{
    u64 cmp;

    cpu_xgpt_irq_dis(cpu);//ack cpuxgpt, api need refine from Weiqi

    cmp = (localtimer_get_phy_count()-mcidle_timer_before_wfi[cpu]);

    if( cmp < (int)mcidle_timer_left2[cpu] )
        localtimer_set_next_event(mcidle_timer_left2[cpu]-cmp);
    else
        localtimer_set_next_event(1);
}
void soidle_after_wfi(bool sodi_en)
{
#ifdef CONFIG_SMP
    if (gpt_check_and_ack_irq(GPT4)) {
        localtimer_set_next_event(1);
    } else {
        /* waked up by other wakeup source */
        unsigned int cnt, cmp;
        gpt_get_cnt(GPT4, &cnt);
        gpt_get_cmp(GPT4, &cmp);
        if (unlikely(cmp < cnt)) {
            idle_err("[%s]GPT%d: counter = %10u, compare = %10u\n", __func__,
                     GPT4 + 1, cnt, cmp);
            BUG();
        }
        localtimer_set_next_event(cmp-cnt);
        stop_gpt(GPT4);
        free_gpt(GPT4);
    }
#endif
    if(sodi_en)
        soidle_cnt[0]++;
}
Exemplo n.º 8
0
void sc_dpidle_after_wfi(void)
{
#ifdef PROFILE_DPIDLE
    dpidle_tick_pos = GPT_GetCounter(GPT2);
    dpidle_wakeup_src = DRV_Reg32(SC_WAKEUP_SRC);
    if (dpidle_debug_mask & DEBUG_PROFILE) {
#ifdef CONFIG_LOCAL_TIMERS
        dcm_info("[%s]%5d %10u %10u %10u %10u %08x\n", __func__, 
                dpidle_profile_idx, dpidle_tick_pre, dpidle_tick_mid, dpidle_tick_pos,
                dpidle_counter, dpidle_wakeup_src);
#else
        dcm_info("[%s]%5d %10u %10u %10u %10u %10u %10u %08x\n", __func__, 
                dpidle_profile_idx, dpidle_tick_pre, dpidle_tick_mid, dpidle_tick_pos,
                dpidle_counter, dpidle_compare, dpidle_compare_update, dpidle_wakeup_src);

#endif
        dpidle_profile_idx++;
    }
#endif

#ifdef CONFIG_LOCAL_WDT
    wdt_tick_pos = GPT_GetCounter(GPT2);
    if (wdt_counter_pre > (wdt_tick_pos - wdt_tick_pre)) {
        wdt_counter_pos = wdt_counter_pre - (wdt_tick_pos - wdt_tick_pre);
        mpcore_wdt_set_counter(wdt_counter_pos);
    } else {
        dcm_info("[%s]:wdt_counter_pre=%10lu, wdt_tick_pre=%10lu, wdt_tick_pos=%10lu\n", 
                __func__, wdt_counter_pre, wdt_tick_pre, wdt_tick_pos);
        mpcore_wdt_set_counter(1);
    }
#endif

#ifdef CONFIG_LOCAL_TIMERS
    if (GPT_Get_IRQ(WAKEUP_GPT)) {
        /* waked up by WAKEUP_GPT */
        localtimer_set_next_event(1);
    } else {
        /* waked up by other wakeup source */
        unsigned int temp1 = GPT_GetCompare(WAKEUP_GPT);
        unsigned int temp2 = GPT_GetCounter(WAKEUP_GPT);
        if (unlikely(temp1 <= temp2)) {
            dcm_err("[%s]GPT%d: counter = %10u, compare = %10u\n", __func__, temp1, temp2);
            BUG();
        }

        localtimer_set_next_event(temp1-temp2);
        GPT_Stop(WAKEUP_GPT);
        GPT_ClearCount(WAKEUP_GPT);
    }
#endif

    if (get_chip_eco_ver() == CHIP_E1) {
        DRV_SetReg32(WPLL_CON0, 0x1);        
    } else {
        if (mmsys_switched_off) {
            DRV_ClrReg16(MDPLL_CON0, 0x1);
            udelay(20);
            mm_clk_sq2pll();
            mmsys_switched_off = 0;
        }
    }   

#if 0
    /* restore TOP_MISC */
    DRV_WriteReg32(TOP_MISC, topmisc);
#endif

    dpidle_count++;
    if ((dpidle_debug_mask & DEBUG_TRACING)) {
        dpidle_single_count++;
    }
}