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:
	case KEY_VOLUMEUP:
	case KEY_VOLUMEDOWN:
		input_report_key(hs->ipdev, key, (key_code != HS_REL_K));
		break;
	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:
		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 FEATURE_KYOCERA_MSND
	case HS_LINE_SPEAKER:
		if( key_code != HS_REL_K )
		{
			msm_snddev_poweramp_on();
		}
		else
		{
			msm_snddev_poweramp_off();
		}
		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) {
	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);
}
/*
 * 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_END:
		if (hs->hs_pdata->ignore_end_key)
			input_report_key(hs->ipdev, KEY_POWER,
						(key_code != HS_REL_K));
		else
			input_report_key(hs->ipdev, key,
						(key_code != HS_REL_K));
		break;
	case KEY_MEDIA:
	case KEY_VOLUMEUP:
	case KEY_VOLUMEDOWN:
		input_report_key(hs->ipdev, key, (key_code != HS_REL_K));
		break;
	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:
		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;
	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:
	case KEY_MEDIA:
	case KEY_VOLUMEUP:
	case KEY_VOLUMEDOWN:
		input_report_key(hs->ipdev, key, (key_code != HS_REL_K));
#if (defined(CONFIG_MACH_ARIESVE) || defined(CONFIG_MACH_ANCORA) || defined(CONFIG_MACH_GODART))
		key_pressed=(key_code != HS_REL_K);
#ifdef KERNEL_DEBUG_SEC
		printk("[key] pwercode %d, %d \n", key, key_pressed);
#endif
#endif		
		break;
	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:
		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;
	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;

#if !defined(CONFIG_KERNEL_MOTOROLA) 
	kpdev = msm_keypad_get_input_dev();
#endif
	switch (key) {
	case KEY_POWER:
	case KEY_END:
#if defined(CONFIG_MACH_MOT)
		if (!kpdev) {
			printk(KERN_ERR "%s: No input device for reporting "
					"pwr/end key press\n", __func__);
			return;
		}
#endif
        
#if !defined(CONFIG_KERNEL_MOTOROLA)        
		input_report_key(kpdev, key, (key_code != HS_REL_K));
		input_sync(kpdev);
#else
       input_report_key(hs->ipdev, key, (key_code != HS_REL_K));
#endif
		break;
	case SW_HEADPHONE_INSERT:
		break;
	case KEY_MEDIA:
		break;
	default:
		printk(KERN_ERR "%s: Unhandled handset key %d\n", __func__,
				key);
	case -1:
		printk(KERN_ERR "%s: No mapping for remote handset event %d\n",
				 __func__, temp_key_code);
		return;
	}
#if !defined(CONFIG_KERNEL_MOTOROLA)    
    input_sync(kpdev);
#else
    input_sync(hs->ipdev);
#endif /* !defined(CONFIG_KERNEL_MOTOROLA) */    
}
/*
 * 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);
}
/*
 * 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);
}
Esempio n. 10
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);
}
Esempio n. 11
0
static void report_hs_key(uint32_t key_code, uint32_t key_parm)
{
	int key, temp_key_code;
     
	printk(KERN_ERR " ^^^^^^ key_code %d, key_parm %d \n",key_code, key_parm);

#ifdef CONFIG_MACH_MSM8X55_J_MASAI_E
    if(key_code == 0xfe && (key_parm == 0 || key_parm == 1))
    {
        msm_hsusb_set_vbus_state(key_parm);
    }
#endif


#ifdef CONFIG_MACH_MSM8X55_J_MASAI_E
	if(key_code == 130 && key_parm == 0){
		is_earjack_connected = 1;
	}
	if(key_code == 255 && key_parm == 130){
		is_earjack_connected = 0;
	}
	
	if(key_code == 132 && key_parm == 0){
		if(is_earjack_connected == 0){
			return;
		}
	}
#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_MACH_MSM8X55_MINI    
	case KEY_VOLUMEUP:
	case KEY_VOLUMEDOWN:
    #endif    
		input_report_key(hs->ipdev, key, (key_code != HS_REL_K));
		break;
	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:      
		hs->hs_on = (key_code != HS_REL_K) ? 1 : 0;
		input_report_switch(hs->ipdev, key, hs->hs_on);
        printk(KERN_ERR "SW_HEADPHONE_INSERT, key_code: %x key_parm: on off : %d\n",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;
	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
}
/*
 * 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;

	printk(KERN_INFO "%In report_hs_key, key_code:%d, key_parm:%d \n", key_code, key_parm);
	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_MEDIA:
		input_report_key(hs->ipdev, key, (key_code != HS_REL_K));
		break;
	case KEY_END:
		if ((key_code != HS_REL_K)) {
			disable_irq(102);
			write_gkpd_value(80);
		} else {
			enable_irq(102);
		}

		if ((ts_key_event == 1 || keypad_event == 1) && (key_code != HS_REL_K)) {
			printk(KERN_INFO "gpio keypad is just enabled\n");
		} else {
			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 KEY_HP:
		if(gpio_get_value(GPIO_EAR_SENSE_BIAS) == 1)
		{
			if (!hs->ipdev) {
				printk(KERN_ERR "%s: No input device for reporting "
						"pwr/end key press\n", __func__);
				return;
			}
			printk(KERN_INFO "HOOK OK!!!!!!\n");
			//write_gkpd_value(72);
//			input_report_key(hs->ipdev, key, 0);//(key_code != HS_REL_K));

			if ((key_code != HS_REL_K))
				write_gkpd_value(72);

			input_report_key(hs->ipdev, key, (key_code != HS_REL_K));
			//input_sync(hs->ipdev);
		}
		break;
	case -1:
		printk(KERN_ERR "%s: No mapping for remote handset event %d\n",
				 __func__, temp_key_code);
		return;
	}
	input_sync(hs->ipdev);
}
Esempio n. 14
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:
	case KEY_MEDIA:
	case KEY_VOLUMEUP:
	case KEY_VOLUMEDOWN:
#ifdef CONFIG_FEATURE_KCC_F45
		HS_DBG_PRINT("%s: key:%x\n", __func__, key);
		if (g_kdm_hs_check) {
			key_set_code(key);
		} else {
			input_report_key(hs->ipdev, key, (key_code != HS_REL_K));
		}
#else
		input_report_key(hs->ipdev, key, (key_code != HS_REL_K));
#endif
		break;
	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:
		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;
	case -1:
		printk(KERN_ERR "%s: No mapping for remote handset event %d\n",
				 __func__, temp_key_code);
		return;
	}
#ifdef CONFIG_FEATURE_KCC_F45
	switch (key) {
	case KEY_POWER:
	case KEY_END:
	case KEY_MEDIA:
	case KEY_VOLUMEUP:
	case KEY_VOLUMEDOWN:
		if (!g_kdm_hs_check) {
			input_sync(hs->ipdev);
		}
		break;
	default:
		input_sync(hs->ipdev);
		break;
	}
#else
	input_sync(hs->ipdev);
#endif
}
Esempio n. 15
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
}
/*
 * 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);
}
Esempio n. 17
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);
}
/*
 * 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 = 0, temp_key_code;

/* FUJITSU:2011-06-15 mod ChargeError start */
   	if (key_code == CHG_ST_NTFY_CODE)
   	{
        printk("got CHG_ST_NTFY_CODE notification\n");
        switch(key_parm)
        {
            case K_CHG_ST_NONE:
                key = KEY_CHG_ST_NONE;
                break;
            case K_CHG_ST_OVP:
                key = KEY_CHG_ST_OVP;
                break;
            case K_CHG_ST_OVC:
                key = KEY_CHG_ST_OVC;
                break;
            case K_CHG_ST_OVD:
                key = KEY_CHG_ST_OVD;
                break;
            case K_CHG_ST_EXP:
                key = KEY_CHG_ST_EXP;
                break;
        }
        printk(" key_code = %d, key_parm = %d\n", key_code, key_parm);
        input_report_key(hs->ipdev, key, (key_code != HS_REL_K));
	input_sync(hs->ipdev);
	return;
	}
