diff options
| -rw-r--r-- | drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c | 1 | ||||
| -rw-r--r-- | drivers/pinctrl/sunxi/pinctrl-sunxi.c | 14 | ||||
| -rw-r--r-- | drivers/pinctrl/sunxi/pinctrl-sunxi.h | 4 |
3 files changed, 17 insertions, 2 deletions
diff --git a/drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c b/drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c index 24c5d88f943f..3c68a8e5e0dd 100644 --- a/drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c +++ b/drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c | |||
| @@ -1011,6 +1011,7 @@ static const struct sunxi_pinctrl_desc sun4i_a10_pinctrl_data = { | |||
| 1011 | .pins = sun4i_a10_pins, | 1011 | .pins = sun4i_a10_pins, |
| 1012 | .npins = ARRAY_SIZE(sun4i_a10_pins), | 1012 | .npins = ARRAY_SIZE(sun4i_a10_pins), |
| 1013 | .irq_banks = 1, | 1013 | .irq_banks = 1, |
| 1014 | .irq_read_needs_mux = true, | ||
| 1014 | }; | 1015 | }; |
| 1015 | 1016 | ||
| 1016 | static int sun4i_a10_pinctrl_probe(struct platform_device *pdev) | 1017 | static int sun4i_a10_pinctrl_probe(struct platform_device *pdev) |
diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/pinctrl-sunxi.c index 3d0744337736..f8e171b76693 100644 --- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c +++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c | |||
| @@ -29,6 +29,7 @@ | |||
| 29 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
| 30 | 30 | ||
| 31 | #include "../core.h" | 31 | #include "../core.h" |
| 32 | #include "../../gpio/gpiolib.h" | ||
| 32 | #include "pinctrl-sunxi.h" | 33 | #include "pinctrl-sunxi.h" |
| 33 | 34 | ||
| 34 | static struct irq_chip sunxi_pinctrl_edge_irq_chip; | 35 | static struct irq_chip sunxi_pinctrl_edge_irq_chip; |
| @@ -464,10 +465,19 @@ static int sunxi_pinctrl_gpio_direction_input(struct gpio_chip *chip, | |||
| 464 | static int sunxi_pinctrl_gpio_get(struct gpio_chip *chip, unsigned offset) | 465 | static int sunxi_pinctrl_gpio_get(struct gpio_chip *chip, unsigned offset) |
| 465 | { | 466 | { |
| 466 | struct sunxi_pinctrl *pctl = dev_get_drvdata(chip->dev); | 467 | struct sunxi_pinctrl *pctl = dev_get_drvdata(chip->dev); |
| 467 | |||
| 468 | u32 reg = sunxi_data_reg(offset); | 468 | u32 reg = sunxi_data_reg(offset); |
| 469 | u8 index = sunxi_data_offset(offset); | 469 | u8 index = sunxi_data_offset(offset); |
| 470 | u32 val = (readl(pctl->membase + reg) >> index) & DATA_PINS_MASK; | 470 | u32 set_mux = pctl->desc->irq_read_needs_mux && |
| 471 | test_bit(FLAG_USED_AS_IRQ, &chip->desc[offset].flags); | ||
| 472 | u32 val; | ||
| 473 | |||
| 474 | if (set_mux) | ||
| 475 | sunxi_pmx_set(pctl->pctl_dev, offset, SUN4I_FUNC_INPUT); | ||
| 476 | |||
| 477 | val = (readl(pctl->membase + reg) >> index) & DATA_PINS_MASK; | ||
| 478 | |||
| 479 | if (set_mux) | ||
| 480 | sunxi_pmx_set(pctl->pctl_dev, offset, SUN4I_FUNC_IRQ); | ||
| 471 | 481 | ||
| 472 | return val; | 482 | return val; |
| 473 | } | 483 | } |
diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.h b/drivers/pinctrl/sunxi/pinctrl-sunxi.h index 5a51523a3459..e248e81a0f9e 100644 --- a/drivers/pinctrl/sunxi/pinctrl-sunxi.h +++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.h | |||
| @@ -77,6 +77,9 @@ | |||
| 77 | #define IRQ_LEVEL_LOW 0x03 | 77 | #define IRQ_LEVEL_LOW 0x03 |
| 78 | #define IRQ_EDGE_BOTH 0x04 | 78 | #define IRQ_EDGE_BOTH 0x04 |
| 79 | 79 | ||
| 80 | #define SUN4I_FUNC_INPUT 0 | ||
| 81 | #define SUN4I_FUNC_IRQ 6 | ||
| 82 | |||
| 80 | struct sunxi_desc_function { | 83 | struct sunxi_desc_function { |
| 81 | const char *name; | 84 | const char *name; |
| 82 | u8 muxval; | 85 | u8 muxval; |
| @@ -94,6 +97,7 @@ struct sunxi_pinctrl_desc { | |||
| 94 | int npins; | 97 | int npins; |
| 95 | unsigned pin_base; | 98 | unsigned pin_base; |
| 96 | unsigned irq_banks; | 99 | unsigned irq_banks; |
| 100 | bool irq_read_needs_mux; | ||
| 97 | }; | 101 | }; |
| 98 | 102 | ||
| 99 | struct sunxi_pinctrl_function { | 103 | struct sunxi_pinctrl_function { |
