xref: /openbmc/linux/include/linux/mfd/max77620.h (revision ea611d1cc180fbb56982c83cd5142a2b34881f5c)
1327156c5SLaxman Dewangan /*
2327156c5SLaxman Dewangan  * Defining registers address and its bit definitions of MAX77620 and MAX20024
3327156c5SLaxman Dewangan  *
4327156c5SLaxman Dewangan  * Copyright (C) 2016 NVIDIA CORPORATION. All rights reserved.
5327156c5SLaxman Dewangan  *
6327156c5SLaxman Dewangan  * This program is free software; you can redistribute it and/or modify it
7327156c5SLaxman Dewangan  * under the terms and conditions of the GNU General Public License,
8327156c5SLaxman Dewangan  * version 2, as published by the Free Software Foundation.
9327156c5SLaxman Dewangan  */
10327156c5SLaxman Dewangan 
11327156c5SLaxman Dewangan #ifndef _MFD_MAX77620_H_
12327156c5SLaxman Dewangan #define _MFD_MAX77620_H_
13327156c5SLaxman Dewangan 
14327156c5SLaxman Dewangan #include <linux/types.h>
15327156c5SLaxman Dewangan 
16327156c5SLaxman Dewangan /* GLOBAL, PMIC, GPIO, FPS, ONOFFC, CID Registers */
17327156c5SLaxman Dewangan #define MAX77620_REG_CNFGGLBL1			0x00
18327156c5SLaxman Dewangan #define MAX77620_REG_CNFGGLBL2			0x01
19327156c5SLaxman Dewangan #define MAX77620_REG_CNFGGLBL3			0x02
20327156c5SLaxman Dewangan #define MAX77620_REG_CNFG1_32K			0x03
21327156c5SLaxman Dewangan #define MAX77620_REG_CNFGBBC			0x04
22327156c5SLaxman Dewangan #define MAX77620_REG_IRQTOP			0x05
23327156c5SLaxman Dewangan #define MAX77620_REG_INTLBT			0x06
24327156c5SLaxman Dewangan #define MAX77620_REG_IRQSD			0x07
25327156c5SLaxman Dewangan #define MAX77620_REG_IRQ_LVL2_L0_7		0x08
26327156c5SLaxman Dewangan #define MAX77620_REG_IRQ_LVL2_L8		0x09
27327156c5SLaxman Dewangan #define MAX77620_REG_IRQ_LVL2_GPIO		0x0A
28327156c5SLaxman Dewangan #define MAX77620_REG_ONOFFIRQ			0x0B
29327156c5SLaxman Dewangan #define MAX77620_REG_NVERC			0x0C
30327156c5SLaxman Dewangan #define MAX77620_REG_IRQTOPM			0x0D
31327156c5SLaxman Dewangan #define MAX77620_REG_INTENLBT			0x0E
32327156c5SLaxman Dewangan #define MAX77620_REG_IRQMASKSD			0x0F
33327156c5SLaxman Dewangan #define MAX77620_REG_IRQ_MSK_L0_7		0x10
34327156c5SLaxman Dewangan #define MAX77620_REG_IRQ_MSK_L8			0x11
35327156c5SLaxman Dewangan #define MAX77620_REG_ONOFFIRQM			0x12
36327156c5SLaxman Dewangan #define MAX77620_REG_STATLBT			0x13
37327156c5SLaxman Dewangan #define MAX77620_REG_STATSD			0x14
38327156c5SLaxman Dewangan #define MAX77620_REG_ONOFFSTAT			0x15
39327156c5SLaxman Dewangan 
40327156c5SLaxman Dewangan /* SD and LDO Registers */
41327156c5SLaxman Dewangan #define MAX77620_REG_SD0			0x16
42327156c5SLaxman Dewangan #define MAX77620_REG_SD1			0x17
43327156c5SLaxman Dewangan #define MAX77620_REG_SD2			0x18
44327156c5SLaxman Dewangan #define MAX77620_REG_SD3			0x19
45327156c5SLaxman Dewangan #define MAX77620_REG_SD4			0x1A
46327156c5SLaxman Dewangan #define MAX77620_REG_DVSSD0			0x1B
47327156c5SLaxman Dewangan #define MAX77620_REG_DVSSD1			0x1C
48327156c5SLaxman Dewangan #define MAX77620_REG_SD0_CFG			0x1D
49327156c5SLaxman Dewangan #define MAX77620_REG_SD1_CFG			0x1E
50327156c5SLaxman Dewangan #define MAX77620_REG_SD2_CFG			0x1F
51327156c5SLaxman Dewangan #define MAX77620_REG_SD3_CFG			0x20
52327156c5SLaxman Dewangan #define MAX77620_REG_SD4_CFG			0x21
53327156c5SLaxman Dewangan #define MAX77620_REG_SD_CFG2			0x22
54327156c5SLaxman Dewangan #define MAX77620_REG_LDO0_CFG			0x23
55327156c5SLaxman Dewangan #define MAX77620_REG_LDO0_CFG2			0x24
56327156c5SLaxman Dewangan #define MAX77620_REG_LDO1_CFG			0x25
57327156c5SLaxman Dewangan #define MAX77620_REG_LDO1_CFG2			0x26
58327156c5SLaxman Dewangan #define MAX77620_REG_LDO2_CFG			0x27
59327156c5SLaxman Dewangan #define MAX77620_REG_LDO2_CFG2			0x28
60327156c5SLaxman Dewangan #define MAX77620_REG_LDO3_CFG			0x29
61327156c5SLaxman Dewangan #define MAX77620_REG_LDO3_CFG2			0x2A
62327156c5SLaxman Dewangan #define MAX77620_REG_LDO4_CFG			0x2B
63327156c5SLaxman Dewangan #define MAX77620_REG_LDO4_CFG2			0x2C
64327156c5SLaxman Dewangan #define MAX77620_REG_LDO5_CFG			0x2D
65327156c5SLaxman Dewangan #define MAX77620_REG_LDO5_CFG2			0x2E
66327156c5SLaxman Dewangan #define MAX77620_REG_LDO6_CFG			0x2F
67327156c5SLaxman Dewangan #define MAX77620_REG_LDO6_CFG2			0x30
68327156c5SLaxman Dewangan #define MAX77620_REG_LDO7_CFG			0x31
69327156c5SLaxman Dewangan #define MAX77620_REG_LDO7_CFG2			0x32
70327156c5SLaxman Dewangan #define MAX77620_REG_LDO8_CFG			0x33
71327156c5SLaxman Dewangan #define MAX77620_REG_LDO8_CFG2			0x34
72327156c5SLaxman Dewangan #define MAX77620_REG_LDO_CFG3			0x35
73327156c5SLaxman Dewangan 
74327156c5SLaxman Dewangan #define MAX77620_LDO_SLEW_RATE_MASK		0x1
75327156c5SLaxman Dewangan 
76327156c5SLaxman Dewangan /* LDO Configuration 3 */
77327156c5SLaxman Dewangan #define MAX77620_TRACK4_MASK			BIT(5)
78327156c5SLaxman Dewangan #define MAX77620_TRACK4_SHIFT			5
79327156c5SLaxman Dewangan 
80327156c5SLaxman Dewangan /* Voltage */
81327156c5SLaxman Dewangan #define MAX77620_SDX_VOLT_MASK			0xFF
82327156c5SLaxman Dewangan #define MAX77620_SD0_VOLT_MASK			0x3F
83327156c5SLaxman Dewangan #define MAX77620_SD1_VOLT_MASK			0x7F
84327156c5SLaxman Dewangan #define MAX77620_LDO_VOLT_MASK			0x3F
85327156c5SLaxman Dewangan 
86327156c5SLaxman Dewangan #define MAX77620_REG_GPIO0			0x36
87327156c5SLaxman Dewangan #define MAX77620_REG_GPIO1			0x37
88327156c5SLaxman Dewangan #define MAX77620_REG_GPIO2			0x38
89327156c5SLaxman Dewangan #define MAX77620_REG_GPIO3			0x39
90327156c5SLaxman Dewangan #define MAX77620_REG_GPIO4			0x3A
91327156c5SLaxman Dewangan #define MAX77620_REG_GPIO5			0x3B
92327156c5SLaxman Dewangan #define MAX77620_REG_GPIO6			0x3C
93327156c5SLaxman Dewangan #define MAX77620_REG_GPIO7			0x3D
94327156c5SLaxman Dewangan #define MAX77620_REG_PUE_GPIO			0x3E
95327156c5SLaxman Dewangan #define MAX77620_REG_PDE_GPIO			0x3F
96327156c5SLaxman Dewangan #define MAX77620_REG_AME_GPIO			0x40
97327156c5SLaxman Dewangan #define MAX77620_REG_ONOFFCNFG1			0x41
98327156c5SLaxman Dewangan #define MAX77620_REG_ONOFFCNFG2			0x42
99327156c5SLaxman Dewangan 
100327156c5SLaxman Dewangan /* FPS Registers */
101327156c5SLaxman Dewangan #define MAX77620_REG_FPS_CFG0			0x43
102327156c5SLaxman Dewangan #define MAX77620_REG_FPS_CFG1			0x44
103327156c5SLaxman Dewangan #define MAX77620_REG_FPS_CFG2			0x45
104327156c5SLaxman Dewangan #define MAX77620_REG_FPS_LDO0			0x46
105327156c5SLaxman Dewangan #define MAX77620_REG_FPS_LDO1			0x47
106327156c5SLaxman Dewangan #define MAX77620_REG_FPS_LDO2			0x48
107327156c5SLaxman Dewangan #define MAX77620_REG_FPS_LDO3			0x49
108327156c5SLaxman Dewangan #define MAX77620_REG_FPS_LDO4			0x4A
109327156c5SLaxman Dewangan #define MAX77620_REG_FPS_LDO5			0x4B
110327156c5SLaxman Dewangan #define MAX77620_REG_FPS_LDO6			0x4C
111327156c5SLaxman Dewangan #define MAX77620_REG_FPS_LDO7			0x4D
112327156c5SLaxman Dewangan #define MAX77620_REG_FPS_LDO8			0x4E
113327156c5SLaxman Dewangan #define MAX77620_REG_FPS_SD0			0x4F
114327156c5SLaxman Dewangan #define MAX77620_REG_FPS_SD1			0x50
115327156c5SLaxman Dewangan #define MAX77620_REG_FPS_SD2			0x51
116327156c5SLaxman Dewangan #define MAX77620_REG_FPS_SD3			0x52
117327156c5SLaxman Dewangan #define MAX77620_REG_FPS_SD4			0x53
118327156c5SLaxman Dewangan #define MAX77620_REG_FPS_NONE			0
119327156c5SLaxman Dewangan 
120327156c5SLaxman Dewangan #define MAX77620_FPS_SRC_MASK			0xC0
121327156c5SLaxman Dewangan #define MAX77620_FPS_SRC_SHIFT			6
122327156c5SLaxman Dewangan #define MAX77620_FPS_PU_PERIOD_MASK		0x38
123327156c5SLaxman Dewangan #define MAX77620_FPS_PU_PERIOD_SHIFT		3
124327156c5SLaxman Dewangan #define MAX77620_FPS_PD_PERIOD_MASK		0x07
125327156c5SLaxman Dewangan #define MAX77620_FPS_PD_PERIOD_SHIFT		0
126327156c5SLaxman Dewangan #define MAX77620_FPS_TIME_PERIOD_MASK		0x38
127327156c5SLaxman Dewangan #define MAX77620_FPS_TIME_PERIOD_SHIFT		3
128327156c5SLaxman Dewangan #define MAX77620_FPS_EN_SRC_MASK		0x06
129327156c5SLaxman Dewangan #define MAX77620_FPS_EN_SRC_SHIFT		1
130327156c5SLaxman Dewangan #define MAX77620_FPS_ENFPS_SW_MASK		0x01
131327156c5SLaxman Dewangan #define MAX77620_FPS_ENFPS_SW			0x01
132327156c5SLaxman Dewangan 
133327156c5SLaxman Dewangan /* Minimum and maximum FPS period time (in microseconds) are
134327156c5SLaxman Dewangan  * different for MAX77620 and Max20024.
135327156c5SLaxman Dewangan  */
136327156c5SLaxman Dewangan #define MAX77620_FPS_PERIOD_MIN_US		40
137327156c5SLaxman Dewangan #define MAX20024_FPS_PERIOD_MIN_US		20
138327156c5SLaxman Dewangan 
139*ea611d1cSDmitry Osipenko #define MAX20024_FPS_PERIOD_MAX_US		2560
140*ea611d1cSDmitry Osipenko #define MAX77620_FPS_PERIOD_MAX_US		5120
141327156c5SLaxman Dewangan 
142327156c5SLaxman Dewangan #define MAX77620_REG_FPS_GPIO1			0x54
143327156c5SLaxman Dewangan #define MAX77620_REG_FPS_GPIO2			0x55
144327156c5SLaxman Dewangan #define MAX77620_REG_FPS_GPIO3			0x56
145327156c5SLaxman Dewangan #define MAX77620_REG_FPS_RSO			0x57
146327156c5SLaxman Dewangan #define MAX77620_REG_CID0			0x58
147327156c5SLaxman Dewangan #define MAX77620_REG_CID1			0x59
148327156c5SLaxman Dewangan #define MAX77620_REG_CID2			0x5A
149327156c5SLaxman Dewangan #define MAX77620_REG_CID3			0x5B
150327156c5SLaxman Dewangan #define MAX77620_REG_CID4			0x5C
151327156c5SLaxman Dewangan #define MAX77620_REG_CID5			0x5D
152327156c5SLaxman Dewangan 
153327156c5SLaxman Dewangan #define MAX77620_REG_DVSSD4			0x5E
154327156c5SLaxman Dewangan #define MAX20024_REG_MAX_ADD			0x70
155327156c5SLaxman Dewangan 
156327156c5SLaxman Dewangan #define MAX77620_CID_DIDM_MASK			0xF0
157327156c5SLaxman Dewangan #define MAX77620_CID_DIDM_SHIFT			4
158327156c5SLaxman Dewangan 
159327156c5SLaxman Dewangan /* CNCG2SD */
160327156c5SLaxman Dewangan #define MAX77620_SD_CNF2_ROVS_EN_SD1		BIT(1)
161327156c5SLaxman Dewangan #define MAX77620_SD_CNF2_ROVS_EN_SD0		BIT(2)
162327156c5SLaxman Dewangan 
163327156c5SLaxman Dewangan /* Device Identification Metal */
164327156c5SLaxman Dewangan #define MAX77620_CID5_DIDM(n)			(((n) >> 4) & 0xF)
165327156c5SLaxman Dewangan /* Device Indentification OTP */
166327156c5SLaxman Dewangan #define MAX77620_CID5_DIDO(n)			((n) & 0xF)
167327156c5SLaxman Dewangan 
168327156c5SLaxman Dewangan /* SD CNFG1 */
169327156c5SLaxman Dewangan #define MAX77620_SD_SR_MASK			0xC0
170327156c5SLaxman Dewangan #define MAX77620_SD_SR_SHIFT			6
171327156c5SLaxman Dewangan #define MAX77620_SD_POWER_MODE_MASK		0x30
172327156c5SLaxman Dewangan #define MAX77620_SD_POWER_MODE_SHIFT		4
173327156c5SLaxman Dewangan #define MAX77620_SD_CFG1_ADE_MASK		BIT(3)
174327156c5SLaxman Dewangan #define MAX77620_SD_CFG1_ADE_DISABLE		0
175327156c5SLaxman Dewangan #define MAX77620_SD_CFG1_ADE_ENABLE		BIT(3)
176327156c5SLaxman Dewangan #define MAX77620_SD_FPWM_MASK			0x04
177327156c5SLaxman Dewangan #define MAX77620_SD_FPWM_SHIFT			2
178327156c5SLaxman Dewangan #define MAX77620_SD_FSRADE_MASK			0x01
179327156c5SLaxman Dewangan #define MAX77620_SD_FSRADE_SHIFT		0
180327156c5SLaxman Dewangan #define MAX77620_SD_CFG1_FPWM_SD_MASK		BIT(2)
181327156c5SLaxman Dewangan #define MAX77620_SD_CFG1_FPWM_SD_SKIP		0
182327156c5SLaxman Dewangan #define MAX77620_SD_CFG1_FPWM_SD_FPWM		BIT(2)
183383d0fcaSVenkat Reddy Talla #define MAX20024_SD_CFG1_MPOK_MASK		BIT(1)
184327156c5SLaxman Dewangan #define MAX77620_SD_CFG1_FSRADE_SD_MASK		BIT(0)
185327156c5SLaxman Dewangan #define MAX77620_SD_CFG1_FSRADE_SD_DISABLE	0
186327156c5SLaxman Dewangan #define MAX77620_SD_CFG1_FSRADE_SD_ENABLE	BIT(0)
187327156c5SLaxman Dewangan 
188327156c5SLaxman Dewangan /* LDO_CNFG2 */
189327156c5SLaxman Dewangan #define MAX77620_LDO_POWER_MODE_MASK		0xC0
190327156c5SLaxman Dewangan #define MAX77620_LDO_POWER_MODE_SHIFT		6
191383d0fcaSVenkat Reddy Talla #define MAX20024_LDO_CFG2_MPOK_MASK		BIT(2)
192327156c5SLaxman Dewangan #define MAX77620_LDO_CFG2_ADE_MASK		BIT(1)
193327156c5SLaxman Dewangan #define MAX77620_LDO_CFG2_ADE_DISABLE		0
194327156c5SLaxman Dewangan #define MAX77620_LDO_CFG2_ADE_ENABLE		BIT(1)
195327156c5SLaxman Dewangan #define MAX77620_LDO_CFG2_SS_MASK		BIT(0)
196327156c5SLaxman Dewangan #define MAX77620_LDO_CFG2_SS_FAST		BIT(0)
197327156c5SLaxman Dewangan #define MAX77620_LDO_CFG2_SS_SLOW		0
198327156c5SLaxman Dewangan 
199327156c5SLaxman Dewangan #define MAX77620_IRQ_TOP_GLBL_MASK		BIT(7)
200327156c5SLaxman Dewangan #define MAX77620_IRQ_TOP_SD_MASK		BIT(6)
201327156c5SLaxman Dewangan #define MAX77620_IRQ_TOP_LDO_MASK		BIT(5)
202327156c5SLaxman Dewangan #define MAX77620_IRQ_TOP_GPIO_MASK		BIT(4)
203327156c5SLaxman Dewangan #define MAX77620_IRQ_TOP_RTC_MASK		BIT(3)
204327156c5SLaxman Dewangan #define MAX77620_IRQ_TOP_32K_MASK		BIT(2)
205327156c5SLaxman Dewangan #define MAX77620_IRQ_TOP_ONOFF_MASK		BIT(1)
206327156c5SLaxman Dewangan 
207327156c5SLaxman Dewangan #define MAX77620_IRQ_LBM_MASK			BIT(3)
208327156c5SLaxman Dewangan #define MAX77620_IRQ_TJALRM1_MASK		BIT(2)
209327156c5SLaxman Dewangan #define MAX77620_IRQ_TJALRM2_MASK		BIT(1)
210327156c5SLaxman Dewangan 
211327156c5SLaxman Dewangan #define MAX77620_PWR_I2C_ADDR			0x3c
212327156c5SLaxman Dewangan #define MAX77620_RTC_I2C_ADDR			0x68
213327156c5SLaxman Dewangan 
214327156c5SLaxman Dewangan #define MAX77620_CNFG_GPIO_DRV_MASK		BIT(0)
215327156c5SLaxman Dewangan #define MAX77620_CNFG_GPIO_DRV_PUSHPULL		BIT(0)
216327156c5SLaxman Dewangan #define MAX77620_CNFG_GPIO_DRV_OPENDRAIN	0
217327156c5SLaxman Dewangan #define MAX77620_CNFG_GPIO_DIR_MASK		BIT(1)
218327156c5SLaxman Dewangan #define MAX77620_CNFG_GPIO_DIR_INPUT		BIT(1)
219327156c5SLaxman Dewangan #define MAX77620_CNFG_GPIO_DIR_OUTPUT		0
220327156c5SLaxman Dewangan #define MAX77620_CNFG_GPIO_INPUT_VAL_MASK	BIT(2)
221327156c5SLaxman Dewangan #define MAX77620_CNFG_GPIO_OUTPUT_VAL_MASK	BIT(3)
222327156c5SLaxman Dewangan #define MAX77620_CNFG_GPIO_OUTPUT_VAL_HIGH	BIT(3)
223327156c5SLaxman Dewangan #define MAX77620_CNFG_GPIO_OUTPUT_VAL_LOW	0
224327156c5SLaxman Dewangan #define MAX77620_CNFG_GPIO_INT_MASK		(0x3 << 4)
225327156c5SLaxman Dewangan #define MAX77620_CNFG_GPIO_INT_FALLING		BIT(4)
226327156c5SLaxman Dewangan #define MAX77620_CNFG_GPIO_INT_RISING		BIT(5)
227327156c5SLaxman Dewangan #define MAX77620_CNFG_GPIO_DBNC_MASK		(0x3 << 6)
228327156c5SLaxman Dewangan #define MAX77620_CNFG_GPIO_DBNC_None		(0x0 << 6)
229327156c5SLaxman Dewangan #define MAX77620_CNFG_GPIO_DBNC_8ms		(0x1 << 6)
230327156c5SLaxman Dewangan #define MAX77620_CNFG_GPIO_DBNC_16ms		(0x2 << 6)
231327156c5SLaxman Dewangan #define MAX77620_CNFG_GPIO_DBNC_32ms		(0x3 << 6)
232327156c5SLaxman Dewangan 
233327156c5SLaxman Dewangan #define MAX77620_IRQ_LVL2_GPIO_EDGE0		BIT(0)
234327156c5SLaxman Dewangan #define MAX77620_IRQ_LVL2_GPIO_EDGE1		BIT(1)
235327156c5SLaxman Dewangan #define MAX77620_IRQ_LVL2_GPIO_EDGE2		BIT(2)
236327156c5SLaxman Dewangan #define MAX77620_IRQ_LVL2_GPIO_EDGE3		BIT(3)
237327156c5SLaxman Dewangan #define MAX77620_IRQ_LVL2_GPIO_EDGE4		BIT(4)
238327156c5SLaxman Dewangan #define MAX77620_IRQ_LVL2_GPIO_EDGE5		BIT(5)
239327156c5SLaxman Dewangan #define MAX77620_IRQ_LVL2_GPIO_EDGE6		BIT(6)
240327156c5SLaxman Dewangan #define MAX77620_IRQ_LVL2_GPIO_EDGE7		BIT(7)
241327156c5SLaxman Dewangan 
242327156c5SLaxman Dewangan #define MAX77620_CNFG1_32K_OUT0_EN		BIT(2)
243327156c5SLaxman Dewangan 
244327156c5SLaxman Dewangan #define MAX77620_ONOFFCNFG1_SFT_RST		BIT(7)
245327156c5SLaxman Dewangan #define MAX77620_ONOFFCNFG1_MRT_MASK		0x38
246327156c5SLaxman Dewangan #define MAX77620_ONOFFCNFG1_MRT_SHIFT		0x3
247327156c5SLaxman Dewangan #define MAX77620_ONOFFCNFG1_SLPEN		BIT(2)
248327156c5SLaxman Dewangan #define MAX77620_ONOFFCNFG1_PWR_OFF		BIT(1)
249327156c5SLaxman Dewangan #define MAX20024_ONOFFCNFG1_CLRSE		0x18
250327156c5SLaxman Dewangan 
251327156c5SLaxman Dewangan #define MAX77620_ONOFFCNFG2_SFT_RST_WK		BIT(7)
252327156c5SLaxman Dewangan #define MAX77620_ONOFFCNFG2_WD_RST_WK		BIT(6)
253327156c5SLaxman Dewangan #define MAX77620_ONOFFCNFG2_SLP_LPM_MSK		BIT(5)
254327156c5SLaxman Dewangan #define MAX77620_ONOFFCNFG2_WK_ALARM1		BIT(2)
255327156c5SLaxman Dewangan #define MAX77620_ONOFFCNFG2_WK_EN0		BIT(0)
256327156c5SLaxman Dewangan 
257327156c5SLaxman Dewangan #define MAX77620_GLBLM_MASK			BIT(0)
258327156c5SLaxman Dewangan 
259327156c5SLaxman Dewangan #define MAX77620_WDTC_MASK			0x3
260327156c5SLaxman Dewangan #define MAX77620_WDTOFFC			BIT(4)
261327156c5SLaxman Dewangan #define MAX77620_WDTSLPC			BIT(3)
262327156c5SLaxman Dewangan #define MAX77620_WDTEN				BIT(2)
263327156c5SLaxman Dewangan 
264327156c5SLaxman Dewangan #define MAX77620_TWD_MASK			0x3
265327156c5SLaxman Dewangan #define MAX77620_TWD_2s				0x0
266327156c5SLaxman Dewangan #define MAX77620_TWD_16s			0x1
267327156c5SLaxman Dewangan #define MAX77620_TWD_64s			0x2
268327156c5SLaxman Dewangan #define MAX77620_TWD_128s			0x3
269327156c5SLaxman Dewangan 
270327156c5SLaxman Dewangan #define MAX77620_CNFGGLBL1_LBDAC_EN		BIT(7)
271327156c5SLaxman Dewangan #define MAX77620_CNFGGLBL1_MPPLD		BIT(6)
272327156c5SLaxman Dewangan #define MAX77620_CNFGGLBL1_LBHYST		(BIT(5) | BIT(4))
273327156c5SLaxman Dewangan #define MAX77620_CNFGGLBL1_LBDAC		0x0E
274327156c5SLaxman Dewangan #define MAX77620_CNFGGLBL1_LBRSTEN		BIT(0)
275327156c5SLaxman Dewangan 
276327156c5SLaxman Dewangan /* CNFG BBC registers */
277327156c5SLaxman Dewangan #define MAX77620_CNFGBBC_ENABLE			BIT(0)
278327156c5SLaxman Dewangan #define MAX77620_CNFGBBC_CURRENT_MASK		0x06
279327156c5SLaxman Dewangan #define MAX77620_CNFGBBC_CURRENT_SHIFT		1
280327156c5SLaxman Dewangan #define MAX77620_CNFGBBC_VOLTAGE_MASK		0x18
281327156c5SLaxman Dewangan #define MAX77620_CNFGBBC_VOLTAGE_SHIFT		3
282327156c5SLaxman Dewangan #define MAX77620_CNFGBBC_LOW_CURRENT_DISABLE	BIT(5)
283327156c5SLaxman Dewangan #define MAX77620_CNFGBBC_RESISTOR_MASK		0xC0
284327156c5SLaxman Dewangan #define MAX77620_CNFGBBC_RESISTOR_SHIFT		6
285327156c5SLaxman Dewangan 
286327156c5SLaxman Dewangan #define MAX77620_FPS_COUNT			3
287327156c5SLaxman Dewangan 
288327156c5SLaxman Dewangan /* Interrupts */
289327156c5SLaxman Dewangan enum {
290327156c5SLaxman Dewangan 	MAX77620_IRQ_TOP_GLBL,		/* Low-Battery */
291327156c5SLaxman Dewangan 	MAX77620_IRQ_TOP_SD,		/* SD power fail */
292327156c5SLaxman Dewangan 	MAX77620_IRQ_TOP_LDO,		/* LDO power fail */
293327156c5SLaxman Dewangan 	MAX77620_IRQ_TOP_GPIO,		/* TOP GPIO internal int to MAX77620 */
294327156c5SLaxman Dewangan 	MAX77620_IRQ_TOP_RTC,		/* RTC */
295327156c5SLaxman Dewangan 	MAX77620_IRQ_TOP_32K,		/* 32kHz oscillator */
296327156c5SLaxman Dewangan 	MAX77620_IRQ_TOP_ONOFF,		/* ON/OFF oscillator */
297327156c5SLaxman Dewangan 	MAX77620_IRQ_LBT_MBATLOW,	/* Thermal alarm status, > 120C */
298327156c5SLaxman Dewangan 	MAX77620_IRQ_LBT_TJALRM1,	/* Thermal alarm status, > 120C */
299327156c5SLaxman Dewangan 	MAX77620_IRQ_LBT_TJALRM2,	/* Thermal alarm status, > 140C */
300327156c5SLaxman Dewangan };
301327156c5SLaxman Dewangan 
302327156c5SLaxman Dewangan /* GPIOs */
303327156c5SLaxman Dewangan enum {
304327156c5SLaxman Dewangan 	MAX77620_GPIO0,
305327156c5SLaxman Dewangan 	MAX77620_GPIO1,
306327156c5SLaxman Dewangan 	MAX77620_GPIO2,
307327156c5SLaxman Dewangan 	MAX77620_GPIO3,
308327156c5SLaxman Dewangan 	MAX77620_GPIO4,
309327156c5SLaxman Dewangan 	MAX77620_GPIO5,
310327156c5SLaxman Dewangan 	MAX77620_GPIO6,
311327156c5SLaxman Dewangan 	MAX77620_GPIO7,
312327156c5SLaxman Dewangan 	MAX77620_GPIO_NR,
313327156c5SLaxman Dewangan };
314327156c5SLaxman Dewangan 
315327156c5SLaxman Dewangan /* FPS Source */
316327156c5SLaxman Dewangan enum max77620_fps_src {
317327156c5SLaxman Dewangan 	MAX77620_FPS_SRC_0,
318327156c5SLaxman Dewangan 	MAX77620_FPS_SRC_1,
319327156c5SLaxman Dewangan 	MAX77620_FPS_SRC_2,
320327156c5SLaxman Dewangan 	MAX77620_FPS_SRC_NONE,
321327156c5SLaxman Dewangan 	MAX77620_FPS_SRC_DEF,
322327156c5SLaxman Dewangan };
323327156c5SLaxman Dewangan 
324327156c5SLaxman Dewangan enum max77620_chip_id {
325327156c5SLaxman Dewangan 	MAX77620,
326327156c5SLaxman Dewangan 	MAX20024,
327327156c5SLaxman Dewangan };
328327156c5SLaxman Dewangan 
329327156c5SLaxman Dewangan struct max77620_chip {
330327156c5SLaxman Dewangan 	struct device *dev;
331327156c5SLaxman Dewangan 	struct regmap *rmap;
332327156c5SLaxman Dewangan 
333327156c5SLaxman Dewangan 	int chip_irq;
334327156c5SLaxman Dewangan 	int irq_base;
335327156c5SLaxman Dewangan 
336327156c5SLaxman Dewangan 	/* chip id */
337327156c5SLaxman Dewangan 	enum max77620_chip_id chip_id;
338327156c5SLaxman Dewangan 
339327156c5SLaxman Dewangan 	bool sleep_enable;
340327156c5SLaxman Dewangan 	bool enable_global_lpm;
341327156c5SLaxman Dewangan 	int shutdown_fps_period[MAX77620_FPS_COUNT];
342327156c5SLaxman Dewangan 	int suspend_fps_period[MAX77620_FPS_COUNT];
343327156c5SLaxman Dewangan 
344327156c5SLaxman Dewangan 	struct regmap_irq_chip_data *top_irq_data;
345327156c5SLaxman Dewangan 	struct regmap_irq_chip_data *gpio_irq_data;
346327156c5SLaxman Dewangan };
347327156c5SLaxman Dewangan 
348327156c5SLaxman Dewangan #endif /* _MFD_MAX77620_H_ */
349