Skip to contentSkip to conversation

pinctrl: msm: Actually use function 0 for gpio selection

PATCH In review Stephen Boyd 4 participants 4 messages Oct 1, 2018 – Oct 2, 2018

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pinctrl: msm: Actually use function 0 for gpio selection

This code needs to select function #0, which is the first int in the array of functions, not the number 0 which may or may not be the function for "GPIO mode" per the enum mapping. We were getting lucky on SDM845, where this was tested, because the function 0 matched the enum value for "GPIO mode". On other platforms, e.g. MSM8996, the gpio enum value is the last one in the list so this code doesn't work and we see a warning at boot. Fix it by grabbing the first element out of the array of functions.

Cc Doug Anderson <[email protected]>
Cc Bjorn Andersson <[email protected]>
Cc Niklas Cassel <[email protected]>
Fixes 1de7ddb3a15c ("pinctrl: msm: Mux out gpio function with gpio_request()")
---
 drivers/pinctrl/qcom/pinctrl-msm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/qcom/pinctrl-msm.c +1 -1
index 1684b2da09d5..b925b8feac95 100644
@@ -188,7 +188,7 @@ static int msm_pinmux_request_gpio(struct pinctrl_dev *pctldev,
 		return 0;
 
 	/* For now assume function 0 is GPIO because it always is */
-	return msm_pinmux_set_mux(pctldev, 0, offset);
+	return msm_pinmux_set_mux(pctldev, g->funcs[0], offset);
 }
 
 static const struct pinmux_ops msm_pinmux_ops = {
Signature · 1 line
Sent by a computer through tubes
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Stephen Boyd

This code needs to select function #0, which is the first int in the array of functions, not the number 0 which may or may not be the function for "GPIO mode" per the enum mapping. We were getting lucky on SDM845, where this was tested, because the function 0 matched the enum value for "GPIO mode". On other platforms, e.g. MSM8996, the gpio enum value is the last one in the list so this code doesn't work and we see a warning at boot. Fix it by grabbing the first element out of the array of functions.

Quoted 6 lines
Cc Doug Anderson <[email protected]>
Cc Bjorn Andersson <[email protected]>
Cc Niklas Cassel <[email protected]>
Fixes 1de7ddb3a15c ("pinctrl: msm: Mux out gpio function with gpio_request()")

Oops...

Regards,
Bjorn

Quoted 20 lines
---
 drivers/pinctrl/qcom/pinctrl-msm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/qcom/pinctrl-msm.c +1 -1
index 1684b2da09d5..b925b8feac95 100644
@@ -188,7 +188,7 @@ static int msm_pinmux_request_gpio(struct pinctrl_dev *pctldev,
 		return 0;
 
 	/* For now assume function 0 is GPIO because it always is */
-	return msm_pinmux_set_mux(pctldev, 0, offset);
+	return msm_pinmux_set_mux(pctldev, g->funcs[0], offset);
 }
 
 static const struct pinmux_ops msm_pinmux_ops = {
Signature · 1 line
Sent by a computer through tubes
Tested-by on v1 1/1
#2 lore raw
In reply to Stephen Boyd
Quoted 9 lines · Stephen Boyd

This code needs to select function #0, which is the first int in the array of functions, not the number 0 which may or may not be the function for "GPIO mode" per the enum mapping. We were getting lucky on SDM845, where this was tested, because the function 0 matched the enum value for "GPIO mode". On other platforms, e.g. MSM8996, the gpio enum value is the last one in the list so this code doesn't work and we see a warning at boot. Fix it by grabbing the first element out of the array of functions.

Quoted 6 lines
Cc Doug Anderson <[email protected]>
Cc Bjorn Andersson <[email protected]>
Cc Niklas Cassel <[email protected]>
Fixes 1de7ddb3a15c ("pinctrl: msm: Mux out gpio function with gpio_request()")
#3 lore raw
In reply to Stephen Boyd
Quoted 9 lines · Stephen Boyd

This code needs to select function #0, which is the first int in the array of functions, not the number 0 which may or may not be the function for "GPIO mode" per the enum mapping. We were getting lucky on SDM845, where this was tested, because the function 0 matched the enum value for "GPIO mode". On other platforms, e.g. MSM8996, the gpio enum value is the last one in the list so this code doesn't work and we see a warning at boot. Fix it by grabbing the first element out of the array of functions.

Quoted 6 lines
Cc Doug Anderson <[email protected]>
Cc Bjorn Andersson <[email protected]>
Cc Niklas Cassel <[email protected]>
Fixes 1de7ddb3a15c ("pinctrl: msm: Mux out gpio function with gpio_request()")

Patch applied with all the tags.

Yours,
Linus Walleij