Skip to content

Commit a82e537

Browse files
dianderslinusw
authored andcommitted
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 <[email protected]> Reviewed-by: Stephen Boyd <[email protected]> Reviewed-by: Maulik Shah <[email protected]> Tested-by: Maulik Shah <[email protected]> Reviewed-by: Bjorn Andersson <[email protected]> Link: https://lore.kernel.org/r/20210114191601.v7.1.I3ad184e3423d8e479bc3e86f5b393abb1704a1d1@changeid Signed-off-by: Linus Walleij <[email protected]>
1 parent 81bd157 commit a82e537

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

drivers/pinctrl/qcom/pinctrl-msm.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,7 @@ static int msm_pinmux_request_gpio(struct pinctrl_dev *pctldev,
210210
if (!g->nfuncs)
211211
return 0;
212212

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);
215214
}
216215

217216
static const struct pinmux_ops msm_pinmux_ops = {

drivers/pinctrl/qcom/pinctrl-msm.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ struct msm_gpio_wakeirq_map {
118118
* @wakeirq_dual_edge_errata: If true then GPIOs using the wakeirq_map need
119119
* to be aware that their parent can't handle dual
120120
* edge interrupts.
121+
* @gpio_func: Which function number is GPIO (usually 0).
121122
*/
122123
struct msm_pinctrl_soc_data {
123124
const struct pinctrl_pin_desc *pins;
@@ -134,6 +135,7 @@ struct msm_pinctrl_soc_data {
134135
const struct msm_gpio_wakeirq_map *wakeirq_map;
135136
unsigned int nwakeirq_map;
136137
bool wakeirq_dual_edge_errata;
138+
unsigned int gpio_func;
137139
};
138140

139141
extern const struct dev_pm_ops msm_pinctrl_dev_pm_ops;

0 commit comments

Comments
 (0)