2 * Copyright (C) 2014 Gateworks Corporation
3 * Tim Harvey <tharvey@gateworks.com>
5 * SPDX-License-Identifier: GPL-2.0+
8 #ifndef __PFUZE100_PMIC_H_
9 #define __PFUZE100_PMIC_H_
11 /* PFUZE100 registers */
13 PFUZE100_DEVICEID = 0x00,
14 PFUZE100_REVID = 0x03,
15 PFUZE100_FABID = 0x04,
17 PFUZE100_SW1ABVOL = 0x20,
18 PFUZE100_SW1ABSTBY = 0x21,
19 PFUZE100_SW1ABOFF = 0x22,
20 PFUZE100_SW1ABMODE = 0x23,
21 PFUZE100_SW1ABCONF = 0x24,
22 PFUZE100_SW1CVOL = 0x2e,
23 PFUZE100_SW1CSTBY = 0x2f,
24 PFUZE100_SW1COFF = 0x30,
25 PFUZE100_SW1CMODE = 0x31,
26 PFUZE100_SW1CCONF = 0x32,
27 PFUZE100_SW2VOL = 0x35,
28 PFUZE100_SW2STBY = 0x36,
29 PFUZE100_SW2OFF = 0x37,
30 PFUZE100_SW2MODE = 0x38,
31 PFUZE100_SW2CONF = 0x39,
32 PFUZE100_SW3AVOL = 0x3c,
33 PFUZE100_SW3ASTBY = 0x3D,
34 PFUZE100_SW3AOFF = 0x3E,
35 PFUZE100_SW3AMODE = 0x3F,
36 PFUZE100_SW3ACONF = 0x40,
37 PFUZE100_SW3BVOL = 0x43,
38 PFUZE100_SW3BSTBY = 0x44,
39 PFUZE100_SW3BOFF = 0x45,
40 PFUZE100_SW3BMODE = 0x46,
41 PFUZE100_SW3BCONF = 0x47,
42 PFUZE100_SW4VOL = 0x4a,
43 PFUZE100_SW4STBY = 0x4b,
44 PFUZE100_SW4OFF = 0x4c,
45 PFUZE100_SW4MODE = 0x4d,
46 PFUZE100_SW4CONF = 0x4e,
47 PFUZE100_SWBSTCON1 = 0x66,
48 PFUZE100_VREFDDRCON = 0x6a,
49 PFUZE100_VSNVSVOL = 0x6b,
50 PFUZE100_VGEN1VOL = 0x6c,
51 PFUZE100_VGEN2VOL = 0x6d,
52 PFUZE100_VGEN3VOL = 0x6e,
53 PFUZE100_VGEN4VOL = 0x6f,
54 PFUZE100_VGEN5VOL = 0x70,
55 PFUZE100_VGEN6VOL = 0x71,
57 PMIC_NUM_OF_REGS = 0x7f,
64 #define PFUZE100_SW1ABC_SETP(x) ((x - 3000) / 250)
66 /* SW1A/B/C Output Voltage Configuration */
77 #define SW1x_0_550V 10
78 #define SW1x_0_575V 11
79 #define SW1x_0_600V 12
80 #define SW1x_0_625V 13
81 #define SW1x_0_650V 14
82 #define SW1x_0_675V 15
83 #define SW1x_0_700V 16
84 #define SW1x_0_725V 17
85 #define SW1x_0_750V 18
86 #define SW1x_0_775V 19
87 #define SW1x_0_800V 20
88 #define SW1x_0_825V 21
89 #define SW1x_0_850V 22
90 #define SW1x_0_875V 23
91 #define SW1x_0_900V 24
92 #define SW1x_0_925V 25
93 #define SW1x_0_950V 26
94 #define SW1x_0_975V 27
95 #define SW1x_1_000V 28
96 #define SW1x_1_025V 29
97 #define SW1x_1_050V 30
98 #define SW1x_1_075V 31
99 #define SW1x_1_100V 32
100 #define SW1x_1_125V 33
101 #define SW1x_1_150V 34
102 #define SW1x_1_175V 35
103 #define SW1x_1_200V 36
104 #define SW1x_1_225V 37
105 #define SW1x_1_250V 38
106 #define SW1x_1_275V 39
107 #define SW1x_1_300V 40
108 #define SW1x_1_325V 41
109 #define SW1x_1_350V 42
110 #define SW1x_1_375V 43
111 #define SW1x_1_400V 44
112 #define SW1x_1_425V 45
113 #define SW1x_1_450V 46
114 #define SW1x_1_475V 47
115 #define SW1x_1_500V 48
116 #define SW1x_1_525V 49
117 #define SW1x_1_550V 50
118 #define SW1x_1_575V 51
119 #define SW1x_1_600V 52
120 #define SW1x_1_625V 53
121 #define SW1x_1_650V 54
122 #define SW1x_1_675V 55
123 #define SW1x_1_700V 56
124 #define SW1x_1_725V 57
125 #define SW1x_1_750V 58
126 #define SW1x_1_775V 59
127 #define SW1x_1_800V 60
128 #define SW1x_1_825V 61
129 #define SW1x_1_850V 62
130 #define SW1x_1_875V 63
132 #define SW1x_NORMAL_MASK 0x3f
133 #define SW1x_STBY_MASK 0x3f
134 #define SW1x_OFF_MASK 0x3f
136 #define SW1xCONF_DVSSPEED_MASK 0xc0
137 #define SW1xCONF_DVSSPEED_2US 0x00
138 #define SW1xCONF_DVSSPEED_4US 0x40
139 #define SW1xCONF_DVSSPEED_8US 0x80
140 #define SW1xCONF_DVSSPEED_16US 0xc0
146 /* VGEN1/2 Voltage Configuration */
157 #define LDOA_1_30V 10
158 #define LDOA_1_35V 11
159 #define LDOA_1_40V 12
160 #define LDOA_1_45V 13
161 #define LDOA_1_50V 14
162 #define LDOA_1_55V 15
164 /* VGEN3/4/5/6 Voltage Configuration */
175 #define LDOB_2_80V 10
176 #define LDOB_2_90V 11
177 #define LDOB_3_00V 12
178 #define LDOB_3_10V 13
179 #define LDOB_3_20V 14
180 #define LDOB_3_30V 15
182 #define LDO_VOL_MASK 0xf
183 #define LDO_EN (1 << 4)
189 /* SWBST Output Voltage */
190 #define SWBST_5_00V 0
191 #define SWBST_5_05V 1
192 #define SWBST_5_10V 2
193 #define SWBST_5_15V 3
195 #define SWBST_VOL_MASK 0x3
196 #define SWBST_MODE_MASK 0xC
197 #define SWBST_MODE_OFF (0 << 2)
198 #define SWBST_MODE_PFM (1 << 2)
199 #define SWBST_MODE_AUTO (2 << 2)
200 #define SWBST_MODE_APS (3 << 2)
203 * Regulator Mode Control
205 * OFF: The regulator is switched off and the output voltage is discharged.
206 * PFM: In this mode, the regulator is always in PFM mode, which is useful
207 * at light loads for optimized efficiency.
208 * PWM: In this mode, the regulator is always in PWM mode operation
209 * regardless of load conditions.
210 * APS: In this mode, the regulator moves automatically between pulse
211 * skipping mode and PWM mode depending on load conditions.
214 * Normal Mode | Standby Mode | value
235 #define SWITCH_SIZE 0x7
237 int power_pfuze100_init(unsigned char bus);