diff mbox

[v1,1/2] pinctrl: intel: Read back TX buffer state

Message ID 20170824081934.85859-1-andriy.shevchenko@linux.intel.com
State New
Headers show

Commit Message

Andy Shevchenko Aug. 24, 2017, 8:19 a.m. UTC
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(-)

Comments

Mika Westerberg Aug. 24, 2017, 9:29 a.m. UTC | #1
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>
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Linus Walleij Aug. 31, 2017, 1:28 p.m. UTC | #2
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
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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)