void soidle_before_wfi(void)
{
#ifdef CONFIG_SMP
    int err = 0;

    soidle_timer_left2 = localtimer_get_counter();

    free_gpt(GPT4);
    err = request_gpt(GPT4, GPT_ONE_SHOT, GPT_CLK_SRC_SYS, GPT_CLK_DIV_1,
                      0, NULL, GPT_NOAUTOEN);
    if (err) {
        idle_info("[%s]fail to request GPT4\n", __func__);
    }

    soidle_timer_left2 = localtimer_get_counter();

    if( soidle_timer_left2 <=0 )
        gpt_set_cmp(GPT4, 1);//Trigger GPT4 Timerout imediately
    else
        gpt_set_cmp(GPT4, soidle_timer_left2);

    start_gpt(GPT4);
#else
    gpt_get_cnt(GPT1, &soidle_timer_left2);
#endif

}
void spm_dpidle_before_wfi(void)
{

    int err = 0;


    g_clk_aud_intbus_sel = clkmux_get(MT_CLKMUX_AUD_INTBUS_SEL,"Deep_Idle");
    clkmux_sel(MT_CLKMUX_AUD_INTBUS_SEL, MT_CG_SYS_26M,"Deep_Idle");

    enable_clock(MT_CG_PMIC_SW_CG_AP, "DEEP_IDLE");//PMIC CG bit for AP. SPM need PMIC wrapper clock to change Vcore voltage
#ifdef CONFIG_SMP

    free_gpt(GPT4);
    err = request_gpt(GPT4, GPT_ONE_SHOT, GPT_CLK_SRC_SYS, GPT_CLK_DIV_1,
                      0, NULL, GPT_NOAUTOEN);

    if (err) {
        idle_info("[%s]fail to request GPT4\n", __func__);
    }

    dpidle_timer_left2 = localtimer_get_counter();

    if( dpidle_timer_left2 <=0 )
        gpt_set_cmp(GPT4, 1);//Trigger GPT4 Timerout imediately
    else
        gpt_set_cmp(GPT4, dpidle_timer_left2);

    start_gpt(GPT4);
#else
    gpt_get_cnt(GPT1, &dpidle_timer_left2);
#endif

}
Esempio n. 3
0
void soidle_before_wfi(int cpu)
{
    int err = 0;
    unsigned int id = soidle_gpt_percpu[cpu];
    
        free_gpt(id);
        err = request_gpt(id, GPT_ONE_SHOT, GPT_CLK_SRC_SYS, GPT_CLK_DIV_1, 
                    0, NULL, GPT_NOAUTOEN);
        if (err) {
            idle_info("[%s]fail to request GPT4\n", __func__);
        }
    
        soidle_timer_left2[cpu] = localtimer_get_counter(); 


        if( (int)soidle_timer_left2[cpu] <=0 )
        {
            gpt_set_cmp(id, 1);//Trigger GPT4 Timerout imediately
        }
        else    
            gpt_set_cmp(id, soidle_timer_left2[cpu]);
        
        start_gpt(id);

}
void spm_dpidle_before_wfi(void)
{
    if (TRUE == mt_dpidle_chk_golden)
    {
    //FIXME:
#if 0
        mt_power_gs_dump_dpidle();
#endif
    }
    bus_dcm_enable();
    clkmgr_faudintbus_pll2sq();
    //clkmux_sel(MT_MUX_AUDINTBUS, 0, "Deepidle"); //select 26M


#ifdef CONFIG_SMP
    dpidle_timer_left2 = localtimer_get_counter();

    if( (int)dpidle_timer_left2 <=0 )
        gpt_set_cmp(idle_gpt, 1);//Trigger GPT4 Timerout imediately
    else
        gpt_set_cmp(idle_gpt, dpidle_timer_left2);

    start_gpt(idle_gpt);
#else
    gpt_get_cnt(idle_gpt, &dpidle_timer_left2);
#endif
}
Esempio n. 5
0
bool soidle_can_enter(int cpu)
{
    int reason = NR_REASONS;

#ifdef CONFIG_SMP
    if ((atomic_read(&is_in_hotplug) == 1)||(num_online_cpus() != 1)) {
        reason = BY_CPU;
        goto out;
    }
#endif

    if(idle_spm_lock){
        reason = BY_VTG;
        goto out;
    }

    //FIXED ME. this checking is needed in 6735?
    // decide when to enable SODI by display driver
    if(spm_get_sodi_en()==0){
        reason = BY_OTH;
        goto out;
	}
	
    memset(soidle_block_mask, 0, NR_GRPS * sizeof(unsigned int));
    if (!clkmgr_idle_can_enter(soidle_condition_mask, soidle_block_mask)) {
        reason = BY_CLK;
        goto out;
    }

#ifdef CONFIG_SMP
    soidle_timer_left = localtimer_get_counter();
    if ((int)soidle_timer_left < soidle_time_critera ||
            ((int)soidle_timer_left) < 0) {
        reason = BY_TMR;
        goto out;
    }
#else
    gpt_get_cnt(GPT1, &soidle_timer_left);
    gpt_get_cmp(GPT1, &soidle_timer_cmp);
    if((soidle_timer_cmp-soidle_timer_left)<soidle_time_critera)
    {
        reason = BY_TMR;
        goto out;
    }
#endif

out:
    if (reason < NR_REASONS) {
        soidle_block_cnt[cpu][reason]++;
        return false;
    } else {
        return true;
    }
}
bool soidle_can_enter(int cpu)
{
    int reason = NR_REASONS;

#ifdef CONFIG_SMP
    if ((atomic_read(&is_in_hotplug) == 1)||(atomic_read(&hotplug_cpu_count) != 1)) {
        reason = BY_CPU;
        goto out;
    }
#endif
    if(idle_spm_lock){
        reason = BY_VTG;
        goto out;
    }


    if(spm_get_sodi_en()==0){
        reason = BY_OTH;
        goto out;
	}

    memset(soidle_block_mask, 0, NR_GRPS * sizeof(unsigned int));
    if (!clkmgr_idle_can_enter(soidle_condition_mask, soidle_block_mask)) {
        reason = BY_CLK;
        goto out;
    }

#ifdef CONFIG_SMP
    soidle_timer_left = localtimer_get_counter();
    if ((int)soidle_timer_left < soidle_time_critera ||
            ((int)soidle_timer_left) < 0) {
        reason = BY_TMR;
        goto out;
    }
#else
    gpt_get_cnt(GPT1, &soidle_timer_left);
    gpt_get_cmp(GPT1, &soidle_timer_cmp);
    if((soidle_timer_cmp-soidle_timer_left)<soidle_time_critera)
    {
        reason = BY_TMR;
        goto out;
    }
#endif


out:
    if (reason < NR_REASONS) {
        soidle_block_cnt[cpu][reason]++;
        return false;
    } else {
        return true;
    }
}
Esempio n. 7
0
void spm_dpidle_before_wfi(void)
{
    if (TRUE == mt_dpidle_chk_golden)
    {
        mt_power_gs_dump_dpidle();
    }

    bus_dcm_enable();

    faudintbus_pll2sq();

#if 0
        dpidle_timer_left = localtimer_get_counter();
        gpt_set_cmp(GPT4, dpidle_timer_left);
#else
        dpidle_timer_left2 = localtimer_get_counter();
        gpt_set_cmp(GPT4, dpidle_timer_left2);
#endif
        start_gpt(GPT4);

}
void mcidle_before_wfi(int cpu)
{
#ifdef CONFIG_SMP
    int err = 0;

    unsigned int id = mcidle_gpt_percpu[cpu];

    mcidle_timer_left2[cpu] = localtimer_get_counter();

    free_gpt(id);
    err = request_gpt(id, GPT_ONE_SHOT, GPT_CLK_SRC_SYS, GPT_CLK_DIV_1,
                      0, NULL, GPT_NOAUTOEN);
    if (err) {
        idle_info("[%s]fail to request GPT4\n", __func__);
    }

    mcidle_timer_left2[cpu] = localtimer_get_counter();


    if(cpu!=0)//core1~n, avoid gpt clear by core0
    {
        if( mcidle_timer_left2[cpu] <=2600 ) //200us(todo)
        {
            if(mcidle_timer_left2[cpu]<=0)
                gpt_set_cmp(id, 1);//Trigger GPT4 Timerout imediately
            else
                gpt_set_cmp(id, mcidle_timer_left2[cpu]);

            spm_write(SPM_SLEEP_CPU_WAKEUP_EVENT,spm_read(SPM_SLEEP_CPU_WAKEUP_EVENT)|0x1);//spm wake up directly

        }
        else
            gpt_set_cmp(id, mcidle_timer_left2[cpu]);

        start_gpt(id);
    }
#else
    gpt_get_cnt(GPT1, &mcidle_timer_left2);
#endif
}
void mcidle_before_wfi(int cpu)
{
    u64 set_count=0;

    spm_mcdi_xgpt_timeout[cpu]=0;

    mcidle_timer_left2[cpu] = localtimer_get_counter();
    mcidle_timer_before_wfi[cpu] =localtimer_get_phy_count();

   	set_count = mcidle_timer_before_wfi[cpu]+(int)mcidle_timer_left2[cpu];

    cpu_xgpt_set_cmp(cpu,set_count);
}
Esempio n. 10
0
static void idle_before_wfi(int cpu)
{
#ifdef PROFILE_IDLE
    idle_tick_pre[cpu] = GPT_GetCounter(GPT2);

#ifdef CONFIG_LOCAL_TIMERS
    idle_counter[cpu] = localtimer_get_counter();
#else
    idle_counter[cpu] = GPT_GetCounter(GPT1);
    idle_compare[cpu] = GPT_GetCompare(GPT1);	
#endif
#endif
}
bool mcidle_can_enter(int cpu)
{
    int reason = NR_REASONS;

#ifndef CONFIG_SMP
    unsigned int cmp;
#endif

    /* MCDI Only */
    if (cpu == 0) {
        reason = BY_OTH;
        goto mcidle_out;
    }

#ifdef CONFIG_SMP
    if (atomic_read(&hotplug_cpu_count) == 1) {
        reason = BY_CPU;
        goto mcidle_out;
    }
#endif

    if (atomic_read(&is_in_hotplug) == 1) {
        reason = BY_CPU;
        goto mcidle_out;
    }
#ifdef CONFIG_SMP
    mcidle_timer_left[cpu] = localtimer_get_counter();
    if (mcidle_timer_left[cpu] < mcidle_time_critera ||
            ((int)mcidle_timer_left[cpu]) < 0) {
        reason = BY_TMR;
        goto mcidle_out;
    }
#else
    gpt_get_cnt(GPT1, &mcidle_timer_left[cpu]);
    gpt_get_cmp(GPT1, &cmp);
    if((cmp-mcidle_timer_left[cpu])<mcidle_time_critera)
    {
        reason = BY_TMR;
        goto mcidle_out;
    }
#endif

mcidle_out:
    if (reason < NR_REASONS) {
        mcidle_block_cnt[cpu][reason]++;
        return false;
    } else {
        return true;
    }
}
Esempio n. 12
0
void spm_mcdi_before_wfi(int cpu)
{
    unsigned int id = mcidle_gpt_percpu[cpu];
    if (cpu != 0) {
        mcidle_timer_left2[cpu] = localtimer_get_counter(); 
#ifdef SPM_SUSPEND_GPT_EN
        err = request_gpt(id, GPT_ONE_SHOT, GPT_CLK_SRC_SYS, GPT_CLK_DIV_1, 
                    0, NULL, GPT_NOAUTOEN);
        if (err) {
            idle_info("[%s]fail to request GPT4\n", __func__);
        }
#endif        
        gpt_set_cmp(id, mcidle_timer_left2[cpu]);
        start_gpt(id);
    }
}
Esempio n. 13
0
bool soidle_can_enter(int cpu)
{
    int reason = NR_REASONS;

    if (TRUE == gSpm_IsLcmVideoMode) {
        reason = BY_OTH;
        goto out;
    }
    
    if (gSPM_SODI_EN != 0) {
        reason = BY_OTH;
        goto out;
    }
        
    /*if hotplug-ing, can't enter sodi avoid bootslave corrupt*/
    if (atomic_read(&is_in_hotplug) >= 1) {
        reason = BY_CPU;
        goto out;
    }  
    if (atomic_read(&hotplug_cpu_count) != 1) {
        reason = BY_CPU;
        goto out;
    }

    if (cpu == 0) {
        memset(soidle_block_mask, 0, NR_GRPS * sizeof(unsigned int));
        if (!clkmgr_idle_can_enter(soidle_condition_mask, soidle_block_mask)) {
            reason = BY_CLK;
            goto out;
        }
    }

    soidle_timer_left[cpu] = localtimer_get_counter();
    if (soidle_timer_left[cpu] < soidle_time_critera || 
            ((int)soidle_timer_left[cpu]) < 0) {
        reason = BY_TMR;
        goto out;
    }

out:
    if (reason < NR_REASONS) {
        soidle_block_cnt[cpu][reason]++;
        return false;
    } else {
        return true;
    }
}
Esempio n. 14
0
bool mcidle_can_enter(int cpu)
{
    int reason = NR_REASONS;

#if 0//core0 not pd
    if (cpu == 0) {
        reason = BY_OTH;
        goto mcidle_out;
    }
#endif

    /*if hotplug-ing, can't enter mcdi avoid bootslave corrupt*/
    if (atomic_read(&is_in_hotplug) >= 1) {
        reason = BY_CPU;
        goto mcidle_out;
    }    

    if (atomic_read(&hotplug_cpu_count) == 1) {
        reason = BY_CPU;
        goto mcidle_out;
    }
    
    if(spm_mcdi_can_enter()==0)
    {
        reason = BY_OTH;
        goto mcidle_out;
        
    }    
    
    mcidle_timer_left[cpu] = localtimer_get_counter();
    if (mcidle_timer_left[cpu] < mcidle_time_critera || 
            ((int)mcidle_timer_left[cpu]) < 0) {
        reason = BY_TMR;
        goto mcidle_out;
    }


mcidle_out:
    if (reason < NR_REASONS) {
        mcidle_block_cnt[cpu][reason]++;
        return false;
    } else {
        return true;
    }
}
Esempio n. 15
0
void soidle_before_wfi(int cpu)
{
#ifdef CONFIG_SMP
    soidle_timer_left2 = localtimer_get_counter();

    if( (int)soidle_timer_left2 <=0 )
    {
        gpt_set_cmp(idle_gpt, 1);//Trigger idle_gpt Timerout imediately
    }
    else
        gpt_set_cmp(idle_gpt, soidle_timer_left2);

    start_gpt(idle_gpt);
#else
    gpt_get_cnt(GPT1, &soidle_timer_left2);
#endif

}
Esempio n. 16
0
bool mcidle_can_enter(int cpu)
{
    int reason = NR_REASONS;

    if(cpu==0){
        reason = BY_VTG;
        goto mcidle_out;
    }

    if(idle_spm_lock){
        reason = BY_VTG;
        goto mcidle_out;
    }

    if (atomic_read(&hotplug_cpu_count) == 1) {
        reason = BY_CPU;
        goto mcidle_out;
    }

    if(spm_mcdi_can_enter()==0)
    {
        reason = BY_OTH;
        goto mcidle_out;

    }

    mcidle_timer_left[cpu] = localtimer_get_counter();
    if (mcidle_timer_left[cpu] < mcidle_time_critera ||
            ((int)mcidle_timer_left[cpu]) < 0) {
        reason = BY_TMR;
        goto mcidle_out;
    }


mcidle_out:
    if (reason < NR_REASONS) {
        mcidle_block_cnt[cpu][reason]++;
        return false;
    } else {
        return true;
    }
}
Esempio n. 17
0
bool sc_dpidle_can_enter(void)
{
#ifdef PROFILE_IDLE
    dpidle_tick_pre = GPT_GetCounter(GPT2);
#endif

#ifdef CONFIG_LOCAL_TIMERS
    dpidle_counter = localtimer_get_counter();
    if (dpidle_counter >= dpidle_time_critera) { // 13000 => 1ms
        GPT_SetCompare(WAKEUP_GPT, dpidle_counter);
        GPT_Start(WAKEUP_GPT);
        dpidle_state = 1;
        return true; 
    }

    if (dpidle_debug_mask & DEBUG_TRACING) {
        if (dpidle_counter > dpidle_block_interval) {
            dpidle_block_interval = dpidle_counter;
        }
        dpidle_sc_block_cnt++;
    }
#else /* !SMP */
    dpidle_counter = GPT_GetCounter(GPT1);
    dpidle_compare = GPT_GetCompare(GPT1);

    if (dpidle_compare >= dpidle_counter + dpidle_time_critera) { // 13000 => 1ms
        dpidle_state = 1;
        return true; 
    }

    if (dpidle_debug_mask & DEBUG_TRACING) {
        unsigned int delta = dpidle_compare - dpidle_counter;
        if (delta > dpidle_block_interval) {
            dpidle_block_interval = delta;
        }
        dpidle_sc_block_cnt++;
    }
#endif

    dpidle_state = 0;
    return false;
}
Esempio n. 18
0
static bool dpidle_can_enter(void)
{
    int reason = NR_REASONS;

	if (!mt_cpufreq_earlysuspend_status_get()){
		reason = BY_VTG;
        goto out;
	}

    /*if hotplug-ing, can't enter dpidle avoid bootslave corrupt*/
    if (atomic_read(&is_in_hotplug) >= 1) {
        reason = BY_CPU;
        goto out;
    }  

    //if ((smp_processor_id() != 0) || (num_online_cpus() != 1)) {
    if (atomic_read(&hotplug_cpu_count) != 1) {
        reason = BY_CPU;
        goto out;
    }

    memset(dpidle_block_mask, 0, NR_GRPS * sizeof(unsigned int));
    if (!clkmgr_idle_can_enter(dpidle_condition_mask, dpidle_block_mask)) {
        reason = BY_CLK;
        goto out;
    }

    dpidle_timer_left = localtimer_get_counter();
    if (dpidle_timer_left < dpidle_time_critera || 
            ((int)dpidle_timer_left) < 0) {
        reason = BY_TMR;
        goto out;
    }

out:	
    if (reason < NR_REASONS) {
        dpidle_block_cnt[reason]++;
        return false;
    } else {		
        return true;
    }
}
unsigned char soidle_can_enter(int cpu)
{
    int reason = NR_REASONS;


#ifdef CONFIG_SMP
    if ((atomic_read(&is_in_hotplug) == 1)||(atomic_read(&hotplug_cpu_count) != 1)) {
        reason = BY_CPU;
        goto soidle_out;
    }
#endif

    memset(soidle_block_mask, 0, NR_GRPS * sizeof(unsigned int));
    if (!clkmgr_idle_can_enter(soidle_condition_mask, soidle_block_mask)) {
        reason = BY_CLK;
        goto soidle_out;
    }

#ifdef CONFIG_SMP
    soidle_timer_left = localtimer_get_counter();
    if (soidle_timer_left < soidle_time_critera ||
            ((int)soidle_timer_left) < 0) {
        reason = BY_TMR;
        goto soidle_out;
    }
#else
    gpt_get_cnt(GPT1, &soidle_timer_left);
    gpt_get_cmp(GPT1, &soidle_timer_cmp);
    if((soidle_timer_cmp-soidle_timer_left)<soidle_time_critera)
    {
        reason = BY_TMR;
        goto soidle_out;
    }
#endif


soidle_out:
    if (reason < NR_REASONS)
        soidle_block_cnt[cpu][reason]++;
    return reason;
}
Esempio n. 20
0
void mcidle_before_wfi(int cpu)
{
    int err = 0;
    u64 set_count=0;
	unsigned int set_count_lo = 0;
    unsigned int set_count_hi = 0;
    
    spm_mcdi_xgpt_timeout[cpu]=0;

    mcidle_timer_left2[cpu] = localtimer_get_counter(); 
    mcidle_timer_before_wfi[cpu] =localtimer_get_phy_count();

   	set_count = mcidle_timer_before_wfi[cpu]+(int)mcidle_timer_left2[cpu];
    
    //set_count_lo = 0x00000000FFFFFFFF & set_count;
    //set_count_hi = (0xFFFFFFFF00000000 & set_count)>>32;
    cpu_xgpt_set_cmp(cpu,set_count);

    return true;


}
void soidle_before_wfi(int cpu)
{
#ifdef CONFIG_SMP
	#if !defined(SODI_APxGPT_TimerCount) || (SODI_APxGPT_TimerCount == 0)
	soidle_timer_left2 = localtimer_get_counter();
	#else
	soidle_timer_left2 = 13000000*SODI_APxGPT_TimerCount;
	#endif

    if( (int)soidle_timer_left2 <=0 )
    {
        gpt_set_cmp(idle_gpt, 1);//Trigger idle_gpt Timerout imediately
    }
    else
    {
        gpt_set_cmp(idle_gpt, soidle_timer_left2);
    }

    start_gpt(idle_gpt);
#else
    gpt_get_cnt(GPT1, &soidle_timer_left2);
#endif

}
static bool dpidle_can_enter(void)
{
    int reason = NR_REASONS;
    int i = 0;
    unsigned long long dpidle_block_curr_time = 0;

    if(dpidle_by_pass_cg==0){
        if (!mt_cpufreq_earlysuspend_status_get()){
            reason = BY_VTG;
            goto out;
        }
    }

#ifdef CONFIG_SMP
    if ((atomic_read(&is_in_hotplug) >= 1)||(num_online_cpus() != 1)) {
        reason = BY_CPU;
        goto out;
    }
#endif

    if(idle_spm_lock){
        reason = BY_VTG;
        goto out;
    }

    if(dpidle_by_pass_cg==0){
	    memset(dpidle_block_mask, 0, NR_GRPS * sizeof(unsigned int));
	    if (!clkmgr_idle_can_enter(dpidle_condition_mask, dpidle_block_mask)) {
	        reason = BY_CLK;
	        goto out;
	    }
    }
#ifdef CONFIG_SMP
    dpidle_timer_left = localtimer_get_counter();
    if ((int)dpidle_timer_left < dpidle_time_critera ||
            ((int)dpidle_timer_left) < 0) {
        reason = BY_TMR;
        goto out;
    }
#else
    gpt_get_cnt(GPT1, &dpidle_timer_left);
    gpt_get_cmp(GPT1, &dpidle_timer_cmp);
    if((dpidle_timer_cmp-dpidle_timer_left)<dpidle_time_critera)
    {
        reason = BY_TMR;
        goto out;
    }
#endif

out:
    if (reason < NR_REASONS) {
        if( dpidle_block_prev_time == 0 )
            dpidle_block_prev_time = idle_get_current_time_ms();

        dpidle_block_curr_time = idle_get_current_time_ms();
        if((dpidle_block_curr_time - dpidle_block_prev_time) > dpidle_block_time_critera)
        {
            if ((smp_processor_id() == 0))
            {
                for (i = 0; i < nr_cpu_ids; i++) {
                    idle_ver("dpidle_cnt[%d]=%lu, rgidle_cnt[%d]=%lu\n",
                            i, dpidle_cnt[i], i, rgidle_cnt[i]);
                }

                for (i = 0; i < NR_REASONS; i++) {
                    idle_ver("[%d]dpidle_block_cnt[%s]=%lu\n", i, reason_name[i],
                            dpidle_block_cnt[i]);
                }

                for (i = 0; i < NR_GRPS; i++) {
                    idle_ver("[%02d]dpidle_condition_mask[%-8s]=0x%08x\t\t"
                            "dpidle_block_mask[%-8s]=0x%08x\n", i,
                            grp_get_name(i), dpidle_condition_mask[i],
                            grp_get_name(i), dpidle_block_mask[i]);
                }
                memset(dpidle_block_cnt, 0, sizeof(dpidle_block_cnt));
                dpidle_block_prev_time = idle_get_current_time_ms();

            }


        }
        dpidle_block_cnt[reason]++;
        return false;
    } else {
        dpidle_block_prev_time = idle_get_current_time_ms();
        return true;
    }

}
bool soidle_can_enter(int cpu)
{
    int reason = NR_REASONS;
    unsigned long long soidle_block_curr_time = 0;

#ifdef CONFIG_SMP
    if ((atomic_read(&is_in_hotplug) == 1)||(num_online_cpus() != 1)) {
        reason = BY_CPU;
        goto out;
    }
#endif

    if(idle_spm_lock){
        reason = BY_VTG;
        goto out;
    }

#if !defined(SODI_DISPLAY_DRV_CHK_DIS) || (SODI_DISPLAY_DRV_CHK_DIS == 0)
    // decide when to enable SODI by display driver
    if(spm_get_sodi_en()==0){
        reason = BY_OTH;
        goto out;
	}
#endif

    if (soidle_by_pass_cg == 0) {
        memset(soidle_block_mask, 0, NR_GRPS * sizeof(unsigned int));
        if (!clkmgr_idle_can_enter(soidle_condition_mask, soidle_block_mask)) {
#if !defined(SODI_CG_CHK_DIS) || (SODI_CG_CHK_DIS == 0)
            reason = BY_CLK;
            goto out;
#endif
        }
    }

#ifdef CONFIG_SMP
    soidle_timer_left = localtimer_get_counter();
    if ((int)soidle_timer_left < soidle_time_critera ||
            ((int)soidle_timer_left) < 0) {
        reason = BY_TMR;
        goto out;
    }
#else
    gpt_get_cnt(GPT1, &soidle_timer_left);
    gpt_get_cmp(GPT1, &soidle_timer_cmp);
    if((soidle_timer_cmp-soidle_timer_left)<soidle_time_critera)
    {
        reason = BY_TMR;
        goto out;
    }
#endif

out:
    if (reason < NR_REASONS) {
        if( soidle_block_prev_time == 0 )
            soidle_block_prev_time = idle_get_current_time_ms();

        soidle_block_curr_time = idle_get_current_time_ms();
        if((soidle_block_curr_time - soidle_block_prev_time) > soidle_block_time_critera)
        {
            if ((smp_processor_id() == 0))
            {
                int i = 0;

                for (i = 0; i < nr_cpu_ids; i++) {
                    idle_ver("soidle_cnt[%d]=%lu, rgidle_cnt[%d]=%lu\n",
                            i, soidle_cnt[i], i, rgidle_cnt[i]);
                }

                for (i = 0; i < NR_REASONS; i++) {
                    idle_ver("[%d]soidle_block_cnt[0][%s]=%lu\n", i, reason_name[i],
                            soidle_block_cnt[0][i]);
                }

                for (i = 0; i < NR_GRPS; i++) {
                    idle_ver("[%02d]soidle_condition_mask[%-8s]=0x%08x\t\t"
                            "soidle_block_mask[%-8s]=0x%08x\n", i,
                            grp_get_name(i), soidle_condition_mask[i],
                            grp_get_name(i), soidle_block_mask[i]);
                }

                memset(soidle_block_cnt, 0, sizeof(soidle_block_cnt));
                soidle_block_prev_time = idle_get_current_time_ms();
            }
        }

        soidle_block_cnt[cpu][reason]++;
        return false;
    } else {
        soidle_block_prev_time = idle_get_current_time_ms();
        return true;
    }
}
static bool dpidle_can_enter(void)
{

    int reason = NR_REASONS;
    int i;
    unsigned long long dpidle_block_curr_time = 0;
#ifdef SPM_MCDI_FUNC
    if (En_SPM_MCDI != 0) {
        reason = BY_OTH;
        goto out;
    }
#endif

#ifdef CONFIG_SMP
    if ((atomic_read(&is_in_hotplug) == 1)||(atomic_read(&hotplug_cpu_count) != 1)) {
        reason = BY_CPU;
        goto out;
    }
#endif


    memset(dpidle_block_mask, 0, NR_GRPS * sizeof(unsigned int));
    if (!clkmgr_idle_can_enter(dpidle_condition_mask, dpidle_block_mask)) {
        reason = BY_CLK;
        goto out;
    }

#ifdef CONFIG_SMP
    dpidle_timer_left = localtimer_get_counter();
    if (dpidle_timer_left < dpidle_time_critera ||
            ((int)dpidle_timer_left) < 0) {
        reason = BY_TMR;
        goto out;
    }
#else
    gpt_get_cnt(GPT1, &dpidle_timer_left);
    gpt_get_cmp(GPT1, &dpidle_timer_cmp);
    if((dpidle_timer_cmp-dpidle_timer_left)<dpidle_time_critera)
    {
        reason = BY_TMR;
        goto out;
    }
#endif


out:
    if (reason < NR_REASONS) {
        if( dpidle_block_prev_time == 0 )
            dpidle_block_prev_time = idle_get_current_time_ms();

        dpidle_block_curr_time = idle_get_current_time_ms();
        if((dpidle_block_curr_time - dpidle_block_prev_time) > dpidle_block_time_critera)
        {
            if ((smp_processor_id() == 0))
            {
                for (i = 0; i < nr_cpu_ids; i++) {
                    idle_ver("dpidle_cnt[%d]=%lu, rgidle_cnt[%d]=%lu\n",
                             i, dpidle_cnt[i], i, rgidle_cnt[i]);
                }

                for (i = 0; i < NR_REASONS; i++) {
                    idle_ver("[%d]dpidle_block_cnt[%s]=%lu\n", i, reason_name[i],
                             dpidle_block_cnt[i]);
                }

                for (i = 0; i < NR_GRPS; i++) {
                    idle_ver("[%02d]dpidle_condition_mask[%-8s]=0x%08x\t\t"
                             "dpidle_block_mask[%-8s]=0x%08x\n", i,
                             grp_get_name(i), dpidle_condition_mask[i],
                             grp_get_name(i), dpidle_block_mask[i]);
                }

                //printk("dpidle_block_prev_time =%lu, dpidle_block_curr_time = %lu\n",dpidle_block_prev_time,dpidle_block_curr_time);

                memset(dpidle_block_cnt, 0, sizeof(dpidle_block_cnt));
                dpidle_block_prev_time = idle_get_current_time_ms();

            }


        }
        dpidle_block_cnt[reason]++;
        return false;
    } else {
        dpidle_block_prev_time = idle_get_current_time_ms();
        return true;
    }

}