1menuconfig POWER
2	 bool "Power"
3	 default y
4	 help
5	  Enable support for power control in U-Boot. This includes support
6	  for PMICs (Power-management Integrated Circuits) and some of the
7	  features provided by PMICs. In particular, voltage regulators can
8	  be used to enable/disable power and vary its voltage. That can be
9	  useful in U-Boot to turn on boot peripherals and adjust CPU voltage
10	  so that the clock speed can be increased. This enables the drivers
11	  in drivers/power, drivers/power/pmic and drivers/power/regulator
12	  as part of a build.
13
14if POWER
15
16config POWER_LEGACY
17	bool "Legacy power support"
18	help
19	  Note: This is a legacy option. Use DM_PMIC instead.
20
21	  Enable support for power control in U-Boot. This includes support
22	  for PMICs (Power-management Integrated Circuits) and some of the
23	  features provided by PMICs. In particular, voltage regulators can
24	  be used to enable/disable power and vary its voltage. That can be
25	  useful in U-Boot to turn on boot peripherals and adjust CPU voltage
26	  so that the clock speed can be increased. This enables the drivers
27	  in drivers/power, drivers/power/pmic and drivers/power/regulator
28	  as part of a build.
29
30config SPL_POWER_LEGACY
31	bool "Legacy power support in SPL"
32	depends on SPL && !SPL_DM_PMIC
33	default y if POWER_LEGACY
34	help
35	  Note: This is a legacy option. Use SPL_DM_PMIC instead.
36
37	  Enable support for power control in SPL. This includes support
38	  for PMICs (Power-management Integrated Circuits) and some of the
39	  features provided by PMICs. In particular, voltage regulators can
40	  be used to enable/disable power and vary its voltage. That can be
41	  useful in SPL to turn on boot peripherals and adjust CPU voltage
42	  so that the clock speed can be increased. This enables the drivers
43	  in drivers/power, drivers/power/pmic and drivers/power/regulator
44	  as part of a build.
45
46source "drivers/power/acpi_pmc/Kconfig"
47
48source "drivers/power/domain/Kconfig"
49
50source "drivers/power/pmic/Kconfig"
51
52source "drivers/power/regulator/Kconfig"
53
54choice
55	prompt "Select Sunxi PMIC Variant"
56	depends on ARCH_SUNXI
57	default AXP209_POWER if MACH_SUN4I || MACH_SUN5I || MACH_SUN7I
58	default AXP221_POWER if MACH_SUN6I || MACH_SUN8I_A23 || MACH_SUN8I_A33 || MACH_SUN8I_R40
59	default AXP818_POWER if MACH_SUN8I_A83T
60	default SUNXI_NO_PMIC if MACH_SUNXI_H3_H5 || MACH_SUN50I || MACH_SUN8I_V3S
61
62config SUNXI_NO_PMIC
63	bool "board without a pmic"
64	---help---
65	Select this for boards which do not use a PMIC.
66
67config AXP152_POWER
68	bool "axp152 pmic support"
69	depends on MACH_SUN5I
70	select AXP_PMIC_BUS
71	select CMD_POWEROFF
72	---help---
73	Select this to enable support for the axp152 pmic found on most
74	A10s boards.
75
76config AXP209_POWER
77	bool "axp209 pmic support"
78	depends on MACH_SUN4I || MACH_SUN5I || MACH_SUN7I || MACH_SUN8I_V3S
79	select AXP_PMIC_BUS
80	select CMD_POWEROFF
81	---help---
82	Select this to enable support for the axp209 pmic found on most
83	A10, A13 and A20 boards.
84
85config AXP221_POWER
86	bool "axp221 / axp223 pmic support"
87	depends on MACH_SUN6I || MACH_SUN8I_A23 || MACH_SUN8I_A33 || MACH_SUN8I_R40
88	select AXP_PMIC_BUS
89	select CMD_POWEROFF
90	---help---
91	Select this to enable support for the axp221/axp223 pmic found on most
92	A23 and A31 boards.
93
94config AXP305_POWER
95	bool "axp305 pmic support"
96	depends on MACH_SUN50I_H616
97	select AXP_PMIC_BUS
98	select CMD_POWEROFF
99	---help---
100	Select this to enable support for the axp305 pmic found on most
101	H616 boards.
102
103config AXP313_POWER
104	bool "axp313 pmic support"
105	depends on MACH_SUN50I_H616
106	select AXP_PMIC_BUS
107	select CMD_POWEROFF
108	---help---
109	Select this to enable support for the AXP313 PMIC found on some
110	H616 boards.
111
112config AXP717_POWER
113	bool "axp717 pmic support"
114	select AXP_PMIC_BUS
115	select CMD_POWEROFF
116	---help---
117	Select this to enable support for the AXP717 PMIC found on some boards.
118
119config AXP803_POWER
120	bool "AXP803 PMIC support"
121	select AXP_PMIC_BUS
122	---help---
123	Select this to enable support for the AXP803 PMIC found on some boards.
124
125config AXP809_POWER
126	bool "axp809 pmic support"
127	depends on MACH_SUN9I
128	select AXP_PMIC_BUS
129	select CMD_POWEROFF
130	---help---
131	Say y here to enable support for the axp809 pmic found on A80 boards.
132
133config AXP818_POWER
134	bool "axp818 pmic support"
135	depends on MACH_SUN8I_A83T
136	select AXP_PMIC_BUS
137	select CMD_POWEROFF
138	---help---
139	Say y here to enable support for the axp818 pmic found on
140	A83T dev board.
141
142config SY8106A_POWER
143	bool "SY8106A pmic support"
144	depends on MACH_SUNXI_H3_H5
145	---help---
146	Select this to enable support for the SY8106A pmic found on some
147	H3 boards.
148
149endchoice
150
151config AXP_I2C_ADDRESS
152	hex "AXP PMIC I2C address"
153	depends on ARCH_SUNXI && !SUNXI_NO_PMIC
154	default 0x36 if AXP305_POWER
155	default 0x36 if AXP313_POWER
156	default 0x30 if AXP152_POWER
157	default 0x34
158	---help---
159	I2C address of the AXP PMIC, used for the SPL only.
160
161config AXP_DCDC1_VOLT
162	int "axp pmic dcdc1 voltage"
163	depends on AXP221_POWER || AXP809_POWER || AXP818_POWER || AXP803_POWER
164	default 3300 if AXP818_POWER || MACH_SUN8I_R40 || AXP803_POWER
165	default 3000 if MACH_SUN6I || MACH_SUN8I || MACH_SUN9I
166	---help---
167	Set the voltage (mV) to program the axp pmic dcdc1 at, set to 0 to
168	disable dcdc1. On A23 / A31 / A33 (axp221) boards dcdc1 is used for
169	generic 3.3V IO voltage for external devices like the lcd-panal and
170	sdcard interfaces, etc. On most boards dcdc1 is undervolted to 3.0V to
171	save battery. On A31 devices dcdc1 is also used for VCC-IO. On A83T
172	dcdc1 is used for VCC-IO, nand, usb0, sd , etc. On A80 dcdc1 normally
173	powers some of the pingroups, NAND/eMMC, SD/MMC, and USB OTG.
174
175config AXP_DCDC2_VOLT
176	int "axp pmic dcdc2 voltage"
177	depends on AXP152_POWER || AXP209_POWER || AXP221_POWER || AXP809_POWER || AXP818_POWER || AXP313_POWER || AXP717_POWER || AXP803_POWER
178	default 900 if AXP818_POWER
179	default 1400 if AXP152_POWER || AXP209_POWER
180	default 1000 if AXP313_POWER
181	default 1000 if AXP717_POWER
182	default 1000 if AXP803_POWER
183	default 1200 if MACH_SUN6I
184	default 1100 if MACH_SUN8I
185	default 0 if MACH_SUN9I
186	---help---
187	Set the voltage (mV) to program the axp pmic dcdc2 at, set to 0 to
188	disable dcdc2.
189	On A10(s) / A13 / A20 boards dcdc2 is VDD-CPU and should be 1.4V.
190	On A31 boards dcdc2 is used for VDD-GPU and should be 1.2V.
191	On A23/A33 boards dcdc2 is used for VDD-SYS and should be 1.1V.
192	On A80 boards dcdc2 powers the GPU and can be left off.
193	On A83T boards dcdc2 is used for VDD-CPUA(cluster 0) and should be 0.9V.
194	On R40 boards dcdc2 is VDD-CPU and should be 1.1V
195	On boards using the AXP313 or AXP717 it's often VDD-CPU.
196
197config AXP_DCDC3_VOLT
198	int "axp pmic dcdc3 voltage"
199	depends on AXP152_POWER || AXP209_POWER || AXP221_POWER || AXP809_POWER || AXP818_POWER || AXP313_POWER || AXP717_POWER
200	default 900 if AXP809_POWER || AXP818_POWER
201	default 1500 if AXP152_POWER
202	default 1250 if AXP209_POWER
203	default 1100 if AXP313_POWER
204	default 1100 if MACH_SUN8I_R40
205	default 1200 if MACH_SUN6I || MACH_SUN8I
206	---help---
207	Set the voltage (mV) to program the axp pmic dcdc3 at, set to 0 to
208	disable dcdc3.
209	On A10(s) / A13 / A20 boards with an axp209 dcdc3 is VDD-INT-DLL and
210	should be 1.25V.
211	On A10s boards with an axp152 dcdc3 is VCC-DRAM and should be 1.5V.
212	On A23 / A31 / A33 boards dcdc3 is VDD-CPU and should be 1.2V.
213	On A80 boards dcdc3 is used for VDD-CPUA(cluster 0) and should be 0.9V.
214	On A83T boards dcdc3 is used for VDD-CPUB(cluster 1) and should be 0.9V.
215	On R40 boards dcdc3 is VDD-SYS and VDD-GPU and should be 1.1V.
216	On boards using the AXP313 or AXP717 it's often VDD-DRAM and should
217	be 1.1V for LPDDR4.
218
219config AXP_DCDC4_VOLT
220	int "axp pmic dcdc4 voltage"
221	depends on AXP152_POWER || AXP221_POWER || AXP809_POWER || AXP305_POWER
222	default 1250 if AXP152_POWER
223	default 1200 if MACH_SUN6I
224	default 0 if MACH_SUN8I
225	default 900 if MACH_SUN9I
226	default 1500 if AXP305_POWER
227	---help---
228	Set the voltage (mV) to program the axp pmic dcdc4 at, set to 0 to
229	disable dcdc4.
230	On A10s boards with an axp152 dcdc4 is VDD-INT-DLL and should be 1.25V.
231	On A31 boards dcdc4 is used for VDD-SYS and should be 1.2V.
232	On A23 / A33 boards dcdc4 is unused and should be disabled.
233	On A80 boards dcdc4 powers VDD-SYS, HDMI, USB OTG and should be 0.9V.
234	On A83T boards dcdc4 is used for VDD-GPU.
235	On H616 boards dcdcd is used for VCC-DRAM.
236
237config AXP_DCDC5_VOLT
238	int "axp pmic dcdc5 voltage"
239	depends on AXP221_POWER || AXP809_POWER || AXP818_POWER || AXP803_POWER
240	default 1500 if MACH_SUN6I || MACH_SUN8I || MACH_SUN9I
241	---help---
242	Set the voltage (mV) to program the axp pmic dcdc5 at, set to 0 to
243	disable dcdc5.
244	On A23 / A31 / A33 / A80 / A83T / R40 boards dcdc5 is VCC-DRAM and
245	should be 1.5V, 1.35V if DDR3L is used.
246
247config AXP_ALDO1_VOLT
248	int "axp pmic (a)ldo1 voltage"
249	depends on AXP221_POWER || AXP809_POWER || AXP818_POWER
250	default 0 if MACH_SUN6I || MACH_SUN8I_R40
251	default 1800 if MACH_SUN8I_A83T
252	default 3000 if MACH_SUN8I || MACH_SUN9I
253	---help---
254	Set the voltage (mV) to program the axp pmic aldo1 at, set to 0 to
255	disable aldo1.
256	On A31 boards aldo1 is often used to power the wifi module.
257	On A23 / A33 boards aldo1 is used for VCC-IO and should be 3.0V.
258	On A80 boards aldo1 powers the USB hosts and should be 3.0V.
259	On A83T / H8 boards aldo1 is used for MIPI CSI, DSI, HDMI, EFUSE, and
260	should be 1.8V.
261
262config AXP_ALDO2_VOLT
263	int "axp pmic (a)ldo2 voltage"
264	depends on AXP152_POWER || AXP209_POWER || AXP221_POWER || AXP809_POWER || AXP818_POWER
265	default 3000 if AXP152_POWER || AXP209_POWER
266	default 0 if MACH_SUN6I || MACH_SUN9I
267	default 1800 if MACH_SUN8I_A83T
268	default 2500 if MACH_SUN8I
269	---help---
270	Set the voltage (mV) to program the axp pmic aldo2 at, set to 0 to
271	disable aldo2.
272	On A10(s) / A13 / A20 boards aldo2 is AVCC and should be 3.0V.
273	On A31 boards aldo2 is typically unused and should be disabled.
274	On A31 boards aldo2 may be used for LPDDR2 then it should be 1.8V.
275	On A23 / A33 boards aldo2 is used for VDD-DLL and should be 2.5V.
276	On A80 boards aldo2 powers PB pingroup and camera IO and can be left off.
277	On A83T / H8 boards aldo2 powers VDD-DLL, VCC18-PLL, CPVDD, VDD18-ADC,
278	LPDDR2, and the codec. It should be 1.8V.
279
280config AXP_ALDO3_VOLT
281	int "axp pmic (a)ldo3 voltage"
282	depends on AXP209_POWER || AXP221_POWER || AXP809_POWER || AXP818_POWER
283	default 0 if AXP209_POWER || MACH_SUN9I
284	default 3000 if MACH_SUN6I || MACH_SUN8I
285	---help---
286	Set the voltage (mV) to program the axp pmic aldo3 at, set to 0 to
287	disable aldo3.
288	On A10(s) / A13 / A20 boards aldo3 should be 2.8V.
289	On A23 / A31 / A33 / R40 boards aldo3 is VCC-PLL and AVCC and should
290	be 3.0V.
291	On A80 boards aldo3 is normally not used.
292	On A83T / H8 boards aldo3 is AVCC, VCC-PL, and VCC-LED, and should be
293	3.0V.
294
295choice
296	prompt "axp pmic (a)ldo3 voltage rate control"
297	depends on AXP209_POWER
298	default AXP_ALDO3_VOLT_SLOPE_NONE
299	---help---
300	The AXP can slowly ramp up voltage to reduce the inrush current when
301	changing voltages.
302	Note, this does not apply when enabling/disabling LDO3. See
303	"axp pmic (a)ldo3 inrush quirk" below to enable a slew rate to limit
304	inrush current on broken board designs.
305
306config AXP_ALDO3_VOLT_SLOPE_NONE
307	bool "No voltage slope"
308	---help---
309	Tries to reach the next voltage setting near instantaneously. Measurements
310	indicate that this is about 0.0167 V/uS.
311
312config AXP_ALDO3_VOLT_SLOPE_16
313	bool "1.6 mV per uS"
314	---help---
315	Increases the voltage by 1.6 mV per uS until the final voltage has
316	been reached. Note that the scaling is in 25 mV steps and thus
317	the slew rate in reality is about 25 mV/31.250 uS.
318
319config AXP_ALDO3_VOLT_SLOPE_08
320	bool "0.8 mV per uS"
321	---help---
322	Increases the voltage by 0.8 mV per uS until the final voltage has
323	been reached. Note that the scaling is in 25 mV steps however and thus
324	the slew rate in reality is about 25 mV/15.625 uS.
325	This is the slowest supported rate.
326
327endchoice
328
329config AXP_ALDO3_INRUSH_QUIRK
330	bool "axp pmic (a)ldo3 inrush quirk"
331	depends on AXP209_POWER
332	---help---
333	The reference design denotes a value of 4.7 uF for the output capacitor
334	of LDO3. Some boards have too high capacitance causing 	an inrush current
335	and resulting an AXP209 shutdown.
336
337config AXP_ALDO4_VOLT
338	int "axp pmic (a)ldo4 voltage"
339	depends on AXP209_POWER
340	default 0 if AXP209_POWER
341	---help---
342	Set the voltage (mV) to program the axp pmic aldo4 at, set to 0 to
343	disable aldo4.
344	On A10(s) / A13 / A20 boards aldo4 should be 2.8V.
345
346config AXP_DLDO1_VOLT
347	int "axp pmic dldo1 voltage"
348	depends on AXP221_POWER || AXP809_POWER || AXP818_POWER
349	default 0
350	---help---
351	Set the voltage (mV) to program the axp pmic dldo1 at, set to 0 to
352	disable dldo1. On sun6i (A31) boards with ethernet dldo1 is often used
353	to power the ethernet phy. On A23, A33 and A80 boards this is often
354	used to power the wifi.
355
356config AXP_DLDO2_VOLT
357	int "axp pmic dldo2 voltage"
358	depends on AXP221_POWER || AXP809_POWER || AXP818_POWER
359	default 3000 if MACH_SUN9I
360	default 0
361	---help---
362	Set the voltage (mV) to program the axp pmic dldo2 at, set to 0 to
363	disable dldo2.
364	On A80 boards dldo2 normally powers the PL pins and should be 3.0V.
365
366config AXP_DLDO3_VOLT
367	int "axp pmic dldo3 voltage"
368	depends on AXP221_POWER || AXP818_POWER
369	default 0
370	---help---
371	Set the voltage (mV) to program the axp pmic dldo3 at, set to 0 to
372	disable dldo3.
373
374config AXP_DLDO4_VOLT
375	int "axp pmic dldo4 voltage"
376	depends on AXP221_POWER || AXP818_POWER
377	default 0
378	---help---
379	Set the voltage (mV) to program the axp pmic dldo4 at, set to 0 to
380	disable dldo4.
381
382config AXP_ELDO1_VOLT
383	int "axp pmic eldo1 voltage"
384	depends on AXP221_POWER || AXP809_POWER || AXP818_POWER
385	default 0
386	---help---
387	Set the voltage (mV) to program the axp pmic eldo1 at, set to 0 to
388	disable eldo1.
389
390config AXP_ELDO2_VOLT
391	int "axp pmic eldo2 voltage"
392	depends on AXP221_POWER || AXP809_POWER || AXP818_POWER
393	default 0
394	---help---
395	Set the voltage (mV) to program the axp pmic eldo2 at, set to 0 to
396	disable eldo2.
397
398config AXP_ELDO3_VOLT
399	int "axp pmic eldo3 voltage"
400	depends on AXP221_POWER || AXP809_POWER || AXP818_POWER
401	default 3000 if MACH_SUN9I
402	default 0
403	---help---
404	Set the voltage (mV) to program the axp pmic eldo3 at, set to 0 to
405	disable eldo3. On some A31(s) tablets it might be used to supply
406	1.2V for the SSD2828 chip (converter of parallel LCD interface
407	into MIPI DSI).
408	On A80 boards it powers the PM pingroup and should be 3.0V.
409
410config AXP_FLDO1_VOLT
411	int "axp pmic fldo1 voltage"
412	depends on AXP818_POWER
413	default 0 if MACH_SUN8I_A83T
414	---help---
415	Set the voltage (mV) to program the axp pmic fldo1 at, set to 0 to
416	disable fldo1.
417	On A83T / H8 boards fldo1 is VCC-HSIC and should be 1.2V if HSIC is
418	used.
419
420config AXP_FLDO2_VOLT
421	int "axp pmic fldo2 voltage"
422	depends on AXP818_POWER
423	default 900 if MACH_SUN8I_A83T
424	---help---
425	Set the voltage (mV) to program the axp pmic fldo2 at, set to 0 to
426	disable fldo2.
427	On A83T / H8 boards fldo2 is VCC-CPUS and should be 0.9V.
428
429config AXP_FLDO3_VOLT
430	int "axp pmic fldo3 voltage"
431	depends on AXP818_POWER
432	default 0
433	---help---
434	Set the voltage (mV) to program the axp pmic fldo3 at, set to 0 to
435	disable fldo3.
436
437config AXP_SW_ON
438	bool "axp pmic sw on"
439	depends on AXP809_POWER || AXP818_POWER
440	---help---
441	Enable to turn on axp pmic sw.
442
443config SY8106A_VOUT1_VOLT
444	int "SY8106A pmic VOUT1 voltage"
445	depends on SY8106A_POWER
446	default 1200
447	---help---
448	Set the voltage (mV) to program the SY8106A pmic VOUT1. This
449	is typically used to power the VDD-CPU and should be 1200mV.
450	Values can range from 680mV till 1950mV.
451
452config TPS6586X_POWER
453	bool "Enable legacy driver for TI TPS6586x power management chip"
454
455config TWL4030_POWER
456	depends on OMAP34XX
457	bool "Enable driver for TI TWL4030 power management chip"
458	imply CMD_POWEROFF
459	---help---
460	The TWL4030 in a combination audio CODEC/power management with
461	GPIO and it is commonly used with the OMAP3 family of processors
462
463config POWER_MT6323
464	bool "Poweroff driver for mediatek mt6323"
465	select CMD_POWEROFF
466	help
467	  This adds poweroff driver for mt6323
468	  this pmic is used on mt7623 / Bananapi R2
469
470config PALMAS_POWER
471	bool "Palmas power support"
472	depends on OMAP54XX
473
474config POWER_FSL
475	bool "Power control (legacy) for Freescale / NXP platforms"
476	depends on POWER_LEGACY
477
478config POWER_I2C
479	bool "I2C-based power control for legacy power"
480	depends on POWER_LEGACY
481	help
482	  Enable this to use the I2C driver designed for the legacy PMIC
483	  interface.
484
485	  Not to be used for new designs and existing ones should be moved to
486	  the new PMIC interface based on driver model.
487
488config POWER_SPI
489	bool "SPI-based power control for legacy power_fsl driver"
490	depends on POWER_FSL && !POWER_I2C
491
492config SPL_POWER_I2C
493	bool "I2C-based power control for legacy power"
494	depends on SPL_POWER_LEGACY
495	default y if POWER_I2C
496	help
497	  Enable this to use the I2C driver designed for the legacy PMIC
498	  interface.
499
500	  Not to be used for new designs and existing ones should be moved to
501	  the new PMIC interface based on driver model.
502
503choice
504	prompt "PMIC chip"
505	default POWER_FSL_MC13892
506	depends on POWER_FSL && POWER_I2C
507
508config POWER_FSL_MC13892
509	bool "MC13892"
510
511config POWER_FSL_MC34704
512	bool "MC34704"
513
514endchoice
515
516endif
517