Commit 3c25381f authored by Bjorn Andersson's avatar Bjorn Andersson Committed by Linus Walleij

pinctrl: msm: Make number of functions variable

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: default avatarBjorn Andersson <bjorn.andersson@sonymobile.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 130cbe30
...@@ -145,12 +145,12 @@ static int msm_pinmux_enable(struct pinctrl_dev *pctldev, ...@@ -145,12 +145,12 @@ static int msm_pinmux_enable(struct pinctrl_dev *pctldev,
if (WARN_ON(g->mux_bit < 0)) if (WARN_ON(g->mux_bit < 0))
return -EINVAL; return -EINVAL;
for (i = 0; i < ARRAY_SIZE(g->funcs); i++) { for (i = 0; i < g->nfuncs; i++) {
if (g->funcs[i] == function) if (g->funcs[i] == function)
break; break;
} }
if (WARN_ON(i == ARRAY_SIZE(g->funcs))) if (WARN_ON(i == g->nfuncs))
return -EINVAL; return -EINVAL;
spin_lock_irqsave(&pctrl->lock, flags); spin_lock_irqsave(&pctrl->lock, flags);
......
...@@ -65,7 +65,8 @@ struct msm_pingroup { ...@@ -65,7 +65,8 @@ struct msm_pingroup {
const unsigned *pins; const unsigned *pins;
unsigned npins; unsigned npins;
unsigned funcs[8]; unsigned *funcs;
unsigned nfuncs;
s16 ctl_reg; s16 ctl_reg;
s16 io_reg; s16 io_reg;
......
...@@ -341,7 +341,7 @@ static const unsigned int sdc2_data_pins[] = { 151 }; ...@@ -341,7 +341,7 @@ static const unsigned int sdc2_data_pins[] = { 151 };
.name = "gpio" #id, \ .name = "gpio" #id, \
.pins = gpio##id##_pins, \ .pins = gpio##id##_pins, \
.npins = ARRAY_SIZE(gpio##id##_pins), \ .npins = ARRAY_SIZE(gpio##id##_pins), \
.funcs = { \ .funcs = (int[]){ \
MSM_MUX_NA, /* gpio mode */ \ MSM_MUX_NA, /* gpio mode */ \
MSM_MUX_##f1, \ MSM_MUX_##f1, \
MSM_MUX_##f2, \ MSM_MUX_##f2, \
...@@ -351,6 +351,7 @@ static const unsigned int sdc2_data_pins[] = { 151 }; ...@@ -351,6 +351,7 @@ static const unsigned int sdc2_data_pins[] = { 151 };
MSM_MUX_##f6, \ MSM_MUX_##f6, \
MSM_MUX_##f7 \ MSM_MUX_##f7 \
}, \ }, \
.nfuncs = 8, \
.ctl_reg = 0x1000 + 0x10 * id, \ .ctl_reg = 0x1000 + 0x10 * id, \
.io_reg = 0x1004 + 0x10 * id, \ .io_reg = 0x1004 + 0x10 * id, \
.intr_cfg_reg = 0x1008 + 0x10 * id, \ .intr_cfg_reg = 0x1008 + 0x10 * id, \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment