[RFC,1/4] pinctrl: define PIN_CONFIG_INPUT

Message ID 20231002021602.260100-2-takahiro.akashi@linaro.org
State New
Headers
Series gpio: add SCMI pinctrl based driver |

Commit Message

Takahiro Akashi Oct. 2, 2023, 2:15 a.m. UTC
  This allows for enabling SCMI pinctrl based GPIO driver to obtain
an input gpio pin.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
---
 include/linux/pinctrl/pinconf-generic.h | 3 +++
 1 file changed, 3 insertions(+)
  

Comments

Linus Walleij Oct. 3, 2023, 8:49 p.m. UTC | #1
Hi Takahiro,

On Mon, Oct 2, 2023 at 4:17 AM AKASHI Takahiro
<takahiro.akashi@linaro.org> wrote:

> This allows for enabling SCMI pinctrl based GPIO driver to obtain
> an input gpio pin.
>
> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
(...)
> + * @PIN_CONFIG_INPUT: This will obtain a value on an input pin. The returned
> + *     argument indicates the value.

We need to specify that this is the inverse of @PIN_CONFIG_OUTPUT,
that setting a line into *input mode* requires the use of
@PIN_CONFIG_INPUT_ENABLE, so the config can never be set
but should return an error on set, and that the argument returned is 1 for
logic high and 0 for logic low.

Otherwise I think this is fine!

Yours,
Linus Walleij
  
Takahiro Akashi Oct. 4, 2023, 6:54 a.m. UTC | #2
On Tue, Oct 03, 2023 at 10:49:10PM +0200, Linus Walleij wrote:
> Hi Takahiro,
> 
> On Mon, Oct 2, 2023 at 4:17???AM AKASHI Takahiro
> <takahiro.akashi@linaro.org> wrote:
> 
> > This allows for enabling SCMI pinctrl based GPIO driver to obtain
> > an input gpio pin.
> >
> > Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> (...)
> > + * @PIN_CONFIG_INPUT: This will obtain a value on an input pin. The returned
> > + *     argument indicates the value.
> 
> We need to specify that this is the inverse of @PIN_CONFIG_OUTPUT,
> that setting a line into *input mode* requires the use of
> @PIN_CONFIG_INPUT_ENABLE, so the config can never be set
> but should return an error on set, and that the argument returned is 1 for
> logic high and 0 for logic low.

I will add more as you suggest.

-Takahiro Akashi


> Otherwise I think this is fine!
> 
> Yours,
> Linus Walleij
  

Patch

diff --git a/include/linux/pinctrl/pinconf-generic.h b/include/linux/pinctrl/pinconf-generic.h
index d74b7a4ea154..842b328ea504 100644
--- a/include/linux/pinctrl/pinconf-generic.h
+++ b/include/linux/pinctrl/pinconf-generic.h
@@ -67,6 +67,8 @@  struct pinctrl_map;
  *	passed as argument. The argument is in mA.
  * @PIN_CONFIG_DRIVE_STRENGTH_UA: the pin will sink or source at most the current
  *	passed as argument. The argument is in uA.
+ * @PIN_CONFIG_INPUT: This will obtain a value on an input pin. The returned
+ *	argument indicates the value.
  * @PIN_CONFIG_INPUT_DEBOUNCE: this will configure the pin to debounce mode,
  *	which means it will wait for signals to settle when reading inputs. The
  *	argument gives the debounce time in usecs. Setting the
@@ -128,6 +130,7 @@  enum pin_config_param {
 	PIN_CONFIG_DRIVE_PUSH_PULL,
 	PIN_CONFIG_DRIVE_STRENGTH,
 	PIN_CONFIG_DRIVE_STRENGTH_UA,
+	PIN_CONFIG_INPUT,
 	PIN_CONFIG_INPUT_DEBOUNCE,
 	PIN_CONFIG_INPUT_ENABLE,
 	PIN_CONFIG_INPUT_SCHMITT,