/* FUJITSU:2011-06-15 mod ChargeError end */

/* FUJITSU:2011-07-05 USB start */
	if (key_code == USB_CABLE_DET) {
		switch(key_parm) {
		case K_CABLE_WAKEUP:
			printk(KERN_DEBUG "%s: cable_det debug. call wakeup (%d)\n", __func__, key_parm);
			/* call wakeup function */
			break;
		case K_CABLE_USB_OTG_INIT_PHY:
		case K_CABLE_USB_CONNECT_CLIENT:
		case K_CABLE_USB_CONNECT_HOST:
			printk(KERN_DEBUG "%s: cable_det debug. USB utilization demand (%d)\n", __func__, key_parm);
			msm_otg_enable_irq();
/* FUJITSU:2011-07-05 USB start */
			printk(KERN_DEBUG "%s: cable_det debug. USB enable (%d)\n", __func__,key_parm);
			msm_hsusb_set_vbus_state(1);
/* FUJITSU:2011-07-05 USB end */
			printk(KERN_DEBUG "%s: cable_det debug. USB connect client (%d) \n",__func__,key_parm);
			break;
		case K_CABLE_USB_DISCONNECT:
			printk(KERN_DEBUG "%s: cable_det debug. USB cable cutting (%d) \n",__func__,key_parm);
/* FUJITSU:2011-07-05 USB start */
			msm_otg_disable_irq();
/* FUJITSU:2011-07-05 USB end */
			printk(KERN_DEBUG "%s: cable_det debug. USB disable (%d) \n",__func__,key_parm);
			break;
/* FUJITSU:2011-07-07 USB start */
		case K_CABLE_CRADLE_CONNECT:
			g_cradle_stat = 1;
			printk(KERN_DEBUG "%s: cable_det debug. CABLE CRADLE enable (%d)stat(%d) \n",__func__,key_parm,g_cradle_stat);
			break;
		case K_CABLE_CRADLE_DISCONNECT:
			g_cradle_otg_charge_type = -1;
			g_cradle_stat = 0;
			printk(KERN_DEBUG "%s: cable_det debug. CABLE CRADLE disable (%d)stat(%d) \n",__func__,key_parm,g_cradle_stat);
			break;
/* FUJITSU:2011-07-07 USB end */
		default:
			/* error !! */
			break;
		}
		return;
    	}
