drm/tidss: Fix typos
[drm/drm-misc.git] / drivers / pinctrl / mediatek / mtk-eint.h
blob6139b16cd225fe0c93aa7e11c28e2f608dc41b24
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * Copyright (C) 2014-2018 MediaTek Inc.
5 * Author: Maoguang Meng <maoguang.meng@mediatek.com>
6 * Sean Wang <sean.wang@mediatek.com>
8 */
9 #ifndef __MTK_EINT_H
10 #define __MTK_EINT_H
12 #include <linux/irqdomain.h>
14 struct mtk_eint_regs {
15 unsigned int stat;
16 unsigned int ack;
17 unsigned int mask;
18 unsigned int mask_set;
19 unsigned int mask_clr;
20 unsigned int sens;
21 unsigned int sens_set;
22 unsigned int sens_clr;
23 unsigned int soft;
24 unsigned int soft_set;
25 unsigned int soft_clr;
26 unsigned int pol;
27 unsigned int pol_set;
28 unsigned int pol_clr;
29 unsigned int dom_en;
30 unsigned int dbnc_ctrl;
31 unsigned int dbnc_set;
32 unsigned int dbnc_clr;
35 struct mtk_eint_hw {
36 u8 port_mask;
37 u8 ports;
38 unsigned int ap_num;
39 unsigned int db_cnt;
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[];
47 struct mtk_eint;
49 struct mtk_eint_xt {
50 int (*get_gpio_n)(void *data, unsigned long eint_n,
51 unsigned int *gpio_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);
57 struct mtk_eint {
58 struct device *dev;
59 void __iomem *base;
60 struct irq_domain *domain;
61 int irq;
63 int *dual_edge;
64 u32 *wake_mask;
65 u32 *cur_mask;
67 /* Used to fit into various EINT device */
68 const struct mtk_eint_hw *hw;
69 const struct mtk_eint_regs *regs;
70 u16 num_db_time;
72 /* Used to fit into various pinctrl device */
73 void *pctl;
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);
85 #else
86 static inline int mtk_eint_do_init(struct mtk_eint *eint)
88 return -EOPNOTSUPP;
91 static inline int mtk_eint_do_suspend(struct mtk_eint *eint)
93 return -EOPNOTSUPP;
96 static inline int mtk_eint_do_resume(struct mtk_eint *eint)
98 return -EOPNOTSUPP;
101 static inline int mtk_eint_set_debounce(struct mtk_eint *eint, unsigned long eint_n,
102 unsigned int debounce)
104 return -EOPNOTSUPP;
107 static inline int mtk_eint_find_irq(struct mtk_eint *eint, unsigned long eint_n)
109 return -EOPNOTSUPP;
111 #endif
112 #endif /* __MTK_EINT_H */