Re: [PATCH] gpiolib: Show correct direction from the beginning

2018-09-21 Thread Linus Walleij
On Thu, Sep 20, 2018 at 7:05 PM Timur Tabi wrote: > On 9/20/18 5:36 PM, Linus Walleij wrote: > > What I mean is that $SUBJECT patch might not hurt Qualcomms > > GPIOs (not crash the platform) if and only if it is augmented to not > > try to get the initial direction from lines masked off in .valid

Re: [PATCH] gpiolib: Show correct direction from the beginning

2018-09-20 Thread Timur Tabi
On 9/20/18 5:36 PM, Linus Walleij wrote: What I mean is that $SUBJECT patch might not hurt Qualcomms GPIOs (not crash the platform) if and only if it is augmented to not try to get the initial direction from lines masked off in .valid_mask if .need_valid_mask is true. Whether it makes sense sema

Re: [PATCH] gpiolib: Show correct direction from the beginning

2018-09-20 Thread Linus Walleij
On Thu, Sep 20, 2018 at 7:14 AM Ricardo Ribalda Delgado wrote: > On Thu, Sep 20, 2018 at 2:20 PM Timur Tabi wrote: > > Users are expected to program the direction for every GPIO they want to > > use, regardless of whatever it's set to before they open it. > > I do not agree that the user should

Re: [PATCH] gpiolib: Show correct direction from the beginning

2018-09-20 Thread Linus Walleij
On Thu, Sep 20, 2018 at 5:35 AM Timur Tabi wrote: > On 9/20/18 12:23 AM, Linus Walleij wrote: > > I think most gpiochips easily survives calling the .get_direction() > > early, Qualcomm's stand out here. > > > > Now that we have .valid_mask in the gpiochip could we simply just > > add this back, r

Re: [PATCH] gpiolib: Show correct direction from the beginning

2018-09-20 Thread Ricardo Ribalda Delgado
Hi On Thu, Sep 20, 2018 at 2:20 PM Timur Tabi wrote: > > > > On 09/19/2018 10:27 AM, Ricardo Ribalda Delgado wrote: > > Let me explain my current setup > > > > I have a board with input and output gpios, the direction is defined > > via pdata. When I run gpioinfo all the gpios are shown as input,

Re: [PATCH] gpiolib: Show correct direction from the beginning

2018-09-20 Thread Timur Tabi
On 9/20/18 12:23 AM, Linus Walleij wrote: I think most gpiochips easily survives calling the .get_direction() early, Qualcomm's stand out here. Now that we have .valid_mask in the gpiochip could we simply just add this back, resepecting valid_mask and avoid checking the direction of precisely th

Re: [PATCH] gpiolib: Show correct direction from the beginning

2018-09-20 Thread Timur Tabi
On 9/19/18 10:27 AM, Ricardo Ribalda Delgado wrote: "The get_direction callback normally triggers a read/write to hardware, but we shouldn't be touching the hardware for an individual GPIO until after it's been properly claimed." is an statement specific for your platform That is definitely

Re: [PATCH] gpiolib: Show correct direction from the beginning

2018-09-20 Thread Timur Tabi
On 09/19/2018 10:27 AM, Ricardo Ribalda Delgado wrote: Let me explain my current setup I have a board with input and output gpios, the direction is defined via pdata. When I run gpioinfo all the gpios are shown as input, regardless if they are input or outputs: Eg: root@qt5022:/tmp# ./gpioin

Re: [PATCH] gpiolib: Show correct direction from the beginning

2018-09-19 Thread Linus Walleij
On Wed, Sep 19, 2018 at 4:50 AM Timur Tabi wrote: > On 9/18/18 11:04 PM, Ricardo Ribalda Delgado wrote: > > And should't that be tacked in qcom hardware with something like: > > > > if (!priv->initialized) > > return INPUT; > > > > if you or Timur point me to the harware that was crashing I wo

Re: [PATCH] gpiolib: Show correct direction from the beginning

2018-09-19 Thread Ricardo Ribalda Delgado
Hi Timur On Wed, Sep 19, 2018 at 1:50 PM Timur Tabi wrote: > > On 9/18/18 11:04 PM, Ricardo Ribalda Delgado wrote: > > And should't that be tacked in qcom hardware with something like: > > > > if (!priv->initialized) > > return INPUT; > > > > if you or Timur point me to the harware that was cr

Re: [PATCH] gpiolib: Show correct direction from the beginning

2018-09-19 Thread Timur Tabi
On 9/18/18 11:04 PM, Ricardo Ribalda Delgado wrote: And should't that be tacked in qcom hardware with something like: if (!priv->initialized) return INPUT; if you or Timur point me to the harware that was crashing I would not mind looking into that, but the current situations seems to me li

Re: [PATCH] gpiolib: Show correct direction from the beginning

2018-09-18 Thread Ricardo Ribalda Delgado
Hi Linus On Wed, Sep 19, 2018 at 12:40 AM Linus Walleij wrote: > > On Fri, Sep 14, 2018 at 12:08 AM Ricardo Ribalda Delgado > wrote: > > > Current code assumes that the direction is input if direction_input > > function is set. > > This might not be the case on GPIOs with programmable direction.

Re: [PATCH] gpiolib: Show correct direction from the beginning

2018-09-18 Thread Linus Walleij
On Fri, Sep 14, 2018 at 12:08 AM Ricardo Ribalda Delgado wrote: > Current code assumes that the direction is input if direction_input > function is set. > This might not be the case on GPIOs with programmable direction. > > Signed-off-by: Ricardo Ribalda Delgado > --- > drivers/gpio/gpiolib.c |

[PATCH] gpiolib: Show correct direction from the beginning

2018-09-14 Thread Ricardo Ribalda Delgado
Current code assumes that the direction is input if direction_input function is set. This might not be the case on GPIOs with programmable direction. Signed-off-by: Ricardo Ribalda Delgado --- drivers/gpio/gpiolib.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/driver