Beispiel #1
0
static void gpio_keys_report_event(struct gpio_button_data *bdata)
{
	static struct timespec home_key_up_time = {0, 0};
	struct gpio_keys_button *button = bdata->button;
	struct input_dev *input = bdata->input;
	unsigned int type = button->type ?: EV_KEY;
	struct irq_desc *desc = irq_to_desc(gpio_to_irq(button->gpio));
	int state = (gpio_get_value_cansleep(button->gpio) ? 1 : 0) ^ button->active_low;

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

		if (button->code == KEY_HOME || button->code == KEY_UP || button->code == KEY_DOWN) {
			if (state) {
				// we can't press this button again in 30ms! god finger? by tegrak
				if (ts_sub_to_ms(current_kernel_time(), home_key_up_time) < 30) {
					printk(KERN_ERR "Unintended home key repeatition. Ignore this action.");
					return;
				}
			}
		} else {
			home_key_up_time = current_kernel_time();
		}

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

	input_sync(input);
}
Beispiel #2
0
static bool suspend_device_irq(struct irq_desc *desc, int irq)
{
	if (!desc->action || desc->no_suspend_depth)
		return false;

	if (irqd_is_wakeup_set(&desc->irq_data)) {
		irqd_set(&desc->irq_data, IRQD_WAKEUP_ARMED);
		/*
		 * We return true here to force the caller to issue
		 * synchronize_irq(). We need to make sure that the
		 * IRQD_WAKEUP_ARMED is visible before we return from
		 * suspend_device_irqs().
		 */
		return true;
	}

	desc->istate |= IRQS_SUSPENDED;
	__disable_irq(desc, irq);

	/*
	 * Hardware which has no wakeup source configuration facility
	 * requires that the non wakeup interrupts are masked at the
	 * chip level. The chip implementation indicates that with
	 * IRQCHIP_MASK_ON_SUSPEND.
	 */
	if (irq_desc_get_chip(desc)->flags & IRQCHIP_MASK_ON_SUSPEND)
		mask_irq(desc);
	return true;
}
Beispiel #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;
	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(FEATURE_TW_TOUCH_AUTO_CAL)
	if(check_touch_cal==1 &&  button->code==KEY_POWER)
		printk("No Key Event Key Power \n");
	else
	{
#endif
		if (type == EV_ABS) {
			if (state)
				input_event(input, type, button->code, button->value);
		} else {
			input_event(input, type, button->code,
					irqd_is_wakeup_set(&desc->irq_data) ? 1 :!!state);
		}
		input_sync(input);
#if defined(FEATURE_TW_TOUCH_AUTO_CAL)
	}
#endif
}
static void nmk_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)
{
	int mode;
	unsigned		i;
	unsigned		gpio = chip->base;
	int			is_out;
	struct nmk_gpio_chip *nmk_chip =
		container_of(chip, struct nmk_gpio_chip, chip);
	const char *modes[] = {
		[NMK_GPIO_ALT_GPIO]	= "gpio",
		[NMK_GPIO_ALT_A]	= "altA",
		[NMK_GPIO_ALT_B]	= "altB",
		[NMK_GPIO_ALT_C]	= "altC",
	};

	for (i = 0; i < chip->ngpio; i++, gpio++) {
		const char *label = gpiochip_is_requested(chip, i);
		bool pull;
		u32 bit = 1 << i;

		is_out = readl(nmk_chip->addr + NMK_GPIO_DIR) & bit;
		pull = !(readl(nmk_chip->addr + NMK_GPIO_PDIS) & bit);
		mode = nmk_gpio_get_mode(gpio);
		seq_printf(s, " gpio-%-3d (%-20.20s) %s %s %s %s",
			gpio, label ?: "(none)",
			is_out ? "out" : "in ",
			chip->get
				? (chip->get(chip, i) ? "hi" : "lo")
				: "?  ",
			(mode < 0) ? "unknown" : modes[mode],
			pull ? "pull" : "none");

		if (label && !is_out) {
			int		irq = gpio_to_irq(gpio);
			struct irq_desc	*desc = irq_to_desc(irq);

			/* This races with request_irq(), set_irq_type(),
			 * and set_irq_wake() ... but those are "rare".
			 */
			if (irq >= 0 && desc->action) {
				char *trigger;
				u32 bitmask = nmk_gpio_get_bitmask(gpio);

				if (nmk_chip->edge_rising & bitmask)
					trigger = "edge-rising";
				else if (nmk_chip->edge_falling & bitmask)
					trigger = "edge-falling";
				else
					trigger = "edge-undefined";

				seq_printf(s, " irq-%d %s%s",
					irq, trigger,
					irqd_is_wakeup_set(&desc->irq_data)
						? " wakeup" : "");
			}
		}

		seq_printf(s, "\n");
	}
}
Beispiel #5
0
void samsung_sync_wakemask(void __iomem *reg,
			   struct samsung_wakeup_mask *mask, int nr_mask)
{
	struct irq_data *data;
	u32 val;

