0001
0002
0003
0004
0005
0006
0007
0008 #ifndef __LINUX_MFD_STPMIC1_H
0009 #define __LINUX_MFD_STPMIC1_H
0010
0011 #define TURN_ON_SR 0x1
0012 #define TURN_OFF_SR 0x2
0013 #define ICC_LDO_TURN_OFF_SR 0x3
0014 #define ICC_BUCK_TURN_OFF_SR 0x4
0015 #define RREQ_STATE_SR 0x5
0016 #define VERSION_SR 0x6
0017
0018 #define SWOFF_PWRCTRL_CR 0x10
0019 #define PADS_PULL_CR 0x11
0020 #define BUCKS_PD_CR 0x12
0021 #define LDO14_PD_CR 0x13
0022 #define LDO56_VREF_PD_CR 0x14
0023 #define VBUS_DET_VIN_CR 0x15
0024 #define PKEY_TURNOFF_CR 0x16
0025 #define BUCKS_MASK_RANK_CR 0x17
0026 #define BUCKS_MASK_RESET_CR 0x18
0027 #define LDOS_MASK_RANK_CR 0x19
0028 #define LDOS_MASK_RESET_CR 0x1A
0029 #define WCHDG_CR 0x1B
0030 #define WCHDG_TIMER_CR 0x1C
0031 #define BUCKS_ICCTO_CR 0x1D
0032 #define LDOS_ICCTO_CR 0x1E
0033
0034 #define BUCK1_ACTIVE_CR 0x20
0035 #define BUCK2_ACTIVE_CR 0x21
0036 #define BUCK3_ACTIVE_CR 0x22
0037 #define BUCK4_ACTIVE_CR 0x23
0038 #define VREF_DDR_ACTIVE_CR 0x24
0039 #define LDO1_ACTIVE_CR 0x25
0040 #define LDO2_ACTIVE_CR 0x26
0041 #define LDO3_ACTIVE_CR 0x27
0042 #define LDO4_ACTIVE_CR 0x28
0043 #define LDO5_ACTIVE_CR 0x29
0044 #define LDO6_ACTIVE_CR 0x2A
0045
0046 #define BUCK1_STDBY_CR 0x30
0047 #define BUCK2_STDBY_CR 0x31
0048 #define BUCK3_STDBY_CR 0x32
0049 #define BUCK4_STDBY_CR 0x33
0050 #define VREF_DDR_STDBY_CR 0x34
0051 #define LDO1_STDBY_CR 0x35
0052 #define LDO2_STDBY_CR 0x36
0053 #define LDO3_STDBY_CR 0x37
0054 #define LDO4_STDBY_CR 0x38
0055 #define LDO5_STDBY_CR 0x39
0056 #define LDO6_STDBY_CR 0x3A
0057
0058 #define BST_SW_CR 0x40
0059
0060 #define INT_PENDING_R1 0x50
0061 #define INT_PENDING_R2 0x51
0062 #define INT_PENDING_R3 0x52
0063 #define INT_PENDING_R4 0x53
0064
0065 #define INT_DBG_LATCH_R1 0x60
0066 #define INT_DBG_LATCH_R2 0x61
0067 #define INT_DBG_LATCH_R3 0x62
0068 #define INT_DBG_LATCH_R4 0x63
0069
0070 #define INT_CLEAR_R1 0x70
0071 #define INT_CLEAR_R2 0x71
0072 #define INT_CLEAR_R3 0x72
0073 #define INT_CLEAR_R4 0x73
0074
0075 #define INT_MASK_R1 0x80
0076 #define INT_MASK_R2 0x81
0077 #define INT_MASK_R3 0x82
0078 #define INT_MASK_R4 0x83
0079
0080 #define INT_SET_MASK_R1 0x90
0081 #define INT_SET_MASK_R2 0x91
0082 #define INT_SET_MASK_R3 0x92
0083 #define INT_SET_MASK_R4 0x93
0084
0085 #define INT_CLEAR_MASK_R1 0xA0
0086 #define INT_CLEAR_MASK_R2 0xA1
0087 #define INT_CLEAR_MASK_R3 0xA2
0088 #define INT_CLEAR_MASK_R4 0xA3
0089
0090 #define INT_SRC_R1 0xB0
0091 #define INT_SRC_R2 0xB1
0092 #define INT_SRC_R3 0xB2
0093 #define INT_SRC_R4 0xB3
0094
0095 #define PMIC_MAX_REGISTER_ADDRESS INT_SRC_R4
0096
0097 #define STPMIC1_PMIC_NUM_IRQ_REGS 4
0098
0099 #define TURN_OFF_SR_ICC_EVENT 0x08
0100
0101 #define LDO_VOLTAGE_MASK GENMASK(6, 2)
0102 #define BUCK_VOLTAGE_MASK GENMASK(7, 2)
0103 #define LDO_BUCK_VOLTAGE_SHIFT 2
0104
0105 #define LDO_ENABLE_MASK BIT(0)
0106 #define BUCK_ENABLE_MASK BIT(0)
0107
0108 #define BUCK_HPLP_ENABLE_MASK BIT(1)
0109 #define BUCK_HPLP_SHIFT 1
0110
0111 #define STDBY_ENABLE_MASK BIT(0)
0112
0113 #define BUCKS_PD_CR_REG_MASK GENMASK(7, 0)
0114 #define BUCK_MASK_RANK_REGISTER_MASK GENMASK(3, 0)
0115 #define BUCK_MASK_RESET_REGISTER_MASK GENMASK(3, 0)
0116 #define LDO1234_PULL_DOWN_REGISTER_MASK GENMASK(7, 0)
0117 #define LDO56_VREF_PD_CR_REG_MASK GENMASK(5, 0)
0118 #define LDO_MASK_RANK_REGISTER_MASK GENMASK(5, 0)
0119 #define LDO_MASK_RESET_REGISTER_MASK GENMASK(5, 0)
0120
0121 #define BUCK1_PULL_DOWN_REG BUCKS_PD_CR
0122 #define BUCK1_PULL_DOWN_MASK BIT(0)
0123 #define BUCK2_PULL_DOWN_REG BUCKS_PD_CR
0124 #define BUCK2_PULL_DOWN_MASK BIT(2)
0125 #define BUCK3_PULL_DOWN_REG BUCKS_PD_CR
0126 #define BUCK3_PULL_DOWN_MASK BIT(4)
0127 #define BUCK4_PULL_DOWN_REG BUCKS_PD_CR
0128 #define BUCK4_PULL_DOWN_MASK BIT(6)
0129
0130 #define LDO1_PULL_DOWN_REG LDO14_PD_CR
0131 #define LDO1_PULL_DOWN_MASK BIT(0)
0132 #define LDO2_PULL_DOWN_REG LDO14_PD_CR
0133 #define LDO2_PULL_DOWN_MASK BIT(2)
0134 #define LDO3_PULL_DOWN_REG LDO14_PD_CR
0135 #define LDO3_PULL_DOWN_MASK BIT(4)
0136 #define LDO4_PULL_DOWN_REG LDO14_PD_CR
0137 #define LDO4_PULL_DOWN_MASK BIT(6)
0138 #define LDO5_PULL_DOWN_REG LDO56_VREF_PD_CR
0139 #define LDO5_PULL_DOWN_MASK BIT(0)
0140 #define LDO6_PULL_DOWN_REG LDO56_VREF_PD_CR
0141 #define LDO6_PULL_DOWN_MASK BIT(2)
0142 #define VREF_DDR_PULL_DOWN_REG LDO56_VREF_PD_CR
0143 #define VREF_DDR_PULL_DOWN_MASK BIT(4)
0144
0145 #define BUCKS_ICCTO_CR_REG_MASK GENMASK(6, 0)
0146 #define LDOS_ICCTO_CR_REG_MASK GENMASK(5, 0)
0147
0148 #define LDO_BYPASS_MASK BIT(7)
0149
0150
0151
0152
0153
0154 #define ICC_EVENT_ENABLED BIT(4)
0155 #define PWRCTRL_POLARITY_HIGH BIT(3)
0156 #define PWRCTRL_PIN_VALID BIT(2)
0157 #define RESTART_REQUEST_ENABLED BIT(1)
0158 #define SOFTWARE_SWITCH_OFF_ENABLED BIT(0)
0159
0160
0161
0162
0163
0164 #define WAKEUP_DETECTOR_DISABLED BIT(4)
0165 #define PWRCTRL_PD_ACTIVE BIT(3)
0166 #define PWRCTRL_PU_ACTIVE BIT(2)
0167 #define WAKEUP_PD_ACTIVE BIT(1)
0168 #define PONKEY_PU_INACTIVE BIT(0)
0169
0170
0171
0172
0173
0174 #define SWIN_DETECTOR_ENABLED BIT(7)
0175 #define SWOUT_DETECTOR_ENABLED BIT(6)
0176 #define VINLOW_ENABLED BIT(0)
0177 #define VINLOW_CTRL_REG_MASK GENMASK(7, 0)
0178
0179
0180
0181
0182 #define BOOST_OVP_DISABLED BIT(7)
0183 #define VBUS_OTG_DETECTION_DISABLED BIT(6)
0184 #define SW_OUT_DISCHARGE BIT(5)
0185 #define VBUS_OTG_DISCHARGE BIT(4)
0186 #define OCP_LIMIT_HIGH BIT(3)
0187 #define SWIN_SWOUT_ENABLED BIT(2)
0188 #define USBSW_OTG_SWITCH_ENABLED BIT(1)
0189 #define BOOST_ENABLED BIT(0)
0190
0191
0192
0193
0194 #define PONKEY_PWR_OFF BIT(7)
0195 #define PONKEY_CC_FLAG_CLEAR BIT(6)
0196 #define PONKEY_TURNOFF_TIMER_MASK GENMASK(3, 0)
0197 #define PONKEY_TURNOFF_MASK GENMASK(7, 0)
0198
0199
0200
0201
0202
0203
0204
0205 struct stpmic1 {
0206 struct device *dev;
0207 struct regmap *regmap;
0208 int irq;
0209 struct regmap_irq_chip_data *irq_data;
0210 };
0211
0212 #endif