linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] Use new GPIO direction defines for intel pinctrl
@ 2019-12-12  6:33 Matti Vaittinen
  2019-12-12  6:34 ` [PATCH v2 1/3] pinctrl: pinctrl-intel: Use GPIO direction definitions Matti Vaittinen
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Matti Vaittinen @ 2019-12-12  6:33 UTC (permalink / raw)
  To: matti.vaittinen, mazziesaccount
  Cc: Mika Westerberg, Andy Shevchenko, Linus Walleij, linux-gpio,
	linux-kernel

We added definitions for GPIO line directions here:
https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git/commit/?id=9208b1e77d6e8e9776f34f46ef4079ecac9c3c25

Let's use them on Intel pincontrollers too.

Changes for v2:
  - Replaced ternary operator with if() for better readability

---

Matti Vaittinen (3):
  pinctrl: pinctrl-intel: Use GPIO direction definitions
  pinctrl: pinctrl-cherryview: Use GPIO direction definitions
  pinctrl: pinctrl-baytrail: Use GPIO direction definitions

 drivers/pinctrl/intel/pinctrl-baytrail.c   | 4 ++--
 drivers/pinctrl/intel/pinctrl-cherryview.c | 5 ++++-
 drivers/pinctrl/intel/pinctrl-intel.c      | 5 ++++-
 3 files changed, 10 insertions(+), 4 deletions(-)


base-commit: e42617b825f8 ("Linux 5.5-rc1")
-- 
2.21.0


-- 
Matti Vaittinen, Linux device drivers
ROHM Semiconductors, Finland SWDC
Kiviharjunlenkki 1E
90220 OULU
FINLAND

~~~ "I don't think so," said Rene Descartes. Just then he vanished ~~~
Simon says - in Latin please.
~~~ "non cogito me" dixit Rene Descarte, deinde evanescavit ~~~
Thanks to Simon Glass for the translation =] 

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

* [PATCH v2 1/3] pinctrl: pinctrl-intel: Use GPIO direction definitions
  2019-12-12  6:33 [PATCH v2 0/3] Use new GPIO direction defines for intel pinctrl Matti Vaittinen
@ 2019-12-12  6:34 ` Matti Vaittinen
  2019-12-12  6:35 ` [PATCH v2 2/3] pinctrl: pinctrl-cherryview: " Matti Vaittinen
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Matti Vaittinen @ 2019-12-12  6:34 UTC (permalink / raw)
  To: matti.vaittinen, mazziesaccount
  Cc: Mika Westerberg, Andy Shevchenko, Linus Walleij, linux-gpio,
	linux-kernel

Use new GPIO_LINE_DIRECTION_IN and GPIO_LINE_DIRECTION_OUT when
returning GPIO direction to GPIO framework.

Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
---
 drivers/pinctrl/intel/pinctrl-intel.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c
index 4860bc9a4e48..2ba2ad8a55d9 100644
--- a/drivers/pinctrl/intel/pinctrl-intel.c
+++ b/drivers/pinctrl/intel/pinctrl-intel.c
@@ -944,7 +944,10 @@ static int intel_gpio_get_direction(struct gpio_chip *chip, unsigned int offset)
 	if (padcfg0 & PADCFG0_PMODE_MASK)
 		return -EINVAL;
 
-	return !!(padcfg0 & PADCFG0_GPIOTXDIS);
+	if (padcfg0 & PADCFG0_GPIOTXDIS)
+		return GPIO_LINE_DIRECTION_IN;
+
+	return GPIO_LINE_DIRECTION_OUT;
 }
 
 static int intel_gpio_direction_input(struct gpio_chip *chip, unsigned int offset)
-- 
2.21.0


-- 
Matti Vaittinen, Linux device drivers
ROHM Semiconductors, Finland SWDC
Kiviharjunlenkki 1E
90220 OULU
FINLAND

~~~ "I don't think so," said Rene Descartes. Just then he vanished ~~~
Simon says - in Latin please.
~~~ "non cogito me" dixit Rene Descarte, deinde evanescavit ~~~
Thanks to Simon Glass for the translation =] 

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

* [PATCH v2 2/3] pinctrl: pinctrl-cherryview: Use GPIO direction definitions
  2019-12-12  6:33 [PATCH v2 0/3] Use new GPIO direction defines for intel pinctrl Matti Vaittinen
  2019-12-12  6:34 ` [PATCH v2 1/3] pinctrl: pinctrl-intel: Use GPIO direction definitions Matti Vaittinen
