xref: /openbmc/linux/include/linux/mfd/mt6397/core.h (revision 297ce026)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright (c) 2014 MediaTek Inc.
4  * Author: Flora Fu, MediaTek
5  */
6 
7 #ifndef __MFD_MT6397_CORE_H__
8 #define __MFD_MT6397_CORE_H__
9 
10 #include <linux/mutex.h>
11 #include <linux/notifier.h>
12 
13 enum chip_id {
14 	MT6323_CHIP_ID = 0x23,
15 	MT6358_CHIP_ID = 0x58,
16 	MT6359_CHIP_ID = 0x59,
17 	MT6366_CHIP_ID = 0x66,
18 	MT6391_CHIP_ID = 0x91,
19 	MT6397_CHIP_ID = 0x97,
20 };
21 
22 enum mt6397_irq_numbers {
23 	MT6397_IRQ_SPKL_AB = 0,
24 	MT6397_IRQ_SPKR_AB,
25 	MT6397_IRQ_SPKL,
26 	MT6397_IRQ_SPKR,
27 	MT6397_IRQ_BAT_L,
28 	MT6397_IRQ_BAT_H,
29 	MT6397_IRQ_FG_BAT_L,
30 	MT6397_IRQ_FG_BAT_H,
31 	MT6397_IRQ_WATCHDOG,
32 	MT6397_IRQ_PWRKEY,
33 	MT6397_IRQ_THR_L,
34 	MT6397_IRQ_THR_H,
35 	MT6397_IRQ_VBATON_UNDET,
36 	MT6397_IRQ_BVALID_DET,
37 	MT6397_IRQ_CHRDET,
38 	MT6397_IRQ_OV,
39 	MT6397_IRQ_LDO,
40 	MT6397_IRQ_HOMEKEY,
41 	MT6397_IRQ_ACCDET,
42 	MT6397_IRQ_AUDIO,
43 	MT6397_IRQ_RTC,
44 	MT6397_IRQ_PWRKEY_RSTB,
45 	MT6397_IRQ_HDMI_SIFM,
46 	MT6397_IRQ_HDMI_CEC,
47 	MT6397_IRQ_VCA15,
48 	MT6397_IRQ_VSRMCA15,
49 	MT6397_IRQ_VCORE,
50 	MT6397_IRQ_VGPU,
51 	MT6397_IRQ_VIO18,
52 	MT6397_IRQ_VPCA7,
53 	MT6397_IRQ_VSRMCA7,
54 	MT6397_IRQ_VDRM,
55 	MT6397_IRQ_NR,
56 };
57 
58 struct mt6397_chip {
59 	struct device *dev;
60 	struct regmap *regmap;
61 	struct notifier_block pm_nb;
62 	int irq;
63 	struct irq_domain *irq_domain;
64 	struct mutex irqlock;
65 	u16 wake_mask[2];
66 	u16 irq_masks_cur[2];
67 	u16 irq_masks_cache[2];
68 	u16 int_con[2];
69 	u16 int_status[2];
70 	u16 chip_id;
71 	void *irq_data;
72 };
73 
74 int mt6358_irq_init(struct mt6397_chip *chip);
75 int mt6397_irq_init(struct mt6397_chip *chip);
76 
77 #endif /* __MFD_MT6397_CORE_H__ */
78