/* FUJITSU:2011-07-05 USB end */

	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: FUJITSU:2011-04-08 DEL */
	case KEY_VOLUMEUP:
	case KEY_VOLUMEDOWN:
		input_report_key(hs->ipdev, key, (key_code != HS_REL_K));
		break;
/* FUJITSU:2011-04-08 for media key start */
	case KEY_MEDIA:
/* FUJITSU:2011-06-08 for media key start */
		if(mediakeyloop){
			if(key_code != HS_REL_K) mediakeyflg = true;
			else mediakeyflg = false;
			break;
		}
		if(mediakeyflg){
			if(key_code == HS_REL_K) mediakeyflg = false;
			break;
		}
/* FUJITSU:2011-06-08 for media key end */
//		if(ena_media_key)input_report_key(hs->ipdev, key, (key_code != HS_REL_K));
		if(ena_media_key && key_code == HS_REL_K){
			input_report_key(hs->ipdev, key, true);
			input_report_key(hs->ipdev, key, false);
		}
		break;
/* FUJITSU:2011-04-08 for media key end */
	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:
		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;
	case -1:
		printk(KERN_ERR "%s: No mapping for remote handset event %d\n",
				 __func__, temp_key_code);
		return;
	}
	input_sync(hs->ipdev);
}
Esempio n. 20
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);
}
Esempio n. 21
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;

