Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

pinctrl: qcom: Allow SoCs to specify a GPIO function that's not 0

There's currently a comment in the code saying function 0 is GPIO.
Instead of hardcoding it, let's add a member where an SoC can specify
it. No known SoCs use a number other than 0, but this just makes the
code clearer. NOTE: no SoC code needs to be updated since we can rely
on zero-initialization.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Reviewed-by: Maulik Shah <mkshah@codeaurora.org>
Tested-by: Maulik Shah <mkshah@codeaurora.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20210114191601.v7.1.I3ad184e3423d8e479bc3e86f5b393abb1704a1d1@changeid
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Douglas Anderson and committed by
Linus Walleij
a82e5378 81bd1579

+3 -2
+1 -2
drivers/pinctrl/qcom/pinctrl-msm.c
··· 210 210 if (!g->nfuncs) 211 211 return 0; 212 212 213 - /* For now assume function 0 is GPIO because it always is */ 214 - return msm_pinmux_set_mux(pctldev, g->funcs[0], offset); 213 + return msm_pinmux_set_mux(pctldev, g->funcs[pctrl->soc->gpio_func], offset); 215 214 } 216 215 217 216 static const struct pinmux_ops msm_pinmux_ops = {
+2
drivers/pinctrl/qcom/pinctrl-msm.h
··· 118 118 * @wakeirq_dual_edge_errata: If true then GPIOs using the wakeirq_map need 119 119 * to be aware that their parent can't handle dual 120 120 * edge interrupts. 121 + * @gpio_func: Which function number is GPIO (usually 0). 121 122 */ 122 123 struct msm_pinctrl_soc_data { 123 124 const struct pinctrl_pin_desc *pins; ··· 135 134 const struct msm_gpio_wakeirq_map *wakeirq_map; 136 135 unsigned int nwakeirq_map; 137 136 bool wakeirq_dual_edge_errata; 137 + unsigned int gpio_func; 138 138 }; 139 139 140 140 extern const struct dev_pm_ops msm_pinctrl_dev_pm_ops;