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 | #define pr_fmt(fmt) "%s: " fmt, __func__ |
| 15 | |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame^] | 16 | #include "rpm-regulator-private.h" |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 17 | |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame^] | 18 | /* RPM regulator request formats */ |
| 19 | static struct rpm_vreg_parts ldo_parts = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 20 | .request_len = 2, |
| 21 | .uV = REQUEST_MEMBER(0, 0x007FFFFF, 0), |
| 22 | .pd = REQUEST_MEMBER(0, 0x00800000, 23), |
David Collins | d090389 | 2011-07-14 16:08:30 -0700 | [diff] [blame] | 23 | .pc = REQUEST_MEMBER(0, 0x0F000000, 24), |
| 24 | .pf = REQUEST_MEMBER(0, 0xF0000000, 28), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 25 | .ip = REQUEST_MEMBER(1, 0x000003FF, 0), |
David Collins | d090389 | 2011-07-14 16:08:30 -0700 | [diff] [blame] | 26 | .ia = REQUEST_MEMBER(1, 0x000FFC00, 10), |
| 27 | .fm = REQUEST_MEMBER(1, 0x00700000, 20), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 28 | }; |
| 29 | |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame^] | 30 | static struct rpm_vreg_parts smps_parts = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 31 | .request_len = 2, |
| 32 | .uV = REQUEST_MEMBER(0, 0x007FFFFF, 0), |
| 33 | .pd = REQUEST_MEMBER(0, 0x00800000, 23), |
David Collins | d090389 | 2011-07-14 16:08:30 -0700 | [diff] [blame] | 34 | .pc = REQUEST_MEMBER(0, 0x0F000000, 24), |
| 35 | .pf = REQUEST_MEMBER(0, 0xF0000000, 28), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 36 | .ip = REQUEST_MEMBER(1, 0x000003FF, 0), |
David Collins | d090389 | 2011-07-14 16:08:30 -0700 | [diff] [blame] | 37 | .ia = REQUEST_MEMBER(1, 0x000FFC00, 10), |
| 38 | .fm = REQUEST_MEMBER(1, 0x00700000, 20), |
| 39 | .pm = REQUEST_MEMBER(1, 0x00800000, 23), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 40 | .freq = REQUEST_MEMBER(1, 0x1F000000, 24), |
| 41 | .freq_clk_src = REQUEST_MEMBER(1, 0x60000000, 29), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 42 | }; |
| 43 | |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame^] | 44 | static struct rpm_vreg_parts switch_parts = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 45 | .request_len = 1, |
| 46 | .enable_state = REQUEST_MEMBER(0, 0x00000001, 0), |
| 47 | .pd = REQUEST_MEMBER(0, 0x00000002, 1), |
| 48 | .pc = REQUEST_MEMBER(0, 0x0000003C, 2), |
| 49 | .pf = REQUEST_MEMBER(0, 0x000003C0, 6), |
| 50 | .hpm = REQUEST_MEMBER(0, 0x00000C00, 10), |
| 51 | }; |
| 52 | |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame^] | 53 | static struct rpm_vreg_parts ncp_parts = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 54 | .request_len = 1, |
| 55 | .uV = REQUEST_MEMBER(0, 0x007FFFFF, 0), |
| 56 | .enable_state = REQUEST_MEMBER(0, 0x00800000, 23), |
| 57 | .comp_mode = REQUEST_MEMBER(0, 0x01000000, 24), |
| 58 | .freq = REQUEST_MEMBER(0, 0x3E000000, 25), |
| 59 | }; |
| 60 | |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame^] | 61 | /* Physically available PMIC regulator voltage setpoint ranges */ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 62 | static struct vreg_range pldo_ranges[] = { |
| 63 | VOLTAGE_RANGE( 750000, 1487500, 12500), |
| 64 | VOLTAGE_RANGE(1500000, 3075000, 25000), |
| 65 | VOLTAGE_RANGE(3100000, 4900000, 50000), |
| 66 | }; |
| 67 | |
| 68 | static struct vreg_range nldo_ranges[] = { |
| 69 | VOLTAGE_RANGE( 750000, 1537500, 12500), |
| 70 | }; |
| 71 | |
| 72 | static struct vreg_range nldo1200_ranges[] = { |
| 73 | VOLTAGE_RANGE( 375000, 743750, 6250), |
| 74 | VOLTAGE_RANGE( 750000, 1537500, 12500), |
| 75 | }; |
| 76 | |
| 77 | static struct vreg_range smps_ranges[] = { |
| 78 | VOLTAGE_RANGE( 375000, 737500, 12500), |
| 79 | VOLTAGE_RANGE( 750000, 1487500, 12500), |
| 80 | VOLTAGE_RANGE(1500000, 3075000, 25000), |
| 81 | }; |
| 82 | |
| 83 | static struct vreg_range ftsmps_ranges[] = { |
| 84 | VOLTAGE_RANGE( 350000, 650000, 50000), |
| 85 | VOLTAGE_RANGE( 700000, 1400000, 12500), |
| 86 | VOLTAGE_RANGE(1500000, 3300000, 50000), |
| 87 | }; |
| 88 | |
| 89 | static struct vreg_range ncp_ranges[] = { |
| 90 | VOLTAGE_RANGE(1500000, 3050000, 50000), |
| 91 | }; |
| 92 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 93 | static struct vreg_set_points pldo_set_points = SET_POINTS(pldo_ranges); |
| 94 | static struct vreg_set_points nldo_set_points = SET_POINTS(nldo_ranges); |
| 95 | static struct vreg_set_points nldo1200_set_points = SET_POINTS(nldo1200_ranges); |
| 96 | static struct vreg_set_points smps_set_points = SET_POINTS(smps_ranges); |
| 97 | static struct vreg_set_points ftsmps_set_points = SET_POINTS(ftsmps_ranges); |
| 98 | static struct vreg_set_points ncp_set_points = SET_POINTS(ncp_ranges); |
| 99 | |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame^] | 100 | static struct vreg_set_points *all_set_points[] = { |
| 101 | &pldo_set_points, |
| 102 | &nldo_set_points, |
| 103 | &nldo1200_set_points, |
| 104 | &smps_set_points, |
| 105 | &ftsmps_set_points, |
| 106 | &ncp_set_points, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 107 | }; |
| 108 | |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame^] | 109 | #define LDO(_id, _name, _name_pc, _ranges, _hpm_min_load) \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 110 | [RPM_VREG_ID_PM8921_##_id] = { \ |
| 111 | .req = { \ |
| 112 | [0] = { .id = MSM_RPM_ID_PM8921_##_id##_0, }, \ |
| 113 | [1] = { .id = MSM_RPM_ID_PM8921_##_id##_1, }, \ |
| 114 | }, \ |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame^] | 115 | .hpm_min_load = RPM_VREG_8960_##_hpm_min_load##_HPM_MIN_LOAD, \ |
| 116 | .type = RPM_REGULATOR_TYPE_LDO, \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 117 | .set_points = &_ranges##_set_points, \ |
| 118 | .part = &ldo_parts, \ |
| 119 | .id = RPM_VREG_ID_PM8921_##_id, \ |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame^] | 120 | .rdesc.name = _name, \ |
| 121 | .rdesc_pc.name = _name_pc, \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 122 | } |
| 123 | |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame^] | 124 | #define SMPS(_id, _name, _name_pc, _ranges, _hpm_min_load) \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 125 | [RPM_VREG_ID_PM8921_##_id] = { \ |
| 126 | .req = { \ |
| 127 | [0] = { .id = MSM_RPM_ID_PM8921_##_id##_0, }, \ |
| 128 | [1] = { .id = MSM_RPM_ID_PM8921_##_id##_1, }, \ |
| 129 | }, \ |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame^] | 130 | .hpm_min_load = RPM_VREG_8960_##_hpm_min_load##_HPM_MIN_LOAD, \ |
| 131 | .type = RPM_REGULATOR_TYPE_SMPS, \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 132 | .set_points = &_ranges##_set_points, \ |
| 133 | .part = &smps_parts, \ |
| 134 | .id = RPM_VREG_ID_PM8921_##_id, \ |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame^] | 135 | .rdesc.name = _name, \ |
| 136 | .rdesc_pc.name = _name_pc, \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 137 | } |
| 138 | |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame^] | 139 | #define LVS(_id, _name, _name_pc) \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 140 | [RPM_VREG_ID_PM8921_##_id] = { \ |
| 141 | .req = { \ |
| 142 | [0] = { .id = MSM_RPM_ID_PM8921_##_id, }, \ |
| 143 | [1] = { .id = -1, }, \ |
| 144 | }, \ |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame^] | 145 | .type = RPM_REGULATOR_TYPE_VS, \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 146 | .part = &switch_parts, \ |
| 147 | .id = RPM_VREG_ID_PM8921_##_id, \ |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame^] | 148 | .rdesc.name = _name, \ |
| 149 | .rdesc_pc.name = _name_pc, \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 150 | } |
| 151 | |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame^] | 152 | #define MVS(_vreg_id, _name, _name_pc, _rpm_id) \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 153 | [RPM_VREG_ID_PM8921_##_vreg_id] = { \ |
| 154 | .req = { \ |
| 155 | [0] = { .id = MSM_RPM_ID_##_rpm_id, }, \ |
| 156 | [1] = { .id = -1, }, \ |
| 157 | }, \ |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame^] | 158 | .type = RPM_REGULATOR_TYPE_VS, \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 159 | .part = &switch_parts, \ |
| 160 | .id = RPM_VREG_ID_PM8921_##_vreg_id, \ |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame^] | 161 | .rdesc.name = _name, \ |
| 162 | .rdesc_pc.name = _name_pc, \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 163 | } |
| 164 | |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame^] | 165 | #define NCP(_id, _name, _name_pc) \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 166 | [RPM_VREG_ID_PM8921_##_id] = { \ |
| 167 | .req = { \ |
| 168 | [0] = { .id = MSM_RPM_ID_##_id##_0, }, \ |
| 169 | [1] = { .id = MSM_RPM_ID_##_id##_1, }, \ |
| 170 | }, \ |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame^] | 171 | .type = RPM_REGULATOR_TYPE_NCP, \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 172 | .set_points = &ncp_set_points, \ |
| 173 | .part = &ncp_parts, \ |
| 174 | .id = RPM_VREG_ID_PM8921_##_id, \ |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame^] | 175 | .rdesc.name = _name, \ |
| 176 | .rdesc_pc.name = _name_pc, \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 177 | } |
| 178 | |
| 179 | static struct vreg vregs[] = { |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame^] | 180 | LDO(L1, "8921_l1", "8921_l1_pc", nldo, LDO_150), |
| 181 | LDO(L2, "8921_l2", "8921_l2_pc", nldo, LDO_150), |
| 182 | LDO(L3, "8921_l3", "8921_l3_pc", pldo, LDO_150), |
| 183 | LDO(L4, "8921_l4", "8921_l4_pc", pldo, LDO_50), |
| 184 | LDO(L5, "8921_l5", "8921_l5_pc", pldo, LDO_300), |
| 185 | LDO(L6, "8921_l6", "8921_l6_pc", pldo, LDO_600), |
| 186 | LDO(L7, "8921_l7", "8921_l7_pc", pldo, LDO_150), |
| 187 | LDO(L8, "8921_l8", "8921_l8_pc", pldo, LDO_300), |
| 188 | LDO(L9, "8921_l9", "8921_l9_pc", pldo, LDO_300), |
| 189 | LDO(L10, "8921_l10", "8921_l10_pc", pldo, LDO_600), |
| 190 | LDO(L11, "8921_l11", "8921_l11_pc", pldo, LDO_150), |
| 191 | LDO(L12, "8921_l12", "8921_l12_pc", nldo, LDO_150), |
| 192 | LDO(L14, "8921_l14", "8921_l14_pc", pldo, LDO_50), |
| 193 | LDO(L15, "8921_l15", "8921_l15_pc", pldo, LDO_150), |
| 194 | LDO(L16, "8921_l16", "8921_l16_pc", pldo, LDO_300), |
| 195 | LDO(L17, "8921_l17", "8921_l17_pc", pldo, LDO_150), |
| 196 | LDO(L18, "8921_l18", "8921_l18_pc", nldo, LDO_150), |
| 197 | LDO(L21, "8921_l21", "8921_l21_pc", pldo, LDO_150), |
| 198 | LDO(L22, "8921_l22", "8921_l22_pc", pldo, LDO_150), |
| 199 | LDO(L23, "8921_l23", "8921_l23_pc", pldo, LDO_150), |
| 200 | LDO(L24, "8921_l24", NULL, nldo1200, LDO_1200), |
| 201 | LDO(L25, "8921_l25", NULL, nldo1200, LDO_1200), |
| 202 | LDO(L26, "8921_l26", NULL, nldo1200, LDO_1200), |
| 203 | LDO(L27, "8921_l27", NULL, nldo1200, LDO_1200), |
| 204 | LDO(L28, "8921_l28", NULL, nldo1200, LDO_1200), |
| 205 | LDO(L29, "8921_l29", "8921_l29_pc", pldo, LDO_150), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 206 | |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame^] | 207 | SMPS(S1, "8921_s1", "8921_s1_pc", smps, SMPS_1500), |
| 208 | SMPS(S2, "8921_s2", "8921_s2_pc", smps, SMPS_1500), |
| 209 | SMPS(S3, "8921_s3", "8921_s3_pc", smps, SMPS_1500), |
| 210 | SMPS(S4, "8921_s4", "8921_s4_pc", smps, SMPS_1500), |
| 211 | SMPS(S5, "8921_s5", NULL, ftsmps, SMPS_2000), |
| 212 | SMPS(S6, "8921_s6", NULL, ftsmps, SMPS_2000), |
| 213 | SMPS(S7, "8921_s7", "8921_s7_pc", smps, SMPS_1500), |
| 214 | SMPS(S8, "8921_s8", "8921_s8_pc", smps, SMPS_1500), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 215 | |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame^] | 216 | LVS(LVS1, "8921_lvs1", "8921_lvs1_pc"), |
| 217 | LVS(LVS2, "8921_lvs2", NULL), |
| 218 | LVS(LVS3, "8921_lvs3", "8921_lvs3_pc"), |
| 219 | LVS(LVS4, "8921_lvs4", "8921_lvs4_pc"), |
| 220 | LVS(LVS5, "8921_lvs5", "8921_lvs5_pc"), |
| 221 | LVS(LVS6, "8921_lvs6", "8921_lvs6_pc"), |
| 222 | LVS(LVS7, "8921_lvs7", "8921_lvs7_pc"), |
| 223 | MVS(USB_OTG, "8921_usb_otg", NULL, USB_OTG_SWITCH), |
| 224 | MVS(HDMI_MVS, "8921_hdmi_mvs", NULL, HDMI_SWITCH), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 225 | |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame^] | 226 | NCP(NCP, "8921_ncp", NULL), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 227 | }; |
| 228 | |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame^] | 229 | static const char *pin_func_label[] = { |
| 230 | [RPM_VREG_PIN_FN_8960_DONT_CARE] = "don't care", |
| 231 | [RPM_VREG_PIN_FN_8960_ENABLE] = "on/off", |
| 232 | [RPM_VREG_PIN_FN_8960_MODE] = "HPM/LPM", |
| 233 | [RPM_VREG_PIN_FN_8960_SLEEP_B] = "sleep_b", |
| 234 | [RPM_VREG_PIN_FN_8960_NONE] = "none", |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 235 | }; |
| 236 | |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame^] | 237 | static const char *force_mode_label[] = { |
| 238 | [RPM_VREG_FORCE_MODE_8960_NONE] = "none", |
| 239 | [RPM_VREG_FORCE_MODE_8960_LPM] = "LPM", |
| 240 | [RPM_VREG_FORCE_MODE_8960_AUTO] = "auto", |
| 241 | [RPM_VREG_FORCE_MODE_8960_HPM] = "HPM", |
| 242 | [RPM_VREG_FORCE_MODE_8960_BYPASS] = "BYP", |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 243 | }; |
| 244 | |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame^] | 245 | static const char *power_mode_label[] = { |
| 246 | [RPM_VREG_POWER_MODE_8960_HYSTERETIC] = "HYS", |
| 247 | [RPM_VREG_POWER_MODE_8960_PWM] = "PWM", |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 248 | }; |
| 249 | |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame^] | 250 | static const char *pin_control_label[] = { |
| 251 | " D1", |
| 252 | " A0", |
| 253 | " A1", |
| 254 | " A2", |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 255 | }; |
| 256 | |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame^] | 257 | static int is_real_id(int id) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 258 | { |
| 259 | return (id >= 0) && (id <= RPM_VREG_ID_PM8921_MAX_REAL); |
| 260 | } |
| 261 | |
| 262 | static int pc_id_to_real_id(int id) |
| 263 | { |
| 264 | int real_id; |
| 265 | |
| 266 | if (id >= RPM_VREG_ID_PM8921_L1_PC && id <= RPM_VREG_ID_PM8921_L23_PC) |
| 267 | real_id = id - RPM_VREG_ID_PM8921_L1_PC; |
| 268 | else if (id >= RPM_VREG_ID_PM8921_L29_PC |
| 269 | && id <= RPM_VREG_ID_PM8921_S4_PC) |
| 270 | real_id = id - RPM_VREG_ID_PM8921_L29_PC |
| 271 | + RPM_VREG_ID_PM8921_L29; |
| 272 | else if (id >= RPM_VREG_ID_PM8921_S7_PC |
| 273 | && id <= RPM_VREG_ID_PM8921_LVS1_PC) |
| 274 | real_id = id - RPM_VREG_ID_PM8921_S7_PC + RPM_VREG_ID_PM8921_S7; |
| 275 | else |
| 276 | real_id = id - RPM_VREG_ID_PM8921_LVS3_PC |
| 277 | + RPM_VREG_ID_PM8921_LVS3; |
| 278 | |
| 279 | return real_id; |
| 280 | } |
| 281 | |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame^] | 282 | static struct vreg_config config = { |
| 283 | .vregs = vregs, |
| 284 | .vregs_len = ARRAY_SIZE(vregs), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 285 | |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame^] | 286 | .vreg_id_min = RPM_VREG_ID_PM8921_L1, |
| 287 | .vreg_id_max = RPM_VREG_ID_PM8921_MAX, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 288 | |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame^] | 289 | .pin_func_none = RPM_VREG_PIN_FN_8960_NONE, |
| 290 | .pin_func_sleep_b = RPM_VREG_PIN_FN_8960_SLEEP_B, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 291 | |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame^] | 292 | .mode_lpm = REGULATOR_MODE_IDLE, |
| 293 | .mode_hpm = REGULATOR_MODE_NORMAL, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 294 | |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame^] | 295 | .set_points = all_set_points, |
| 296 | .set_points_len = ARRAY_SIZE(all_set_points), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 297 | |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame^] | 298 | .label_pin_ctrl = pin_control_label, |
| 299 | .label_pin_ctrl_len = ARRAY_SIZE(pin_control_label), |
| 300 | .label_pin_func = pin_func_label, |
| 301 | .label_pin_func_len = ARRAY_SIZE(pin_func_label), |
| 302 | .label_force_mode = force_mode_label, |
| 303 | .label_force_mode_len = ARRAY_SIZE(force_mode_label), |
| 304 | .label_power_mode = power_mode_label, |
| 305 | .label_power_mode_len = ARRAY_SIZE(power_mode_label), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 306 | |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame^] | 307 | .is_real_id = is_real_id, |
| 308 | .pc_id_to_real_id = pc_id_to_real_id, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 309 | }; |
| 310 | |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame^] | 311 | struct vreg_config *get_config_8960(void) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 312 | { |
David Collins | 6f032ba | 2011-08-31 14:08:15 -0700 | [diff] [blame^] | 313 | return &config; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 314 | } |