xref: /openbmc/linux/include/linux/mfd/max8998.h (revision f66501dc)
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * max8998.h - Voltage regulator driver for the Maxim 8998
4  *
5  *  Copyright (C) 2009-2010 Samsung Electrnoics
6  *  Kyungmin Park <kyungmin.park@samsung.com>
7  *  Marek Szyprowski <m.szyprowski@samsung.com>
8  */
9 
10 #ifndef __LINUX_MFD_MAX8998_H
11 #define __LINUX_MFD_MAX8998_H
12 
13 #include <linux/regulator/machine.h>
14 
15 /* MAX 8998 regulator ids */
16 enum {
17 	MAX8998_LDO2 = 2,
18 	MAX8998_LDO3,
19 	MAX8998_LDO4,
20 	MAX8998_LDO5,
21 	MAX8998_LDO6,
22 	MAX8998_LDO7,
23 	MAX8998_LDO8,
24 	MAX8998_LDO9,
25 	MAX8998_LDO10,
26 	MAX8998_LDO11,
27 	MAX8998_LDO12,
28 	MAX8998_LDO13,
29 	MAX8998_LDO14,
30 	MAX8998_LDO15,
31 	MAX8998_LDO16,
32 	MAX8998_LDO17,
33 	MAX8998_BUCK1,
34 	MAX8998_BUCK2,
35 	MAX8998_BUCK3,
36 	MAX8998_BUCK4,
37 	MAX8998_EN32KHZ_AP,
38 	MAX8998_EN32KHZ_CP,
39 	MAX8998_ENVICHG,
40 	MAX8998_ESAFEOUT1,
41 	MAX8998_ESAFEOUT2,
42 };
43 
44 /**
45  * max8998_regulator_data - regulator data
46  * @id: regulator id
47  * @initdata: regulator init data (contraints, supplies, ...)
48  * @reg_node: DT node of regulator (unused on non-DT platforms)
49  */
50 struct max8998_regulator_data {
51 	int				id;
52 	struct regulator_init_data	*initdata;
53 	struct device_node		*reg_node;
54 };
55 
56 /**
57  * struct max8998_board - packages regulator init data
58  * @regulators: array of defined regulators
59  * @num_regulators: number of regulators used
60  * @irq_base: base IRQ number for max8998, required for IRQs
61  * @ono: power onoff IRQ number for max8998
62  * @buck_voltage_lock: Do NOT change the values of the following six
63  *   registers set by buck?_voltage?. The voltage of BUCK1/2 cannot
64  *   be other than the preset values.
65  * @buck1_voltage: BUCK1 DVS mode 1 voltage registers
66  * @buck2_voltage: BUCK2 DVS mode 2 voltage registers
67  * @buck1_set1: BUCK1 gpio pin 1 to set output voltage
68  * @buck1_set2: BUCK1 gpio pin 2 to set output voltage
69  * @buck1_default_idx: Default for BUCK1 gpio pin 1, 2
70  * @buck2_set3: BUCK2 gpio pin to set output voltage
71  * @buck2_default_idx: Default for BUCK2 gpio pin.
72  * @wakeup: Allow to wake up from suspend
73  * @rtc_delay: LP3974 RTC chip bug that requires delay after a register
74  * write before reading it.
75  * @eoc: End of Charge Level in percent: 10% ~ 45% by 5% step
76  *   If it equals 0, leave it unchanged.
77  *   Otherwise, it is a invalid value.
78  * @restart: Restart Level in mV: 100, 150, 200, and -1 for disable.
79  *   If it equals 0, leave it unchanged.
80  *   Otherwise, it is a invalid value.
81  * @timeout: Full Timeout in hours: 5, 6, 7, and -1 for disable.
82  *   If it equals 0, leave it unchanged.
83  *   Otherwise, leave it unchanged.
84  */
85 struct max8998_platform_data {
86 	struct max8998_regulator_data	*regulators;
87 	int				num_regulators;
88 	unsigned int			irq_base;
89 	int				ono;
90 	bool				buck_voltage_lock;
91 	int				buck1_voltage[4];
92 	int				buck2_voltage[2];
93 	int				buck1_set1;
94 	int				buck1_set2;
95 	int				buck1_default_idx;
96 	int				buck2_set3;
97 	int				buck2_default_idx;
98 	bool				wakeup;
99 	bool				rtc_delay;
100 	int				eoc;
101 	int				restart;
102 	int				timeout;
103 };
104 
105 #endif /*  __LINUX_MFD_MAX8998_H */
106