Exemplo n.º 1
0
static void gpio_keys_gpio_report_event(struct gpio_button_data *bdata)
{
	const 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;
	struct irq_desc *desc = irq_to_desc(gpio_to_irq(button->gpio));

#if !defined(CONFIG_SAMSUNG_PRODUCT_SHIP)
	if ((button->code == KEY_POWER)) {
		printk(KERN_INFO "GPIO-KEY : PWR key is %s[%d]\n",
					state ? "pressed" : "released", irqd_is_wakeup_set(&desc->irq_data));
	}

	if ((button->code == KEY_HOMEPAGE)) {
		printk(KERN_INFO "GPIO-KEY : HOME key is %s[%d]\n",
					state ? "pressed" : "released", irqd_is_wakeup_set(&desc->irq_data));
	}
#else
	if ((button->code == KEY_POWER) && !!state) {
		printk(KERN_INFO "GPIO-KEY : key is pressed!!\n");
	}
	if ((button->code == KEY_HOMEPAGE) && !!state) {
		printk(KERN_INFO "GPIO-KEY : key is pressed!\n");
	}
#endif

	if (type == EV_ABS) {
		if (state)
			input_event(input, type, button->code, button->value);
	} else {
		bdata->key_state = !!state;

/* If AP wake up time(Press button~Start Kernel) is over 50ms,
  * Make Press event for waking up device(LCD ON).
  */
		input_event(input, type, button->code,
				irqd_is_wakeup_set(&desc->irq_data) ? 1 : !!state);
	}

	input_sync(input);
#ifdef CONFIG_INPUT_BOOSTER
	if (button->code == KEY_HOMEPAGE)
		input_booster_send_event(BOOSTER_DEVICE_KEY, !!state);
#endif
}
Exemplo n.º 2
0
static void gpio_keys_close(struct input_dev *input)
{
	struct gpio_keys_drvdata *ddata = input_get_drvdata(input);
	const struct gpio_keys_platform_data *pdata = ddata->pdata;
#if defined (CONFIG_INPUT_BOOSTER)
	int i;
#endif

	if (pdata->disable)
		pdata->disable(input->dev.parent);
#if defined (CONFIG_INPUT_BOOSTER)
	for (i = 0; i < ddata->pdata->nbuttons; i++) {
		struct gpio_button_data *bdata = &ddata->data[i];
		if (bdata->button->code == KEY_HOMEPAGE) {
			input_booster_send_event(BOOSTER_DEVICE_KEY, BOOSTER_MODE_FORCE_OFF);
		}
	}
#endif
}
void forced_release(struct wacom_i2c *wac_i2c)
{
#if defined(CONFIG_SAMSUNG_KERNEL_DEBUG_USER)
	printk(KERN_DEBUG "epen:%s\n", __func__);
#endif
	input_report_abs(wac_i2c->input_dev, ABS_X, 0);
	input_report_abs(wac_i2c->input_dev, ABS_Y, 0);
	input_report_abs(wac_i2c->input_dev, ABS_PRESSURE, 0);
	input_report_abs(wac_i2c->input_dev, ABS_DISTANCE, 0);
	input_report_key(wac_i2c->input_dev, BTN_STYLUS, 0);
	input_report_key(wac_i2c->input_dev, BTN_TOUCH, 0);
	input_report_key(wac_i2c->input_dev, BTN_TOOL_RUBBER, 0);
	input_report_key(wac_i2c->input_dev, BTN_TOOL_PEN, 0);
	input_sync(wac_i2c->input_dev);
#ifdef CONFIG_INPUT_BOOSTER
	input_booster_send_event(BOOSTER_DEVICE_PEN, BOOSTER_MODE_FORCE_OFF);
#endif

	wac_i2c->pen_prox = 0;
	wac_i2c->pen_pressed = 0;
	wac_i2c->side_pressed = 0;
	/*wac_i2c->pen_pdct = PDCT_NOSIGNAL;*/
}
Exemplo n.º 4
0
static void gpio_keys_gpio_report_event(struct gpio_button_data *bdata)
{
	const 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;
	struct irq_desc *desc = irq_to_desc(gpio_to_irq(button->gpio));

#if !defined(CONFIG_SAMSUNG_PRODUCT_SHIP)
	if ((button->code == KEY_POWER)) {
		printk(KERN_INFO "GPIO-KEY : PWR key is %s[%d]\n",
					state ? "pressed" : "released", irqd_is_wakeup_set(&desc->irq_data));
	} else if ((button->code == KEY_HOMEPAGE)) {
		printk(KERN_INFO "GPIO-KEY : HOME key is %s[%d]\n",
					state ? "pressed" : "released", irqd_is_wakeup_set(&desc->irq_data));
	} else if ((button->code == KEY_VOLUMEUP)) {
		printk(KERN_INFO "GPIO-KEY : VOL_UP key is %s[%d]\n",
					state ? "pressed" : "released", irqd_is_wakeup_set(&desc->irq_data));
	} else if ((button->code == KEY_VOLUMEDOWN)) {
		printk(KERN_INFO "GPIO-KEY : VOL_DOWN key is %s[%d]\n",
					state ? "pressed" : "released", irqd_is_wakeup_set(&desc->irq_data));
	}
#else
	if ((button->code == KEY_POWER) && !!state) {
		printk(KERN_INFO "GPIO-KEY : key is pressed!!\n");
	} else if ((button->code == KEY_HOMEPAGE) && !!state) {
		printk(KERN_INFO "GPIO-KEY : key is pressed!\n");
	}
#endif

	if (type == EV_ABS) {
		if (state)
			input_event(input, type, button->code, button->value);
	} else {
		bdata->key_state = !!state;

/* If AP wake up time(Press button~Start Kernel) is over 50ms,
  * Make Press event for waking up device(LCD ON).
  */

#ifdef CONFIG_KEYBOARD_FORCE_REPORT_PRESS_EVENT
		if((!bdata->flag_pressed) && (irqd_is_wakeup_set(&desc->irq_data))) {
			if(state)
				bdata->flag_pressed = true;
			else {
				printk(KERN_INFO"GPIO-KEY : key_pressed is false. but state of %d keycode is 'release'. Enforce input_event with press.\n", button->code);
				input_event(input, type, button->code, 1);
				bdata->flag_pressed = false;
			}
		}
#endif

#ifdef CONFIG_KEYBOARD_FORCE_REPORT_PRESS_EVENT

		input_event(input, type, button->code, !!state);
#else
		input_event(input, type, button->code,
				irqd_is_wakeup_set(&desc->irq_data) ? 1 : !!state);
#endif
	}

	input_sync(input);
#ifdef CONFIG_INPUT_BOOSTER
	if (button->code == KEY_HOMEPAGE)
		input_booster_send_event(BOOSTER_DEVICE_KEY, !!state);
#endif
}