@ 2019-12-12  6:35 ` Matti Vaittinen
  2019-12-12  6:35 ` [PATCH v2 3/3] pinctrl: pinctrl-baytrail: " Matti Vaittinen
  2019-12-12 11:21 ` [PATCH v2 0/3] Use new GPIO direction defines for intel pinctrl Mika Westerberg
  3 siblings, 0 replies; 7+ messages in thread
From: Matti Vaittinen @ 2019-12-12  6:35 UTC (permalink / raw)
  To: matti.vaittinen, mazziesaccount
  Cc: Mika Westerberg, Andy Shevchenko, Linus Walleij, linux-gpio,
	linux-kernel

Use new GPIO_LINE_DIRECTION_IN and GPIO_LINE_DIRECTION_OUT when
returning GPIO direction to GPIO framework.

Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
---
 drivers/pinctrl/intel/pinctrl-cherryview.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/intel/pinctrl-cherryview.c b/drivers/pinctrl/intel/pinctrl-cherryview.c
index 582fa8a75559..7f049c17fce3 100644
--- a/drivers/pinctrl/intel/pinctrl-cherryview.c
+++ b/drivers/pinctrl/intel/pinctrl-cherryview.c
@@ -1287,7 +1287,10 @@ static int chv_gpio_get_direction(struct gpio_chip *chip, unsigned int offset)
 	direction = ctrl0 & CHV_PADCTRL0_GPIOCFG_MASK;
 	direction >>= CHV_PADCTRL0_GPIOCFG_SHIFT;
 
-	return direction != CHV_PADCTRL0_GPIOCFG_GPO;
+	if (direction == CHV_PADCTRL0_GPIOCFG_GPO)
+		return GPIO_LINE_DIRECTION_OUT;
+
+	return GPIO_LINE_DIRECTION_IN;
 }
 
 static int chv_gpio_direction_input(struct gpio_chip *chip, unsigned int offset)
-- 
2.21.0


-- 
Matti Vaittinen, Linux device drivers
ROHM Semiconductors, Finland SWDC
Kiviharjunlenkki 1E
90220 OULU
FINLAND

~~~ "I don't think so," said Rene Descartes. Just then he vanished ~~~
Simon says - in Latin please.
~~~ "non cogito me" dixit Rene Descarte, deinde evanescavit ~~~
Thanks to Simon Glass for the translation =] 

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

* [PATCH v2 3/3] pinctrl: pinctrl-baytrail: Use GPIO direction definitions
  2019-12-12  6:33 [PATCH v2 0/3] Use new GPIO direction defines for intel pinctrl Matti Vaittinen
  2019-12-12  6:34 ` [PATCH v2 1/3] pinctrl: pinctrl-intel: Use GPIO direction definitions Matti Vaittinen
  2019-12-12  6:35 ` [PATCH v2 2/3] pinctrl: pinctrl-cherryview: " Matti Vaittinen
@ 2019-12-12  6:35 ` Matti Vaittinen
  2019-12-12  6:37   ` Vaittinen, Matti
  2019-12-12 11:21 ` [PATCH v2 0/3] Use new GPIO direction defines for intel pinctrl Mika Westerberg
  3 siblings, 1 reply; 7+ messages in thread
From: Matti Vaittinen @ 2019-12-12  6:35 UTC (permalink / raw)
  To: matti.vaittinen, mazziesaccount
  Cc: Mika Westerberg, Andy Shevchenko, Linus Walleij, linux-gpio,
	linux-kernel

Use new GPIO_LINE_DIRECTION_IN and GPIO_LINE_DIRECTION_OUT when
returning GPIO direction to GPIO framework.

Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Acked-by: Andy Shevchenko <andriy.shevchenko@intel.com>
---
 drivers/pinctrl/intel/pinctrl-baytrail.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c
index 9ffb22211d2b..362276ad5640 100644
--- a/drivers/pinctrl/intel/pinctrl-baytrail.c
+++ b/drivers/pinctrl/intel/pinctrl-baytrail.c
@@ -1160,9 +1160,9 @@ static int byt_gpio_get_direction(struct gpio_chip *chip, unsigned int offset)
 	raw_spin_unlock_irqrestore(&vg->lock, flags);
 
 	if (!(value & BYT_OUTPUT_EN))
-		return 0;
+		return GPIO_LINE_DIRECTION_OUT;
 	if (!(value & BYT_INPUT_EN))
-		return 1;
+		return GPIO_LINE_DIRECTION_IN;
 
 	return -EINVAL;
 }
-- 
2.21.0


-- 
Matti Vaittinen, Linux device drivers
ROHM Semiconductors, Finland SWDC
Kiviharjunlenkki 1E
90220 OULU
FINLAND

~~~ "I don't think so," said Rene Descartes. Just then he vanished ~~~
Simon says - in Latin please.
~~~ "non cogito me" dixit Rene Descarte, deinde evanescavit ~~~
Thanks to Simon Glass for the translation =] 

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