	val = __raw_readl(reg);

	for (; nr_mask > 0; nr_mask--, mask++) {
		if (mask->irq == NO_WAKEUP_IRQ) {
			val |= mask->bit;
			continue;
		}

		data = irq_get_irq_data(mask->irq);

		
		if (irqd_is_wakeup_set(data))
			val &= ~mask->bit;
		else
			val |= mask->bit;
	}

	printk(KERN_INFO "wakemask %08x => %08x\n", __raw_readl(reg), val);
	__raw_writel(val, reg);
}
Beispiel #6
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
}
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;
	struct irq_desc *desc = irq_to_desc(gpio_to_irq(button->gpio));
	int state = (gpio_get_value_cansleep(button->gpio) ? 1 : 0) ^ button->active_low;

	pr_info("gpio-keys : code[%d], type[%d], state[%d]\n",
			button->code, button->type, state);

	if (type == EV_ABS) {
		if (state) {
			input_event(input, type, button->code, button->value);
			input_sync(input);
		}
	} else {
		int report_state;
		static int prev_state;

		if (bdata->wakeup && !state) {
			input_event(input, type, button->code, !state);
			input_sync(input);
#if !defined(CONFIG_SAMSUNG_PRODUCT_SHIP)
			printk(KERN_DEBUG"keys:f code %d, state %d\n",
				button->code, !state);
#else
			if (button->code == KEY_POWER)
				printk(KERN_DEBUG "keys:f PWR %d\n", !state);
#endif
		}

		bdata->key_state = !!state;
		bdata->wakeup = false;

		report_state = irqd_is_wakeup_set(&desc->irq_data) ? 1 : !!state;
#if !defined(CONFIG_SAMSUNG_PRODUCT_SHIP)
		printk(KERN_DEBUG"keys:code %d, state %d\n",
			button->code, report_state);
#endif
		input_event(input, type, button->code, report_state);
		input_sync(input);

		if (button->code == KEY_POWER && prev_state != report_state) {
			printk(KERN_DEBUG "keys:PWR %d\n", report_state);
			prev_state = report_state;
		}
#ifdef KEY_BOOSTER
		if (button->code == KEY_HOMEPAGE)
			gpio_key_set_dvfs_lock(bdata, !!state);
#endif
#ifdef CONFIG_INPUT_BOOSTER
		if (button->code == KEY_HOMEPAGE)
			INPUT_BOOSTER_SEND_EVENT(KEY_HOMEPAGE, !!state);
#endif
	}
}
Beispiel #8
0
static void stm32_receive_chars(struct uart_port *port, bool threaded)
{
	struct tty_port *tport = &port->state->port;
	struct stm32_port *stm32_port = to_stm32_port(port);
	struct stm32_usart_offsets *ofs = &stm32_port->info->ofs;
	unsigned long c;
	u32 sr;
	char flag;

	if (irqd_is_wakeup_set(irq_get_irq_data(port->irq)))
		pm_wakeup_event(tport->tty->dev, 0);

	while (stm32_pending_rx(port, &sr, &stm32_port->last_res, threaded)) {
		sr |= USART_SR_DUMMY_RX;
		c = stm32_get_char(port, &sr, &stm32_port->last_res);
		flag = TTY_NORMAL;
		port->icount.rx++;

		if (sr & USART_SR_ERR_MASK) {
			if (sr & USART_SR_LBD) {
				port->icount.brk++;
				if (uart_handle_break(port))
					continue;
			} else if (sr & USART_SR_ORE) {
				if (ofs->icr != UNDEF_REG)
					writel_relaxed(USART_ICR_ORECF,
						       port->membase +
						       ofs->icr);
				port->icount.overrun++;
			} else if (sr & USART_SR_PE) {
				port->icount.parity++;
			} else if (sr & USART_SR_FE) {
				port->icount.frame++;
			}

			sr &= port->read_status_mask;

			if (sr & USART_SR_LBD)
				flag = TTY_BREAK;
			else if (sr & USART_SR_PE)
				flag = TTY_PARITY;
			else if (sr & USART_SR_FE)
				flag = TTY_FRAME;
		}

		if (uart_handle_sysrq_char(port, c))
			continue;
		uart_insert_char(port, sr, USART_SR_ORE, c, flag);
	}

	spin_unlock(&port->lock);
	tty_flip_buffer_push(tport);
	spin_lock(&port->lock);
}
Beispiel #9
0
static ssize_t wakeup_show(struct kobject *kobj,
			   struct kobj_attribute *attr, char *buf)
{
	struct irq_desc *desc = container_of(kobj, struct irq_desc, kobj);
	ssize_t ret = 0;

