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