예제 #1
0
static irqreturn_t pwrkey_release_irq(int irq, void *_pwrkey)
{
	struct pmic8xxx_pwrkey *pwrkey = _pwrkey;

	if (pwrkey->press == false) {
		input_report_key(pwrkey->pwr, KEY_POWER, 1);
		input_sync(pwrkey->pwr);
		pwrkey->press = true;
	} else {
		pwrkey->press = false;
	}

#ifdef QUALCOMM_ORIGINAL_FEATURE
	input_report_key(pwrkey->pwr, KEY_POWER, 0);
	input_sync(pwrkey->pwr);
#else
	PWRKEY_INFO_PRINT("checkpoint: %s: %x\n", __func__, g_kdm_pwrkey_check);
	if (g_kdm_pwrkey_check) {
			key_set_code(KEY_POWER);
	} else {
		input_report_key(pwrkey->pwr, KEY_POWER, 0);
		input_sync(pwrkey->pwr);
	}
#endif /* QUALCOMM_ORIGINAL_FEATURE */

	return IRQ_HANDLED;
}
예제 #2
0
static void gpio_keys_gpio_report_event(struct gpio_button_data *bdata)
{
    struct gpio_keys_button *button = bdata->button;
    struct input_dev *input = bdata->input;
    unsigned int type = button->type ?: EV_KEY;
    int state = (gpio_get_value_cansleep(button->gpio) ? 1 : 0) ^ button->active_low;

#ifdef QUALCOMM_ORIGINAL_FEATURE
    if (type == EV_ABS) {
        if (state)
            input_event(input, type, button->code, button->value);
    } else {
        input_event(input, type, button->code, !!state);
    }
    input_sync(input);
#else
    bool is_on;

    if (g_kdm_check) {
        key_set_code(button->code);
    } else {
        KEY_LOG_PRINT("gpio_keys type:%x code:%x state:%x \n", type, button->code, state);
        if (state) {
            KEY_LOG_PRINT("gpio_keys active_cnt:%x \n", button->active_cnt);
            if (button->active_cnt) {
                KEY_LOG_PRINT("gpio_keys active_cnt-- \n");
                button->active_cnt--;
                mod_timer(&bdata->timer,
                          jiffies + msecs_to_jiffies(button->debounce_interval));
            } else {
                KEY_LOG_PRINT("gpio_keys set on \n");
                button->active_cnt = ACTIVE_STATE_CNT;
                gpio_keys_set_stateon(button->code);
                KEY_LOG_PRINT("send on event \n");
                wake_lock_timeout(&gpio_wake_lock,HZ);
                input_event(input, type, button->code, !!state);
                input_sync(input);
            }
        } else {
            KEY_LOG_PRINT("gpio_keys set off \n");
            button->active_cnt = ACTIVE_STATE_CNT;
            is_on = gpio_keys_is_stateon(button->code);
            gpio_keys_set_stateoff(button->code);
            if (is_on) {
                KEY_LOG_PRINT("send off event \n");
                input_event(input, type, button->code, !!state);
                input_sync(input);
            }
        }
    }
#endif
}
예제 #3
0
static void gpio_keys_report_event(struct gpio_button_data *bdata)
{
	struct gpio_keys_button *button = bdata->button;
	struct input_dev *input = bdata->input;
	unsigned int type = button->type ?: EV_KEY;
	
#ifdef CONFIG_FEATURE_KCC_00
	int state = (gpio_get_value_cansleep(button->gpio) ? 1 : 0) ^ button->active_low;
#else
	int state = (gpio_get_value(button->gpio) ? 1 : 0) ^ button->active_low;
#endif

#ifdef CONFIG_FEATURE_KCC_00
    if( g_kdm_check )
    {
		key_set_code( button->code );
	}else{

		KEY_LOG_PRINT("gpio_keys type:%x code:%x state:%x \n", type, button->code, state);
		if( state ){
			KEY_LOG_PRINT("gpio_keys active_cnt:%x \n", button->active_cnt );
			if( button->active_cnt ){
				button->active_cnt--;
				mod_timer(&bdata->timer,
					jiffies + msecs_to_jiffies(button->debounce_interval));
			}else{
				button->active_cnt = ACTIVE_STATE_CNT;
				input_event(input, type, button->code, !!state);
				input_sync(input);
			}
		}else{
			button->active_cnt = ACTIVE_STATE_CNT;
			input_event(input, type, button->code, !!state);
			input_sync(input);
		}
	}
#else
	if (type == EV_ABS) {
		if (state)
			input_event(input, type, button->code, button->value);
	} else {
		input_event(input, type, button->code, !!state);
	}
	input_sync(input);
#endif
}
예제 #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;

	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
}