kernel: update 3.14 to 3.14.18
[openwrt/openwrt.git] / target / linux / ipq806x / patches / 0037-pinctrl-msm-Make-number-of-functions-variable.patch
1 From 1c11b14dd6d740e997919f0bf789bf921548dc0f Mon Sep 17 00:00:00 2001
2 From: Bjorn Andersson <bjorn.andersson@sonymobile.com>
3 Date: Mon, 31 Mar 2014 14:49:55 -0700
4 Subject: [PATCH 037/182] pinctrl: msm: Make number of functions variable
5
6 The various pins may have different number of functions defined, so make this
7 number definable per pin instead of just increasing it to the largest one for
8 all of the platforms.
9
10 Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
11 Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
12 ---
13 drivers/pinctrl/pinctrl-msm.c | 4 ++--
14 drivers/pinctrl/pinctrl-msm.h | 3 ++-
15 drivers/pinctrl/pinctrl-msm8x74.c | 3 ++-
16 3 files changed, 6 insertions(+), 4 deletions(-)
17
18 --- a/drivers/pinctrl/pinctrl-msm.c
19 +++ b/drivers/pinctrl/pinctrl-msm.c
20 @@ -145,12 +145,12 @@ static int msm_pinmux_enable(struct pinc
21 if (WARN_ON(g->mux_bit < 0))
22 return -EINVAL;
23
24 - for (i = 0; i < ARRAY_SIZE(g->funcs); i++) {
25 + for (i = 0; i < g->nfuncs; i++) {
26 if (g->funcs[i] == function)
27 break;
28 }
29
30 - if (WARN_ON(i == ARRAY_SIZE(g->funcs)))
31 + if (WARN_ON(i == g->nfuncs))
32 return -EINVAL;
33
34 spin_lock_irqsave(&pctrl->lock, flags);
35 --- a/drivers/pinctrl/pinctrl-msm.h
36 +++ b/drivers/pinctrl/pinctrl-msm.h
37 @@ -65,7 +65,8 @@ struct msm_pingroup {
38 const unsigned *pins;
39 unsigned npins;
40
41 - unsigned funcs[8];
42 + unsigned *funcs;
43 + unsigned nfuncs;
44
45 s16 ctl_reg;
46 s16 io_reg;
47 --- a/drivers/pinctrl/pinctrl-msm8x74.c
48 +++ b/drivers/pinctrl/pinctrl-msm8x74.c
49 @@ -341,7 +341,7 @@ static const unsigned int sdc2_data_pins
50 .name = "gpio" #id, \
51 .pins = gpio##id##_pins, \
52 .npins = ARRAY_SIZE(gpio##id##_pins), \
53 - .funcs = { \
54 + .funcs = (int[]){ \
55 MSM_MUX_NA, /* gpio mode */ \
56 MSM_MUX_##f1, \
57 MSM_MUX_##f2, \
58 @@ -351,6 +351,7 @@ static const unsigned int sdc2_data_pins
59 MSM_MUX_##f6, \
60 MSM_MUX_##f7 \
61 }, \
62 + .nfuncs = 8, \
63 .ctl_reg = 0x1000 + 0x10 * id, \
64 .io_reg = 0x1004 + 0x10 * id, \
65 .intr_cfg_reg = 0x1008 + 0x10 * id, \