blob: d5182cf1497eff62c8430093bf56d2be5dd330b6 [file] [log] [blame]
Simon Glass79d66a62019-12-06 21:41:58 -07001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Copyright (C) 2015, Bin Meng <bmeng.cn@gmail.com>
4 */
5
6#include <common.h>
7#include <dm.h>
8#include <irq.h>
9
10int irq_route_pmc_gpio_gpe(struct udevice *dev, uint pmc_gpe_num)
11{
12 const struct irq_ops *ops = irq_get_ops(dev);
13
14 if (!ops->route_pmc_gpio_gpe)
15 return -ENOSYS;
16
17 return ops->route_pmc_gpio_gpe(dev, pmc_gpe_num);
18}
19
20int irq_set_polarity(struct udevice *dev, uint irq, bool active_low)
21{
22 const struct irq_ops *ops = irq_get_ops(dev);
23
24 if (!ops->set_polarity)
25 return -ENOSYS;
26
27 return ops->set_polarity(dev, irq, active_low);
28}
29
30int irq_snapshot_polarities(struct udevice *dev)
31{
32 const struct irq_ops *ops = irq_get_ops(dev);
33
34 if (!ops->snapshot_polarities)
35 return -ENOSYS;
36
37 return ops->snapshot_polarities(dev);
38}
39
40int irq_restore_polarities(struct udevice *dev)
41{
42 const struct irq_ops *ops = irq_get_ops(dev);
43
44 if (!ops->restore_polarities)
45 return -ENOSYS;
46
47 return ops->restore_polarities(dev);
48}
49
50UCLASS_DRIVER(irq) = {
51 .id = UCLASS_IRQ,
52 .name = "irq",
53};