/*
 * tuple format: (key_code, key_param)
 *
 * old-architecture:
 * key-press = (key_code, 0)
 * key-release = (0xff, key_code)
 *
 * new-architecutre:
 * key-press = (key_code, 0)
 * key-release = (key_code, 0xff)
 */
static void report_hs_key(uint32_t key_code, uint32_t key_parm)
{
	int key, temp_key_code;

	if (key_code == HS_REL_K)
		key = hs_find_key(key_parm);
	else
		key = hs_find_key(key_code);

	temp_key_code = key_code;

	if (key_parm == HS_REL_K)
		key_code = key_parm;

	switch (key) {
	case KEY_POWER:
	case KEY_END:
	case KEY_MEDIA:
		input_report_key(hs->ipdev, key, (key_code != HS_REL_K));
		break;
	case SW_HEADPHONE_INSERT:
		report_headset_switch(hs->ipdev, key, (key_code != HS_REL_K));
		break;
	case -1:
		printk(KERN_ERR "%s: No mapping for remote handset event %d\n",
				 __func__, temp_key_code);
		return;
	}
	input_sync(hs->ipdev);
}
Пример #2
0
/*
 * tuple format: (key_code, key_param)
 *
 * old-architecture:
 * key-press = (key_code, 0)
 * key-release = (0xff, key_code)
 *
 * new-architecutre:
 * key-press = (key_code, 0)
 * key-release = (key_code, 0xff)
 */
static void report_hs_key(uint32_t key_code, uint32_t key_parm)
{
	int key, temp_key_code;

	if (key_code == HS_REL_K)
		key = hs_find_key(key_parm);
	else
		key = hs_find_key(key_code);

	temp_key_code = key_code;

	if (key_parm == HS_REL_K)
		key_code = key_parm;

	switch (key) {
	case KEY_POWER:
	case KEY_END:
		input_report_key(hs->ipdev, key, (key_code != HS_REL_K));
		break;

	case KEY_MEDIA:
	case KEY_VOLUMEUP:
	case KEY_VOLUMEDOWN:
		/* This should be the HSSD button */
#ifdef CONFIG_SEMC_SEPORT_PLATFORM
		if (seport_vad_data) {
			atomic_set(&seport_vad_data->status,
				   key_code == HS_REL_K);
			mutex_lock(&seport_vad_btn_lock);
			seport_vad_det_cb_func(
				atomic_read(&seport_vad_data->status),
				seport_vad_data);
			mutex_unlock(&seport_vad_btn_lock);
		} else
			printk(KERN_WARNING "%s - VAD button data pointer " \
			       "not initialized.\n",
			       __func__);

#elif defined CONFIG_ES209RA_HEADSET
		es209ra_audio_jack_button_handler(key_code);
		return;
#else
		input_report_key(hs->ipdev, key, (key_code != HS_REL_K));
#endif /* CONFIG_SEMC_SEPORT_PLATFORM */
		break;
	case SW_HEADPHONE_INSERT:
#ifndef CONFIG_SEMC_SEPORT_PLATFORM
		report_headset_switch(hs->ipdev, key, (key_code != HS_REL_K));
#endif
		break;
	case -1:
		printk(KERN_ERR "%s: No mapping for remote handset event %d\n",
				 __func__, temp_key_code);
		return;
	}
	input_sync(hs->ipdev);
}
/*
 * tuple format: (key_code, key_param)
 *
 * old-architecture:
 * key-press = (key_code, 0)
 * key-release = (0xff, key_code)
 *
 * new-architecutre:
 * key-press = (key_code, 0)
 * key-release = (key_code, 0xff)
 */
