All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 1/2] pinctrl: intel: Read back TX buffer state
@ 2017-08-24  8:19 Andy Shevchenko
  2017-08-24  8:19 ` [RFC, PATCH v1 2/2] pinctrl: intel: Decrease indentation in intel_gpio_set() Andy Shevchenko
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Andy Shevchenko @ 2017-08-24  8:19 UTC (permalink / raw)
  To: Linus Walleij, linux-gpio, Mika Westerberg, Heikki Krogerus
  Cc: Andy Shevchenko, Bourque, Francis

In the same way as it's done in pinctrl-cherryview.c we would provide
a readback TX buffer state.

Fixes: 17fab473693 ("pinctrl: intel: Set pin direction properly")
Reported-by: "Bourque, Francis" <francis.bourque@intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/pinctrl/intel/pinctrl-intel.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c
index 6dc1096d3d34..c8675611b768 100644
--- a/drivers/pinctrl/intel/pinctrl-intel.c
+++ b/drivers/pinctrl/intel/pinctrl-intel.c
@@ -751,12 +751,17 @@ static int intel_gpio_get(struct gpio_chip *chip, unsigned offset)
 {
 	struct intel_pinctrl *pctrl = gpiochip_get_data(chip);
 	void __iomem *reg;
+	u32 padcfg0;
 
 	reg = intel_get_padcfg(pctrl, offset, PADCFG0);
 	if (!reg)
 		return -EINVAL;
 
-	return !!(readl(reg) & PADCFG0_GPIORXSTATE);
+	padcfg0 = readl(reg);
+	if (!(padcfg0 & PADCFG0_GPIOTXDIS))
+		return !!(padcfg0 & PADCFG0_GPIOTXSTATE);
+
+	return !!(padcfg0 & PADCFG0_GPIORXSTATE);
 }
 
 static void intel_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
-- 
2.14.1


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

* [RFC, PATCH v1 2/2] pinctrl: intel: Decrease indentation in intel_gpio_set()
  2017-08-24  8:19 [PATCH v1 1/2] pinctrl: intel: Read back TX buffer state Andy Shevchenko
@ 2017-08-24  8:19 ` Andy Shevchenko
  2017-08-24  9:30   ` Mika Westerberg
  2017-08-31 12:47   ` Linus Walleij
  2017-08-24  9:29 ` [PATCH v1 1/2] pinctrl: intel: Read back TX buffer state Mika Westerberg
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 7+ messages in thread
From: Andy Shevchenko @ 2017-08-24  8:19 UTC (permalink / raw)
  To: Linus Walleij, linux-gpio, Mika Westerberg, Heikki Krogerus
  Cc: Andy Shevchenko

Decrease indentation in intel_gpio_set() to make it looking slightly better
and be in align with intel_gpio_get().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/pinctrl/intel/pinctrl-intel.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c
index c8675611b768..19e2bd16a301 100644
--- a/drivers/pinctrl/intel/pinctrl-intel.c
+++ b/drivers/pinctrl/intel/pinctrl-intel.c
@@ -767,22 +767,22 @@ static int intel_gpio_get(struct gpio_chip *chip, unsigned offset)
 static void intel_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
 {
 	struct intel_pinctrl *pctrl = gpiochip_get_data(chip);
+	unsigned long flags;
 	void __iomem *reg;
+	u32 padcfg0;
 
 	reg = intel_get_padcfg(pctrl, offset, PADCFG0);
-	if (reg) {
-		unsigned long flags;
-		u32 padcfg0;
+	if (!reg)
+		return;
 
-		raw_spin_lock_irqsave(&pctrl->lock, flags);
-		padcfg0 = readl(reg);
-		if (value)
-			padcfg0 |= PADCFG0_GPIOTXSTATE;
-		else
-			padcfg0 &= ~PADCFG0_GPIOTXSTATE;
-		writel(padcfg0, reg);
-		raw_spin_unlock_irqrestore(&pctrl->lock, flags);
-	}
+	raw_spin_lock_irqsave(&pctrl->lock, flags);
+	padcfg0 = readl(reg);
+	if (value)
+		padcfg0 |= PADCFG0_GPIOTXSTATE;
+	else
+		padcfg0 &= ~PADCFG0_GPIOTXSTATE;
+	writel(padcfg0, reg);
+	raw_spin_unlock_irqrestore(&pctrl->lock, flags);
 }
 
 static int intel_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
-- 
2.14.1


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

* Re: [PATCH v1 1/2] pinctrl: intel: Read back TX buffer state
  2017-08-24  8:19 [PATCH v1 1/2] pinctrl: intel: Read back TX buffer state Andy Shevchenko
  2017-08-24  8:19 ` [RFC, PATCH v1 2/2] pinctrl: intel: Decrease indentation in intel_gpio_set() Andy Shevchenko
