]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
pinctrl: msm: Make number of functions variable
authorBjorn Andersson <bjorn.andersson@sonymobile.com>
Mon, 31 Mar 2014 21:49:55 +0000 (14:49 -0700)
committerLinus Walleij <linus.walleij@linaro.org>
Tue, 22 Apr 2014 06:41:34 +0000 (08:41 +0200)
The various pins may have different number of functions defined, so make this
number definable per pin instead of just increasing it to the largest one for
all of the platforms.

Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/pinctrl-msm.c
drivers/pinctrl/pinctrl-msm.h
drivers/pinctrl/pinctrl-msm8x74.c

index e43fbce56598a65bd10dcbcafc56709ea7f746a1..5fa9341cc5892f4bc3a5e154633c5f1849100745 100644 (file)
@@ -145,12 +145,12 @@ static int msm_pinmux_enable(struct pinctrl_dev *pctldev,
        if (WARN_ON(g->mux_bit < 0))
                return -EINVAL;
 
-       for (i = 0; i < ARRAY_SIZE(g->funcs); i++) {
+       for (i = 0; i < g->nfuncs; i++) {
                if (g->funcs[i] == function)
                        break;
        }
 
-       if (WARN_ON(i == ARRAY_SIZE(g->funcs)))
+       if (WARN_ON(i == g->nfuncs))
                return -EINVAL;
 
        spin_lock_irqsave(&pctrl->lock, flags);
index 6e26f1b676d75f9de3d90bcb3c1f48b1bda7d095..7b2a227a590aaf563763cd4beb5d3a06f6fc8a89 100644 (file)
@@ -65,7 +65,8 @@ struct msm_pingroup {
        const unsigned *pins;
        unsigned npins;
 
-       unsigned funcs[8];
+       unsigned *funcs;
+       unsigned nfuncs;
 
        s16 ctl_reg;
        s16 io_reg;
index dde5529807aab71cc78729b8ef0d3e98544385f3..57766d56e257b9a3d598280338afd2a60a3125cb 100644 (file)
@@ -341,7 +341,7 @@ static const unsigned int sdc2_data_pins[] = { 151 };
                .name = "gpio" #id,                     \
                .pins = gpio##id##_pins,                \
                .npins = ARRAY_SIZE(gpio##id##_pins),   \
-               .funcs = {                              \
+               .funcs = (int[]){                       \
                        MSM_MUX_NA, /* gpio mode */     \
                        MSM_MUX_##f1,                   \
                        MSM_MUX_##f2,                   \
@@ -351,6 +351,7 @@ static const unsigned int sdc2_data_pins[] = { 151 };
                        MSM_MUX_##f6,                   \
                        MSM_MUX_##f7                    \
                },                                      \
+               .nfuncs = 8,                            \
                .ctl_reg = 0x1000 + 0x10 * id,          \
                .io_reg = 0x1004 + 0x10 * id,           \
                .intr_cfg_reg = 0x1008 + 0x10 * id,     \