/* work function thread - ffkaka */
static void headset_button_gpio_work(struct work_struct *work)
{
	struct _headset_gpio *hgp = container_of(work, struct _headset_gpio, gpio_work);
	unsigned int key_type  = KEY_RESERVED;

	ret_estate = hgp->active;//jinwon.baek 120808 for earloopback switch checking

	if(hgp->parent->detect.active == 0) return;

	if (hgp->active) {
		code = headset_get_button_code(0);
		pr_info("[headset] button push active=[%d] \n",hgp->active);
	} else {
		pr_info("[headset] button release active=[%d] \n",hgp->active);	
	}

	key_type = headset_map_code2key_type(code);
	switch (key_type) {
		case EV_KEY:
			if(ret_estate == PUSH)
			{
				input_event(hgp->parent->input, key_type, code, 1);
				input_sync(hgp->parent->input);
			}else{
				input_event(hgp->parent->input, key_type, code, 0);
				input_sync(hgp->parent->input);
			}
			break;
		default:
			pr_err("headset not support key type [%d]\n", key_type);
	}
	
}
Exemplo n.º 2
0
static enum hrtimer_restart report_headset_button_status(int active, struct _headset_gpio *hgp)
{
	enum hrtimer_restart restart;
	unsigned int key_type  = KEY_RESERVED;

	pr_info("report_headset_button_status-Active [%d] \n",active);

	ret_estate = active;//jinwon.baek 120808 for earloopback switch checking 
	
	if (active < 0) {
		code = KEY_RESERVED;
		pr_info("KEY_RESERVED eport_headset_button_status-Active [%d] \n",active);	
		return HRTIMER_NORESTART;

	}
	if (active) {
		code = headset_get_button_code(0);

	} else {
		pr_info("HRTIMER_NORESTART eport_headset_button_status-Active [%d] \n",active);	
	}

 	{
		key_type = headset_map_code2key_type(code);
		switch (key_type) {
		case EV_KEY:
			pr_info("headset button-ret_estate %d\n",ret_estate);
			if(ret_estate == PUSH)
			{
			input_event(hgp->parent->input, key_type, code, 1);
		input_sync(hgp->parent->input);
			}else{
			input_event(hgp->parent->input, key_type, code, 0);
		input_sync(hgp->parent->input);
			}
			pr_info("headset button-%d[%dms]\n", key_type, hgp->holded);
			break;
		default:
			pr_err("headset not support key type [%d]\n", key_type);
		}
	}
		return HRTIMER_NORESTART;
}