static void report_hs_key(uint32_t key_code, uint32_t key_parm)
{
	int key, temp_key_code;

	if (key_code == HS_REL_K)
		key = hs_find_key(key_parm);
	else
		key = hs_find_key(key_code);

	temp_key_code = key_code;

	if (key_parm == HS_REL_K)
		key_code = key_parm;

	switch (key) {
	case KEY_POWER:
	case KEY_SLEEP:// KEY_END-->KEY_SLEEP 142 
	case KEY_MEDIA:
    case KEY_VOLUMEUP:
	case KEY_VOLUMEDOWN:
	    printk(KERN_ERR "--keycode from A9\n \tkey:%d keycode:%d\n",key,key_code);
		input_report_key(hs->ipdev, key, (key_code != HS_REL_K));
		break;
		
case KEY_WAKEUP:
		printk(KERN_ERR "--keycode from A9(charger)\n \tkey:%d keycode:%d\n",key,key_code);
#ifdef CONFIG_SCREEN_ON_WITHOUT_KEYOCDE
    		msm_batt_force_update();
#else
		input_report_key(hs->ipdev, key, (key_code != HS_REL_K));
#endif
		//usb vbus notify by rpc_hs,wangzy_20111212		
		if(NULL != msm_vbus_notify){
			if(key_code == HS_EXT_PWR_ON_K)			
				msm_vbus_notify(1); 		
			if(key_code == HS_EXT_PWR_OFF_K)			
				msm_vbus_notify(0); 
			}
		//end
		break;
	case SW_HEADPHONE_INSERT:
		report_headset_switch(hs->ipdev, key, (key_code != HS_REL_K));
		break;
	case -1:
		printk(KERN_ERR "%s: No mapping for remote handset event %d\n",
				 __func__, temp_key_code);
		return;
	}
	input_sync(hs->ipdev);
}
Пример #4
0
/*
 * tuple format: (key_code, key_param)
 *
 * old-architecture:
 * key-press = (key_code, 0)
 * key-release = (0xff, key_code)
 *
 * new-architecutre:
 * key-press = (key_code, 0)
 * key-release = (key_code, 0xff)
 */    
static void report_hs_key(uint32_t key_code, uint32_t key_parm)
{
	int key, temp_key_code;

	if (key_code == HS_REL_K)
		key = hs_find_key(key_parm);
	else
		key = hs_find_key(key_code);

	temp_key_code = key_code;

	if (key_parm == HS_REL_K)
		key_code = key_parm;

	printk(KERN_ERR "[%s,%d] key %d %s\n", 
           __FUNCTION__, __LINE__, key, (key_code != HS_REL_K) ? "Down" : "Up");

	switch (key) {
#if !HUAWEI_HWID(S70)
	case KEY_POWER:
	case KEY_END:
	case KEY_MEDIA:
		input_report_key(hs->ipdev, key, (key_code != HS_REL_K));
		break;
#else
    case KEY_POWER:
    case KEY_END:
		input_report_key(hs->ipdev, KEY_POWER, (key_code != HS_REL_K));
		break;
	case KEY_MEDIA:
		input_report_key(hs->ipdev, key, (key_code != HS_REL_K));
		break;
#endif
	case SW_HEADPHONE_INSERT:        
        if (gHeadsetflags) {
            wake_lock(&gHeadsetWakeLock);            
            Headset_Timer.expires = jiffies + HEADSET_TIMEOUT;
            add_timer(&Headset_Timer);
            gHeadsetflags = 0;
        }
		report_headset_switch(hs->ipdev, key, (key_code != HS_REL_K));
		break;
	case -1:
		printk(KERN_ERR "%s: No mapping for remote handset event %d\n",
				 __func__, temp_key_code);
		return;
	}
	input_sync(hs->ipdev);
}
/*
 * tuple format: (key_code, key_param)
 *
 * old-architecture:
 * key-press = (key_code, 0)
 * key-release = (0xff, key_code)
 *
 * new-architecutre:
 * key-press = (key_code, 0)
 * key-release = (key_code, 0xff)
 */
static void report_hs_key(uint32_t key_code, uint32_t key_parm)
{
	int key, temp_key_code;

	if (key_code == HS_REL_K)
		key = hs_find_key(key_parm);
	else
		key = hs_find_key(key_code);

	temp_key_code = key_code;

	if (key_parm == HS_REL_K)
		key_code = key_parm;

	switch (key) {
	case KEY_POWER:
	case KEY_SLEEP://ZTE_KEYMAP_ZX_001 KEY_END-->KEY_SLEEP 142 200911178
	case KEY_MEDIA:
    case KEY_VOLUMEUP:
	case KEY_VOLUMEDOWN:
	    printk(KERN_ERR "--keycode from A9\n \tkey:%d keycode:%d\n",key,key_code);
		input_report_key(hs->ipdev, key, (key_code != HS_REL_K));
		break;
		
case KEY_WAKEUP://ZTE_HS_ZHENGCHAO_01
		printk(KERN_ERR "--keycode from A9(charger)\n \tkey:%d keycode:%d\n",key,key_code);
#ifdef CONFIG_SCREEN_ON_WITHOUT_KEYOCDE
    		msm_batt_force_update();
#else
		input_report_key(hs->ipdev, key, (key_code != HS_REL_K));
#endif
		break;
	case SW_HEADPHONE_INSERT:
	    printk(KERN_ERR "HEADPHONE_INSERT from A9\n \tkey:%d keycode:%d\n",key,key_code); // ZTE_Audio_CJ_110307
		report_headset_switch(hs->ipdev, key, (key_code != HS_REL_K));
		break;
	case -1:
		printk(KERN_ERR "%s: No mapping for remote handset event %d\n",
				 __func__, temp_key_code);
		return;
	}
	input_sync(hs->ipdev);
}
Пример #6
0
/*
 * tuple format: (key_code, key_param)
 *
 * old-architecture:
 * key-press = (key_code, 0)
 * key-release = (0xff, key_code)
 *
 * new-architecutre:
 * key-press = (key_code, 0)
 * key-release = (key_code, 0xff)
 * SEMC:
 * switch = (switch_code, switch_value)
 */
