pinctrl: intel: Read back TX buffer state
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Thu, 24 Aug 2017 08:19:33 +0000 (11:19 +0300)
committerLinus Walleij <linus.walleij@linaro.org>
Thu, 31 Aug 2017 13:34:31 +0000 (15:34 +0200)
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>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Tested-by: "Bourque, Francis" <francis.bourque@intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/intel/pinctrl-intel.c

index ac806891ff817d6e25f0753335cc9ea9e2c6891b..71df0f70b61f01c51484c87f35bdba9a1158cdbc 100644 (file)
@@ -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)