Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

irqchip/loongson-liointc: Save/restore int_edge/int_pol registers during S3/S4

If int_edge/int_pol registers are configured to not be the default values, we
should save/restore them during S3/S4.

Signed-off-by: Yingkun Meng <mengyingkun@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20221207140643.1600743-1-chenhuacai@loongson.cn

authored by

Huacai Chen and committed by
Marc Zyngier
fc98adb9 e7406042

+13
+13
drivers/irqchip/irq-loongson-liointc.c
··· 55 55 struct liointc_handler_data handler[LIOINTC_NUM_PARENT]; 56 56 void __iomem *core_isr[LIOINTC_NUM_CORES]; 57 57 u8 map_cache[LIOINTC_CHIP_IRQ]; 58 + u32 int_pol; 59 + u32 int_edge; 58 60 bool has_lpc_irq_errata; 59 61 }; 60 62 ··· 140 138 return 0; 141 139 } 142 140 141 + static void liointc_suspend(struct irq_chip_generic *gc) 142 + { 143 + struct liointc_priv *priv = gc->private; 144 + 145 + priv->int_pol = readl(gc->reg_base + LIOINTC_REG_INTC_POL); 146 + priv->int_edge = readl(gc->reg_base + LIOINTC_REG_INTC_EDGE); 147 + } 148 + 143 149 static void liointc_resume(struct irq_chip_generic *gc) 144 150 { 145 151 struct liointc_priv *priv = gc->private; ··· 160 150 /* Restore map cache */ 161 151 for (i = 0; i < LIOINTC_CHIP_IRQ; i++) 162 152 writeb(priv->map_cache[i], gc->reg_base + i); 153 + writel(priv->int_pol, gc->reg_base + LIOINTC_REG_INTC_POL); 154 + writel(priv->int_edge, gc->reg_base + LIOINTC_REG_INTC_EDGE); 163 155 /* Restore mask cache */ 164 156 writel(gc->mask_cache, gc->reg_base + LIOINTC_REG_INTC_ENABLE); 165 157 irq_gc_unlock_irqrestore(gc, flags); ··· 281 269 gc->private = priv; 282 270 gc->reg_base = base; 283 271 gc->domain = domain; 272 + gc->suspend = liointc_suspend; 284 273 gc->resume = liointc_resume; 285 274 286 275 ct = gc->chip_types;