1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright (C) 2014-2018 MediaTek Inc.
5 * Author: Maoguang Meng <maoguang.meng@mediatek.com>
6 * Sean Wang <sean.wang@mediatek.com>
12 #include <linux/irqdomain.h>
14 struct mtk_eint_regs
{
18 unsigned int mask_set
;
19 unsigned int mask_clr
;
21 unsigned int sens_set
;
22 unsigned int sens_clr
;
24 unsigned int soft_set
;
25 unsigned int soft_clr
;
30 unsigned int dbnc_ctrl
;
31 unsigned int dbnc_set
;
32 unsigned int dbnc_clr
;
45 int (*get_gpio_n
)(void *data
, unsigned long eint_n
,
47 struct gpio_chip
**gpio_chip
);
48 int (*get_gpio_state
)(void *data
, unsigned long eint_n
);
49 int (*set_gpio_as_eint
)(void *data
, unsigned long eint_n
);
55 struct irq_domain
*domain
;
62 /* Used to fit into various EINT device */
63 const struct mtk_eint_hw
*hw
;
64 const struct mtk_eint_regs
*regs
;
66 /* Used to fit into various pinctrl device */
68 const struct mtk_eint_xt
*gpio_xlate
;
71 #if IS_ENABLED(CONFIG_EINT_MTK)
72 int mtk_eint_do_init(struct mtk_eint
*eint
);
73 int mtk_eint_do_suspend(struct mtk_eint
*eint
);
74 int mtk_eint_do_resume(struct mtk_eint
*eint
);
75 int mtk_eint_set_debounce(struct mtk_eint
*eint
, unsigned long eint_n
,
76 unsigned int debounce
);
77 int mtk_eint_find_irq(struct mtk_eint
*eint
, unsigned long eint_n
);
80 static inline int mtk_eint_do_init(struct mtk_eint
*eint
)
85 static inline int mtk_eint_do_suspend(struct mtk_eint
*eint
)
90 static inline int mtk_eint_do_resume(struct mtk_eint
*eint
)
95 static inline int mtk_eint_set_debounce(struct mtk_eint
*eint
, unsigned long eint_n
,
96 unsigned int debounce
)
101 static inline int mtk_eint_find_irq(struct mtk_eint
*eint
, unsigned long eint_n
)
106 #endif /* __MTK_EINT_H */