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]++;
}
Ejemplo n.º 2
0
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 mt_idle_init(void)
{
    int err = 0;

    idle_info("[%s]entry!!\n", __func__);
    arm_pm_idle = arch_idle;

#ifndef SPM_SUSPEND_GPT_EN
    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__);
    }
#endif

    err = sysfs_create_file(power_kobj, &idle_state_attr.attr);
#ifdef SPM_MCDI_FUNC
    err |= sysfs_create_file(power_kobj, &mcidle_state_attr.attr);
#endif
    err |= sysfs_create_file(power_kobj, &soidle_state_attr.attr);
    err |= sysfs_create_file(power_kobj, &dpidle_state_attr.attr);
    err |= sysfs_create_file(power_kobj, &rgidle_state_attr.attr);

    if (err) {
        idle_err("[%s]: fail to create sysfs\n", __func__);
    }
}
Ejemplo n.º 5
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]++;
}
Ejemplo n.º 6
0
void mt_idle_init(void)
{

    int err = 0;
    int i = 0;

    idle_info("[%s]entry!!\n", __func__);
	
    arm_pm_idle = arch_idle;

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

    err = 0;

    for(i=0;i<NR_CPUS;i++){
        err |= cpu_xgpt_register_timer(i,NULL);
    }

    if (err) {
        idle_info("[%s]fail to request cpuxgpt\n", __func__);
    }
#if defined(CONFIG_PM)
    err = sysfs_create_file(power_kobj, &idle_state_attr.attr);
    err |= sysfs_create_file(power_kobj, &soidle_state_attr.attr);
    err |= sysfs_create_file(power_kobj, &dpidle_state_attr.attr);
    err |= sysfs_create_file(power_kobj, &rgidle_state_attr.attr);
    if (err) {
        idle_err("[%s]: fail to create sysfs\n", __func__);
    }
#endif	
}
Ejemplo n.º 7
0
void mt_idle_init(void)
{
    int err = 0;
    
    idle_info("[%s]entry!!\n", __func__);
    arm_pm_idle = arch_idle;

#ifndef SPM_SODI_ENABLED
    idle_switch[IDLE_TYPE_SO] = 0;
#endif

    //92 deepidle keep use xgpt
    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__);
    }


    err = cpu_xgpt_register_timer(0,NULL);
    err |= cpu_xgpt_register_timer(1,NULL);
    err |= cpu_xgpt_register_timer(2,NULL);
    err |= cpu_xgpt_register_timer(3,NULL);
    err |= cpu_xgpt_register_timer(4,NULL);
    err |= cpu_xgpt_register_timer(5,NULL);
    err |= cpu_xgpt_register_timer(6,NULL);
    err |= cpu_xgpt_register_timer(7,NULL);
    if (err) {
        idle_info("[%s]fail to request cpuxgpt\n", __func__);
    }
    

    err = sysfs_create_file(power_kobj, &idle_state_attr.attr);
#ifdef SPM_SODI_ENABLED
    err |= sysfs_create_file(power_kobj, &soidle_state_attr.attr);
#endif
#ifdef SPM_MCDI_FUNC
    err |= sysfs_create_file(power_kobj, &mcidle_state_attr.attr);
#endif
    err |= sysfs_create_file(power_kobj, &dpidle_state_attr.attr);
    err |= sysfs_create_file(power_kobj, &slidle_state_attr.attr);
    err |= sysfs_create_file(power_kobj, &rgidle_state_attr.attr);

    if (err) {
        idle_err("[%s]: fail to create sysfs\n", __func__);
    }
}
Ejemplo n.º 8
0
void mt_idle_init(void)
{
    int err = 0;
    int i = 0;

    CHIP_SW_VER ver=mt_get_chip_sw_ver();

    if(CHIP_SW_VER_02<=ver)
    {
        memcpy(idle_switch,idle_switch_E2,sizeof(idle_switch));
        //return;//TODO,for E2 default off arch_idle
    }

    idle_info("[%s]entry!!\n", __func__);

    arm_pm_idle = arch_idle;

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

    err = 0;

    for(i=0;i<NR_CPUS;i++){
        err |= cpu_xgpt_register_timer(i,NULL);
    }

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

    err = sysfs_create_file(power_kobj, &idle_state_attr.attr);
    err |= sysfs_create_file(power_kobj, &soidle_state_attr.attr);
    err |= sysfs_create_file(power_kobj, &mcidle_state_attr.attr);
    err |= sysfs_create_file(power_kobj, &dpidle_state_attr.attr);
    err |= sysfs_create_file(power_kobj, &slidle_state_attr.attr);
    err |= sysfs_create_file(power_kobj, &rgidle_state_attr.attr);

    if (err) {
        idle_err("[%s]: fail to create sysfs\n", __func__);
    }
}
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]++;
}