xref: /openbmc/linux/include/linux/mfd/tps6586x.h (revision 669ca030)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __LINUX_MFD_TPS6586X_H
3 #define __LINUX_MFD_TPS6586X_H
4 
5 #define TPS6586X_SLEW_RATE_INSTANTLY	0x00
6 #define TPS6586X_SLEW_RATE_110UV	0x01
7 #define TPS6586X_SLEW_RATE_220UV	0x02
8 #define TPS6586X_SLEW_RATE_440UV	0x03
9 #define TPS6586X_SLEW_RATE_880UV	0x04
10 #define TPS6586X_SLEW_RATE_1760UV	0x05
11 #define TPS6586X_SLEW_RATE_3520UV	0x06
12 #define TPS6586X_SLEW_RATE_7040UV	0x07
13 
14 #define TPS6586X_SLEW_RATE_SET		0x08
15 #define TPS6586X_SLEW_RATE_MASK         0x07
16 
17 /* VERSION CRC */
18 #define TPS658621A	0x15
19 #define TPS658621CD	0x2c
20 #define TPS658623	0x1b
21 #define TPS658624	0x0a
22 #define TPS658640	0x01
23 #define TPS658640v2	0x02
24 #define TPS658643	0x03
25 
26 enum {
27 	TPS6586X_ID_SYS,
28 	TPS6586X_ID_SM_0,
29 	TPS6586X_ID_SM_1,
30 	TPS6586X_ID_SM_2,
31 	TPS6586X_ID_LDO_0,
32 	TPS6586X_ID_LDO_1,
33 	TPS6586X_ID_LDO_2,
34 	TPS6586X_ID_LDO_3,
35 	TPS6586X_ID_LDO_4,
36 	TPS6586X_ID_LDO_5,
37 	TPS6586X_ID_LDO_6,
38 	TPS6586X_ID_LDO_7,
39 	TPS6586X_ID_LDO_8,
40 	TPS6586X_ID_LDO_9,
41 	TPS6586X_ID_LDO_RTC,
42 	TPS6586X_ID_MAX_REGULATOR,
43 };
44 
45 enum {
46 	TPS6586X_INT_PLDO_0,
47 	TPS6586X_INT_PLDO_1,
48 	TPS6586X_INT_PLDO_2,
49 	TPS6586X_INT_PLDO_3,
50 	TPS6586X_INT_PLDO_4,
51 	TPS6586X_INT_PLDO_5,
52 	TPS6586X_INT_PLDO_6,
53 	TPS6586X_INT_PLDO_7,
54 	TPS6586X_INT_COMP_DET,
55 	TPS6586X_INT_ADC,
56 	TPS6586X_INT_PLDO_8,
57 	TPS6586X_INT_PLDO_9,
58 	TPS6586X_INT_PSM_0,
59 	TPS6586X_INT_PSM_1,
60 	TPS6586X_INT_PSM_2,
61 	TPS6586X_INT_PSM_3,
62 	TPS6586X_INT_RTC_ALM1,
63 	TPS6586X_INT_ACUSB_OVP,
64 	TPS6586X_INT_USB_DET,
65 	TPS6586X_INT_AC_DET,
66 	TPS6586X_INT_BAT_DET,
67 	TPS6586X_INT_CHG_STAT,
68 	TPS6586X_INT_CHG_TEMP,
69 	TPS6586X_INT_PP,
70 	TPS6586X_INT_RESUME,
71 	TPS6586X_INT_LOW_SYS,
72 	TPS6586X_INT_RTC_ALM2,
73 };
74 
75 struct tps6586x_settings {
76 	int slew_rate;
77 };
78 
79 struct tps6586x_subdev_info {
80 	int		id;
81 	const char	*name;
82 	void		*platform_data;
83 	struct device_node *of_node;
84 };
85 
86 struct tps6586x_platform_data {
87 	int num_subdevs;
88 	struct tps6586x_subdev_info *subdevs;
89 
90 	int gpio_base;
91 	int irq_base;
92 	bool pm_off;
93 
94 	struct regulator_init_data *reg_init_data[TPS6586X_ID_MAX_REGULATOR];
95 };
96 
97 /*
98  * NOTE: the functions below are not intended for use outside
99  * of the TPS6586X sub-device drivers
100  */
101 extern int tps6586x_write(struct device *dev, int reg, uint8_t val);
102 extern int tps6586x_writes(struct device *dev, int reg, int len, uint8_t *val);
103 extern int tps6586x_read(struct device *dev, int reg, uint8_t *val);
104 extern int tps6586x_reads(struct device *dev, int reg, int len, uint8_t *val);
105 extern int tps6586x_set_bits(struct device *dev, int reg, uint8_t bit_mask);
106 extern int tps6586x_clr_bits(struct device *dev, int reg, uint8_t bit_mask);
107 extern int tps6586x_update(struct device *dev, int reg, uint8_t val,
108 			   uint8_t mask);
109 extern int tps6586x_irq_get_virq(struct device *dev, int irq);
110 extern int tps6586x_get_version(struct device *dev);
111 
112 #endif /*__LINUX_MFD_TPS6586X_H */
113