summaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl/sunxi
diff options
context:
space:
mode:
authorChen-Yu Tsai <wens@csie.org>2014-06-30 18:04:59 +0200
committerLinus Walleij <linus.walleij@linaro.org>2014-07-11 14:08:25 +0200
commit0d3bafac658de2f8e267df805a61e597449699b5 (patch)
tree2316c9bbd5d6bd41fae57aa3960c2ce0fe576e76 /drivers/pinctrl/sunxi
parentpinctrl: sunxi: Define enable / disable irq callbacks (diff)
downloadlinux-0d3bafac658de2f8e267df805a61e597449699b5.tar.xz
linux-0d3bafac658de2f8e267df805a61e597449699b5.zip
pinctrl: sunxi: Fix multi bank interrupt support in gpio_to_irq
When mapping the interrupts, the gpio_to_irq function did not consider the bank number of the gpio pin in question, only the offset or the interrupt number in the bank. As a result, requests for interrupts in the later banks get mapped to the first bank. This issue was discovered while enabling mmc on the new sun8i platform. The tablet I have uses a pin/interrupt from the second bank to do mmc card detection. Tested on this very device with register inspection and actual mmc card insertion/removal. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/sunxi')
-rw-r--r--drivers/pinctrl/sunxi/pinctrl-sunxi.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
index c641566c6efd..47f5e1bc50d0 100644
--- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c
+++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
@@ -520,6 +520,7 @@ static int sunxi_pinctrl_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
{
struct sunxi_pinctrl *pctl = dev_get_drvdata(chip->dev);
struct sunxi_desc_function *desc;
+ unsigned irqnum;
if (offset >= chip->ngpio)
return -ENXIO;
@@ -528,10 +529,12 @@ static int sunxi_pinctrl_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
if (!desc)
return -EINVAL;
+ irqnum = desc->irqbank * IRQ_PER_BANK + desc->irqnum;
+
dev_dbg(chip->dev, "%s: request IRQ for GPIO %d, return %d\n",
- chip->label, offset + chip->base, desc->irqnum);
+ chip->label, offset + chip->base, irqnum);
- return irq_find_mapping(pctl->domain, desc->irqnum);
+ return irq_find_mapping(pctl->domain, irqnum);
}
static int sunxi_pinctrl_irq_request_resources(struct irq_data *d)