static void report_hs_key(uint32_t key_code, uint32_t key_parm)
{
	int key, temp_key_code;

	if (key_code == HS_REL_K)
		key = hs_find_key(key_parm);
	else
		key = hs_find_key(key_code);

	temp_key_code = key_code;

	if (key_parm == HS_REL_K)
		key_code = key_parm;

	switch (key) {
	case KEY_MEDIA:
                if (key_code == HS_REL_K)
                        del_timer(&hs->endkey_timer);
                else
                        mod_timer(&hs->endkey_timer, jiffies + msecs_to_jiffies(END_KEY_PERIOD));

	case KEY_END:
                /* This will never actually happen since we emulate it on android instead */
	case KEY_POWER:
	case KEY_VOLUMEUP:
	case KEY_VOLUMEDOWN:
		input_report_key(hs->ipdev, key, (key_code != HS_REL_K));
		break;
	case SW_HEADPHONE_INSERT:
		/* Special, this is a switch, so we pass the param onwards */
		report_headset_switch(hs->ipdev, key, key_parm);
		break;
	case -1:
		printk(KERN_ERR "%s: No mapping for remote handset event %d\n",
				 __func__, temp_key_code);
		return;
	}
	input_sync(hs->ipdev);
}
/*
 * tuple format: (key_code, key_param)
 *
 * old-architecture:
 * key-press = (key_code, 0)
 * key-release = (0xff, key_code)
 *
 * new-architecutre:
 * key-press = (key_code, 0)
 * key-release = (key_code, 0xff)
 */
static void report_hs_key(uint32_t key_code, uint32_t key_parm)
{
	int key, temp_key_code;

	if (key_code == HS_REL_K)
		key = hs_find_key(key_parm);
	else
		key = hs_find_key(key_code);

	temp_key_code = key_code;

	if (key_parm == HS_REL_K)
		key_code = key_parm;

	switch (key) {
	case KEY_POWER:
	case KEY_END:
#if 0
	case KEY_MEDIA:
	case KEY_VOLUMEUP:
	case KEY_VOLUMEDOWN:
#endif
#if 0
		input_report_key(hs->ipdev, key, (key_code != HS_REL_K));
#else
		if(pm_key)
		{
#if DEBUG
		switch (key) {
		case KEY_POWER:
			printk(KERN_INFO "[msm-handset] [%s] KEY_POWER[%d] key_code[%d]\n", __func__,key,key_code);
		break;
		case KEY_END:
			printk(KERN_INFO "[msm-handset] [%s] KEY_END[%d] key_code[%d]\n", __func__,key,key_code);
		break;
		}
#endif
#if defined(CONFIG_TENKEY_KEYPAD) && (CONFIG_TENKEY_KEYPAD_SUBID == 2)
		if(shext_hw_revision_cleck == true)
		{
			input_report_key(pm_key->ipdev, KEY_SAVE, (key_code != HS_REL_K));
		}else{
			input_report_key(pm_key->ipdev, key, (key_code != HS_REL_K));
			input_sync(pm_key->ipdev);
		}
#else
			input_report_key(pm_key->ipdev, key, (key_code != HS_REL_K));
			input_sync(pm_key->ipdev);
#endif
		}
		else
		{
#if DEBUG
			printk(KERN_INFO "[msm-handset] [%s] pm_key = NULL\n", __func__);
#endif
		}
#endif
		break;
#if 1
	case KEY_MEDIA:
#if 0
		report_headphone_switch(hs->ipdev, key, (key_code != HS_REL_K));
#else
		if(hssw)
		{
			report_headphone_switch(hssw->ipdev, key, (key_code != HS_REL_K));
			input_sync(hssw->ipdev);
		}
		else
		{
#if DEBUG
			printk(KERN_INFO "[msm-handset] [%s] hssw = NULL\n", __func__);
#endif
		}
#endif
		break;
#endif
	case SW_HEADPHONE_INSERT_W_MIC:
		hs->mic_on = hs->hs_on = (key_code != HS_REL_K) ? 1 : 0;
		input_report_switch(hs->ipdev, SW_HEADPHONE_INSERT,
							hs->hs_on);
		input_report_switch(hs->ipdev, SW_MICROPHONE_INSERT,
							hs->mic_on);
		update_state();
		break;

	case SW_HEADPHONE_INSERT:
#if 0
		report_headset_switch(hs->ipdev, key, (key_code != HS_REL_K));
#else
		if(hs)
		{
			report_headset_switch(hs->ipdev, key, key_parm);
#endif
#if 1
			input_sync(hs->ipdev);
#endif
		}
		else
		{
#if DEBUG
			printk(KERN_INFO "[msm-handset] [%s] hs = NULL\n", __func__);
#endif
		}
		hs->hs_on = (key_code != HS_REL_K) ? 1 : 0;
//		input_report_switch(hs->ipdev, key, hs->hs_on);
		update_state();
		break;
	case SW_MICROPHONE_INSERT:
		hs->mic_on = (key_code != HS_REL_K) ? 1 : 0;
		input_report_switch(hs->ipdev, key, hs->mic_on);
		update_state();
		break;
#ifdef FLIP_USE	/* FLIP */
	case SW_LID:
		if(hs)
		{
			if(report_flip_switch(hs->ipdev, key, key_parm) != 0)
			{
				return;
			}
#if 1
			input_sync(hs->ipdev);
#endif
		}
		else
		{
#if DEBUG
			printk(KERN_INFO "[msm-handset] [%s] hs = NULL\n", __func__);
#endif
		}
		break;
#endif
	case -1:
		printk(KERN_ERR "%s: No mapping for remote handset event %d\n",
				 __func__, temp_key_code);
		return;
	}
#if 0
	input_sync(hs->ipdev);
#endif
}
Пример #8
0
/*
 * tuple format: (key_code, key_param)
 *
 * old-architecture:
 * key-press = (key_code, 0)
 * key-release = (0xff, key_code)
 *
 * new-architecutre:
 * key-press = (key_code, 0)
 * key-release = (key_code, 0xff)
 */
static void report_hs_key(uint32_t key_code, uint32_t key_parm)
{
	int key, temp_key_code;

	if (key_code == HS_REL_K)
		key = hs_find_key(key_parm);
	else
		key = hs_find_key(key_code);

	temp_key_code = key_code;

	if (key_parm == HS_REL_K)
		key_code = key_parm;

	switch (key) {
	case KEY_POWER:
	case KEY_END:
#if 0
	case KEY_MEDIA:
	case KEY_VOLUMEUP:
	case KEY_VOLUMEDOWN:
#endif
#if 0
		input_report_key(hs->ipdev, key, (key_code != HS_REL_K));
#else
		if(pm_key)
		{
			input_report_key(pm_key->ipdev, key, (key_code != HS_REL_K));
			input_sync(pm_key->ipdev);
		}
#endif
		break;
#if 1
	case KEY_MEDIA:
#if 0
		report_headphone_switch(hs->ipdev, key, (key_code != HS_REL_K));
#else
		if(hssw)
		{
			report_headphone_switch(hssw->ipdev, key, (key_code != HS_REL_K));
			input_sync(hssw->ipdev);
		}
		else
		{
#if DEBUG
			printk(KERN_INFO "[msm-handset] [%s] hssw = NULL\n", __func__);
#endif
		}
#endif
		break;
#endif
	case SW_HEADPHONE_INSERT:
#if 0
		report_headset_switch(hs->ipdev, key, (key_code != HS_REL_K));
#else
		if(hs)
		{
			report_headset_switch(hs->ipdev, key, key_parm);
#endif
#if 1
			input_sync(hs->ipdev);
#endif
		}
		else
		{
#if DEBUG
			printk(KERN_INFO "[msm-handset] [%s] hs = NULL\n", __func__);
#endif
		}
		break;
#if 1
	case SW_LID:
		break;
#endif
#if 1
	case KEY_VOLUMEUP:
	case KEY_VOLUMEDOWN:
	case KEY_CAMERA:
	case KEY_FOCUS:
#ifdef CONFIG_LYNCIS_KEYPAD
    case KEY_MENU:
    case KEY_HOME:
    case KEY_BACK:
    case KEY_SEARCH:
#endif /* CONFIG_LYNCIS_KEYPAD */
		if(mt_key)
		{
			input_report_key(mt_key->ipdev, key, (key_code != HS_REL_K));
			input_sync(mt_key->ipdev);
		}
		else
		{
			printk(KERN_INFO "[msm-handset] [%s] mt_key = NULL\n", __func__);
		}
		break;
#endif
	case -1:
		printk(KERN_ERR "%s: No mapping for remote handset event %d\n",
				 __func__, temp_key_code);
		return;
	}
#if 0
	input_sync(hs->ipdev);
#endif
}
Пример #9
0
/*
 * tuple format: (key_code, key_param)
 *
 * old-architecture:
 * key-press = (key_code, 0)
 * key-release = (0xff, key_code)
 *
 * new-architecutre:
 * key-press = (key_code, 0)
 * key-release = (key_code, 0xff)
 */
