linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pinctrl: msm: Actually use function 0 for gpio selection
@ 2018-10-01 21:49 Stephen Boyd
  2018-10-02  3:50 ` Bjorn Andersson
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Stephen Boyd @ 2018-10-01 21:49 UTC (permalink / raw)
  To: Linus Walleij
  Cc: linux-kernel, linux-arm-msm, linux-gpio, Doug Anderson,
	Bjorn Andersson, Niklas Cassel

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 <dianders@chromium.org>
Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: Niklas Cassel <niklas.cassel@linaro.org>
Reported-by: Niklas Cassel <niklas.cassel@linaro.org>
Fixes: 1de7ddb3a15c ("pinctrl: msm: Mux out gpio function with gpio_request()")
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---
 drivers/pinctrl/qcom/pinctrl-msm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pinctrl/qcom/pinctrl-msm.c b/drivers/pinctrl/qcom/pinctrl-msm.c
index 1684b2da09d5..b925b8feac95 100644
--- a/drivers/pinctrl/qcom/pinctrl-msm.c
+++ b/drivers/pinctrl/qcom/pinctrl-msm.c
@@ -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 = {
-- 
Sent by a computer through tubes


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] pinctrl: msm: Actually use function 0 for gpio selection
  2018-10-01 21:49 [PATCH] pinctrl: msm: Actually use function 0 for gpio selection Stephen Boyd
@ 2018-10-02  3:50 ` Bjorn Andersson
  2018-10-02  8:47 ` Niklas Cassel
  2018-10-02  8:49 ` Linus Walleij
  2 siblings, 0 replies; 4+ messages in thread
From: Bjorn Andersson @ 2018-10-02  3:50 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Linus Walleij, linux-kernel, linux-arm-msm, linux-gpio,
	Doug Anderson, Niklas Cassel

On Mon 01 Oct 14:49 PDT 2018, Stephen Boyd wrote:

> 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 <dianders@chromium.org>
> Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
> Cc: Niklas Cassel <niklas.cassel@linaro.org>
> Reported-by: Niklas Cassel <niklas.cassel@linaro.org>
> Fixes: 1de7ddb3a15c ("pinctrl: msm: Mux out gpio function with gpio_request()")
> Signed-off-by: Stephen Boyd <swboyd@chromium.org>

Oops...

Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>

Regards,
Bjorn

> ---
>  drivers/pinctrl/qcom/pinctrl-msm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pinctrl/qcom/pinctrl-msm.c b/drivers/pinctrl/qcom/pinctrl-msm.c
> index 1684b2da09d5..b925b8feac95 100644
> --- a/drivers/pinctrl/qcom/pinctrl-msm.c
> +++ b/drivers/pinctrl/qcom/pinctrl-msm.c
> @@ -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 = {
> -- 
> Sent by a computer through tubes
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] pinctrl: msm: Actually use function 0 for gpio selection
  2018-10-01 21:49 [PATCH] pinctrl: msm: Actually use function 0 for gpio selection Stephen Boyd
  2018-10-02  3:50 ` Bjorn Andersson
@ 2018-10-02  8:47 ` Niklas Cassel
  2018-10-02  8:49 ` Linus Walleij
  2 siblings, 0 replies; 4+ messages in thread
From: Niklas Cassel @ 2018-10-02  8:47 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Linus Walleij, linux-kernel, linux-arm-msm, linux-gpio,
	Doug Anderson, Bjorn Andersson

On Mon, Oct 01, 2018 at 02:49:05PM -0700, Stephen Boyd wrote:
> 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 <dianders@chromium.org>
> Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
> Cc: Niklas Cassel <niklas.cassel@linaro.org>
> Reported-by: Niklas Cassel <niklas.cassel@linaro.org>
> Fixes: 1de7ddb3a15c ("pinctrl: msm: Mux out gpio function with gpio_request()")
> Signed-off-by: Stephen Boyd <swboyd@chromium.org>

Tested-by: Niklas Cassel <niklas.cassel@linaro.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] pinctrl: msm: Actually use function 0 for gpio selection
  2018-10-01 21:49 [PATCH] pinctrl: msm: Actually use function 0 for gpio selection Stephen Boyd
  2018-10-02  3:50 ` Bjorn Andersson
  2018-10-02  8:47 ` Niklas Cassel
@ 2018-10-02  8:49 ` Linus Walleij
  2 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2018-10-02  8:49 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: linux-kernel, linux-arm-msm, open list:GPIO SUBSYSTEM,
	Doug Anderson, Bjorn Andersson, Niklas Cassel

On Mon, Oct 1, 2018 at 11:49 PM Stephen Boyd <swboyd@chromium.org> wrote:

> 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 <dianders@chromium.org>
> Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
> Cc: Niklas Cassel <niklas.cassel@linaro.org>
> Reported-by: Niklas Cassel <niklas.cassel@linaro.org>
> Fixes: 1de7ddb3a15c ("pinctrl: msm: Mux out gpio function with gpio_request()")
> Signed-off-by: Stephen Boyd <swboyd@chromium.org>

Patch applied with all the tags.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-10-02  8:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-01 21:49 [PATCH] pinctrl: msm: Actually use function 0 for gpio selection Stephen Boyd
2018-10-02  3:50 ` Bjorn Andersson
2018-10-02  8:47 ` Niklas Cassel
2018-10-02  8:49 ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).