Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) ST-Ericsson SA 2010 |
| 3 | * |
| 4 | * License Terms: GNU General Public License v2 |
| 5 | * |
Bengt Jonsson | e1159e6 | 2010-12-10 11:08:44 +0100 | [diff] [blame] | 6 | * Authors: Sundar Iyer <sundar.iyer@stericsson.com> for ST-Ericsson |
| 7 | * Bengt Jonsson <bengt.g.jonsson@stericsson.com> for ST-Ericsson |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 8 | * Daniel Willerud <daniel.willerud@stericsson.com> for ST-Ericsson |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 9 | * |
| 10 | * AB8500 peripheral regulators |
| 11 | * |
Bengt Jonsson | e1159e6 | 2010-12-10 11:08:44 +0100 | [diff] [blame] | 12 | * AB8500 supports the following regulators: |
Bengt Jonsson | ea05ef3 | 2011-03-10 14:43:31 +0100 | [diff] [blame] | 13 | * VAUX1/2/3, VINTCORE, VTVOUT, VUSB, VAUDIO, VAMIC1/2, VDMIC, VANA |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 14 | * |
| 15 | * AB8505 supports the following regulators: |
| 16 | * VAUX1/2/3/4/5/6, VINTCORE, VADC, VUSB, VAUDIO, VAMIC1/2, VDMIC, VANA |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 17 | */ |
| 18 | #include <linux/init.h> |
| 19 | #include <linux/kernel.h> |
Paul Gortmaker | 65602c3 | 2011-07-17 16:28:23 -0400 | [diff] [blame] | 20 | #include <linux/module.h> |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 21 | #include <linux/err.h> |
| 22 | #include <linux/platform_device.h> |
Mattias Wallin | 47c1697 | 2010-09-10 17:47:56 +0200 | [diff] [blame] | 23 | #include <linux/mfd/abx500.h> |
Linus Walleij | ee66e65 | 2011-12-02 14:16:33 +0100 | [diff] [blame] | 24 | #include <linux/mfd/abx500/ab8500.h> |
Lee Jones | 3a8334b | 2012-05-17 14:45:16 +0100 | [diff] [blame] | 25 | #include <linux/of.h> |
| 26 | #include <linux/regulator/of_regulator.h> |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 27 | #include <linux/regulator/driver.h> |
| 28 | #include <linux/regulator/machine.h> |
| 29 | #include <linux/regulator/ab8500.h> |
Lee Jones | 3a8334b | 2012-05-17 14:45:16 +0100 | [diff] [blame] | 30 | #include <linux/slab.h> |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 31 | |
| 32 | /** |
Lee Jones | 3fe5228 | 2013-04-02 13:24:12 +0100 | [diff] [blame] | 33 | * struct ab8500_shared_mode - is used when mode is shared between |
| 34 | * two regulators. |
| 35 | * @shared_regulator: pointer to the other sharing regulator |
| 36 | * @lp_mode_req: low power mode requested by this regulator |
| 37 | */ |
| 38 | struct ab8500_shared_mode { |
| 39 | struct ab8500_regulator_info *shared_regulator; |
| 40 | bool lp_mode_req; |
| 41 | }; |
| 42 | |
| 43 | /** |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 44 | * struct ab8500_regulator_info - ab8500 regulator information |
Bengt Jonsson | e1159e6 | 2010-12-10 11:08:44 +0100 | [diff] [blame] | 45 | * @dev: device pointer |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 46 | * @desc: regulator description |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 47 | * @regulator_dev: regulator device |
Lee Jones | 3fe5228 | 2013-04-02 13:24:12 +0100 | [diff] [blame] | 48 | * @shared_mode: used when mode is shared between two regulators |
Emeric Vigier | bd28a15 | 2013-03-21 15:58:59 +0000 | [diff] [blame] | 49 | * @is_enabled: status of regulator (on/off) |
Bengt Jonsson | 7ce4669 | 2013-03-21 15:59:00 +0000 | [diff] [blame] | 50 | * @load_lp_uA: maximum load in idle (low power) mode |
Mattias Wallin | 47c1697 | 2010-09-10 17:47:56 +0200 | [diff] [blame] | 51 | * @update_bank: bank to control on/off |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 52 | * @update_reg: register to control on/off |
Emeric Vigier | bd28a15 | 2013-03-21 15:58:59 +0000 | [diff] [blame] | 53 | * @update_mask: mask to enable/disable and set mode of regulator |
| 54 | * @update_val: bits holding the regulator current mode |
| 55 | * @update_val_idle: bits to enable the regulator in idle (low power) mode |
| 56 | * @update_val_normal: bits to enable the regulator in normal (high power) mode |
Lee Jones | 3fe5228 | 2013-04-02 13:24:12 +0100 | [diff] [blame] | 57 | * @mode_bank: bank with location of mode register |
| 58 | * @mode_reg: mode register |
| 59 | * @mode_mask: mask for setting mode |
| 60 | * @mode_val_idle: mode setting for low power |
| 61 | * @mode_val_normal: mode setting for normal power |
Mattias Wallin | 47c1697 | 2010-09-10 17:47:56 +0200 | [diff] [blame] | 62 | * @voltage_bank: bank to control regulator voltage |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 63 | * @voltage_reg: register to control regulator voltage |
| 64 | * @voltage_mask: mask to control regulator voltage |
Linus Walleij | a0a7014 | 2012-08-20 18:41:35 +0200 | [diff] [blame] | 65 | * @voltage_shift: shift to control regulator voltage |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 66 | */ |
| 67 | struct ab8500_regulator_info { |
| 68 | struct device *dev; |
| 69 | struct regulator_desc desc; |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 70 | struct regulator_dev *regulator; |
Lee Jones | 3fe5228 | 2013-04-02 13:24:12 +0100 | [diff] [blame] | 71 | struct ab8500_shared_mode *shared_mode; |
Emeric Vigier | bd28a15 | 2013-03-21 15:58:59 +0000 | [diff] [blame] | 72 | bool is_enabled; |
Bengt Jonsson | 7ce4669 | 2013-03-21 15:59:00 +0000 | [diff] [blame] | 73 | int load_lp_uA; |
Mattias Wallin | 47c1697 | 2010-09-10 17:47:56 +0200 | [diff] [blame] | 74 | u8 update_bank; |
| 75 | u8 update_reg; |
Bengt Jonsson | e1159e6 | 2010-12-10 11:08:44 +0100 | [diff] [blame] | 76 | u8 update_mask; |
Emeric Vigier | bd28a15 | 2013-03-21 15:58:59 +0000 | [diff] [blame] | 77 | u8 update_val; |
| 78 | u8 update_val_idle; |
| 79 | u8 update_val_normal; |
Lee Jones | 3fe5228 | 2013-04-02 13:24:12 +0100 | [diff] [blame] | 80 | u8 mode_bank; |
| 81 | u8 mode_reg; |
| 82 | u8 mode_mask; |
| 83 | u8 mode_val_idle; |
| 84 | u8 mode_val_normal; |
Mattias Wallin | 47c1697 | 2010-09-10 17:47:56 +0200 | [diff] [blame] | 85 | u8 voltage_bank; |
| 86 | u8 voltage_reg; |
| 87 | u8 voltage_mask; |
Linus Walleij | a0a7014 | 2012-08-20 18:41:35 +0200 | [diff] [blame] | 88 | u8 voltage_shift; |
Lee Jones | d7607ba | 2013-04-02 13:24:11 +0100 | [diff] [blame] | 89 | struct { |
| 90 | u8 voltage_limit; |
| 91 | u8 voltage_bank; |
| 92 | u8 voltage_reg; |
| 93 | u8 voltage_mask; |
| 94 | u8 voltage_shift; |
| 95 | } expand_register; |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 96 | }; |
| 97 | |
| 98 | /* voltage tables for the vauxn/vintcore supplies */ |
Axel Lin | ec1cc4d | 2012-05-20 10:33:35 +0800 | [diff] [blame] | 99 | static const unsigned int ldo_vauxn_voltages[] = { |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 100 | 1100000, |
| 101 | 1200000, |
| 102 | 1300000, |
| 103 | 1400000, |
| 104 | 1500000, |
| 105 | 1800000, |
| 106 | 1850000, |
| 107 | 1900000, |
| 108 | 2500000, |
| 109 | 2650000, |
| 110 | 2700000, |
| 111 | 2750000, |
| 112 | 2800000, |
| 113 | 2900000, |
| 114 | 3000000, |
| 115 | 3300000, |
| 116 | }; |
| 117 | |
Axel Lin | ec1cc4d | 2012-05-20 10:33:35 +0800 | [diff] [blame] | 118 | static const unsigned int ldo_vaux3_voltages[] = { |
Bengt Jonsson | 2b75151 | 2010-12-10 11:08:43 +0100 | [diff] [blame] | 119 | 1200000, |
| 120 | 1500000, |
| 121 | 1800000, |
| 122 | 2100000, |
| 123 | 2500000, |
| 124 | 2750000, |
| 125 | 2790000, |
| 126 | 2910000, |
| 127 | }; |
| 128 | |
Lee Jones | 62ab411 | 2013-03-28 16:11:18 +0000 | [diff] [blame] | 129 | static const unsigned int ldo_vaux56_voltages[] = { |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 130 | 1800000, |
| 131 | 1050000, |
| 132 | 1100000, |
| 133 | 1200000, |
| 134 | 1500000, |
| 135 | 2200000, |
| 136 | 2500000, |
| 137 | 2790000, |
| 138 | }; |
| 139 | |
Lee Jones | 62ab411 | 2013-03-28 16:11:18 +0000 | [diff] [blame] | 140 | static const unsigned int ldo_vaux3_ab8540_voltages[] = { |
Lee Jones | ae0a9a3 | 2013-03-28 16:11:16 +0000 | [diff] [blame] | 141 | 1200000, |
| 142 | 1500000, |
| 143 | 1800000, |
| 144 | 2100000, |
| 145 | 2500000, |
| 146 | 2750000, |
| 147 | 2790000, |
| 148 | 2910000, |
| 149 | 3050000, |
| 150 | }; |
| 151 | |
Zhenhua HUANG | 684d5ce | 2013-04-02 13:24:15 +0100 | [diff] [blame] | 152 | static const unsigned int ldo_vaux56_ab8540_voltages[] = { |
| 153 | 750000, 760000, 770000, 780000, 790000, 800000, |
| 154 | 810000, 820000, 830000, 840000, 850000, 860000, |
| 155 | 870000, 880000, 890000, 900000, 910000, 920000, |
| 156 | 930000, 940000, 950000, 960000, 970000, 980000, |
| 157 | 990000, 1000000, 1010000, 1020000, 1030000, |
| 158 | 1040000, 1050000, 1060000, 1070000, 1080000, |
| 159 | 1090000, 1100000, 1110000, 1120000, 1130000, |
| 160 | 1140000, 1150000, 1160000, 1170000, 1180000, |
| 161 | 1190000, 1200000, 1210000, 1220000, 1230000, |
| 162 | 1240000, 1250000, 1260000, 1270000, 1280000, |
| 163 | 1290000, 1300000, 1310000, 1320000, 1330000, |
| 164 | 1340000, 1350000, 1360000, 1800000, 2790000, |
| 165 | }; |
| 166 | |
Axel Lin | ec1cc4d | 2012-05-20 10:33:35 +0800 | [diff] [blame] | 167 | static const unsigned int ldo_vintcore_voltages[] = { |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 168 | 1200000, |
| 169 | 1225000, |
| 170 | 1250000, |
| 171 | 1275000, |
| 172 | 1300000, |
| 173 | 1325000, |
| 174 | 1350000, |
| 175 | }; |
| 176 | |
Lee Jones | 62ab411 | 2013-03-28 16:11:18 +0000 | [diff] [blame] | 177 | static const unsigned int ldo_sdio_voltages[] = { |
Lee Jones | ae0a9a3 | 2013-03-28 16:11:16 +0000 | [diff] [blame] | 178 | 1160000, |
| 179 | 1050000, |
| 180 | 1100000, |
| 181 | 1500000, |
| 182 | 1800000, |
| 183 | 2200000, |
| 184 | 2910000, |
| 185 | 3050000, |
| 186 | }; |
| 187 | |
Lee Jones | b080c78 | 2013-03-28 16:11:17 +0000 | [diff] [blame] | 188 | static const unsigned int fixed_1200000_voltage[] = { |
| 189 | 1200000, |
| 190 | }; |
| 191 | |
| 192 | static const unsigned int fixed_1800000_voltage[] = { |
| 193 | 1800000, |
| 194 | }; |
| 195 | |
| 196 | static const unsigned int fixed_2000000_voltage[] = { |
| 197 | 2000000, |
| 198 | }; |
| 199 | |
| 200 | static const unsigned int fixed_2050000_voltage[] = { |
| 201 | 2050000, |
| 202 | }; |
| 203 | |
| 204 | static const unsigned int fixed_3300000_voltage[] = { |
| 205 | 3300000, |
| 206 | }; |
| 207 | |
Lee Jones | 8a3b1b8 | 2013-04-02 13:24:09 +0100 | [diff] [blame] | 208 | static const unsigned int ldo_vana_voltages[] = { |
| 209 | 1050000, |
| 210 | 1075000, |
| 211 | 1100000, |
| 212 | 1125000, |
| 213 | 1150000, |
| 214 | 1175000, |
| 215 | 1200000, |
| 216 | 1225000, |
| 217 | }; |
| 218 | |
| 219 | static const unsigned int ldo_vaudio_voltages[] = { |
| 220 | 2000000, |
| 221 | 2100000, |
| 222 | 2200000, |
| 223 | 2300000, |
| 224 | 2400000, |
| 225 | 2500000, |
| 226 | 2600000, |
| 227 | 2600000, /* Duplicated in Vaudio and IsoUicc Control register. */ |
| 228 | }; |
| 229 | |
Lee Jones | 4c84b4d | 2013-04-02 13:24:13 +0100 | [diff] [blame] | 230 | static const unsigned int ldo_vdmic_voltages[] = { |
| 231 | 1800000, |
| 232 | 1900000, |
| 233 | 2000000, |
| 234 | 2850000, |
| 235 | }; |
| 236 | |
Lee Jones | 3fe5228 | 2013-04-02 13:24:12 +0100 | [diff] [blame] | 237 | static DEFINE_MUTEX(shared_mode_mutex); |
| 238 | static struct ab8500_shared_mode ldo_anamic1_shared; |
| 239 | static struct ab8500_shared_mode ldo_anamic2_shared; |
Lee Jones | 4c84b4d | 2013-04-02 13:24:13 +0100 | [diff] [blame] | 240 | static struct ab8500_shared_mode ab8540_ldo_anamic1_shared; |
| 241 | static struct ab8500_shared_mode ab8540_ldo_anamic2_shared; |
Lee Jones | 3fe5228 | 2013-04-02 13:24:12 +0100 | [diff] [blame] | 242 | |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 243 | static int ab8500_regulator_enable(struct regulator_dev *rdev) |
| 244 | { |
Bengt Jonsson | fc24b42 | 2010-12-10 11:08:45 +0100 | [diff] [blame] | 245 | int ret; |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 246 | struct ab8500_regulator_info *info = rdev_get_drvdata(rdev); |
| 247 | |
Bengt Jonsson | fc24b42 | 2010-12-10 11:08:45 +0100 | [diff] [blame] | 248 | if (info == NULL) { |
| 249 | dev_err(rdev_get_dev(rdev), "regulator info null pointer\n"); |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 250 | return -EINVAL; |
Bengt Jonsson | fc24b42 | 2010-12-10 11:08:45 +0100 | [diff] [blame] | 251 | } |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 252 | |
Mattias Wallin | 47c1697 | 2010-09-10 17:47:56 +0200 | [diff] [blame] | 253 | ret = abx500_mask_and_set_register_interruptible(info->dev, |
Bengt Jonsson | e1159e6 | 2010-12-10 11:08:44 +0100 | [diff] [blame] | 254 | info->update_bank, info->update_reg, |
Emeric Vigier | bd28a15 | 2013-03-21 15:58:59 +0000 | [diff] [blame] | 255 | info->update_mask, info->update_val); |
Axel Lin | f71bf52 | 2013-03-26 16:13:14 +0800 | [diff] [blame] | 256 | if (ret < 0) { |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 257 | dev_err(rdev_get_dev(rdev), |
| 258 | "couldn't set enable bits for regulator\n"); |
Axel Lin | f71bf52 | 2013-03-26 16:13:14 +0800 | [diff] [blame] | 259 | return ret; |
| 260 | } |
Bengt Jonsson | 09aefa1 | 2010-12-10 11:08:46 +0100 | [diff] [blame] | 261 | |
Emeric Vigier | bd28a15 | 2013-03-21 15:58:59 +0000 | [diff] [blame] | 262 | info->is_enabled = true; |
| 263 | |
Bengt Jonsson | 09aefa1 | 2010-12-10 11:08:46 +0100 | [diff] [blame] | 264 | dev_vdbg(rdev_get_dev(rdev), |
| 265 | "%s-enable (bank, reg, mask, value): 0x%x, 0x%x, 0x%x, 0x%x\n", |
| 266 | info->desc.name, info->update_bank, info->update_reg, |
Emeric Vigier | bd28a15 | 2013-03-21 15:58:59 +0000 | [diff] [blame] | 267 | info->update_mask, info->update_val); |
Bengt Jonsson | 09aefa1 | 2010-12-10 11:08:46 +0100 | [diff] [blame] | 268 | |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 269 | return ret; |
| 270 | } |
| 271 | |
| 272 | static int ab8500_regulator_disable(struct regulator_dev *rdev) |
| 273 | { |
Bengt Jonsson | fc24b42 | 2010-12-10 11:08:45 +0100 | [diff] [blame] | 274 | int ret; |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 275 | struct ab8500_regulator_info *info = rdev_get_drvdata(rdev); |
| 276 | |
Bengt Jonsson | fc24b42 | 2010-12-10 11:08:45 +0100 | [diff] [blame] | 277 | if (info == NULL) { |
| 278 | dev_err(rdev_get_dev(rdev), "regulator info null pointer\n"); |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 279 | return -EINVAL; |
Bengt Jonsson | fc24b42 | 2010-12-10 11:08:45 +0100 | [diff] [blame] | 280 | } |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 281 | |
Mattias Wallin | 47c1697 | 2010-09-10 17:47:56 +0200 | [diff] [blame] | 282 | ret = abx500_mask_and_set_register_interruptible(info->dev, |
Bengt Jonsson | e1159e6 | 2010-12-10 11:08:44 +0100 | [diff] [blame] | 283 | info->update_bank, info->update_reg, |
| 284 | info->update_mask, 0x0); |
Axel Lin | f71bf52 | 2013-03-26 16:13:14 +0800 | [diff] [blame] | 285 | if (ret < 0) { |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 286 | dev_err(rdev_get_dev(rdev), |
| 287 | "couldn't set disable bits for regulator\n"); |
Axel Lin | f71bf52 | 2013-03-26 16:13:14 +0800 | [diff] [blame] | 288 | return ret; |
| 289 | } |
Bengt Jonsson | 09aefa1 | 2010-12-10 11:08:46 +0100 | [diff] [blame] | 290 | |
Emeric Vigier | bd28a15 | 2013-03-21 15:58:59 +0000 | [diff] [blame] | 291 | info->is_enabled = false; |
| 292 | |
Bengt Jonsson | 09aefa1 | 2010-12-10 11:08:46 +0100 | [diff] [blame] | 293 | dev_vdbg(rdev_get_dev(rdev), |
| 294 | "%s-disable (bank, reg, mask, value): 0x%x, 0x%x, 0x%x, 0x%x\n", |
| 295 | info->desc.name, info->update_bank, info->update_reg, |
| 296 | info->update_mask, 0x0); |
| 297 | |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 298 | return ret; |
| 299 | } |
| 300 | |
Bengt Jonsson | 7ce4669 | 2013-03-21 15:59:00 +0000 | [diff] [blame] | 301 | static unsigned int ab8500_regulator_get_optimum_mode( |
| 302 | struct regulator_dev *rdev, int input_uV, |
| 303 | int output_uV, int load_uA) |
| 304 | { |
| 305 | unsigned int mode; |
| 306 | |
| 307 | struct ab8500_regulator_info *info = rdev_get_drvdata(rdev); |
| 308 | |
| 309 | if (info == NULL) { |
| 310 | dev_err(rdev_get_dev(rdev), "regulator info null pointer\n"); |
| 311 | return -EINVAL; |
| 312 | } |
| 313 | |
| 314 | if (load_uA <= info->load_lp_uA) |
| 315 | mode = REGULATOR_MODE_IDLE; |
| 316 | else |
| 317 | mode = REGULATOR_MODE_NORMAL; |
| 318 | |
| 319 | return mode; |
| 320 | } |
| 321 | |
Emeric Vigier | bd28a15 | 2013-03-21 15:58:59 +0000 | [diff] [blame] | 322 | static int ab8500_regulator_set_mode(struct regulator_dev *rdev, |
| 323 | unsigned int mode) |
| 324 | { |
Lee Jones | 3fe5228 | 2013-04-02 13:24:12 +0100 | [diff] [blame] | 325 | int ret = 0; |
| 326 | u8 bank; |
| 327 | u8 reg; |
| 328 | u8 mask; |
| 329 | u8 val; |
| 330 | bool dmr = false; /* Dedicated mode register */ |
Emeric Vigier | bd28a15 | 2013-03-21 15:58:59 +0000 | [diff] [blame] | 331 | struct ab8500_regulator_info *info = rdev_get_drvdata(rdev); |
| 332 | |
| 333 | if (info == NULL) { |
| 334 | dev_err(rdev_get_dev(rdev), "regulator info null pointer\n"); |
| 335 | return -EINVAL; |
| 336 | } |
| 337 | |
Lee Jones | 3fe5228 | 2013-04-02 13:24:12 +0100 | [diff] [blame] | 338 | if (info->shared_mode) { |
| 339 | /* |
| 340 | * Special case where mode is shared between two regulators. |
| 341 | */ |
| 342 | struct ab8500_shared_mode *sm = info->shared_mode; |
| 343 | mutex_lock(&shared_mode_mutex); |
| 344 | |
| 345 | if (mode == REGULATOR_MODE_IDLE) { |
| 346 | sm->lp_mode_req = true; /* Low power mode requested */ |
| 347 | if (!((sm->shared_regulator)-> |
| 348 | shared_mode->lp_mode_req)) { |
| 349 | mutex_unlock(&shared_mode_mutex); |
| 350 | return 0; /* Other regulator prevent LP mode */ |
| 351 | } |
| 352 | } else { |
| 353 | sm->lp_mode_req = false; |
| 354 | } |
Emeric Vigier | bd28a15 | 2013-03-21 15:58:59 +0000 | [diff] [blame] | 355 | } |
| 356 | |
Lee Jones | 3fe5228 | 2013-04-02 13:24:12 +0100 | [diff] [blame] | 357 | if (info->mode_mask) { |
| 358 | /* Dedicated register for handling mode */ |
| 359 | |
| 360 | dmr = true; |
| 361 | |
| 362 | switch (mode) { |
| 363 | case REGULATOR_MODE_NORMAL: |
| 364 | val = info->mode_val_normal; |
| 365 | break; |
| 366 | case REGULATOR_MODE_IDLE: |
| 367 | val = info->mode_val_idle; |
| 368 | break; |
| 369 | default: |
| 370 | if (info->shared_mode) |
| 371 | mutex_unlock(&shared_mode_mutex); |
| 372 | return -EINVAL; |
| 373 | } |
| 374 | |
| 375 | bank = info->mode_bank; |
| 376 | reg = info->mode_reg; |
| 377 | mask = info->mode_mask; |
| 378 | } else { |
| 379 | /* Mode register same as enable register */ |
| 380 | |
| 381 | switch (mode) { |
| 382 | case REGULATOR_MODE_NORMAL: |
| 383 | info->update_val = info->update_val_normal; |
| 384 | val = info->update_val_normal; |
| 385 | break; |
| 386 | case REGULATOR_MODE_IDLE: |
| 387 | info->update_val = info->update_val_idle; |
| 388 | val = info->update_val_idle; |
| 389 | break; |
| 390 | default: |
| 391 | if (info->shared_mode) |
| 392 | mutex_unlock(&shared_mode_mutex); |
| 393 | return -EINVAL; |
| 394 | } |
| 395 | |
| 396 | bank = info->update_bank; |
| 397 | reg = info->update_reg; |
| 398 | mask = info->update_mask; |
| 399 | } |
| 400 | |
| 401 | if (info->is_enabled || dmr) { |
Emeric Vigier | bd28a15 | 2013-03-21 15:58:59 +0000 | [diff] [blame] | 402 | ret = abx500_mask_and_set_register_interruptible(info->dev, |
Lee Jones | 3fe5228 | 2013-04-02 13:24:12 +0100 | [diff] [blame] | 403 | bank, reg, mask, val); |
| 404 | if (ret < 0) |
Emeric Vigier | bd28a15 | 2013-03-21 15:58:59 +0000 | [diff] [blame] | 405 | dev_err(rdev_get_dev(rdev), |
| 406 | "couldn't set regulator mode\n"); |
Bengt Jonsson | 7ce4669 | 2013-03-21 15:59:00 +0000 | [diff] [blame] | 407 | |
| 408 | dev_vdbg(rdev_get_dev(rdev), |
| 409 | "%s-set_mode (bank, reg, mask, value): " |
| 410 | "0x%x, 0x%x, 0x%x, 0x%x\n", |
Lee Jones | 3fe5228 | 2013-04-02 13:24:12 +0100 | [diff] [blame] | 411 | info->desc.name, bank, reg, |
| 412 | mask, val); |
Emeric Vigier | bd28a15 | 2013-03-21 15:58:59 +0000 | [diff] [blame] | 413 | } |
| 414 | |
Lee Jones | 3fe5228 | 2013-04-02 13:24:12 +0100 | [diff] [blame] | 415 | if (info->shared_mode) |
| 416 | mutex_unlock(&shared_mode_mutex); |
Axel Lin | 742a732 | 2013-03-28 17:23:00 +0800 | [diff] [blame] | 417 | |
Lee Jones | 3fe5228 | 2013-04-02 13:24:12 +0100 | [diff] [blame] | 418 | return ret; |
Emeric Vigier | bd28a15 | 2013-03-21 15:58:59 +0000 | [diff] [blame] | 419 | } |
| 420 | |
| 421 | static unsigned int ab8500_regulator_get_mode(struct regulator_dev *rdev) |
| 422 | { |
| 423 | struct ab8500_regulator_info *info = rdev_get_drvdata(rdev); |
| 424 | int ret; |
Lee Jones | 3fe5228 | 2013-04-02 13:24:12 +0100 | [diff] [blame] | 425 | u8 val; |
| 426 | u8 val_normal; |
| 427 | u8 val_idle; |
Emeric Vigier | bd28a15 | 2013-03-21 15:58:59 +0000 | [diff] [blame] | 428 | |
| 429 | if (info == NULL) { |
| 430 | dev_err(rdev_get_dev(rdev), "regulator info null pointer\n"); |
| 431 | return -EINVAL; |
| 432 | } |
| 433 | |
Lee Jones | 3fe5228 | 2013-04-02 13:24:12 +0100 | [diff] [blame] | 434 | /* Need special handling for shared mode */ |
| 435 | if (info->shared_mode) { |
| 436 | if (info->shared_mode->lp_mode_req) |
| 437 | return REGULATOR_MODE_IDLE; |
| 438 | else |
| 439 | return REGULATOR_MODE_NORMAL; |
| 440 | } |
| 441 | |
| 442 | if (info->mode_mask) { |
| 443 | /* Dedicated register for handling mode */ |
| 444 | ret = abx500_get_register_interruptible(info->dev, |
| 445 | info->mode_bank, info->mode_reg, &val); |
| 446 | val = val & info->mode_mask; |
| 447 | |
| 448 | val_normal = info->mode_val_normal; |
| 449 | val_idle = info->mode_val_idle; |
| 450 | } else { |
| 451 | /* Mode register same as enable register */ |
| 452 | val = info->update_val; |
| 453 | val_normal = info->update_val_normal; |
| 454 | val_idle = info->update_val_idle; |
| 455 | } |
| 456 | |
| 457 | if (val == val_normal) |
Emeric Vigier | bd28a15 | 2013-03-21 15:58:59 +0000 | [diff] [blame] | 458 | ret = REGULATOR_MODE_NORMAL; |
Lee Jones | 3fe5228 | 2013-04-02 13:24:12 +0100 | [diff] [blame] | 459 | else if (val == val_idle) |
Emeric Vigier | bd28a15 | 2013-03-21 15:58:59 +0000 | [diff] [blame] | 460 | ret = REGULATOR_MODE_IDLE; |
| 461 | else |
| 462 | ret = -EINVAL; |
| 463 | |
| 464 | return ret; |
| 465 | } |
| 466 | |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 467 | static int ab8500_regulator_is_enabled(struct regulator_dev *rdev) |
| 468 | { |
Bengt Jonsson | fc24b42 | 2010-12-10 11:08:45 +0100 | [diff] [blame] | 469 | int ret; |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 470 | struct ab8500_regulator_info *info = rdev_get_drvdata(rdev); |
Bengt Jonsson | 09aefa1 | 2010-12-10 11:08:46 +0100 | [diff] [blame] | 471 | u8 regval; |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 472 | |
Bengt Jonsson | fc24b42 | 2010-12-10 11:08:45 +0100 | [diff] [blame] | 473 | if (info == NULL) { |
| 474 | dev_err(rdev_get_dev(rdev), "regulator info null pointer\n"); |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 475 | return -EINVAL; |
Bengt Jonsson | fc24b42 | 2010-12-10 11:08:45 +0100 | [diff] [blame] | 476 | } |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 477 | |
Mattias Wallin | 47c1697 | 2010-09-10 17:47:56 +0200 | [diff] [blame] | 478 | ret = abx500_get_register_interruptible(info->dev, |
Bengt Jonsson | 09aefa1 | 2010-12-10 11:08:46 +0100 | [diff] [blame] | 479 | info->update_bank, info->update_reg, ®val); |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 480 | if (ret < 0) { |
| 481 | dev_err(rdev_get_dev(rdev), |
| 482 | "couldn't read 0x%x register\n", info->update_reg); |
| 483 | return ret; |
| 484 | } |
| 485 | |
Bengt Jonsson | 09aefa1 | 2010-12-10 11:08:46 +0100 | [diff] [blame] | 486 | dev_vdbg(rdev_get_dev(rdev), |
| 487 | "%s-is_enabled (bank, reg, mask, value): 0x%x, 0x%x, 0x%x," |
| 488 | " 0x%x\n", |
| 489 | info->desc.name, info->update_bank, info->update_reg, |
| 490 | info->update_mask, regval); |
| 491 | |
| 492 | if (regval & info->update_mask) |
Emeric Vigier | bd28a15 | 2013-03-21 15:58:59 +0000 | [diff] [blame] | 493 | info->is_enabled = true; |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 494 | else |
Emeric Vigier | bd28a15 | 2013-03-21 15:58:59 +0000 | [diff] [blame] | 495 | info->is_enabled = false; |
| 496 | |
| 497 | return info->is_enabled; |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 498 | } |
| 499 | |
Axel Lin | 3bf6e90 | 2012-02-24 17:15:45 +0800 | [diff] [blame] | 500 | static int ab8500_regulator_get_voltage_sel(struct regulator_dev *rdev) |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 501 | { |
Bengt Jonsson | 09aefa1 | 2010-12-10 11:08:46 +0100 | [diff] [blame] | 502 | int ret, val; |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 503 | struct ab8500_regulator_info *info = rdev_get_drvdata(rdev); |
Bengt Jonsson | 09aefa1 | 2010-12-10 11:08:46 +0100 | [diff] [blame] | 504 | u8 regval; |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 505 | |
Bengt Jonsson | fc24b42 | 2010-12-10 11:08:45 +0100 | [diff] [blame] | 506 | if (info == NULL) { |
| 507 | dev_err(rdev_get_dev(rdev), "regulator info null pointer\n"); |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 508 | return -EINVAL; |
Bengt Jonsson | fc24b42 | 2010-12-10 11:08:45 +0100 | [diff] [blame] | 509 | } |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 510 | |
Bengt Jonsson | 09aefa1 | 2010-12-10 11:08:46 +0100 | [diff] [blame] | 511 | ret = abx500_get_register_interruptible(info->dev, |
| 512 | info->voltage_bank, info->voltage_reg, ®val); |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 513 | if (ret < 0) { |
| 514 | dev_err(rdev_get_dev(rdev), |
| 515 | "couldn't read voltage reg for regulator\n"); |
| 516 | return ret; |
| 517 | } |
| 518 | |
Bengt Jonsson | 09aefa1 | 2010-12-10 11:08:46 +0100 | [diff] [blame] | 519 | dev_vdbg(rdev_get_dev(rdev), |
Linus Walleij | a0a7014 | 2012-08-20 18:41:35 +0200 | [diff] [blame] | 520 | "%s-get_voltage (bank, reg, mask, shift, value): " |
| 521 | "0x%x, 0x%x, 0x%x, 0x%x, 0x%x\n", |
| 522 | info->desc.name, info->voltage_bank, |
| 523 | info->voltage_reg, info->voltage_mask, |
| 524 | info->voltage_shift, regval); |
Bengt Jonsson | 09aefa1 | 2010-12-10 11:08:46 +0100 | [diff] [blame] | 525 | |
Bengt Jonsson | 09aefa1 | 2010-12-10 11:08:46 +0100 | [diff] [blame] | 526 | val = regval & info->voltage_mask; |
Linus Walleij | a0a7014 | 2012-08-20 18:41:35 +0200 | [diff] [blame] | 527 | return val >> info->voltage_shift; |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 528 | } |
| 529 | |
Lee Jones | d7607ba | 2013-04-02 13:24:11 +0100 | [diff] [blame] | 530 | static int ab8540_aux3_regulator_get_voltage_sel(struct regulator_dev *rdev) |
| 531 | { |
| 532 | int ret, val; |
| 533 | struct ab8500_regulator_info *info = rdev_get_drvdata(rdev); |
| 534 | u8 regval, regval_expand; |
| 535 | |
| 536 | if (info == NULL) { |
| 537 | dev_err(rdev_get_dev(rdev), "regulator info null pointer\n"); |
| 538 | return -EINVAL; |
| 539 | } |
| 540 | |
| 541 | ret = abx500_get_register_interruptible(info->dev, |
| 542 | info->voltage_bank, info->voltage_reg, ®val); |
| 543 | |
| 544 | if (ret < 0) { |
| 545 | dev_err(rdev_get_dev(rdev), |
| 546 | "couldn't read voltage reg for regulator\n"); |
| 547 | return ret; |
| 548 | } |
| 549 | |
| 550 | ret = abx500_get_register_interruptible(info->dev, |
| 551 | info->expand_register.voltage_bank, |
| 552 | info->expand_register.voltage_reg, ®val_expand); |
| 553 | |
| 554 | if (ret < 0) { |
| 555 | dev_err(rdev_get_dev(rdev), |
| 556 | "couldn't read voltage reg for regulator\n"); |
| 557 | return ret; |
| 558 | } |
| 559 | |
| 560 | dev_vdbg(rdev_get_dev(rdev), |
| 561 | "%s-get_voltage (bank, reg, mask, value): 0x%x, 0x%x, 0x%x," |
| 562 | " 0x%x\n", |
| 563 | info->desc.name, info->voltage_bank, info->voltage_reg, |
| 564 | info->voltage_mask, regval); |
| 565 | dev_vdbg(rdev_get_dev(rdev), |
| 566 | "%s-get_voltage expand (bank, reg, mask, value): 0x%x, 0x%x, 0x%x," |
| 567 | " 0x%x\n", |
| 568 | info->desc.name, info->expand_register.voltage_bank, |
| 569 | info->expand_register.voltage_reg, |
| 570 | info->expand_register.voltage_mask, regval_expand); |
| 571 | |
| 572 | if (regval_expand&(info->expand_register.voltage_mask)) |
| 573 | /* Vaux3 has a different layout */ |
| 574 | val = info->expand_register.voltage_limit; |
| 575 | else |
| 576 | val = (regval & info->voltage_mask) >> info->voltage_shift; |
| 577 | |
| 578 | return val; |
| 579 | } |
| 580 | |
Axel Lin | ae713d3 | 2012-03-20 09:51:08 +0800 | [diff] [blame] | 581 | static int ab8500_regulator_set_voltage_sel(struct regulator_dev *rdev, |
| 582 | unsigned selector) |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 583 | { |
Bengt Jonsson | fc24b42 | 2010-12-10 11:08:45 +0100 | [diff] [blame] | 584 | int ret; |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 585 | struct ab8500_regulator_info *info = rdev_get_drvdata(rdev); |
Bengt Jonsson | 09aefa1 | 2010-12-10 11:08:46 +0100 | [diff] [blame] | 586 | u8 regval; |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 587 | |
Bengt Jonsson | fc24b42 | 2010-12-10 11:08:45 +0100 | [diff] [blame] | 588 | if (info == NULL) { |
| 589 | dev_err(rdev_get_dev(rdev), "regulator info null pointer\n"); |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 590 | return -EINVAL; |
Bengt Jonsson | fc24b42 | 2010-12-10 11:08:45 +0100 | [diff] [blame] | 591 | } |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 592 | |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 593 | /* set the registers for the request */ |
Linus Walleij | a0a7014 | 2012-08-20 18:41:35 +0200 | [diff] [blame] | 594 | regval = (u8)selector << info->voltage_shift; |
Mattias Wallin | 47c1697 | 2010-09-10 17:47:56 +0200 | [diff] [blame] | 595 | ret = abx500_mask_and_set_register_interruptible(info->dev, |
Bengt Jonsson | 09aefa1 | 2010-12-10 11:08:46 +0100 | [diff] [blame] | 596 | info->voltage_bank, info->voltage_reg, |
| 597 | info->voltage_mask, regval); |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 598 | if (ret < 0) |
| 599 | dev_err(rdev_get_dev(rdev), |
| 600 | "couldn't set voltage reg for regulator\n"); |
| 601 | |
Bengt Jonsson | 09aefa1 | 2010-12-10 11:08:46 +0100 | [diff] [blame] | 602 | dev_vdbg(rdev_get_dev(rdev), |
| 603 | "%s-set_voltage (bank, reg, mask, value): 0x%x, 0x%x, 0x%x," |
| 604 | " 0x%x\n", |
| 605 | info->desc.name, info->voltage_bank, info->voltage_reg, |
| 606 | info->voltage_mask, regval); |
| 607 | |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 608 | return ret; |
| 609 | } |
| 610 | |
Lee Jones | d7607ba | 2013-04-02 13:24:11 +0100 | [diff] [blame] | 611 | static int ab8540_aux3_regulator_set_voltage_sel(struct regulator_dev *rdev, |
| 612 | unsigned selector) |
| 613 | { |
| 614 | int ret; |
| 615 | struct ab8500_regulator_info *info = rdev_get_drvdata(rdev); |
| 616 | u8 regval; |
| 617 | |
| 618 | if (info == NULL) { |
| 619 | dev_err(rdev_get_dev(rdev), "regulator info null pointer\n"); |
| 620 | return -EINVAL; |
| 621 | } |
| 622 | |
| 623 | if (selector >= info->expand_register.voltage_limit) { |
| 624 | /* Vaux3 bit4 has different layout */ |
| 625 | regval = (u8)selector << info->expand_register.voltage_shift; |
| 626 | ret = abx500_mask_and_set_register_interruptible(info->dev, |
| 627 | info->expand_register.voltage_bank, |
| 628 | info->expand_register.voltage_reg, |
| 629 | info->expand_register.voltage_mask, |
| 630 | regval); |
| 631 | } else { |
| 632 | /* set the registers for the request */ |
| 633 | regval = (u8)selector << info->voltage_shift; |
| 634 | ret = abx500_mask_and_set_register_interruptible(info->dev, |
| 635 | info->voltage_bank, info->voltage_reg, |
| 636 | info->voltage_mask, regval); |
| 637 | } |
| 638 | if (ret < 0) |
| 639 | dev_err(rdev_get_dev(rdev), |
| 640 | "couldn't set voltage reg for regulator\n"); |
| 641 | |
| 642 | dev_vdbg(rdev_get_dev(rdev), |
| 643 | "%s-set_voltage (bank, reg, mask, value): 0x%x, 0x%x, 0x%x," |
| 644 | " 0x%x\n", |
| 645 | info->desc.name, info->voltage_bank, info->voltage_reg, |
| 646 | info->voltage_mask, regval); |
| 647 | |
| 648 | return ret; |
| 649 | } |
| 650 | |
Bengt Jonsson | 7ce4669 | 2013-03-21 15:59:00 +0000 | [diff] [blame] | 651 | static struct regulator_ops ab8500_regulator_volt_mode_ops = { |
| 652 | .enable = ab8500_regulator_enable, |
| 653 | .disable = ab8500_regulator_disable, |
| 654 | .is_enabled = ab8500_regulator_is_enabled, |
| 655 | .get_optimum_mode = ab8500_regulator_get_optimum_mode, |
| 656 | .set_mode = ab8500_regulator_set_mode, |
| 657 | .get_mode = ab8500_regulator_get_mode, |
| 658 | .get_voltage_sel = ab8500_regulator_get_voltage_sel, |
| 659 | .set_voltage_sel = ab8500_regulator_set_voltage_sel, |
| 660 | .list_voltage = regulator_list_voltage_table, |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 661 | }; |
| 662 | |
Lee Jones | d7607ba | 2013-04-02 13:24:11 +0100 | [diff] [blame] | 663 | static struct regulator_ops ab8540_aux3_regulator_volt_mode_ops = { |
| 664 | .enable = ab8500_regulator_enable, |
| 665 | .disable = ab8500_regulator_disable, |
| 666 | .get_optimum_mode = ab8500_regulator_get_optimum_mode, |
| 667 | .set_mode = ab8500_regulator_set_mode, |
| 668 | .get_mode = ab8500_regulator_get_mode, |
| 669 | .is_enabled = ab8500_regulator_is_enabled, |
| 670 | .get_voltage_sel = ab8540_aux3_regulator_get_voltage_sel, |
| 671 | .set_voltage_sel = ab8540_aux3_regulator_set_voltage_sel, |
| 672 | .list_voltage = regulator_list_voltage_table, |
Lee Jones | d7607ba | 2013-04-02 13:24:11 +0100 | [diff] [blame] | 673 | }; |
| 674 | |
Lee Jones | 8a3b1b8 | 2013-04-02 13:24:09 +0100 | [diff] [blame] | 675 | static struct regulator_ops ab8500_regulator_volt_ops = { |
| 676 | .enable = ab8500_regulator_enable, |
| 677 | .disable = ab8500_regulator_disable, |
| 678 | .is_enabled = ab8500_regulator_is_enabled, |
| 679 | .get_voltage_sel = ab8500_regulator_get_voltage_sel, |
| 680 | .set_voltage_sel = ab8500_regulator_set_voltage_sel, |
| 681 | .list_voltage = regulator_list_voltage_table, |
Lee Jones | 8a3b1b8 | 2013-04-02 13:24:09 +0100 | [diff] [blame] | 682 | }; |
| 683 | |
Bengt Jonsson | 7ce4669 | 2013-03-21 15:59:00 +0000 | [diff] [blame] | 684 | static struct regulator_ops ab8500_regulator_mode_ops = { |
| 685 | .enable = ab8500_regulator_enable, |
| 686 | .disable = ab8500_regulator_disable, |
| 687 | .is_enabled = ab8500_regulator_is_enabled, |
| 688 | .get_optimum_mode = ab8500_regulator_get_optimum_mode, |
| 689 | .set_mode = ab8500_regulator_set_mode, |
| 690 | .get_mode = ab8500_regulator_get_mode, |
Axel Lin | d7816ab | 2013-04-02 13:24:22 +0100 | [diff] [blame] | 691 | .list_voltage = regulator_list_voltage_table, |
Bengt Jonsson | 7ce4669 | 2013-03-21 15:59:00 +0000 | [diff] [blame] | 692 | }; |
| 693 | |
| 694 | static struct regulator_ops ab8500_regulator_ops = { |
| 695 | .enable = ab8500_regulator_enable, |
| 696 | .disable = ab8500_regulator_disable, |
| 697 | .is_enabled = ab8500_regulator_is_enabled, |
Axel Lin | d7816ab | 2013-04-02 13:24:22 +0100 | [diff] [blame] | 698 | .list_voltage = regulator_list_voltage_table, |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 699 | }; |
| 700 | |
Lee Jones | 3fe5228 | 2013-04-02 13:24:12 +0100 | [diff] [blame] | 701 | static struct regulator_ops ab8500_regulator_anamic_mode_ops = { |
| 702 | .enable = ab8500_regulator_enable, |
| 703 | .disable = ab8500_regulator_disable, |
| 704 | .is_enabled = ab8500_regulator_is_enabled, |
| 705 | .set_mode = ab8500_regulator_set_mode, |
| 706 | .get_mode = ab8500_regulator_get_mode, |
| 707 | .list_voltage = regulator_list_voltage_table, |
| 708 | }; |
| 709 | |
Lee Jones | 8e6a8d7 | 2013-03-28 16:11:11 +0000 | [diff] [blame] | 710 | /* AB8500 regulator information */ |
Bengt Jonsson | 6909b45 | 2010-12-10 11:08:47 +0100 | [diff] [blame] | 711 | static struct ab8500_regulator_info |
| 712 | ab8500_regulator_info[AB8500_NUM_REGULATORS] = { |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 713 | /* |
Bengt Jonsson | e1159e6 | 2010-12-10 11:08:44 +0100 | [diff] [blame] | 714 | * Variable Voltage Regulators |
| 715 | * name, min mV, max mV, |
| 716 | * update bank, reg, mask, enable val |
Axel Lin | ec1cc4d | 2012-05-20 10:33:35 +0800 | [diff] [blame] | 717 | * volt bank, reg, mask |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 718 | */ |
Bengt Jonsson | 6909b45 | 2010-12-10 11:08:47 +0100 | [diff] [blame] | 719 | [AB8500_LDO_AUX1] = { |
| 720 | .desc = { |
| 721 | .name = "LDO-AUX1", |
Bengt Jonsson | 7ce4669 | 2013-03-21 15:59:00 +0000 | [diff] [blame] | 722 | .ops = &ab8500_regulator_volt_mode_ops, |
Bengt Jonsson | 6909b45 | 2010-12-10 11:08:47 +0100 | [diff] [blame] | 723 | .type = REGULATOR_VOLTAGE, |
| 724 | .id = AB8500_LDO_AUX1, |
| 725 | .owner = THIS_MODULE, |
| 726 | .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages), |
Axel Lin | ec1cc4d | 2012-05-20 10:33:35 +0800 | [diff] [blame] | 727 | .volt_table = ldo_vauxn_voltages, |
Axel Lin | 530158b | 2013-03-27 17:47:22 +0800 | [diff] [blame] | 728 | .enable_time = 200, |
Bengt Jonsson | 6909b45 | 2010-12-10 11:08:47 +0100 | [diff] [blame] | 729 | }, |
Bengt Jonsson | 7ce4669 | 2013-03-21 15:59:00 +0000 | [diff] [blame] | 730 | .load_lp_uA = 5000, |
Bengt Jonsson | 6909b45 | 2010-12-10 11:08:47 +0100 | [diff] [blame] | 731 | .update_bank = 0x04, |
| 732 | .update_reg = 0x09, |
| 733 | .update_mask = 0x03, |
Emeric Vigier | bd28a15 | 2013-03-21 15:58:59 +0000 | [diff] [blame] | 734 | .update_val = 0x01, |
| 735 | .update_val_idle = 0x03, |
| 736 | .update_val_normal = 0x01, |
Bengt Jonsson | 6909b45 | 2010-12-10 11:08:47 +0100 | [diff] [blame] | 737 | .voltage_bank = 0x04, |
| 738 | .voltage_reg = 0x1f, |
| 739 | .voltage_mask = 0x0f, |
Bengt Jonsson | 6909b45 | 2010-12-10 11:08:47 +0100 | [diff] [blame] | 740 | }, |
| 741 | [AB8500_LDO_AUX2] = { |
| 742 | .desc = { |
| 743 | .name = "LDO-AUX2", |
Bengt Jonsson | 7ce4669 | 2013-03-21 15:59:00 +0000 | [diff] [blame] | 744 | .ops = &ab8500_regulator_volt_mode_ops, |
Bengt Jonsson | 6909b45 | 2010-12-10 11:08:47 +0100 | [diff] [blame] | 745 | .type = REGULATOR_VOLTAGE, |
| 746 | .id = AB8500_LDO_AUX2, |
| 747 | .owner = THIS_MODULE, |
| 748 | .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages), |
Axel Lin | ec1cc4d | 2012-05-20 10:33:35 +0800 | [diff] [blame] | 749 | .volt_table = ldo_vauxn_voltages, |
Axel Lin | 530158b | 2013-03-27 17:47:22 +0800 | [diff] [blame] | 750 | .enable_time = 200, |
Bengt Jonsson | 6909b45 | 2010-12-10 11:08:47 +0100 | [diff] [blame] | 751 | }, |
Bengt Jonsson | 7ce4669 | 2013-03-21 15:59:00 +0000 | [diff] [blame] | 752 | .load_lp_uA = 5000, |
Bengt Jonsson | 6909b45 | 2010-12-10 11:08:47 +0100 | [diff] [blame] | 753 | .update_bank = 0x04, |
| 754 | .update_reg = 0x09, |
| 755 | .update_mask = 0x0c, |
Emeric Vigier | bd28a15 | 2013-03-21 15:58:59 +0000 | [diff] [blame] | 756 | .update_val = 0x04, |
| 757 | .update_val_idle = 0x0c, |
| 758 | .update_val_normal = 0x04, |
Bengt Jonsson | 6909b45 | 2010-12-10 11:08:47 +0100 | [diff] [blame] | 759 | .voltage_bank = 0x04, |
| 760 | .voltage_reg = 0x20, |
| 761 | .voltage_mask = 0x0f, |
Bengt Jonsson | 6909b45 | 2010-12-10 11:08:47 +0100 | [diff] [blame] | 762 | }, |
| 763 | [AB8500_LDO_AUX3] = { |
| 764 | .desc = { |
| 765 | .name = "LDO-AUX3", |
Bengt Jonsson | 7ce4669 | 2013-03-21 15:59:00 +0000 | [diff] [blame] | 766 | .ops = &ab8500_regulator_volt_mode_ops, |
Bengt Jonsson | 6909b45 | 2010-12-10 11:08:47 +0100 | [diff] [blame] | 767 | .type = REGULATOR_VOLTAGE, |
| 768 | .id = AB8500_LDO_AUX3, |
| 769 | .owner = THIS_MODULE, |
| 770 | .n_voltages = ARRAY_SIZE(ldo_vaux3_voltages), |
Axel Lin | ec1cc4d | 2012-05-20 10:33:35 +0800 | [diff] [blame] | 771 | .volt_table = ldo_vaux3_voltages, |
Axel Lin | 530158b | 2013-03-27 17:47:22 +0800 | [diff] [blame] | 772 | .enable_time = 450, |
Bengt Jonsson | 6909b45 | 2010-12-10 11:08:47 +0100 | [diff] [blame] | 773 | }, |
Bengt Jonsson | 7ce4669 | 2013-03-21 15:59:00 +0000 | [diff] [blame] | 774 | .load_lp_uA = 5000, |
Bengt Jonsson | 6909b45 | 2010-12-10 11:08:47 +0100 | [diff] [blame] | 775 | .update_bank = 0x04, |
| 776 | .update_reg = 0x0a, |
| 777 | .update_mask = 0x03, |
Emeric Vigier | bd28a15 | 2013-03-21 15:58:59 +0000 | [diff] [blame] | 778 | .update_val = 0x01, |
| 779 | .update_val_idle = 0x03, |
| 780 | .update_val_normal = 0x01, |
Bengt Jonsson | 6909b45 | 2010-12-10 11:08:47 +0100 | [diff] [blame] | 781 | .voltage_bank = 0x04, |
| 782 | .voltage_reg = 0x21, |
| 783 | .voltage_mask = 0x07, |
Bengt Jonsson | 6909b45 | 2010-12-10 11:08:47 +0100 | [diff] [blame] | 784 | }, |
| 785 | [AB8500_LDO_INTCORE] = { |
| 786 | .desc = { |
| 787 | .name = "LDO-INTCORE", |
Bengt Jonsson | 7ce4669 | 2013-03-21 15:59:00 +0000 | [diff] [blame] | 788 | .ops = &ab8500_regulator_volt_mode_ops, |
Bengt Jonsson | 6909b45 | 2010-12-10 11:08:47 +0100 | [diff] [blame] | 789 | .type = REGULATOR_VOLTAGE, |
| 790 | .id = AB8500_LDO_INTCORE, |
| 791 | .owner = THIS_MODULE, |
| 792 | .n_voltages = ARRAY_SIZE(ldo_vintcore_voltages), |
Axel Lin | ec1cc4d | 2012-05-20 10:33:35 +0800 | [diff] [blame] | 793 | .volt_table = ldo_vintcore_voltages, |
Axel Lin | 530158b | 2013-03-27 17:47:22 +0800 | [diff] [blame] | 794 | .enable_time = 750, |
Bengt Jonsson | 6909b45 | 2010-12-10 11:08:47 +0100 | [diff] [blame] | 795 | }, |
Bengt Jonsson | 7ce4669 | 2013-03-21 15:59:00 +0000 | [diff] [blame] | 796 | .load_lp_uA = 5000, |
Bengt Jonsson | 6909b45 | 2010-12-10 11:08:47 +0100 | [diff] [blame] | 797 | .update_bank = 0x03, |
| 798 | .update_reg = 0x80, |
| 799 | .update_mask = 0x44, |
Lee Jones | cc40dc2 | 2013-03-21 15:59:41 +0000 | [diff] [blame] | 800 | .update_val = 0x44, |
Emeric Vigier | bd28a15 | 2013-03-21 15:58:59 +0000 | [diff] [blame] | 801 | .update_val_idle = 0x44, |
| 802 | .update_val_normal = 0x04, |
Bengt Jonsson | 6909b45 | 2010-12-10 11:08:47 +0100 | [diff] [blame] | 803 | .voltage_bank = 0x03, |
| 804 | .voltage_reg = 0x80, |
| 805 | .voltage_mask = 0x38, |
Linus Walleij | a0a7014 | 2012-08-20 18:41:35 +0200 | [diff] [blame] | 806 | .voltage_shift = 3, |
Bengt Jonsson | 6909b45 | 2010-12-10 11:08:47 +0100 | [diff] [blame] | 807 | }, |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 808 | |
| 809 | /* |
Bengt Jonsson | e1159e6 | 2010-12-10 11:08:44 +0100 | [diff] [blame] | 810 | * Fixed Voltage Regulators |
| 811 | * name, fixed mV, |
| 812 | * update bank, reg, mask, enable val |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 813 | */ |
Bengt Jonsson | 6909b45 | 2010-12-10 11:08:47 +0100 | [diff] [blame] | 814 | [AB8500_LDO_TVOUT] = { |
| 815 | .desc = { |
| 816 | .name = "LDO-TVOUT", |
Bengt Jonsson | 7ce4669 | 2013-03-21 15:59:00 +0000 | [diff] [blame] | 817 | .ops = &ab8500_regulator_mode_ops, |
Bengt Jonsson | 6909b45 | 2010-12-10 11:08:47 +0100 | [diff] [blame] | 818 | .type = REGULATOR_VOLTAGE, |
| 819 | .id = AB8500_LDO_TVOUT, |
| 820 | .owner = THIS_MODULE, |
| 821 | .n_voltages = 1, |
Lee Jones | b080c78 | 2013-03-28 16:11:17 +0000 | [diff] [blame] | 822 | .volt_table = fixed_2000000_voltage, |
Lee Jones | ed3c138 | 2013-03-28 16:11:12 +0000 | [diff] [blame] | 823 | .enable_time = 500, |
Bengt Jonsson | 6909b45 | 2010-12-10 11:08:47 +0100 | [diff] [blame] | 824 | }, |
Bengt Jonsson | 7ce4669 | 2013-03-21 15:59:00 +0000 | [diff] [blame] | 825 | .load_lp_uA = 1000, |
Bengt Jonsson | 6909b45 | 2010-12-10 11:08:47 +0100 | [diff] [blame] | 826 | .update_bank = 0x03, |
| 827 | .update_reg = 0x80, |
| 828 | .update_mask = 0x82, |
Emeric Vigier | bd28a15 | 2013-03-21 15:58:59 +0000 | [diff] [blame] | 829 | .update_val = 0x02, |
Bengt Jonsson | 7ce4669 | 2013-03-21 15:59:00 +0000 | [diff] [blame] | 830 | .update_val_idle = 0x82, |
| 831 | .update_val_normal = 0x02, |
Bengt Jonsson | 6909b45 | 2010-12-10 11:08:47 +0100 | [diff] [blame] | 832 | }, |
| 833 | [AB8500_LDO_AUDIO] = { |
| 834 | .desc = { |
| 835 | .name = "LDO-AUDIO", |
Bengt Jonsson | 7ce4669 | 2013-03-21 15:59:00 +0000 | [diff] [blame] | 836 | .ops = &ab8500_regulator_ops, |
Bengt Jonsson | 6909b45 | 2010-12-10 11:08:47 +0100 | [diff] [blame] | 837 | .type = REGULATOR_VOLTAGE, |
| 838 | .id = AB8500_LDO_AUDIO, |
| 839 | .owner = THIS_MODULE, |
| 840 | .n_voltages = 1, |
Axel Lin | 530158b | 2013-03-27 17:47:22 +0800 | [diff] [blame] | 841 | .enable_time = 140, |
Lee Jones | b080c78 | 2013-03-28 16:11:17 +0000 | [diff] [blame] | 842 | .volt_table = fixed_2000000_voltage, |
Bengt Jonsson | 6909b45 | 2010-12-10 11:08:47 +0100 | [diff] [blame] | 843 | }, |
Bengt Jonsson | 6909b45 | 2010-12-10 11:08:47 +0100 | [diff] [blame] | 844 | .update_bank = 0x03, |
| 845 | .update_reg = 0x83, |
| 846 | .update_mask = 0x02, |
Emeric Vigier | bd28a15 | 2013-03-21 15:58:59 +0000 | [diff] [blame] | 847 | .update_val = 0x02, |
Bengt Jonsson | 6909b45 | 2010-12-10 11:08:47 +0100 | [diff] [blame] | 848 | }, |
| 849 | [AB8500_LDO_ANAMIC1] = { |
| 850 | .desc = { |
| 851 | .name = "LDO-ANAMIC1", |
Bengt Jonsson | 7ce4669 | 2013-03-21 15:59:00 +0000 | [diff] [blame] | 852 | .ops = &ab8500_regulator_ops, |
Bengt Jonsson | 6909b45 | 2010-12-10 11:08:47 +0100 | [diff] [blame] | 853 | .type = REGULATOR_VOLTAGE, |
| 854 | .id = AB8500_LDO_ANAMIC1, |
| 855 | .owner = THIS_MODULE, |
| 856 | .n_voltages = 1, |
Axel Lin | 530158b | 2013-03-27 17:47:22 +0800 | [diff] [blame] | 857 | .enable_time = 500, |
Lee Jones | b080c78 | 2013-03-28 16:11:17 +0000 | [diff] [blame] | 858 | .volt_table = fixed_2050000_voltage, |
Bengt Jonsson | 6909b45 | 2010-12-10 11:08:47 +0100 | [diff] [blame] | 859 | }, |
Bengt Jonsson | 6909b45 | 2010-12-10 11:08:47 +0100 | [diff] [blame] | 860 | .update_bank = 0x03, |
| 861 | .update_reg = 0x83, |
| 862 | .update_mask = 0x08, |
Emeric Vigier | bd28a15 | 2013-03-21 15:58:59 +0000 | [diff] [blame] | 863 | .update_val = 0x08, |
Bengt Jonsson | 6909b45 | 2010-12-10 11:08:47 +0100 | [diff] [blame] | 864 | }, |
| 865 | [AB8500_LDO_ANAMIC2] = { |
| 866 | .desc = { |
| 867 | .name = "LDO-ANAMIC2", |
Bengt Jonsson | 7ce4669 | 2013-03-21 15:59:00 +0000 | [diff] [blame] | 868 | .ops = &ab8500_regulator_ops, |
Bengt Jonsson | 6909b45 | 2010-12-10 11:08:47 +0100 | [diff] [blame] | 869 | .type = REGULATOR_VOLTAGE, |
| 870 | .id = AB8500_LDO_ANAMIC2, |
| 871 | .owner = THIS_MODULE, |
| 872 | .n_voltages = 1, |
Axel Lin | 530158b | 2013-03-27 17:47:22 +0800 | [diff] [blame] | 873 | .enable_time = 500, |
Lee Jones | b080c78 | 2013-03-28 16:11:17 +0000 | [diff] [blame] | 874 | .volt_table = fixed_2050000_voltage, |
Bengt Jonsson | 6909b45 | 2010-12-10 11:08:47 +0100 | [diff] [blame] | 875 | }, |
Bengt Jonsson | 6909b45 | 2010-12-10 11:08:47 +0100 | [diff] [blame] | 876 | .update_bank = 0x03, |
| 877 | .update_reg = 0x83, |
| 878 | .update_mask = 0x10, |
Emeric Vigier | bd28a15 | 2013-03-21 15:58:59 +0000 | [diff] [blame] | 879 | .update_val = 0x10, |
Bengt Jonsson | 6909b45 | 2010-12-10 11:08:47 +0100 | [diff] [blame] | 880 | }, |
| 881 | [AB8500_LDO_DMIC] = { |
| 882 | .desc = { |
| 883 | .name = "LDO-DMIC", |
Bengt Jonsson | 7ce4669 | 2013-03-21 15:59:00 +0000 | [diff] [blame] | 884 | .ops = &ab8500_regulator_ops, |
Bengt Jonsson | 6909b45 | 2010-12-10 11:08:47 +0100 | [diff] [blame] | 885 | .type = REGULATOR_VOLTAGE, |
| 886 | .id = AB8500_LDO_DMIC, |
| 887 | .owner = THIS_MODULE, |
| 888 | .n_voltages = 1, |
Axel Lin | 530158b | 2013-03-27 17:47:22 +0800 | [diff] [blame] | 889 | .enable_time = 420, |
Lee Jones | b080c78 | 2013-03-28 16:11:17 +0000 | [diff] [blame] | 890 | .volt_table = fixed_1800000_voltage, |
Bengt Jonsson | 6909b45 | 2010-12-10 11:08:47 +0100 | [diff] [blame] | 891 | }, |
Bengt Jonsson | 6909b45 | 2010-12-10 11:08:47 +0100 | [diff] [blame] | 892 | .update_bank = 0x03, |
| 893 | .update_reg = 0x83, |
| 894 | .update_mask = 0x04, |
Emeric Vigier | bd28a15 | 2013-03-21 15:58:59 +0000 | [diff] [blame] | 895 | .update_val = 0x04, |
Bengt Jonsson | 6909b45 | 2010-12-10 11:08:47 +0100 | [diff] [blame] | 896 | }, |
Bengt Jonsson | 7ce4669 | 2013-03-21 15:59:00 +0000 | [diff] [blame] | 897 | |
| 898 | /* |
| 899 | * Regulators with fixed voltage and normal/idle modes |
| 900 | */ |
Bengt Jonsson | 6909b45 | 2010-12-10 11:08:47 +0100 | [diff] [blame] | 901 | [AB8500_LDO_ANA] = { |
| 902 | .desc = { |
| 903 | .name = "LDO-ANA", |
Bengt Jonsson | 7ce4669 | 2013-03-21 15:59:00 +0000 | [diff] [blame] | 904 | .ops = &ab8500_regulator_mode_ops, |
Bengt Jonsson | 6909b45 | 2010-12-10 11:08:47 +0100 | [diff] [blame] | 905 | .type = REGULATOR_VOLTAGE, |
| 906 | .id = AB8500_LDO_ANA, |
| 907 | .owner = THIS_MODULE, |
| 908 | .n_voltages = 1, |
Axel Lin | 530158b | 2013-03-27 17:47:22 +0800 | [diff] [blame] | 909 | .enable_time = 140, |
Lee Jones | b080c78 | 2013-03-28 16:11:17 +0000 | [diff] [blame] | 910 | .volt_table = fixed_1200000_voltage, |
Bengt Jonsson | 6909b45 | 2010-12-10 11:08:47 +0100 | [diff] [blame] | 911 | }, |
Bengt Jonsson | 7ce4669 | 2013-03-21 15:59:00 +0000 | [diff] [blame] | 912 | .load_lp_uA = 1000, |
Bengt Jonsson | 6909b45 | 2010-12-10 11:08:47 +0100 | [diff] [blame] | 913 | .update_bank = 0x04, |
| 914 | .update_reg = 0x06, |
| 915 | .update_mask = 0x0c, |
Emeric Vigier | bd28a15 | 2013-03-21 15:58:59 +0000 | [diff] [blame] | 916 | .update_val = 0x04, |
Bengt Jonsson | 7ce4669 | 2013-03-21 15:59:00 +0000 | [diff] [blame] | 917 | .update_val_idle = 0x0c, |
| 918 | .update_val_normal = 0x04, |
Bengt Jonsson | 6909b45 | 2010-12-10 11:08:47 +0100 | [diff] [blame] | 919 | }, |
Lee Jones | 8e6a8d7 | 2013-03-28 16:11:11 +0000 | [diff] [blame] | 920 | }; |
Bengt Jonsson | 6909b45 | 2010-12-10 11:08:47 +0100 | [diff] [blame] | 921 | |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 922 | /* AB8505 regulator information */ |
| 923 | static struct ab8500_regulator_info |
| 924 | ab8505_regulator_info[AB8505_NUM_REGULATORS] = { |
| 925 | /* |
| 926 | * Variable Voltage Regulators |
| 927 | * name, min mV, max mV, |
| 928 | * update bank, reg, mask, enable val |
Lee Jones | d319310 | 2013-04-02 13:24:18 +0100 | [diff] [blame] | 929 | * volt bank, reg, mask |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 930 | */ |
| 931 | [AB8505_LDO_AUX1] = { |
| 932 | .desc = { |
| 933 | .name = "LDO-AUX1", |
| 934 | .ops = &ab8500_regulator_volt_mode_ops, |
| 935 | .type = REGULATOR_VOLTAGE, |
Lee Jones | 0b94641 | 2013-04-02 13:24:07 +0100 | [diff] [blame] | 936 | .id = AB8505_LDO_AUX1, |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 937 | .owner = THIS_MODULE, |
| 938 | .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages), |
Lee Jones | 62ab411 | 2013-03-28 16:11:18 +0000 | [diff] [blame] | 939 | .volt_table = ldo_vauxn_voltages, |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 940 | }, |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 941 | .load_lp_uA = 5000, |
| 942 | .update_bank = 0x04, |
| 943 | .update_reg = 0x09, |
| 944 | .update_mask = 0x03, |
| 945 | .update_val = 0x01, |
| 946 | .update_val_idle = 0x03, |
| 947 | .update_val_normal = 0x01, |
| 948 | .voltage_bank = 0x04, |
| 949 | .voltage_reg = 0x1f, |
| 950 | .voltage_mask = 0x0f, |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 951 | }, |
| 952 | [AB8505_LDO_AUX2] = { |
| 953 | .desc = { |
| 954 | .name = "LDO-AUX2", |
| 955 | .ops = &ab8500_regulator_volt_mode_ops, |
| 956 | .type = REGULATOR_VOLTAGE, |
Lee Jones | 0b94641 | 2013-04-02 13:24:07 +0100 | [diff] [blame] | 957 | .id = AB8505_LDO_AUX2, |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 958 | .owner = THIS_MODULE, |
| 959 | .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages), |
Lee Jones | 62ab411 | 2013-03-28 16:11:18 +0000 | [diff] [blame] | 960 | .volt_table = ldo_vauxn_voltages, |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 961 | }, |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 962 | .load_lp_uA = 5000, |
| 963 | .update_bank = 0x04, |
| 964 | .update_reg = 0x09, |
| 965 | .update_mask = 0x0c, |
| 966 | .update_val = 0x04, |
| 967 | .update_val_idle = 0x0c, |
| 968 | .update_val_normal = 0x04, |
| 969 | .voltage_bank = 0x04, |
| 970 | .voltage_reg = 0x20, |
| 971 | .voltage_mask = 0x0f, |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 972 | }, |
| 973 | [AB8505_LDO_AUX3] = { |
| 974 | .desc = { |
| 975 | .name = "LDO-AUX3", |
| 976 | .ops = &ab8500_regulator_volt_mode_ops, |
| 977 | .type = REGULATOR_VOLTAGE, |
Lee Jones | 0b94641 | 2013-04-02 13:24:07 +0100 | [diff] [blame] | 978 | .id = AB8505_LDO_AUX3, |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 979 | .owner = THIS_MODULE, |
| 980 | .n_voltages = ARRAY_SIZE(ldo_vaux3_voltages), |
Lee Jones | 62ab411 | 2013-03-28 16:11:18 +0000 | [diff] [blame] | 981 | .volt_table = ldo_vaux3_voltages, |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 982 | }, |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 983 | .load_lp_uA = 5000, |
| 984 | .update_bank = 0x04, |
| 985 | .update_reg = 0x0a, |
| 986 | .update_mask = 0x03, |
| 987 | .update_val = 0x01, |
| 988 | .update_val_idle = 0x03, |
| 989 | .update_val_normal = 0x01, |
| 990 | .voltage_bank = 0x04, |
| 991 | .voltage_reg = 0x21, |
| 992 | .voltage_mask = 0x07, |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 993 | }, |
| 994 | [AB8505_LDO_AUX4] = { |
| 995 | .desc = { |
| 996 | .name = "LDO-AUX4", |
| 997 | .ops = &ab8500_regulator_volt_mode_ops, |
| 998 | .type = REGULATOR_VOLTAGE, |
Lee Jones | 0b94641 | 2013-04-02 13:24:07 +0100 | [diff] [blame] | 999 | .id = AB8505_LDO_AUX4, |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 1000 | .owner = THIS_MODULE, |
| 1001 | .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages), |
Lee Jones | 62ab411 | 2013-03-28 16:11:18 +0000 | [diff] [blame] | 1002 | .volt_table = ldo_vauxn_voltages, |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 1003 | }, |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 1004 | .load_lp_uA = 5000, |
| 1005 | /* values for Vaux4Regu register */ |
| 1006 | .update_bank = 0x04, |
| 1007 | .update_reg = 0x2e, |
| 1008 | .update_mask = 0x03, |
| 1009 | .update_val = 0x01, |
| 1010 | .update_val_idle = 0x03, |
| 1011 | .update_val_normal = 0x01, |
| 1012 | /* values for Vaux4SEL register */ |
| 1013 | .voltage_bank = 0x04, |
| 1014 | .voltage_reg = 0x2f, |
| 1015 | .voltage_mask = 0x0f, |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 1016 | }, |
| 1017 | [AB8505_LDO_AUX5] = { |
| 1018 | .desc = { |
| 1019 | .name = "LDO-AUX5", |
| 1020 | .ops = &ab8500_regulator_volt_mode_ops, |
| 1021 | .type = REGULATOR_VOLTAGE, |
| 1022 | .id = AB8505_LDO_AUX5, |
| 1023 | .owner = THIS_MODULE, |
| 1024 | .n_voltages = ARRAY_SIZE(ldo_vaux56_voltages), |
Lee Jones | 62ab411 | 2013-03-28 16:11:18 +0000 | [diff] [blame] | 1025 | .volt_table = ldo_vaux56_voltages, |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 1026 | }, |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 1027 | .load_lp_uA = 2000, |
| 1028 | /* values for CtrlVaux5 register */ |
| 1029 | .update_bank = 0x01, |
| 1030 | .update_reg = 0x55, |
Lee Jones | ae0a9a3 | 2013-03-28 16:11:16 +0000 | [diff] [blame] | 1031 | .update_mask = 0x18, |
| 1032 | .update_val = 0x10, |
| 1033 | .update_val_idle = 0x18, |
| 1034 | .update_val_normal = 0x10, |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 1035 | .voltage_bank = 0x01, |
| 1036 | .voltage_reg = 0x55, |
| 1037 | .voltage_mask = 0x07, |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 1038 | }, |
| 1039 | [AB8505_LDO_AUX6] = { |
| 1040 | .desc = { |
| 1041 | .name = "LDO-AUX6", |
| 1042 | .ops = &ab8500_regulator_volt_mode_ops, |
| 1043 | .type = REGULATOR_VOLTAGE, |
| 1044 | .id = AB8505_LDO_AUX6, |
| 1045 | .owner = THIS_MODULE, |
| 1046 | .n_voltages = ARRAY_SIZE(ldo_vaux56_voltages), |
Lee Jones | 62ab411 | 2013-03-28 16:11:18 +0000 | [diff] [blame] | 1047 | .volt_table = ldo_vaux56_voltages, |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 1048 | }, |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 1049 | .load_lp_uA = 2000, |
| 1050 | /* values for CtrlVaux6 register */ |
| 1051 | .update_bank = 0x01, |
| 1052 | .update_reg = 0x56, |
Lee Jones | ae0a9a3 | 2013-03-28 16:11:16 +0000 | [diff] [blame] | 1053 | .update_mask = 0x18, |
| 1054 | .update_val = 0x10, |
| 1055 | .update_val_idle = 0x18, |
| 1056 | .update_val_normal = 0x10, |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 1057 | .voltage_bank = 0x01, |
| 1058 | .voltage_reg = 0x56, |
| 1059 | .voltage_mask = 0x07, |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 1060 | }, |
| 1061 | [AB8505_LDO_INTCORE] = { |
| 1062 | .desc = { |
| 1063 | .name = "LDO-INTCORE", |
| 1064 | .ops = &ab8500_regulator_volt_mode_ops, |
| 1065 | .type = REGULATOR_VOLTAGE, |
Lee Jones | 0b94641 | 2013-04-02 13:24:07 +0100 | [diff] [blame] | 1066 | .id = AB8505_LDO_INTCORE, |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 1067 | .owner = THIS_MODULE, |
| 1068 | .n_voltages = ARRAY_SIZE(ldo_vintcore_voltages), |
Lee Jones | 62ab411 | 2013-03-28 16:11:18 +0000 | [diff] [blame] | 1069 | .volt_table = ldo_vintcore_voltages, |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 1070 | }, |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 1071 | .load_lp_uA = 5000, |
| 1072 | .update_bank = 0x03, |
| 1073 | .update_reg = 0x80, |
| 1074 | .update_mask = 0x44, |
| 1075 | .update_val = 0x04, |
| 1076 | .update_val_idle = 0x44, |
| 1077 | .update_val_normal = 0x04, |
| 1078 | .voltage_bank = 0x03, |
| 1079 | .voltage_reg = 0x80, |
| 1080 | .voltage_mask = 0x38, |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 1081 | .voltage_shift = 3, |
| 1082 | }, |
| 1083 | |
| 1084 | /* |
| 1085 | * Fixed Voltage Regulators |
| 1086 | * name, fixed mV, |
| 1087 | * update bank, reg, mask, enable val |
| 1088 | */ |
| 1089 | [AB8505_LDO_ADC] = { |
| 1090 | .desc = { |
| 1091 | .name = "LDO-ADC", |
| 1092 | .ops = &ab8500_regulator_mode_ops, |
| 1093 | .type = REGULATOR_VOLTAGE, |
| 1094 | .id = AB8505_LDO_ADC, |
| 1095 | .owner = THIS_MODULE, |
| 1096 | .n_voltages = 1, |
Lee Jones | b080c78 | 2013-03-28 16:11:17 +0000 | [diff] [blame] | 1097 | .volt_table = fixed_2000000_voltage, |
Lee Jones | a4d6846 | 2013-04-02 13:24:16 +0100 | [diff] [blame] | 1098 | .enable_time = 10000, |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 1099 | }, |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 1100 | .load_lp_uA = 1000, |
| 1101 | .update_bank = 0x03, |
| 1102 | .update_reg = 0x80, |
| 1103 | .update_mask = 0x82, |
| 1104 | .update_val = 0x02, |
| 1105 | .update_val_idle = 0x82, |
| 1106 | .update_val_normal = 0x02, |
| 1107 | }, |
| 1108 | [AB8505_LDO_USB] = { |
| 1109 | .desc = { |
| 1110 | .name = "LDO-USB", |
| 1111 | .ops = &ab8500_regulator_mode_ops, |
| 1112 | .type = REGULATOR_VOLTAGE, |
Lee Jones | 0b94641 | 2013-04-02 13:24:07 +0100 | [diff] [blame] | 1113 | .id = AB8505_LDO_USB, |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 1114 | .owner = THIS_MODULE, |
| 1115 | .n_voltages = 1, |
Lee Jones | b080c78 | 2013-03-28 16:11:17 +0000 | [diff] [blame] | 1116 | .volt_table = fixed_3300000_voltage, |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 1117 | }, |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 1118 | .update_bank = 0x03, |
| 1119 | .update_reg = 0x82, |
| 1120 | .update_mask = 0x03, |
| 1121 | .update_val = 0x01, |
| 1122 | .update_val_idle = 0x03, |
| 1123 | .update_val_normal = 0x01, |
| 1124 | }, |
| 1125 | [AB8505_LDO_AUDIO] = { |
| 1126 | .desc = { |
| 1127 | .name = "LDO-AUDIO", |
Lee Jones | 8a3b1b8 | 2013-04-02 13:24:09 +0100 | [diff] [blame] | 1128 | .ops = &ab8500_regulator_volt_ops, |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 1129 | .type = REGULATOR_VOLTAGE, |
Lee Jones | 0b94641 | 2013-04-02 13:24:07 +0100 | [diff] [blame] | 1130 | .id = AB8505_LDO_AUDIO, |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 1131 | .owner = THIS_MODULE, |
Lee Jones | 8a3b1b8 | 2013-04-02 13:24:09 +0100 | [diff] [blame] | 1132 | .n_voltages = ARRAY_SIZE(ldo_vaudio_voltages), |
| 1133 | .volt_table = ldo_vaudio_voltages, |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 1134 | }, |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 1135 | .update_bank = 0x03, |
| 1136 | .update_reg = 0x83, |
| 1137 | .update_mask = 0x02, |
| 1138 | .update_val = 0x02, |
Lee Jones | 8a3b1b8 | 2013-04-02 13:24:09 +0100 | [diff] [blame] | 1139 | .voltage_bank = 0x01, |
| 1140 | .voltage_reg = 0x57, |
| 1141 | .voltage_mask = 0x7, |
| 1142 | .voltage_shift = 4, |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 1143 | }, |
| 1144 | [AB8505_LDO_ANAMIC1] = { |
| 1145 | .desc = { |
| 1146 | .name = "LDO-ANAMIC1", |
Lee Jones | 3fe5228 | 2013-04-02 13:24:12 +0100 | [diff] [blame] | 1147 | .ops = &ab8500_regulator_anamic_mode_ops, |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 1148 | .type = REGULATOR_VOLTAGE, |
Lee Jones | 0b94641 | 2013-04-02 13:24:07 +0100 | [diff] [blame] | 1149 | .id = AB8505_LDO_ANAMIC1, |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 1150 | .owner = THIS_MODULE, |
| 1151 | .n_voltages = 1, |
Lee Jones | b080c78 | 2013-03-28 16:11:17 +0000 | [diff] [blame] | 1152 | .volt_table = fixed_2050000_voltage, |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 1153 | }, |
Lee Jones | 4c84b4d | 2013-04-02 13:24:13 +0100 | [diff] [blame] | 1154 | .shared_mode = &ldo_anamic1_shared, |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 1155 | .update_bank = 0x03, |
| 1156 | .update_reg = 0x83, |
| 1157 | .update_mask = 0x08, |
| 1158 | .update_val = 0x08, |
Lee Jones | 3fe5228 | 2013-04-02 13:24:12 +0100 | [diff] [blame] | 1159 | .mode_bank = 0x01, |
| 1160 | .mode_reg = 0x54, |
| 1161 | .mode_mask = 0x04, |
| 1162 | .mode_val_idle = 0x04, |
| 1163 | .mode_val_normal = 0x00, |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 1164 | }, |
| 1165 | [AB8505_LDO_ANAMIC2] = { |
| 1166 | .desc = { |
| 1167 | .name = "LDO-ANAMIC2", |
Lee Jones | 3fe5228 | 2013-04-02 13:24:12 +0100 | [diff] [blame] | 1168 | .ops = &ab8500_regulator_anamic_mode_ops, |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 1169 | .type = REGULATOR_VOLTAGE, |
Lee Jones | 0b94641 | 2013-04-02 13:24:07 +0100 | [diff] [blame] | 1170 | .id = AB8505_LDO_ANAMIC2, |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 1171 | .owner = THIS_MODULE, |
| 1172 | .n_voltages = 1, |
Lee Jones | b080c78 | 2013-03-28 16:11:17 +0000 | [diff] [blame] | 1173 | .volt_table = fixed_2050000_voltage, |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 1174 | }, |
Lee Jones | 3fe5228 | 2013-04-02 13:24:12 +0100 | [diff] [blame] | 1175 | .shared_mode = &ldo_anamic2_shared, |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 1176 | .update_bank = 0x03, |
| 1177 | .update_reg = 0x83, |
| 1178 | .update_mask = 0x10, |
| 1179 | .update_val = 0x10, |
Lee Jones | 3fe5228 | 2013-04-02 13:24:12 +0100 | [diff] [blame] | 1180 | .mode_bank = 0x01, |
| 1181 | .mode_reg = 0x54, |
| 1182 | .mode_mask = 0x04, |
| 1183 | .mode_val_idle = 0x04, |
| 1184 | .mode_val_normal = 0x00, |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 1185 | }, |
| 1186 | [AB8505_LDO_AUX8] = { |
| 1187 | .desc = { |
| 1188 | .name = "LDO-AUX8", |
| 1189 | .ops = &ab8500_regulator_ops, |
| 1190 | .type = REGULATOR_VOLTAGE, |
| 1191 | .id = AB8505_LDO_AUX8, |
| 1192 | .owner = THIS_MODULE, |
| 1193 | .n_voltages = 1, |
Lee Jones | b080c78 | 2013-03-28 16:11:17 +0000 | [diff] [blame] | 1194 | .volt_table = fixed_1800000_voltage, |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 1195 | }, |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 1196 | .update_bank = 0x03, |
| 1197 | .update_reg = 0x83, |
| 1198 | .update_mask = 0x04, |
| 1199 | .update_val = 0x04, |
| 1200 | }, |
| 1201 | /* |
| 1202 | * Regulators with fixed voltage and normal/idle modes |
| 1203 | */ |
| 1204 | [AB8505_LDO_ANA] = { |
| 1205 | .desc = { |
| 1206 | .name = "LDO-ANA", |
Lee Jones | 8a3b1b8 | 2013-04-02 13:24:09 +0100 | [diff] [blame] | 1207 | .ops = &ab8500_regulator_volt_mode_ops, |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 1208 | .type = REGULATOR_VOLTAGE, |
Lee Jones | 0b94641 | 2013-04-02 13:24:07 +0100 | [diff] [blame] | 1209 | .id = AB8505_LDO_ANA, |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 1210 | .owner = THIS_MODULE, |
Lee Jones | 8a3b1b8 | 2013-04-02 13:24:09 +0100 | [diff] [blame] | 1211 | .n_voltages = ARRAY_SIZE(ldo_vana_voltages), |
| 1212 | .volt_table = ldo_vana_voltages, |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 1213 | }, |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 1214 | .load_lp_uA = 1000, |
| 1215 | .update_bank = 0x04, |
| 1216 | .update_reg = 0x06, |
| 1217 | .update_mask = 0x0c, |
| 1218 | .update_val = 0x04, |
| 1219 | .update_val_idle = 0x0c, |
| 1220 | .update_val_normal = 0x04, |
Lee Jones | 8a3b1b8 | 2013-04-02 13:24:09 +0100 | [diff] [blame] | 1221 | .voltage_bank = 0x04, |
| 1222 | .voltage_reg = 0x29, |
| 1223 | .voltage_mask = 0x7, |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 1224 | }, |
| 1225 | }; |
| 1226 | |
Lee Jones | 8e6a8d7 | 2013-03-28 16:11:11 +0000 | [diff] [blame] | 1227 | /* AB9540 regulator information */ |
| 1228 | static struct ab8500_regulator_info |
| 1229 | ab9540_regulator_info[AB9540_NUM_REGULATORS] = { |
| 1230 | /* |
| 1231 | * Variable Voltage Regulators |
| 1232 | * name, min mV, max mV, |
| 1233 | * update bank, reg, mask, enable val |
Lee Jones | d319310 | 2013-04-02 13:24:18 +0100 | [diff] [blame] | 1234 | * volt bank, reg, mask |
Lee Jones | 8e6a8d7 | 2013-03-28 16:11:11 +0000 | [diff] [blame] | 1235 | */ |
| 1236 | [AB9540_LDO_AUX1] = { |
| 1237 | .desc = { |
| 1238 | .name = "LDO-AUX1", |
| 1239 | .ops = &ab8500_regulator_volt_mode_ops, |
| 1240 | .type = REGULATOR_VOLTAGE, |
Lee Jones | 0b94641 | 2013-04-02 13:24:07 +0100 | [diff] [blame] | 1241 | .id = AB9540_LDO_AUX1, |
Lee Jones | 8e6a8d7 | 2013-03-28 16:11:11 +0000 | [diff] [blame] | 1242 | .owner = THIS_MODULE, |
| 1243 | .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages), |
Lee Jones | 62ab411 | 2013-03-28 16:11:18 +0000 | [diff] [blame] | 1244 | .volt_table = ldo_vauxn_voltages, |
Lee Jones | 8e6a8d7 | 2013-03-28 16:11:11 +0000 | [diff] [blame] | 1245 | }, |
Lee Jones | 8e6a8d7 | 2013-03-28 16:11:11 +0000 | [diff] [blame] | 1246 | .load_lp_uA = 5000, |
| 1247 | .update_bank = 0x04, |
| 1248 | .update_reg = 0x09, |
| 1249 | .update_mask = 0x03, |
| 1250 | .update_val = 0x01, |
| 1251 | .update_val_idle = 0x03, |
| 1252 | .update_val_normal = 0x01, |
| 1253 | .voltage_bank = 0x04, |
| 1254 | .voltage_reg = 0x1f, |
| 1255 | .voltage_mask = 0x0f, |
Lee Jones | 8e6a8d7 | 2013-03-28 16:11:11 +0000 | [diff] [blame] | 1256 | }, |
| 1257 | [AB9540_LDO_AUX2] = { |
| 1258 | .desc = { |
| 1259 | .name = "LDO-AUX2", |
| 1260 | .ops = &ab8500_regulator_volt_mode_ops, |
| 1261 | .type = REGULATOR_VOLTAGE, |
Lee Jones | 0b94641 | 2013-04-02 13:24:07 +0100 | [diff] [blame] | 1262 | .id = AB9540_LDO_AUX2, |
Lee Jones | 8e6a8d7 | 2013-03-28 16:11:11 +0000 | [diff] [blame] | 1263 | .owner = THIS_MODULE, |
| 1264 | .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages), |
Lee Jones | 62ab411 | 2013-03-28 16:11:18 +0000 | [diff] [blame] | 1265 | .volt_table = ldo_vauxn_voltages, |
Lee Jones | 8e6a8d7 | 2013-03-28 16:11:11 +0000 | [diff] [blame] | 1266 | }, |
Lee Jones | 8e6a8d7 | 2013-03-28 16:11:11 +0000 | [diff] [blame] | 1267 | .load_lp_uA = 5000, |
| 1268 | .update_bank = 0x04, |
| 1269 | .update_reg = 0x09, |
| 1270 | .update_mask = 0x0c, |
| 1271 | .update_val = 0x04, |
| 1272 | .update_val_idle = 0x0c, |
| 1273 | .update_val_normal = 0x04, |
| 1274 | .voltage_bank = 0x04, |
| 1275 | .voltage_reg = 0x20, |
| 1276 | .voltage_mask = 0x0f, |
Lee Jones | 8e6a8d7 | 2013-03-28 16:11:11 +0000 | [diff] [blame] | 1277 | }, |
| 1278 | [AB9540_LDO_AUX3] = { |
| 1279 | .desc = { |
| 1280 | .name = "LDO-AUX3", |
| 1281 | .ops = &ab8500_regulator_volt_mode_ops, |
| 1282 | .type = REGULATOR_VOLTAGE, |
Lee Jones | 0b94641 | 2013-04-02 13:24:07 +0100 | [diff] [blame] | 1283 | .id = AB9540_LDO_AUX3, |
Lee Jones | 8e6a8d7 | 2013-03-28 16:11:11 +0000 | [diff] [blame] | 1284 | .owner = THIS_MODULE, |
| 1285 | .n_voltages = ARRAY_SIZE(ldo_vaux3_voltages), |
Lee Jones | 62ab411 | 2013-03-28 16:11:18 +0000 | [diff] [blame] | 1286 | .volt_table = ldo_vaux3_voltages, |
Lee Jones | 8e6a8d7 | 2013-03-28 16:11:11 +0000 | [diff] [blame] | 1287 | }, |
Lee Jones | 8e6a8d7 | 2013-03-28 16:11:11 +0000 | [diff] [blame] | 1288 | .load_lp_uA = 5000, |
| 1289 | .update_bank = 0x04, |
| 1290 | .update_reg = 0x0a, |
| 1291 | .update_mask = 0x03, |
| 1292 | .update_val = 0x01, |
| 1293 | .update_val_idle = 0x03, |
| 1294 | .update_val_normal = 0x01, |
| 1295 | .voltage_bank = 0x04, |
| 1296 | .voltage_reg = 0x21, |
| 1297 | .voltage_mask = 0x07, |
Lee Jones | 8e6a8d7 | 2013-03-28 16:11:11 +0000 | [diff] [blame] | 1298 | }, |
| 1299 | [AB9540_LDO_AUX4] = { |
| 1300 | .desc = { |
| 1301 | .name = "LDO-AUX4", |
| 1302 | .ops = &ab8500_regulator_volt_mode_ops, |
| 1303 | .type = REGULATOR_VOLTAGE, |
| 1304 | .id = AB9540_LDO_AUX4, |
| 1305 | .owner = THIS_MODULE, |
| 1306 | .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages), |
Lee Jones | 62ab411 | 2013-03-28 16:11:18 +0000 | [diff] [blame] | 1307 | .volt_table = ldo_vauxn_voltages, |
Lee Jones | 8e6a8d7 | 2013-03-28 16:11:11 +0000 | [diff] [blame] | 1308 | }, |
Lee Jones | 8e6a8d7 | 2013-03-28 16:11:11 +0000 | [diff] [blame] | 1309 | .load_lp_uA = 5000, |
| 1310 | /* values for Vaux4Regu register */ |
| 1311 | .update_bank = 0x04, |
| 1312 | .update_reg = 0x2e, |
| 1313 | .update_mask = 0x03, |
| 1314 | .update_val = 0x01, |
| 1315 | .update_val_idle = 0x03, |
| 1316 | .update_val_normal = 0x01, |
| 1317 | /* values for Vaux4SEL register */ |
| 1318 | .voltage_bank = 0x04, |
| 1319 | .voltage_reg = 0x2f, |
| 1320 | .voltage_mask = 0x0f, |
Lee Jones | 8e6a8d7 | 2013-03-28 16:11:11 +0000 | [diff] [blame] | 1321 | }, |
| 1322 | [AB9540_LDO_INTCORE] = { |
| 1323 | .desc = { |
| 1324 | .name = "LDO-INTCORE", |
| 1325 | .ops = &ab8500_regulator_volt_mode_ops, |
| 1326 | .type = REGULATOR_VOLTAGE, |
Lee Jones | 0b94641 | 2013-04-02 13:24:07 +0100 | [diff] [blame] | 1327 | .id = AB9540_LDO_INTCORE, |
Lee Jones | 8e6a8d7 | 2013-03-28 16:11:11 +0000 | [diff] [blame] | 1328 | .owner = THIS_MODULE, |
| 1329 | .n_voltages = ARRAY_SIZE(ldo_vintcore_voltages), |
Lee Jones | 62ab411 | 2013-03-28 16:11:18 +0000 | [diff] [blame] | 1330 | .volt_table = ldo_vintcore_voltages, |
Lee Jones | 8e6a8d7 | 2013-03-28 16:11:11 +0000 | [diff] [blame] | 1331 | }, |
Lee Jones | 8e6a8d7 | 2013-03-28 16:11:11 +0000 | [diff] [blame] | 1332 | .load_lp_uA = 5000, |
| 1333 | .update_bank = 0x03, |
| 1334 | .update_reg = 0x80, |
| 1335 | .update_mask = 0x44, |
| 1336 | .update_val = 0x44, |
| 1337 | .update_val_idle = 0x44, |
| 1338 | .update_val_normal = 0x04, |
| 1339 | .voltage_bank = 0x03, |
| 1340 | .voltage_reg = 0x80, |
| 1341 | .voltage_mask = 0x38, |
Lee Jones | 8e6a8d7 | 2013-03-28 16:11:11 +0000 | [diff] [blame] | 1342 | .voltage_shift = 3, |
| 1343 | }, |
Bengt Jonsson | 6909b45 | 2010-12-10 11:08:47 +0100 | [diff] [blame] | 1344 | |
Lee Jones | 8e6a8d7 | 2013-03-28 16:11:11 +0000 | [diff] [blame] | 1345 | /* |
| 1346 | * Fixed Voltage Regulators |
| 1347 | * name, fixed mV, |
| 1348 | * update bank, reg, mask, enable val |
| 1349 | */ |
| 1350 | [AB9540_LDO_TVOUT] = { |
| 1351 | .desc = { |
| 1352 | .name = "LDO-TVOUT", |
| 1353 | .ops = &ab8500_regulator_mode_ops, |
| 1354 | .type = REGULATOR_VOLTAGE, |
Lee Jones | 0b94641 | 2013-04-02 13:24:07 +0100 | [diff] [blame] | 1355 | .id = AB9540_LDO_TVOUT, |
Lee Jones | 8e6a8d7 | 2013-03-28 16:11:11 +0000 | [diff] [blame] | 1356 | .owner = THIS_MODULE, |
| 1357 | .n_voltages = 1, |
Lee Jones | b080c78 | 2013-03-28 16:11:17 +0000 | [diff] [blame] | 1358 | .volt_table = fixed_2000000_voltage, |
Lee Jones | a4d6846 | 2013-04-02 13:24:16 +0100 | [diff] [blame] | 1359 | .enable_time = 10000, |
Lee Jones | 8e6a8d7 | 2013-03-28 16:11:11 +0000 | [diff] [blame] | 1360 | }, |
Lee Jones | 8e6a8d7 | 2013-03-28 16:11:11 +0000 | [diff] [blame] | 1361 | .load_lp_uA = 1000, |
| 1362 | .update_bank = 0x03, |
| 1363 | .update_reg = 0x80, |
| 1364 | .update_mask = 0x82, |
| 1365 | .update_val = 0x02, |
| 1366 | .update_val_idle = 0x82, |
| 1367 | .update_val_normal = 0x02, |
| 1368 | }, |
| 1369 | [AB9540_LDO_USB] = { |
| 1370 | .desc = { |
| 1371 | .name = "LDO-USB", |
| 1372 | .ops = &ab8500_regulator_ops, |
| 1373 | .type = REGULATOR_VOLTAGE, |
| 1374 | .id = AB9540_LDO_USB, |
| 1375 | .owner = THIS_MODULE, |
| 1376 | .n_voltages = 1, |
Lee Jones | b080c78 | 2013-03-28 16:11:17 +0000 | [diff] [blame] | 1377 | .volt_table = fixed_3300000_voltage, |
Lee Jones | 8e6a8d7 | 2013-03-28 16:11:11 +0000 | [diff] [blame] | 1378 | }, |
Lee Jones | 8e6a8d7 | 2013-03-28 16:11:11 +0000 | [diff] [blame] | 1379 | .update_bank = 0x03, |
| 1380 | .update_reg = 0x82, |
| 1381 | .update_mask = 0x03, |
| 1382 | .update_val = 0x01, |
| 1383 | .update_val_idle = 0x03, |
| 1384 | .update_val_normal = 0x01, |
| 1385 | }, |
| 1386 | [AB9540_LDO_AUDIO] = { |
| 1387 | .desc = { |
| 1388 | .name = "LDO-AUDIO", |
| 1389 | .ops = &ab8500_regulator_ops, |
| 1390 | .type = REGULATOR_VOLTAGE, |
Lee Jones | 0b94641 | 2013-04-02 13:24:07 +0100 | [diff] [blame] | 1391 | .id = AB9540_LDO_AUDIO, |
Lee Jones | 8e6a8d7 | 2013-03-28 16:11:11 +0000 | [diff] [blame] | 1392 | .owner = THIS_MODULE, |
| 1393 | .n_voltages = 1, |
Lee Jones | b080c78 | 2013-03-28 16:11:17 +0000 | [diff] [blame] | 1394 | .volt_table = fixed_2000000_voltage, |
Lee Jones | 8e6a8d7 | 2013-03-28 16:11:11 +0000 | [diff] [blame] | 1395 | }, |
Lee Jones | 8e6a8d7 | 2013-03-28 16:11:11 +0000 | [diff] [blame] | 1396 | .update_bank = 0x03, |
| 1397 | .update_reg = 0x83, |
| 1398 | .update_mask = 0x02, |
| 1399 | .update_val = 0x02, |
| 1400 | }, |
| 1401 | [AB9540_LDO_ANAMIC1] = { |
| 1402 | .desc = { |
| 1403 | .name = "LDO-ANAMIC1", |
| 1404 | .ops = &ab8500_regulator_ops, |
| 1405 | .type = REGULATOR_VOLTAGE, |
Lee Jones | 0b94641 | 2013-04-02 13:24:07 +0100 | [diff] [blame] | 1406 | .id = AB9540_LDO_ANAMIC1, |
Lee Jones | 8e6a8d7 | 2013-03-28 16:11:11 +0000 | [diff] [blame] | 1407 | .owner = THIS_MODULE, |
| 1408 | .n_voltages = 1, |
Lee Jones | b080c78 | 2013-03-28 16:11:17 +0000 | [diff] [blame] | 1409 | .volt_table = fixed_2050000_voltage, |
Lee Jones | 8e6a8d7 | 2013-03-28 16:11:11 +0000 | [diff] [blame] | 1410 | }, |
Lee Jones | 8e6a8d7 | 2013-03-28 16:11:11 +0000 | [diff] [blame] | 1411 | .update_bank = 0x03, |
| 1412 | .update_reg = 0x83, |
| 1413 | .update_mask = 0x08, |
| 1414 | .update_val = 0x08, |
| 1415 | }, |
| 1416 | [AB9540_LDO_ANAMIC2] = { |
| 1417 | .desc = { |
| 1418 | .name = "LDO-ANAMIC2", |
| 1419 | .ops = &ab8500_regulator_ops, |
| 1420 | .type = REGULATOR_VOLTAGE, |
Lee Jones | 0b94641 | 2013-04-02 13:24:07 +0100 | [diff] [blame] | 1421 | .id = AB9540_LDO_ANAMIC2, |
Lee Jones | 8e6a8d7 | 2013-03-28 16:11:11 +0000 | [diff] [blame] | 1422 | .owner = THIS_MODULE, |
| 1423 | .n_voltages = 1, |
Lee Jones | b080c78 | 2013-03-28 16:11:17 +0000 | [diff] [blame] | 1424 | .volt_table = fixed_2050000_voltage, |
Lee Jones | 8e6a8d7 | 2013-03-28 16:11:11 +0000 | [diff] [blame] | 1425 | }, |
Lee Jones | 8e6a8d7 | 2013-03-28 16:11:11 +0000 | [diff] [blame] | 1426 | .update_bank = 0x03, |
| 1427 | .update_reg = 0x83, |
| 1428 | .update_mask = 0x10, |
| 1429 | .update_val = 0x10, |
| 1430 | }, |
| 1431 | [AB9540_LDO_DMIC] = { |
| 1432 | .desc = { |
| 1433 | .name = "LDO-DMIC", |
| 1434 | .ops = &ab8500_regulator_ops, |
| 1435 | .type = REGULATOR_VOLTAGE, |
Lee Jones | 0b94641 | 2013-04-02 13:24:07 +0100 | [diff] [blame] | 1436 | .id = AB9540_LDO_DMIC, |
Lee Jones | 8e6a8d7 | 2013-03-28 16:11:11 +0000 | [diff] [blame] | 1437 | .owner = THIS_MODULE, |
| 1438 | .n_voltages = 1, |
Lee Jones | b080c78 | 2013-03-28 16:11:17 +0000 | [diff] [blame] | 1439 | .volt_table = fixed_1800000_voltage, |
Lee Jones | 8e6a8d7 | 2013-03-28 16:11:11 +0000 | [diff] [blame] | 1440 | }, |
Lee Jones | 8e6a8d7 | 2013-03-28 16:11:11 +0000 | [diff] [blame] | 1441 | .update_bank = 0x03, |
| 1442 | .update_reg = 0x83, |
| 1443 | .update_mask = 0x04, |
| 1444 | .update_val = 0x04, |
| 1445 | }, |
| 1446 | |
| 1447 | /* |
| 1448 | * Regulators with fixed voltage and normal/idle modes |
| 1449 | */ |
| 1450 | [AB9540_LDO_ANA] = { |
| 1451 | .desc = { |
| 1452 | .name = "LDO-ANA", |
| 1453 | .ops = &ab8500_regulator_mode_ops, |
| 1454 | .type = REGULATOR_VOLTAGE, |
Lee Jones | 0b94641 | 2013-04-02 13:24:07 +0100 | [diff] [blame] | 1455 | .id = AB9540_LDO_ANA, |
Lee Jones | 8e6a8d7 | 2013-03-28 16:11:11 +0000 | [diff] [blame] | 1456 | .owner = THIS_MODULE, |
| 1457 | .n_voltages = 1, |
Lee Jones | b080c78 | 2013-03-28 16:11:17 +0000 | [diff] [blame] | 1458 | .volt_table = fixed_1200000_voltage, |
Lee Jones | 8e6a8d7 | 2013-03-28 16:11:11 +0000 | [diff] [blame] | 1459 | }, |
Lee Jones | 8e6a8d7 | 2013-03-28 16:11:11 +0000 | [diff] [blame] | 1460 | .load_lp_uA = 1000, |
| 1461 | .update_bank = 0x04, |
| 1462 | .update_reg = 0x06, |
| 1463 | .update_mask = 0x0c, |
| 1464 | .update_val = 0x08, |
| 1465 | .update_val_idle = 0x0c, |
| 1466 | .update_val_normal = 0x08, |
| 1467 | }, |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 1468 | }; |
| 1469 | |
Lee Jones | ae0a9a3 | 2013-03-28 16:11:16 +0000 | [diff] [blame] | 1470 | /* AB8540 regulator information */ |
| 1471 | static struct ab8500_regulator_info |
| 1472 | ab8540_regulator_info[AB8540_NUM_REGULATORS] = { |
| 1473 | /* |
| 1474 | * Variable Voltage Regulators |
| 1475 | * name, min mV, max mV, |
| 1476 | * update bank, reg, mask, enable val |
Lee Jones | d319310 | 2013-04-02 13:24:18 +0100 | [diff] [blame] | 1477 | * volt bank, reg, mask |
Lee Jones | ae0a9a3 | 2013-03-28 16:11:16 +0000 | [diff] [blame] | 1478 | */ |
| 1479 | [AB8540_LDO_AUX1] = { |
| 1480 | .desc = { |
| 1481 | .name = "LDO-AUX1", |
| 1482 | .ops = &ab8500_regulator_volt_mode_ops, |
| 1483 | .type = REGULATOR_VOLTAGE, |
Lee Jones | 0b94641 | 2013-04-02 13:24:07 +0100 | [diff] [blame] | 1484 | .id = AB8540_LDO_AUX1, |
Lee Jones | ae0a9a3 | 2013-03-28 16:11:16 +0000 | [diff] [blame] | 1485 | .owner = THIS_MODULE, |
| 1486 | .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages), |
Lee Jones | 62ab411 | 2013-03-28 16:11:18 +0000 | [diff] [blame] | 1487 | .volt_table = ldo_vauxn_voltages, |
Lee Jones | ae0a9a3 | 2013-03-28 16:11:16 +0000 | [diff] [blame] | 1488 | }, |
| 1489 | .load_lp_uA = 5000, |
| 1490 | .update_bank = 0x04, |
| 1491 | .update_reg = 0x09, |
| 1492 | .update_mask = 0x03, |
| 1493 | .update_val = 0x01, |
| 1494 | .update_val_idle = 0x03, |
| 1495 | .update_val_normal = 0x01, |
| 1496 | .voltage_bank = 0x04, |
| 1497 | .voltage_reg = 0x1f, |
| 1498 | .voltage_mask = 0x0f, |
Lee Jones | ae0a9a3 | 2013-03-28 16:11:16 +0000 | [diff] [blame] | 1499 | }, |
| 1500 | [AB8540_LDO_AUX2] = { |
| 1501 | .desc = { |
| 1502 | .name = "LDO-AUX2", |
| 1503 | .ops = &ab8500_regulator_volt_mode_ops, |
| 1504 | .type = REGULATOR_VOLTAGE, |
Lee Jones | 0b94641 | 2013-04-02 13:24:07 +0100 | [diff] [blame] | 1505 | .id = AB8540_LDO_AUX2, |
Lee Jones | ae0a9a3 | 2013-03-28 16:11:16 +0000 | [diff] [blame] | 1506 | .owner = THIS_MODULE, |
| 1507 | .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages), |
Lee Jones | 62ab411 | 2013-03-28 16:11:18 +0000 | [diff] [blame] | 1508 | .volt_table = ldo_vauxn_voltages, |
Lee Jones | ae0a9a3 | 2013-03-28 16:11:16 +0000 | [diff] [blame] | 1509 | }, |
| 1510 | .load_lp_uA = 5000, |
| 1511 | .update_bank = 0x04, |
| 1512 | .update_reg = 0x09, |
| 1513 | .update_mask = 0x0c, |
| 1514 | .update_val = 0x04, |
| 1515 | .update_val_idle = 0x0c, |
| 1516 | .update_val_normal = 0x04, |
| 1517 | .voltage_bank = 0x04, |
| 1518 | .voltage_reg = 0x20, |
| 1519 | .voltage_mask = 0x0f, |
Lee Jones | ae0a9a3 | 2013-03-28 16:11:16 +0000 | [diff] [blame] | 1520 | }, |
| 1521 | [AB8540_LDO_AUX3] = { |
| 1522 | .desc = { |
| 1523 | .name = "LDO-AUX3", |
Lee Jones | d7607ba | 2013-04-02 13:24:11 +0100 | [diff] [blame] | 1524 | .ops = &ab8540_aux3_regulator_volt_mode_ops, |
Lee Jones | ae0a9a3 | 2013-03-28 16:11:16 +0000 | [diff] [blame] | 1525 | .type = REGULATOR_VOLTAGE, |
Lee Jones | 0b94641 | 2013-04-02 13:24:07 +0100 | [diff] [blame] | 1526 | .id = AB8540_LDO_AUX3, |
Lee Jones | ae0a9a3 | 2013-03-28 16:11:16 +0000 | [diff] [blame] | 1527 | .owner = THIS_MODULE, |
| 1528 | .n_voltages = ARRAY_SIZE(ldo_vaux3_ab8540_voltages), |
Lee Jones | 62ab411 | 2013-03-28 16:11:18 +0000 | [diff] [blame] | 1529 | .volt_table = ldo_vaux3_ab8540_voltages, |
Lee Jones | ae0a9a3 | 2013-03-28 16:11:16 +0000 | [diff] [blame] | 1530 | }, |
| 1531 | .load_lp_uA = 5000, |
| 1532 | .update_bank = 0x04, |
| 1533 | .update_reg = 0x0a, |
| 1534 | .update_mask = 0x03, |
| 1535 | .update_val = 0x01, |
| 1536 | .update_val_idle = 0x03, |
| 1537 | .update_val_normal = 0x01, |
| 1538 | .voltage_bank = 0x04, |
| 1539 | .voltage_reg = 0x21, |
| 1540 | .voltage_mask = 0x07, |
Lee Jones | d7607ba | 2013-04-02 13:24:11 +0100 | [diff] [blame] | 1541 | .expand_register = { |
| 1542 | .voltage_limit = 8, |
| 1543 | .voltage_bank = 0x04, |
| 1544 | .voltage_reg = 0x01, |
| 1545 | .voltage_mask = 0x10, |
| 1546 | .voltage_shift = 1, |
| 1547 | } |
Lee Jones | ae0a9a3 | 2013-03-28 16:11:16 +0000 | [diff] [blame] | 1548 | }, |
| 1549 | [AB8540_LDO_AUX4] = { |
| 1550 | .desc = { |
| 1551 | .name = "LDO-AUX4", |
| 1552 | .ops = &ab8500_regulator_volt_mode_ops, |
| 1553 | .type = REGULATOR_VOLTAGE, |
Lee Jones | 0b94641 | 2013-04-02 13:24:07 +0100 | [diff] [blame] | 1554 | .id = AB8540_LDO_AUX4, |
Lee Jones | ae0a9a3 | 2013-03-28 16:11:16 +0000 | [diff] [blame] | 1555 | .owner = THIS_MODULE, |
| 1556 | .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages), |
Lee Jones | 62ab411 | 2013-03-28 16:11:18 +0000 | [diff] [blame] | 1557 | .volt_table = ldo_vauxn_voltages, |
Lee Jones | ae0a9a3 | 2013-03-28 16:11:16 +0000 | [diff] [blame] | 1558 | }, |
| 1559 | .load_lp_uA = 5000, |
| 1560 | /* values for Vaux4Regu register */ |
| 1561 | .update_bank = 0x04, |
| 1562 | .update_reg = 0x2e, |
| 1563 | .update_mask = 0x03, |
| 1564 | .update_val = 0x01, |
| 1565 | .update_val_idle = 0x03, |
| 1566 | .update_val_normal = 0x01, |
| 1567 | /* values for Vaux4SEL register */ |
| 1568 | .voltage_bank = 0x04, |
| 1569 | .voltage_reg = 0x2f, |
| 1570 | .voltage_mask = 0x0f, |
Lee Jones | ae0a9a3 | 2013-03-28 16:11:16 +0000 | [diff] [blame] | 1571 | }, |
Zhenhua HUANG | 684d5ce | 2013-04-02 13:24:15 +0100 | [diff] [blame] | 1572 | [AB8540_LDO_AUX5] = { |
| 1573 | .desc = { |
| 1574 | .name = "LDO-AUX5", |
| 1575 | .ops = &ab8500_regulator_volt_mode_ops, |
| 1576 | .type = REGULATOR_VOLTAGE, |
| 1577 | .id = AB8540_LDO_AUX5, |
| 1578 | .owner = THIS_MODULE, |
| 1579 | .n_voltages = ARRAY_SIZE(ldo_vaux56_ab8540_voltages), |
Lee Jones | d319310 | 2013-04-02 13:24:18 +0100 | [diff] [blame] | 1580 | .volt_table = ldo_vaux56_ab8540_voltages, |
Zhenhua HUANG | 684d5ce | 2013-04-02 13:24:15 +0100 | [diff] [blame] | 1581 | }, |
| 1582 | .load_lp_uA = 20000, |
| 1583 | /* values for Vaux5Regu register */ |
| 1584 | .update_bank = 0x04, |
| 1585 | .update_reg = 0x32, |
| 1586 | .update_mask = 0x03, |
| 1587 | .update_val = 0x01, |
| 1588 | .update_val_idle = 0x03, |
| 1589 | .update_val_normal = 0x01, |
| 1590 | /* values for Vaux5SEL register */ |
| 1591 | .voltage_bank = 0x04, |
| 1592 | .voltage_reg = 0x33, |
| 1593 | .voltage_mask = 0x3f, |
Zhenhua HUANG | 684d5ce | 2013-04-02 13:24:15 +0100 | [diff] [blame] | 1594 | }, |
| 1595 | [AB8540_LDO_AUX6] = { |
| 1596 | .desc = { |
| 1597 | .name = "LDO-AUX6", |
| 1598 | .ops = &ab8500_regulator_volt_mode_ops, |
| 1599 | .type = REGULATOR_VOLTAGE, |
| 1600 | .id = AB8540_LDO_AUX6, |
| 1601 | .owner = THIS_MODULE, |
| 1602 | .n_voltages = ARRAY_SIZE(ldo_vaux56_ab8540_voltages), |
Lee Jones | d319310 | 2013-04-02 13:24:18 +0100 | [diff] [blame] | 1603 | .volt_table = ldo_vaux56_ab8540_voltages, |
Zhenhua HUANG | 684d5ce | 2013-04-02 13:24:15 +0100 | [diff] [blame] | 1604 | }, |
| 1605 | .load_lp_uA = 20000, |
| 1606 | /* values for Vaux6Regu register */ |
| 1607 | .update_bank = 0x04, |
| 1608 | .update_reg = 0x35, |
| 1609 | .update_mask = 0x03, |
| 1610 | .update_val = 0x01, |
| 1611 | .update_val_idle = 0x03, |
| 1612 | .update_val_normal = 0x01, |
| 1613 | /* values for Vaux6SEL register */ |
| 1614 | .voltage_bank = 0x04, |
| 1615 | .voltage_reg = 0x36, |
| 1616 | .voltage_mask = 0x3f, |
Zhenhua HUANG | 684d5ce | 2013-04-02 13:24:15 +0100 | [diff] [blame] | 1617 | }, |
Lee Jones | ae0a9a3 | 2013-03-28 16:11:16 +0000 | [diff] [blame] | 1618 | [AB8540_LDO_INTCORE] = { |
| 1619 | .desc = { |
| 1620 | .name = "LDO-INTCORE", |
| 1621 | .ops = &ab8500_regulator_volt_mode_ops, |
| 1622 | .type = REGULATOR_VOLTAGE, |
Lee Jones | 0b94641 | 2013-04-02 13:24:07 +0100 | [diff] [blame] | 1623 | .id = AB8540_LDO_INTCORE, |
Lee Jones | ae0a9a3 | 2013-03-28 16:11:16 +0000 | [diff] [blame] | 1624 | .owner = THIS_MODULE, |
| 1625 | .n_voltages = ARRAY_SIZE(ldo_vintcore_voltages), |
Lee Jones | 62ab411 | 2013-03-28 16:11:18 +0000 | [diff] [blame] | 1626 | .volt_table = ldo_vintcore_voltages, |
Lee Jones | ae0a9a3 | 2013-03-28 16:11:16 +0000 | [diff] [blame] | 1627 | }, |
| 1628 | .load_lp_uA = 5000, |
| 1629 | .update_bank = 0x03, |
| 1630 | .update_reg = 0x80, |
| 1631 | .update_mask = 0x44, |
| 1632 | .update_val = 0x44, |
| 1633 | .update_val_idle = 0x44, |
| 1634 | .update_val_normal = 0x04, |
| 1635 | .voltage_bank = 0x03, |
| 1636 | .voltage_reg = 0x80, |
| 1637 | .voltage_mask = 0x38, |
Lee Jones | ae0a9a3 | 2013-03-28 16:11:16 +0000 | [diff] [blame] | 1638 | .voltage_shift = 3, |
| 1639 | }, |
| 1640 | |
| 1641 | /* |
| 1642 | * Fixed Voltage Regulators |
| 1643 | * name, fixed mV, |
| 1644 | * update bank, reg, mask, enable val |
| 1645 | */ |
| 1646 | [AB8540_LDO_TVOUT] = { |
| 1647 | .desc = { |
| 1648 | .name = "LDO-TVOUT", |
| 1649 | .ops = &ab8500_regulator_mode_ops, |
| 1650 | .type = REGULATOR_VOLTAGE, |
Lee Jones | 0b94641 | 2013-04-02 13:24:07 +0100 | [diff] [blame] | 1651 | .id = AB8540_LDO_TVOUT, |
Lee Jones | ae0a9a3 | 2013-03-28 16:11:16 +0000 | [diff] [blame] | 1652 | .owner = THIS_MODULE, |
| 1653 | .n_voltages = 1, |
Axel Lin | aca45e9 | 2013-04-02 13:24:23 +0100 | [diff] [blame] | 1654 | .volt_table = fixed_2000000_voltage, |
Lee Jones | a4d6846 | 2013-04-02 13:24:16 +0100 | [diff] [blame] | 1655 | .enable_time = 10000, |
Lee Jones | ae0a9a3 | 2013-03-28 16:11:16 +0000 | [diff] [blame] | 1656 | }, |
Lee Jones | ae0a9a3 | 2013-03-28 16:11:16 +0000 | [diff] [blame] | 1657 | .load_lp_uA = 1000, |
| 1658 | .update_bank = 0x03, |
| 1659 | .update_reg = 0x80, |
| 1660 | .update_mask = 0x82, |
| 1661 | .update_val = 0x02, |
| 1662 | .update_val_idle = 0x82, |
| 1663 | .update_val_normal = 0x02, |
| 1664 | }, |
| 1665 | [AB8540_LDO_AUDIO] = { |
| 1666 | .desc = { |
| 1667 | .name = "LDO-AUDIO", |
| 1668 | .ops = &ab8500_regulator_ops, |
| 1669 | .type = REGULATOR_VOLTAGE, |
Lee Jones | 0b94641 | 2013-04-02 13:24:07 +0100 | [diff] [blame] | 1670 | .id = AB8540_LDO_AUDIO, |
Lee Jones | ae0a9a3 | 2013-03-28 16:11:16 +0000 | [diff] [blame] | 1671 | .owner = THIS_MODULE, |
| 1672 | .n_voltages = 1, |
Lee Jones | b080c78 | 2013-03-28 16:11:17 +0000 | [diff] [blame] | 1673 | .volt_table = fixed_2000000_voltage, |
Lee Jones | ae0a9a3 | 2013-03-28 16:11:16 +0000 | [diff] [blame] | 1674 | }, |
| 1675 | .update_bank = 0x03, |
| 1676 | .update_reg = 0x83, |
| 1677 | .update_mask = 0x02, |
| 1678 | .update_val = 0x02, |
| 1679 | }, |
| 1680 | [AB8540_LDO_ANAMIC1] = { |
| 1681 | .desc = { |
| 1682 | .name = "LDO-ANAMIC1", |
Lee Jones | 4c84b4d | 2013-04-02 13:24:13 +0100 | [diff] [blame] | 1683 | .ops = &ab8500_regulator_anamic_mode_ops, |
Lee Jones | ae0a9a3 | 2013-03-28 16:11:16 +0000 | [diff] [blame] | 1684 | .type = REGULATOR_VOLTAGE, |
Lee Jones | 0b94641 | 2013-04-02 13:24:07 +0100 | [diff] [blame] | 1685 | .id = AB8540_LDO_ANAMIC1, |
Lee Jones | ae0a9a3 | 2013-03-28 16:11:16 +0000 | [diff] [blame] | 1686 | .owner = THIS_MODULE, |
| 1687 | .n_voltages = 1, |
Lee Jones | b080c78 | 2013-03-28 16:11:17 +0000 | [diff] [blame] | 1688 | .volt_table = fixed_2050000_voltage, |
Lee Jones | ae0a9a3 | 2013-03-28 16:11:16 +0000 | [diff] [blame] | 1689 | }, |
Lee Jones | 4c84b4d | 2013-04-02 13:24:13 +0100 | [diff] [blame] | 1690 | .shared_mode = &ab8540_ldo_anamic1_shared, |
Lee Jones | ae0a9a3 | 2013-03-28 16:11:16 +0000 | [diff] [blame] | 1691 | .update_bank = 0x03, |
| 1692 | .update_reg = 0x83, |
| 1693 | .update_mask = 0x08, |
| 1694 | .update_val = 0x08, |
Lee Jones | 4c84b4d | 2013-04-02 13:24:13 +0100 | [diff] [blame] | 1695 | .mode_bank = 0x03, |
| 1696 | .mode_reg = 0x83, |
| 1697 | .mode_mask = 0x20, |
| 1698 | .mode_val_idle = 0x20, |
| 1699 | .mode_val_normal = 0x00, |
Lee Jones | ae0a9a3 | 2013-03-28 16:11:16 +0000 | [diff] [blame] | 1700 | }, |
| 1701 | [AB8540_LDO_ANAMIC2] = { |
| 1702 | .desc = { |
| 1703 | .name = "LDO-ANAMIC2", |
Lee Jones | 4c84b4d | 2013-04-02 13:24:13 +0100 | [diff] [blame] | 1704 | .ops = &ab8500_regulator_anamic_mode_ops, |
Lee Jones | ae0a9a3 | 2013-03-28 16:11:16 +0000 | [diff] [blame] | 1705 | .type = REGULATOR_VOLTAGE, |
Lee Jones | 0b94641 | 2013-04-02 13:24:07 +0100 | [diff] [blame] | 1706 | .id = AB8540_LDO_ANAMIC2, |
Lee Jones | ae0a9a3 | 2013-03-28 16:11:16 +0000 | [diff] [blame] | 1707 | .owner = THIS_MODULE, |
| 1708 | .n_voltages = 1, |
Lee Jones | b080c78 | 2013-03-28 16:11:17 +0000 | [diff] [blame] | 1709 | .volt_table = fixed_2050000_voltage, |
Lee Jones | ae0a9a3 | 2013-03-28 16:11:16 +0000 | [diff] [blame] | 1710 | }, |
Lee Jones | 4c84b4d | 2013-04-02 13:24:13 +0100 | [diff] [blame] | 1711 | .shared_mode = &ab8540_ldo_anamic2_shared, |
Lee Jones | ae0a9a3 | 2013-03-28 16:11:16 +0000 | [diff] [blame] | 1712 | .update_bank = 0x03, |
| 1713 | .update_reg = 0x83, |
| 1714 | .update_mask = 0x10, |
| 1715 | .update_val = 0x10, |
Lee Jones | 4c84b4d | 2013-04-02 13:24:13 +0100 | [diff] [blame] | 1716 | .mode_bank = 0x03, |
| 1717 | .mode_reg = 0x83, |
| 1718 | .mode_mask = 0x20, |
| 1719 | .mode_val_idle = 0x20, |
| 1720 | .mode_val_normal = 0x00, |
Lee Jones | ae0a9a3 | 2013-03-28 16:11:16 +0000 | [diff] [blame] | 1721 | }, |
| 1722 | [AB8540_LDO_DMIC] = { |
| 1723 | .desc = { |
| 1724 | .name = "LDO-DMIC", |
Lee Jones | 4c84b4d | 2013-04-02 13:24:13 +0100 | [diff] [blame] | 1725 | .ops = &ab8500_regulator_volt_mode_ops, |
Lee Jones | ae0a9a3 | 2013-03-28 16:11:16 +0000 | [diff] [blame] | 1726 | .type = REGULATOR_VOLTAGE, |
Lee Jones | 0b94641 | 2013-04-02 13:24:07 +0100 | [diff] [blame] | 1727 | .id = AB8540_LDO_DMIC, |
Lee Jones | ae0a9a3 | 2013-03-28 16:11:16 +0000 | [diff] [blame] | 1728 | .owner = THIS_MODULE, |
Lee Jones | 4c84b4d | 2013-04-02 13:24:13 +0100 | [diff] [blame] | 1729 | .n_voltages = ARRAY_SIZE(ldo_vdmic_voltages), |
Lee Jones | d319310 | 2013-04-02 13:24:18 +0100 | [diff] [blame] | 1730 | .volt_table = ldo_vdmic_voltages, |
Lee Jones | ae0a9a3 | 2013-03-28 16:11:16 +0000 | [diff] [blame] | 1731 | }, |
Lee Jones | 4c84b4d | 2013-04-02 13:24:13 +0100 | [diff] [blame] | 1732 | .load_lp_uA = 1000, |
Lee Jones | ae0a9a3 | 2013-03-28 16:11:16 +0000 | [diff] [blame] | 1733 | .update_bank = 0x03, |
| 1734 | .update_reg = 0x83, |
| 1735 | .update_mask = 0x04, |
| 1736 | .update_val = 0x04, |
Lee Jones | 4c84b4d | 2013-04-02 13:24:13 +0100 | [diff] [blame] | 1737 | .voltage_bank = 0x03, |
| 1738 | .voltage_reg = 0x83, |
| 1739 | .voltage_mask = 0xc0, |
Lee Jones | ae0a9a3 | 2013-03-28 16:11:16 +0000 | [diff] [blame] | 1740 | }, |
| 1741 | |
| 1742 | /* |
| 1743 | * Regulators with fixed voltage and normal/idle modes |
| 1744 | */ |
| 1745 | [AB8540_LDO_ANA] = { |
| 1746 | .desc = { |
| 1747 | .name = "LDO-ANA", |
| 1748 | .ops = &ab8500_regulator_mode_ops, |
| 1749 | .type = REGULATOR_VOLTAGE, |
Lee Jones | 0b94641 | 2013-04-02 13:24:07 +0100 | [diff] [blame] | 1750 | .id = AB8540_LDO_ANA, |
Lee Jones | ae0a9a3 | 2013-03-28 16:11:16 +0000 | [diff] [blame] | 1751 | .owner = THIS_MODULE, |
| 1752 | .n_voltages = 1, |
Lee Jones | b080c78 | 2013-03-28 16:11:17 +0000 | [diff] [blame] | 1753 | .volt_table = fixed_1200000_voltage, |
Lee Jones | ae0a9a3 | 2013-03-28 16:11:16 +0000 | [diff] [blame] | 1754 | }, |
| 1755 | .load_lp_uA = 1000, |
| 1756 | .update_bank = 0x04, |
| 1757 | .update_reg = 0x06, |
| 1758 | .update_mask = 0x0c, |
| 1759 | .update_val = 0x04, |
| 1760 | .update_val_idle = 0x0c, |
| 1761 | .update_val_normal = 0x04, |
| 1762 | }, |
| 1763 | [AB8540_LDO_SDIO] = { |
| 1764 | .desc = { |
| 1765 | .name = "LDO-SDIO", |
| 1766 | .ops = &ab8500_regulator_volt_mode_ops, |
| 1767 | .type = REGULATOR_VOLTAGE, |
| 1768 | .id = AB8540_LDO_SDIO, |
| 1769 | .owner = THIS_MODULE, |
Lee Jones | 62ab411 | 2013-03-28 16:11:18 +0000 | [diff] [blame] | 1770 | .n_voltages = ARRAY_SIZE(ldo_sdio_voltages), |
| 1771 | .volt_table = ldo_sdio_voltages, |
Lee Jones | ae0a9a3 | 2013-03-28 16:11:16 +0000 | [diff] [blame] | 1772 | }, |
Lee Jones | ae0a9a3 | 2013-03-28 16:11:16 +0000 | [diff] [blame] | 1773 | .load_lp_uA = 5000, |
| 1774 | .update_bank = 0x03, |
| 1775 | .update_reg = 0x88, |
| 1776 | .update_mask = 0x30, |
| 1777 | .update_val = 0x10, |
| 1778 | .update_val_idle = 0x30, |
| 1779 | .update_val_normal = 0x10, |
| 1780 | .voltage_bank = 0x03, |
| 1781 | .voltage_reg = 0x88, |
| 1782 | .voltage_mask = 0x07, |
Lee Jones | ae0a9a3 | 2013-03-28 16:11:16 +0000 | [diff] [blame] | 1783 | }, |
| 1784 | }; |
| 1785 | |
Lee Jones | 3fe5228 | 2013-04-02 13:24:12 +0100 | [diff] [blame] | 1786 | static struct ab8500_shared_mode ldo_anamic1_shared = { |
| 1787 | .shared_regulator = &ab8505_regulator_info[AB8505_LDO_ANAMIC2], |
| 1788 | }; |
| 1789 | |
| 1790 | static struct ab8500_shared_mode ldo_anamic2_shared = { |
| 1791 | .shared_regulator = &ab8505_regulator_info[AB8505_LDO_ANAMIC1], |
| 1792 | }; |
| 1793 | |
Lee Jones | 4c84b4d | 2013-04-02 13:24:13 +0100 | [diff] [blame] | 1794 | static struct ab8500_shared_mode ab8540_ldo_anamic1_shared = { |
| 1795 | .shared_regulator = &ab8540_regulator_info[AB8540_LDO_ANAMIC2], |
| 1796 | }; |
| 1797 | |
| 1798 | static struct ab8500_shared_mode ab8540_ldo_anamic2_shared = { |
| 1799 | .shared_regulator = &ab8540_regulator_info[AB8540_LDO_ANAMIC1], |
| 1800 | }; |
| 1801 | |
Bengt Jonsson | 79568b94 | 2011-03-11 11:54:46 +0100 | [diff] [blame] | 1802 | struct ab8500_reg_init { |
| 1803 | u8 bank; |
| 1804 | u8 addr; |
| 1805 | u8 mask; |
| 1806 | }; |
| 1807 | |
| 1808 | #define REG_INIT(_id, _bank, _addr, _mask) \ |
| 1809 | [_id] = { \ |
| 1810 | .bank = _bank, \ |
| 1811 | .addr = _addr, \ |
| 1812 | .mask = _mask, \ |
| 1813 | } |
| 1814 | |
Lee Jones | 8e6a8d7 | 2013-03-28 16:11:11 +0000 | [diff] [blame] | 1815 | /* AB8500 register init */ |
Bengt Jonsson | 79568b94 | 2011-03-11 11:54:46 +0100 | [diff] [blame] | 1816 | static struct ab8500_reg_init ab8500_reg_init[] = { |
| 1817 | /* |
Lee Jones | 33bc8f4 | 2013-03-21 15:59:02 +0000 | [diff] [blame] | 1818 | * 0x30, VanaRequestCtrl |
Bengt Jonsson | 79568b94 | 2011-03-11 11:54:46 +0100 | [diff] [blame] | 1819 | * 0xc0, VextSupply1RequestCtrl |
| 1820 | */ |
Lee Jones | 43a5911 | 2013-03-21 15:59:15 +0000 | [diff] [blame] | 1821 | REG_INIT(AB8500_REGUREQUESTCTRL2, 0x03, 0x04, 0xf0), |
Bengt Jonsson | 79568b94 | 2011-03-11 11:54:46 +0100 | [diff] [blame] | 1822 | /* |
| 1823 | * 0x03, VextSupply2RequestCtrl |
| 1824 | * 0x0c, VextSupply3RequestCtrl |
| 1825 | * 0x30, Vaux1RequestCtrl |
| 1826 | * 0xc0, Vaux2RequestCtrl |
| 1827 | */ |
| 1828 | REG_INIT(AB8500_REGUREQUESTCTRL3, 0x03, 0x05, 0xff), |
| 1829 | /* |
| 1830 | * 0x03, Vaux3RequestCtrl |
| 1831 | * 0x04, SwHPReq |
| 1832 | */ |
| 1833 | REG_INIT(AB8500_REGUREQUESTCTRL4, 0x03, 0x06, 0x07), |
| 1834 | /* |
| 1835 | * 0x08, VanaSysClkReq1HPValid |
| 1836 | * 0x20, Vaux1SysClkReq1HPValid |
| 1837 | * 0x40, Vaux2SysClkReq1HPValid |
| 1838 | * 0x80, Vaux3SysClkReq1HPValid |
| 1839 | */ |
Lee Jones | 43a5911 | 2013-03-21 15:59:15 +0000 | [diff] [blame] | 1840 | REG_INIT(AB8500_REGUSYSCLKREQ1HPVALID1, 0x03, 0x07, 0xe8), |
Bengt Jonsson | 79568b94 | 2011-03-11 11:54:46 +0100 | [diff] [blame] | 1841 | /* |
| 1842 | * 0x10, VextSupply1SysClkReq1HPValid |
| 1843 | * 0x20, VextSupply2SysClkReq1HPValid |
| 1844 | * 0x40, VextSupply3SysClkReq1HPValid |
| 1845 | */ |
Lee Jones | 43a5911 | 2013-03-21 15:59:15 +0000 | [diff] [blame] | 1846 | REG_INIT(AB8500_REGUSYSCLKREQ1HPVALID2, 0x03, 0x08, 0x70), |
Bengt Jonsson | 79568b94 | 2011-03-11 11:54:46 +0100 | [diff] [blame] | 1847 | /* |
| 1848 | * 0x08, VanaHwHPReq1Valid |
| 1849 | * 0x20, Vaux1HwHPReq1Valid |
| 1850 | * 0x40, Vaux2HwHPReq1Valid |
| 1851 | * 0x80, Vaux3HwHPReq1Valid |
| 1852 | */ |
Lee Jones | 43a5911 | 2013-03-21 15:59:15 +0000 | [diff] [blame] | 1853 | REG_INIT(AB8500_REGUHWHPREQ1VALID1, 0x03, 0x09, 0xe8), |
Bengt Jonsson | 79568b94 | 2011-03-11 11:54:46 +0100 | [diff] [blame] | 1854 | /* |
| 1855 | * 0x01, VextSupply1HwHPReq1Valid |
| 1856 | * 0x02, VextSupply2HwHPReq1Valid |
| 1857 | * 0x04, VextSupply3HwHPReq1Valid |
| 1858 | */ |
Lee Jones | 43a5911 | 2013-03-21 15:59:15 +0000 | [diff] [blame] | 1859 | REG_INIT(AB8500_REGUHWHPREQ1VALID2, 0x03, 0x0a, 0x07), |
Bengt Jonsson | 79568b94 | 2011-03-11 11:54:46 +0100 | [diff] [blame] | 1860 | /* |
| 1861 | * 0x08, VanaHwHPReq2Valid |
| 1862 | * 0x20, Vaux1HwHPReq2Valid |
| 1863 | * 0x40, Vaux2HwHPReq2Valid |
| 1864 | * 0x80, Vaux3HwHPReq2Valid |
| 1865 | */ |
Lee Jones | 43a5911 | 2013-03-21 15:59:15 +0000 | [diff] [blame] | 1866 | REG_INIT(AB8500_REGUHWHPREQ2VALID1, 0x03, 0x0b, 0xe8), |
Bengt Jonsson | 79568b94 | 2011-03-11 11:54:46 +0100 | [diff] [blame] | 1867 | /* |
| 1868 | * 0x01, VextSupply1HwHPReq2Valid |
| 1869 | * 0x02, VextSupply2HwHPReq2Valid |
| 1870 | * 0x04, VextSupply3HwHPReq2Valid |
| 1871 | */ |
Lee Jones | 43a5911 | 2013-03-21 15:59:15 +0000 | [diff] [blame] | 1872 | REG_INIT(AB8500_REGUHWHPREQ2VALID2, 0x03, 0x0c, 0x07), |
Bengt Jonsson | 79568b94 | 2011-03-11 11:54:46 +0100 | [diff] [blame] | 1873 | /* |
| 1874 | * 0x20, VanaSwHPReqValid |
| 1875 | * 0x80, Vaux1SwHPReqValid |
| 1876 | */ |
Lee Jones | 43a5911 | 2013-03-21 15:59:15 +0000 | [diff] [blame] | 1877 | REG_INIT(AB8500_REGUSWHPREQVALID1, 0x03, 0x0d, 0xa0), |
Bengt Jonsson | 79568b94 | 2011-03-11 11:54:46 +0100 | [diff] [blame] | 1878 | /* |
| 1879 | * 0x01, Vaux2SwHPReqValid |
| 1880 | * 0x02, Vaux3SwHPReqValid |
| 1881 | * 0x04, VextSupply1SwHPReqValid |
| 1882 | * 0x08, VextSupply2SwHPReqValid |
| 1883 | * 0x10, VextSupply3SwHPReqValid |
| 1884 | */ |
Lee Jones | 43a5911 | 2013-03-21 15:59:15 +0000 | [diff] [blame] | 1885 | REG_INIT(AB8500_REGUSWHPREQVALID2, 0x03, 0x0e, 0x1f), |
Bengt Jonsson | 79568b94 | 2011-03-11 11:54:46 +0100 | [diff] [blame] | 1886 | /* |
| 1887 | * 0x02, SysClkReq2Valid1 |
Lee Jones | 43a5911 | 2013-03-21 15:59:15 +0000 | [diff] [blame] | 1888 | * 0x04, SysClkReq3Valid1 |
| 1889 | * 0x08, SysClkReq4Valid1 |
| 1890 | * 0x10, SysClkReq5Valid1 |
| 1891 | * 0x20, SysClkReq6Valid1 |
| 1892 | * 0x40, SysClkReq7Valid1 |
Bengt Jonsson | 79568b94 | 2011-03-11 11:54:46 +0100 | [diff] [blame] | 1893 | * 0x80, SysClkReq8Valid1 |
| 1894 | */ |
| 1895 | REG_INIT(AB8500_REGUSYSCLKREQVALID1, 0x03, 0x0f, 0xfe), |
| 1896 | /* |
| 1897 | * 0x02, SysClkReq2Valid2 |
Lee Jones | 43a5911 | 2013-03-21 15:59:15 +0000 | [diff] [blame] | 1898 | * 0x04, SysClkReq3Valid2 |
| 1899 | * 0x08, SysClkReq4Valid2 |
| 1900 | * 0x10, SysClkReq5Valid2 |
| 1901 | * 0x20, SysClkReq6Valid2 |
| 1902 | * 0x40, SysClkReq7Valid2 |
Bengt Jonsson | 79568b94 | 2011-03-11 11:54:46 +0100 | [diff] [blame] | 1903 | * 0x80, SysClkReq8Valid2 |
| 1904 | */ |
| 1905 | REG_INIT(AB8500_REGUSYSCLKREQVALID2, 0x03, 0x10, 0xfe), |
| 1906 | /* |
| 1907 | * 0x02, VTVoutEna |
| 1908 | * 0x04, Vintcore12Ena |
| 1909 | * 0x38, Vintcore12Sel |
| 1910 | * 0x40, Vintcore12LP |
| 1911 | * 0x80, VTVoutLP |
| 1912 | */ |
| 1913 | REG_INIT(AB8500_REGUMISC1, 0x03, 0x80, 0xfe), |
| 1914 | /* |
| 1915 | * 0x02, VaudioEna |
| 1916 | * 0x04, VdmicEna |
| 1917 | * 0x08, Vamic1Ena |
| 1918 | * 0x10, Vamic2Ena |
| 1919 | */ |
| 1920 | REG_INIT(AB8500_VAUDIOSUPPLY, 0x03, 0x83, 0x1e), |
| 1921 | /* |
| 1922 | * 0x01, Vamic1_dzout |
| 1923 | * 0x02, Vamic2_dzout |
| 1924 | */ |
| 1925 | REG_INIT(AB8500_REGUCTRL1VAMIC, 0x03, 0x84, 0x03), |
| 1926 | /* |
Lee Jones | 43a5911 | 2013-03-21 15:59:15 +0000 | [diff] [blame] | 1927 | * 0x03, VpllRegu (NOTE! PRCMU register bits) |
Lee Jones | 33bc8f4 | 2013-03-21 15:59:02 +0000 | [diff] [blame] | 1928 | * 0x0c, VanaRegu |
Bengt Jonsson | 79568b94 | 2011-03-11 11:54:46 +0100 | [diff] [blame] | 1929 | */ |
| 1930 | REG_INIT(AB8500_VPLLVANAREGU, 0x04, 0x06, 0x0f), |
| 1931 | /* |
| 1932 | * 0x01, VrefDDREna |
| 1933 | * 0x02, VrefDDRSleepMode |
| 1934 | */ |
| 1935 | REG_INIT(AB8500_VREFDDR, 0x04, 0x07, 0x03), |
| 1936 | /* |
| 1937 | * 0x03, VextSupply1Regu |
| 1938 | * 0x0c, VextSupply2Regu |
| 1939 | * 0x30, VextSupply3Regu |
| 1940 | * 0x40, ExtSupply2Bypass |
| 1941 | * 0x80, ExtSupply3Bypass |
| 1942 | */ |
| 1943 | REG_INIT(AB8500_EXTSUPPLYREGU, 0x04, 0x08, 0xff), |
| 1944 | /* |
| 1945 | * 0x03, Vaux1Regu |
| 1946 | * 0x0c, Vaux2Regu |
| 1947 | */ |
| 1948 | REG_INIT(AB8500_VAUX12REGU, 0x04, 0x09, 0x0f), |
| 1949 | /* |
| 1950 | * 0x03, Vaux3Regu |
| 1951 | */ |
Lee Jones | 43a5911 | 2013-03-21 15:59:15 +0000 | [diff] [blame] | 1952 | REG_INIT(AB8500_VRF1VAUX3REGU, 0x04, 0x0a, 0x03), |
Bengt Jonsson | 79568b94 | 2011-03-11 11:54:46 +0100 | [diff] [blame] | 1953 | /* |
| 1954 | * 0x0f, Vaux1Sel |
| 1955 | */ |
| 1956 | REG_INIT(AB8500_VAUX1SEL, 0x04, 0x1f, 0x0f), |
| 1957 | /* |
| 1958 | * 0x0f, Vaux2Sel |
| 1959 | */ |
| 1960 | REG_INIT(AB8500_VAUX2SEL, 0x04, 0x20, 0x0f), |
| 1961 | /* |
| 1962 | * 0x07, Vaux3Sel |
| 1963 | */ |
Lee Jones | 43a5911 | 2013-03-21 15:59:15 +0000 | [diff] [blame] | 1964 | REG_INIT(AB8500_VRF1VAUX3SEL, 0x04, 0x21, 0x07), |
Bengt Jonsson | 79568b94 | 2011-03-11 11:54:46 +0100 | [diff] [blame] | 1965 | /* |
| 1966 | * 0x01, VextSupply12LP |
| 1967 | */ |
| 1968 | REG_INIT(AB8500_REGUCTRL2SPARE, 0x04, 0x22, 0x01), |
| 1969 | /* |
| 1970 | * 0x04, Vaux1Disch |
| 1971 | * 0x08, Vaux2Disch |
| 1972 | * 0x10, Vaux3Disch |
| 1973 | * 0x20, Vintcore12Disch |
| 1974 | * 0x40, VTVoutDisch |
| 1975 | * 0x80, VaudioDisch |
| 1976 | */ |
Lee Jones | 43a5911 | 2013-03-21 15:59:15 +0000 | [diff] [blame] | 1977 | REG_INIT(AB8500_REGUCTRLDISCH, 0x04, 0x43, 0xfc), |
Bengt Jonsson | 79568b94 | 2011-03-11 11:54:46 +0100 | [diff] [blame] | 1978 | /* |
| 1979 | * 0x02, VanaDisch |
| 1980 | * 0x04, VdmicPullDownEna |
| 1981 | * 0x10, VdmicDisch |
| 1982 | */ |
Lee Jones | 43a5911 | 2013-03-21 15:59:15 +0000 | [diff] [blame] | 1983 | REG_INIT(AB8500_REGUCTRLDISCH2, 0x04, 0x44, 0x16), |
Bengt Jonsson | 79568b94 | 2011-03-11 11:54:46 +0100 | [diff] [blame] | 1984 | }; |
| 1985 | |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 1986 | /* AB8505 register init */ |
| 1987 | static struct ab8500_reg_init ab8505_reg_init[] = { |
| 1988 | /* |
| 1989 | * 0x03, VarmRequestCtrl |
| 1990 | * 0x0c, VsmpsCRequestCtrl |
| 1991 | * 0x30, VsmpsARequestCtrl |
| 1992 | * 0xc0, VsmpsBRequestCtrl |
| 1993 | */ |
| 1994 | REG_INIT(AB8505_REGUREQUESTCTRL1, 0x03, 0x03, 0xff), |
| 1995 | /* |
| 1996 | * 0x03, VsafeRequestCtrl |
| 1997 | * 0x0c, VpllRequestCtrl |
| 1998 | * 0x30, VanaRequestCtrl |
| 1999 | */ |
| 2000 | REG_INIT(AB8505_REGUREQUESTCTRL2, 0x03, 0x04, 0x3f), |
| 2001 | /* |
| 2002 | * 0x30, Vaux1RequestCtrl |
| 2003 | * 0xc0, Vaux2RequestCtrl |
| 2004 | */ |
| 2005 | REG_INIT(AB8505_REGUREQUESTCTRL3, 0x03, 0x05, 0xf0), |
| 2006 | /* |
| 2007 | * 0x03, Vaux3RequestCtrl |
| 2008 | * 0x04, SwHPReq |
| 2009 | */ |
| 2010 | REG_INIT(AB8505_REGUREQUESTCTRL4, 0x03, 0x06, 0x07), |
| 2011 | /* |
| 2012 | * 0x01, VsmpsASysClkReq1HPValid |
| 2013 | * 0x02, VsmpsBSysClkReq1HPValid |
| 2014 | * 0x04, VsafeSysClkReq1HPValid |
| 2015 | * 0x08, VanaSysClkReq1HPValid |
| 2016 | * 0x10, VpllSysClkReq1HPValid |
| 2017 | * 0x20, Vaux1SysClkReq1HPValid |
| 2018 | * 0x40, Vaux2SysClkReq1HPValid |
| 2019 | * 0x80, Vaux3SysClkReq1HPValid |
| 2020 | */ |
| 2021 | REG_INIT(AB8505_REGUSYSCLKREQ1HPVALID1, 0x03, 0x07, 0xff), |
| 2022 | /* |
| 2023 | * 0x01, VsmpsCSysClkReq1HPValid |
| 2024 | * 0x02, VarmSysClkReq1HPValid |
| 2025 | * 0x04, VbbSysClkReq1HPValid |
| 2026 | * 0x08, VsmpsMSysClkReq1HPValid |
| 2027 | */ |
| 2028 | REG_INIT(AB8505_REGUSYSCLKREQ1HPVALID2, 0x03, 0x08, 0x0f), |
| 2029 | /* |
| 2030 | * 0x01, VsmpsAHwHPReq1Valid |
| 2031 | * 0x02, VsmpsBHwHPReq1Valid |
| 2032 | * 0x04, VsafeHwHPReq1Valid |
| 2033 | * 0x08, VanaHwHPReq1Valid |
| 2034 | * 0x10, VpllHwHPReq1Valid |
| 2035 | * 0x20, Vaux1HwHPReq1Valid |
| 2036 | * 0x40, Vaux2HwHPReq1Valid |
| 2037 | * 0x80, Vaux3HwHPReq1Valid |
| 2038 | */ |
| 2039 | REG_INIT(AB8505_REGUHWHPREQ1VALID1, 0x03, 0x09, 0xff), |
| 2040 | /* |
| 2041 | * 0x08, VsmpsMHwHPReq1Valid |
| 2042 | */ |
| 2043 | REG_INIT(AB8505_REGUHWHPREQ1VALID2, 0x03, 0x0a, 0x08), |
| 2044 | /* |
| 2045 | * 0x01, VsmpsAHwHPReq2Valid |
| 2046 | * 0x02, VsmpsBHwHPReq2Valid |
| 2047 | * 0x04, VsafeHwHPReq2Valid |
| 2048 | * 0x08, VanaHwHPReq2Valid |
| 2049 | * 0x10, VpllHwHPReq2Valid |
| 2050 | * 0x20, Vaux1HwHPReq2Valid |
| 2051 | * 0x40, Vaux2HwHPReq2Valid |
| 2052 | * 0x80, Vaux3HwHPReq2Valid |
| 2053 | */ |
| 2054 | REG_INIT(AB8505_REGUHWHPREQ2VALID1, 0x03, 0x0b, 0xff), |
| 2055 | /* |
| 2056 | * 0x08, VsmpsMHwHPReq2Valid |
| 2057 | */ |
| 2058 | REG_INIT(AB8505_REGUHWHPREQ2VALID2, 0x03, 0x0c, 0x08), |
| 2059 | /* |
| 2060 | * 0x01, VsmpsCSwHPReqValid |
| 2061 | * 0x02, VarmSwHPReqValid |
| 2062 | * 0x04, VsmpsASwHPReqValid |
| 2063 | * 0x08, VsmpsBSwHPReqValid |
| 2064 | * 0x10, VsafeSwHPReqValid |
| 2065 | * 0x20, VanaSwHPReqValid |
| 2066 | * 0x40, VpllSwHPReqValid |
| 2067 | * 0x80, Vaux1SwHPReqValid |
| 2068 | */ |
| 2069 | REG_INIT(AB8505_REGUSWHPREQVALID1, 0x03, 0x0d, 0xff), |
| 2070 | /* |
| 2071 | * 0x01, Vaux2SwHPReqValid |
| 2072 | * 0x02, Vaux3SwHPReqValid |
| 2073 | * 0x20, VsmpsMSwHPReqValid |
| 2074 | */ |
| 2075 | REG_INIT(AB8505_REGUSWHPREQVALID2, 0x03, 0x0e, 0x23), |
| 2076 | /* |
| 2077 | * 0x02, SysClkReq2Valid1 |
| 2078 | * 0x04, SysClkReq3Valid1 |
| 2079 | * 0x08, SysClkReq4Valid1 |
| 2080 | */ |
| 2081 | REG_INIT(AB8505_REGUSYSCLKREQVALID1, 0x03, 0x0f, 0x0e), |
| 2082 | /* |
| 2083 | * 0x02, SysClkReq2Valid2 |
| 2084 | * 0x04, SysClkReq3Valid2 |
| 2085 | * 0x08, SysClkReq4Valid2 |
| 2086 | */ |
| 2087 | REG_INIT(AB8505_REGUSYSCLKREQVALID2, 0x03, 0x10, 0x0e), |
| 2088 | /* |
| 2089 | * 0x01, Vaux4SwHPReqValid |
| 2090 | * 0x02, Vaux4HwHPReq2Valid |
| 2091 | * 0x04, Vaux4HwHPReq1Valid |
| 2092 | * 0x08, Vaux4SysClkReq1HPValid |
| 2093 | */ |
| 2094 | REG_INIT(AB8505_REGUVAUX4REQVALID, 0x03, 0x11, 0x0f), |
| 2095 | /* |
| 2096 | * 0x02, VadcEna |
| 2097 | * 0x04, VintCore12Ena |
| 2098 | * 0x38, VintCore12Sel |
| 2099 | * 0x40, VintCore12LP |
| 2100 | * 0x80, VadcLP |
| 2101 | */ |
| 2102 | REG_INIT(AB8505_REGUMISC1, 0x03, 0x80, 0xfe), |
| 2103 | /* |
| 2104 | * 0x02, VaudioEna |
| 2105 | * 0x04, VdmicEna |
| 2106 | * 0x08, Vamic1Ena |
| 2107 | * 0x10, Vamic2Ena |
| 2108 | */ |
| 2109 | REG_INIT(AB8505_VAUDIOSUPPLY, 0x03, 0x83, 0x1e), |
| 2110 | /* |
| 2111 | * 0x01, Vamic1_dzout |
| 2112 | * 0x02, Vamic2_dzout |
| 2113 | */ |
| 2114 | REG_INIT(AB8505_REGUCTRL1VAMIC, 0x03, 0x84, 0x03), |
| 2115 | /* |
| 2116 | * 0x03, VsmpsARegu |
| 2117 | * 0x0c, VsmpsASelCtrl |
| 2118 | * 0x10, VsmpsAAutoMode |
| 2119 | * 0x20, VsmpsAPWMMode |
| 2120 | */ |
| 2121 | REG_INIT(AB8505_VSMPSAREGU, 0x04, 0x03, 0x3f), |
| 2122 | /* |
| 2123 | * 0x03, VsmpsBRegu |
| 2124 | * 0x0c, VsmpsBSelCtrl |
| 2125 | * 0x10, VsmpsBAutoMode |
| 2126 | * 0x20, VsmpsBPWMMode |
| 2127 | */ |
| 2128 | REG_INIT(AB8505_VSMPSBREGU, 0x04, 0x04, 0x3f), |
| 2129 | /* |
| 2130 | * 0x03, VsafeRegu |
| 2131 | * 0x0c, VsafeSelCtrl |
| 2132 | * 0x10, VsafeAutoMode |
| 2133 | * 0x20, VsafePWMMode |
| 2134 | */ |
| 2135 | REG_INIT(AB8505_VSAFEREGU, 0x04, 0x05, 0x3f), |
| 2136 | /* |
| 2137 | * 0x03, VpllRegu (NOTE! PRCMU register bits) |
| 2138 | * 0x0c, VanaRegu |
| 2139 | */ |
| 2140 | REG_INIT(AB8505_VPLLVANAREGU, 0x04, 0x06, 0x0f), |
| 2141 | /* |
| 2142 | * 0x03, VextSupply1Regu |
| 2143 | * 0x0c, VextSupply2Regu |
| 2144 | * 0x30, VextSupply3Regu |
| 2145 | * 0x40, ExtSupply2Bypass |
| 2146 | * 0x80, ExtSupply3Bypass |
| 2147 | */ |
| 2148 | REG_INIT(AB8505_EXTSUPPLYREGU, 0x04, 0x08, 0xff), |
| 2149 | /* |
| 2150 | * 0x03, Vaux1Regu |
| 2151 | * 0x0c, Vaux2Regu |
| 2152 | */ |
| 2153 | REG_INIT(AB8505_VAUX12REGU, 0x04, 0x09, 0x0f), |
| 2154 | /* |
| 2155 | * 0x0f, Vaux3Regu |
| 2156 | */ |
| 2157 | REG_INIT(AB8505_VRF1VAUX3REGU, 0x04, 0x0a, 0x0f), |
| 2158 | /* |
| 2159 | * 0x3f, VsmpsASel1 |
| 2160 | */ |
| 2161 | REG_INIT(AB8505_VSMPSASEL1, 0x04, 0x13, 0x3f), |
| 2162 | /* |
| 2163 | * 0x3f, VsmpsASel2 |
| 2164 | */ |
| 2165 | REG_INIT(AB8505_VSMPSASEL2, 0x04, 0x14, 0x3f), |
| 2166 | /* |
| 2167 | * 0x3f, VsmpsASel3 |
| 2168 | */ |
| 2169 | REG_INIT(AB8505_VSMPSASEL3, 0x04, 0x15, 0x3f), |
| 2170 | /* |
| 2171 | * 0x3f, VsmpsBSel1 |
| 2172 | */ |
| 2173 | REG_INIT(AB8505_VSMPSBSEL1, 0x04, 0x17, 0x3f), |
| 2174 | /* |
| 2175 | * 0x3f, VsmpsBSel2 |
| 2176 | */ |
| 2177 | REG_INIT(AB8505_VSMPSBSEL2, 0x04, 0x18, 0x3f), |
| 2178 | /* |
| 2179 | * 0x3f, VsmpsBSel3 |
| 2180 | */ |
| 2181 | REG_INIT(AB8505_VSMPSBSEL3, 0x04, 0x19, 0x3f), |
| 2182 | /* |
| 2183 | * 0x7f, VsafeSel1 |
| 2184 | */ |
| 2185 | REG_INIT(AB8505_VSAFESEL1, 0x04, 0x1b, 0x7f), |
| 2186 | /* |
| 2187 | * 0x3f, VsafeSel2 |
| 2188 | */ |
| 2189 | REG_INIT(AB8505_VSAFESEL2, 0x04, 0x1c, 0x7f), |
| 2190 | /* |
| 2191 | * 0x3f, VsafeSel3 |
| 2192 | */ |
| 2193 | REG_INIT(AB8505_VSAFESEL3, 0x04, 0x1d, 0x7f), |
| 2194 | /* |
| 2195 | * 0x0f, Vaux1Sel |
| 2196 | */ |
| 2197 | REG_INIT(AB8505_VAUX1SEL, 0x04, 0x1f, 0x0f), |
| 2198 | /* |
| 2199 | * 0x0f, Vaux2Sel |
| 2200 | */ |
| 2201 | REG_INIT(AB8505_VAUX2SEL, 0x04, 0x20, 0x0f), |
| 2202 | /* |
| 2203 | * 0x07, Vaux3Sel |
| 2204 | * 0x30, VRF1Sel |
| 2205 | */ |
| 2206 | REG_INIT(AB8505_VRF1VAUX3SEL, 0x04, 0x21, 0x37), |
| 2207 | /* |
| 2208 | * 0x03, Vaux4RequestCtrl |
| 2209 | */ |
| 2210 | REG_INIT(AB8505_VAUX4REQCTRL, 0x04, 0x2d, 0x03), |
| 2211 | /* |
| 2212 | * 0x03, Vaux4Regu |
| 2213 | */ |
| 2214 | REG_INIT(AB8505_VAUX4REGU, 0x04, 0x2e, 0x03), |
| 2215 | /* |
| 2216 | * 0x0f, Vaux4Sel |
| 2217 | */ |
| 2218 | REG_INIT(AB8505_VAUX4SEL, 0x04, 0x2f, 0x0f), |
| 2219 | /* |
| 2220 | * 0x04, Vaux1Disch |
| 2221 | * 0x08, Vaux2Disch |
| 2222 | * 0x10, Vaux3Disch |
| 2223 | * 0x20, Vintcore12Disch |
| 2224 | * 0x40, VTVoutDisch |
| 2225 | * 0x80, VaudioDisch |
| 2226 | */ |
| 2227 | REG_INIT(AB8505_REGUCTRLDISCH, 0x04, 0x43, 0xfc), |
| 2228 | /* |
| 2229 | * 0x02, VanaDisch |
| 2230 | * 0x04, VdmicPullDownEna |
| 2231 | * 0x10, VdmicDisch |
| 2232 | */ |
| 2233 | REG_INIT(AB8505_REGUCTRLDISCH2, 0x04, 0x44, 0x16), |
| 2234 | /* |
| 2235 | * 0x01, Vaux4Disch |
| 2236 | */ |
| 2237 | REG_INIT(AB8505_REGUCTRLDISCH3, 0x04, 0x48, 0x01), |
| 2238 | /* |
| 2239 | * 0x07, Vaux5Sel |
| 2240 | * 0x08, Vaux5LP |
| 2241 | * 0x10, Vaux5Ena |
| 2242 | * 0x20, Vaux5Disch |
| 2243 | * 0x40, Vaux5DisSfst |
| 2244 | * 0x80, Vaux5DisPulld |
| 2245 | */ |
| 2246 | REG_INIT(AB8505_CTRLVAUX5, 0x01, 0x55, 0xff), |
| 2247 | /* |
| 2248 | * 0x07, Vaux6Sel |
| 2249 | * 0x08, Vaux6LP |
| 2250 | * 0x10, Vaux6Ena |
| 2251 | * 0x80, Vaux6DisPulld |
| 2252 | */ |
| 2253 | REG_INIT(AB8505_CTRLVAUX6, 0x01, 0x56, 0x9f), |
| 2254 | }; |
| 2255 | |
Lee Jones | 8e6a8d7 | 2013-03-28 16:11:11 +0000 | [diff] [blame] | 2256 | /* AB9540 register init */ |
| 2257 | static struct ab8500_reg_init ab9540_reg_init[] = { |
| 2258 | /* |
| 2259 | * 0x03, VarmRequestCtrl |
| 2260 | * 0x0c, VapeRequestCtrl |
| 2261 | * 0x30, Vsmps1RequestCtrl |
| 2262 | * 0xc0, Vsmps2RequestCtrl |
| 2263 | */ |
| 2264 | REG_INIT(AB9540_REGUREQUESTCTRL1, 0x03, 0x03, 0xff), |
| 2265 | /* |
| 2266 | * 0x03, Vsmps3RequestCtrl |
| 2267 | * 0x0c, VpllRequestCtrl |
| 2268 | * 0x30, VanaRequestCtrl |
| 2269 | * 0xc0, VextSupply1RequestCtrl |
| 2270 | */ |
| 2271 | REG_INIT(AB9540_REGUREQUESTCTRL2, 0x03, 0x04, 0xff), |
| 2272 | /* |
| 2273 | * 0x03, VextSupply2RequestCtrl |
| 2274 | * 0x0c, VextSupply3RequestCtrl |
| 2275 | * 0x30, Vaux1RequestCtrl |
| 2276 | * 0xc0, Vaux2RequestCtrl |
| 2277 | */ |
| 2278 | REG_INIT(AB9540_REGUREQUESTCTRL3, 0x03, 0x05, 0xff), |
| 2279 | /* |
| 2280 | * 0x03, Vaux3RequestCtrl |
| 2281 | * 0x04, SwHPReq |
| 2282 | */ |
| 2283 | REG_INIT(AB9540_REGUREQUESTCTRL4, 0x03, 0x06, 0x07), |
| 2284 | /* |
| 2285 | * 0x01, Vsmps1SysClkReq1HPValid |
| 2286 | * 0x02, Vsmps2SysClkReq1HPValid |
| 2287 | * 0x04, Vsmps3SysClkReq1HPValid |
| 2288 | * 0x08, VanaSysClkReq1HPValid |
| 2289 | * 0x10, VpllSysClkReq1HPValid |
| 2290 | * 0x20, Vaux1SysClkReq1HPValid |
| 2291 | * 0x40, Vaux2SysClkReq1HPValid |
| 2292 | * 0x80, Vaux3SysClkReq1HPValid |
| 2293 | */ |
| 2294 | REG_INIT(AB9540_REGUSYSCLKREQ1HPVALID1, 0x03, 0x07, 0xff), |
| 2295 | /* |
| 2296 | * 0x01, VapeSysClkReq1HPValid |
| 2297 | * 0x02, VarmSysClkReq1HPValid |
| 2298 | * 0x04, VbbSysClkReq1HPValid |
| 2299 | * 0x08, VmodSysClkReq1HPValid |
| 2300 | * 0x10, VextSupply1SysClkReq1HPValid |
| 2301 | * 0x20, VextSupply2SysClkReq1HPValid |
| 2302 | * 0x40, VextSupply3SysClkReq1HPValid |
| 2303 | */ |
| 2304 | REG_INIT(AB9540_REGUSYSCLKREQ1HPVALID2, 0x03, 0x08, 0x7f), |
| 2305 | /* |
| 2306 | * 0x01, Vsmps1HwHPReq1Valid |
| 2307 | * 0x02, Vsmps2HwHPReq1Valid |
| 2308 | * 0x04, Vsmps3HwHPReq1Valid |
| 2309 | * 0x08, VanaHwHPReq1Valid |
| 2310 | * 0x10, VpllHwHPReq1Valid |
| 2311 | * 0x20, Vaux1HwHPReq1Valid |
| 2312 | * 0x40, Vaux2HwHPReq1Valid |
| 2313 | * 0x80, Vaux3HwHPReq1Valid |
| 2314 | */ |
| 2315 | REG_INIT(AB9540_REGUHWHPREQ1VALID1, 0x03, 0x09, 0xff), |
| 2316 | /* |
| 2317 | * 0x01, VextSupply1HwHPReq1Valid |
| 2318 | * 0x02, VextSupply2HwHPReq1Valid |
| 2319 | * 0x04, VextSupply3HwHPReq1Valid |
| 2320 | * 0x08, VmodHwHPReq1Valid |
| 2321 | */ |
| 2322 | REG_INIT(AB9540_REGUHWHPREQ1VALID2, 0x03, 0x0a, 0x0f), |
| 2323 | /* |
| 2324 | * 0x01, Vsmps1HwHPReq2Valid |
| 2325 | * 0x02, Vsmps2HwHPReq2Valid |
| 2326 | * 0x03, Vsmps3HwHPReq2Valid |
| 2327 | * 0x08, VanaHwHPReq2Valid |
| 2328 | * 0x10, VpllHwHPReq2Valid |
| 2329 | * 0x20, Vaux1HwHPReq2Valid |
| 2330 | * 0x40, Vaux2HwHPReq2Valid |
| 2331 | * 0x80, Vaux3HwHPReq2Valid |
| 2332 | */ |
| 2333 | REG_INIT(AB9540_REGUHWHPREQ2VALID1, 0x03, 0x0b, 0xff), |
| 2334 | /* |
| 2335 | * 0x01, VextSupply1HwHPReq2Valid |
| 2336 | * 0x02, VextSupply2HwHPReq2Valid |
| 2337 | * 0x04, VextSupply3HwHPReq2Valid |
| 2338 | * 0x08, VmodHwHPReq2Valid |
| 2339 | */ |
| 2340 | REG_INIT(AB9540_REGUHWHPREQ2VALID2, 0x03, 0x0c, 0x0f), |
| 2341 | /* |
| 2342 | * 0x01, VapeSwHPReqValid |
| 2343 | * 0x02, VarmSwHPReqValid |
| 2344 | * 0x04, Vsmps1SwHPReqValid |
| 2345 | * 0x08, Vsmps2SwHPReqValid |
| 2346 | * 0x10, Vsmps3SwHPReqValid |
| 2347 | * 0x20, VanaSwHPReqValid |
| 2348 | * 0x40, VpllSwHPReqValid |
| 2349 | * 0x80, Vaux1SwHPReqValid |
| 2350 | */ |
| 2351 | REG_INIT(AB9540_REGUSWHPREQVALID1, 0x03, 0x0d, 0xff), |
| 2352 | /* |
| 2353 | * 0x01, Vaux2SwHPReqValid |
| 2354 | * 0x02, Vaux3SwHPReqValid |
| 2355 | * 0x04, VextSupply1SwHPReqValid |
| 2356 | * 0x08, VextSupply2SwHPReqValid |
| 2357 | * 0x10, VextSupply3SwHPReqValid |
| 2358 | * 0x20, VmodSwHPReqValid |
| 2359 | */ |
| 2360 | REG_INIT(AB9540_REGUSWHPREQVALID2, 0x03, 0x0e, 0x3f), |
| 2361 | /* |
| 2362 | * 0x02, SysClkReq2Valid1 |
| 2363 | * ... |
| 2364 | * 0x80, SysClkReq8Valid1 |
| 2365 | */ |
| 2366 | REG_INIT(AB9540_REGUSYSCLKREQVALID1, 0x03, 0x0f, 0xfe), |
| 2367 | /* |
| 2368 | * 0x02, SysClkReq2Valid2 |
| 2369 | * ... |
| 2370 | * 0x80, SysClkReq8Valid2 |
| 2371 | */ |
| 2372 | REG_INIT(AB9540_REGUSYSCLKREQVALID2, 0x03, 0x10, 0xfe), |
| 2373 | /* |
| 2374 | * 0x01, Vaux4SwHPReqValid |
| 2375 | * 0x02, Vaux4HwHPReq2Valid |
| 2376 | * 0x04, Vaux4HwHPReq1Valid |
| 2377 | * 0x08, Vaux4SysClkReq1HPValid |
| 2378 | */ |
| 2379 | REG_INIT(AB9540_REGUVAUX4REQVALID, 0x03, 0x11, 0x0f), |
| 2380 | /* |
| 2381 | * 0x02, VTVoutEna |
| 2382 | * 0x04, Vintcore12Ena |
| 2383 | * 0x38, Vintcore12Sel |
| 2384 | * 0x40, Vintcore12LP |
| 2385 | * 0x80, VTVoutLP |
| 2386 | */ |
| 2387 | REG_INIT(AB9540_REGUMISC1, 0x03, 0x80, 0xfe), |
| 2388 | /* |
| 2389 | * 0x02, VaudioEna |
| 2390 | * 0x04, VdmicEna |
| 2391 | * 0x08, Vamic1Ena |
| 2392 | * 0x10, Vamic2Ena |
| 2393 | */ |
| 2394 | REG_INIT(AB9540_VAUDIOSUPPLY, 0x03, 0x83, 0x1e), |
| 2395 | /* |
| 2396 | * 0x01, Vamic1_dzout |
| 2397 | * 0x02, Vamic2_dzout |
| 2398 | */ |
| 2399 | REG_INIT(AB9540_REGUCTRL1VAMIC, 0x03, 0x84, 0x03), |
| 2400 | /* |
| 2401 | * 0x03, Vsmps1Regu |
| 2402 | * 0x0c, Vsmps1SelCtrl |
| 2403 | * 0x10, Vsmps1AutoMode |
| 2404 | * 0x20, Vsmps1PWMMode |
| 2405 | */ |
| 2406 | REG_INIT(AB9540_VSMPS1REGU, 0x04, 0x03, 0x3f), |
| 2407 | /* |
| 2408 | * 0x03, Vsmps2Regu |
| 2409 | * 0x0c, Vsmps2SelCtrl |
| 2410 | * 0x10, Vsmps2AutoMode |
| 2411 | * 0x20, Vsmps2PWMMode |
| 2412 | */ |
| 2413 | REG_INIT(AB9540_VSMPS2REGU, 0x04, 0x04, 0x3f), |
| 2414 | /* |
| 2415 | * 0x03, Vsmps3Regu |
| 2416 | * 0x0c, Vsmps3SelCtrl |
| 2417 | * NOTE! PRCMU register |
| 2418 | */ |
| 2419 | REG_INIT(AB9540_VSMPS3REGU, 0x04, 0x05, 0x0f), |
| 2420 | /* |
| 2421 | * 0x03, VpllRegu |
| 2422 | * 0x0c, VanaRegu |
| 2423 | */ |
| 2424 | REG_INIT(AB9540_VPLLVANAREGU, 0x04, 0x06, 0x0f), |
| 2425 | /* |
| 2426 | * 0x03, VextSupply1Regu |
| 2427 | * 0x0c, VextSupply2Regu |
| 2428 | * 0x30, VextSupply3Regu |
| 2429 | * 0x40, ExtSupply2Bypass |
| 2430 | * 0x80, ExtSupply3Bypass |
| 2431 | */ |
| 2432 | REG_INIT(AB9540_EXTSUPPLYREGU, 0x04, 0x08, 0xff), |
| 2433 | /* |
| 2434 | * 0x03, Vaux1Regu |
| 2435 | * 0x0c, Vaux2Regu |
| 2436 | */ |
| 2437 | REG_INIT(AB9540_VAUX12REGU, 0x04, 0x09, 0x0f), |
| 2438 | /* |
| 2439 | * 0x0c, Vrf1Regu |
| 2440 | * 0x03, Vaux3Regu |
| 2441 | */ |
| 2442 | REG_INIT(AB9540_VRF1VAUX3REGU, 0x04, 0x0a, 0x0f), |
| 2443 | /* |
| 2444 | * 0x3f, Vsmps1Sel1 |
| 2445 | */ |
| 2446 | REG_INIT(AB9540_VSMPS1SEL1, 0x04, 0x13, 0x3f), |
| 2447 | /* |
| 2448 | * 0x3f, Vsmps1Sel2 |
| 2449 | */ |
| 2450 | REG_INIT(AB9540_VSMPS1SEL2, 0x04, 0x14, 0x3f), |
| 2451 | /* |
| 2452 | * 0x3f, Vsmps1Sel3 |
| 2453 | */ |
| 2454 | REG_INIT(AB9540_VSMPS1SEL3, 0x04, 0x15, 0x3f), |
| 2455 | /* |
| 2456 | * 0x3f, Vsmps2Sel1 |
| 2457 | */ |
| 2458 | REG_INIT(AB9540_VSMPS2SEL1, 0x04, 0x17, 0x3f), |
| 2459 | /* |
| 2460 | * 0x3f, Vsmps2Sel2 |
| 2461 | */ |
| 2462 | REG_INIT(AB9540_VSMPS2SEL2, 0x04, 0x18, 0x3f), |
| 2463 | /* |
| 2464 | * 0x3f, Vsmps2Sel3 |
| 2465 | */ |
| 2466 | REG_INIT(AB9540_VSMPS2SEL3, 0x04, 0x19, 0x3f), |
| 2467 | /* |
| 2468 | * 0x7f, Vsmps3Sel1 |
| 2469 | * NOTE! PRCMU register |
| 2470 | */ |
| 2471 | REG_INIT(AB9540_VSMPS3SEL1, 0x04, 0x1b, 0x7f), |
| 2472 | /* |
| 2473 | * 0x7f, Vsmps3Sel2 |
| 2474 | * NOTE! PRCMU register |
| 2475 | */ |
| 2476 | REG_INIT(AB9540_VSMPS3SEL2, 0x04, 0x1c, 0x7f), |
| 2477 | /* |
| 2478 | * 0x0f, Vaux1Sel |
| 2479 | */ |
| 2480 | REG_INIT(AB9540_VAUX1SEL, 0x04, 0x1f, 0x0f), |
| 2481 | /* |
| 2482 | * 0x0f, Vaux2Sel |
| 2483 | */ |
| 2484 | REG_INIT(AB9540_VAUX2SEL, 0x04, 0x20, 0x0f), |
| 2485 | /* |
| 2486 | * 0x07, Vaux3Sel |
| 2487 | * 0x30, Vrf1Sel |
| 2488 | */ |
| 2489 | REG_INIT(AB9540_VRF1VAUX3SEL, 0x04, 0x21, 0x37), |
| 2490 | /* |
| 2491 | * 0x01, VextSupply12LP |
| 2492 | */ |
| 2493 | REG_INIT(AB9540_REGUCTRL2SPARE, 0x04, 0x22, 0x01), |
| 2494 | /* |
| 2495 | * 0x03, Vaux4RequestCtrl |
| 2496 | */ |
| 2497 | REG_INIT(AB9540_VAUX4REQCTRL, 0x04, 0x2d, 0x03), |
| 2498 | /* |
| 2499 | * 0x03, Vaux4Regu |
| 2500 | */ |
| 2501 | REG_INIT(AB9540_VAUX4REGU, 0x04, 0x2e, 0x03), |
| 2502 | /* |
| 2503 | * 0x08, Vaux4Sel |
| 2504 | */ |
| 2505 | REG_INIT(AB9540_VAUX4SEL, 0x04, 0x2f, 0x0f), |
| 2506 | /* |
| 2507 | * 0x01, VpllDisch |
| 2508 | * 0x02, Vrf1Disch |
| 2509 | * 0x04, Vaux1Disch |
| 2510 | * 0x08, Vaux2Disch |
| 2511 | * 0x10, Vaux3Disch |
| 2512 | * 0x20, Vintcore12Disch |
| 2513 | * 0x40, VTVoutDisch |
| 2514 | * 0x80, VaudioDisch |
| 2515 | */ |
| 2516 | REG_INIT(AB9540_REGUCTRLDISCH, 0x04, 0x43, 0xff), |
| 2517 | /* |
| 2518 | * 0x01, VsimDisch |
| 2519 | * 0x02, VanaDisch |
| 2520 | * 0x04, VdmicPullDownEna |
| 2521 | * 0x08, VpllPullDownEna |
| 2522 | * 0x10, VdmicDisch |
| 2523 | */ |
| 2524 | REG_INIT(AB9540_REGUCTRLDISCH2, 0x04, 0x44, 0x1f), |
| 2525 | /* |
| 2526 | * 0x01, Vaux4Disch |
| 2527 | */ |
| 2528 | REG_INIT(AB9540_REGUCTRLDISCH3, 0x04, 0x48, 0x01), |
| 2529 | }; |
| 2530 | |
Lee Jones | ae0a9a3 | 2013-03-28 16:11:16 +0000 | [diff] [blame] | 2531 | /* AB8540 register init */ |
| 2532 | static struct ab8500_reg_init ab8540_reg_init[] = { |
| 2533 | /* |
| 2534 | * 0x01, VSimSycClkReq1Valid |
| 2535 | * 0x02, VSimSycClkReq2Valid |
| 2536 | * 0x04, VSimSycClkReq3Valid |
| 2537 | * 0x08, VSimSycClkReq4Valid |
| 2538 | * 0x10, VSimSycClkReq5Valid |
| 2539 | * 0x20, VSimSycClkReq6Valid |
| 2540 | * 0x40, VSimSycClkReq7Valid |
| 2541 | * 0x80, VSimSycClkReq8Valid |
| 2542 | */ |
| 2543 | REG_INIT(AB8540_VSIMSYSCLKCTRL, 0x02, 0x33, 0xff), |
| 2544 | /* |
| 2545 | * 0x03, VarmRequestCtrl |
| 2546 | * 0x0c, VapeRequestCtrl |
| 2547 | * 0x30, Vsmps1RequestCtrl |
| 2548 | * 0xc0, Vsmps2RequestCtrl |
| 2549 | */ |
| 2550 | REG_INIT(AB8540_REGUREQUESTCTRL1, 0x03, 0x03, 0xff), |
| 2551 | /* |
| 2552 | * 0x03, Vsmps3RequestCtrl |
| 2553 | * 0x0c, VpllRequestCtrl |
| 2554 | * 0x30, VanaRequestCtrl |
| 2555 | * 0xc0, VextSupply1RequestCtrl |
| 2556 | */ |
| 2557 | REG_INIT(AB8540_REGUREQUESTCTRL2, 0x03, 0x04, 0xff), |
| 2558 | /* |
| 2559 | * 0x03, VextSupply2RequestCtrl |
| 2560 | * 0x0c, VextSupply3RequestCtrl |
| 2561 | * 0x30, Vaux1RequestCtrl |
| 2562 | * 0xc0, Vaux2RequestCtrl |
| 2563 | */ |
| 2564 | REG_INIT(AB8540_REGUREQUESTCTRL3, 0x03, 0x05, 0xff), |
| 2565 | /* |
| 2566 | * 0x03, Vaux3RequestCtrl |
| 2567 | * 0x04, SwHPReq |
| 2568 | */ |
| 2569 | REG_INIT(AB8540_REGUREQUESTCTRL4, 0x03, 0x06, 0x07), |
| 2570 | /* |
| 2571 | * 0x01, Vsmps1SysClkReq1HPValid |
| 2572 | * 0x02, Vsmps2SysClkReq1HPValid |
| 2573 | * 0x04, Vsmps3SysClkReq1HPValid |
| 2574 | * 0x08, VanaSysClkReq1HPValid |
| 2575 | * 0x10, VpllSysClkReq1HPValid |
| 2576 | * 0x20, Vaux1SysClkReq1HPValid |
| 2577 | * 0x40, Vaux2SysClkReq1HPValid |
| 2578 | * 0x80, Vaux3SysClkReq1HPValid |
| 2579 | */ |
| 2580 | REG_INIT(AB8540_REGUSYSCLKREQ1HPVALID1, 0x03, 0x07, 0xff), |
| 2581 | /* |
| 2582 | * 0x01, VapeSysClkReq1HPValid |
| 2583 | * 0x02, VarmSysClkReq1HPValid |
| 2584 | * 0x04, VbbSysClkReq1HPValid |
| 2585 | * 0x10, VextSupply1SysClkReq1HPValid |
| 2586 | * 0x20, VextSupply2SysClkReq1HPValid |
| 2587 | * 0x40, VextSupply3SysClkReq1HPValid |
| 2588 | */ |
| 2589 | REG_INIT(AB8540_REGUSYSCLKREQ1HPVALID2, 0x03, 0x08, 0x77), |
| 2590 | /* |
| 2591 | * 0x01, Vsmps1HwHPReq1Valid |
| 2592 | * 0x02, Vsmps2HwHPReq1Valid |
| 2593 | * 0x04, Vsmps3HwHPReq1Valid |
| 2594 | * 0x08, VanaHwHPReq1Valid |
| 2595 | * 0x10, VpllHwHPReq1Valid |
| 2596 | * 0x20, Vaux1HwHPReq1Valid |
| 2597 | * 0x40, Vaux2HwHPReq1Valid |
| 2598 | * 0x80, Vaux3HwHPReq1Valid |
| 2599 | */ |
| 2600 | REG_INIT(AB8540_REGUHWHPREQ1VALID1, 0x03, 0x09, 0xff), |
| 2601 | /* |
| 2602 | * 0x01, VextSupply1HwHPReq1Valid |
| 2603 | * 0x02, VextSupply2HwHPReq1Valid |
| 2604 | * 0x04, VextSupply3HwHPReq1Valid |
| 2605 | */ |
| 2606 | REG_INIT(AB8540_REGUHWHPREQ1VALID2, 0x03, 0x0a, 0x07), |
| 2607 | /* |
| 2608 | * 0x01, Vsmps1HwHPReq2Valid |
| 2609 | * 0x02, Vsmps2HwHPReq2Valid |
| 2610 | * 0x03, Vsmps3HwHPReq2Valid |
| 2611 | * 0x08, VanaHwHPReq2Valid |
| 2612 | * 0x10, VpllHwHPReq2Valid |
| 2613 | * 0x20, Vaux1HwHPReq2Valid |
| 2614 | * 0x40, Vaux2HwHPReq2Valid |
| 2615 | * 0x80, Vaux3HwHPReq2Valid |
| 2616 | */ |
| 2617 | REG_INIT(AB8540_REGUHWHPREQ2VALID1, 0x03, 0x0b, 0xff), |
| 2618 | /* |
| 2619 | * 0x01, VextSupply1HwHPReq2Valid |
| 2620 | * 0x02, VextSupply2HwHPReq2Valid |
| 2621 | * 0x04, VextSupply3HwHPReq2Valid |
| 2622 | */ |
| 2623 | REG_INIT(AB8540_REGUHWHPREQ2VALID2, 0x03, 0x0c, 0x07), |
| 2624 | /* |
| 2625 | * 0x01, VapeSwHPReqValid |
| 2626 | * 0x02, VarmSwHPReqValid |
| 2627 | * 0x04, Vsmps1SwHPReqValid |
| 2628 | * 0x08, Vsmps2SwHPReqValid |
| 2629 | * 0x10, Vsmps3SwHPReqValid |
| 2630 | * 0x20, VanaSwHPReqValid |
| 2631 | * 0x40, VpllSwHPReqValid |
| 2632 | * 0x80, Vaux1SwHPReqValid |
| 2633 | */ |
| 2634 | REG_INIT(AB8540_REGUSWHPREQVALID1, 0x03, 0x0d, 0xff), |
| 2635 | /* |
| 2636 | * 0x01, Vaux2SwHPReqValid |
| 2637 | * 0x02, Vaux3SwHPReqValid |
| 2638 | * 0x04, VextSupply1SwHPReqValid |
| 2639 | * 0x08, VextSupply2SwHPReqValid |
| 2640 | * 0x10, VextSupply3SwHPReqValid |
| 2641 | */ |
| 2642 | REG_INIT(AB8540_REGUSWHPREQVALID2, 0x03, 0x0e, 0x1f), |
| 2643 | /* |
| 2644 | * 0x02, SysClkReq2Valid1 |
| 2645 | * ... |
| 2646 | * 0x80, SysClkReq8Valid1 |
| 2647 | */ |
| 2648 | REG_INIT(AB8540_REGUSYSCLKREQVALID1, 0x03, 0x0f, 0xff), |
| 2649 | /* |
| 2650 | * 0x02, SysClkReq2Valid2 |
| 2651 | * ... |
| 2652 | * 0x80, SysClkReq8Valid2 |
| 2653 | */ |
| 2654 | REG_INIT(AB8540_REGUSYSCLKREQVALID2, 0x03, 0x10, 0xff), |
| 2655 | /* |
| 2656 | * 0x01, Vaux4SwHPReqValid |
| 2657 | * 0x02, Vaux4HwHPReq2Valid |
| 2658 | * 0x04, Vaux4HwHPReq1Valid |
| 2659 | * 0x08, Vaux4SysClkReq1HPValid |
| 2660 | */ |
| 2661 | REG_INIT(AB8540_REGUVAUX4REQVALID, 0x03, 0x11, 0x0f), |
| 2662 | /* |
| 2663 | * 0x01, Vaux5SwHPReqValid |
| 2664 | * 0x02, Vaux5HwHPReq2Valid |
| 2665 | * 0x04, Vaux5HwHPReq1Valid |
| 2666 | * 0x08, Vaux5SysClkReq1HPValid |
| 2667 | */ |
| 2668 | REG_INIT(AB8540_REGUVAUX5REQVALID, 0x03, 0x12, 0x0f), |
| 2669 | /* |
| 2670 | * 0x01, Vaux6SwHPReqValid |
| 2671 | * 0x02, Vaux6HwHPReq2Valid |
| 2672 | * 0x04, Vaux6HwHPReq1Valid |
| 2673 | * 0x08, Vaux6SysClkReq1HPValid |
| 2674 | */ |
| 2675 | REG_INIT(AB8540_REGUVAUX6REQVALID, 0x03, 0x13, 0x0f), |
| 2676 | /* |
| 2677 | * 0x01, VclkbSwHPReqValid |
| 2678 | * 0x02, VclkbHwHPReq2Valid |
| 2679 | * 0x04, VclkbHwHPReq1Valid |
| 2680 | * 0x08, VclkbSysClkReq1HPValid |
| 2681 | */ |
| 2682 | REG_INIT(AB8540_REGUVCLKBREQVALID, 0x03, 0x14, 0x0f), |
| 2683 | /* |
| 2684 | * 0x01, Vrf1SwHPReqValid |
| 2685 | * 0x02, Vrf1HwHPReq2Valid |
| 2686 | * 0x04, Vrf1HwHPReq1Valid |
| 2687 | * 0x08, Vrf1SysClkReq1HPValid |
| 2688 | */ |
| 2689 | REG_INIT(AB8540_REGUVRF1REQVALID, 0x03, 0x15, 0x0f), |
| 2690 | /* |
| 2691 | * 0x02, VTVoutEna |
| 2692 | * 0x04, Vintcore12Ena |
| 2693 | * 0x38, Vintcore12Sel |
| 2694 | * 0x40, Vintcore12LP |
| 2695 | * 0x80, VTVoutLP |
| 2696 | */ |
| 2697 | REG_INIT(AB8540_REGUMISC1, 0x03, 0x80, 0xfe), |
| 2698 | /* |
| 2699 | * 0x02, VaudioEna |
| 2700 | * 0x04, VdmicEna |
| 2701 | * 0x08, Vamic1Ena |
| 2702 | * 0x10, Vamic2Ena |
| 2703 | * 0x20, Vamic12LP |
| 2704 | * 0xC0, VdmicSel |
| 2705 | */ |
| 2706 | REG_INIT(AB8540_VAUDIOSUPPLY, 0x03, 0x83, 0xfe), |
| 2707 | /* |
| 2708 | * 0x01, Vamic1_dzout |
| 2709 | * 0x02, Vamic2_dzout |
| 2710 | */ |
| 2711 | REG_INIT(AB8540_REGUCTRL1VAMIC, 0x03, 0x84, 0x03), |
| 2712 | /* |
| 2713 | * 0x07, VHSICSel |
| 2714 | * 0x08, VHSICOffState |
| 2715 | * 0x10, VHSIEna |
| 2716 | * 0x20, VHSICLP |
| 2717 | */ |
| 2718 | REG_INIT(AB8540_VHSIC, 0x03, 0x87, 0x3f), |
| 2719 | /* |
| 2720 | * 0x07, VSDIOSel |
| 2721 | * 0x08, VSDIOOffState |
| 2722 | * 0x10, VSDIOEna |
| 2723 | * 0x20, VSDIOLP |
| 2724 | */ |
| 2725 | REG_INIT(AB8540_VSDIO, 0x03, 0x88, 0x3f), |
| 2726 | /* |
| 2727 | * 0x03, Vsmps1Regu |
| 2728 | * 0x0c, Vsmps1SelCtrl |
| 2729 | * 0x10, Vsmps1AutoMode |
| 2730 | * 0x20, Vsmps1PWMMode |
| 2731 | */ |
| 2732 | REG_INIT(AB8540_VSMPS1REGU, 0x04, 0x03, 0x3f), |
| 2733 | /* |
| 2734 | * 0x03, Vsmps2Regu |
| 2735 | * 0x0c, Vsmps2SelCtrl |
| 2736 | * 0x10, Vsmps2AutoMode |
| 2737 | * 0x20, Vsmps2PWMMode |
| 2738 | */ |
| 2739 | REG_INIT(AB8540_VSMPS2REGU, 0x04, 0x04, 0x3f), |
| 2740 | /* |
| 2741 | * 0x03, Vsmps3Regu |
| 2742 | * 0x0c, Vsmps3SelCtrl |
| 2743 | * 0x10, Vsmps3AutoMode |
| 2744 | * 0x20, Vsmps3PWMMode |
| 2745 | * NOTE! PRCMU register |
| 2746 | */ |
| 2747 | REG_INIT(AB8540_VSMPS3REGU, 0x04, 0x05, 0x0f), |
| 2748 | /* |
| 2749 | * 0x03, VpllRegu |
| 2750 | * 0x0c, VanaRegu |
| 2751 | */ |
| 2752 | REG_INIT(AB8540_VPLLVANAREGU, 0x04, 0x06, 0x0f), |
| 2753 | /* |
| 2754 | * 0x03, VextSupply1Regu |
| 2755 | * 0x0c, VextSupply2Regu |
| 2756 | * 0x30, VextSupply3Regu |
| 2757 | * 0x40, ExtSupply2Bypass |
| 2758 | * 0x80, ExtSupply3Bypass |
| 2759 | */ |
| 2760 | REG_INIT(AB8540_EXTSUPPLYREGU, 0x04, 0x08, 0xff), |
| 2761 | /* |
| 2762 | * 0x03, Vaux1Regu |
| 2763 | * 0x0c, Vaux2Regu |
| 2764 | */ |
| 2765 | REG_INIT(AB8540_VAUX12REGU, 0x04, 0x09, 0x0f), |
| 2766 | /* |
| 2767 | * 0x0c, VRF1Regu |
| 2768 | * 0x03, Vaux3Regu |
| 2769 | */ |
| 2770 | REG_INIT(AB8540_VRF1VAUX3REGU, 0x04, 0x0a, 0x0f), |
| 2771 | /* |
| 2772 | * 0x3f, Vsmps1Sel1 |
| 2773 | */ |
| 2774 | REG_INIT(AB8540_VSMPS1SEL1, 0x04, 0x13, 0x3f), |
| 2775 | /* |
| 2776 | * 0x3f, Vsmps1Sel2 |
| 2777 | */ |
| 2778 | REG_INIT(AB8540_VSMPS1SEL2, 0x04, 0x14, 0x3f), |
| 2779 | /* |
| 2780 | * 0x3f, Vsmps1Sel3 |
| 2781 | */ |
| 2782 | REG_INIT(AB8540_VSMPS1SEL3, 0x04, 0x15, 0x3f), |
| 2783 | /* |
| 2784 | * 0x3f, Vsmps2Sel1 |
| 2785 | */ |
| 2786 | REG_INIT(AB8540_VSMPS2SEL1, 0x04, 0x17, 0x3f), |
| 2787 | /* |
| 2788 | * 0x3f, Vsmps2Sel2 |
| 2789 | */ |
| 2790 | REG_INIT(AB8540_VSMPS2SEL2, 0x04, 0x18, 0x3f), |
| 2791 | /* |
| 2792 | * 0x3f, Vsmps2Sel3 |
| 2793 | */ |
| 2794 | REG_INIT(AB8540_VSMPS2SEL3, 0x04, 0x19, 0x3f), |
| 2795 | /* |
| 2796 | * 0x7f, Vsmps3Sel1 |
| 2797 | * NOTE! PRCMU register |
| 2798 | */ |
| 2799 | REG_INIT(AB8540_VSMPS3SEL1, 0x04, 0x1b, 0x7f), |
| 2800 | /* |
| 2801 | * 0x7f, Vsmps3Sel2 |
| 2802 | * NOTE! PRCMU register |
| 2803 | */ |
| 2804 | REG_INIT(AB8540_VSMPS3SEL2, 0x04, 0x1c, 0x7f), |
| 2805 | /* |
| 2806 | * 0x0f, Vaux1Sel |
| 2807 | */ |
| 2808 | REG_INIT(AB8540_VAUX1SEL, 0x04, 0x1f, 0x0f), |
| 2809 | /* |
| 2810 | * 0x0f, Vaux2Sel |
| 2811 | */ |
| 2812 | REG_INIT(AB8540_VAUX2SEL, 0x04, 0x20, 0x0f), |
| 2813 | /* |
| 2814 | * 0x07, Vaux3Sel |
| 2815 | * 0x70, Vrf1Sel |
| 2816 | */ |
| 2817 | REG_INIT(AB8540_VRF1VAUX3SEL, 0x04, 0x21, 0x77), |
| 2818 | /* |
| 2819 | * 0x01, VextSupply12LP |
| 2820 | */ |
| 2821 | REG_INIT(AB8540_REGUCTRL2SPARE, 0x04, 0x22, 0x01), |
| 2822 | /* |
| 2823 | * 0x07, Vanasel |
| 2824 | * 0x30, Vpllsel |
| 2825 | */ |
| 2826 | REG_INIT(AB8540_VANAVPLLSEL, 0x04, 0x29, 0x37), |
| 2827 | /* |
| 2828 | * 0x03, Vaux4RequestCtrl |
| 2829 | */ |
| 2830 | REG_INIT(AB8540_VAUX4REQCTRL, 0x04, 0x2d, 0x03), |
| 2831 | /* |
| 2832 | * 0x03, Vaux4Regu |
| 2833 | */ |
| 2834 | REG_INIT(AB8540_VAUX4REGU, 0x04, 0x2e, 0x03), |
| 2835 | /* |
| 2836 | * 0x0f, Vaux4Sel |
| 2837 | */ |
| 2838 | REG_INIT(AB8540_VAUX4SEL, 0x04, 0x2f, 0x0f), |
| 2839 | /* |
| 2840 | * 0x03, Vaux5RequestCtrl |
| 2841 | */ |
| 2842 | REG_INIT(AB8540_VAUX5REQCTRL, 0x04, 0x31, 0x03), |
| 2843 | /* |
| 2844 | * 0x03, Vaux5Regu |
| 2845 | */ |
| 2846 | REG_INIT(AB8540_VAUX5REGU, 0x04, 0x32, 0x03), |
| 2847 | /* |
| 2848 | * 0x3f, Vaux5Sel |
| 2849 | */ |
| 2850 | REG_INIT(AB8540_VAUX5SEL, 0x04, 0x33, 0x3f), |
| 2851 | /* |
| 2852 | * 0x03, Vaux6RequestCtrl |
| 2853 | */ |
| 2854 | REG_INIT(AB8540_VAUX6REQCTRL, 0x04, 0x34, 0x03), |
| 2855 | /* |
| 2856 | * 0x03, Vaux6Regu |
| 2857 | */ |
| 2858 | REG_INIT(AB8540_VAUX6REGU, 0x04, 0x35, 0x03), |
| 2859 | /* |
| 2860 | * 0x3f, Vaux6Sel |
| 2861 | */ |
| 2862 | REG_INIT(AB8540_VAUX6SEL, 0x04, 0x36, 0x3f), |
| 2863 | /* |
| 2864 | * 0x03, VCLKBRequestCtrl |
| 2865 | */ |
| 2866 | REG_INIT(AB8540_VCLKBREQCTRL, 0x04, 0x37, 0x03), |
| 2867 | /* |
| 2868 | * 0x03, VCLKBRegu |
| 2869 | */ |
| 2870 | REG_INIT(AB8540_VCLKBREGU, 0x04, 0x38, 0x03), |
| 2871 | /* |
| 2872 | * 0x07, VCLKBSel |
| 2873 | */ |
| 2874 | REG_INIT(AB8540_VCLKBSEL, 0x04, 0x39, 0x07), |
| 2875 | /* |
| 2876 | * 0x03, Vrf1RequestCtrl |
| 2877 | */ |
| 2878 | REG_INIT(AB8540_VRF1REQCTRL, 0x04, 0x3a, 0x03), |
| 2879 | /* |
| 2880 | * 0x01, VpllDisch |
| 2881 | * 0x02, Vrf1Disch |
| 2882 | * 0x04, Vaux1Disch |
| 2883 | * 0x08, Vaux2Disch |
| 2884 | * 0x10, Vaux3Disch |
| 2885 | * 0x20, Vintcore12Disch |
| 2886 | * 0x40, VTVoutDisch |
| 2887 | * 0x80, VaudioDisch |
| 2888 | */ |
| 2889 | REG_INIT(AB8540_REGUCTRLDISCH, 0x04, 0x43, 0xff), |
| 2890 | /* |
| 2891 | * 0x02, VanaDisch |
| 2892 | * 0x04, VdmicPullDownEna |
| 2893 | * 0x08, VpllPullDownEna |
| 2894 | * 0x10, VdmicDisch |
| 2895 | */ |
| 2896 | REG_INIT(AB8540_REGUCTRLDISCH2, 0x04, 0x44, 0x1e), |
| 2897 | /* |
| 2898 | * 0x01, Vaux4Disch |
| 2899 | */ |
| 2900 | REG_INIT(AB8540_REGUCTRLDISCH3, 0x04, 0x48, 0x01), |
| 2901 | /* |
| 2902 | * 0x01, Vaux5Disch |
| 2903 | * 0x02, Vaux6Disch |
| 2904 | * 0x04, VCLKBDisch |
| 2905 | */ |
| 2906 | REG_INIT(AB8540_REGUCTRLDISCH4, 0x04, 0x49, 0x07), |
| 2907 | }; |
| 2908 | |
Lee Jones | da45edc | 2013-04-02 13:24:20 +0100 | [diff] [blame] | 2909 | static struct of_regulator_match ab8500_regulator_match[] = { |
| 2910 | { .name = "ab8500_ldo_aux1", .driver_data = (void *) AB8500_LDO_AUX1, }, |
| 2911 | { .name = "ab8500_ldo_aux2", .driver_data = (void *) AB8500_LDO_AUX2, }, |
| 2912 | { .name = "ab8500_ldo_aux3", .driver_data = (void *) AB8500_LDO_AUX3, }, |
| 2913 | { .name = "ab8500_ldo_intcore", .driver_data = (void *) AB8500_LDO_INTCORE, }, |
| 2914 | { .name = "ab8500_ldo_tvout", .driver_data = (void *) AB8500_LDO_TVOUT, }, |
| 2915 | { .name = "ab8500_ldo_audio", .driver_data = (void *) AB8500_LDO_AUDIO, }, |
| 2916 | { .name = "ab8500_ldo_anamic1", .driver_data = (void *) AB8500_LDO_ANAMIC1, }, |
| 2917 | { .name = "ab8500_ldo_amamic2", .driver_data = (void *) AB8500_LDO_ANAMIC2, }, |
| 2918 | { .name = "ab8500_ldo_dmic", .driver_data = (void *) AB8500_LDO_DMIC, }, |
| 2919 | { .name = "ab8500_ldo_ana", .driver_data = (void *) AB8500_LDO_ANA, }, |
| 2920 | }; |
| 2921 | |
| 2922 | static struct of_regulator_match ab8505_regulator_match[] = { |
| 2923 | { .name = "ab8500_ldo_aux1", .driver_data = (void *) AB8505_LDO_AUX1, }, |
| 2924 | { .name = "ab8500_ldo_aux2", .driver_data = (void *) AB8505_LDO_AUX2, }, |
| 2925 | { .name = "ab8500_ldo_aux3", .driver_data = (void *) AB8505_LDO_AUX3, }, |
| 2926 | { .name = "ab8500_ldo_aux4", .driver_data = (void *) AB8505_LDO_AUX4, }, |
| 2927 | { .name = "ab8500_ldo_aux5", .driver_data = (void *) AB8505_LDO_AUX5, }, |
| 2928 | { .name = "ab8500_ldo_aux6", .driver_data = (void *) AB8505_LDO_AUX6, }, |
| 2929 | { .name = "ab8500_ldo_intcore", .driver_data = (void *) AB8505_LDO_INTCORE, }, |
| 2930 | { .name = "ab8500_ldo_adc", .driver_data = (void *) AB8505_LDO_ADC, }, |
| 2931 | { .name = "ab8500_ldo_audio", .driver_data = (void *) AB8505_LDO_AUDIO, }, |
| 2932 | { .name = "ab8500_ldo_anamic1", .driver_data = (void *) AB8505_LDO_ANAMIC1, }, |
| 2933 | { .name = "ab8500_ldo_amamic2", .driver_data = (void *) AB8505_LDO_ANAMIC2, }, |
| 2934 | { .name = "ab8500_ldo_aux8", .driver_data = (void *) AB8505_LDO_AUX8, }, |
| 2935 | { .name = "ab8500_ldo_ana", .driver_data = (void *) AB8505_LDO_ANA, }, |
| 2936 | }; |
| 2937 | |
| 2938 | static struct of_regulator_match ab8540_regulator_match[] = { |
| 2939 | { .name = "ab8500_ldo_aux1", .driver_data = (void *) AB8540_LDO_AUX1, }, |
| 2940 | { .name = "ab8500_ldo_aux2", .driver_data = (void *) AB8540_LDO_AUX2, }, |
| 2941 | { .name = "ab8500_ldo_aux3", .driver_data = (void *) AB8540_LDO_AUX3, }, |
| 2942 | { .name = "ab8500_ldo_aux4", .driver_data = (void *) AB8540_LDO_AUX4, }, |
| 2943 | { .name = "ab8500_ldo_aux5", .driver_data = (void *) AB8540_LDO_AUX5, }, |
| 2944 | { .name = "ab8500_ldo_aux6", .driver_data = (void *) AB8540_LDO_AUX6, }, |
| 2945 | { .name = "ab8500_ldo_intcore", .driver_data = (void *) AB8540_LDO_INTCORE, }, |
| 2946 | { .name = "ab8500_ldo_tvout", .driver_data = (void *) AB8540_LDO_TVOUT, }, |
| 2947 | { .name = "ab8500_ldo_audio", .driver_data = (void *) AB8540_LDO_AUDIO, }, |
| 2948 | { .name = "ab8500_ldo_anamic1", .driver_data = (void *) AB8540_LDO_ANAMIC1, }, |
| 2949 | { .name = "ab8500_ldo_amamic2", .driver_data = (void *) AB8540_LDO_ANAMIC2, }, |
| 2950 | { .name = "ab8500_ldo_dmic", .driver_data = (void *) AB8540_LDO_DMIC, }, |
| 2951 | { .name = "ab8500_ldo_ana", .driver_data = (void *) AB8540_LDO_ANA, }, |
| 2952 | { .name = "ab8500_ldo_sdio", .driver_data = (void *) AB8540_LDO_SDIO, }, |
| 2953 | }; |
| 2954 | |
| 2955 | static struct of_regulator_match ab9540_regulator_match[] = { |
| 2956 | { .name = "ab8500_ldo_aux1", .driver_data = (void *) AB9540_LDO_AUX1, }, |
| 2957 | { .name = "ab8500_ldo_aux2", .driver_data = (void *) AB9540_LDO_AUX2, }, |
| 2958 | { .name = "ab8500_ldo_aux3", .driver_data = (void *) AB9540_LDO_AUX3, }, |
| 2959 | { .name = "ab8500_ldo_aux4", .driver_data = (void *) AB9540_LDO_AUX4, }, |
| 2960 | { .name = "ab8500_ldo_intcore", .driver_data = (void *) AB9540_LDO_INTCORE, }, |
| 2961 | { .name = "ab8500_ldo_tvout", .driver_data = (void *) AB9540_LDO_TVOUT, }, |
| 2962 | { .name = "ab8500_ldo_audio", .driver_data = (void *) AB9540_LDO_AUDIO, }, |
| 2963 | { .name = "ab8500_ldo_anamic1", .driver_data = (void *) AB9540_LDO_ANAMIC1, }, |
| 2964 | { .name = "ab8500_ldo_amamic2", .driver_data = (void *) AB9540_LDO_ANAMIC2, }, |
| 2965 | { .name = "ab8500_ldo_dmic", .driver_data = (void *) AB9540_LDO_DMIC, }, |
| 2966 | { .name = "ab8500_ldo_ana", .driver_data = (void *) AB9540_LDO_ANA, }, |
| 2967 | }; |
| 2968 | |
Lee Jones | 33aeb49 | 2013-04-02 13:24:14 +0100 | [diff] [blame] | 2969 | static struct { |
| 2970 | struct ab8500_regulator_info *info; |
| 2971 | int info_size; |
| 2972 | struct ab8500_reg_init *init; |
| 2973 | int init_size; |
| 2974 | struct of_regulator_match *match; |
| 2975 | int match_size; |
| 2976 | } abx500_regulator; |
| 2977 | |
Lee Jones | da45edc | 2013-04-02 13:24:20 +0100 | [diff] [blame] | 2978 | static void abx500_get_regulator_info(struct ab8500 *ab8500) |
| 2979 | { |
| 2980 | if (is_ab9540(ab8500)) { |
| 2981 | abx500_regulator.info = ab9540_regulator_info; |
| 2982 | abx500_regulator.info_size = ARRAY_SIZE(ab9540_regulator_info); |
| 2983 | abx500_regulator.init = ab9540_reg_init; |
| 2984 | abx500_regulator.init_size = AB9540_NUM_REGULATOR_REGISTERS; |
| 2985 | abx500_regulator.match = ab9540_regulator_match; |
| 2986 | abx500_regulator.match_size = ARRAY_SIZE(ab9540_regulator_match); |
| 2987 | } else if (is_ab8505(ab8500)) { |
| 2988 | abx500_regulator.info = ab8505_regulator_info; |
| 2989 | abx500_regulator.info_size = ARRAY_SIZE(ab8505_regulator_info); |
| 2990 | abx500_regulator.init = ab8505_reg_init; |
| 2991 | abx500_regulator.init_size = AB8505_NUM_REGULATOR_REGISTERS; |
| 2992 | abx500_regulator.match = ab8505_regulator_match; |
| 2993 | abx500_regulator.match_size = ARRAY_SIZE(ab8505_regulator_match); |
| 2994 | } else if (is_ab8540(ab8500)) { |
| 2995 | abx500_regulator.info = ab8540_regulator_info; |
| 2996 | abx500_regulator.info_size = ARRAY_SIZE(ab8540_regulator_info); |
| 2997 | abx500_regulator.init = ab8540_reg_init; |
| 2998 | abx500_regulator.init_size = AB8540_NUM_REGULATOR_REGISTERS; |
| 2999 | abx500_regulator.match = ab8540_regulator_match; |
| 3000 | abx500_regulator.match_size = ARRAY_SIZE(ab8540_regulator_match); |
| 3001 | } else { |
| 3002 | abx500_regulator.info = ab8500_regulator_info; |
| 3003 | abx500_regulator.info_size = ARRAY_SIZE(ab8500_regulator_info); |
| 3004 | abx500_regulator.init = ab8500_reg_init; |
| 3005 | abx500_regulator.init_size = AB8500_NUM_REGULATOR_REGISTERS; |
| 3006 | abx500_regulator.match = ab8500_regulator_match; |
| 3007 | abx500_regulator.match_size = ARRAY_SIZE(ab8500_regulator_match); |
| 3008 | } |
| 3009 | } |
| 3010 | |
Lee Jones | 3c1b843 | 2013-03-21 15:59:01 +0000 | [diff] [blame] | 3011 | static int ab8500_regulator_init_registers(struct platform_device *pdev, |
| 3012 | int id, int mask, int value) |
Lee Jones | a7ac1d9 | 2012-05-17 14:45:14 +0100 | [diff] [blame] | 3013 | { |
Lee Jones | 33aeb49 | 2013-04-02 13:24:14 +0100 | [diff] [blame] | 3014 | struct ab8500_reg_init *reg_init = abx500_regulator.init; |
Lee Jones | a7ac1d9 | 2012-05-17 14:45:14 +0100 | [diff] [blame] | 3015 | int err; |
| 3016 | |
Lee Jones | 3c1b843 | 2013-03-21 15:59:01 +0000 | [diff] [blame] | 3017 | BUG_ON(value & ~mask); |
Lee Jones | b54969a | 2013-03-28 16:11:10 +0000 | [diff] [blame] | 3018 | BUG_ON(mask & ~reg_init[id].mask); |
Lee Jones | a7ac1d9 | 2012-05-17 14:45:14 +0100 | [diff] [blame] | 3019 | |
Lee Jones | 3c1b843 | 2013-03-21 15:59:01 +0000 | [diff] [blame] | 3020 | /* initialize register */ |
Lee Jones | a7ac1d9 | 2012-05-17 14:45:14 +0100 | [diff] [blame] | 3021 | err = abx500_mask_and_set_register_interruptible( |
| 3022 | &pdev->dev, |
Lee Jones | b54969a | 2013-03-28 16:11:10 +0000 | [diff] [blame] | 3023 | reg_init[id].bank, |
| 3024 | reg_init[id].addr, |
Lee Jones | 3c1b843 | 2013-03-21 15:59:01 +0000 | [diff] [blame] | 3025 | mask, value); |
Lee Jones | a7ac1d9 | 2012-05-17 14:45:14 +0100 | [diff] [blame] | 3026 | if (err < 0) { |
| 3027 | dev_err(&pdev->dev, |
| 3028 | "Failed to initialize 0x%02x, 0x%02x.\n", |
Lee Jones | b54969a | 2013-03-28 16:11:10 +0000 | [diff] [blame] | 3029 | reg_init[id].bank, |
| 3030 | reg_init[id].addr); |
Lee Jones | a7ac1d9 | 2012-05-17 14:45:14 +0100 | [diff] [blame] | 3031 | return err; |
| 3032 | } |
Lee Jones | a7ac1d9 | 2012-05-17 14:45:14 +0100 | [diff] [blame] | 3033 | dev_vdbg(&pdev->dev, |
Lee Jones | 3c1b843 | 2013-03-21 15:59:01 +0000 | [diff] [blame] | 3034 | " init: 0x%02x, 0x%02x, 0x%02x, 0x%02x\n", |
Lee Jones | b54969a | 2013-03-28 16:11:10 +0000 | [diff] [blame] | 3035 | reg_init[id].bank, |
| 3036 | reg_init[id].addr, |
Lee Jones | 3c1b843 | 2013-03-21 15:59:01 +0000 | [diff] [blame] | 3037 | mask, value); |
Lee Jones | a7ac1d9 | 2012-05-17 14:45:14 +0100 | [diff] [blame] | 3038 | |
| 3039 | return 0; |
| 3040 | } |
| 3041 | |
Bill Pemberton | a502357 | 2012-11-19 13:22:22 -0500 | [diff] [blame] | 3042 | static int ab8500_regulator_register(struct platform_device *pdev, |
Lee Jones | b54969a | 2013-03-28 16:11:10 +0000 | [diff] [blame] | 3043 | struct regulator_init_data *init_data, |
Lee Jones | b54969a | 2013-03-28 16:11:10 +0000 | [diff] [blame] | 3044 | int id, struct device_node *np) |
Lee Jones | a7ac1d9 | 2012-05-17 14:45:14 +0100 | [diff] [blame] | 3045 | { |
Lee Jones | 8e6a8d7 | 2013-03-28 16:11:11 +0000 | [diff] [blame] | 3046 | struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent); |
Lee Jones | a7ac1d9 | 2012-05-17 14:45:14 +0100 | [diff] [blame] | 3047 | struct ab8500_regulator_info *info = NULL; |
| 3048 | struct regulator_config config = { }; |
| 3049 | int err; |
| 3050 | |
| 3051 | /* assign per-regulator data */ |
Lee Jones | 33aeb49 | 2013-04-02 13:24:14 +0100 | [diff] [blame] | 3052 | info = &abx500_regulator.info[id]; |
Lee Jones | a7ac1d9 | 2012-05-17 14:45:14 +0100 | [diff] [blame] | 3053 | info->dev = &pdev->dev; |
| 3054 | |
| 3055 | config.dev = &pdev->dev; |
| 3056 | config.init_data = init_data; |
| 3057 | config.driver_data = info; |
| 3058 | config.of_node = np; |
| 3059 | |
| 3060 | /* fix for hardware before ab8500v2.0 */ |
Lee Jones | 8e6a8d7 | 2013-03-28 16:11:11 +0000 | [diff] [blame] | 3061 | if (is_ab8500_1p1_or_earlier(ab8500)) { |
Lee Jones | a7ac1d9 | 2012-05-17 14:45:14 +0100 | [diff] [blame] | 3062 | if (info->desc.id == AB8500_LDO_AUX3) { |
| 3063 | info->desc.n_voltages = |
| 3064 | ARRAY_SIZE(ldo_vauxn_voltages); |
Axel Lin | ec1cc4d | 2012-05-20 10:33:35 +0800 | [diff] [blame] | 3065 | info->desc.volt_table = ldo_vauxn_voltages; |
Lee Jones | a7ac1d9 | 2012-05-17 14:45:14 +0100 | [diff] [blame] | 3066 | info->voltage_mask = 0xf; |
| 3067 | } |
| 3068 | } |
| 3069 | |
| 3070 | /* register regulator with framework */ |
| 3071 | info->regulator = regulator_register(&info->desc, &config); |
| 3072 | if (IS_ERR(info->regulator)) { |
| 3073 | err = PTR_ERR(info->regulator); |
| 3074 | dev_err(&pdev->dev, "failed to register regulator %s\n", |
| 3075 | info->desc.name); |
| 3076 | /* when we fail, un-register all earlier regulators */ |
| 3077 | while (--id >= 0) { |
Lee Jones | 33aeb49 | 2013-04-02 13:24:14 +0100 | [diff] [blame] | 3078 | info = &abx500_regulator.info[id]; |
Lee Jones | a7ac1d9 | 2012-05-17 14:45:14 +0100 | [diff] [blame] | 3079 | regulator_unregister(info->regulator); |
| 3080 | } |
| 3081 | return err; |
| 3082 | } |
| 3083 | |
| 3084 | return 0; |
| 3085 | } |
| 3086 | |
Bill Pemberton | a502357 | 2012-11-19 13:22:22 -0500 | [diff] [blame] | 3087 | static int |
Lee Jones | b54969a | 2013-03-28 16:11:10 +0000 | [diff] [blame] | 3088 | ab8500_regulator_of_probe(struct platform_device *pdev, |
Lee Jones | b54969a | 2013-03-28 16:11:10 +0000 | [diff] [blame] | 3089 | struct device_node *np) |
Lee Jones | 3a8334b | 2012-05-17 14:45:16 +0100 | [diff] [blame] | 3090 | { |
Lee Jones | 33aeb49 | 2013-04-02 13:24:14 +0100 | [diff] [blame] | 3091 | struct of_regulator_match *match = abx500_regulator.match; |
Lee Jones | 3a8334b | 2012-05-17 14:45:16 +0100 | [diff] [blame] | 3092 | int err, i; |
| 3093 | |
Lee Jones | 33aeb49 | 2013-04-02 13:24:14 +0100 | [diff] [blame] | 3094 | for (i = 0; i < abx500_regulator.info_size; i++) { |
Lee Jones | 3a8334b | 2012-05-17 14:45:16 +0100 | [diff] [blame] | 3095 | err = ab8500_regulator_register( |
Lee Jones | 33aeb49 | 2013-04-02 13:24:14 +0100 | [diff] [blame] | 3096 | pdev, match[i].init_data, i, match[i].of_node); |
Lee Jones | 3a8334b | 2012-05-17 14:45:16 +0100 | [diff] [blame] | 3097 | if (err) |
| 3098 | return err; |
| 3099 | } |
| 3100 | |
| 3101 | return 0; |
| 3102 | } |
| 3103 | |
Bill Pemberton | a502357 | 2012-11-19 13:22:22 -0500 | [diff] [blame] | 3104 | static int ab8500_regulator_probe(struct platform_device *pdev) |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 3105 | { |
| 3106 | struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent); |
Lee Jones | 3a8334b | 2012-05-17 14:45:16 +0100 | [diff] [blame] | 3107 | struct device_node *np = pdev->dev.of_node; |
Bengt Jonsson | 732805a | 2013-03-21 15:59:03 +0000 | [diff] [blame] | 3108 | struct ab8500_platform_data *ppdata; |
| 3109 | struct ab8500_regulator_platform_data *pdata; |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 3110 | int i, err; |
Lee Jones | b54969a | 2013-03-28 16:11:10 +0000 | [diff] [blame] | 3111 | |
Lee Jones | 33aeb49 | 2013-04-02 13:24:14 +0100 | [diff] [blame] | 3112 | if (!ab8500) { |
| 3113 | dev_err(&pdev->dev, "null mfd parent\n"); |
| 3114 | return -EINVAL; |
Lee Jones | 8e6a8d7 | 2013-03-28 16:11:11 +0000 | [diff] [blame] | 3115 | } |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 3116 | |
Lee Jones | 33aeb49 | 2013-04-02 13:24:14 +0100 | [diff] [blame] | 3117 | abx500_get_regulator_info(ab8500); |
| 3118 | |
Lee Jones | 3a8334b | 2012-05-17 14:45:16 +0100 | [diff] [blame] | 3119 | if (np) { |
Lee Jones | 33aeb49 | 2013-04-02 13:24:14 +0100 | [diff] [blame] | 3120 | err = of_regulator_match(&pdev->dev, np, |
| 3121 | abx500_regulator.match, |
| 3122 | abx500_regulator.match_size); |
Lee Jones | 3a8334b | 2012-05-17 14:45:16 +0100 | [diff] [blame] | 3123 | if (err < 0) { |
| 3124 | dev_err(&pdev->dev, |
| 3125 | "Error parsing regulator init data: %d\n", err); |
| 3126 | return err; |
| 3127 | } |
| 3128 | |
Lee Jones | 33aeb49 | 2013-04-02 13:24:14 +0100 | [diff] [blame] | 3129 | err = ab8500_regulator_of_probe(pdev, np); |
Lee Jones | 3a8334b | 2012-05-17 14:45:16 +0100 | [diff] [blame] | 3130 | return err; |
| 3131 | } |
| 3132 | |
Bengt Jonsson | 732805a | 2013-03-21 15:59:03 +0000 | [diff] [blame] | 3133 | ppdata = dev_get_platdata(ab8500->dev); |
| 3134 | if (!ppdata) { |
| 3135 | dev_err(&pdev->dev, "null parent pdata\n"); |
| 3136 | return -EINVAL; |
| 3137 | } |
| 3138 | |
| 3139 | pdata = ppdata->regulator; |
Bengt Jonsson | fc24b42 | 2010-12-10 11:08:45 +0100 | [diff] [blame] | 3140 | if (!pdata) { |
| 3141 | dev_err(&pdev->dev, "null pdata\n"); |
| 3142 | return -EINVAL; |
| 3143 | } |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 3144 | |
Bengt Jonsson | cb189b0 | 2010-12-10 11:08:40 +0100 | [diff] [blame] | 3145 | /* make sure the platform data has the correct size */ |
Lee Jones | 33aeb49 | 2013-04-02 13:24:14 +0100 | [diff] [blame] | 3146 | if (pdata->num_regulator != abx500_regulator.info_size) { |
Bengt Jonsson | 79568b94 | 2011-03-11 11:54:46 +0100 | [diff] [blame] | 3147 | dev_err(&pdev->dev, "Configuration error: size mismatch.\n"); |
Bengt Jonsson | cb189b0 | 2010-12-10 11:08:40 +0100 | [diff] [blame] | 3148 | return -EINVAL; |
| 3149 | } |
| 3150 | |
Lee Jones | da0b0c4 | 2013-03-28 16:11:09 +0000 | [diff] [blame] | 3151 | /* initialize debug (initial state is recorded with this call) */ |
| 3152 | err = ab8500_regulator_debug_init(pdev); |
| 3153 | if (err) |
| 3154 | return err; |
| 3155 | |
Bengt Jonsson | 79568b94 | 2011-03-11 11:54:46 +0100 | [diff] [blame] | 3156 | /* initialize registers */ |
Bengt Jonsson | 732805a | 2013-03-21 15:59:03 +0000 | [diff] [blame] | 3157 | for (i = 0; i < pdata->num_reg_init; i++) { |
Lee Jones | 3c1b843 | 2013-03-21 15:59:01 +0000 | [diff] [blame] | 3158 | int id, mask, value; |
Bengt Jonsson | 79568b94 | 2011-03-11 11:54:46 +0100 | [diff] [blame] | 3159 | |
Bengt Jonsson | 732805a | 2013-03-21 15:59:03 +0000 | [diff] [blame] | 3160 | id = pdata->reg_init[i].id; |
| 3161 | mask = pdata->reg_init[i].mask; |
| 3162 | value = pdata->reg_init[i].value; |
Bengt Jonsson | 79568b94 | 2011-03-11 11:54:46 +0100 | [diff] [blame] | 3163 | |
| 3164 | /* check for configuration errors */ |
Lee Jones | 33aeb49 | 2013-04-02 13:24:14 +0100 | [diff] [blame] | 3165 | BUG_ON(id >= abx500_regulator.init_size); |
Bengt Jonsson | 79568b94 | 2011-03-11 11:54:46 +0100 | [diff] [blame] | 3166 | |
Lee Jones | 33aeb49 | 2013-04-02 13:24:14 +0100 | [diff] [blame] | 3167 | err = ab8500_regulator_init_registers(pdev, id, mask, value); |
Lee Jones | a7ac1d9 | 2012-05-17 14:45:14 +0100 | [diff] [blame] | 3168 | if (err < 0) |
Bengt Jonsson | 79568b94 | 2011-03-11 11:54:46 +0100 | [diff] [blame] | 3169 | return err; |
Bengt Jonsson | 79568b94 | 2011-03-11 11:54:46 +0100 | [diff] [blame] | 3170 | } |
| 3171 | |
Rabin Vincent | f7eae37 | 2013-04-02 13:24:08 +0100 | [diff] [blame] | 3172 | if (!is_ab8505(ab8500)) { |
| 3173 | /* register external regulators (before Vaux1, 2 and 3) */ |
| 3174 | err = ab8500_ext_regulator_init(pdev); |
| 3175 | if (err) |
| 3176 | return err; |
| 3177 | } |
Lee Jones | d1a8200 | 2013-03-28 16:11:01 +0000 | [diff] [blame] | 3178 | |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 3179 | /* register all regulators */ |
Lee Jones | 33aeb49 | 2013-04-02 13:24:14 +0100 | [diff] [blame] | 3180 | for (i = 0; i < abx500_regulator.info_size; i++) { |
Lee Jones | b54969a | 2013-03-28 16:11:10 +0000 | [diff] [blame] | 3181 | err = ab8500_regulator_register(pdev, &pdata->regulator[i], |
Lee Jones | 33aeb49 | 2013-04-02 13:24:14 +0100 | [diff] [blame] | 3182 | i, NULL); |
Lee Jones | a7ac1d9 | 2012-05-17 14:45:14 +0100 | [diff] [blame] | 3183 | if (err < 0) |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 3184 | return err; |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 3185 | } |
| 3186 | |
| 3187 | return 0; |
| 3188 | } |
| 3189 | |
Bill Pemberton | 8dc995f | 2012-11-19 13:26:10 -0500 | [diff] [blame] | 3190 | static int ab8500_regulator_remove(struct platform_device *pdev) |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 3191 | { |
Lee Jones | d1a8200 | 2013-03-28 16:11:01 +0000 | [diff] [blame] | 3192 | int i, err; |
Lee Jones | 8e6a8d7 | 2013-03-28 16:11:11 +0000 | [diff] [blame] | 3193 | struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent); |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 3194 | |
Lee Jones | 33aeb49 | 2013-04-02 13:24:14 +0100 | [diff] [blame] | 3195 | for (i = 0; i < abx500_regulator.info_size; i++) { |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 3196 | struct ab8500_regulator_info *info = NULL; |
Lee Jones | 33aeb49 | 2013-04-02 13:24:14 +0100 | [diff] [blame] | 3197 | info = &abx500_regulator.info[i]; |
Bengt Jonsson | 09aefa1 | 2010-12-10 11:08:46 +0100 | [diff] [blame] | 3198 | |
| 3199 | dev_vdbg(rdev_get_dev(info->regulator), |
| 3200 | "%s-remove\n", info->desc.name); |
| 3201 | |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 3202 | regulator_unregister(info->regulator); |
| 3203 | } |
| 3204 | |
Rabin Vincent | f7eae37 | 2013-04-02 13:24:08 +0100 | [diff] [blame] | 3205 | if (!is_ab8505(ab8500)) { |
| 3206 | /* remove external regulators (after Vaux1, 2 and 3) */ |
| 3207 | err = ab8500_ext_regulator_exit(pdev); |
| 3208 | if (err) |
| 3209 | return err; |
| 3210 | } |
Lee Jones | d1a8200 | 2013-03-28 16:11:01 +0000 | [diff] [blame] | 3211 | |
Lee Jones | da0b0c4 | 2013-03-28 16:11:09 +0000 | [diff] [blame] | 3212 | /* remove regulator debug */ |
| 3213 | err = ab8500_regulator_debug_exit(pdev); |
| 3214 | if (err) |
| 3215 | return err; |
| 3216 | |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 3217 | return 0; |
| 3218 | } |
| 3219 | |
| 3220 | static struct platform_driver ab8500_regulator_driver = { |
| 3221 | .probe = ab8500_regulator_probe, |
Bill Pemberton | 5eb9f2b | 2012-11-19 13:20:42 -0500 | [diff] [blame] | 3222 | .remove = ab8500_regulator_remove, |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 3223 | .driver = { |
| 3224 | .name = "ab8500-regulator", |
| 3225 | .owner = THIS_MODULE, |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 3226 | }, |
| 3227 | }; |
| 3228 | |
| 3229 | static int __init ab8500_regulator_init(void) |
| 3230 | { |
| 3231 | int ret; |
| 3232 | |
| 3233 | ret = platform_driver_register(&ab8500_regulator_driver); |
| 3234 | if (ret != 0) |
| 3235 | pr_err("Failed to register ab8500 regulator: %d\n", ret); |
| 3236 | |
| 3237 | return ret; |
| 3238 | } |
| 3239 | subsys_initcall(ab8500_regulator_init); |
| 3240 | |
| 3241 | static void __exit ab8500_regulator_exit(void) |
| 3242 | { |
| 3243 | platform_driver_unregister(&ab8500_regulator_driver); |
| 3244 | } |
| 3245 | module_exit(ab8500_regulator_exit); |
| 3246 | |
| 3247 | MODULE_LICENSE("GPL v2"); |
| 3248 | MODULE_AUTHOR("Sundar Iyer <sundar.iyer@stericsson.com>"); |
Bengt Jonsson | 732805a | 2013-03-21 15:59:03 +0000 | [diff] [blame] | 3249 | MODULE_AUTHOR("Bengt Jonsson <bengt.g.jonsson@stericsson.com>"); |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame] | 3250 | MODULE_AUTHOR("Daniel Willerud <daniel.willerud@stericsson.com>"); |
Sundar R IYER | c789ca2 | 2010-07-13 21:48:56 +0530 | [diff] [blame] | 3251 | MODULE_DESCRIPTION("Regulator Driver for ST-Ericsson AB8500 Mixed-Sig PMIC"); |
| 3252 | MODULE_ALIAS("platform:ab8500-regulator"); |