0001
0002
0003
0004
0005
0006
0007
0008 #ifndef __LINUX_MFD_LP87565_H
0009 #define __LINUX_MFD_LP87565_H
0010
0011 #include <linux/i2c.h>
0012 #include <linux/regulator/driver.h>
0013 #include <linux/regulator/machine.h>
0014
0015 enum lp87565_device_type {
0016 LP87565_DEVICE_TYPE_UNKNOWN = 0,
0017 LP87565_DEVICE_TYPE_LP87524_Q1,
0018 LP87565_DEVICE_TYPE_LP87561_Q1,
0019 LP87565_DEVICE_TYPE_LP87565_Q1,
0020 };
0021
0022
0023 #define LP87565_REG_DEV_REV 0X00
0024 #define LP87565_REG_OTP_REV 0X01
0025 #define LP87565_REG_BUCK0_CTRL_1 0X02
0026 #define LP87565_REG_BUCK0_CTRL_2 0X03
0027
0028 #define LP87565_REG_BUCK1_CTRL_1 0X04
0029 #define LP87565_REG_BUCK1_CTRL_2 0X05
0030
0031 #define LP87565_REG_BUCK2_CTRL_1 0X06
0032 #define LP87565_REG_BUCK2_CTRL_2 0X07
0033
0034 #define LP87565_REG_BUCK3_CTRL_1 0X08
0035 #define LP87565_REG_BUCK3_CTRL_2 0X09
0036
0037 #define LP87565_REG_BUCK0_VOUT 0X0A
0038 #define LP87565_REG_BUCK0_FLOOR_VOUT 0X0B
0039
0040 #define LP87565_REG_BUCK1_VOUT 0X0C
0041 #define LP87565_REG_BUCK1_FLOOR_VOUT 0X0D
0042
0043 #define LP87565_REG_BUCK2_VOUT 0X0E
0044 #define LP87565_REG_BUCK2_FLOOR_VOUT 0X0F
0045
0046 #define LP87565_REG_BUCK3_VOUT 0X10
0047 #define LP87565_REG_BUCK3_FLOOR_VOUT 0X11
0048
0049 #define LP87565_REG_BUCK0_DELAY 0X12
0050 #define LP87565_REG_BUCK1_DELAY 0X13
0051
0052 #define LP87565_REG_BUCK2_DELAY 0X14
0053 #define LP87565_REG_BUCK3_DELAY 0X15
0054
0055 #define LP87565_REG_GPO2_DELAY 0X16
0056 #define LP87565_REG_GPO3_DELAY 0X17
0057 #define LP87565_REG_RESET 0X18
0058 #define LP87565_REG_CONFIG 0X19
0059
0060 #define LP87565_REG_INT_TOP_1 0X1A
0061 #define LP87565_REG_INT_TOP_2 0X1B
0062
0063 #define LP87565_REG_INT_BUCK_0_1 0X1C
0064 #define LP87565_REG_INT_BUCK_2_3 0X1D
0065 #define LP87565_REG_TOP_STAT 0X1E
0066 #define LP87565_REG_BUCK_0_1_STAT 0X1F
0067 #define LP87565_REG_BUCK_2_3_STAT 0x20
0068
0069 #define LP87565_REG_TOP_MASK_1 0x21
0070 #define LP87565_REG_TOP_MASK_2 0x22
0071
0072 #define LP87565_REG_BUCK_0_1_MASK 0x23
0073 #define LP87565_REG_BUCK_2_3_MASK 0x24
0074 #define LP87565_REG_SEL_I_LOAD 0x25
0075
0076 #define LP87565_REG_I_LOAD_2 0x26
0077 #define LP87565_REG_I_LOAD_1 0x27
0078
0079 #define LP87565_REG_PGOOD_CTRL1 0x28
0080 #define LP87565_REG_PGOOD_CTRL2 0x29
0081 #define LP87565_REG_PGOOD_FLT 0x2A
0082 #define LP87565_REG_PLL_CTRL 0x2B
0083 #define LP87565_REG_PIN_FUNCTION 0x2C
0084 #define LP87565_REG_GPIO_CONFIG 0x2D
0085 #define LP87565_REG_GPIO_IN 0x2E
0086 #define LP87565_REG_GPIO_OUT 0x2F
0087
0088 #define LP87565_REG_MAX LP87565_REG_GPIO_OUT
0089
0090
0091 #define LP87565_DEV_REV_DEV_ID 0xC0
0092 #define LP87565_DEV_REV_ALL_LAYER 0x30
0093 #define LP87565_DEV_REV_METAL_LAYER 0x0F
0094
0095 #define LP87565_OTP_REV_OTP_ID 0xFF
0096
0097 #define LP87565_BUCK_CTRL_1_EN BIT(7)
0098 #define LP87565_BUCK_CTRL_1_EN_PIN_CTRL BIT(6)
0099 #define LP87565_BUCK_CTRL_1_PIN_SELECT_EN 0x30
0100
0101 #define LP87565_BUCK_CTRL_1_ROOF_FLOOR_EN BIT(3)
0102 #define LP87565_BUCK_CTRL_1_RDIS_EN BIT(2)
0103 #define LP87565_BUCK_CTRL_1_FPWM BIT(1)
0104
0105 #define LP87565_BUCK_CTRL_1_FPWM_MP_0_2 BIT(0)
0106
0107 #define LP87565_BUCK_CTRL_2_ILIM 0x38
0108 #define LP87565_BUCK_CTRL_2_SLEW_RATE 0x07
0109
0110 #define LP87565_BUCK_VSET 0xFF
0111 #define LP87565_BUCK_FLOOR_VSET 0xFF
0112
0113 #define LP87565_BUCK_SHUTDOWN_DELAY 0xF0
0114 #define LP87565_BUCK_STARTUP_DELAY 0x0F
0115
0116 #define LP87565_GPIO_SHUTDOWN_DELAY 0xF0
0117 #define LP87565_GPIO_STARTUP_DELAY 0x0F
0118
0119 #define LP87565_RESET_SW_RESET BIT(0)
0120
0121 #define LP87565_CONFIG_DOUBLE_DELAY BIT(7)
0122 #define LP87565_CONFIG_CLKIN_PD BIT(6)
0123 #define LP87565_CONFIG_EN4_PD BIT(5)
0124 #define LP87565_CONFIG_EN3_PD BIT(4)
0125 #define LP87565_CONFIG_TDIE_WARN_LEVEL BIT(3)
0126 #define LP87565_CONFIG_EN2_PD BIT(2)
0127 #define LP87565_CONFIG_EN1_PD BIT(1)
0128
0129 #define LP87565_INT_GPIO BIT(7)
0130 #define LP87565_INT_BUCK23 BIT(6)
0131 #define LP87565_INT_BUCK01 BIT(5)
0132 #define LP87565_NO_SYNC_CLK BIT(4)
0133 #define LP87565_TDIE_SD BIT(3)
0134 #define LP87565_TDIE_WARN BIT(2)
0135 #define LP87565_INT_OVP BIT(1)
0136 #define LP87565_I_LOAD_READY BIT(0)
0137
0138 #define LP87565_INT_TOP2_RESET_REG BIT(0)
0139
0140 #define LP87565_BUCK1_PG_INT BIT(6)
0141 #define LP87565_BUCK1_SC_INT BIT(5)
0142 #define LP87565_BUCK1_ILIM_INT BIT(4)
0143 #define LP87565_BUCK0_PG_INT BIT(2)
0144 #define LP87565_BUCK0_SC_INT BIT(1)
0145 #define LP87565_BUCK0_ILIM_INT BIT(0)
0146
0147 #define LP87565_BUCK3_PG_INT BIT(6)
0148 #define LP87565_BUCK3_SC_INT BIT(5)
0149 #define LP87565_BUCK3_ILIM_INT BIT(4)
0150 #define LP87565_BUCK2_PG_INT BIT(2)
0151 #define LP87565_BUCK2_SC_INT BIT(1)
0152 #define LP87565_BUCK2_ILIM_INT BIT(0)
0153
0154 #define LP87565_SYNC_CLK_STAT BIT(4)
0155 #define LP87565_TDIE_SD_STAT BIT(3)
0156 #define LP87565_TDIE_WARN_STAT BIT(2)
0157 #define LP87565_OVP_STAT BIT(1)
0158
0159 #define LP87565_BUCK1_STAT BIT(7)
0160 #define LP87565_BUCK1_PG_STAT BIT(6)
0161 #define LP87565_BUCK1_ILIM_STAT BIT(4)
0162 #define LP87565_BUCK0_STAT BIT(3)
0163 #define LP87565_BUCK0_PG_STAT BIT(2)
0164 #define LP87565_BUCK0_ILIM_STAT BIT(0)
0165
0166 #define LP87565_BUCK3_STAT BIT(7)
0167 #define LP87565_BUCK3_PG_STAT BIT(6)
0168 #define LP87565_BUCK3_ILIM_STAT BIT(4)
0169 #define LP87565_BUCK2_STAT BIT(3)
0170 #define LP87565_BUCK2_PG_STAT BIT(2)
0171 #define LP87565_BUCK2_ILIM_STAT BIT(0)
0172
0173 #define LPL87565_GPIO_MASK BIT(7)
0174 #define LPL87565_SYNC_CLK_MASK BIT(4)
0175 #define LPL87565_TDIE_WARN_MASK BIT(2)
0176 #define LPL87565_I_LOAD_READY_MASK BIT(0)
0177
0178 #define LPL87565_RESET_REG_MASK BIT(0)
0179
0180 #define LPL87565_BUCK1_PG_MASK BIT(6)
0181 #define LPL87565_BUCK1_ILIM_MASK BIT(4)
0182 #define LPL87565_BUCK0_PG_MASK BIT(2)
0183 #define LPL87565_BUCK0_ILIM_MASK BIT(0)
0184
0185 #define LPL87565_BUCK3_PG_MASK BIT(6)
0186 #define LPL87565_BUCK3_ILIM_MASK BIT(4)
0187 #define LPL87565_BUCK2_PG_MASK BIT(2)
0188 #define LPL87565_BUCK2_ILIM_MASK BIT(0)
0189
0190 #define LP87565_LOAD_CURRENT_BUCK_SELECT 0x3
0191
0192 #define LP87565_I_LOAD2_BUCK_LOAD_CURRENT 0x3
0193 #define LP87565_I_LOAD1_BUCK_LOAD_CURRENT 0xFF
0194
0195 #define LP87565_PG3_SEL 0xC0
0196 #define LP87565_PG2_SEL 0x30
0197 #define LP87565_PG1_SEL 0x0C
0198 #define LP87565_PG0_SEL 0x03
0199
0200 #define LP87565_HALF_DAY BIT(7)
0201 #define LP87565_EN_PG0_NINT BIT(6)
0202 #define LP87565_PGOOD_SET_DELAY BIT(5)
0203 #define LP87565_EN_PGFLT_STAT BIT(4)
0204 #define LP87565_PGOOD_WINDOW BIT(2)
0205 #define LP87565_PGOOD_OD BIT(1)
0206 #define LP87565_PGOOD_POL BIT(0)
0207
0208 #define LP87565_PG3_FLT BIT(3)
0209 #define LP87565_PG2_FLT BIT(2)
0210 #define LP87565_PG1_FLT BIT(1)
0211 #define LP87565_PG0_FLT BIT(0)
0212
0213 #define LP87565_PLL_MODE 0xC0
0214 #define LP87565_EXT_CLK_FREQ 0x1F
0215
0216 #define LP87565_EN_SPREAD_SPEC BIT(7)
0217 #define LP87565_EN_PIN_CTRL_GPIO3 BIT(6)
0218 #define LP87565_EN_PIN_SELECT_GPIO3 BIT(5)
0219 #define LP87565_EN_PIN_CTRL_GPIO2 BIT(4)
0220 #define LP87565_EN_PIN_SELECT_GPIO2 BIT(3)
0221 #define LP87565_GPIO3_SEL BIT(2)
0222 #define LP87565_GPIO2_SEL BIT(1)
0223 #define LP87565_GPIO1_SEL BIT(0)
0224
0225 #define LP87565_GPIO3_OD BIT(6)
0226 #define LP87565_GPIO2_OD BIT(5)
0227 #define LP87565_GPIO1_OD BIT(4)
0228 #define LP87565_GPIO3_DIR BIT(2)
0229 #define LP87565_GPIO2_DIR BIT(1)
0230 #define LP87565_GPIO1_DIR BIT(0)
0231
0232 #define LP87565_GPIO3_IN BIT(2)
0233 #define LP87565_GPIO2_IN BIT(1)
0234 #define LP87565_GPIO1_IN BIT(0)
0235
0236 #define LP87565_GPIO3_OUT BIT(2)
0237 #define LP87565_GPIO2_OUT BIT(1)
0238 #define LP87565_GPIO1_OUT BIT(0)
0239
0240
0241
0242
0243
0244
0245
0246
0247
0248
0249
0250 struct lp87565 {
0251 struct device *dev;
0252 u8 rev;
0253 u8 dev_type;
0254 struct regmap *regmap;
0255 struct gpio_desc *reset_gpio;
0256 };
0257 #endif