blob: f350fd0ba1dfd566374afb8afb86fdf1d1ba95ef [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 {
17 TPS6586X_ID_SM_0,
18 TPS6586X_ID_SM_1,
19 TPS6586X_ID_SM_2,
20 TPS6586X_ID_LDO_0,
21 TPS6586X_ID_LDO_1,
22 TPS6586X_ID_LDO_2,
23 TPS6586X_ID_LDO_3,
24 TPS6586X_ID_LDO_4,
25 TPS6586X_ID_LDO_5,
26 TPS6586X_ID_LDO_6,
27 TPS6586X_ID_LDO_7,
28 TPS6586X_ID_LDO_8,
29 TPS6586X_ID_LDO_9,
30 TPS6586X_ID_LDO_RTC,
31};
32
Gary Kingc26448c2010-09-20 00:18:27 +020033enum {
34 TPS6586X_INT_PLDO_0,
35 TPS6586X_INT_PLDO_1,
36 TPS6586X_INT_PLDO_2,
37 TPS6586X_INT_PLDO_3,
38 TPS6586X_INT_PLDO_4,
39 TPS6586X_INT_PLDO_5,
40 TPS6586X_INT_PLDO_6,
41 TPS6586X_INT_PLDO_7,
42 TPS6586X_INT_COMP_DET,
43 TPS6586X_INT_ADC,
44 TPS6586X_INT_PLDO_8,
45 TPS6586X_INT_PLDO_9,
46 TPS6586X_INT_PSM_0,
47 TPS6586X_INT_PSM_1,
48 TPS6586X_INT_PSM_2,
49 TPS6586X_INT_PSM_3,
50 TPS6586X_INT_RTC_ALM1,
51 TPS6586X_INT_ACUSB_OVP,
52 TPS6586X_INT_USB_DET,
53 TPS6586X_INT_AC_DET,
54 TPS6586X_INT_BAT_DET,
55 TPS6586X_INT_CHG_STAT,
56 TPS6586X_INT_CHG_TEMP,
57 TPS6586X_INT_PP,
58 TPS6586X_INT_RESUME,
59 TPS6586X_INT_LOW_SYS,
60 TPS6586X_INT_RTC_ALM2,
61};
62
Xin Xie500c5242011-08-09 18:47:50 +080063struct tps6586x_settings {
64 int slew_rate;
65};
66
Mike Rapoportc6c19332010-08-11 01:11:04 +020067struct tps6586x_subdev_info {
68 int id;
69 const char *name;
70 void *platform_data;
Thierry Reding62f6b082012-04-26 16:52:21 +020071 struct device_node *of_node;
Mike Rapoportc6c19332010-08-11 01:11:04 +020072};
73
74struct tps6586x_platform_data {
75 int num_subdevs;
76 struct tps6586x_subdev_info *subdevs;
77
78 int gpio_base;
Gary Kingc26448c2010-09-20 00:18:27 +020079 int irq_base;
Mike Rapoportc6c19332010-08-11 01:11:04 +020080};
81
82/*
83 * NOTE: the functions below are not intended for use outside
84 * of the TPS6586X sub-device drivers
85 */
86extern int tps6586x_write(struct device *dev, int reg, uint8_t val);
87extern int tps6586x_writes(struct device *dev, int reg, int len, uint8_t *val);
88extern int tps6586x_read(struct device *dev, int reg, uint8_t *val);
89extern int tps6586x_reads(struct device *dev, int reg, int len, uint8_t *val);
90extern int tps6586x_set_bits(struct device *dev, int reg, uint8_t bit_mask);
91extern int tps6586x_clr_bits(struct device *dev, int reg, uint8_t bit_mask);
92extern int tps6586x_update(struct device *dev, int reg, uint8_t val,
93 uint8_t mask);
94
95#endif /*__LINUX_MFD_TPS6586X_H */