|
@@ -29,6 +29,7 @@
|
|
|
#include <linux/slab.h>
|
|
|
|
|
|
#include "../core.h"
|
|
|
+#include "../../gpio/gpiolib.h"
|
|
|
#include "pinctrl-sunxi.h"
|
|
|
|
|
|
static struct irq_chip sunxi_pinctrl_edge_irq_chip;
|
|
@@ -464,10 +465,19 @@ static int sunxi_pinctrl_gpio_direction_input(struct gpio_chip *chip,
|
|
|
static int sunxi_pinctrl_gpio_get(struct gpio_chip *chip, unsigned offset)
|
|
|
{
|
|
|
struct sunxi_pinctrl *pctl = dev_get_drvdata(chip->dev);
|
|
|
-
|
|
|
u32 reg = sunxi_data_reg(offset);
|
|
|
u8 index = sunxi_data_offset(offset);
|
|
|
- u32 val = (readl(pctl->membase + reg) >> index) & DATA_PINS_MASK;
|
|
|
+ u32 set_mux = pctl->desc->irq_read_needs_mux &&
|
|
|
+ test_bit(FLAG_USED_AS_IRQ, &chip->desc[offset].flags);
|
|
|
+ u32 val;
|
|
|
+
|
|
|
+ if (set_mux)
|
|
|
+ sunxi_pmx_set(pctl->pctl_dev, offset, SUN4I_FUNC_INPUT);
|
|
|
+
|
|
|
+ val = (readl(pctl->membase + reg) >> index) & DATA_PINS_MASK;
|
|
|
+
|
|
|
+ if (set_mux)
|
|
|
+ sunxi_pmx_set(pctl->pctl_dev, offset, SUN4I_FUNC_IRQ);
|
|
|
|
|
|
return val;
|
|
|
}
|