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