Exemplo n.º 1
0
static void kp_repeat_sr(unsigned long data)
{
	struct kp *kp_data=(struct kp *)data;
	u32 	status;
	u32  timer_period;

	status = READ_AOBUS_REG(AO_IR_DEC_STATUS);
	switch(status&REMOTE_HW_DECODER_STATUS_MASK) 
	{
		case REMOTE_HW_DECODER_STATUS_OK:
			kp_send_key(kp_data->input, (kp_data->cur_keycode>>16)&0xff, 0);
			repeat_flag = 0;
			break ;
		default:
			SET_AOBUS_REG_MASK(AO_IR_DEC_REG1,1);//reset ir deocoder
			CLEAR_AOBUS_REG_MASK(AO_IR_DEC_REG1,1);	
			if(kp_data->repeat_tick !=0)//new key coming in.
			{
				timer_period= jiffies + 10 ;  //timer peroid waiting for a stable state.
			}
			else //repeat key check
			{
				if(kp_data->repeat_enable)
				{
					kp_send_key(kp_data->input, (kp_data->cur_keycode>>16)&0xff, 2);
				}
				timer_period=jiffies+msecs_to_jiffies(kp_data->repeat_peroid);
			}
			mod_timer(&kp_data->repeat_timer,timer_period);
			kp_data->repeat_tick =0;
			break;
	}
Exemplo n.º 2
0
int aml_callkey_resume(struct platform_device *pdev)
{
    int v=0;
#ifdef CONFIG_AMLOGIC_MODEM
    if(!get_modemPower()){
    printk("aml_callkey_resume, modem is power off\n");
    return 0;
    }
#endif

    if (READ_AOBUS_REG(AO_RTI_STATUS_REG2) == CALL_FLAG) {
        printk("aml_callkey_resume, uboot tell me call wakeup system\n");
        v=1;
    }else{
        v = gp_call_key_workdata->callkey_pdata->get_phone_ring_value();
        printk("aml_callkey_resume, get_phone_ring_value is %d\n",v);
    }
    
    if(0 < v){
        printk("aml_callkey_resume, key %d pressed.\n", KEY_PHONERING);
        requestWakeLock(gp_call_key_workdata);                   
        input_report_key(input, KEY_PHONERING, 1);
        input_sync(input);

        mod_timer(&gp_call_key_workdata->wk_timer,jiffies+msecs_to_jiffies(UNLOCK_DELAYTIME));
        WRITE_AOBUS_REG(AO_RTI_STATUS_REG2, 0);
    }
    return 0 ;
}
Exemplo n.º 3
0
int do_irtest(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
    unsigned int i;
    printf("Enter NEC IR testing function ...\n");
    SET_AOBUS_REG_MASK(AO_RTI_PIN_MUX_REG, 1<<0);//set IR pinmux
    WRITE_AOBUS_REG(AO_IR_DEC_LDR_ACTIVE, 0x01d801ac);
    WRITE_AOBUS_REG(AO_IR_DEC_LDR_IDLE, 0x00f800ca);
    WRITE_AOBUS_REG(AO_IR_DEC_LDR_REPEAT, 0);
    WRITE_AOBUS_REG(AO_IR_DEC_BIT_0, 0x0044002c);
    WRITE_AOBUS_REG(AO_IR_DEC_REG0, 0x30fa0013);
    WRITE_AOBUS_REG(AO_IR_DEC_STATUS, 0x08915c00);
    WRITE_AOBUS_REG(AO_IR_DEC_REG1, 0x0000be70);
    for(i = 0; i < 200; i++){
        msleep(50);
        if(READ_AOBUS_REG_BITS(AO_IR_DEC_STATUS, 3, 1))
            printf("key = 0x%08x\n", READ_AOBUS_REG(AO_IR_DEC_FRAME));
        else
            printf("No key !!!\n");
        }
    return 0;
}
static void ir_fiq_interrupt(void)
{
    int pulse_width;
    char tmp[64];
    unsigned int current_jiffies = jiffies;
    sprintf(tmp, "ir_fiq_interrupt[%u]\n", current_jiffies);
    //strcat(logbuf, tmp);

    if(send_flag == 1)
	{
		//strcat(logbuf,"it is a send_flag\n");
        return;//don't receive key when sending a key
	}

	if(end_key == true)
	{
	    //strcat(logbuf,"it is a end_key\n");
		return;//don't receive repeat key
	}

    if(current_jiffies - last_jiffies > 10)//means a new key
    {   
        //dbg("it is a new ir key\n");
	    //strcat(logbuf,"it is a new ir key\n");
        rec_idx = 0;
		invalid_win = 0;
        rec_win.winNum = 0;
		reced_win.winNum = 0;
		end_key = false;
        last_jiffies = current_jiffies;
        return;//ignore first falling or rising edge
    }
    
    last_jiffies = current_jiffies;
    
    pulse_width = ( (READ_AOBUS_REG(AO_IR_DEC_REG1)) & 0x1FFF0000 ) >> 16 ;
	sprintf(tmp, "[%d]",pulse_width);
	//strcat(logbuf,tmp);

    if(pulse_width < 10)//200us
    {
    	invalid_win++;
        return;		//ignore if it is a invalid pulse
    }
	else if(pulse_width > 1000) //20ms
	{
		end_key = true;
		return;		//end of key
	}

    rec_idx++;
    if(rec_idx >= MAX_PLUSE)
        return;
    
    rec_win.winNum = rec_idx;
    rec_win.winArray[rec_idx-1] = (pulse_width*20);
	//sprintf(tmp, "[%d][%u]",rec_idx-1, rec_win.winArray[rec_idx-1]);
	//strcat(logbuf,tmp);

	mod_timer(&check_end_timer,jiffies+msecs_to_jiffies(60));
}