Skip to content

Commit fc98adb

Browse files
chenhuacaiMarc Zyngier
authored andcommitted
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 <[email protected]> Signed-off-by: Huacai Chen <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent e740604 commit fc98adb

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

drivers/irqchip/irq-loongson-liointc.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ struct liointc_priv {
5555
struct liointc_handler_data handler[LIOINTC_NUM_PARENT];
5656
void __iomem *core_isr[LIOINTC_NUM_CORES];
5757
u8 map_cache[LIOINTC_CHIP_IRQ];
58+
u32 int_pol;
59+
u32 int_edge;
5860
bool has_lpc_irq_errata;
5961
};
6062

@@ -138,6 +140,14 @@ static int liointc_set_type(struct irq_data *data, unsigned int type)
138140
return 0;
139141
}
140142

143+
static void liointc_suspend(struct irq_chip_generic *gc)
144+
{
145+
struct liointc_priv *priv = gc->private;
146+
147+
priv->int_pol = readl(gc->reg_base + LIOINTC_REG_INTC_POL);
148+
priv->int_edge = readl(gc->reg_base + LIOINTC_REG_INTC_EDGE);
149+
}
150+
141151
static void liointc_resume(struct irq_chip_generic *gc)
142152
{
143153
struct liointc_priv *priv = gc->private;
@@ -150,6 +160,8 @@ static void liointc_resume(struct irq_chip_generic *gc)
150160
/* Restore map cache */
151161
for (i = 0; i < LIOINTC_CHIP_IRQ; i++)
152162
writeb(priv->map_cache[i], gc->reg_base + i);
163+
writel(priv->int_pol, gc->reg_base + LIOINTC_REG_INTC_POL);
164+
writel(priv->int_edge, gc->reg_base + LIOINTC_REG_INTC_EDGE);
153165
/* Restore mask cache */
154166
writel(gc->mask_cache, gc->reg_base + LIOINTC_REG_INTC_ENABLE);
155167
irq_gc_unlock_irqrestore(gc, flags);
@@ -269,6 +281,7 @@ static int liointc_init(phys_addr_t addr, unsigned long size, int revision,
269281
gc->private = priv;
270282
gc->reg_base = base;
271283
gc->domain = domain;
284+
gc->suspend = liointc_suspend;
272285
gc->resume = liointc_resume;
273286

274287
ct = gc->chip_types;

0 commit comments

Comments
 (0)