#if defined(T_QCI_IS3)
    if (key_code == CHG_ST_NTFY_CODE) {
        switch(key_parm) {
        case K_CHG_ST_NONE:
            key = KEY_CHG_ST_NONE;
            break;
        case K_CHG_ST_OVP:
            key = KEY_CHG_ST_OVP;
            break;
        case K_CHG_ST_OVC:
            key = KEY_CHG_ST_OVC;
            break;
        case K_CHG_ST_OVD:
            key = KEY_CHG_ST_OVD;
            break;
        case K_CHG_ST_EXP:
            key = KEY_CHG_ST_EXP;
            break;
        case K_TEMP_MSM_OVER_LAYER1:
            key = KEY_TEMP_MSM_OVER_LEYER_1;
            break;
        case K_TEMP_MSM_OVER_LAYER2:
            key = KEY_TEMP_MSM_OVER_LEYER_2;
            break;
        case K_TEMP_MSM_OVER_LAYER3:
            key = KEY_TEMP_MSM_OVER_LEYER_3;
            break;
        case K_TEMP_MSM_OVER_RESUME_NORMAL:
            key = KEY_TEMP_MSM_OVER_RESUME_NORMAL;
            break;
        default:
            key = 0;
            break;
        }
        printk("got CHG_ST_NTFY_CODE key_code = %d, key_parm = %d, key = %d\n", key_code, key_parm,key);
        input_report_key(hs->ipdev, key, (key_code != HS_REL_K));
        input_sync(hs->ipdev);
        input_report_key(hs->ipdev, key, 0);
        input_sync(hs->ipdev);
        return;
    }
#endif

    /* FUJITSU:2012.02.23 USB start */
    if (key_code == USB_CABLE_DET) {
        switch (key_parm) {
        case K_CABLE_WAKEUP:
            pr_info("%s: cable wakeup\n", __func__);
            break;
        case K_CABLE_USB_OTG_INIT_PHY:
            pr_info("%s: cable USB OTG init PHY\n", __func__);
            break;
        case K_CABLE_USB_CONNECT_CLIENT:
            pr_info("%s: cable USB connect client\n", __func__);
            break;
        case K_CABLE_USB_CONNECT_HOST:
            pr_info("%s: cable USB connect host\n", __func__);
            break;
        case K_CABLE_USB_DISCONNECT:
            pr_info("%s: cable USB disconnect\n", __func__);
            break;
        case K_CABLE_CRADLE_CONNECT:
            pr_info("%s: cradle connect\n", __func__);
            break;
        case K_CABLE_CRADLE_DISCONNECT:
            pr_info("%s: cradle disconnect\n", __func__);
            break;
        default:
            pr_info("%s: unknown key_parm=0x%x\n", __func__, key_parm);
            break;
        }
        return;
    }
    /* FUJITSU:2012.02.23 USB end */

    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_VOLUMEUP:
    case KEY_VOLUMEDOWN:
        input_report_key(hs->ipdev, key, (key_code != HS_REL_K));
        break;
#if defined(T_QCI_IS3)
    /* FUJITSU:2011-12-01 for media key start */
    case KEY_MEDIA:
        if(mediakeyloop) {
            if(key_code != HS_REL_K) mediakeyflg = true;
            else mediakeyflg = false;
            break;
        }
        if(mediakeyflg) {
            if(key_code == HS_REL_K) mediakeyflg = false;
            break;
        }

        if(ena_media_key)input_report_key(hs->ipdev, key, (key_code != HS_REL_K));
        break;
        /* FUJITSU:2011-12-01 for media key end */
#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:
        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;
    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;

/* FUJITSU:2012-04-28 mod Battery 12_1 holder,mhl type, voltage_now start */
#ifdef CONFIG_FUJITSU_KEY_CHG_ST
	if (key_code == CHG_ST_NTFY_CODE){
		switch(key_parm){
		case K_CHG_ST_NONE:
			key = KEY_CHG_ST_NONE;
			break;
		case K_CHG_ST_OVP:
			key = KEY_CHG_ST_OVP;
#ifdef CONFIG_FUJITSU_CHARGER_12_1
			msm_battery_health(POWER_SUPPLY_HEALTH_OVER_SUPPLY_VOLTAGE);
#endif
			break;
		case K_CHG_ST_OVC:
			key = KEY_CHG_ST_OVC;
			msm_battery_health(POWER_SUPPLY_HEALTH_OVERVOLTAGE);
			break;
		case K_CHG_ST_OVD:
			key = KEY_CHG_ST_OVD;
			break;
		case K_CHG_ST_EXP:
			key = KEY_CHG_ST_EXP;
			msm_battery_health(POWER_SUPPLY_HEALTH_UNSPEC_FAILURE);
			break;
		default:
			key = 0;
			break;
		}
		pr_err("CHG_ST_NTFY_CODE: %d,NONE=%d,OVP=%d,OVC=%d,OVD=%d,EXP=%d\n",
			key_parm,
			battery_abnormal_st[0],
			battery_abnormal_st[1],
			battery_abnormal_st[2],
			battery_abnormal_st[3],
			battery_abnormal_st[4]);

#ifndef  CONFIG_FUJITSU_CHARGER_12_1
		input_report_key(hs->ipdev, key, (key_code != HS_REL_K));
		input_sync(hs->ipdev);
#endif
		return;
	}