	raw_spin_lock_irq(&desc->lock);
	ret = sprintf(buf, "%s\n",
		      irqd_is_wakeup_set(&desc->irq_data) ? "enabled" : "disabled");
	raw_spin_unlock_irq(&desc->lock);

	return ret;

}
static int nmk_gpio_irq_set_type(struct irq_data *d, unsigned int type)
{
	bool enabled = !irqd_irq_disabled(d);
	bool wake = irqd_is_wakeup_set(d);
	int gpio;
	struct nmk_gpio_chip *nmk_chip;
	unsigned long flags;
	u32 bitmask;

	gpio = NOMADIK_IRQ_TO_GPIO(d->irq);
	nmk_chip = irq_data_get_irq_chip_data(d);
	bitmask = nmk_gpio_get_bitmask(gpio);
	if (!nmk_chip)
		return -EINVAL;

	if (type & IRQ_TYPE_LEVEL_HIGH)
		return -EINVAL;
	if (type & IRQ_TYPE_LEVEL_LOW)
		return -EINVAL;

	clk_enable(nmk_chip->clk);
	spin_lock_irqsave(&nmk_chip->lock, flags);

	if (enabled)
		__nmk_gpio_irq_modify(nmk_chip, gpio, NORMAL, false);

	if (enabled || wake)
		__nmk_gpio_irq_modify(nmk_chip, gpio, WAKE, false);

	nmk_chip->edge_rising &= ~bitmask;
	if (type & IRQ_TYPE_EDGE_RISING)
		nmk_chip->edge_rising |= bitmask;

	nmk_chip->edge_falling &= ~bitmask;
	if (type & IRQ_TYPE_EDGE_FALLING)
		nmk_chip->edge_falling |= bitmask;

	if (enabled)
		__nmk_gpio_irq_modify(nmk_chip, gpio, NORMAL, true);

	if (enabled || wake)
		__nmk_gpio_irq_modify(nmk_chip, gpio, WAKE, true);

	spin_unlock_irqrestore(&nmk_chip->lock, flags);
	clk_disable(nmk_chip->clk);

	return 0;
}
Beispiel #11
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;
	struct irq_desc *desc = irq_to_desc(gpio_to_irq(button->gpio));
	int state = (gpio_get_value_cansleep(button->gpio) ? 1 : 0) ^ button->active_low;

	if (type == EV_ABS) {
		if (state)
			input_event(input, type, button->code, button->value);
	} else {
		input_event(input, type, button->code,
				irqd_is_wakeup_set(&desc->irq_data) ? 1 : !!state);
	}
	input_sync(input);
}
Beispiel #12
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;
	struct irq_desc *desc = irq_to_desc(gpio_to_irq(button->gpio));
	int state = (gpio_get_value_cansleep(button->gpio) ? 1 : 0) ^ button->active_low;

	if (type == EV_ABS) {
		if (state) {
			input_event(input, type, button->code, button->value);
			input_sync(input);
		}
	} else {
		int report_state;
		static int prev_state;

		if (bdata->wakeup && !state) {
			input_event(input, type, button->code, !state);
			input_sync(input);
			if (button->code == KEY_POWER)
				printk(KERN_DEBUG "[keys] f PWR %d\n", !state);
		}

		bdata->key_state = !!state;
		bdata->wakeup = false;

		report_state = irqd_is_wakeup_set(&desc->irq_data) ? 1 : !!state;

		input_event(input, type, button->code, report_state);
		input_sync(input);

		if (button->code == KEY_POWER && prev_state != report_state) {
			printk(KERN_DEBUG "[keys]PWR %d\n", report_state);
			prev_state = report_state;
		}

#ifdef KEY_BOOSTER
		if (button->code == KEY_HOMEPAGE)
			gpio_key_set_dvfs_lock(bdata, !!state);
#endif
	}
}
Beispiel #13
0
/**
 * handle_threaded_wake_irq - Handler for dedicated wake-up interrupts
 * @irq: Device specific dedicated wake-up interrupt
 * @_wirq: Wake IRQ data
 *
 * Some devices have a separate wake-up interrupt in addition to the
 * device IO interrupt. The wake-up interrupt signals that a device
 * should be woken up from it's idle state. This handler uses device
 * specific pm_runtime functions to wake the device, and then it's
 * up to the device to do whatever it needs to. Note that as the
 * device may need to restore context and start up regulators, we
 * use a threaded IRQ.
 *
 * Also note that we are not resending the lost device interrupts.
 * We assume that the wake-up interrupt just needs to wake-up the
 * device, and then device's pm_runtime_resume() can deal with the
 * situation.
 */
