static void report_key(struct gpio_kp *kp, int key_index, int out, int in)
{
	struct gpio_event_matrix_info *mi = kp->keypad_info;
	int pressed = test_bit(key_index, kp->keys_pressed);
	unsigned short keyentry = mi->keymap[key_index];
	unsigned short keycode = keyentry & MATRIX_KEY_MASK;
	unsigned short dev = keyentry >> MATRIX_CODE_BITS;

	if (pressed != test_bit(keycode, kp->input_devs->dev[dev]->key)) {
		if (keycode == KEY_RESERVED) {
			if (mi->flags & GPIOKPF_PRINT_UNMAPPED_KEYS)
				pr_info("gpiomatrix: unmapped key, %d-%d "
					"(%d-%d) changed to %d\n",
					out, in, mi->output_gpios[out],
					mi->input_gpios[in], pressed);
		} else {
			if (mi->flags & GPIOKPF_PRINT_MAPPED_KEYS)
				pr_info("gpiomatrix: key %x, %d-%d (%d-%d) "
					"changed to %d\n", keycode,
					out, in, mi->output_gpios[out],
					mi->input_gpios[in], pressed);
			input_report_key(kp->input_devs->dev[dev], keycode, pressed);

#if defined(CONFIG_LGE_DIAGTEST)
			mtc_send_key_log_packet((unsigned long)keycode, (unsigned long)!pressed);
			ats_eta_mtc_key_logging((int)keycode, (char)pressed);
#endif
		}
	}
}
Beispiel #2
0
static void report_key(struct gpio_kp *kp, int key_index, int out, int in)
{
	struct gpio_event_matrix_info *mi = kp->keypad_info;
	int pressed = test_bit(key_index, kp->keys_pressed);
	unsigned short keyentry = mi->keymap[key_index];
	unsigned short keycode = keyentry & MATRIX_KEY_MASK;
	unsigned short dev = keyentry >> MATRIX_CODE_BITS;

	if (pressed != test_bit(keycode, kp->input_devs->dev[dev]->key)) {
		if (keycode == KEY_RESERVED) {
			if (mi->flags & GPIOKPF_PRINT_UNMAPPED_KEYS)
				pr_info("gpiomatrix: unmapped key, %d-%d "
					"(%d-%d) changed to %d\n",
					out, in, mi->output_gpios[out],
					mi->input_gpios[in], pressed);
		} else {
			if (mi->flags & GPIOKPF_PRINT_MAPPED_KEYS)
				pr_info("gpiomatrix: key %x, %d-%d (%d-%d) "
					"changed to %d\n", keycode,
					out, in, mi->output_gpios[out],
					mi->input_gpios[in], pressed);
			input_report_key(kp->input_devs->dev[dev], keycode, pressed);

			// LGE_CHANGE_S [2011.0125] [[email protected]] [gelato] keypad log [START]
			printk("gpiomatrix: key %x, %d-%d (%d-%d) "
					"changed to %d\n", keycode,
					out, in, mi->output_gpios[out],
					mi->input_gpios[in], pressed);
			// LGE_CHANGE_E [2011.0125] [[email protected]] [gelato] keypad log [END]			
// LGE_CHANGE_S [[email protected]] [2011.02.25] [GELATO] enable or disable key logging status of slate [START]
#ifdef CONFIG_LGE_DIAG
			if(key_touch_logging_status == 1 && pressed == 1)
				mtc_send_key_log_packet((unsigned long)keycode, 1L);
#endif
// LGE_CHANGE_E [[email protected]] [2011.02.25] [GELATO] enable or disable key logging status of slate [END]
		}
	}
}
/*
 * 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);
}