linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pinctrl: msm: Use dynamic GPIO numbering
@ 2018-01-29  0:59 Bjorn Andersson
  2018-02-07 13:52 ` Linus Walleij
  2020-10-23 14:21 ` Arun KS
  0 siblings, 2 replies; 7+ messages in thread
From: Bjorn Andersson @ 2018-01-29  0:59 UTC (permalink / raw)
  To: Bjorn Andersson, Linus Walleij
  Cc: linux-arm-msm, linux-gpio, linux-kernel, Timur Tabi

The base of the TLMM gpiochip should not be statically defined as 0, fix
this to not artificially restrict the existence of multiple pinctrl-msm
devices.

Fixes: f365be092572 ("pinctrl: Add Qualcomm TLMM driver")
Reported-by: Timur Tabi <timur@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.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 495432f3341b..95e5c5ea40af 100644
--- a/drivers/pinctrl/qcom/pinctrl-msm.c
+++ b/drivers/pinctrl/qcom/pinctrl-msm.c
@@ -818,7 +818,7 @@ static int msm_gpio_init(struct msm_pinctrl *pctrl)
 		return -EINVAL;
 
 	chip = &pctrl->chip;
-	chip->base = 0;
+	chip->base = -1;
 	chip->ngpio = ngpio;
 	chip->label = dev_name(pctrl->dev);
 	chip->parent = pctrl->dev;
-- 
2.15.0

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

* Re: [PATCH] pinctrl: msm: Use dynamic GPIO numbering
  2018-01-29  0:59 [PATCH] pinctrl: msm: Use dynamic GPIO numbering Bjorn Andersson
@ 2018-02-07 13:52 ` Linus Walleij
  2018-02-07 14:52   ` Timur Tabi
  2018-02-20 16:42   ` Timur Tabi
  2020-10-23 14:21 ` Arun KS
  1 sibling, 2 replies; 7+ messages in thread
From: Linus Walleij @ 2018-02-07 13:52 UTC (permalink / raw)
  To: Bjorn Andersson; +Cc: linux-arm-msm, linux-gpio, linux-kernel, Timur Tabi

On Mon, Jan 29, 2018 at 1:59 AM, Bjorn Andersson
<bjorn.andersson@linaro.org> wrote:

> The base of the TLMM gpiochip should not be statically defined as 0, fix
> this to not artificially restrict the existence of multiple pinctrl-msm
> devices.
>
> Fixes: f365be092572 ("pinctrl: Add Qualcomm TLMM driver")
> Reported-by: Timur Tabi <timur@codeaurora.org>
> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>

OK I put this in devel for v4.17, let's see if something explodes
in linux-next else we can go with this.

Otherwise we need something that conserves base 0 for singular
TLMM drivers and make it -1 for newer platforms with several
instances.

Yours,
Linus Walleij

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

* Re: [PATCH] pinctrl: msm: Use dynamic GPIO numbering
  2018-02-07 13:52 ` Linus Walleij
@ 2018-02-07 14:52   ` Timur Tabi
  2018-02-20 16:42   ` Timur Tabi
  1 sibling, 0 replies; 7+ messages in thread
From: Timur Tabi @ 2018-02-07 14:52 UTC (permalink / raw)
  To: Linus Walleij, Bjorn Andersson; +Cc: linux-arm-msm, linux-gpio, linux-kernel

On 2/7/18 7:52 AM, Linus Walleij wrote:
> Otherwise we need something that conserves base 0 for singular
> TLMM drivers and make it -1 for newer platforms with several
> instances.

     static int base = 0;

     chip->base = base;
     base = -1;

-- 
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm
Technologies, Inc.  Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.

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

* Re: [PATCH] pinctrl: msm: Use dynamic GPIO numbering
  2018-02-07 13:52 ` Linus Walleij
  2018-02-07 14:52   ` Timur Tabi
@ 2018-02-20 16:42   ` Timur Tabi
  1 sibling, 0 replies; 7+ messages in thread
From: Timur Tabi @ 2018-02-20 16:42 UTC (permalink / raw)
  To: Linus Walleij, Bjorn Andersson; +Cc: linux-arm-msm, linux-gpio, linux-kernel

On 02/07/2018 07:52 AM, Linus Walleij wrote:
> OK I put this in devel for v4.17, let's see if something explodes
> in linux-next else we can go with this.
> 
> Otherwise we need something that conserves base 0 for singular
> TLMM drivers and make it -1 for newer platforms with several
> instances.

I don't see this patch in linusw/linux-gpio.git anywhere.  Do you want 
me to submit another patch that implements this:

     static int base = 0;

     chip->base = base;
     base = -1;

This preserves existing behavior for current drivers.

-- 
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm
Technologies, Inc.  Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.

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