static irqreturn_t handle_threaded_wake_irq(int irq, void *_wirq)
{
	struct wake_irq *wirq = _wirq;
	int res;

	/* Maybe abort suspend? */
	if (irqd_is_wakeup_set(irq_get_irq_data(irq))) {
		pm_wakeup_event(wirq->dev, 0);

		return IRQ_HANDLED;
	}

	/* We don't want RPM_ASYNC or RPM_NOWAIT here */
	res = pm_runtime_resume(wirq->dev);
	if (res < 0)
		dev_warn(wirq->dev,
			 "wake IRQ with no resume: %i\n", res);

	return IRQ_HANDLED;
}
static int __qpnpint_handle_irq(struct spmi_controller *spmi_ctrl,
                                struct qpnp_irq_spec *spec,
                                bool show)
{
    //yangjq, 20130619, Add log to show MPM irq 62, GIC irq 222
    extern int save_irq_wakeup_gpio(int irq, int gpio);
    struct irq_domain *domain;
    unsigned long hwirq, busno;
    int irq;

    if (!spec || !spmi_ctrl)
        return -EINVAL;

    pr_debug("spec slave = %u per = %u irq = %u\n",
             spec->slave, spec->per, spec->irq);

    busno = spmi_ctrl->nr;
    if (busno >= QPNPINT_MAX_BUSSES)
        return -EINVAL;

    hwirq = qpnpint_encode_hwirq(spec);
    if (hwirq < 0) {
        pr_err("invalid irq spec passed\n");
        return -EINVAL;
    }

    domain = chip_lookup[busno]->domain;
    irq = irq_radix_revmap_lookup(domain, hwirq);

    if (show) {
        struct irq_desc *desc;
        const char *name = "null";

        desc = irq_to_desc(irq);
        if (desc == NULL)
            name = "stray irq";
        else if (desc->action && desc->action->name)
            name = desc->action->name;

        pr_warn("%d triggered [0x%01x, 0x%02x,0x%01x] %s\n",
                irq, spec->slave, spec->per, spec->irq, name);
    } else {
        //yangjq, 20130617, Add log to show MPM irq 62, GIC irq 222, START
#if 0
        desc = irq_to_desc(irq);
        if (desc != NULL) {
            if (irqd_is_wakeup_set(&desc->irq_data)) {
                if (save_irq_wakeup(irq)) {
#ifdef CONFIG_KALLSYMS
                    printk("%s(), irq=%d, %s, handler=(%pS)\n", __func__, irq,
                           desc->action && desc->action->name ? desc->action->name : "",
                           (void *)desc->action->handler);
#else
                    printk("%s(), irq=%d, %s, handler=0x%08x\n", __func__, irq,
                           desc->action && desc->action->name ? desc->action->name : "",
                           (unsigned int)desc->action->handler);
#endif
                }
            }
        }
#endif //0
        //yangjq, 20130619, Add log to show MPM irq 62, GIC irq 222
        save_irq_wakeup_gpio(irq, 0);
        generic_handle_irq(irq);
    }

    return 0;
}
Beispiel #15
0
static void asc_receive_chars(struct uart_port *port)
{
	struct tty_port *tport = &port->state->port;
	unsigned long status, mode;
	unsigned long c = 0;
	char flag;
	bool ignore_pe = false;

	/*
	 * Datasheet states: If the MODE field selects an 8-bit frame then
	 * this [parity error] bit is undefined. Software should ignore this
	 * bit when reading 8-bit frames.
	 */
	mode = asc_in(port, ASC_CTL) & ASC_CTL_MODE_MSK;
	if (mode == ASC_CTL_MODE_8BIT || mode == ASC_CTL_MODE_8BIT_PAR)
		ignore_pe = true;

	if (irqd_is_wakeup_set(irq_get_irq_data(port->irq)))
		pm_wakeup_event(tport->tty->dev, 0);

	while ((status = asc_in(port, ASC_STA)) & ASC_STA_RBF) {
		c = asc_in(port, ASC_RXBUF) | ASC_RXBUF_DUMMY_RX;
		flag = TTY_NORMAL;
		port->icount.rx++;

		if (status & ASC_STA_OE || c & ASC_RXBUF_FE ||
		    (c & ASC_RXBUF_PE && !ignore_pe)) {

			if (c & ASC_RXBUF_FE) {
				if (c == (ASC_RXBUF_FE | ASC_RXBUF_DUMMY_RX)) {
					port->icount.brk++;
					if (uart_handle_break(port))
						continue;
					c |= ASC_RXBUF_DUMMY_BE;
				} else {
					port->icount.frame++;
				}
			} else if (c & ASC_RXBUF_PE) {
				port->icount.parity++;
			}
			/*
			 * Reading any data from the RX FIFO clears the
			 * overflow error condition.
			 */
			if (status & ASC_STA_OE) {
				port->icount.overrun++;
				c |= ASC_RXBUF_DUMMY_OE;
			}

			c &= port->read_status_mask;

			if (c & ASC_RXBUF_DUMMY_BE)
				flag = TTY_BREAK;
			else if (c & ASC_RXBUF_PE)
				flag = TTY_PARITY;
			else if (c & ASC_RXBUF_FE)
				flag = TTY_FRAME;
		}

		if (uart_handle_sysrq_char(port, c & 0xff))
			continue;

		uart_insert_char(port, c, ASC_RXBUF_DUMMY_OE, c & 0xff, flag);
	}

	/* Tell the rest of the system the news. New characters! */
	tty_flip_buffer_push(tport);
}
Beispiel #16
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
}
Beispiel #17
0
static void gpio_keys_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;
	struct irq_desc *desc = irq_to_desc(gpio_to_irq(button->gpio));
	int state = (gpio_get_value_cansleep(button->gpio) ? 1 : 0) ^ button->active_low;

