static void hook_det_work(struct work_struct *work)
{
	//printk("[JIWON] hook_det_work start\n");

#if 0/*  20110121 : no hook event skip */
	if(headset_sw_data->is_suspend == 1 && get_twl4030_status() == 0)
	{
		printk("[LUCKYJUN77] suspend status \n");	
		return;
	}
#endif
	
    if(headset_type == HUB_HEADPHONE)	//detect type error case
    {
    	//printk("[JIWON] hook_det_work : headphone -> headset\n");
//		schedule_delayed_work(&headset_sw_data->delayed_work,	msecs_to_jiffies(type_detection_tim*3));
		headset_type = HUB_HEADSET;
		switch_set_state(&headset_sw_data->sdev, headset_type);
    }


    if(headset_type != HUB_HEADSET)
		return;

	if(hook_status == HOOK_RELEASED){
			//printk("[JIWON] threshold area for hook key glitch1\n");		
		if(gpio_get_value(headset_sw_data->hook_gpio) == 0){ 	//threshold area for hook key glitch
			//printk("[JIWON] threshold area for hook key glitch2\n");		
		    hook_status = HOOK_PRESSED; 
//		    input_report_key(headset_sw_data->ip_dev, KEY_HOOK, 1);
			schedule_delayed_work(&headset_sw_data->hook_delayed_work,	msecs_to_jiffies(10 /*type_detection_tim/8*/)); /* 20110215  for EarJack & Hook Action */
		}
	}
	else{
		if(gpio_get_value(headset_sw_data->hook_gpio) == 0){ 
			printk("[JIWON] HOOK_PRESSED\n");
		    input_report_key(headset_sw_data->ip_dev, KEY_HOOK, 1);		    
			input_sync(headset_sw_data->ip_dev);		    
			schedule_delayed_work(&headset_sw_data->hook_delayed_work,	msecs_to_jiffies(hook_detection_tim)); /* 20110215  for EarJack & Hook Action */			
		}
		else {
			    input_report_key(headset_sw_data->ip_dev, KEY_HOOK, 0);	
				input_sync(headset_sw_data->ip_dev);
				printk("[JIWON] HOOK_RELEASED\n");				
			    hook_status = HOOK_RELEASED;	
// 20100831  for TEST MODE [START_LGE]
#if 0 //rajesh
			if(get_test_mode())
			{
				write_gkpd_value(KEY_HOOK);
			}
#endif
// 20100831  for TEST MODE [END_LGE]				
		}
	}
}
Exemple #2
0
static void hook_det_work(struct work_struct *work)
{
	//DBG("[JIWON] hook_det_work start\n");

#if 0/* [email protected] 20110121 : no hook event skip */
	if(headset_sw_data->is_suspend == 1 && get_twl4030_status() == 0)
	{
		DBG("[LUCKYJUN77] suspend status \n");	
		return;
	}
#endif
	
    if(headset_type == HUB_HEADPHONE)	//detect type error case
    {
    	DBG("[JIWON] hook_det_work : headphone -> headset\n");
//		schedule_delayed_work(&headset_sw_data->delayed_work,	msecs_to_jiffies(type_detection_tim*3));
		headset_type = HUB_HEADSET;
		switch_set_state(&headset_sw_data->sdev, headset_type);
    }


    if(headset_type != HUB_HEADSET)
		return;

	if(hook_status == HOOK_RELEASED){
		if(gpio_get_value(headset_sw_data->hook_gpio) == 0){ 	//threshold area for hook key glitch
			//DBG("[JIWON] threshold area for hook key glitch2\n");		
		    hook_status = HOOK_PRESSED; 
//		    input_report_key(headset_sw_data->ip_dev, KEY_HOOK, 1);
#if defined(CONFIG_PRODUCT_LGE_LU6800) || defined(CONFIG_PRODUCT_LGE_KU5900)||defined(CONFIG_PRODUCT_LGE_P970) //20110404 [email protected] B HW Request.roll back the delay time.
			schedule_delayed_work(&headset_sw_data->hook_delayed_work,	msecs_to_jiffies(10 /*type_detection_tim/8*/)); //20110401 [email protected]  Not   B-prj case
#elif defined(CONFIG_PRODUCT_LGE_HUB)
			schedule_delayed_work(&headset_sw_data->hook_delayed_work,	msecs_to_jiffies(type_detection_tim/8)); 
#endif
		}
	}
	else{
		if(gpio_get_value(headset_sw_data->hook_gpio) == 0){ 
			DBG("[JIWON] HOOK_PRESSED\n");
		    input_report_key(headset_sw_data->ip_dev, KEY_HOOK, 1);		    
			input_sync(headset_sw_data->ip_dev);		    
#if defined(CONFIG_PRODUCT_LGE_LU6800) || defined(CONFIG_PRODUCT_LGE_KU5900)||defined(CONFIG_PRODUCT_LGE_P970)			
			schedule_delayed_work(&headset_sw_data->hook_delayed_work,	msecs_to_jiffies(hook_detection_tim)); /* 20110215 [email protected] for EarJack & Hook Action */			
#elif defined(CONFIG_PRODUCT_LGE_HUB)
			schedule_delayed_work(&headset_sw_data->hook_delayed_work,	msecs_to_jiffies(type_detection_tim));
#endif
		}
		else {
			    input_report_key(headset_sw_data->ip_dev, KEY_HOOK, 0);	
				input_sync(headset_sw_data->ip_dev);
				DBG("[JIWON] HOOK_RELEASED\n");				
			    hook_status = HOOK_RELEASED;	
// 20100831 [email protected] for TEST MODE [START_LGE]
			if(get_test_mode())
			{
				write_gkpd_value(KEY_HOOK);
			}
// 20100831 [email protected] for TEST MODE [END_LGE]				
		}
	}
}