@ 2017-08-24  9:29 ` Mika Westerberg
  2017-08-25 16:59 ` Bourque, Francis
  2017-08-31 13:28 ` Linus Walleij
  3 siblings, 0 replies; 7+ messages in thread
From: Mika Westerberg @ 2017-08-24  9:29 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Linus Walleij, linux-gpio, Heikki Krogerus, Bourque, Francis

On Thu, Aug 24, 2017 at 11:19:33AM +0300, Andy Shevchenko wrote:
> In the same way as it's done in pinctrl-cherryview.c we would provide
> a readback TX buffer state.
> 
> Fixes: 17fab473693 ("pinctrl: intel: Set pin direction properly")
> Reported-by: "Bourque, Francis" <francis.bourque@intel.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Thanks Andy for taking care of this!

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

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

* Re: [RFC, PATCH v1 2/2] pinctrl: intel: Decrease indentation in intel_gpio_set()
  2017-08-24  8:19 ` [RFC, PATCH v1 2/2] pinctrl: intel: Decrease indentation in intel_gpio_set() Andy Shevchenko
@ 2017-08-24  9:30   ` Mika Westerberg
  2017-08-31 12:47   ` Linus Walleij
  1 sibling, 0 replies; 7+ messages in thread
From: Mika Westerberg @ 2017-08-24  9:30 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: Linus Walleij, linux-gpio, Heikki Krogerus

On Thu, Aug 24, 2017 at 11:19:34AM +0300, Andy Shevchenko wrote:
> Decrease indentation in intel_gpio_set() to make it looking slightly better
> and be in align with intel_gpio_get().
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

No objections from me. Looks better this way :)

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

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

* RE: [PATCH v1 1/2] pinctrl: intel: Read back TX buffer state
  2017-08-24  8:19 [PATCH v1 1/2] pinctrl: intel: Read back TX buffer state Andy Shevchenko
  2017-08-24  8:19 ` [RFC, PATCH v1 2/2] pinctrl: intel: Decrease indentation in intel_gpio_set() Andy Shevchenko
  2017-08-24  9:29 ` [PATCH v1 1/2] pinctrl: intel: Read back TX buffer state Mika Westerberg
@ 2017-08-25 16:59 ` Bourque, Francis
  2017-08-31 13:28 ` Linus Walleij
  3 siblings, 0 replies; 7+ messages in thread
From: Bourque, Francis @ 2017-08-25 16:59 UTC (permalink / raw)
  To: Andy Shevchenko, Linus Walleij, linux-gpio, Mika Westerberg,
	Heikki Krogerus

Tested-by: "Bourque, Francis" <francis.bourque@intel.com>

We tested on KBL-Y based design with a 4.12.3 kernel + patch

Francis Bourque
Platform Architect at Intel
Phone (503) 712-4558


-----Original Message-----
From: Andy Shevchenko [mailto:andriy.shevchenko@linux.intel.com] 
Sent: Thursday, August 24, 2017 1:20 AM
To: Linus Walleij <linus.walleij@linaro.org>; linux-gpio@vger.kernel.org; Mika Westerberg <mika.westerberg@linux.intel.com>; Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>; Bourque, Francis <francis.bourque@intel.com>
Subject: [PATCH v1 1/2] pinctrl: intel: Read back TX buffer state

