irq: add irq_handler_enable_suspend_only() interface
Change-Id: I3cda4c3a4ce5928be32eaa8b65ccd4e16946c116 Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
This commit is contained in:
parent
4176611909
commit
2c4e90c1f8
|
|
@ -21,6 +21,8 @@ struct irqchip_desc {
|
|||
struct irq_chip *gpio;
|
||||
struct irq_chip *virq;
|
||||
|
||||
int suspend_irq[PLATFORM_SUSPEND_MAX_IRQ];
|
||||
int suspend_num;
|
||||
};
|
||||
|
||||
static struct irq_desc irq_desc[PLATFORM_MAX_IRQ];
|
||||
|
|
@ -246,13 +248,38 @@ void irq_free_handler(int irq)
|
|||
}
|
||||
}
|
||||
|
||||
int irq_handler_enable_suspend_only(int irq)
|
||||
{
|
||||
if (bad_irq(irq))
|
||||
return -EINVAL;
|
||||
|
||||
if (irqchip.suspend_num >= PLATFORM_SUSPEND_MAX_IRQ) {
|
||||
printf("Over max count(%d) of suspend irq\n",
|
||||
PLATFORM_SUSPEND_MAX_IRQ);
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
irqchip.suspend_irq[irqchip.suspend_num++] = irq;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int irqs_suspend(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < irqchip.suspend_num; i++)
|
||||
irq_handler_enable(irqchip.suspend_irq[i]);
|
||||
|
||||
return irqchip.gic->irq_suspend();
|
||||
}
|
||||
|
||||
int irqs_resume(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < irqchip.suspend_num; i++)
|
||||
irq_handler_disable(irqchip.suspend_irq[i]);
|
||||
|
||||
return irqchip.gic->irq_resume();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
/*
|
||||
* IRQ-NUMBERS
|
||||
*/
|
||||
#define PLATFORM_SUSPEND_MAX_IRQ 12
|
||||
#define PLATFORM_GIC_MAX_IRQ (GIC_IRQS_NR)
|
||||
#define PLATFORM_GPIO_MAX_IRQ (GIC_IRQS_NR + GPIO_IRQS_NR)
|
||||
#define PLATFORM_MAX_IRQ (GIC_IRQS_NR + GPIO_IRQS_NR)
|
||||
|
|
|
|||
|
|
@ -94,6 +94,7 @@ void irq_free_handler(int irq);
|
|||
int irq_set_irq_type(int irq, unsigned int type);
|
||||
int irq_revert_irq_type(int irq);
|
||||
int irq_handler_enable(int irq);
|
||||
int irq_handler_enable_suspend_only(int irq);
|
||||
int irq_handler_disable(int irq);
|
||||
int irq_get_gpio_level(int irq);
|
||||
int irqs_suspend(void);
|
||||
|
|
|
|||
Loading…
Reference in New Issue