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
;
40 const unsigned int *db_time
;
43 extern const unsigned int debounce_time_mt2701
[];
44 extern const unsigned int debounce_time_mt6765
[];
45 extern const unsigned int debounce_time_mt6795
[];
50 int (*get_gpio_n
)(void *data
, unsigned long eint_n
,
52 struct gpio_chip
**gpio_chip
);
53 int (*get_gpio_state
)(void *data
, unsigned long eint_n
);
54 int (*set_gpio_as_eint
)(void *data
, unsigned long eint_n
);
60 struct irq_domain
*domain
;
67 /* Used to fit into various EINT device */
68 const struct mtk_eint_hw
*hw
;
69 const struct mtk_eint_regs
*regs
;
72 /* Used to fit into various pinctrl device */
74 const struct mtk_eint_xt
*gpio_xlate
;
77 #if IS_ENABLED(CONFIG_EINT_MTK)
78 int mtk_eint_do_init(struct mtk_eint
*eint
);
79 int mtk_eint_do_suspend(struct mtk_eint
*eint
);
80 int mtk_eint_do_resume(struct mtk_eint
*eint
);
81 int mtk_eint_set_debounce(struct mtk_eint
*eint
, unsigned long eint_n
,
82 unsigned int debounce
);
83 int mtk_eint_find_irq(struct mtk_eint
*eint
, unsigned long eint_n
);
86 static inline int mtk_eint_do_init(struct mtk_eint
*eint
)
91 static inline int mtk_eint_do_suspend(struct mtk_eint
*eint
)
96 static inline int mtk_eint_do_resume(struct mtk_eint
*eint
)
101 static inline int mtk_eint_set_debounce(struct mtk_eint
*eint
, unsigned long eint_n
,
102 unsigned int debounce
)
107 static inline int mtk_eint_find_irq(struct mtk_eint
*eint
, unsigned long eint_n
)
112 #endif /* __MTK_EINT_H */