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