#ifdef CONFIG_FAST_BOOT
		/*Fake pwr off control*/
		if (fake_shut_down || fake_pressed) {
			if (button->code == KEY_POWER) {
				if (!!state) {
					printk(KERN_DEBUG"keys: start fake check\n");
					fake_pressed = true;
					if (!wake_lock_active(&fake_lock))
						wake_lock(&fake_lock);
					mod_timer(&fake_timer,
						jiffies + msecs_to_jiffies(500));
				} else {
					printk(KERN_DEBUG"keys: end fake checkPwr 0\n");
					fake_pressed = false;
					if (wake_lock_active(&fake_lock))
						wake_unlock(&fake_lock);
				}
			}
			bdata->wakeup = false;
			return ;
		}
#endif

	if (type == EV_ABS) {
		if (state) {
			input_event(input, type, button->code, button->value);
			input_sync(input);
		}
	} else {
		int report_state;
		static int prev_state;

		if (bdata->wakeup && !state) {
			input_event(input, type, button->code, !state);
			input_sync(input);
#if !defined(CONFIG_SAMSUNG_PRODUCT_SHIP)
			printk(KERN_DEBUG"keys:f code %d, state %d\n",
				button->code, !state);
#else
			if (button->code == KEY_POWER)
				printk(KERN_DEBUG "keys:f PWR %d\n", !state);
#endif
		}

		bdata->key_state = !!state;
		bdata->wakeup = false;

		report_state = irqd_is_wakeup_set(&desc->irq_data) ? 1 : !!state;
#if !defined(CONFIG_SAMSUNG_PRODUCT_SHIP)
		printk(KERN_DEBUG"keys:code %d, state %d\n",
			button->code, report_state);
#endif
		input_event(input, type, button->code, report_state);
		input_sync(input);

		if (button->code == KEY_POWER && prev_state != report_state) {
			printk(KERN_DEBUG "keys:PWR %d\n", report_state);
			prev_state = report_state;
		}

#ifdef KEY_BOOSTER
		if (button->code == KEY_HOMEPAGE)
			gpio_key_set_dvfs_lock(bdata, !!state);
#endif
#ifdef CONFIG_INPUT_BOOSTER
		if (button->code == KEY_HOMEPAGE)
			INPUT_BOOSTER_SEND_EVENT(KEY_HOMEPAGE, !!state);
#endif
	}
}