diff options
-rw-r--r-- | drivers/pinctrl/pinctrl-rockchip.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c index ba74f0aa60c7..e91e8453aa78 100644 --- a/drivers/pinctrl/pinctrl-rockchip.c +++ b/drivers/pinctrl/pinctrl-rockchip.c | |||
@@ -89,6 +89,7 @@ struct rockchip_iomux { | |||
89 | * @reg_pull: optional separate register for additional pull settings | 89 | * @reg_pull: optional separate register for additional pull settings |
90 | * @clk: clock of the gpio bank | 90 | * @clk: clock of the gpio bank |
91 | * @irq: interrupt of the gpio bank | 91 | * @irq: interrupt of the gpio bank |
92 | * @saved_enables: Saved content of GPIO_INTEN at suspend time. | ||
92 | * @pin_base: first pin number | 93 | * @pin_base: first pin number |
93 | * @nr_pins: number of pins in this bank | 94 | * @nr_pins: number of pins in this bank |
94 | * @name: name of the bank | 95 | * @name: name of the bank |
@@ -107,6 +108,7 @@ struct rockchip_pin_bank { | |||
107 | struct regmap *regmap_pull; | 108 | struct regmap *regmap_pull; |
108 | struct clk *clk; | 109 | struct clk *clk; |
109 | int irq; | 110 | int irq; |
111 | u32 saved_enables; | ||
110 | u32 pin_base; | 112 | u32 pin_base; |
111 | u8 nr_pins; | 113 | u8 nr_pins; |
112 | char *name; | 114 | char *name; |
@@ -1543,6 +1545,23 @@ static int rockchip_irq_set_type(struct irq_data *d, unsigned int type) | |||
1543 | return 0; | 1545 | return 0; |
1544 | } | 1546 | } |
1545 | 1547 | ||
1548 | static void rockchip_irq_suspend(struct irq_data *d) | ||
1549 | { | ||
1550 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); | ||
1551 | struct rockchip_pin_bank *bank = gc->private; | ||
1552 | |||
1553 | bank->saved_enables = irq_reg_readl(gc, GPIO_INTEN); | ||
1554 | irq_reg_writel(gc, gc->wake_active, GPIO_INTEN); | ||
1555 | } | ||
1556 | |||
1557 | static void rockchip_irq_resume(struct irq_data *d) | ||
1558 | { | ||
1559 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); | ||
1560 | struct rockchip_pin_bank *bank = gc->private; | ||
1561 | |||
1562 | irq_reg_writel(gc, bank->saved_enables, GPIO_INTEN); | ||
1563 | } | ||
1564 | |||
1546 | static int rockchip_interrupts_register(struct platform_device *pdev, | 1565 | static int rockchip_interrupts_register(struct platform_device *pdev, |
1547 | struct rockchip_pinctrl *info) | 1566 | struct rockchip_pinctrl *info) |
1548 | { | 1567 | { |
@@ -1587,6 +1606,8 @@ static int rockchip_interrupts_register(struct platform_device *pdev, | |||
1587 | gc->chip_types[0].chip.irq_mask = irq_gc_mask_clr_bit; | 1606 | gc->chip_types[0].chip.irq_mask = irq_gc_mask_clr_bit; |
1588 | gc->chip_types[0].chip.irq_unmask = irq_gc_mask_set_bit; | 1607 | gc->chip_types[0].chip.irq_unmask = irq_gc_mask_set_bit; |
1589 | gc->chip_types[0].chip.irq_set_wake = irq_gc_set_wake; | 1608 | gc->chip_types[0].chip.irq_set_wake = irq_gc_set_wake; |
1609 | gc->chip_types[0].chip.irq_suspend = rockchip_irq_suspend; | ||
1610 | gc->chip_types[0].chip.irq_resume = rockchip_irq_resume; | ||
1590 | gc->chip_types[0].chip.irq_set_type = rockchip_irq_set_type; | 1611 | gc->chip_types[0].chip.irq_set_type = rockchip_irq_set_type; |
1591 | gc->wake_enabled = IRQ_MSK(bank->nr_pins); | 1612 | gc->wake_enabled = IRQ_MSK(bank->nr_pins); |
1592 | 1613 | ||