示例#1
0
static irqreturn_t detect_irq_handler(int irq, void *dev_id)
{
	int value1, value2;
	int retry_limit = 10;

	hs_notify_hpin_irq();

	AJ_DBG("");

	do {
		value1 = gpio_get_value(pjack_info->audio_jack_detect);
		set_irq_type(pjack_info->irq_jack, value1 ?
				IRQF_TRIGGER_LOW : IRQF_TRIGGER_HIGH);
		value2 = gpio_get_value(pjack_info->audio_jack_detect);
	} while (value1 != value2 && retry_limit-- > 0);

	AJ_DBG("value2 = %d (%d retries)", value2, (10-retry_limit));

	if ((pjack_info->audio_jack_flag == 0) ^ value2) {
		wake_lock_timeout(&pjack_info->audiojack_wake_lock, 4*HZ);

		/* Do the rest of the work in timer context */
		hrtimer_start(&pjack_info->detection_timer,
		pjack_info->debounce_time, HRTIMER_MODE_REL);
	}

	return IRQ_HANDLED;
}
static irqreturn_t detect_irq_handler(int irq, void *dev_id)
{
	int gpio1 = 0;
	int gpio2 = 0;
	int retry_limit = 10;
	unsigned int irq_type = IRQF_TRIGGER_NONE;

	hs_notify_hpin_irq();

	HS_DBG();

	do {
		gpio1 = gpio_get_value(hi->pdata.hpin_gpio);
		irq_type = gpio1 ? IRQF_TRIGGER_LOW : IRQF_TRIGGER_HIGH;
		irq_set_irq_type(hi->hpin_irq, irq_type);
		gpio2 = gpio_get_value(hi->pdata.hpin_gpio);
	} while (gpio1 != gpio2 && retry_limit-- > 0);

	HS_DBG("gpio2 = %d (%d retries)", gpio2, (10-retry_limit));

	if ((hi->headset_state == 0) ^ gpio2) {
		wake_lock_timeout(&hi->hs_wake_lock, HS_WAKE_LOCK_TIMEOUT);
		queue_delayed_work(detect_wq, &detect_gpio_work,
				   hi->hpin_debounce);
	}

	return IRQ_HANDLED;
}
static irqreturn_t detect_irq_handler(int irq, void *data)
{
	unsigned int irq_mask = IRQF_TRIGGER_HIGH | IRQF_TRIGGER_LOW;

	hs_notify_hpin_irq();

	HS_DBG();

	hi->hpin_irq_type ^= irq_mask;
	set_irq_type(hi->pdata.hpin_irq, hi->hpin_irq_type);

	wake_lock_timeout(&hi->hs_wake_lock, HS_WAKE_LOCK_TIMEOUT);
	queue_delayed_work(detect_wq, &detect_35mm_work, hi->hpin_debounce);

	return IRQ_HANDLED;
}
static irqreturn_t detect_irq_handler(int irq, void *data)
{
	unsigned int irq_mask = IRQF_TRIGGER_HIGH | IRQF_TRIGGER_LOW;

	hs_notify_hpin_irq();

	HS_DBG();

	if (!(hi->pdata.driver_flag & DRIVER_HS_PMIC_EDGE_IRQ)) {
		hi->hpin_irq_type ^= irq_mask;
		set_irq_type(hi->pdata.hpin_irq, hi->hpin_irq_type);
	}

	wake_lock_timeout(&hi->hs_wake_lock, HS_WAKE_LOCK_TIMEOUT);
	queue_delayed_work(detect_wq, &detect_pmic_work, hi->hpin_debounce);

	return IRQ_HANDLED;
}