Skip to content

Commit 375b674

Browse files
Leo Yu-Chi LiangMina-Chou
authored andcommitted
smu: andes: irq/irq-sifive-plic: Add plic_set_wake to support wake event (torvalds#164)
We need irq_set_wake hook to get wake event information, so revert commit f5259b0 ("smu: andes: Revert "irqchip/sifive-plic: Support wake IRQs") When entering suspend, kernel PM framework will check all the drivers to see if they have the ability to wake up the system. Implement plic_set_wake to acquire wake event information. Signed-off-by: Leo Yu-Chi Liang <[email protected]>
1 parent 8e7dc10 commit 375b674

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

drivers/irqchip/irq-sifive-plic.c

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@
6464

6565
#define PLIC_QUIRK_EDGE_INTERRUPT 0
6666

67+
unsigned long *andes_wake_event;
68+
6769
struct plic_priv {
6870
struct fwnode_handle *fwnode;
6971
struct cpumask lmask;
@@ -164,6 +166,16 @@ static void plic_irq_eoi(struct irq_data *d)
164166
}
165167
}
166168

169+
static int plic_set_wake(struct irq_data *d, unsigned int on)
170+
{
171+
if (on)
172+
__assign_bit(d->hwirq, andes_wake_event, true);
173+
else
174+
__assign_bit(d->hwirq, andes_wake_event, false);
175+
176+
return 0;
177+
}
178+
167179
#ifdef CONFIG_SMP
168180
static int plic_set_affinity(struct irq_data *d,
169181
const struct cpumask *mask_val, bool force)
@@ -197,12 +209,12 @@ static struct irq_chip plic_edge_chip = {
197209
.irq_ack = plic_irq_eoi,
198210
.irq_mask = plic_irq_mask,
199211
.irq_unmask = plic_irq_unmask,
212+
.irq_set_wake = plic_set_wake,
200213
#ifdef CONFIG_SMP
201214
.irq_set_affinity = plic_set_affinity,
202215
#endif
203216
.irq_set_type = plic_irq_set_type,
204-
.flags = IRQCHIP_SKIP_SET_WAKE |
205-
IRQCHIP_AFFINITY_PRE_STARTUP,
217+
.flags = IRQCHIP_AFFINITY_PRE_STARTUP,
206218
};
207219

208220
static struct irq_chip plic_chip = {
@@ -212,12 +224,12 @@ static struct irq_chip plic_chip = {
212224
.irq_mask = plic_irq_mask,
213225
.irq_unmask = plic_irq_unmask,
214226
.irq_eoi = plic_irq_eoi,
227+
.irq_set_wake = plic_set_wake,
215228
#ifdef CONFIG_SMP
216229
.irq_set_affinity = plic_set_affinity,
217230
#endif
218231
.irq_set_type = plic_irq_set_type,
219-
.flags = IRQCHIP_SKIP_SET_WAKE |
220-
IRQCHIP_AFFINITY_PRE_STARTUP,
232+
.flags = IRQCHIP_AFFINITY_PRE_STARTUP,
221233
};
222234

223235
static int plic_irq_set_type(struct irq_data *d, unsigned int type)
@@ -545,6 +557,10 @@ static int plic_probe(struct fwnode_handle *fwnode)
545557
if (error)
546558
goto fail_free_regs;
547559

560+
andes_wake_event = kzalloc(sizeof(unsigned long), GFP_KERNEL);
561+
if (WARN_ON(!andes_wake_event))
562+
return -ENOMEM;
563+
548564
priv = kzalloc(sizeof(*priv), GFP_KERNEL);
549565
if (!priv) {
550566
error = -ENOMEM;

0 commit comments

Comments
 (0)