"Flags mismatch irq" register interrupt handler error
Posted 自強不息 厚德載物
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了"Flags mismatch irq" register interrupt handler error相关的知识,希望对你有一定的参考价值。
Question :
When you see the log "Flags mismatch irq ............", maybe you use the same irq number to register different interrupt handler .
irq number ---> handler_1
|
|--> handler_2
|
|--> handler_3
|
|--> handler_4
log
01-01 00:00:17.887 I/SMBCHG ( 0): ovp_handler_init: chip->cd_ac_acok_n_gpio_irq = 101
01-01 00:00:17.893 E/genirq ( 0): Flags mismatch irq 101. 00002003 (cd_ac_acok_n) vs. 00002003 (cd_acok_n_irq_1)
01-01 00:00:17.902 I/SMBCHG ( 0): ovp_handler_init: request irq cd_ac_acok_nerror.
void xxx_init(void)
{
...
...
chip->cd_ac_acok_n_gpio_irq = gpio_to_irq(chip->cd_ac_acok_n_gpio_number);
pr_err("chip->cd_ac_acok_n_gpio_irq = %d\n", chip->cd_ac_acok_n_gpio_irq);
rc = request_irq(chip->cd_ac_acok_n_gpio_irq,
cd_ac_acok_n_gpio_isr,
IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
"cd_acok_n_irq_1",
chip);
...
...
}
void yyy_init(void)
{
...
...
rc = request_irq(chip->cd_ac_acok_n_gpio_irq
handler_name,
IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
"cd_ac_acok_n",
chip);
...
...
}
...
...
/*
* Can‘t share interrupts unless both agree to and are
* the same type (level, edge, polarity). So both flag
* fields must have IRQF_SHARED set and the bits which
* set the trigger type must match. Also all must
* agree on ONESHOT.
*/
if (!((old->flags & new->flags) & IRQF_SHARED) ||
((old->flags ^ new->flags) & IRQF_TRIGGER_MASK) ||
((old->flags ^ new->flags) & IRQF_ONESHOT))
goto mismatch;
...
...
mismatch:
if (!(new->flags & IRQF_PROBE_SHARED)) {
pr_err("Flags mismatch irq %d. %08x (%s) vs. %08x (%s)\n",
irq, new->flags, new->name, old->flags, old->name);
#ifdef CONFIG_DEBUG_SHIRQ
dump_stack();
#endif
}
...
...
android/kernel/msm-3.18/kernel/irq/manage.c
Solve :
If you want to use the same irq number to register different interrupt handler, please use IRQ_SHARED flags.
void xxx_init(void)
{
...
...
chip->cd_ac_acok_n_gpio_irq = gpio_to_irq(chip->cd_ac_acok_n_gpio_number);
pr_err("chip->cd_ac_acok_n_gpio_irq = %d\n", chip->cd_ac_acok_n_gpio_irq);
rc = request_irq(chip->cd_ac_acok_n_gpio_irq, cd_ac_acok_n_gpio_isr,
IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_ONESHOT | IRQF_SHARED ,
"cd_acok_n_irq_1",
chip);
...
...
}
void yyy_init(void)
{
...
...
rc = request_irq(chip->cd_ac_acok_n_gpio_irq
handler_name,
IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_ONESHOT | IRQF_SHARED,
"cd_ac_acok_n",
chip);
...
...
}
以上是关于"Flags mismatch irq" register interrupt handler error的主要内容,如果未能解决你的问题,请参考以下文章