1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  *  Copyright(C) 2024 Svyatoslav Ryhel <clamor95@gmail.com>
4  */
5 
6 #ifndef _MAX8907_H_
7 #define _MAX8907_H_
8 
9 #define MAX8907_LDO_NUM			20
10 #define MAX8907_SD_NUM			3
11 
12 /* Drivers name */
13 #define MAX8907_LDO_DRIVER		"max8907_ldo"
14 #define MAX8907_SD_DRIVER		"max8907_sd"
15 #define MAX8907_RST_DRIVER		"max8907_rst"
16 
17 /* MAX8907 register map */
18 #define MAX8907_REG_SDCTL1		0x04
19 #define MAX8907_REG_SDCTL2		0x07
20 #define MAX8907_REG_SDCTL3		0x0A
21 
22 #define MAX8907_REG_LDOCTL16		0x10
23 #define MAX8907_REG_LDOCTL17		0x14
24 #define MAX8907_REG_LDOCTL1		0x18
25 #define MAX8907_REG_LDOCTL2		0x1C
26 #define MAX8907_REG_LDOCTL3		0x20
27 #define MAX8907_REG_LDOCTL4		0x24
28 #define MAX8907_REG_LDOCTL5		0x28
29 #define MAX8907_REG_LDOCTL6		0x2C
30 #define MAX8907_REG_LDOCTL7		0x30
31 #define MAX8907_REG_LDOCTL8		0x34
32 #define MAX8907_REG_LDOCTL9		0x38
33 #define MAX8907_REG_LDOCTL10		0x3C
34 #define MAX8907_REG_LDOCTL11		0x40
35 #define MAX8907_REG_LDOCTL12		0x44
36 #define MAX8907_REG_LDOCTL13		0x48
37 #define MAX8907_REG_LDOCTL14		0x4C
38 #define MAX8907_REG_LDOCTL15		0x50
39 #define MAX8907_REG_LDOCTL19		0x5C
40 #define MAX8907_REG_LDOCTL18		0x72
41 #define MAX8907_REG_LDOCTL20		0x9C
42 
43 #define MAX8907_REG_RESET_CNFG		0x0F
44 #define   MASK_POWER_OFF		BIT(6)
45 
46 /* MAX8907 configuration values */
47 #define MAX8907_CTL			0
48 #define MAX8907_SEQCNT			1
49 #define MAX8907_VOUT			2
50 
51 /* mask bit fields */
52 #define MAX8907_MASK_LDO_SEQ		0x1C
53 #define MAX8907_MASK_LDO_EN		0x01
54 
55 /* Step-Down (SD) Regulator calculations */
56 #define SD1_VOLT_MAX			2225000
57 #define SD1_VOLT_MIN			650000
58 #define SD1_VOLT_STEP			25000
59 
60 #define SD2_VOLT_MAX			1425000
61 #define SD2_VOLT_MIN			637500
62 #define SD2_VOLT_STEP			12500
63 
64 #define SD3_VOLT_MAX			3900000
65 #define SD3_VOLT_MIN			750000
66 #define SD3_VOLT_STEP			50000
67 
68 /* Low-Dropout Linear (LDO) Regulator calculations */
69 #define LDO_750_VOLT_MAX		3900000
70 #define LDO_750_VOLT_MIN		750000
71 #define LDO_750_VOLT_STEP		50000
72 
73 #define LDO_650_VOLT_MAX		2225000
74 #define LDO_650_VOLT_MIN		650000
75 #define LDO_650_VOLT_STEP		25000
76 
77 #endif /* _MAX8907_H_ */
78