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