Exemplo n.º 1
1
static void type_det_work(struct work_struct *work)
{
	DBG("[JIWON] type_det_work start\n");

	if(headset_status == 1)
	{
	    if(gpio_get_value(headset_sw_data->hook_gpio) == 0) 
	    {
			headset_type = HUB_HEADPHONE;
			//DBG("[JIWON] type_det_work : HUB_HEADPHONE\n");
		}
		else
		{
			headset_type = HUB_HEADSET;
			//DBG("[JIWON] type_det_work : HUB_HEADSET\n");		
		}
	}
	else
	{
		headset_type = HUB_NONE;
#if defined(CONFIG_PRODUCT_LGE_KU5900)||defined(CONFIG_PRODUCT_LGE_P970) || defined(CONFIG_PRODUCT_LGE_LU6800) // 20100814 [email protected], dmb ant detect [START_LGE]		
	//nothing
#elif defined(CONFIG_PRODUCT_LGE_HUB) // [email protected] : Mach_Hub use external ant for dmb
		headset_sw_data->dmb_ant_detected = 0;
		set_dmb_status(headset_sw_data->dmb_ant_detected);	//[email protected]		
#endif		
	}


#if defined(CONFIG_PRODUCT_LGE_KU5900) ||defined(CONFIG_PRODUCT_LGE_P970)|| defined(CONFIG_PRODUCT_LGE_LU6800) 	// 20100814 [email protected], dmb ant detect [START_LGE]
	//nothing
#elif defined(CONFIG_PRODUCT_LGE_HUB) // [email protected] : Mach_Hub use external ant for dmb
//	msleep(100);
    if(system_rev > 3 && gpio_get_value(headset_sw_data->dmb_ant_gpio) == 1) 
    {
		DBG("[LUCKYJUN77] type_det_work : dmb_ant detected\n");
		headset_type = HUB_NONE;
		headset_sw_data->dmb_ant_detected = 1;
		set_dmb_status(headset_sw_data->dmb_ant_detected);	//[email protected]		
//		switch_set_state(&headset_sw_data->sdev, headset_type);		
//		return;
	}
#endif	// 20100814 [email protected], dmb ant detect [START_LGE]

#if defined(CONFIG_PRODUCT_LGE_KU5900) ||defined(CONFIG_PRODUCT_LGE_P970)|| defined(CONFIG_PRODUCT_LGE_LU6800) // 20100814 [email protected], dmb ant detect [START_LGE]
		if(headset_type == HUB_NONE)
		{
	#ifdef USE_LDOBIAS			
			gpio_direction_output(MIC_BIAS_LDO, 0);
			gpio_set_value(MIC_BIAS_LDO, 0);
	#else
			hub_headsetdet_bias(0);
	#endif
		}
#else
	if(system_rev <= 3)	//revB case
	{
    if(headset_type == HUB_NONE)
		hub_headsetdet_bias(0);
	}
	else 
	{
		if(headset_type == HUB_NONE && headset_sw_data->dmb_ant_detected == 0)
		{
			hub_headsetdet_bias(0);
		}
	}
#endif	// 20100814 [email protected], dmb ant detect [START_LGE]
	
 /* 20110215 [email protected] for EarJack & Hook Action [START] */
   if(headset_type == 1) 
   	{	   
    	IsHeadsetInserted=1;
    	DBG("[JIWON] type_det_work : IsHeadsetInserted=1\n");
   	}
   else
   	{
    	IsHeadsetInserted=0;
	    DBG("[JIWON] type_det_work : IsHeadsetInserted=0\n");
   	}
 /* 20110215 [email protected] for EarJack & Hook Action [END] */
  
	switch_set_state(&headset_sw_data->sdev, headset_type);

// 20100608 [email protected], headset event inform for hdmi [START_LGE]
#if defined(CONFIG_PRODUCT_LGE_LU6800)
	if(is_hdmi_enabled() == 1)
	{
		if(headset_type == HUB_NONE)
			Hdmi_setAudioMute(0);
		else
			Hdmi_setAudioMute(1);
	}
#endif
// 20100608 [email protected], headset event inform for hdmi [END_LGE]
	// 20110425 [email protected] detect headset during sleep [START]
	set_wakelock(0);	
	// 20110425 [email protected] detect headset during sleep [END]

}
static void headset_det_work(struct work_struct *work)
{
	headset_status = gpio_get_value(headset_sw_data->gpio); 
	//printk("[JIWON] headset_det_work start\n");

	if(headset_status == 0)
	{
	//printk("[JIWON] headset_det_work : no headset\n");
#if 1	// 20100825 , mic bias LDO control test [START_LGE]
		gpio_direction_output(MIC_BIAS_LDO, 0);
		gpio_set_value(MIC_BIAS_LDO, 0);
#endif	// 20100825 , mic bias LDO control test [END_LGE]
	
		//hub_headsetdet_bias(0);
//For_Resume_Speed		printk("[LUCKYJUN77] headset_det_work : headset_type = HUB_NONE\n");
		headset_type = HUB_NONE;
		switch_set_state(&headset_sw_data->sdev, headset_type);
		#if defined(CONFIG_NXP_HDMI)
		if(is_hdmi_enabled() == 1)
		{
			printk("(headset_det_work == Hdmi_setAudioMute(0)\n");
			Hdmi_setAudioMute(0);
		}
	    #endif
		return;		
	}
	
	msleep(100);
#if 1	// 20100825 , mic bias LDO control test [START_LGE]
	gpio_direction_output(MIC_BIAS_LDO, 1);
	gpio_set_value(MIC_BIAS_LDO, 1);
#endif	// 20100825 , mic bias LDO control test [END_LGE]
	
	//hub_headsetdet_bias(1);
        
#if defined(CONFIG_MACH_LGE_HUB_REV_A)	// 20100814 , dmb ant detect [START_LGE]
	//nothing
#else
   if(system_rev > 3 && gpio_get_value(headset_sw_data->dmb_ant_gpio) == 1) 
    {
		printk("[LUCKYJUN77] headset_det_work : dmb_ant detected\n");
		headset_sw_data->dmb_ant_detected = 1;
		set_dmb_status(headset_sw_data->dmb_ant_detected);	//
		headset_type = HUB_NONE;
		return;
	}
#endif	
	schedule_delayed_work(&headset_sw_data->delayed_work,	msecs_to_jiffies(type_detection_tim));
	
}
static void type_det_work(struct work_struct *work)
{
	//printk("[JIWON] type_det_work start\n");

	if(headset_status == 1)
	{
	    if(gpio_get_value(headset_sw_data->hook_gpio) == 0) 
	    {
			headset_type = HUB_HEADPHONE;
			//printk("[JIWON] type_det_work : HUB_HEADPHONE\n");
		}
		else
		{
			headset_type = HUB_HEADSET;
			//printk("[JIWON] type_det_work : HUB_HEADSET\n");		
	}
	}
	else
	{
       	//printk("[JIWON] type_det_work : no headset\n");		
		headset_type = HUB_NONE;
#if defined(CONFIG_MACH_LGE_HUB_REV_A) // 20100814 , dmb ant detect [START_LGE]		
	//nothing
#else
		headset_sw_data->dmb_ant_detected = 0;
		set_dmb_status(headset_sw_data->dmb_ant_detected);	//		
#endif		
	}


#if defined(CONFIG_MACH_LGE_HUB_REV_A) 	// 20100814 , dmb ant detect [START_LGE]
	//nothing
#else
//	msleep(100);
    if(system_rev > 3 && gpio_get_value(headset_sw_data->dmb_ant_gpio) == 1) 
    {
		printk("[LUCKYJUN77] type_det_work : dmb_ant detected\n");
		headset_type = HUB_NONE;
		headset_sw_data->dmb_ant_detected = 1;
		set_dmb_status(headset_sw_data->dmb_ant_detected);	//		
//		switch_set_state(&headset_sw_data->sdev, headset_type);		
//		return;
	}
#endif	// 20100814 , dmb ant detect [START_LGE]

#if defined(CONFIG_MACH_LGE_HUB_REV_A) // 20100814 , dmb ant detect [START_LGE]
    if(headset_type == HUB_NONE){
		//hub_headsetdet_bias(0);
		gpio_direction_output(MIC_BIAS_LDO, 0);
		gpio_set_value(MIC_BIAS_LDO, 0);
    }
#else
	if(system_rev <= 3)	//revB case
	{
    if(headset_type == HUB_NONE)
		//hub_headsetdet_bias(0);
		gpio_direction_output(MIC_BIAS_LDO, 0);
		gpio_set_value(MIC_BIAS_LDO, 0);
	}
	else 
	{
	if(headset_type == HUB_NONE && headset_sw_data->dmb_ant_detected == 0)
		//hub_headsetdet_bias(0);	
		gpio_direction_output(MIC_BIAS_LDO, 0);
		gpio_set_value(MIC_BIAS_LDO, 0);
	}
#endif	// 20100814 , dmb ant detect [START_LGE]
	
 /* 20110215  for EarJack & Hook Action [START] */
   if(headset_type == 1) 
   	{	   
    	IsHeadsetInserted=1;
    	//printk("[JIWON] type_det_work : IsHeadsetInserted=1\n");
   	}
   else
   	{
    	IsHeadsetInserted=0;
	    //printk("[JIWON] type_det_work : IsHeadsetInserted=0\n");
   	}
 /* 20110215  for EarJack & Hook Action [END] */
  
	switch_set_state(&headset_sw_data->sdev, headset_type);

// 20100608 , headset event inform for hdmi [START_LGE]
#if 1
#if defined(CONFIG_NXP_HDMI)
	if(is_hdmi_enabled() == 1)
	{
		if(headset_type == HUB_NONE)
			Hdmi_setAudioMute(0);
		else
			Hdmi_setAudioMute(1);
	}
#endif
#endif
// 20100608 , headset event inform for hdmi [END_LGE]
	
}
Exemplo n.º 4
0
static void headset_det_work(struct work_struct *work)
{
	headset_status = gpio_get_value(headset_sw_data->gpio); 

	if(headset_status == 0)
	{
#if defined(CONFIG_PRODUCT_LGE_KU5900) || defined(CONFIG_PRODUCT_LGE_LU6800)||defined(CONFIG_PRODUCT_LGE_P970)
	#ifdef USE_LDOBIAS	
		gpio_direction_output(MIC_BIAS_LDO, 0);
		gpio_set_value(MIC_BIAS_LDO, 0);
	#else
		hub_headsetdet_bias(0);
	#endif
#elif defined(CONFIG_PRODUCT_LGE_HUB)
	#ifdef USE_LDOBIAS	
		gpio_direction_output(MIC_BIAS_LDO, 0);
		gpio_set_value(MIC_BIAS_LDO, 0);
	#endif
		hub_headsetdet_bias(0);
#endif
//For_Resume_Speed		DBG("[LUCKYJUN77] headset_det_work : headset_type = HUB_NONE\n");
		DBG("[LUCKYJUN77] headset_det_work : headset_type = HUB_NONE\n");

		headset_type = HUB_NONE;
		switch_set_state(&headset_sw_data->sdev, headset_type);
		#if defined(CONFIG_OMAP2_DSS_HDMI)  
		if(is_hdmi_enabled() == 1)
		{
			DBG("(headset_det_work == Hdmi_setAudioMute(0)\n");
			Hdmi_setAudioMute(0);
		}
	    #endif
	// 20110425 [email protected] detect headset during sleep [START]		
		set_wakelock(0);		
	// 20110425 [email protected] detect headset during sleep [END]		
		return;		
	}
	
	msleep(100);

#if defined(CONFIG_PRODUCT_LGE_KU5900) || defined(CONFIG_PRODUCT_LGE_LU6800)||defined(CONFIG_PRODUCT_LGE_P970)
	#ifdef USE_LDOBIAS	
		gpio_direction_output(MIC_BIAS_LDO, 1);
		gpio_set_value(MIC_BIAS_LDO, 1);
	#else
		hub_headsetdet_bias(1);// LGE_B_S 20101217 [email protected], porting
	#endif
#elif defined(CONFIG_PRODUCT_LGE_HUB)
	#ifdef USE_LDOBIAS	
		gpio_direction_output(MIC_BIAS_LDO, 1);
		gpio_set_value(MIC_BIAS_LDO, 1);
	#endif
		hub_headsetdet_bias(1);// LGE_B_S 20101217 [email protected], porting

#endif

#if defined(CONFIG_PRODUCT_LGE_KU5900)||defined(CONFIG_PRODUCT_LGE_P970) || defined(CONFIG_PRODUCT_LGE_LU6800)	// 20100814 [email protected], dmb ant detect [START_LGE]
	//nothing
#elif defined(CONFIG_PRODUCT_LGE_HUB)
   if(system_rev > 3 && gpio_get_value(headset_sw_data->dmb_ant_gpio) == 1) 
    {
		DBG("[LUCKYJUN77] headset_det_work : dmb_ant detected\n");
		headset_sw_data->dmb_ant_detected = 1;
		set_dmb_status(headset_sw_data->dmb_ant_detected);	//[email protected]
		headset_type = HUB_NONE;
		return;
	}
#endif	
	DBG("[LUCKYJUN77] headset_det_work : dmb_ant detected\n");

	schedule_delayed_work(&headset_sw_data->delayed_work,	msecs_to_jiffies(type_detection_tim));
	
}