In the same way as it's done in pinctrl-cherryview.c we would provide a readback TX buffer state.

Fixes: 17fab473693 ("pinctrl: intel: Set pin direction properly")
Reported-by: "Bourque, Francis" <francis.bourque@intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/pinctrl/intel/pinctrl-intel.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c
index 6dc1096d3d34..c8675611b768 100644
--- a/drivers/pinctrl/intel/pinctrl-intel.c
+++ b/drivers/pinctrl/intel/pinctrl-intel.c
@@ -751,12 +751,17 @@ static int intel_gpio_get(struct gpio_chip *chip, unsigned offset)  {
 	struct intel_pinctrl *pctrl = gpiochip_get_data(chip);
 	void __iomem *reg;
+	u32 padcfg0;
 
 	reg = intel_get_padcfg(pctrl, offset, PADCFG0);
 	if (!reg)
 		return -EINVAL;
 
-	return !!(readl(reg) & PADCFG0_GPIORXSTATE);
+	padcfg0 = readl(reg);
+	if (!(padcfg0 & PADCFG0_GPIOTXDIS))
+		return !!(padcfg0 & PADCFG0_GPIOTXSTATE);
+
+	return !!(padcfg0 & PADCFG0_GPIORXSTATE);
 }
 
 static void intel_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
--
2.14.1


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

* Re: [RFC, PATCH v1 2/2] pinctrl: intel: Decrease indentation in intel_gpio_set()
  2017-08-24  8:19 ` [RFC, PATCH v1 2/2] pinctrl: intel: Decrease indentation in intel_gpio_set() Andy Shevchenko
  2017-08-24  9:30   ` Mika Westerberg
@ 2017-08-31 12:47   ` Linus Walleij
  1 sibling, 0 replies; 7+ messages in thread
From: Linus Walleij @ 2017-08-31 12:47 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-gpio, Mika Westerberg, Heikki Krogerus

On Thu, Aug 24, 2017 at 10:19 AM, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:

> Decrease indentation in intel_gpio_set() to make it looking slightly better
> and be in align with intel_gpio_get().
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Patch applied with Mika's ACK.

Yours,
Linus Walleij

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

* Re: [PATCH v1 1/2] pinctrl: intel: Read back TX buffer state
  2017-08-24  8:19 [PATCH v1 1/2] pinctrl: intel: Read back TX buffer state Andy Shevchenko
                   ` (2 preceding siblings ...)
  2017-08-25 16:59 ` Bourque, Francis
@ 2017-08-31 13:28 ` Linus Walleij
  3 siblings, 0 replies; 7+ messages in thread
From: Linus Walleij @ 2017-08-31 13:28 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: linux-gpio, Mika Westerberg, Heikki Krogerus, Bourque, Francis

On Thu, Aug 24, 2017 at 10:19 AM, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:

> In the same way as it's done in pinctrl-cherryview.c we would provide
> a readback TX buffer state.
>
> Fixes: 17fab473693 ("pinctrl: intel: Set pin direction properly")
> Reported-by: "Bourque, Francis" <francis.bourque@intel.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Patch applied with the ACKs.

Yours,
Linus Walleij

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

end of thread, other threads:[~2017-08-31 13:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-24  8:19 [PATCH v1 1/2] pinctrl: intel: Read back TX buffer state Andy Shevchenko
2017-08-24  8:19 ` [RFC, PATCH v1 2/2] pinctrl: intel: Decrease indentation in intel_gpio_set() Andy Shevchenko
2017-08-24  9:30   ` Mika Westerberg
2017-08-31 12:47   ` Linus Walleij
2017-08-24  9:29 ` [PATCH v1 1/2] pinctrl: intel: Read back TX buffer state Mika Westerberg
2017-08-25 16:59 ` Bourque, Francis
2017-08-31 13:28 ` Linus Walleij

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.