static void report_hs_key(uint32_t key_code, uint32_t key_parm)
{
	int key, temp_key_code;

	if (key_code == HS_REL_K)
		key = hs_find_key(key_parm);
	else
		key = hs_find_key(key_code);

	temp_key_code = key_code;

	if (key_parm == HS_REL_K)
		key_code = key_parm;

	switch (key) {
	case KEY_POWER:
	case KEY_END:
		key = KEY_POWER;
	case KEY_MEDIA:
	case KEY_VOLUMEUP:
	case KEY_VOLUMEDOWN:
		input_report_key(hs->ipdev, key, (key_code != HS_REL_K));
    
    {
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      if(key == KEY_POWER)
      {
        if(key_code == HS_REL_K)  
        {
          pwrkey_down = 0;
          cancel_delayed_work_sync(&pwrkey_work);
        }
        else  
        {
          pwrkey_down = 1;
          queue_delayed_work(pwrkey_wqueue, &pwrkey_work, 8*HZ);
        }
      }
      else if(key == KEY_END && pwrkey_down == 1)
      {
        if(key_code == HS_REL_K)  
        {
          pwrkey_down = 0;
          cancel_delayed_work_sync(&pwrkey_work);
        }
      }
    }
    
		break;
	case SW_HEADPHONE_INSERT:
		report_headset_switch(hs->ipdev, key, (key_code != HS_REL_K));
		break;

  
  case KEY_BATTERY:
    #ifdef CONFIG_BATTERY_QSD
    if(key_code == HS_BAD_BATT_K)
    {
      qsd_bat_update_usb_status(CHG_EVENT_GAGIC_BATT_GOOD);
    }
    else if(key_code == HS_CHARGING_ON_K)
    {
      qsd_bat_update_usb_status(AC_STATUS_AC_IN);
#ifdef CONFIG_HW_AUSTIN	  
      
      q6audio_update_AC_5V_status(1);
#endif 
    }	  
    else if(key_code == HS_CHARGING_OFF_K)
    {
      qsd_bat_update_usb_status(AC_STATUS_AC_NONE);
#ifdef CONFIG_HW_AUSTIN	  
      
      q6audio_update_AC_5V_status(0);	
#endif 
    }
    else if(key_code == HS_BAT_LOW_K)
    {
      qsd_bat_update_usb_status(CHG_EVENT_PMIC_BATT_LOW);
    }
    #endif
    return; 
  

	case -1:
		printk(KERN_ERR "%s: No mapping for remote handset event %d\n",
				 __func__, temp_key_code);
		return;
	}
	input_sync(hs->ipdev);
}
Пример #10
0
static void earjack_det_func( struct work_struct *earjack_work)
{
	int ret=0;
	int nADCValue=0,nADCValue2=0;

	//wake_lock_timeout(&headset_wakelock,HZ/2);
	ret=gpio_get_value_cansleep(hspd->ear_det);	
	printk("EARJACK_DET=> %d\n", ret);

	if(ret==hspd->ear_det_active) {
		Regulator_L8_Enable(1);
		msleep(100);
		ret=Check_ADC_MPP(&nADCValue);  // garbage value reading.
		msleep(10);
		ret=Check_ADC_MPP(&nADCValue);
		if(ret) {
			printk("Check_ADC_MPP() error ret=%d\n",ret);
			goto earjack_det_exit;
		}

		msleep(10);

		ret=Check_ADC_MPP(&nADCValue2);
		if(ret) {
			printk("Check_ADC_MPP() error ret=%d\n",ret);
			goto earjack_det_exit;
		}

		hs_dbg("det nADCValue=%d %d\n",nADCValue,nADCValue2);
		nADCValue=(nADCValue+nADCValue2)/2;

#if 0  // garbage value reading
		msleep(10);
		Check_ADC_MPP(&nADCValue2);
		hs_dbg("dummy det nADCValue=%d\n",nADCValue2);
		msleep(10);
		Check_ADC_MPP(&nADCValue2);
		hs_dbg("dummy det nADCValue=%d\n",nADCValue2);
		msleep(10);
		Check_ADC_MPP(&nADCValue2);
		hs_dbg("dummy det nADCValue=%d\n",nADCValue2);
#endif

		earjack_keycode=0;

		if(nADCValue>=1000) { // 4 pole 2180
			hspd->curr_state= MSM_HEADSET;
			Remote_Interrupt_Enable(1);
		} else {  // 3pole
			hspd->curr_state= MSM_HEADPHONE;
			Regulator_L8_Enable(0);
		}
	} else {
		Regulator_L8_Enable(0);
		if(hspd->curr_state==MSM_HEADSET)
			Remote_Interrupt_Enable(0);
		
		hspd->curr_state=0;
	}

	report_headset_switch(hs->ipdev, SW_HEADPHONE_INSERT, hspd->curr_state);
	input_sync(hs->ipdev);

earjack_det_exit:
	//wake_unlock(&headset_wakelock);
	return;
}
Пример #11
0
static void report_hs_key(uint32_t key_code, uint32_t key_parm)
{
	int key, temp_key_code;

	if (key_code == HS_REL_K)
		key = hs_find_key(key_parm);
	else
		key = hs_find_key(key_code);

	temp_key_code = key_code;

	if (key_parm == HS_REL_K)
		key_code = key_parm;

	switch (key) {
#ifndef CONFIG_MACH_MSM7X27_ALOHAV
	case KEY_POWER:
	case KEY_END:
		input_report_key(hs->ipdev, key, (key_code != HS_REL_K));
		break;
	case KEY_MEDIA:
		if (gpio_get_value(GPIO_EAR_SENSE_BIAS) == 1) {
			/* LGE_CHANGE
			 * 2010-03-09, [email protected] To protect from wrong hook key operation
			 */ 
			input_report_key(hs->ipdev, key, (key_code != HS_REL_K));
		}
		break;
	case KEY_CONNECT:
		if (deskdock_detect_callback)
			deskdock_detect_callback((key_code != HS_REL_K));
		break;
#else /*CONFIG_MACH_MSM7X27_ALOHAG*/
	case KEY_POWER:
	case KEY_END:
	case KEY_MEDIA:
	case KEY_VOLUMEUP:
	case KEY_VOLUMEDOWN:
		input_report_key(hs->ipdev, key, (key_code != HS_REL_K));
#if defined(CONFIG_LGE_DIAGTEST)
		/* LGE_CHANGES
		 * [[email protected]] 2010-01-23, 
		 * [VS740] for key test
		 */
		if(if_condition_is_on_key_buffering == HS_TRUE && key_code == 0/*press*/)
			lgf_factor_key_test_rsp((uint8_t)key);
#endif
		break;
#endif /*CONFIG_MACH_MSM7X27_ALOHAG */

	case SW_HEADPHONE_INSERT:
#ifndef CONFIG_LGE_HEADSET
		report_headset_switch(hs->ipdev, key, (key_code != HS_REL_K));
#endif
#if defined(CONFIG_LGE_DIAGTEST)
		/* LGE_CHANGES
		 * [[email protected]] 2010-01-23
		 * [VS740] for key test */
		if(if_condition_is_on_key_buffering == HS_TRUE && key_code == 0/*press*/)
			lgf_factor_key_test_rsp((uint8_t)key);
#endif
		break;
	case -1:
		printk(KERN_ERR "%s: No mapping for remote handset event %d\n",
				 __func__, temp_key_code);
		return;
	}
	input_sync(hs->ipdev);
}
Пример #12
0
static void report_hs_key(uint32_t key_code, uint32_t key_parm)
{
	int key, temp_key_code;

	if (key_code == HS_REL_K)
		key = hs_find_key(key_parm);
	else
		key = hs_find_key(key_code);

	temp_key_code = key_code;

	if (key_parm == HS_REL_K)
		key_code = key_parm;


        if (key_code != HS_REL_K)
            testmode_input_scancode(key);


	switch (key) {
#ifndef CONFIG_MACH_MSM7X27_ALOHAV
	case KEY_POWER:
	case KEY_END:
		input_report_key(hs->ipdev, key, (key_code != HS_REL_K));
		break;
	case KEY_MEDIA:
			input_report_key(hs->ipdev, key, (key_code != HS_REL_K));
		break;
	case KEY_CONNECT:
		if (deskdock_detect_callback)
			deskdock_detect_callback((key_code != HS_REL_K));
		break;
#else 
	case KEY_POWER:
	case KEY_END:
	case KEY_MEDIA:
	case KEY_VOLUMEUP:
	case KEY_VOLUMEDOWN:
		input_report_key(hs->ipdev, key, (key_code != HS_REL_K));
#if defined(CONFIG_LGE_DIAGTEST)
		
		if(if_condition_is_on_key_buffering == HS_TRUE && key_code == 0)
			lgf_factor_key_test_rsp((uint8_t)key);
#endif
		break;
#endif 

	case SW_HEADPHONE_INSERT:
		report_headset_switch(hs->ipdev, key, (key_code != HS_REL_K));
#if defined(CONFIG_LGE_DIAGTEST)
		
		if(if_condition_is_on_key_buffering == HS_TRUE && key_code == 0)
			lgf_factor_key_test_rsp((uint8_t)key);
#endif
		break;

	#if 0
	
	case KEY_HEADSETHOOK:
		input_report_key(hs->ipdev, key, (key_code != HS_REL_K));
		break;
	
	#endif
	
	case -1:
		printk(KERN_ERR "%s: No mapping for remote handset event %d\n",
				 __func__, temp_key_code);
		return;
	}
	input_sync(hs->ipdev);
	
	printk(" %s : HS_KEY event : %d \n", __func__, key_code);
}
/*
 * tuple format: (key_code, key_param)
 *
 * old-architecture:
 * key-press = (key_code, 0)
 * key-release = (0xff, key_code)
 *
 * new-architecutre:
 * key-press = (key_code, 0)
 * key-release = (key_code, 0xff)
 */
