kernel: update 3.14 to 3.14.18
[openwrt.git] / target / linux / sunxi / patches-3.14 / 137-1-pinctrl-create-irq-pin-mapping.patch
1 From 4c228d02d1339a286e259893062ea445be82b573 Mon Sep 17 00:00:00 2001
2 From: Chen-Yu Tsai <wens@csie.org>
3 Date: Tue, 7 Jan 2014 18:56:29 +0800
4 Subject: [PATCH] pinctrl: sunxi: create irq/pin mapping during init
5
6 The irq/pin mapping is used to lookup the pin to mux to the irq
7 function when the irq is enabled. It is created when gpio_to_irq
8 is called. Creating the mapping during init allows us to map the
9 interrupts directly from the device tree.
10
11 Signed-off-by: Chen-Yu Tsai <wens@csie.org>
12 ---
13  drivers/pinctrl/pinctrl-sunxi.c | 5 +++--
14  1 file changed, 3 insertions(+), 2 deletions(-)
15
16 --- a/drivers/pinctrl/pinctrl-sunxi.c
17 +++ b/drivers/pinctrl/pinctrl-sunxi.c
18 @@ -531,8 +531,6 @@ static int sunxi_pinctrl_gpio_to_irq(str
19         if (!desc)
20                 return -EINVAL;
21  
22 -       pctl->irq_array[desc->irqnum] = offset;
23 -
24         dev_dbg(chip->dev, "%s: request IRQ for GPIO %d, return %d\n",
25                 chip->label, offset + chip->base, desc->irqnum);
26  
27 @@ -759,6 +757,9 @@ static int sunxi_pinctrl_build_state(str
28                 struct sunxi_desc_function *func = pin->functions;
29  
30                 while (func->name) {
31 +                       /* Create interrupt mapping while we're at it */
32 +                       if (!strcmp(func->name, "irq"))
33 +                               pctl->irq_array[func->irqnum] = pin->pin.number;
34                         sunxi_pinctrl_add_function(pctl, func->name);
35                         func++;
36                 }