FILE
mtk-eint.h
File preview with syntax highlighting.
linux-6.19.14/drivers/pinctrl/mediatek/mtk-eint.h
1/* SPDX-License-Identifier: GPL-2.0 */ 2/* 3 * Copyright (C) 2014-2025 MediaTek Inc. 4 * 5 * Author: Maoguang Meng <maoguang.meng@mediatek.com> 6 * Sean Wang <sean.wang@mediatek.com> 7 * Hao Chang <ot_chhao.chang@mediatek.com> 8 * Qingliang Li <qingliang.li@mediatek.com> 9 */ 10#ifndef __MTK_EINT_H 11#define __MTK_EINT_H 12 13#include <linux/irqdomain.h> 14 15struct mtk_eint_regs { 16 unsigned int stat; 17 unsigned int ack; 18 unsigned int mask; 19 unsigned int mask_set; 20 unsigned int mask_clr; 21 unsigned int sens; 22 unsigned int sens_set; 23 unsigned int sens_clr; 24 unsigned int soft; 25 unsigned int soft_set; 26 unsigned int soft_clr; 27 unsigned int pol; 28 unsigned int pol_set; 29 unsigned int pol_clr; 30 unsigned int dom_en; 31 unsigned int dbnc_ctrl; 32 unsigned int dbnc_set; 33 unsigned int dbnc_clr; 34}; 35 36struct mtk_eint_hw { 37 u8 port_mask; 38 u8 ports; 39 unsigned int ap_num; 40 unsigned int db_cnt; 41 const unsigned int *db_time; 42}; 43 44struct mtk_eint_pin { 45 u16 number; 46 u8 instance; 47 u8 index; 48 bool debounce; 49 bool dual_edge; 50}; 51 52extern const unsigned int debounce_time_mt2701[]; 53extern const unsigned int debounce_time_mt6765[]; 54extern const unsigned int debounce_time_mt6795[]; 55extern const unsigned int debounce_time_mt6878[]; 56 57struct mtk_eint; 58 59struct mtk_eint_xt { 60 int (*get_gpio_n)(void *data, unsigned long eint_n, 61 unsigned int *gpio_n, 62 struct gpio_chip **gpio_chip); 63 int (*get_gpio_state)(void *data, unsigned long eint_n); 64 int (*set_gpio_as_eint)(void *data, unsigned long eint_n); 65}; 66 67struct mtk_eint { 68 struct device *dev; 69 void __iomem **base; 70 int nbase; 71 u16 *base_pin_num; 72 struct irq_domain *domain; 73 int irq; 74 75 int *dual_edge; 76 u16 **pin_list; 77 u32 **wake_mask; 78 u32 **cur_mask; 79 80 /* Used to fit into various EINT device */ 81 const struct mtk_eint_hw *hw; 82 const struct mtk_eint_regs *regs; 83 struct mtk_eint_pin *pins; 84 u16 num_db_time; 85 86 /* Used to fit into various pinctrl device */ 87 void *pctl; 88 const struct mtk_eint_xt *gpio_xlate; 89}; 90 91#if IS_ENABLED(CONFIG_EINT_MTK) 92int mtk_eint_do_init(struct mtk_eint *eint, struct mtk_eint_pin *eint_pin); 93int mtk_eint_do_suspend(struct mtk_eint *eint); 94int mtk_eint_do_resume(struct mtk_eint *eint); 95int mtk_eint_set_debounce(struct mtk_eint *eint, unsigned long eint_n, 96 unsigned int debounce); 97int mtk_eint_find_irq(struct mtk_eint *eint, unsigned long eint_n); 98 99#else 100static inline int mtk_eint_do_init(struct mtk_eint *eint, 101 struct mtk_eint_pin *eint_pin) 102{ 103 return -EOPNOTSUPP; 104} 105 106static inline int mtk_eint_do_suspend(struct mtk_eint *eint) 107{ 108 return -EOPNOTSUPP; 109} 110 111static inline int mtk_eint_do_resume(struct mtk_eint *eint) 112{ 113 return -EOPNOTSUPP; 114} 115 116static inline int mtk_eint_set_debounce(struct mtk_eint *eint, unsigned long eint_n, 117 unsigned int debounce) 118{ 119 return -EOPNOTSUPP; 120} 121 122static inline int mtk_eint_find_irq(struct mtk_eint *eint, unsigned long eint_n) 123{ 124 return -EOPNOTSUPP; 125} 126#endif 127#endif /* __MTK_EINT_H */
~/
Read-only file preview.