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);
}
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);
}
int cpu_xgpt_set_timer(int id, u64 ns)
{
	u64 count = 0;
	u64 now = 0;
	u64 set_count = 0;
	unsigned int set_count_lo = 0;
unsigned int set_count_hi = 0;
	count = ns;
	now = localtimer_get_phy_count();
	do_div(count, 1000/13);

	set_count = count + now;
	set_count_lo = 0x00000000FFFFFFFF & set_count;
	set_count_hi = (0xFFFFFFFF00000000 & set_count)>>32;

	pr_debug("%s:set cpuxgpt(%d) count(%u,%u)\n", __func__ , id, set_count_hi, set_count_lo);

	__cpuxgpt_set_cmp(id, set_count_hi, set_count_lo);
	__cpuxgpt_irq_en(id);
	return 0;
}
Example #4
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;


}