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