* Re: [PATCH] pinctrl: msm: Use dynamic GPIO numbering
  2018-01-29  0:59 [PATCH] pinctrl: msm: Use dynamic GPIO numbering Bjorn Andersson
  2018-02-07 13:52 ` Linus Walleij
@ 2020-10-23 14:21 ` Arun KS
  2020-11-05 10:16   ` Linus Walleij
  1 sibling, 1 reply; 7+ messages in thread
From: Arun KS @ 2020-10-23 14:21 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Linus Walleij, linux-arm-msm, linux-gpio, linux-kernel,
	Timur Tabi, Arun KS

On Mon, Jan 29, 2018 at 8:30 AM Bjorn Andersson
<bjorn.andersson@linaro.org> wrote:
>
> The base of the TLMM gpiochip should not be statically defined as 0, fix
> this to not artificially restrict the existence of multiple pinctrl-msm
> devices.

Can someone please provide the details why this is needed for
pinctrl-msm.  Is there any msm-chipset using multiple tlmm devices?  I
m only concerned because, after this change, the use of gpio number
from user space has become a little difficult. Can we merge the patch
from Timur to maintain the past behavior when multiple tlmm devices
are not present, which is most likely the case?

     static int base = 0;

     chip->base = base;
     base = -1;

Regards,
Arun

>
> Fixes: f365be092572 ("pinctrl: Add Qualcomm TLMM driver")
> Reported-by: Timur Tabi <timur@codeaurora.org>
> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.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 495432f3341b..95e5c5ea40af 100644
> --- a/drivers/pinctrl/qcom/pinctrl-msm.c
> +++ b/drivers/pinctrl/qcom/pinctrl-msm.c
> @@ -818,7 +818,7 @@ static int msm_gpio_init(struct msm_pinctrl *pctrl)
>                 return -EINVAL;
>
>         chip = &pctrl->chip;
> -       chip->base = 0;
> +       chip->base = -1;
>         chip->ngpio = ngpio;
>         chip->label = dev_name(pctrl->dev);
>         chip->parent = pctrl->dev;
> --
> 2.15.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] pinctrl: msm: Use dynamic GPIO numbering
  2020-10-23 14:21 ` Arun KS
@ 2020-11-05 10:16   ` Linus Walleij
  2020-11-08 15:11     ` Arun KS
  0 siblings, 1 reply; 7+ messages in thread
From: Linus Walleij @ 2020-11-05 10:16 UTC (permalink / raw)
  To: Arun KS
  Cc: Bjorn Andersson, MSM, open list:GPIO SUBSYSTEM, linux-kernel,
	Timur Tabi, Arun KS

On Fri, Oct 23, 2020 at 4:21 PM Arun KS <arunks.linux@gmail.com> wrote:

> Im only concerned because, after this change, the use of gpio number
> from user space has become a little difficult.

This makes me a bit puzzled so I need to push back a bit
here.

What is this userspace and what interface is it using?

We recommend using the GPIO character device with
libgpiod for userspace applications:
https://www.kernel.org/doc/html/latest/driver-api/gpio/using-gpio.html

Is there any problem with this?

sysfs is deprecated for years now:
https://www.kernel.org/doc/html/latest/admin-guide/gpio/sysfs.html

Yours,
Linus Walleij

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

* Re: [PATCH] pinctrl: msm: Use dynamic GPIO numbering
  2020-11-05 10:16   ` Linus Walleij
@ 2020-11-08 15:11     ` Arun KS
  0 siblings, 0 replies; 7+ messages in thread
From: Arun KS @ 2020-11-08 15:11 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Bjorn Andersson, MSM, open list:GPIO SUBSYSTEM, linux-kernel,
	Timur Tabi, Arun KS

On Thu, Nov 5, 2020 at 3:46 PM Linus Walleij <linus.walleij@linaro.org> wrote:
>
> On Fri, Oct 23, 2020 at 4:21 PM Arun KS <arunks.linux@gmail.com> wrote:
>
> > Im only concerned because, after this change, the use of gpio number
> > from user space has become a little difficult.
>
> This makes me a bit puzzled so I need to push back a bit
> here.
>
> What is this userspace and what interface is it using?
>
> We recommend using the GPIO character device with
> libgpiod for userspace applications:
> https://www.kernel.org/doc/html/latest/driver-api/gpio/using-gpio.html

Thanks Linus. Makes sense. Basically using the gpiochipset and offset
to it will solve my problem. Earlier, while using the sysfs interface,
it used to be one to one mapping with real gpio numbers.

Regards,
Arun
>
> Is there any problem with this?
>
> sysfs is deprecated for years now:
> https://www.kernel.org/doc/html/latest/admin-guide/gpio/sysfs.html
>
> Yours,
> Linus Walleij

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

end of thread, other threads:[~2020-11-08 15:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-29  0:59 [PATCH] pinctrl: msm: Use dynamic GPIO numbering Bjorn Andersson
2018-02-07 13:52 ` Linus Walleij
2018-02-07 14:52   ` Timur Tabi
2018-02-20 16:42   ` Timur Tabi
2020-10-23 14:21 ` Arun KS
2020-11-05 10:16   ` Linus Walleij
2020-11-08 15:11     ` Arun KS

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).