* Re: [PATCH v2 3/3] pinctrl: pinctrl-baytrail: Use GPIO direction definitions
  2019-12-12  6:35 ` [PATCH v2 3/3] pinctrl: pinctrl-baytrail: " Matti Vaittinen
@ 2019-12-12  6:37   ` Vaittinen, Matti
  0 siblings, 0 replies; 7+ messages in thread
From: Vaittinen, Matti @ 2019-12-12  6:37 UTC (permalink / raw)
  To: mazziesaccount
  Cc: mika.westerberg, linux-gpio, andy, linux-kernel, linus.walleij

Hello Andy,

On Thu, 2019-12-12 at 08:35 +0200, Matti Vaittinen wrote:
> Use new GPIO_LINE_DIRECTION_IN and GPIO_LINE_DIRECTION_OUT when
> returning GPIO direction to GPIO framework.
> 
> Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
> Acked-by: Andy Shevchenko <andriy.shevchenko@intel.com>

I translated your LGTM as an ack. Please let me know if this is not Ok.

Br,
	Matti

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

* Re: [PATCH v2 0/3] Use new GPIO direction defines for intel pinctrl
  2019-12-12  6:33 [PATCH v2 0/3] Use new GPIO direction defines for intel pinctrl Matti Vaittinen
                   ` (2 preceding siblings ...)
  2019-12-12  6:35 ` [PATCH v2 3/3] pinctrl: pinctrl-baytrail: " Matti Vaittinen
@ 2019-12-12 11:21 ` Mika Westerberg
  2019-12-12 13:29   ` Andy Shevchenko
  3 siblings, 1 reply; 7+ messages in thread
From: Mika Westerberg @ 2019-12-12 11:21 UTC (permalink / raw)
  To: Matti Vaittinen
  Cc: mazziesaccount, Andy Shevchenko, Linus Walleij, linux-gpio, linux-kernel

On Thu, Dec 12, 2019 at 08:33:54AM +0200, Matti Vaittinen wrote:
> We added definitions for GPIO line directions here:
> https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git/commit/?id=9208b1e77d6e8e9776f34f46ef4079ecac9c3c25
> 
> Let's use them on Intel pincontrollers too.
> 
> Changes for v2:
>   - Replaced ternary operator with if() for better readability
> 
> ---
> 
> Matti Vaittinen (3):
>   pinctrl: pinctrl-intel: Use GPIO direction definitions
>   pinctrl: pinctrl-cherryview: Use GPIO direction definitions
>   pinctrl: pinctrl-baytrail: Use GPIO direction definitions

Andy, please pick these up with my,

Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>

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

* Re: [PATCH v2 0/3] Use new GPIO direction defines for intel pinctrl
  2019-12-12 11:21 ` [PATCH v2 0/3] Use new GPIO direction defines for intel pinctrl Mika Westerberg
@ 2019-12-12 13:29   ` Andy Shevchenko
  0 siblings, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2019-12-12 13:29 UTC (permalink / raw)
  To: Mika Westerberg
  Cc: Matti Vaittinen, mazziesaccount, Andy Shevchenko, Linus Walleij,
	linux-gpio, linux-kernel

On Thu, Dec 12, 2019 at 01:21:35PM +0200, Mika Westerberg wrote:
> On Thu, Dec 12, 2019 at 08:33:54AM +0200, Matti Vaittinen wrote:
> > We added definitions for GPIO line directions here:
> > https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git/commit/?id=9208b1e77d6e8e9776f34f46ef4079ecac9c3c25
> > 
> > Let's use them on Intel pincontrollers too.
> > 
> > Changes for v2:
> >   - Replaced ternary operator with if() for better readability
> > 
> > ---
> > 
> > Matti Vaittinen (3):
> >   pinctrl: pinctrl-intel: Use GPIO direction definitions
> >   pinctrl: pinctrl-cherryview: Use GPIO direction definitions
> >   pinctrl: pinctrl-baytrail: Use GPIO direction definitions
> 
> Andy, please pick these up with my,
> 
> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>

Pushed to my review and testing queue, thanks!

-- 
With Best Regards,
Andy Shevchenko



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

end of thread, other threads:[~2019-12-12 13:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-12  6:33 [PATCH v2 0/3] Use new GPIO direction defines for intel pinctrl Matti Vaittinen
2019-12-12  6:34 ` [PATCH v2 1/3] pinctrl: pinctrl-intel: Use GPIO direction definitions Matti Vaittinen
2019-12-12  6:35 ` [PATCH v2 2/3] pinctrl: pinctrl-cherryview: " Matti Vaittinen
2019-12-12  6:35 ` [PATCH v2 3/3] pinctrl: pinctrl-baytrail: " Matti Vaittinen
2019-12-12  6:37   ` Vaittinen, Matti
2019-12-12 11:21 ` [PATCH v2 0/3] Use new GPIO direction defines for intel pinctrl Mika Westerberg
2019-12-12 13:29   ` Andy Shevchenko

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