Justin Paupore | b3a33b7 | 2011-08-23 15:30:32 -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 "board-msm7x27a-regulator.h" |
| 15 | |
| 16 | #define PCOM_VREG_CONSUMERS(name) \ |
| 17 | static struct regulator_consumer_supply __pcom_vreg_supply_##name[] |
| 18 | |
| 19 | #define PCOM_VREG_INIT_DATA(_name, _supply, _min_uV, _max_uV, _always_on, \ |
| 20 | _boot_on, _apply_uV, _supply_uV)\ |
| 21 | { \ |
| 22 | .supply_regulator = _supply, \ |
| 23 | .consumer_supplies = __pcom_vreg_supply_##_name, \ |
| 24 | .num_consumer_supplies = ARRAY_SIZE(__pcom_vreg_supply_##_name), \ |
| 25 | .constraints = { \ |
| 26 | .name = #_name, \ |
| 27 | .min_uV = _min_uV, \ |
| 28 | .max_uV = _max_uV, \ |
| 29 | .valid_modes_mask = REGULATOR_MODE_NORMAL, \ |
| 30 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | \ |
| 31 | REGULATOR_CHANGE_STATUS, \ |
| 32 | .input_uV = _supply_uV, \ |
| 33 | .apply_uV = _apply_uV, \ |
| 34 | .boot_on = _boot_on, \ |
| 35 | .always_on = _always_on \ |
| 36 | } \ |
| 37 | } |
| 38 | |
| 39 | #define PCOM_VREG_SMP(_name, _id, _supply, _min_uV, _max_uV, _rise_time, \ |
| 40 | _pulldown, _always_on, _boot_on, _apply_uV, _supply_uV) \ |
| 41 | { \ |
| 42 | .init_data = PCOM_VREG_INIT_DATA(_name, _supply, _min_uV, _max_uV, \ |
| 43 | _always_on, _boot_on, _apply_uV, _supply_uV), \ |
| 44 | .id = _id, \ |
| 45 | .rise_time = _rise_time, \ |
| 46 | .pulldown = _pulldown, \ |
| 47 | .negative = 0, \ |
| 48 | } |
| 49 | |
| 50 | #define PCOM_VREG_LDO PCOM_VREG_SMP |
| 51 | |
| 52 | #define PCOM_VREG_NCP(_name, _id, _supply, _min_uV, _max_uV, _rise_time, \ |
| 53 | _always_on, _boot_on, _apply_uV, _supply_uV) \ |
| 54 | { \ |
| 55 | .init_data = PCOM_VREG_INIT_DATA(_name, _supply, -(_min_uV), \ |
| 56 | -(_max_uV), _always_on, _boot_on, _apply_uV, _supply_uV), \ |
| 57 | .id = _id, \ |
| 58 | .rise_time = _rise_time, \ |
| 59 | .pulldown = -1, \ |
| 60 | .negative = 1, \ |
| 61 | } |
| 62 | |
| 63 | PCOM_VREG_CONSUMERS(smps1) = { |
| 64 | REGULATOR_SUPPLY("smps1", NULL), |
| 65 | REGULATOR_SUPPLY("msmc1", NULL), |
| 66 | }; |
| 67 | |
| 68 | PCOM_VREG_CONSUMERS(smps2) = { |
| 69 | REGULATOR_SUPPLY("smps2", NULL), |
| 70 | REGULATOR_SUPPLY("msmc2", NULL), |
| 71 | }; |
| 72 | |
| 73 | PCOM_VREG_CONSUMERS(smps3) = { |
| 74 | REGULATOR_SUPPLY("smps3", NULL), |
| 75 | REGULATOR_SUPPLY("msme1", NULL), |
| 76 | }; |
| 77 | |
| 78 | PCOM_VREG_CONSUMERS(smps4) = { |
| 79 | REGULATOR_SUPPLY("smps4", NULL), |
| 80 | REGULATOR_SUPPLY("rf", NULL), |
| 81 | }; |
| 82 | |
| 83 | PCOM_VREG_CONSUMERS(ldo01) = { |
| 84 | REGULATOR_SUPPLY("ldo01", NULL), |
| 85 | REGULATOR_SUPPLY("ldo1", NULL), |
| 86 | REGULATOR_SUPPLY("rfrx1", NULL), |
| 87 | }; |
| 88 | |
| 89 | PCOM_VREG_CONSUMERS(ldo02) = { |
| 90 | REGULATOR_SUPPLY("ldo02", NULL), |
| 91 | REGULATOR_SUPPLY("ldo2", NULL), |
| 92 | REGULATOR_SUPPLY("rfrx2", NULL), |
| 93 | }; |
| 94 | |
| 95 | PCOM_VREG_CONSUMERS(ldo03) = { |
| 96 | REGULATOR_SUPPLY("ldo03", NULL), |
| 97 | REGULATOR_SUPPLY("ldo3", NULL), |
| 98 | REGULATOR_SUPPLY("mddi", NULL), |
| 99 | }; |
| 100 | |
| 101 | PCOM_VREG_CONSUMERS(ldo04) = { |
| 102 | REGULATOR_SUPPLY("ldo04", NULL), |
| 103 | REGULATOR_SUPPLY("ldo4", NULL), |
| 104 | REGULATOR_SUPPLY("pllx", NULL), |
| 105 | }; |
| 106 | |
| 107 | PCOM_VREG_CONSUMERS(ldo05) = { |
| 108 | REGULATOR_SUPPLY("ldo05", NULL), |
| 109 | REGULATOR_SUPPLY("ldo5", NULL), |
| 110 | REGULATOR_SUPPLY("wlan2", NULL), |
| 111 | }; |
| 112 | |
| 113 | PCOM_VREG_CONSUMERS(ldo06) = { |
| 114 | REGULATOR_SUPPLY("ldo06", NULL), |
| 115 | REGULATOR_SUPPLY("ldo6", NULL), |
| 116 | REGULATOR_SUPPLY("wlan3", NULL), |
| 117 | }; |
| 118 | |
| 119 | PCOM_VREG_CONSUMERS(ldo07) = { |
| 120 | REGULATOR_SUPPLY("ldo07", NULL), |
| 121 | REGULATOR_SUPPLY("ldo7", NULL), |
| 122 | REGULATOR_SUPPLY("msma", NULL), |
| 123 | }; |
| 124 | |
| 125 | PCOM_VREG_CONSUMERS(ldo08) = { |
| 126 | REGULATOR_SUPPLY("ldo08", NULL), |
| 127 | REGULATOR_SUPPLY("ldo8", NULL), |
| 128 | REGULATOR_SUPPLY("tcxo", NULL), |
| 129 | }; |
| 130 | |
| 131 | PCOM_VREG_CONSUMERS(ldo09) = { |
| 132 | REGULATOR_SUPPLY("ldo09", NULL), |
| 133 | REGULATOR_SUPPLY("ldo9", NULL), |
| 134 | REGULATOR_SUPPLY("usb2", NULL), |
| 135 | }; |
| 136 | |
| 137 | PCOM_VREG_CONSUMERS(ldo10) = { |
| 138 | REGULATOR_SUPPLY("ldo10", NULL), |
| 139 | REGULATOR_SUPPLY("emmc", NULL), |
| 140 | }; |
| 141 | |
| 142 | PCOM_VREG_CONSUMERS(ldo11) = { |
| 143 | REGULATOR_SUPPLY("ldo11", NULL), |
| 144 | REGULATOR_SUPPLY("wlan_tcx0", NULL), |
| 145 | }; |
| 146 | |
| 147 | PCOM_VREG_CONSUMERS(ldo12) = { |
| 148 | REGULATOR_SUPPLY("ldo12", NULL), |
| 149 | REGULATOR_SUPPLY("gp2", NULL), |
| 150 | }; |
| 151 | |
| 152 | PCOM_VREG_CONSUMERS(ldo13) = { |
| 153 | REGULATOR_SUPPLY("ldo13", NULL), |
| 154 | REGULATOR_SUPPLY("mmc", NULL), |
| 155 | }; |
| 156 | |
| 157 | PCOM_VREG_CONSUMERS(ldo14) = { |
| 158 | REGULATOR_SUPPLY("ldo14", NULL), |
| 159 | REGULATOR_SUPPLY("usb", NULL), |
| 160 | }; |
| 161 | |
| 162 | PCOM_VREG_CONSUMERS(ldo15) = { |
| 163 | REGULATOR_SUPPLY("ldo15", NULL), |
| 164 | REGULATOR_SUPPLY("usim2", NULL), |
| 165 | }; |
| 166 | |
| 167 | PCOM_VREG_CONSUMERS(ldo16) = { |
| 168 | REGULATOR_SUPPLY("ldo16", NULL), |
| 169 | REGULATOR_SUPPLY("ruim", NULL), |
| 170 | }; |
| 171 | |
| 172 | PCOM_VREG_CONSUMERS(ldo17) = { |
| 173 | REGULATOR_SUPPLY("ldo17", NULL), |
| 174 | REGULATOR_SUPPLY("bt", NULL), |
| 175 | }; |
| 176 | |
| 177 | PCOM_VREG_CONSUMERS(ldo18) = { |
| 178 | REGULATOR_SUPPLY("ldo18", NULL), |
| 179 | REGULATOR_SUPPLY("rftx", NULL), |
| 180 | }; |
| 181 | |
| 182 | PCOM_VREG_CONSUMERS(ldo19) = { |
| 183 | REGULATOR_SUPPLY("ldo19", NULL), |
| 184 | REGULATOR_SUPPLY("wlan4", NULL), |
| 185 | }; |
| 186 | |
| 187 | PCOM_VREG_CONSUMERS(ncp) = { |
| 188 | REGULATOR_SUPPLY("ncp", NULL), |
| 189 | }; |
| 190 | |
| 191 | static struct proccomm_regulator_info msm7x27a_pcom_vreg_info[] = { |
| 192 | /* Standard regulators (SMPS and LDO) |
| 193 | * R = rise time (us) |
| 194 | * P = pulldown (1 = pull down, 0 = float, -1 = don't care) |
| 195 | * A = always on |
| 196 | * B = boot on |
| 197 | * V = automatic voltage set (meaningful for single-voltage regs only) |
| 198 | * S = supply voltage (uV) |
| 199 | * name id supp min uV max uV R P A B V S */ |
| 200 | PCOM_VREG_SMP(smps1, 3, NULL, 1100000, 1100000, 0, -1, 0, 0, 0, 0), |
| 201 | PCOM_VREG_SMP(smps2, 4, NULL, 1100000, 1100000, 0, -1, 0, 0, 0, 0), |
| 202 | PCOM_VREG_SMP(smps3, 2, NULL, 1800000, 1800000, 0, -1, 0, 0, 0, 0), |
| 203 | PCOM_VREG_SMP(smps4, 24, NULL, 2100000, 2100000, 0, -1, 0, 0, 0, 0), |
| 204 | PCOM_VREG_LDO(ldo01, 12, NULL, 2100000, 2100000, 0, -1, 0, 0, 0, 0), |
| 205 | PCOM_VREG_LDO(ldo02, 13, NULL, 2850000, 2850000, 0, -1, 0, 0, 0, 0), |
| 206 | PCOM_VREG_LDO(ldo03, 49, NULL, 1200000, 1200000, 0, -1, 0, 0, 0, 0), |
| 207 | PCOM_VREG_LDO(ldo04, 50, NULL, 1100000, 1100000, 0, -1, 0, 0, 0, 0), |
| 208 | PCOM_VREG_LDO(ldo05, 45, NULL, 1300000, 1300000, 0, -1, 0, 0, 0, 0), |
| 209 | PCOM_VREG_LDO(ldo06, 51, NULL, 1200000, 1200000, 0, -1, 0, 0, 0, 0), |
| 210 | PCOM_VREG_LDO(ldo07, 0, NULL, 2600000, 2600000, 0, -1, 0, 0, 0, 0), |
| 211 | PCOM_VREG_LDO(ldo08, 9, NULL, 2850000, 2850000, 0, -1, 0, 0, 0, 0), |
| 212 | PCOM_VREG_LDO(ldo09, 44, NULL, 1800000, 1800000, 0, -1, 0, 0, 0, 0), |
| 213 | PCOM_VREG_LDO(ldo10, 52, NULL, 1800000, 3000000, 0, -1, 0, 0, 0, 0), |
| 214 | PCOM_VREG_LDO(ldo11, 53, NULL, 1800000, 1800000, 0, -1, 0, 0, 0, 0), |
| 215 | PCOM_VREG_LDO(ldo12, 21, NULL, 2850000, 2850000, 0, -1, 0, 0, 0, 0), |
| 216 | PCOM_VREG_LDO(ldo13, 18, NULL, 2850000, 2850000, 0, -1, 0, 0, 0, 0), |
| 217 | PCOM_VREG_LDO(ldo14, 16, NULL, 3300000, 3300000, 0, -1, 0, 0, 0, 0), |
| 218 | PCOM_VREG_LDO(ldo15, 54, NULL, 1800000, 2850000, 0, -1, 0, 0, 0, 0), |
| 219 | PCOM_VREG_LDO(ldo16, 19, NULL, 1800000, 2850000, 0, -1, 0, 0, 0, 0), |
| 220 | PCOM_VREG_LDO(ldo17, 56, NULL, 2900000, 3000000, 0, -1, 0, 0, 0, 0), |
| 221 | PCOM_VREG_LDO(ldo18, 11, NULL, 2700000, 2700000, 0, -1, 0, 0, 0, 0), |
| 222 | PCOM_VREG_LDO(ldo19, 57, NULL, 1200000, 1200000, 0, -1, 0, 0, 0, 0), |
| 223 | |
| 224 | PCOM_VREG_NCP(ncp, 31, NULL, -1800000, -1800000, 0, 0, 0, 0, 0), |
| 225 | }; |
| 226 | |
| 227 | struct proccomm_regulator_platform_data msm7x27a_proccomm_regulator_data = { |
| 228 | .regs = msm7x27a_pcom_vreg_info, |
| 229 | .nregs = ARRAY_SIZE(msm7x27a_pcom_vreg_info) |
| 230 | }; |