Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2011, Code Aurora Forum. All rights reserved. |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License version 2 and |
| 6 | * only version 2 as published by the Free Software Foundation. |
| 7 | * |
| 8 | * This program is distributed in the hope that it will be useful, |
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | * GNU General Public License for more details. |
| 12 | */ |
| 13 | |
| 14 | #include <linux/regulator/pm8921-regulator.h> |
| 15 | #include <linux/regulator/gpio-regulator.h> |
David Collins | 26f0556 | 2011-06-20 09:56:28 -0700 | [diff] [blame] | 16 | #include <mach/rpm-regulator.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 17 | |
| 18 | #include "board-msm8960.h" |
| 19 | |
| 20 | #define VREG_CONSUMERS(_id) \ |
| 21 | static struct regulator_consumer_supply vreg_consumers_##_id[] |
| 22 | |
| 23 | /* |
| 24 | * Consumer specific regulator names: |
| 25 | * regulator name consumer dev_name |
| 26 | */ |
| 27 | VREG_CONSUMERS(L1) = { |
| 28 | REGULATOR_SUPPLY("8921_l1", NULL), |
| 29 | }; |
| 30 | VREG_CONSUMERS(L2) = { |
| 31 | REGULATOR_SUPPLY("8921_l2", NULL), |
| 32 | REGULATOR_SUPPLY("dsi_vdda", "mipi_dsi.1"), |
| 33 | REGULATOR_SUPPLY("mipi_csi_vdd", "msm_camera_imx074.0"), |
| 34 | REGULATOR_SUPPLY("mipi_csi_vdd", "msm_camera_ov2720.0"), |
Kevin Chan | dfecce2 | 2011-07-13 10:52:41 -0700 | [diff] [blame] | 35 | REGULATOR_SUPPLY("mipi_csi_vdd", "msm_camera_qs_mt9p017.0"), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 36 | }; |
| 37 | VREG_CONSUMERS(L3) = { |
| 38 | REGULATOR_SUPPLY("8921_l3", NULL), |
| 39 | REGULATOR_SUPPLY("HSUSB_3p3", "msm_otg"), |
| 40 | }; |
| 41 | VREG_CONSUMERS(L4) = { |
| 42 | REGULATOR_SUPPLY("8921_l4", NULL), |
| 43 | REGULATOR_SUPPLY("HSUSB_1p8", "msm_otg"), |
| 44 | REGULATOR_SUPPLY("iris_vddxo", "wcnss_wlan.0"), |
| 45 | }; |
| 46 | VREG_CONSUMERS(L5) = { |
| 47 | REGULATOR_SUPPLY("8921_l5", NULL), |
| 48 | REGULATOR_SUPPLY("sdc_vdd", "msm_sdcc.1"), |
| 49 | }; |
| 50 | VREG_CONSUMERS(L6) = { |
| 51 | REGULATOR_SUPPLY("8921_l6", NULL), |
| 52 | REGULATOR_SUPPLY("sdc_vdd", "msm_sdcc.3"), |
| 53 | }; |
| 54 | VREG_CONSUMERS(L7) = { |
| 55 | REGULATOR_SUPPLY("8921_l7", NULL), |
| 56 | REGULATOR_SUPPLY("sdc_vddp", "msm_sdcc.3"), |
| 57 | }; |
| 58 | VREG_CONSUMERS(L8) = { |
| 59 | REGULATOR_SUPPLY("8921_l8", NULL), |
| 60 | REGULATOR_SUPPLY("dsi_vdc", "mipi_dsi.1"), |
| 61 | }; |
| 62 | VREG_CONSUMERS(L9) = { |
| 63 | REGULATOR_SUPPLY("8921_l9", NULL), |
| 64 | REGULATOR_SUPPLY("vdd", "3-0024"), |
| 65 | }; |
| 66 | VREG_CONSUMERS(L10) = { |
| 67 | REGULATOR_SUPPLY("8921_l10", NULL), |
| 68 | REGULATOR_SUPPLY("iris_vddpa", "wcnss_wlan.0"), |
| 69 | |
| 70 | }; |
| 71 | VREG_CONSUMERS(L11) = { |
| 72 | REGULATOR_SUPPLY("8921_l11", NULL), |
| 73 | REGULATOR_SUPPLY("cam_vana", "msm_camera_imx074.0"), |
| 74 | REGULATOR_SUPPLY("cam_vana", "msm_camera_ov2720.0"), |
Kevin Chan | dfecce2 | 2011-07-13 10:52:41 -0700 | [diff] [blame] | 75 | REGULATOR_SUPPLY("cam_vana", "msm_camera_qs_mt9p017.0"), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 76 | }; |
| 77 | VREG_CONSUMERS(L12) = { |
| 78 | REGULATOR_SUPPLY("8921_l12", NULL), |
| 79 | REGULATOR_SUPPLY("cam_vdig", "msm_camera_imx074.0"), |
| 80 | REGULATOR_SUPPLY("cam_vdig", "msm_camera_ov2720.0"), |
Kevin Chan | dfecce2 | 2011-07-13 10:52:41 -0700 | [diff] [blame] | 81 | REGULATOR_SUPPLY("cam_vdig", "msm_camera_qs_mt9p017.0"), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 82 | }; |
| 83 | VREG_CONSUMERS(L14) = { |
| 84 | REGULATOR_SUPPLY("8921_l14", NULL), |
| 85 | }; |
| 86 | VREG_CONSUMERS(L15) = { |
| 87 | REGULATOR_SUPPLY("8921_l15", NULL), |
| 88 | }; |
| 89 | VREG_CONSUMERS(L16) = { |
| 90 | REGULATOR_SUPPLY("8921_l16", NULL), |
| 91 | REGULATOR_SUPPLY("cam_vaf", "msm_camera_imx074.0"), |
| 92 | REGULATOR_SUPPLY("cam_vaf", "msm_camera_ov2720.0"), |
Kevin Chan | dfecce2 | 2011-07-13 10:52:41 -0700 | [diff] [blame] | 93 | REGULATOR_SUPPLY("cam_vaf", "msm_camera_qs_mt9p017.0"), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 94 | }; |
| 95 | VREG_CONSUMERS(L17) = { |
| 96 | REGULATOR_SUPPLY("8921_l17", NULL), |
| 97 | }; |
| 98 | VREG_CONSUMERS(L18) = { |
| 99 | REGULATOR_SUPPLY("8921_l18", NULL), |
| 100 | }; |
| 101 | VREG_CONSUMERS(L21) = { |
| 102 | REGULATOR_SUPPLY("8921_l21", NULL), |
| 103 | }; |
| 104 | VREG_CONSUMERS(L22) = { |
| 105 | REGULATOR_SUPPLY("8921_l22", NULL), |
| 106 | }; |
| 107 | VREG_CONSUMERS(L23) = { |
| 108 | REGULATOR_SUPPLY("8921_l23", NULL), |
| 109 | REGULATOR_SUPPLY("dsi_vddio", "mipi_dsi.1"), |
| 110 | REGULATOR_SUPPLY("hdmi_avdd", "hdmi_msm.0"), |
| 111 | }; |
| 112 | VREG_CONSUMERS(L24) = { |
| 113 | REGULATOR_SUPPLY("8921_l24", NULL), |
| 114 | REGULATOR_SUPPLY("riva_vddmx", "wcnss_wlan.0"), |
| 115 | }; |
| 116 | VREG_CONSUMERS(L25) = { |
| 117 | REGULATOR_SUPPLY("8921_l25", NULL), |
| 118 | REGULATOR_SUPPLY("VDDD_CDC_D", "tabla-slim"), |
| 119 | REGULATOR_SUPPLY("CDC_VDDA_A_1P2V", "tabla-slim"), |
| 120 | }; |
| 121 | VREG_CONSUMERS(L26) = { |
| 122 | REGULATOR_SUPPLY("8921_l26", NULL), |
Matt Wagantall | 0b2f982 | 2011-07-12 20:11:28 -0700 | [diff] [blame] | 123 | REGULATOR_SUPPLY("q6_lpass", NULL), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 124 | }; |
| 125 | VREG_CONSUMERS(L27) = { |
| 126 | REGULATOR_SUPPLY("8921_l27", NULL), |
Matt Wagantall | 0b2f982 | 2011-07-12 20:11:28 -0700 | [diff] [blame] | 127 | REGULATOR_SUPPLY("q6_modem_sw", NULL), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 128 | }; |
| 129 | VREG_CONSUMERS(L28) = { |
| 130 | REGULATOR_SUPPLY("8921_l28", NULL), |
Matt Wagantall | 0b2f982 | 2011-07-12 20:11:28 -0700 | [diff] [blame] | 131 | REGULATOR_SUPPLY("q6_modem_fw", NULL), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 132 | }; |
| 133 | VREG_CONSUMERS(L29) = { |
| 134 | REGULATOR_SUPPLY("8921_l29", NULL), |
| 135 | }; |
| 136 | VREG_CONSUMERS(S1) = { |
| 137 | REGULATOR_SUPPLY("8921_s1", NULL), |
| 138 | }; |
| 139 | VREG_CONSUMERS(S2) = { |
| 140 | REGULATOR_SUPPLY("8921_s2", NULL), |
| 141 | REGULATOR_SUPPLY("iris_vddrfa", "wcnss_wlan.0"), |
| 142 | |
| 143 | }; |
| 144 | VREG_CONSUMERS(S3) = { |
| 145 | REGULATOR_SUPPLY("8921_s3", NULL), |
| 146 | REGULATOR_SUPPLY("HSUSB_VDDCX", "msm_otg"), |
| 147 | REGULATOR_SUPPLY("riva_vddcx", "wcnss_wlan.0"), |
| 148 | }; |
| 149 | VREG_CONSUMERS(S4) = { |
| 150 | REGULATOR_SUPPLY("8921_s4", NULL), |
| 151 | REGULATOR_SUPPLY("sdc_vccq", "msm_sdcc.1"), |
| 152 | REGULATOR_SUPPLY("riva_vddpx", "wcnss_wlan.0"), |
| 153 | REGULATOR_SUPPLY("hdmi_vcc", "hdmi_msm.0"), |
| 154 | REGULATOR_SUPPLY("VDDIO_CDC", "tabla-slim"), |
| 155 | REGULATOR_SUPPLY("CDC_VDD_CP", "tabla-slim"), |
| 156 | REGULATOR_SUPPLY("CDC_VDDA_TX", "tabla-slim"), |
| 157 | REGULATOR_SUPPLY("CDC_VDDA_RX", "tabla-slim"), |
| 158 | }; |
| 159 | VREG_CONSUMERS(S5) = { |
| 160 | REGULATOR_SUPPLY("8921_s5", NULL), |
| 161 | REGULATOR_SUPPLY("krait0", NULL), |
| 162 | }; |
| 163 | VREG_CONSUMERS(S6) = { |
| 164 | REGULATOR_SUPPLY("8921_s6", NULL), |
| 165 | REGULATOR_SUPPLY("krait1", NULL), |
| 166 | }; |
| 167 | VREG_CONSUMERS(S7) = { |
| 168 | REGULATOR_SUPPLY("8921_s7", NULL), |
| 169 | }; |
| 170 | VREG_CONSUMERS(S8) = { |
| 171 | REGULATOR_SUPPLY("8921_s8", NULL), |
| 172 | }; |
| 173 | VREG_CONSUMERS(LVS1) = { |
| 174 | REGULATOR_SUPPLY("8921_lvs1", NULL), |
| 175 | REGULATOR_SUPPLY("sdc_vdd", "msm_sdcc.4"), |
| 176 | REGULATOR_SUPPLY("iris_vddio", "wcnss_wlan.0"), |
| 177 | }; |
| 178 | VREG_CONSUMERS(LVS2) = { |
| 179 | REGULATOR_SUPPLY("8921_lvs2", NULL), |
| 180 | REGULATOR_SUPPLY("iris_vdddig", "wcnss_wlan.0"), |
| 181 | }; |
| 182 | VREG_CONSUMERS(LVS3) = { |
| 183 | REGULATOR_SUPPLY("8921_lvs3", NULL), |
| 184 | }; |
| 185 | VREG_CONSUMERS(LVS4) = { |
| 186 | REGULATOR_SUPPLY("8921_lvs4", NULL), |
| 187 | REGULATOR_SUPPLY("vcc_i2c", "3-0024"), |
| 188 | }; |
| 189 | VREG_CONSUMERS(LVS5) = { |
| 190 | REGULATOR_SUPPLY("8921_lvs5", NULL), |
| 191 | REGULATOR_SUPPLY("cam_vio", "msm_camera_imx074.0"), |
| 192 | REGULATOR_SUPPLY("cam_vio", "msm_camera_ov2720.0"), |
Kevin Chan | dfecce2 | 2011-07-13 10:52:41 -0700 | [diff] [blame] | 193 | REGULATOR_SUPPLY("cam_vio", "msm_camera_qs_mt9p017.0"), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 194 | }; |
| 195 | VREG_CONSUMERS(LVS6) = { |
| 196 | REGULATOR_SUPPLY("8921_lvs6", NULL), |
| 197 | REGULATOR_SUPPLY("vdd_io", "spi0.0"), |
| 198 | }; |
| 199 | VREG_CONSUMERS(LVS7) = { |
| 200 | REGULATOR_SUPPLY("8921_lvs7", NULL), |
| 201 | }; |
| 202 | VREG_CONSUMERS(USB_OTG) = { |
| 203 | REGULATOR_SUPPLY("8921_usb_otg", NULL), |
| 204 | REGULATOR_SUPPLY("vbus_otg", "msm_otg"), |
| 205 | }; |
| 206 | VREG_CONSUMERS(HDMI_MVS) = { |
| 207 | REGULATOR_SUPPLY("8921_hdmi_mvs", NULL), |
| 208 | REGULATOR_SUPPLY("hdmi_mvs", "hdmi_msm.0"), |
| 209 | }; |
| 210 | VREG_CONSUMERS(NCP) = { |
| 211 | REGULATOR_SUPPLY("8921_ncp", NULL), |
| 212 | }; |
| 213 | VREG_CONSUMERS(EXT_5V) = { |
| 214 | REGULATOR_SUPPLY("ext_5v", NULL), |
| 215 | }; |
| 216 | VREG_CONSUMERS(EXT_L2) = { |
| 217 | REGULATOR_SUPPLY("ext_l2", NULL), |
| 218 | REGULATOR_SUPPLY("vdd_phy", "spi0.0"), |
| 219 | }; |
David Collins | b10be1d | 2011-09-02 10:29:31 -0700 | [diff] [blame] | 220 | VREG_CONSUMERS(EXT_3P3V) = { |
| 221 | REGULATOR_SUPPLY("ext_3p3v", NULL), |
Amir Samuelov | 0c7270f | 2011-09-07 03:13:47 +0300 | [diff] [blame^] | 222 | REGULATOR_SUPPLY("vdd_lvds_3p3v", "mipi_dsi.1"), |
David Collins | b10be1d | 2011-09-02 10:29:31 -0700 | [diff] [blame] | 223 | }; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 224 | |
| 225 | #define PM8921_VREG_INIT(_id, _min_uV, _max_uV, _modes, _ops, _apply_uV, \ |
| 226 | _pull_down, _always_on, _supply_regulator, \ |
David Collins | 4317676 | 2011-07-26 15:33:38 -0700 | [diff] [blame] | 227 | _system_uA, _enable_time) \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 228 | { \ |
| 229 | .init_data = { \ |
| 230 | .constraints = { \ |
| 231 | .valid_modes_mask = _modes, \ |
| 232 | .valid_ops_mask = _ops, \ |
| 233 | .min_uV = _min_uV, \ |
| 234 | .max_uV = _max_uV, \ |
| 235 | .input_uV = _max_uV, \ |
| 236 | .apply_uV = _apply_uV, \ |
| 237 | .always_on = _always_on, \ |
| 238 | }, \ |
| 239 | .num_consumer_supplies = \ |
| 240 | ARRAY_SIZE(vreg_consumers_##_id), \ |
| 241 | .consumer_supplies = vreg_consumers_##_id, \ |
| 242 | .supply_regulator = _supply_regulator, \ |
| 243 | }, \ |
| 244 | .id = PM8921_VREG_ID_##_id, \ |
| 245 | .pull_down_enable = _pull_down, \ |
| 246 | .system_uA = _system_uA, \ |
David Collins | 4317676 | 2011-07-26 15:33:38 -0700 | [diff] [blame] | 247 | .enable_time = _enable_time, \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 248 | } |
| 249 | |
| 250 | #define PM8921_VREG_INIT_LDO(_id, _always_on, _pull_down, _min_uV, _max_uV, \ |
David Collins | 4317676 | 2011-07-26 15:33:38 -0700 | [diff] [blame] | 251 | _enable_time, _supply_regulator, _system_uA) \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 252 | PM8921_VREG_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \ |
| 253 | | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \ |
| 254 | REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \ |
| 255 | REGULATOR_CHANGE_DRMS, 0, _pull_down, _always_on, \ |
David Collins | 4317676 | 2011-07-26 15:33:38 -0700 | [diff] [blame] | 256 | _supply_regulator, _system_uA, _enable_time) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 257 | |
| 258 | #define PM8921_VREG_INIT_NLDO1200(_id, _always_on, _pull_down, _min_uV, \ |
David Collins | 4317676 | 2011-07-26 15:33:38 -0700 | [diff] [blame] | 259 | _max_uV, _enable_time, _supply_regulator, _system_uA) \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 260 | PM8921_VREG_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \ |
| 261 | | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \ |
| 262 | REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \ |
| 263 | REGULATOR_CHANGE_DRMS, 0, _pull_down, _always_on, \ |
David Collins | 4317676 | 2011-07-26 15:33:38 -0700 | [diff] [blame] | 264 | _supply_regulator, _system_uA, _enable_time) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 265 | |
| 266 | #define PM8921_VREG_INIT_SMPS(_id, _always_on, _pull_down, _min_uV, _max_uV, \ |
David Collins | 4317676 | 2011-07-26 15:33:38 -0700 | [diff] [blame] | 267 | _enable_time, _supply_regulator, _system_uA) \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 268 | PM8921_VREG_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \ |
| 269 | | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \ |
| 270 | REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \ |
| 271 | REGULATOR_CHANGE_DRMS, 0, _pull_down, _always_on, \ |
David Collins | 4317676 | 2011-07-26 15:33:38 -0700 | [diff] [blame] | 272 | _supply_regulator, _system_uA, _enable_time) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 273 | |
| 274 | #define PM8921_VREG_INIT_FTSMPS(_id, _always_on, _pull_down, _min_uV, _max_uV, \ |
David Collins | 4317676 | 2011-07-26 15:33:38 -0700 | [diff] [blame] | 275 | _enable_time, _supply_regulator, _system_uA) \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 276 | PM8921_VREG_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL, \ |
| 277 | REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS \ |
| 278 | | REGULATOR_CHANGE_MODE, 0, _pull_down, _always_on, \ |
David Collins | 4317676 | 2011-07-26 15:33:38 -0700 | [diff] [blame] | 279 | _supply_regulator, _system_uA, _enable_time) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 280 | |
David Collins | 4317676 | 2011-07-26 15:33:38 -0700 | [diff] [blame] | 281 | #define PM8921_VREG_INIT_VS(_id, _always_on, _pull_down, _enable_time, \ |
| 282 | _supply_regulator) \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 283 | PM8921_VREG_INIT(_id, 0, 0, 0, REGULATOR_CHANGE_STATUS, 0, _pull_down, \ |
David Collins | 4317676 | 2011-07-26 15:33:38 -0700 | [diff] [blame] | 284 | _always_on, _supply_regulator, 0, _enable_time) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 285 | |
David Collins | 4317676 | 2011-07-26 15:33:38 -0700 | [diff] [blame] | 286 | #define PM8921_VREG_INIT_VS300(_id, _always_on, _pull_down, _enable_time, \ |
| 287 | _supply_regulator) \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 288 | PM8921_VREG_INIT(_id, 0, 0, 0, REGULATOR_CHANGE_STATUS, 0, _pull_down, \ |
David Collins | 4317676 | 2011-07-26 15:33:38 -0700 | [diff] [blame] | 289 | _always_on, _supply_regulator, 0, _enable_time) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 290 | |
David Collins | 4317676 | 2011-07-26 15:33:38 -0700 | [diff] [blame] | 291 | #define PM8921_VREG_INIT_NCP(_id, _always_on, _min_uV, _max_uV, _enable_time, \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 292 | _supply_regulator) \ |
| 293 | PM8921_VREG_INIT(_id, _min_uV, _max_uV, 0, REGULATOR_CHANGE_VOLTAGE | \ |
David Collins | 4317676 | 2011-07-26 15:33:38 -0700 | [diff] [blame] | 294 | REGULATOR_CHANGE_STATUS, 0, 0, _always_on, _supply_regulator, \ |
| 295 | 0, _enable_time) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 296 | |
| 297 | /* Pin control initialization */ |
| 298 | #define PM8921_PC_INIT(_id, _always_on, _pin_fn, _pin_ctrl, _supply_regulator) \ |
| 299 | { \ |
| 300 | .init_data = { \ |
| 301 | .constraints = { \ |
| 302 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, \ |
| 303 | .always_on = _always_on, \ |
| 304 | }, \ |
| 305 | .num_consumer_supplies = \ |
| 306 | ARRAY_SIZE(vreg_consumers_##_id##_PC), \ |
| 307 | .consumer_supplies = vreg_consumers_##_id##_PC, \ |
| 308 | .supply_regulator = _supply_regulator, \ |
| 309 | }, \ |
| 310 | .id = PM8921_VREG_ID_##_id##_PC, \ |
| 311 | .pin_fn = PM8921_VREG_PIN_FN_##_pin_fn, \ |
| 312 | .pin_ctrl = _pin_ctrl, \ |
| 313 | } |
| 314 | |
| 315 | #define GPIO_VREG_INIT(_id, _reg_name, _gpio_label, _gpio) \ |
| 316 | [GPIO_VREG_ID_##_id] = { \ |
| 317 | .init_data = { \ |
| 318 | .constraints = { \ |
| 319 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, \ |
| 320 | }, \ |
| 321 | .num_consumer_supplies = \ |
| 322 | ARRAY_SIZE(vreg_consumers_##_id), \ |
| 323 | .consumer_supplies = vreg_consumers_##_id, \ |
| 324 | }, \ |
| 325 | .regulator_name = _reg_name, \ |
| 326 | .gpio_label = _gpio_label, \ |
| 327 | .gpio = _gpio, \ |
| 328 | } |
| 329 | |
| 330 | #define SAW_VREG_INIT(_id, _name, _min_uV, _max_uV) \ |
| 331 | { \ |
| 332 | .constraints = { \ |
| 333 | .name = _name, \ |
| 334 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE, \ |
| 335 | .min_uV = _min_uV, \ |
| 336 | .max_uV = _max_uV, \ |
| 337 | }, \ |
| 338 | .num_consumer_supplies = ARRAY_SIZE(vreg_consumers_##_id), \ |
| 339 | .consumer_supplies = vreg_consumers_##_id, \ |
| 340 | } |
| 341 | |
David Collins | 26f0556 | 2011-06-20 09:56:28 -0700 | [diff] [blame] | 342 | #define RPM_INIT(_id, _min_uV, _max_uV, _modes, _ops, _apply_uV, _default_uV, \ |
| 343 | _peak_uA, _avg_uA, _pull_down, _pin_ctrl, _freq, _pin_fn, \ |
| 344 | _force_mode, _power_mode, _state, _sleep_selectable, \ |
| 345 | _always_on, _supply_regulator, _system_uA) \ |
| 346 | { \ |
| 347 | .init_data = { \ |
| 348 | .constraints = { \ |
| 349 | .valid_modes_mask = _modes, \ |
| 350 | .valid_ops_mask = _ops, \ |
| 351 | .min_uV = _min_uV, \ |
| 352 | .max_uV = _max_uV, \ |
| 353 | .input_uV = _min_uV, \ |
| 354 | .apply_uV = _apply_uV, \ |
| 355 | .always_on = _always_on, \ |
| 356 | }, \ |
| 357 | .num_consumer_supplies = \ |
| 358 | ARRAY_SIZE(vreg_consumers_##_id), \ |
| 359 | .consumer_supplies = vreg_consumers_##_id, \ |
| 360 | .supply_regulator = _supply_regulator, \ |
| 361 | }, \ |
| 362 | .id = RPM_VREG_ID_PM8921_##_id, \ |
| 363 | .default_uV = _default_uV, \ |
| 364 | .peak_uA = _peak_uA, \ |
| 365 | .avg_uA = _avg_uA, \ |
| 366 | .pull_down_enable = _pull_down, \ |
| 367 | .pin_ctrl = _pin_ctrl, \ |
| 368 | .freq = RPM_VREG_FREQ_##_freq, \ |
| 369 | .pin_fn = _pin_fn, \ |
| 370 | .force_mode = _force_mode, \ |
| 371 | .power_mode = _power_mode, \ |
| 372 | .state = _state, \ |
| 373 | .sleep_selectable = _sleep_selectable, \ |
| 374 | .system_uA = _system_uA, \ |
| 375 | } |
| 376 | |
| 377 | #define RPM_LDO(_id, _always_on, _pd, _sleep_selectable, _min_uV, _max_uV, \ |
| 378 | _supply_regulator, _system_uA, _init_peak_uA) \ |
| 379 | RPM_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \ |
| 380 | | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE \ |
| 381 | | REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE \ |
| 382 | | REGULATOR_CHANGE_DRMS, 0, _max_uV, _init_peak_uA, 0, _pd, \ |
| 383 | RPM_VREG_PIN_CTRL_NONE, NONE, RPM_VREG_PIN_FN_NONE, \ |
| 384 | RPM_VREG_FORCE_MODE_NONE, RPM_VREG_POWER_MODE_PWM, \ |
| 385 | RPM_VREG_STATE_OFF, _sleep_selectable, _always_on, \ |
| 386 | _supply_regulator, _system_uA) |
| 387 | |
| 388 | #define RPM_SMPS(_id, _always_on, _pd, _sleep_selectable, _min_uV, _max_uV, \ |
| 389 | _supply_regulator, _system_uA, _freq) \ |
| 390 | RPM_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \ |
| 391 | | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE \ |
| 392 | | REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE \ |
| 393 | | REGULATOR_CHANGE_DRMS, 0, _max_uV, _system_uA, 0, _pd, \ |
| 394 | RPM_VREG_PIN_CTRL_NONE, _freq, RPM_VREG_PIN_FN_NONE, \ |
| 395 | RPM_VREG_FORCE_MODE_NONE, RPM_VREG_POWER_MODE_PWM, \ |
| 396 | RPM_VREG_STATE_OFF, _sleep_selectable, _always_on, \ |
| 397 | _supply_regulator, _system_uA) |
| 398 | |
| 399 | #define RPM_VS(_id, _always_on, _pd, _sleep_selectable, _supply_regulator) \ |
| 400 | RPM_INIT(_id, 0, 0, 0, REGULATOR_CHANGE_STATUS, 0, 0, 1000, 1000, _pd, \ |
| 401 | RPM_VREG_PIN_CTRL_NONE, NONE, RPM_VREG_PIN_FN_NONE, \ |
| 402 | RPM_VREG_FORCE_MODE_NONE, RPM_VREG_POWER_MODE_PWM, \ |
| 403 | RPM_VREG_STATE_OFF, _sleep_selectable, _always_on, \ |
| 404 | _supply_regulator, 0) |
| 405 | |
| 406 | #define RPM_NCP(_id, _always_on, _sleep_selectable, _min_uV, _max_uV, \ |
| 407 | _supply_regulator, _freq) \ |
| 408 | RPM_INIT(_id, _min_uV, _max_uV, 0, REGULATOR_CHANGE_VOLTAGE \ |
| 409 | | REGULATOR_CHANGE_STATUS, 0, _max_uV, 1000, 1000, 0, \ |
| 410 | RPM_VREG_PIN_CTRL_NONE, _freq, RPM_VREG_PIN_FN_NONE, \ |
| 411 | RPM_VREG_FORCE_MODE_NONE, RPM_VREG_POWER_MODE_PWM, \ |
| 412 | RPM_VREG_STATE_OFF, _sleep_selectable, _always_on, \ |
| 413 | _supply_regulator, 0) |
| 414 | |
| 415 | /* Pin control initialization */ |
| 416 | #define RPM_PC_INIT(_id, _always_on, _pin_fn, _pin_ctrl, _supply_regulator) \ |
| 417 | { \ |
| 418 | .init_data = { \ |
| 419 | .constraints = { \ |
| 420 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, \ |
| 421 | .always_on = _always_on, \ |
| 422 | }, \ |
| 423 | .num_consumer_supplies = \ |
| 424 | ARRAY_SIZE(vreg_consumers_##_id##_PC), \ |
| 425 | .consumer_supplies = vreg_consumers_##_id##_PC, \ |
| 426 | .supply_regulator = _supply_regulator, \ |
| 427 | }, \ |
| 428 | .id = RPM_VREG_ID_PM8921_##_id##_PC, \ |
| 429 | .pin_fn = RPM_VREG_PIN_FN_##_pin_fn, \ |
| 430 | .pin_ctrl = _pin_ctrl, \ |
| 431 | } |
| 432 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 433 | /* GPIO regulator constraints */ |
| 434 | struct gpio_regulator_platform_data msm_gpio_regulator_pdata[] __devinitdata = { |
| 435 | GPIO_VREG_INIT(EXT_5V, "ext_5v", "ext_5v_en", PM8921_MPP_PM_TO_SYS(7)), |
| 436 | GPIO_VREG_INIT(EXT_L2, "ext_l2", "ext_l2_en", 91), |
David Collins | b10be1d | 2011-09-02 10:29:31 -0700 | [diff] [blame] | 437 | GPIO_VREG_INIT(EXT_3P3V, "ext_3p3v", "ext_3p3v_en", |
| 438 | PM8921_GPIO_PM_TO_SYS(17)), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 439 | }; |
| 440 | |
| 441 | /* SAW regulator constraints */ |
| 442 | struct regulator_init_data msm_saw_regulator_pdata_s5 = |
| 443 | /* ID vreg_name min_uV max_uV */ |
| 444 | SAW_VREG_INIT(S5, "8921_s5", 1050000, 1150000); |
| 445 | struct regulator_init_data msm_saw_regulator_pdata_s6 = |
| 446 | SAW_VREG_INIT(S6, "8921_s6", 1050000, 1150000); |
| 447 | |
| 448 | /* PM8921 regulator constraints */ |
| 449 | struct pm8921_regulator_platform_data |
| 450 | msm_pm8921_regulator_pdata[] __devinitdata = { |
David Collins | 26f0556 | 2011-06-20 09:56:28 -0700 | [diff] [blame] | 451 | /* |
| 452 | * ID a_on pd min_uV max_uV en_t supply |
| 453 | * system_uA |
| 454 | */ |
David Collins | 4317676 | 2011-07-26 15:33:38 -0700 | [diff] [blame] | 455 | PM8921_VREG_INIT_NLDO1200(L26, 0, 1, 1050000, 1050000, 200, "8921_s7", |
| 456 | 0), |
| 457 | PM8921_VREG_INIT_NLDO1200(L27, 0, 1, 1050000, 1050000, 200, "8921_s7", |
| 458 | 0), |
| 459 | PM8921_VREG_INIT_NLDO1200(L28, 0, 1, 1050000, 1050000, 200, "8921_s7", |
| 460 | 0), |
David Collins | 26f0556 | 2011-06-20 09:56:28 -0700 | [diff] [blame] | 461 | PM8921_VREG_INIT_LDO(L29, 0, 1, 2050000, 2100000, 200, "8921_s8", |
| 462 | 0), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 463 | |
David Collins | 26f0556 | 2011-06-20 09:56:28 -0700 | [diff] [blame] | 464 | /* ID always_on pd enable_time supply */ |
| 465 | PM8921_VREG_INIT_VS300(USB_OTG, 0, 1, 0, "ext_5v"), |
| 466 | PM8921_VREG_INIT_VS300(HDMI_MVS, 0, 1, 0, "ext_5v"), |
| 467 | }; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 468 | |
David Collins | 26f0556 | 2011-06-20 09:56:28 -0700 | [diff] [blame] | 469 | static struct rpm_regulator_init_data |
| 470 | msm_rpm_regulator_init_data[] __devinitdata = { |
| 471 | /* ID a_on pd ss min_uV max_uV supply sys_uA freq */ |
| 472 | RPM_SMPS(S1, 1, 1, 0, 1225000, 1225000, NULL, 100000, 3p20), |
| 473 | RPM_SMPS(S2, 0, 1, 0, 1300000, 1300000, NULL, 0, 1p60), |
| 474 | RPM_SMPS(S3, 0, 1, 1, 1150000, 1150000, NULL, 100000, 4p80), |
| 475 | RPM_SMPS(S4, 1, 1, 0, 1800000, 1800000, NULL, 100000, 3p20), |
| 476 | RPM_SMPS(S7, 0, 1, 0, 1150000, 1150000, NULL, 100000, 3p20), |
| 477 | RPM_SMPS(S8, 1, 1, 0, 2200000, 2200000, NULL, 100000, 1p60), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 478 | |
David Collins | 26f0556 | 2011-06-20 09:56:28 -0700 | [diff] [blame] | 479 | /* ID a_on pd ss min_uV max_uV supply sys_uA init_ip */ |
| 480 | RPM_LDO(L1, 1, 1, 0, 1050000, 1050000, "8921_s4", 0, 10000), |
| 481 | RPM_LDO(L2, 0, 1, 0, 1200000, 1200000, "8921_s4", 0, 0), |
| 482 | RPM_LDO(L3, 0, 1, 0, 3075000, 3075000, NULL, 0, 0), |
| 483 | RPM_LDO(L4, 1, 1, 0, 1800000, 1800000, NULL, 10000, 10000), |
| 484 | RPM_LDO(L5, 0, 1, 0, 2950000, 2950000, NULL, 0, 0), |
| 485 | RPM_LDO(L6, 0, 1, 0, 2950000, 2950000, NULL, 0, 0), |
| 486 | RPM_LDO(L7, 1, 1, 0, 1850000, 2950000, NULL, 10000, 10000), |
| 487 | RPM_LDO(L8, 0, 1, 0, 2800000, 3000000, NULL, 0, 0), |
| 488 | RPM_LDO(L9, 0, 1, 0, 2850000, 2850000, NULL, 0, 0), |
| 489 | RPM_LDO(L10, 0, 1, 0, 2900000, 2900000, NULL, 0, 0), |
| 490 | RPM_LDO(L11, 0, 1, 0, 2850000, 2850000, NULL, 0, 0), |
| 491 | RPM_LDO(L12, 0, 1, 0, 1200000, 1200000, "8921_s4", 0, 0), |
| 492 | RPM_LDO(L14, 0, 1, 0, 1800000, 1800000, NULL, 0, 0), |
| 493 | RPM_LDO(L15, 0, 1, 0, 1800000, 2950000, NULL, 0, 0), |
| 494 | RPM_LDO(L16, 0, 1, 0, 2800000, 2800000, NULL, 0, 0), |
| 495 | RPM_LDO(L17, 0, 1, 0, 1800000, 2950000, NULL, 0, 0), |
| 496 | RPM_LDO(L18, 0, 1, 0, 1300000, 1300000, "8921_s4", 0, 0), |
| 497 | RPM_LDO(L21, 0, 1, 0, 1900000, 1900000, "8921_s8", 0, 0), |
| 498 | RPM_LDO(L22, 0, 1, 0, 2750000, 2750000, NULL, 0, 0), |
| 499 | RPM_LDO(L23, 1, 1, 0, 1800000, 1800000, "8921_s8", 10000, 10000), |
| 500 | RPM_LDO(L24, 0, 1, 1, 1150000, 1150000, "8921_s1", 10000, 10000), |
| 501 | RPM_LDO(L25, 1, 1, 0, 1225000, 1225000, "8921_s1", 10000, 10000), |
| 502 | |
| 503 | /* ID a_on pd ss supply */ |
| 504 | RPM_VS(LVS1, 0, 1, 0, "8921_s4"), |
| 505 | RPM_VS(LVS2, 0, 1, 0, "8921_s1"), |
| 506 | RPM_VS(LVS3, 0, 1, 0, "8921_s4"), |
| 507 | RPM_VS(LVS4, 0, 1, 0, "8921_s4"), |
| 508 | RPM_VS(LVS5, 0, 1, 0, "8921_s4"), |
| 509 | RPM_VS(LVS6, 0, 1, 0, "8921_s4"), |
| 510 | RPM_VS(LVS7, 0, 1, 0, "8921_s4"), |
| 511 | |
| 512 | /* ID a_on ss min_uV max_uV supply freq */ |
| 513 | RPM_NCP(NCP, 0, 0, 1800000, 1800000, "8921_l6", 1p60), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 514 | }; |
| 515 | |
| 516 | int msm_pm8921_regulator_pdata_len __devinitdata = |
| 517 | ARRAY_SIZE(msm_pm8921_regulator_pdata); |
David Collins | 26f0556 | 2011-06-20 09:56:28 -0700 | [diff] [blame] | 518 | |
| 519 | struct rpm_regulator_platform_data msm_rpm_regulator_pdata __devinitdata = { |
| 520 | .init_data = msm_rpm_regulator_init_data, |
| 521 | .num_regulators = ARRAY_SIZE(msm_rpm_regulator_init_data), |
| 522 | }; |