Commit 347f026e authored by Kai-Heng Feng's avatar Kai-Heng Feng Committed by Greg Kroah-Hartman

pinctrl: intel: Clear interrupt status in mask/unmask callback

[ Upstream commit 670784fb ]

Commit a939bb57 ("pinctrl: intel: implement gpio_irq_enable") was
added because clearing interrupt status bit is required to avoid
unexpected behavior.

Turns out the unmask callback also needs the fix, which can solve weird
IRQ triggering issues on I2C touchpad ELAN1200.
Signed-off-by: default avatarKai-Heng Feng <kai.heng.feng@canonical.com>
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 5c454589
...@@ -913,35 +913,6 @@ static void intel_gpio_irq_ack(struct irq_data *d) ...@@ -913,35 +913,6 @@ static void intel_gpio_irq_ack(struct irq_data *d)
} }
} }
static void intel_gpio_irq_enable(struct irq_data *d)
{
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
struct intel_pinctrl *pctrl = gpiochip_get_data(gc);
const struct intel_community *community;
const struct intel_padgroup *padgrp;
int pin;
pin = intel_gpio_to_pin(pctrl, irqd_to_hwirq(d), &community, &padgrp);
if (pin >= 0) {
unsigned int gpp, gpp_offset, is_offset;
unsigned long flags;
u32 value;
gpp = padgrp->reg_num;
gpp_offset = padgroup_offset(padgrp, pin);
is_offset = community->is_offset + gpp * 4;
raw_spin_lock_irqsave(&pctrl->lock, flags);
/* Clear interrupt status first to avoid unexpected interrupt */
writel(BIT(gpp_offset), community->regs + is_offset);
value = readl(community->regs + community->ie_offset + gpp * 4);
value |= BIT(gpp_offset);
writel(value, community->regs + community->ie_offset + gpp * 4);
raw_spin_unlock_irqrestore(&pctrl->lock, flags);
}
}
static void intel_gpio_irq_mask_unmask(struct irq_data *d, bool mask) static void intel_gpio_irq_mask_unmask(struct irq_data *d, bool mask)
{ {
struct gpio_chip *gc = irq_data_get_irq_chip_data(d); struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
...@@ -954,15 +925,20 @@ static void intel_gpio_irq_mask_unmask(struct irq_data *d, bool mask) ...@@ -954,15 +925,20 @@ static void intel_gpio_irq_mask_unmask(struct irq_data *d, bool mask)
if (pin >= 0) { if (pin >= 0) {
unsigned int gpp, gpp_offset; unsigned int gpp, gpp_offset;
unsigned long flags; unsigned long flags;
void __iomem *reg; void __iomem *reg, *is;
u32 value; u32 value;
gpp = padgrp->reg_num; gpp = padgrp->reg_num;
gpp_offset = padgroup_offset(padgrp, pin); gpp_offset = padgroup_offset(padgrp, pin);
reg = community->regs + community->ie_offset + gpp * 4; reg = community->regs + community->ie_offset + gpp * 4;
is = community->regs + community->is_offset + gpp * 4;
raw_spin_lock_irqsave(&pctrl->lock, flags); raw_spin_lock_irqsave(&pctrl->lock, flags);
/* Clear interrupt status first to avoid unexpected interrupt */
writel(BIT(gpp_offset), is);
value = readl(reg); value = readl(reg);
if (mask) if (mask)
value &= ~BIT(gpp_offset); value &= ~BIT(gpp_offset);
...@@ -1106,7 +1082,6 @@ static irqreturn_t intel_gpio_irq(int irq, void *data) ...@@ -1106,7 +1082,6 @@ static irqreturn_t intel_gpio_irq(int irq, void *data)
static struct irq_chip intel_gpio_irqchip = { static struct irq_chip intel_gpio_irqchip = {
.name = "intel-gpio", .name = "intel-gpio",
.irq_enable = intel_gpio_irq_enable,
.irq_ack = intel_gpio_irq_ack, .irq_ack = intel_gpio_irq_ack,
.irq_mask = intel_gpio_irq_mask, .irq_mask = intel_gpio_irq_mask,
.irq_unmask = intel_gpio_irq_unmask, .irq_unmask = intel_gpio_irq_unmask,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment