Skip to content

Commit a59c99d

Browse files
smaeullinusw
authored andcommitted
pinctrl: sunxi: Forward calls to irq_set_irq_wake
The pinctrl irqchip may be connected to an irqchip that implements the .irq_set_wake callback, such as the R_INTC on A31 and newer sunxi SoCs. In order for GPIOs to be able to trigger wakeup, the IRQ from the pinctrl to the upper irqchip must also be enabled for wakeup. Since the kernel's IRQ core already manages the "wake_depth" of each IRQ, no additional accounting is needed in the pinctrl driver. Signed-off-by: Samuel Holland <samuel@sholland.org> Link: https://lore.kernel.org/r/20200117213340.47714-1-samuel@sholland.org Acked-by: Maxime Ripard <mripard@kernel.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
1 parent 86ecb7d commit a59c99d

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

drivers/pinctrl/sunxi/pinctrl-sunxi.c

+12-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <linux/io.h>
1414
#include <linux/clk.h>
1515
#include <linux/gpio/driver.h>
16+
#include <linux/interrupt.h>
1617
#include <linux/irqdomain.h>
1718
#include <linux/irqchip/chained_irq.h>
1819
#include <linux/export.h>
@@ -1058,6 +1059,14 @@ static void sunxi_pinctrl_irq_ack_unmask(struct irq_data *d)
10581059
sunxi_pinctrl_irq_unmask(d);
10591060
}
10601061

1062+
static int sunxi_pinctrl_irq_set_wake(struct irq_data *d, unsigned int on)
1063+
{
1064+
struct sunxi_pinctrl *pctl = irq_data_get_irq_chip_data(d);
1065+
u8 bank = d->hwirq / IRQ_PER_BANK;
1066+
1067+
return irq_set_irq_wake(pctl->irq[bank], on);
1068+
}
1069+
10611070
static struct irq_chip sunxi_pinctrl_edge_irq_chip = {
10621071
.name = "sunxi_pio_edge",
10631072
.irq_ack = sunxi_pinctrl_irq_ack,
@@ -1066,7 +1075,7 @@ static struct irq_chip sunxi_pinctrl_edge_irq_chip = {
10661075
.irq_request_resources = sunxi_pinctrl_irq_request_resources,
10671076
.irq_release_resources = sunxi_pinctrl_irq_release_resources,
10681077
.irq_set_type = sunxi_pinctrl_irq_set_type,
1069-
.flags = IRQCHIP_SKIP_SET_WAKE,
1078+
.irq_set_wake = sunxi_pinctrl_irq_set_wake,
10701079
};
10711080

10721081
static struct irq_chip sunxi_pinctrl_level_irq_chip = {
@@ -1081,7 +1090,8 @@ static struct irq_chip sunxi_pinctrl_level_irq_chip = {
10811090
.irq_request_resources = sunxi_pinctrl_irq_request_resources,
10821091
.irq_release_resources = sunxi_pinctrl_irq_release_resources,
10831092
.irq_set_type = sunxi_pinctrl_irq_set_type,
1084-
.flags = IRQCHIP_SKIP_SET_WAKE | IRQCHIP_EOI_THREADED |
1093+
.irq_set_wake = sunxi_pinctrl_irq_set_wake,
1094+
.flags = IRQCHIP_EOI_THREADED |
10851095
IRQCHIP_EOI_IF_HANDLED,
10861096
};
10871097

0 commit comments

Comments
 (0)