static void report_hs_key(uint32_t key_code, uint32_t key_parm)
{
	int key, temp_key_code;
	#ifdef CONFIG_EF18_BOARD // shpark
	static int connType;
	#endif

	#ifdef TEST_PI35_ADC_READ
	int adc;

	if(key_code < 0x10) {
		adc = (key_code & 0xFF) << 8;
		adc |= key_parm;
		nAdcValue = adc;
		printk("::::::::::::: nAdcValue = %d\n", adc);
	}
	#endif

	if (key_code == HS_REL_K)
		key = hs_find_key(key_parm);
	else
		key = hs_find_key(key_code);

	temp_key_code = key_code;

	if (key_parm == HS_REL_K)
		key_code = key_parm;

	switch (key) {
	case KEY_POWER:
	case KEY_END:
	case KEY_MEDIA:
	#ifndef CONFIG_EF18_BOARD // shpark
	case KEY_VOLUMEUP:
	case KEY_VOLUMEDOWN:
	#endif
    #ifdef FEATURE_SKY_CHG_LOGO
    case KEY_BATTERY:
    #endif
		input_report_key(hs->ipdev, key, (key_code != HS_REL_K));
	#ifdef FEATURE_WAKELOCK
		wake_unlock(&headset_wakeup);
		wake_lock_timeout(&headset_wakeup, HZ);
	#endif		
		break;
	case SW_HEADPHONE_INSERT:
		#ifdef CONFIG_EF18_BOARD // shpark
		if(key_code == HS_REL_K) { // release
			switch(key_parm) {
				case HS_SKY_20PIN_STEREO_HEADSET_K:
					conn_headset_type &= ~(1 << 0);
					connType &= ~(1 << 0);
					break;
				case HS_SKY_3P5PI_STEREO_HEADSET_K:
					conn_headset_type &= ~(1 << 1);
					connType &= ~(1 << 1);
					break;
				case HS_SKY_3P5PI_STEREO_HEADSET_NO_MIC_K:
					conn_headset_type &= ~(1 << 2);
					connType &= ~(1 << 2);
					break;
				case HS_SKY_MICROUSB_TDMB_K:
					//conn_headset_type &= ~(1 << 3);
					connType &= ~(1 << 3);
					break;
			}
		}
		else { // insert
			switch(key_code) {
				case HS_SKY_20PIN_STEREO_HEADSET_K:
					conn_headset_type |= (1 << 0);
					connType |= (1 << 0);
					break;
				case HS_SKY_3P5PI_STEREO_HEADSET_K:
					conn_headset_type |= (1 << 1);
					connType |= (1 << 1);
					break;
				case HS_SKY_3P5PI_STEREO_HEADSET_NO_MIC_K:
					conn_headset_type |= (1 << 2);
					connType |= (1 << 2);
					break;
				case HS_SKY_MICROUSB_TDMB_K:
					//conn_headset_type |= (1 << 3);
					connType |= (1 << 3);
					break;
			}
		}

		/*
		if (key_code == HS_REL_K) {
			if (key_parm == HS_SKY_20PIN_STEREO_HEADSET_K) {
				conn_headset_type &= ~(1 << 0);
				connType &= ~(1 << 0);
			}
			else if (key_parm == HS_SKY_3P5PI_STEREO_HEADSET_K) {
				conn_headset_type &= ~(1 << 1);
				connType &= ~(1 << 1);
			}
			else if (key_parm == HS_SKY_3P5PI_STEREO_HEADSET_NO_MIC_K) {
				conn_headset_type &= ~(1 << 2);
				connType &= ~(1 << 1);
			}
		}
		else {
			if (key_code == HS_SKY_20PIN_STEREO_HEADSET_K) {
				conn_headset_type |= (1 << 0);
				connType |= (1 << 0);
			}
			else if (key_code == HS_SKY_3P5PI_STEREO_HEADSET_K) {
				conn_headset_type |= (1 << 1);
				connType |= (1 << 1);
			}
			else if (key_code == HS_SKY_3P5PI_STEREO_HEADSET_NO_MIC_K) {
				conn_headset_type |= (1 << 2);
				connType |= (1 << 2);
			}
		}*/

		report_headset_switch(hs->ipdev, key, connType);
		printk(KERN_ERR "(SKY-HEADSET) Headset Detection(key:0x%x, conn_headset_type:0x%x, connType:0x%x)\n", key, conn_headset_type, connType);
		#else
		report_headset_switch(hs->ipdev, key, (key_code != HS_REL_K));
		#endif
		break;
	#ifdef CONFIG_EF18_BOARD
	/*case KEY_SEND:*/
	case KEY_VOLUMEUP:
	case KEY_VOLUMEDOWN:
		printk(KERN_ERR "[SKY Headset] volume up, down(%d)\n", key_code);
		input_report_key(hs->ipdev, key, (key_code != HS_REL_K));
		break;
	#endif
	case -1:
		printk(KERN_ERR "%s: No mapping for remote handset event %d\n",
				 __func__, temp_key_code);
		return;
	}
	input_sync(hs->ipdev);
}
/*
 * tuple format: (key_code, key_param)
 *
 * old-architecture:
 * key-press = (key_code, 0)
 * key-release = (0xff, key_code)
 *
 * new-architecutre:
 * key-press = (key_code, 0)
 * key-release = (key_code, 0xff)
 */
static void report_hs_key(uint32_t key_code, uint32_t key_parm)
{
	int key, temp_key_code;

	if (key_code == HS_REL_K)
		key = hs_find_key(key_parm);
	else
		key = hs_find_key(key_code);

	temp_key_code = key_code;

	if (key_parm == HS_REL_K)
		key_code = key_parm;

	switch (key) {
#ifndef CONFIG_MACH_MSM7X27_ALOHAV
	case KEY_POWER:
	case KEY_END:
		input_report_key(hs->ipdev, key, (key_code != HS_REL_K));
#if defined (CONFIG_LGE_DIAGTEST)
		mtc_send_key_log_packet((unsigned long)key, !(key_code != HS_REL_K));
    ats_eta_mtc_key_logging((int)key, (key_code != HS_REL_K));
#endif
		break;
	case KEY_MEDIA:
		if (gpio_get_value(GPIO_EAR_SENSE_BIAS) == 1) {
			input_report_key(hs->ipdev, key, (key_code != HS_REL_K));
		}
		break;
	case KEY_CONNECT:
		if (deskdock_detect_callback)
			deskdock_detect_callback((key_code != HS_REL_K));
		break;
#else /*CONFIG_MACH_MSM7X27_ALOHAG*/
	case KEY_POWER:
	case KEY_END:
	case KEY_MEDIA:
	case KEY_VOLUMEUP:
	case KEY_VOLUMEDOWN:
		input_report_key(hs->ipdev, key, (key_code != HS_REL_K));
#if defined(CONFIG_LGE_DIAGTEST)
		if(if_condition_is_on_key_buffering == HS_TRUE && key_code == 0/*press*/)
			lgf_factor_key_test_rsp((uint8_t)key);
#endif
		break;
#endif /*CONFIG_MACH_MSM7X27_ALOHAG */

	case SW_HEADPHONE_INSERT:
#ifndef CONFIG_LGE_HEADSET
		report_headset_switch(hs->ipdev, key, (key_code != HS_REL_K));
#endif
#if defined(CONFIG_LGE_DIAGTEST)
		if(if_condition_is_on_key_buffering == HS_TRUE && key_code == 0/*press*/)
			lgf_factor_key_test_rsp((uint8_t)key);
#endif
		break;
	case -1:
		printk(KERN_ERR "%s: No mapping for remote handset event %d\n",
				 __func__, temp_key_code);
		return;
	}
	input_sync(hs->ipdev);
}