Esempio n. 1
0
static irqreturn_t wacom_interrupt_pdct(int irq, void *dev_id)
{
	struct wacom_i2c *wac_i2c = dev_id;

	if (wac_i2c->query_status == false)
		return IRQ_HANDLED;

	wac_i2c->pen_pdct = gpio_get_value(wac_i2c->wac_pdata->gpio_pendct);

	printk(KERN_DEBUG "[E-PEN] pdct %d(%d)\n",
		wac_i2c->pen_pdct, wac_i2c->pen_prox);

	if (wac_i2c->pen_pdct == PDCT_NOSIGNAL) {
#ifdef WACOM_DISCARD_EVENT_ON_EDGE
		/* on edge, pen_prox can be zero even if hover event is released. */
		if (wac_i2c->rdy_pdct == true && wac_i2c->pen_prox == 0)
			forced_release(wac_i2c);
#else
		/* If rdy is 1, pen is still working*/
		if (wac_i2c->pen_prox == 0)
			forced_release(wac_i2c);
#endif
	} else if (wac_i2c->pen_prox == 0)
		forced_hover(wac_i2c);

	return IRQ_HANDLED;
}
Esempio n. 2
0
static void wacom_power_off(struct wacom_i2c *wac_i2c)
{
	if (wac_i2c->power_enable) {
		wacom_enable_irq(wac_i2c, false);

		/* release pen, if it is pressed */
#if defined(CONFIG_MACH_P4NOTE)
#ifdef WACOM_PDCT_WORK_AROUND
		if (wac_i2c->pen_pdct == PDCT_DETECT_PEN)
#else
		if (wac_i2c->pen_pressed || wac_i2c->side_pressed
			|| wac_i2c->pen_prox)
#endif
#else
		if (wac_i2c->pen_pressed || wac_i2c->side_pressed
			|| wac_i2c->pen_prox)
#endif
			forced_release(wac_i2c);

		if (!wake_lock_active(&wac_i2c->wakelock)) {
			wac_i2c->power_enable = false;
			wac_i2c->wac_pdata->suspend_platform_hw();
		} else
			printk(KERN_DEBUG"epen:wake_lock active\n");
	}
}
Esempio n. 3
0
static irqreturn_t wacom_interrupt_pdct(int irq, void *dev_id)
{
	struct wacom_i2c *wac_i2c = dev_id;

	if (wac_i2c->query_status == false)
		return IRQ_HANDLED;

	wac_i2c->pen_pdct = gpio_get_value(wac_i2c->wac_pdata->gpio_pen_pdct);

	dev_info(&wac_i2c->client->dev, "%s: pdct %d(%d) [%s]\n",
			__func__, wac_i2c->pen_pdct, wac_i2c->pen_prox,
			wac_i2c->pen_pdct ? "Released" : "Pressed");
#ifdef CONFIG_TOUCH_WAKE
	if (touchwake_is_active() && !wac_i2c->pen_pdct) {
		#ifdef TOUCHWAKE_DEBUG_PRINT
		pr_info("[TOUCHWAKE] Wacom Pen pressed\n");
		#endif
		touch_press(); // Yank555.lu - Screen touched by pen
	}
#endif
#if 0
	if (wac_i2c->pen_pdct == PDCT_NOSIGNAL) {
		/* If rdy is 1, pen is still working*/
		if (wac_i2c->pen_prox == 0)
			forced_release(wac_i2c);
	} else if (wac_i2c->pen_prox == 0)
		forced_hover(wac_i2c);
#endif

	return IRQ_HANDLED;
}
void wacom_i2c_pendct_work(struct work_struct *work)
{
	struct wacom_i2c *wac_i2c =
	    container_of(work, struct wacom_i2c, pendct_dwork.work);

	printk(KERN_DEBUG "[E-PEN] %s , %d\n",
	       __func__, gpio_get_value(wac_i2c->wac_pdata->gpio_pendct));

	if (gpio_get_value(wac_i2c->wac_pdata->gpio_pendct))
		forced_release(wac_i2c);
}
static void wacom_i2c_disable(struct wacom_i2c *wac_i2c)
{
	if (wac_i2c->power_enable) {
		wacom_enable_irq(wac_i2c, false);

		/* release pen, if it is pressed */
		if (wac_i2c->pen_pressed || wac_i2c->side_pressed
			|| wac_i2c->pen_prox)
			forced_release(wac_i2c);

			wac_i2c->wac_pdata->wacom_stop(wac_i2c);
	}
}
void forced_hover(struct wacom_i2c *wac_i2c)
{
	/* To distinguish hover and pdct area, release */
	if (wac_i2c->last_x != 0 || wac_i2c->last_y != 0) {
		printk(KERN_DEBUG "epen:release hover\n");
		forced_release(wac_i2c);
	}
	wac_i2c->rdy_pdct = true;
#if defined(CONFIG_SAMSUNG_KERNEL_DEBUG_USER)
	printk(KERN_DEBUG "epen:%s\n", __func__);
#endif
	input_report_key(wac_i2c->input_dev, KEY_PEN_PDCT, 1);
	input_sync(wac_i2c->input_dev);
}
Esempio n. 7
0
static void wacom_i2c_early_suspend(struct early_suspend *h)
{
	struct wacom_i2c *wac_i2c =
	    container_of(h, struct wacom_i2c, early_suspend);

	disable_irq(wac_i2c->client->irq);

	/* release pen, if it is pressed */
	if (wac_i2c->pen_pressed || wac_i2c->side_pressed)
		forced_release(wac_i2c);

	wac_i2c->wac_pdata->early_suspend_platform_hw();
	printk(KERN_DEBUG "[E-PEN] %s.\n", __func__);
}
void wacom_i2c_pendct_work(struct work_struct *work)
{
	struct wacom_i2c *wac_i2c =
	    container_of(work, struct wacom_i2c, pendct_dwork.work);

	printk(KERN_DEBUG "epen:%s , %d\n",
	       __func__, gpio_get_value(wac_i2c->wac_pdata->gpio_pendct));

	if (gpio_get_value(wac_i2c->wac_pdata->gpio_pendct))
#ifdef WACOM_DISCARD_EVENT_ON_EDGE
		if (wac_i2c->pen_pressed || wac_i2c->side_pressed
				|| wac_i2c->pen_prox)
#endif
		forced_release(wac_i2c);
}
Esempio n. 9
0
static irqreturn_t wacom_interrupt_pdct(int irq, void *dev_id)
{
	struct wacom_i2c *wac_i2c = dev_id;

	wac_i2c->pen_pdct = gpio_get_value(wac_i2c->wac_pdata->gpio_pendct);

	printk(KERN_DEBUG "[E-PEN] pdct %d(%d)\n",
		wac_i2c->pen_pdct, wac_i2c->pen_prox);

	if (wac_i2c->pen_pdct == PDCT_NOSIGNAL) {
		/* If rdy is 1, pen is still working*/
		if (wac_i2c->pen_prox == 0)
			forced_release(wac_i2c);
	} else if (wac_i2c->pen_prox == 0)
		forced_hover(wac_i2c);

	return IRQ_HANDLED;
}
static void wacom_power_off(struct wacom_i2c *wac_i2c)
{
	mutex_lock(&wac_i2c->lock);

	if (!wac_i2c->power_enable) {
		printk(KERN_DEBUG"epen:pass pwr off\n");
		goto out_power_off;
	}

#ifdef WACOM_BOOSTER
	wacom_set_dvfs_lock(wac_i2c, 2);
#endif
	wacom_enable_irq(wac_i2c, false);

	/* release pen, if it is pressed */
	if (wac_i2c->pen_pressed || wac_i2c->side_pressed
		|| wac_i2c->pen_prox)
		forced_release(wac_i2c);

	cancel_delayed_work_sync(&wac_i2c->resume_work);

#ifdef LCD_FREQ_SYNC
	cancel_work_sync(&wac_i2c->lcd_freq_work);
	cancel_delayed_work_sync(&wac_i2c->lcd_freq_done_work);
	wac_i2c->lcd_freq_wait = false;
#endif
#ifdef WACOM_USE_SOFTKEY_BLOCK
	cancel_delayed_work_sync(&wac_i2c->softkey_block_work);
	wac_i2c->block_softkey = false;
#endif

	if (wake_lock_active(&wac_i2c->fw_wakelock)) {
		printk(KERN_DEBUG"epen:wake_lock active. pass pwr off\n");
		goto out_power_off;
	}

	/* power off */
	wac_i2c->power_enable = false;
	wac_i2c->wac_pdata->suspend_platform_hw();

	printk(KERN_DEBUG"epen:%s\n", __func__);
 out_power_off:
	mutex_unlock(&wac_i2c->lock);
}
static void wacom_i2c_early_suspend(struct early_suspend *h)
{
	struct wacom_i2c *wac_i2c = container_of(h, struct wacom_i2c, early_suspend);

	if(IsWacomEnabled == false){
		printk(KERN_ERR "[E-PEN]: E-PEN have been disabled by menu \n");
		return;
	}


	disable_irq(wac_i2c->client->irq);

#ifdef EPEN_CPU_LOCK

	if (epen_cpu_lock_status) {
		s5pv310_cpufreq_lock_free(DVFS_LOCK_ID_PEN);
		epen_cpu_lock_status = 0;
	}

#endif
#ifdef WACOM_PDCT_WORK_AROUND
	disable_irq(wac_i2c->irq_pdct);
#endif
	printk(KERN_INFO "[E-PEN] %s - wac_i2c->pen_pdct = %d, wac_i2c->pen_pressed = %d\n", __func__, wac_i2c->pen_pdct, wac_i2c->pen_pressed);
	printk(KERN_INFO "[E-PEN] %s - wac_i2c->side_pressed = %d, wac_i2c->pen_prox = %d\n", __func__, wac_i2c->side_pressed, wac_i2c->pen_prox);

	/* release pen, if it is pressed*/
#if 0 //def WACOM_PDCT_WORK_AROUND
	if (wac_i2c->pen_pdct == PDCT_DETECT_PEN)
#else
	if (wac_i2c->pen_pressed || wac_i2c->side_pressed
		|| wac_i2c->pen_prox)
#endif
		forced_release(wac_i2c);

	wac_i2c->wac_pdata->early_suspend_platform_hw();
	printk(KERN_DEBUG "[E-PEN]:%s.\n", __func__);
}
static irqreturn_t wacom_interrupt_pdct(int irq, void *dev_id)
{
	struct wacom_i2c *wac_i2c = dev_id;

	if (wac_i2c->query_status == false)
		return IRQ_HANDLED;

	wac_i2c->pen_pdct = gpio_get_value(wac_i2c->wac_pdata->gpio_pen_pdct);

	dev_info(&wac_i2c->client->dev, "%s: pdct %d(%d) [%s]\n",
			__func__, wac_i2c->pen_pdct, wac_i2c->pen_prox,
			wac_i2c->pen_pdct ? "Released" : "Pressed");
#if 0
	if (wac_i2c->pen_pdct == PDCT_NOSIGNAL) {
		/* If rdy is 1, pen is still working*/
		if (wac_i2c->pen_prox == 0)
			forced_release(wac_i2c);
	} else if (wac_i2c->pen_prox == 0)
		forced_hover(wac_i2c);
#endif

	return IRQ_HANDLED;
}
Esempio n. 13
0
static void wacom_i2c_disable(struct wacom_i2c *wac_i2c)
{
#ifdef CONFIG_TOUCH_WAKE
	// Don't change state if touchwake listening delay is active
	if (!touchwake_is_active()) {
		#ifdef TOUCHWAKE_DEBUG_PRINT
		pr_info("[TOUCHWAKE] Wacom i2c disable\n");
		#endif
#endif
		if (wac_i2c->power_enable) {
			wacom_enable_irq(wac_i2c, false);

			/* release pen, if it is pressed */
			if (wac_i2c->pen_pressed || wac_i2c->side_pressed
				|| wac_i2c->pen_prox)
				forced_release(wac_i2c);

				wac_i2c->wac_pdata->wacom_stop(wac_i2c);
		}
#ifdef CONFIG_TOUCH_WAKE
	}
#endif
}
Esempio n. 14
0
static void wacom_i2c_early_suspend(struct early_suspend *h)
{
	struct wacom_i2c *wac_i2c =
	    container_of(h, struct wacom_i2c, early_suspend);

	disable_irq(wac_i2c->client->irq);
#ifdef WACOM_PDCT_WORK_AROUND
	disable_irq(wac_i2c->irq_pdct);
#endif

	/* release pen, if it is pressed */
#ifdef WACOM_PDCT_WORK_AROUND
	if (wac_i2c->pen_pdct == PDCT_DETECT_PEN)
#else
	if (wac_i2c->pen_pressed || wac_i2c->side_pressed
		|| wac_i2c->pen_prox)
#endif
		forced_release(wac_i2c);

	if (!wake_lock_active(&wac_i2c->wakelock))
		wac_i2c->wac_pdata->early_suspend_platform_hw();
	printk(KERN_DEBUG "[E-PEN] %s.\n", __func__);
}