Mike Rapoport | c6c1933 | 2010-08-11 01:11:04 +0200 | [diff] [blame] | 1 | #ifndef __LINUX_MFD_TPS6586X_H |
| 2 | #define __LINUX_MFD_TPS6586X_H |
| 3 | |
Xin Xie | 500c524 | 2011-08-09 18:47:50 +0800 | [diff] [blame] | 4 | #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 | |
Stefan Agner | e0a3da8 | 2013-12-06 13:51:45 +0100 | [diff] [blame] | 16 | /* VERSION CRC */ |
| 17 | #define TPS658621A 0x15 |
| 18 | #define TPS658621CD 0x2c |
| 19 | #define TPS658623 0x1b |
| 20 | #define TPS658643 0x03 |
| 21 | |
Mike Rapoport | c6c1933 | 2010-08-11 01:11:04 +0200 | [diff] [blame] | 22 | enum { |
Laxman Dewangan | 9394b80 | 2012-09-04 14:43:39 -0600 | [diff] [blame] | 23 | TPS6586X_ID_SYS, |
Mike Rapoport | c6c1933 | 2010-08-11 01:11:04 +0200 | [diff] [blame] | 24 | TPS6586X_ID_SM_0, |
| 25 | TPS6586X_ID_SM_1, |
| 26 | TPS6586X_ID_SM_2, |
| 27 | TPS6586X_ID_LDO_0, |
| 28 | TPS6586X_ID_LDO_1, |
| 29 | TPS6586X_ID_LDO_2, |
| 30 | TPS6586X_ID_LDO_3, |
| 31 | TPS6586X_ID_LDO_4, |
| 32 | TPS6586X_ID_LDO_5, |
| 33 | TPS6586X_ID_LDO_6, |
| 34 | TPS6586X_ID_LDO_7, |
| 35 | TPS6586X_ID_LDO_8, |
| 36 | TPS6586X_ID_LDO_9, |
| 37 | TPS6586X_ID_LDO_RTC, |
Laxman Dewangan | 64e4816 | 2012-10-18 19:36:09 +0530 | [diff] [blame] | 38 | TPS6586X_ID_MAX_REGULATOR, |
Mike Rapoport | c6c1933 | 2010-08-11 01:11:04 +0200 | [diff] [blame] | 39 | }; |
| 40 | |
Gary King | c26448c | 2010-09-20 00:18:27 +0200 | [diff] [blame] | 41 | enum { |
| 42 | TPS6586X_INT_PLDO_0, |
| 43 | TPS6586X_INT_PLDO_1, |
| 44 | TPS6586X_INT_PLDO_2, |
| 45 | TPS6586X_INT_PLDO_3, |
| 46 | TPS6586X_INT_PLDO_4, |
| 47 | TPS6586X_INT_PLDO_5, |
| 48 | TPS6586X_INT_PLDO_6, |
| 49 | TPS6586X_INT_PLDO_7, |
| 50 | TPS6586X_INT_COMP_DET, |
| 51 | TPS6586X_INT_ADC, |
| 52 | TPS6586X_INT_PLDO_8, |
| 53 | TPS6586X_INT_PLDO_9, |
| 54 | TPS6586X_INT_PSM_0, |
| 55 | TPS6586X_INT_PSM_1, |
| 56 | TPS6586X_INT_PSM_2, |
| 57 | TPS6586X_INT_PSM_3, |
| 58 | TPS6586X_INT_RTC_ALM1, |
| 59 | TPS6586X_INT_ACUSB_OVP, |
| 60 | TPS6586X_INT_USB_DET, |
| 61 | TPS6586X_INT_AC_DET, |
| 62 | TPS6586X_INT_BAT_DET, |
| 63 | TPS6586X_INT_CHG_STAT, |
| 64 | TPS6586X_INT_CHG_TEMP, |
| 65 | TPS6586X_INT_PP, |
| 66 | TPS6586X_INT_RESUME, |
| 67 | TPS6586X_INT_LOW_SYS, |
| 68 | TPS6586X_INT_RTC_ALM2, |
| 69 | }; |
| 70 | |
Xin Xie | 500c524 | 2011-08-09 18:47:50 +0800 | [diff] [blame] | 71 | struct tps6586x_settings { |
| 72 | int slew_rate; |
| 73 | }; |
| 74 | |
Mike Rapoport | c6c1933 | 2010-08-11 01:11:04 +0200 | [diff] [blame] | 75 | struct tps6586x_subdev_info { |
| 76 | int id; |
| 77 | const char *name; |
| 78 | void *platform_data; |
Thierry Reding | 62f6b08 | 2012-04-26 16:52:21 +0200 | [diff] [blame] | 79 | struct device_node *of_node; |
Mike Rapoport | c6c1933 | 2010-08-11 01:11:04 +0200 | [diff] [blame] | 80 | }; |
| 81 | |
| 82 | struct tps6586x_platform_data { |
| 83 | int num_subdevs; |
| 84 | struct tps6586x_subdev_info *subdevs; |
| 85 | |
| 86 | int gpio_base; |
Gary King | c26448c | 2010-09-20 00:18:27 +0200 | [diff] [blame] | 87 | int irq_base; |
Bill Huang | 004c15a | 2012-08-19 18:07:55 -0700 | [diff] [blame] | 88 | bool pm_off; |
Laxman Dewangan | 64e4816 | 2012-10-18 19:36:09 +0530 | [diff] [blame] | 89 | |
| 90 | struct regulator_init_data *reg_init_data[TPS6586X_ID_MAX_REGULATOR]; |
Mike Rapoport | c6c1933 | 2010-08-11 01:11:04 +0200 | [diff] [blame] | 91 | }; |
| 92 | |
| 93 | /* |
| 94 | * NOTE: the functions below are not intended for use outside |
| 95 | * of the TPS6586X sub-device drivers |
| 96 | */ |
| 97 | extern int tps6586x_write(struct device *dev, int reg, uint8_t val); |
| 98 | extern int tps6586x_writes(struct device *dev, int reg, int len, uint8_t *val); |
| 99 | extern int tps6586x_read(struct device *dev, int reg, uint8_t *val); |
| 100 | extern int tps6586x_reads(struct device *dev, int reg, int len, uint8_t *val); |
| 101 | extern int tps6586x_set_bits(struct device *dev, int reg, uint8_t bit_mask); |
| 102 | extern int tps6586x_clr_bits(struct device *dev, int reg, uint8_t bit_mask); |
| 103 | extern int tps6586x_update(struct device *dev, int reg, uint8_t val, |
| 104 | uint8_t mask); |
Laxman Dewangan | 605511a | 2012-11-13 19:18:05 +0530 | [diff] [blame] | 105 | extern int tps6586x_irq_get_virq(struct device *dev, int irq); |
Stefan Agner | e0a3da8 | 2013-12-06 13:51:45 +0100 | [diff] [blame] | 106 | extern int tps6586x_get_version(struct device *dev); |
Mike Rapoport | c6c1933 | 2010-08-11 01:11:04 +0200 | [diff] [blame] | 107 | |
| 108 | #endif /*__LINUX_MFD_TPS6586X_H */ |