#ifdef CONFIG_FUJITSU_CHARGER_12_1
	if (key_code == CHG_ST_CNCL_NTFY_CODE){
		switch(key_parm){
		case K_CHG_ST_NONE:
			key = KEY_CHG_ST_NONE;
			msm_battery_health(POWER_SUPPLY_HEALTH_GOOD);
			break;
		case K_CHG_ST_OVP:
			key = KEY_CHG_ST_OVP;
			msm_battery_health(POWER_SUPPLY_HEALTH_GOOD);
			break;
		case K_CHG_ST_OVC:
			key = KEY_CHG_ST_OVC;
			msm_battery_health(POWER_SUPPLY_HEALTH_GOOD);
			break;
		case K_CHG_ST_OVD:
			key = KEY_CHG_ST_OVD;
			break;
		case K_CHG_ST_EXP:
			key = KEY_CHG_ST_EXP;
			msm_battery_health(POWER_SUPPLY_HEALTH_GOOD);
			break;
		default:
			key = 0;
			break;
		}
		pr_err("CHG_ST_CNCL_CODE: %d,NONE=%d,OVP=%d,OVC=%d,OVD=%d,EXP=%d\n",
			key_parm,
			battery_abnormal_st[0],
			battery_abnormal_st[1],
			battery_abnormal_st[2],
			battery_abnormal_st[3],
			battery_abnormal_st[4]);

		return;
	}
#endif //CONFIG_FUJITSU_CHARGER_12_1
#endif //CONFIG_FUJITSU_KEY_CHG_ST
/* FUJITSU:2012-04-28 mod Battery 12_1 holder,mhl type, voltage_now end */


/* FUJITSU:2012-02-23 USB start */
	if (key_code == USB_CABLE_DET) {
		switch (key_parm) {
		case K_CABLE_WAKEUP:
			pr_info("%s: cable wakeup\n", __func__);
			break;
		case K_CABLE_USB_OTG_INIT_PHY:
			pr_info("%s: cable USB OTG init PHY\n", __func__);
			break;
		case K_CABLE_USB_CONNECT_CLIENT:
			pr_info("%s: cable USB connect client\n", __func__);
			break;
		case K_CABLE_USB_CONNECT_HOST:
			pr_info("%s: cable USB connect host\n", __func__);
			break;
		case K_CABLE_USB_DISCONNECT:
			pr_info("%s: cable USB disconnect\n", __func__);
			break;
		case K_CABLE_CRADLE_CONNECT:
			pr_info("%s: cradle connect\n", __func__);
			break;
		case K_CABLE_CRADLE_DISCONNECT:
			pr_info("%s: cradle disconnect\n", __func__);
			break;
		default:
			pr_info("%s: unknown key_parm=0x%x\n", __func__, key_parm);
			break;
		}
		return;
    	}
/* FUJITSU:2012-02-23 USB end */

	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: FUJITSU:2011-12-01 DEL */
	case KEY_VOLUMEUP:
	case KEY_VOLUMEDOWN:
		input_report_key(hs->ipdev, key, (key_code != HS_REL_K));
		break;
/* FUJITSU:2011-12-01 for media key start */
	case KEY_MEDIA:
		if(mediakeyloop){
			if(key_code != HS_REL_K) mediakeyflg = true;
			else mediakeyflg = false;
			break;
		}
		if(mediakeyflg){
			if(key_code == HS_REL_K) mediakeyflg = false;
			break;
		}

		if(ena_media_key)input_report_key(hs->ipdev, key, (key_code != HS_REL_K));
		break;
/* FUJITSU:2011-12-01 for media key end */
	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:
		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;
	case -1:
		printk(KERN_ERR "%s: No mapping for remote handset event %d\n",
				 __func__, temp_key_code);
		return;
	}
	input_sync(hs->ipdev);
}