blob: f8da0e152567059e0d0928c844e70dda7a94cc4a [file] [log] [blame]
Mike Rapoportc6c19332010-08-11 01:11:04 +02001#ifndef __LINUX_MFD_TPS6586X_H
2#define __LINUX_MFD_TPS6586X_H
3
Xin Xie500c5242011-08-09 18:47:50 +08004#define TPS6586X_SLEW_RATE_INSTANTLY 0x00
5#define TPS6586X_SLEW_RATE_110UV 0x01
6#define TPS6586X_SLEW_RATE_220UV 0x02
7#define TPS6586X_SLEW_RATE_440UV 0x03
8#define TPS6586X_SLEW_RATE_880UV 0x04
9#define TPS6586X_SLEW_RATE_1760UV 0x05
10#define TPS6586X_SLEW_RATE_3520UV 0x06
11#define TPS6586X_SLEW_RATE_7040UV 0x07
12
13#define TPS6586X_SLEW_RATE_SET 0x08
14#define TPS6586X_SLEW_RATE_MASK 0x07
15
Mike Rapoportc6c19332010-08-11 01:11:04 +020016enum {
Laxman Dewangan9394b802012-09-04 14:43:39 -060017 TPS6586X_ID_SYS,
Mike Rapoportc6c19332010-08-11 01:11:04 +020018 TPS6586X_ID_SM_0,
19 TPS6586X_ID_SM_1,
20 TPS6586X_ID_SM_2,
21 TPS6586X_ID_LDO_0,
22 TPS6586X_ID_LDO_1,
23 TPS6586X_ID_LDO_2,
24 TPS6586X_ID_LDO_3,
25 TPS6586X_ID_LDO_4,
26 TPS6586X_ID_LDO_5,
27 TPS6586X_ID_LDO_6,
28 TPS6586X_ID_LDO_7,
29 TPS6586X_ID_LDO_8,
30 TPS6586X_ID_LDO_9,
31 TPS6586X_ID_LDO_RTC,
Laxman Dewangan64e48162012-10-18 19:36:09 +053032 TPS6586X_ID_MAX_REGULATOR,
Mike Rapoportc6c19332010-08-11 01:11:04 +020033};
34
Gary Kingc26448c2010-09-20 00:18:27 +020035enum {
36 TPS6586X_INT_PLDO_0,
37 TPS6586X_INT_PLDO_1,
38 TPS6586X_INT_PLDO_2,
39 TPS6586X_INT_PLDO_3,
40 TPS6586X_INT_PLDO_4,
41 TPS6586X_INT_PLDO_5,
42 TPS6586X_INT_PLDO_6,
43 TPS6586X_INT_PLDO_7,
44 TPS6586X_INT_COMP_DET,
45 TPS6586X_INT_ADC,
46 TPS6586X_INT_PLDO_8,
47 TPS6586X_INT_PLDO_9,
48 TPS6586X_INT_PSM_0,
49 TPS6586X_INT_PSM_1,
50 TPS6586X_INT_PSM_2,
51 TPS6586X_INT_PSM_3,
52 TPS6586X_INT_RTC_ALM1,
53 TPS6586X_INT_ACUSB_OVP,
54 TPS6586X_INT_USB_DET,
55 TPS6586X_INT_AC_DET,
56 TPS6586X_INT_BAT_DET,
57 TPS6586X_INT_CHG_STAT,
58 TPS6586X_INT_CHG_TEMP,
59 TPS6586X_INT_PP,
60 TPS6586X_INT_RESUME,
61 TPS6586X_INT_LOW_SYS,
62 TPS6586X_INT_RTC_ALM2,
63};
64
Xin Xie500c5242011-08-09 18:47:50 +080065struct tps6586x_settings {
66 int slew_rate;
67};
68
Mike Rapoportc6c19332010-08-11 01:11:04 +020069struct tps6586x_subdev_info {
70 int id;
71 const char *name;
72 void *platform_data;
Thierry Reding62f6b082012-04-26 16:52:21 +020073 struct device_node *of_node;
Mike Rapoportc6c19332010-08-11 01:11:04 +020074};
75
76struct tps6586x_platform_data {
77 int num_subdevs;
78 struct tps6586x_subdev_info *subdevs;
79
80 int gpio_base;
Gary Kingc26448c2010-09-20 00:18:27 +020081 int irq_base;
Bill Huang004c15a2012-08-19 18:07:55 -070082 bool pm_off;
Laxman Dewangan64e48162012-10-18 19:36:09 +053083
84 struct regulator_init_data *reg_init_data[TPS6586X_ID_MAX_REGULATOR];
Mike Rapoportc6c19332010-08-11 01:11:04 +020085};
86
87/*
88 * NOTE: the functions below are not intended for use outside
89 * of the TPS6586X sub-device drivers
90 */
91extern int tps6586x_write(struct device *dev, int reg, uint8_t val);
92extern int tps6586x_writes(struct device *dev, int reg, int len, uint8_t *val);
93extern int tps6586x_read(struct device *dev, int reg, uint8_t *val);
94extern int tps6586x_reads(struct device *dev, int reg, int len, uint8_t *val);
95extern int tps6586x_set_bits(struct device *dev, int reg, uint8_t bit_mask);
96extern int tps6586x_clr_bits(struct device *dev, int reg, uint8_t bit_mask);
97extern int tps6586x_update(struct device *dev, int reg, uint8_t val,
98 uint8_t mask);
99
100#endif /*__LINUX_MFD_TPS6586X_H */