Sundar Iyer | 4f724be | 2010-09-15 10:50:59 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) ST-Ericsson SA 2010 |
| 3 | * |
| 4 | * License Terms: GNU General Public License v2 |
| 5 | * |
Bengt Jonsson | a1e516e | 2010-12-10 11:08:48 +0100 | [diff] [blame] | 6 | * Authors: Sundar Iyer <sundar.iyer@stericsson.com> |
| 7 | * Bengt Jonsson <bengt.g.jonsson@stericsson.com> |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame^] | 8 | * Daniel Willerud <daniel.willerud@stericsson.com> |
Sundar Iyer | 4f724be | 2010-09-15 10:50:59 +0100 | [diff] [blame] | 9 | * |
| 10 | * MOP500 board specific initialization for regulators |
| 11 | */ |
| 12 | #include <linux/kernel.h> |
| 13 | #include <linux/regulator/machine.h> |
Bengt Jonsson | a1e516e | 2010-12-10 11:08:48 +0100 | [diff] [blame] | 14 | #include <linux/regulator/ab8500.h> |
Lee Jones | 422d765 | 2013-03-28 16:11:04 +0000 | [diff] [blame] | 15 | #include <mach/id.h> /* to identify older boards for fixes */ |
Linus Walleij | d1de85a | 2010-12-02 17:10:14 +0100 | [diff] [blame] | 16 | #include "board-mop500-regulators.h" |
| 17 | |
Lee Jones | 0b5ea1e | 2012-09-03 14:33:39 +0100 | [diff] [blame] | 18 | static struct regulator_consumer_supply gpio_en_3v3_consumers[] = { |
| 19 | REGULATOR_SUPPLY("vdd33a", "smsc911x.0"), |
| 20 | }; |
| 21 | |
| 22 | struct regulator_init_data gpio_en_3v3_regulator = { |
| 23 | .constraints = { |
| 24 | .name = "EN-3V3", |
| 25 | .min_uV = 3300000, |
| 26 | .max_uV = 3300000, |
| 27 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, |
| 28 | }, |
| 29 | .num_consumer_supplies = ARRAY_SIZE(gpio_en_3v3_consumers), |
| 30 | .consumer_supplies = gpio_en_3v3_consumers, |
| 31 | }; |
| 32 | |
Linus Walleij | fe67dfc | 2011-03-07 11:48:15 +0100 | [diff] [blame] | 33 | /* |
| 34 | * TPS61052 regulator |
| 35 | */ |
| 36 | static struct regulator_consumer_supply tps61052_vaudio_consumers[] = { |
| 37 | /* |
| 38 | * Boost converter supply to raise voltage on audio speaker, this |
| 39 | * is actually connected to three pins, VInVhfL (left amplifier) |
| 40 | * VInVhfR (right amplifier) and VIntDClassInt - all three must |
| 41 | * be connected to the same voltage. |
| 42 | */ |
| 43 | REGULATOR_SUPPLY("vintdclassint", "ab8500-codec.0"), |
| 44 | }; |
| 45 | |
| 46 | struct regulator_init_data tps61052_regulator = { |
| 47 | .constraints = { |
| 48 | .name = "vaudio-hf", |
| 49 | .min_uV = 4500000, |
| 50 | .max_uV = 4500000, |
| 51 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, |
| 52 | }, |
| 53 | .num_consumer_supplies = ARRAY_SIZE(tps61052_vaudio_consumers), |
| 54 | .consumer_supplies = tps61052_vaudio_consumers, |
| 55 | }; |
| 56 | |
Linus Walleij | d1de85a | 2010-12-02 17:10:14 +0100 | [diff] [blame] | 57 | static struct regulator_consumer_supply ab8500_vaux1_consumers[] = { |
Lee Jones | 27f26de | 2013-03-21 15:59:05 +0000 | [diff] [blame] | 58 | /* Main display, u8500 R3 uib */ |
| 59 | REGULATOR_SUPPLY("vddi", "mcde_disp_sony_acx424akp.0"), |
| 60 | /* Main display, u8500 uib and ST uib */ |
| 61 | REGULATOR_SUPPLY("vdd1", "samsung_s6d16d0.0"), |
| 62 | /* Secondary display, ST uib */ |
| 63 | REGULATOR_SUPPLY("vdd1", "samsung_s6d16d0.1"), |
Linus Walleij | d1de85a | 2010-12-02 17:10:14 +0100 | [diff] [blame] | 64 | /* SFH7741 proximity sensor */ |
| 65 | REGULATOR_SUPPLY("vcc", "gpio-keys.0"), |
| 66 | /* BH1780GLS ambient light sensor */ |
| 67 | REGULATOR_SUPPLY("vcc", "2-0029"), |
| 68 | /* lsm303dlh accelerometer */ |
| 69 | REGULATOR_SUPPLY("vdd", "3-0018"), |
Lee Jones | cb6795a | 2013-03-21 15:59:21 +0000 | [diff] [blame] | 70 | /* lsm303dlhc accelerometer */ |
| 71 | REGULATOR_SUPPLY("vdd", "2-0019"), |
Linus Walleij | d1de85a | 2010-12-02 17:10:14 +0100 | [diff] [blame] | 72 | /* lsm303dlh magnetometer */ |
Lee Jones | cb6795a | 2013-03-21 15:59:21 +0000 | [diff] [blame] | 73 | REGULATOR_SUPPLY("vdd", "2-001e"), |
Linus Walleij | d1de85a | 2010-12-02 17:10:14 +0100 | [diff] [blame] | 74 | /* Rohm BU21013 Touchscreen devices */ |
| 75 | REGULATOR_SUPPLY("avdd", "3-005c"), |
| 76 | REGULATOR_SUPPLY("avdd", "3-005d"), |
| 77 | /* Synaptics RMI4 Touchscreen device */ |
| 78 | REGULATOR_SUPPLY("vdd", "3-004b"), |
Lee Jones | efb34d2 | 2013-03-21 15:59:10 +0000 | [diff] [blame] | 79 | /* L3G4200D Gyroscope device */ |
| 80 | REGULATOR_SUPPLY("vdd", "2-0068"), |
Lee Jones | 2d0266a | 2013-03-21 15:59:11 +0000 | [diff] [blame] | 81 | /* Ambient light sensor device */ |
| 82 | REGULATOR_SUPPLY("vdd", "3-0029"), |
Lee Jones | 4336c1d | 2013-03-21 15:59:12 +0000 | [diff] [blame] | 83 | /* Pressure sensor device */ |
| 84 | REGULATOR_SUPPLY("vdd", "2-005c"), |
Lee Jones | 5379f02 | 2013-03-21 15:59:13 +0000 | [diff] [blame] | 85 | /* Cypress TrueTouch Touchscreen device */ |
| 86 | REGULATOR_SUPPLY("vcpin", "spi8.0"), |
Lee Jones | fa67952 | 2013-03-21 15:59:14 +0000 | [diff] [blame] | 87 | /* Camera device */ |
| 88 | REGULATOR_SUPPLY("vaux12v5", "mmio_camera"), |
Linus Walleij | d1de85a | 2010-12-02 17:10:14 +0100 | [diff] [blame] | 89 | }; |
| 90 | |
| 91 | static struct regulator_consumer_supply ab8500_vaux2_consumers[] = { |
| 92 | /* On-board eMMC power */ |
| 93 | REGULATOR_SUPPLY("vmmc", "sdi4"), |
| 94 | /* AB8500 audio codec */ |
| 95 | REGULATOR_SUPPLY("vcc-N2158", "ab8500-codec.0"), |
| 96 | }; |
| 97 | |
| 98 | static struct regulator_consumer_supply ab8500_vaux3_consumers[] = { |
| 99 | /* External MMC slot power */ |
| 100 | REGULATOR_SUPPLY("vmmc", "sdi0"), |
| 101 | }; |
| 102 | |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame^] | 103 | static struct regulator_consumer_supply ab8505_vaux4_consumers[] = { |
| 104 | }; |
| 105 | |
| 106 | static struct regulator_consumer_supply ab8505_vaux5_consumers[] = { |
| 107 | }; |
| 108 | |
| 109 | static struct regulator_consumer_supply ab8505_vaux6_consumers[] = { |
| 110 | }; |
| 111 | |
| 112 | static struct regulator_consumer_supply ab8505_vaux8_consumers[] = { |
| 113 | /* AB8500 audio codec device */ |
| 114 | REGULATOR_SUPPLY("v-aux8", NULL), |
| 115 | }; |
| 116 | |
| 117 | static struct regulator_consumer_supply ab8505_vadc_consumers[] = { |
| 118 | /* Internal general-purpose ADC */ |
| 119 | REGULATOR_SUPPLY("vddadc", "ab8500-gpadc.0"), |
| 120 | /* ADC for charger */ |
| 121 | REGULATOR_SUPPLY("vddadc", "ab8500-charger.0"), |
| 122 | }; |
| 123 | |
Linus Walleij | d1de85a | 2010-12-02 17:10:14 +0100 | [diff] [blame] | 124 | static struct regulator_consumer_supply ab8500_vtvout_consumers[] = { |
| 125 | /* TV-out DENC supply */ |
| 126 | REGULATOR_SUPPLY("vtvout", "ab8500-denc.0"), |
| 127 | /* Internal general-purpose ADC */ |
| 128 | REGULATOR_SUPPLY("vddadc", "ab8500-gpadc.0"), |
| 129 | }; |
| 130 | |
Ola Lilja | 29bd2ab | 2012-02-01 14:18:10 +0100 | [diff] [blame] | 131 | static struct regulator_consumer_supply ab8500_vaud_consumers[] = { |
| 132 | /* AB8500 audio-codec main supply */ |
| 133 | REGULATOR_SUPPLY("vaud", "ab8500-codec.0"), |
| 134 | }; |
| 135 | |
| 136 | static struct regulator_consumer_supply ab8500_vamic1_consumers[] = { |
| 137 | /* AB8500 audio-codec Mic1 supply */ |
| 138 | REGULATOR_SUPPLY("vamic1", "ab8500-codec.0"), |
| 139 | }; |
| 140 | |
| 141 | static struct regulator_consumer_supply ab8500_vamic2_consumers[] = { |
| 142 | /* AB8500 audio-codec Mic2 supply */ |
| 143 | REGULATOR_SUPPLY("vamic2", "ab8500-codec.0"), |
| 144 | }; |
| 145 | |
| 146 | static struct regulator_consumer_supply ab8500_vdmic_consumers[] = { |
| 147 | /* AB8500 audio-codec DMic supply */ |
| 148 | REGULATOR_SUPPLY("vdmic", "ab8500-codec.0"), |
| 149 | }; |
| 150 | |
Linus Walleij | d1de85a | 2010-12-02 17:10:14 +0100 | [diff] [blame] | 151 | static struct regulator_consumer_supply ab8500_vintcore_consumers[] = { |
| 152 | /* SoC core supply, no device */ |
| 153 | REGULATOR_SUPPLY("v-intcore", NULL), |
Joe Perches | 7c9d440 | 2011-06-23 11:39:20 -0700 | [diff] [blame] | 154 | /* USB Transceiver */ |
Linus Walleij | d1de85a | 2010-12-02 17:10:14 +0100 | [diff] [blame] | 155 | REGULATOR_SUPPLY("vddulpivio18", "ab8500-usb.0"), |
| 156 | }; |
| 157 | |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame^] | 158 | static struct regulator_consumer_supply ab8505_usb_consumers[] = { |
| 159 | /* HS USB OTG physical interface */ |
| 160 | REGULATOR_SUPPLY("v-ape", NULL), |
| 161 | }; |
| 162 | |
Linus Walleij | d1de85a | 2010-12-02 17:10:14 +0100 | [diff] [blame] | 163 | static struct regulator_consumer_supply ab8500_vana_consumers[] = { |
| 164 | /* External displays, connector on board, 1v8 power supply */ |
| 165 | REGULATOR_SUPPLY("vsmps2", "mcde.0"), |
| 166 | }; |
Sundar Iyer | 4f724be | 2010-09-15 10:50:59 +0100 | [diff] [blame] | 167 | |
Bengt Jonsson | dfa3a82 | 2011-03-09 13:34:17 +0100 | [diff] [blame] | 168 | /* ab8500 regulator register initialization */ |
Bengt Jonsson | 732805a | 2013-03-21 15:59:03 +0000 | [diff] [blame] | 169 | static struct ab8500_regulator_reg_init ab8500_reg_init[] = { |
Bengt Jonsson | dfa3a82 | 2011-03-09 13:34:17 +0100 | [diff] [blame] | 170 | /* |
| 171 | * VanaRequestCtrl = HP/LP depending on VxRequest |
| 172 | * VextSupply1RequestCtrl = HP/LP depending on VxRequest |
| 173 | */ |
Lee Jones | 43a5911 | 2013-03-21 15:59:15 +0000 | [diff] [blame] | 174 | INIT_REGULATOR_REGISTER(AB8500_REGUREQUESTCTRL2, 0xf0, 0x00), |
Bengt Jonsson | dfa3a82 | 2011-03-09 13:34:17 +0100 | [diff] [blame] | 175 | /* |
| 176 | * VextSupply2RequestCtrl = HP/LP depending on VxRequest |
| 177 | * VextSupply3RequestCtrl = HP/LP depending on VxRequest |
| 178 | * Vaux1RequestCtrl = HP/LP depending on VxRequest |
| 179 | * Vaux2RequestCtrl = HP/LP depending on VxRequest |
| 180 | */ |
Lee Jones | 3c1b843 | 2013-03-21 15:59:01 +0000 | [diff] [blame] | 181 | INIT_REGULATOR_REGISTER(AB8500_REGUREQUESTCTRL3, 0xff, 0x00), |
Bengt Jonsson | dfa3a82 | 2011-03-09 13:34:17 +0100 | [diff] [blame] | 182 | /* |
| 183 | * Vaux3RequestCtrl = HP/LP depending on VxRequest |
| 184 | * SwHPReq = Control through SWValid disabled |
| 185 | */ |
Lee Jones | 3c1b843 | 2013-03-21 15:59:01 +0000 | [diff] [blame] | 186 | INIT_REGULATOR_REGISTER(AB8500_REGUREQUESTCTRL4, 0x07, 0x00), |
Bengt Jonsson | dfa3a82 | 2011-03-09 13:34:17 +0100 | [diff] [blame] | 187 | /* |
| 188 | * VanaSysClkReq1HPValid = disabled |
| 189 | * Vaux1SysClkReq1HPValid = disabled |
| 190 | * Vaux2SysClkReq1HPValid = disabled |
| 191 | * Vaux3SysClkReq1HPValid = disabled |
| 192 | */ |
Lee Jones | 43a5911 | 2013-03-21 15:59:15 +0000 | [diff] [blame] | 193 | INIT_REGULATOR_REGISTER(AB8500_REGUSYSCLKREQ1HPVALID1, 0xe8, 0x00), |
Bengt Jonsson | dfa3a82 | 2011-03-09 13:34:17 +0100 | [diff] [blame] | 194 | /* |
| 195 | * VextSupply1SysClkReq1HPValid = disabled |
| 196 | * VextSupply2SysClkReq1HPValid = disabled |
| 197 | * VextSupply3SysClkReq1HPValid = SysClkReq1 controlled |
| 198 | */ |
Lee Jones | 3c1b843 | 2013-03-21 15:59:01 +0000 | [diff] [blame] | 199 | INIT_REGULATOR_REGISTER(AB8500_REGUSYSCLKREQ1HPVALID2, 0x70, 0x40), |
Bengt Jonsson | dfa3a82 | 2011-03-09 13:34:17 +0100 | [diff] [blame] | 200 | /* |
| 201 | * VanaHwHPReq1Valid = disabled |
| 202 | * Vaux1HwHPreq1Valid = disabled |
| 203 | * Vaux2HwHPReq1Valid = disabled |
| 204 | * Vaux3HwHPReqValid = disabled |
| 205 | */ |
Lee Jones | 3c1b843 | 2013-03-21 15:59:01 +0000 | [diff] [blame] | 206 | INIT_REGULATOR_REGISTER(AB8500_REGUHWHPREQ1VALID1, 0xe8, 0x00), |
Bengt Jonsson | dfa3a82 | 2011-03-09 13:34:17 +0100 | [diff] [blame] | 207 | /* |
| 208 | * VextSupply1HwHPReq1Valid = disabled |
| 209 | * VextSupply2HwHPReq1Valid = disabled |
| 210 | * VextSupply3HwHPReq1Valid = disabled |
| 211 | */ |
Lee Jones | 3c1b843 | 2013-03-21 15:59:01 +0000 | [diff] [blame] | 212 | INIT_REGULATOR_REGISTER(AB8500_REGUHWHPREQ1VALID2, 0x07, 0x00), |
Bengt Jonsson | dfa3a82 | 2011-03-09 13:34:17 +0100 | [diff] [blame] | 213 | /* |
| 214 | * VanaHwHPReq2Valid = disabled |
| 215 | * Vaux1HwHPReq2Valid = disabled |
| 216 | * Vaux2HwHPReq2Valid = disabled |
| 217 | * Vaux3HwHPReq2Valid = disabled |
| 218 | */ |
Lee Jones | 3c1b843 | 2013-03-21 15:59:01 +0000 | [diff] [blame] | 219 | INIT_REGULATOR_REGISTER(AB8500_REGUHWHPREQ2VALID1, 0xe8, 0x00), |
Bengt Jonsson | dfa3a82 | 2011-03-09 13:34:17 +0100 | [diff] [blame] | 220 | /* |
| 221 | * VextSupply1HwHPReq2Valid = disabled |
| 222 | * VextSupply2HwHPReq2Valid = disabled |
| 223 | * VextSupply3HwHPReq2Valid = HWReq2 controlled |
| 224 | */ |
Lee Jones | 3c1b843 | 2013-03-21 15:59:01 +0000 | [diff] [blame] | 225 | INIT_REGULATOR_REGISTER(AB8500_REGUHWHPREQ2VALID2, 0x07, 0x04), |
Bengt Jonsson | dfa3a82 | 2011-03-09 13:34:17 +0100 | [diff] [blame] | 226 | /* |
| 227 | * VanaSwHPReqValid = disabled |
| 228 | * Vaux1SwHPReqValid = disabled |
| 229 | */ |
Lee Jones | 3c1b843 | 2013-03-21 15:59:01 +0000 | [diff] [blame] | 230 | INIT_REGULATOR_REGISTER(AB8500_REGUSWHPREQVALID1, 0xa0, 0x00), |
Bengt Jonsson | dfa3a82 | 2011-03-09 13:34:17 +0100 | [diff] [blame] | 231 | /* |
| 232 | * Vaux2SwHPReqValid = disabled |
| 233 | * Vaux3SwHPReqValid = disabled |
| 234 | * VextSupply1SwHPReqValid = disabled |
| 235 | * VextSupply2SwHPReqValid = disabled |
| 236 | * VextSupply3SwHPReqValid = disabled |
| 237 | */ |
Lee Jones | 3c1b843 | 2013-03-21 15:59:01 +0000 | [diff] [blame] | 238 | INIT_REGULATOR_REGISTER(AB8500_REGUSWHPREQVALID2, 0x1f, 0x00), |
Bengt Jonsson | dfa3a82 | 2011-03-09 13:34:17 +0100 | [diff] [blame] | 239 | /* |
| 240 | * SysClkReq2Valid1 = SysClkReq2 controlled |
| 241 | * SysClkReq3Valid1 = disabled |
| 242 | * SysClkReq4Valid1 = SysClkReq4 controlled |
| 243 | * SysClkReq5Valid1 = disabled |
| 244 | * SysClkReq6Valid1 = SysClkReq6 controlled |
| 245 | * SysClkReq7Valid1 = disabled |
| 246 | * SysClkReq8Valid1 = disabled |
| 247 | */ |
Lee Jones | 3c1b843 | 2013-03-21 15:59:01 +0000 | [diff] [blame] | 248 | INIT_REGULATOR_REGISTER(AB8500_REGUSYSCLKREQVALID1, 0xfe, 0x2a), |
Bengt Jonsson | dfa3a82 | 2011-03-09 13:34:17 +0100 | [diff] [blame] | 249 | /* |
| 250 | * SysClkReq2Valid2 = disabled |
| 251 | * SysClkReq3Valid2 = disabled |
| 252 | * SysClkReq4Valid2 = disabled |
| 253 | * SysClkReq5Valid2 = disabled |
| 254 | * SysClkReq6Valid2 = SysClkReq6 controlled |
| 255 | * SysClkReq7Valid2 = disabled |
| 256 | * SysClkReq8Valid2 = disabled |
| 257 | */ |
Lee Jones | 3c1b843 | 2013-03-21 15:59:01 +0000 | [diff] [blame] | 258 | INIT_REGULATOR_REGISTER(AB8500_REGUSYSCLKREQVALID2, 0xfe, 0x20), |
Bengt Jonsson | dfa3a82 | 2011-03-09 13:34:17 +0100 | [diff] [blame] | 259 | /* |
| 260 | * VTVoutEna = disabled |
| 261 | * Vintcore12Ena = disabled |
| 262 | * Vintcore12Sel = 1.25 V |
| 263 | * Vintcore12LP = inactive (HP) |
| 264 | * VTVoutLP = inactive (HP) |
| 265 | */ |
Lee Jones | 3c1b843 | 2013-03-21 15:59:01 +0000 | [diff] [blame] | 266 | INIT_REGULATOR_REGISTER(AB8500_REGUMISC1, 0xfe, 0x10), |
Bengt Jonsson | dfa3a82 | 2011-03-09 13:34:17 +0100 | [diff] [blame] | 267 | /* |
| 268 | * VaudioEna = disabled |
| 269 | * VdmicEna = disabled |
| 270 | * Vamic1Ena = disabled |
| 271 | * Vamic2Ena = disabled |
| 272 | */ |
Lee Jones | 3c1b843 | 2013-03-21 15:59:01 +0000 | [diff] [blame] | 273 | INIT_REGULATOR_REGISTER(AB8500_VAUDIOSUPPLY, 0x1e, 0x00), |
Bengt Jonsson | dfa3a82 | 2011-03-09 13:34:17 +0100 | [diff] [blame] | 274 | /* |
| 275 | * Vamic1_dzout = high-Z when Vamic1 is disabled |
| 276 | * Vamic2_dzout = high-Z when Vamic2 is disabled |
| 277 | */ |
Lee Jones | 3c1b843 | 2013-03-21 15:59:01 +0000 | [diff] [blame] | 278 | INIT_REGULATOR_REGISTER(AB8500_REGUCTRL1VAMIC, 0x03, 0x00), |
Bengt Jonsson | dfa3a82 | 2011-03-09 13:34:17 +0100 | [diff] [blame] | 279 | /* |
Lee Jones | 43a5911 | 2013-03-21 15:59:15 +0000 | [diff] [blame] | 280 | * VPll = Hw controlled (NOTE! PRCMU bits) |
Bengt Jonsson | dfa3a82 | 2011-03-09 13:34:17 +0100 | [diff] [blame] | 281 | * VanaRegu = force off |
| 282 | */ |
Lee Jones | 3c1b843 | 2013-03-21 15:59:01 +0000 | [diff] [blame] | 283 | INIT_REGULATOR_REGISTER(AB8500_VPLLVANAREGU, 0x0f, 0x02), |
Bengt Jonsson | dfa3a82 | 2011-03-09 13:34:17 +0100 | [diff] [blame] | 284 | /* |
| 285 | * VrefDDREna = disabled |
| 286 | * VrefDDRSleepMode = inactive (no pulldown) |
| 287 | */ |
Lee Jones | 3c1b843 | 2013-03-21 15:59:01 +0000 | [diff] [blame] | 288 | INIT_REGULATOR_REGISTER(AB8500_VREFDDR, 0x03, 0x00), |
Bengt Jonsson | dfa3a82 | 2011-03-09 13:34:17 +0100 | [diff] [blame] | 289 | /* |
Lee Jones | a387ac5 | 2013-03-28 16:11:02 +0000 | [diff] [blame] | 290 | * VextSupply1Regu = force LP |
| 291 | * VextSupply2Regu = force OFF |
| 292 | * VextSupply3Regu = force HP (-> STBB2=LP and TPS=LP) |
Bengt Jonsson | dfa3a82 | 2011-03-09 13:34:17 +0100 | [diff] [blame] | 293 | * ExtSupply2Bypass = ExtSupply12LPn ball is 0 when Ena is 0 |
| 294 | * ExtSupply3Bypass = ExtSupply3LPn ball is 0 when Ena is 0 |
| 295 | */ |
Lee Jones | a387ac5 | 2013-03-28 16:11:02 +0000 | [diff] [blame] | 296 | INIT_REGULATOR_REGISTER(AB8500_EXTSUPPLYREGU, 0xff, 0x13), |
Bengt Jonsson | dfa3a82 | 2011-03-09 13:34:17 +0100 | [diff] [blame] | 297 | /* |
| 298 | * Vaux1Regu = force HP |
| 299 | * Vaux2Regu = force off |
| 300 | */ |
Lee Jones | 3c1b843 | 2013-03-21 15:59:01 +0000 | [diff] [blame] | 301 | INIT_REGULATOR_REGISTER(AB8500_VAUX12REGU, 0x0f, 0x01), |
Bengt Jonsson | dfa3a82 | 2011-03-09 13:34:17 +0100 | [diff] [blame] | 302 | /* |
Lee Jones | d79df32 | 2013-03-21 15:58:58 +0000 | [diff] [blame] | 303 | * Vaux3Regu = force off |
Bengt Jonsson | dfa3a82 | 2011-03-09 13:34:17 +0100 | [diff] [blame] | 304 | */ |
Lee Jones | 43a5911 | 2013-03-21 15:59:15 +0000 | [diff] [blame] | 305 | INIT_REGULATOR_REGISTER(AB8500_VRF1VAUX3REGU, 0x03, 0x00), |
Bengt Jonsson | dfa3a82 | 2011-03-09 13:34:17 +0100 | [diff] [blame] | 306 | /* |
| 307 | * Vaux1Sel = 2.5 V |
| 308 | */ |
Lee Jones | 3c1b843 | 2013-03-21 15:59:01 +0000 | [diff] [blame] | 309 | INIT_REGULATOR_REGISTER(AB8500_VAUX1SEL, 0x0f, 0x08), |
Bengt Jonsson | dfa3a82 | 2011-03-09 13:34:17 +0100 | [diff] [blame] | 310 | /* |
| 311 | * Vaux2Sel = 2.9 V |
| 312 | */ |
Lee Jones | 3c1b843 | 2013-03-21 15:59:01 +0000 | [diff] [blame] | 313 | INIT_REGULATOR_REGISTER(AB8500_VAUX2SEL, 0x0f, 0x0d), |
Bengt Jonsson | dfa3a82 | 2011-03-09 13:34:17 +0100 | [diff] [blame] | 314 | /* |
| 315 | * Vaux3Sel = 2.91 V |
| 316 | */ |
Lee Jones | 3c1b843 | 2013-03-21 15:59:01 +0000 | [diff] [blame] | 317 | INIT_REGULATOR_REGISTER(AB8500_VRF1VAUX3SEL, 0x07, 0x07), |
Bengt Jonsson | dfa3a82 | 2011-03-09 13:34:17 +0100 | [diff] [blame] | 318 | /* |
| 319 | * VextSupply12LP = disabled (no LP) |
| 320 | */ |
Lee Jones | 3c1b843 | 2013-03-21 15:59:01 +0000 | [diff] [blame] | 321 | INIT_REGULATOR_REGISTER(AB8500_REGUCTRL2SPARE, 0x01, 0x00), |
Bengt Jonsson | dfa3a82 | 2011-03-09 13:34:17 +0100 | [diff] [blame] | 322 | /* |
| 323 | * Vaux1Disch = short discharge time |
| 324 | * Vaux2Disch = short discharge time |
| 325 | * Vaux3Disch = short discharge time |
| 326 | * Vintcore12Disch = short discharge time |
| 327 | * VTVoutDisch = short discharge time |
| 328 | * VaudioDisch = short discharge time |
| 329 | */ |
Lee Jones | 3c1b843 | 2013-03-21 15:59:01 +0000 | [diff] [blame] | 330 | INIT_REGULATOR_REGISTER(AB8500_REGUCTRLDISCH, 0xfc, 0x00), |
Bengt Jonsson | dfa3a82 | 2011-03-09 13:34:17 +0100 | [diff] [blame] | 331 | /* |
| 332 | * VanaDisch = short discharge time |
| 333 | * VdmicPullDownEna = pulldown disabled when Vdmic is disabled |
| 334 | * VdmicDisch = short discharge time |
| 335 | */ |
Lee Jones | 3c1b843 | 2013-03-21 15:59:01 +0000 | [diff] [blame] | 336 | INIT_REGULATOR_REGISTER(AB8500_REGUCTRLDISCH2, 0x16, 0x00), |
Bengt Jonsson | dfa3a82 | 2011-03-09 13:34:17 +0100 | [diff] [blame] | 337 | }; |
| 338 | |
Bengt Jonsson | a1e516e | 2010-12-10 11:08:48 +0100 | [diff] [blame] | 339 | /* AB8500 regulators */ |
Bengt Jonsson | 732805a | 2013-03-21 15:59:03 +0000 | [diff] [blame] | 340 | static struct regulator_init_data ab8500_regulators[AB8500_NUM_REGULATORS] = { |
Bengt Jonsson | a1e516e | 2010-12-10 11:08:48 +0100 | [diff] [blame] | 341 | /* supplies to the display/camera */ |
| 342 | [AB8500_LDO_AUX1] = { |
| 343 | .constraints = { |
| 344 | .name = "V-DISPLAY", |
| 345 | .min_uV = 2500000, |
| 346 | .max_uV = 2900000, |
| 347 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | |
| 348 | REGULATOR_CHANGE_STATUS, |
Linus Walleij | db24520 | 2011-04-04 10:44:51 +0200 | [diff] [blame] | 349 | .boot_on = 1, /* display is on at boot */ |
| 350 | /* |
| 351 | * This voltage cannot be disabled right now because |
| 352 | * it is somehow affecting the external MMC |
| 353 | * functionality, though that typically will use |
| 354 | * AUX3. |
| 355 | */ |
| 356 | .always_on = 1, |
Bengt Jonsson | a1e516e | 2010-12-10 11:08:48 +0100 | [diff] [blame] | 357 | }, |
Linus Walleij | d1de85a | 2010-12-02 17:10:14 +0100 | [diff] [blame] | 358 | .num_consumer_supplies = ARRAY_SIZE(ab8500_vaux1_consumers), |
| 359 | .consumer_supplies = ab8500_vaux1_consumers, |
Bengt Jonsson | a1e516e | 2010-12-10 11:08:48 +0100 | [diff] [blame] | 360 | }, |
| 361 | /* supplies to the on-board eMMC */ |
| 362 | [AB8500_LDO_AUX2] = { |
| 363 | .constraints = { |
| 364 | .name = "V-eMMC1", |
| 365 | .min_uV = 1100000, |
| 366 | .max_uV = 3300000, |
| 367 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | |
| 368 | REGULATOR_CHANGE_STATUS, |
| 369 | }, |
Linus Walleij | d1de85a | 2010-12-02 17:10:14 +0100 | [diff] [blame] | 370 | .num_consumer_supplies = ARRAY_SIZE(ab8500_vaux2_consumers), |
| 371 | .consumer_supplies = ab8500_vaux2_consumers, |
Bengt Jonsson | a1e516e | 2010-12-10 11:08:48 +0100 | [diff] [blame] | 372 | }, |
| 373 | /* supply for VAUX3, supplies to SDcard slots */ |
| 374 | [AB8500_LDO_AUX3] = { |
| 375 | .constraints = { |
| 376 | .name = "V-MMC-SD", |
| 377 | .min_uV = 1100000, |
| 378 | .max_uV = 3300000, |
| 379 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | |
| 380 | REGULATOR_CHANGE_STATUS, |
| 381 | }, |
Linus Walleij | d1de85a | 2010-12-02 17:10:14 +0100 | [diff] [blame] | 382 | .num_consumer_supplies = ARRAY_SIZE(ab8500_vaux3_consumers), |
| 383 | .consumer_supplies = ab8500_vaux3_consumers, |
Bengt Jonsson | a1e516e | 2010-12-10 11:08:48 +0100 | [diff] [blame] | 384 | }, |
| 385 | /* supply for tvout, gpadc, TVOUT LDO */ |
| 386 | [AB8500_LDO_TVOUT] = { |
| 387 | .constraints = { |
| 388 | .name = "V-TVOUT", |
| 389 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, |
| 390 | }, |
Linus Walleij | d1de85a | 2010-12-02 17:10:14 +0100 | [diff] [blame] | 391 | .num_consumer_supplies = ARRAY_SIZE(ab8500_vtvout_consumers), |
| 392 | .consumer_supplies = ab8500_vtvout_consumers, |
Bengt Jonsson | a1e516e | 2010-12-10 11:08:48 +0100 | [diff] [blame] | 393 | }, |
| 394 | /* supply for ab8500-vaudio, VAUDIO LDO */ |
| 395 | [AB8500_LDO_AUDIO] = { |
| 396 | .constraints = { |
| 397 | .name = "V-AUD", |
| 398 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, |
| 399 | }, |
Ola Lilja | 29bd2ab | 2012-02-01 14:18:10 +0100 | [diff] [blame] | 400 | .num_consumer_supplies = ARRAY_SIZE(ab8500_vaud_consumers), |
| 401 | .consumer_supplies = ab8500_vaud_consumers, |
Bengt Jonsson | a1e516e | 2010-12-10 11:08:48 +0100 | [diff] [blame] | 402 | }, |
| 403 | /* supply for v-anamic1 VAMic1-LDO */ |
| 404 | [AB8500_LDO_ANAMIC1] = { |
| 405 | .constraints = { |
| 406 | .name = "V-AMIC1", |
| 407 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, |
| 408 | }, |
Ola Lilja | 29bd2ab | 2012-02-01 14:18:10 +0100 | [diff] [blame] | 409 | .num_consumer_supplies = ARRAY_SIZE(ab8500_vamic1_consumers), |
| 410 | .consumer_supplies = ab8500_vamic1_consumers, |
Bengt Jonsson | a1e516e | 2010-12-10 11:08:48 +0100 | [diff] [blame] | 411 | }, |
| 412 | /* supply for v-amic2, VAMIC2 LDO, reuse constants for AMIC1 */ |
| 413 | [AB8500_LDO_ANAMIC2] = { |
| 414 | .constraints = { |
| 415 | .name = "V-AMIC2", |
| 416 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, |
| 417 | }, |
Ola Lilja | 29bd2ab | 2012-02-01 14:18:10 +0100 | [diff] [blame] | 418 | .num_consumer_supplies = ARRAY_SIZE(ab8500_vamic2_consumers), |
| 419 | .consumer_supplies = ab8500_vamic2_consumers, |
Bengt Jonsson | a1e516e | 2010-12-10 11:08:48 +0100 | [diff] [blame] | 420 | }, |
| 421 | /* supply for v-dmic, VDMIC LDO */ |
| 422 | [AB8500_LDO_DMIC] = { |
| 423 | .constraints = { |
| 424 | .name = "V-DMIC", |
| 425 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, |
| 426 | }, |
Ola Lilja | 29bd2ab | 2012-02-01 14:18:10 +0100 | [diff] [blame] | 427 | .num_consumer_supplies = ARRAY_SIZE(ab8500_vdmic_consumers), |
| 428 | .consumer_supplies = ab8500_vdmic_consumers, |
Bengt Jonsson | a1e516e | 2010-12-10 11:08:48 +0100 | [diff] [blame] | 429 | }, |
| 430 | /* supply for v-intcore12, VINTCORE12 LDO */ |
| 431 | [AB8500_LDO_INTCORE] = { |
| 432 | .constraints = { |
| 433 | .name = "V-INTCORE", |
| 434 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, |
| 435 | }, |
Linus Walleij | d1de85a | 2010-12-02 17:10:14 +0100 | [diff] [blame] | 436 | .num_consumer_supplies = ARRAY_SIZE(ab8500_vintcore_consumers), |
| 437 | .consumer_supplies = ab8500_vintcore_consumers, |
Bengt Jonsson | a1e516e | 2010-12-10 11:08:48 +0100 | [diff] [blame] | 438 | }, |
| 439 | /* supply for U8500 CSI/DSI, VANA LDO */ |
| 440 | [AB8500_LDO_ANA] = { |
| 441 | .constraints = { |
| 442 | .name = "V-CSI/DSI", |
| 443 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, |
| 444 | }, |
Linus Walleij | d1de85a | 2010-12-02 17:10:14 +0100 | [diff] [blame] | 445 | .num_consumer_supplies = ARRAY_SIZE(ab8500_vana_consumers), |
| 446 | .consumer_supplies = ab8500_vana_consumers, |
Sundar Iyer | 4f724be | 2010-09-15 10:50:59 +0100 | [diff] [blame] | 447 | }, |
| 448 | }; |
Bengt Jonsson | 732805a | 2013-03-21 15:59:03 +0000 | [diff] [blame] | 449 | |
Lee Jones | a387ac5 | 2013-03-28 16:11:02 +0000 | [diff] [blame] | 450 | /* supply for VextSupply3 */ |
| 451 | static struct regulator_consumer_supply ab8500_ext_supply3_consumers[] = { |
| 452 | /* SIM supply for 3 V SIM cards */ |
| 453 | REGULATOR_SUPPLY("vinvsim", "sim-detect.0"), |
| 454 | }; |
| 455 | |
| 456 | /* extended configuration for VextSupply2, only used for HREFP_V20 boards */ |
| 457 | static struct ab8500_ext_regulator_cfg ab8500_ext_supply2 = { |
| 458 | .hwreq = true, |
| 459 | }; |
| 460 | |
| 461 | /* |
| 462 | * AB8500 external regulators |
| 463 | */ |
| 464 | static struct regulator_init_data ab8500_ext_regulators[] = { |
| 465 | /* fixed Vbat supplies VSMPS1_EXT_1V8 */ |
| 466 | [AB8500_EXT_SUPPLY1] = { |
| 467 | .constraints = { |
| 468 | .name = "ab8500-ext-supply1", |
| 469 | .min_uV = 1800000, |
| 470 | .max_uV = 1800000, |
| 471 | .initial_mode = REGULATOR_MODE_IDLE, |
| 472 | .boot_on = 1, |
| 473 | .always_on = 1, |
| 474 | }, |
| 475 | }, |
| 476 | /* fixed Vbat supplies VSMPS2_EXT_1V36 and VSMPS5_EXT_1V15 */ |
| 477 | [AB8500_EXT_SUPPLY2] = { |
| 478 | .constraints = { |
| 479 | .name = "ab8500-ext-supply2", |
| 480 | .min_uV = 1360000, |
| 481 | .max_uV = 1360000, |
| 482 | }, |
| 483 | }, |
| 484 | /* fixed Vbat supplies VSMPS3_EXT_3V4 and VSMPS4_EXT_3V4 */ |
| 485 | [AB8500_EXT_SUPPLY3] = { |
| 486 | .constraints = { |
| 487 | .name = "ab8500-ext-supply3", |
| 488 | .min_uV = 3400000, |
| 489 | .max_uV = 3400000, |
| 490 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, |
| 491 | .boot_on = 1, |
| 492 | }, |
| 493 | .num_consumer_supplies = |
| 494 | ARRAY_SIZE(ab8500_ext_supply3_consumers), |
| 495 | .consumer_supplies = ab8500_ext_supply3_consumers, |
| 496 | }, |
| 497 | }; |
| 498 | |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame^] | 499 | /* ab8505 regulator register initialization */ |
| 500 | static struct ab8500_regulator_reg_init ab8505_reg_init[] = { |
| 501 | /* |
| 502 | * VarmRequestCtrl |
| 503 | * VsmpsCRequestCtrl |
| 504 | * VsmpsARequestCtrl |
| 505 | * VsmpsBRequestCtrl |
| 506 | */ |
| 507 | INIT_REGULATOR_REGISTER(AB8505_REGUREQUESTCTRL1, 0x00, 0x00), |
| 508 | /* |
| 509 | * VsafeRequestCtrl |
| 510 | * VpllRequestCtrl |
| 511 | * VanaRequestCtrl = HP/LP depending on VxRequest |
| 512 | */ |
| 513 | INIT_REGULATOR_REGISTER(AB8505_REGUREQUESTCTRL2, 0x30, 0x00), |
| 514 | /* |
| 515 | * Vaux1RequestCtrl = HP/LP depending on VxRequest |
| 516 | * Vaux2RequestCtrl = HP/LP depending on VxRequest |
| 517 | */ |
| 518 | INIT_REGULATOR_REGISTER(AB8505_REGUREQUESTCTRL3, 0xf0, 0x00), |
| 519 | /* |
| 520 | * Vaux3RequestCtrl = HP/LP depending on VxRequest |
| 521 | * SwHPReq = Control through SWValid disabled |
| 522 | */ |
| 523 | INIT_REGULATOR_REGISTER(AB8505_REGUREQUESTCTRL4, 0x07, 0x00), |
| 524 | /* |
| 525 | * VsmpsASysClkReq1HPValid |
| 526 | * VsmpsBSysClkReq1HPValid |
| 527 | * VsafeSysClkReq1HPValid |
| 528 | * VanaSysClkReq1HPValid = disabled |
| 529 | * VpllSysClkReq1HPValid |
| 530 | * Vaux1SysClkReq1HPValid = disabled |
| 531 | * Vaux2SysClkReq1HPValid = disabled |
| 532 | * Vaux3SysClkReq1HPValid = disabled |
| 533 | */ |
| 534 | INIT_REGULATOR_REGISTER(AB8505_REGUSYSCLKREQ1HPVALID1, 0xe8, 0x00), |
| 535 | /* |
| 536 | * VsmpsCSysClkReq1HPValid |
| 537 | * VarmSysClkReq1HPValid |
| 538 | * VbbSysClkReq1HPValid |
| 539 | * VsmpsMSysClkReq1HPValid |
| 540 | */ |
| 541 | INIT_REGULATOR_REGISTER(AB8505_REGUSYSCLKREQ1HPVALID2, 0x00, 0x00), |
| 542 | /* |
| 543 | * VsmpsAHwHPReq1Valid |
| 544 | * VsmpsBHwHPReq1Valid |
| 545 | * VsafeHwHPReq1Valid |
| 546 | * VanaHwHPReq1Valid = disabled |
| 547 | * VpllHwHPReq1Valid |
| 548 | * Vaux1HwHPreq1Valid = disabled |
| 549 | * Vaux2HwHPReq1Valid = disabled |
| 550 | * Vaux3HwHPReqValid = disabled |
| 551 | */ |
| 552 | INIT_REGULATOR_REGISTER(AB8505_REGUHWHPREQ1VALID1, 0xe8, 0x00), |
| 553 | /* |
| 554 | * VsmpsMHwHPReq1Valid |
| 555 | */ |
| 556 | INIT_REGULATOR_REGISTER(AB8505_REGUHWHPREQ1VALID2, 0x00, 0x00), |
| 557 | /* |
| 558 | * VsmpsAHwHPReq2Valid |
| 559 | * VsmpsBHwHPReq2Valid |
| 560 | * VsafeHwHPReq2Valid |
| 561 | * VanaHwHPReq2Valid = disabled |
| 562 | * VpllHwHPReq2Valid |
| 563 | * Vaux1HwHPReq2Valid = disabled |
| 564 | * Vaux2HwHPReq2Valid = disabled |
| 565 | * Vaux3HwHPReq2Valid = disabled |
| 566 | */ |
| 567 | INIT_REGULATOR_REGISTER(AB8505_REGUHWHPREQ2VALID1, 0xe8, 0x00), |
| 568 | /* |
| 569 | * VsmpsMHwHPReq2Valid |
| 570 | */ |
| 571 | INIT_REGULATOR_REGISTER(AB8505_REGUHWHPREQ2VALID2, 0x00, 0x00), |
| 572 | /** |
| 573 | * VsmpsCSwHPReqValid |
| 574 | * VarmSwHPReqValid |
| 575 | * VsmpsASwHPReqValid |
| 576 | * VsmpsBSwHPReqValid |
| 577 | * VsafeSwHPReqValid |
| 578 | * VanaSwHPReqValid |
| 579 | * VanaSwHPReqValid = disabled |
| 580 | * VpllSwHPReqValid |
| 581 | * Vaux1SwHPReqValid = disabled |
| 582 | */ |
| 583 | INIT_REGULATOR_REGISTER(AB8505_REGUSWHPREQVALID1, 0xa0, 0x00), |
| 584 | /* |
| 585 | * Vaux2SwHPReqValid = disabled |
| 586 | * Vaux3SwHPReqValid = disabled |
| 587 | * VsmpsMSwHPReqValid |
| 588 | */ |
| 589 | INIT_REGULATOR_REGISTER(AB8505_REGUSWHPREQVALID2, 0x03, 0x00), |
| 590 | /* |
| 591 | * SysClkReq2Valid1 = SysClkReq2 controlled |
| 592 | * SysClkReq3Valid1 = disabled |
| 593 | * SysClkReq4Valid1 = SysClkReq4 controlled |
| 594 | */ |
| 595 | INIT_REGULATOR_REGISTER(AB8505_REGUSYSCLKREQVALID1, 0x0e, 0x0a), |
| 596 | /* |
| 597 | * SysClkReq2Valid2 = disabled |
| 598 | * SysClkReq3Valid2 = disabled |
| 599 | * SysClkReq4Valid2 = disabled |
| 600 | */ |
| 601 | INIT_REGULATOR_REGISTER(AB8505_REGUSYSCLKREQVALID2, 0x0e, 0x00), |
| 602 | /* |
| 603 | * Vaux4SwHPReqValid |
| 604 | * Vaux4HwHPReq2Valid |
| 605 | * Vaux4HwHPReq1Valid |
| 606 | * Vaux4SysClkReq1HPValid |
| 607 | */ |
| 608 | INIT_REGULATOR_REGISTER(AB8505_REGUVAUX4REQVALID, 0x00, 0x00), |
| 609 | /* |
| 610 | * VadcEna = disabled |
| 611 | * VintCore12Ena = disabled |
| 612 | * VintCore12Sel = 1.25 V |
| 613 | * VintCore12LP = inactive (HP) |
| 614 | * VadcLP = inactive (HP) |
| 615 | */ |
| 616 | INIT_REGULATOR_REGISTER(AB8505_REGUMISC1, 0xfe, 0x10), |
| 617 | /* |
| 618 | * VaudioEna = disabled |
| 619 | * Vaux8Ena = disabled |
| 620 | * Vamic1Ena = disabled |
| 621 | * Vamic2Ena = disabled |
| 622 | */ |
| 623 | INIT_REGULATOR_REGISTER(AB8505_VAUDIOSUPPLY, 0x1e, 0x00), |
| 624 | /* |
| 625 | * Vamic1_dzout = high-Z when Vamic1 is disabled |
| 626 | * Vamic2_dzout = high-Z when Vamic2 is disabled |
| 627 | */ |
| 628 | INIT_REGULATOR_REGISTER(AB8505_REGUCTRL1VAMIC, 0x03, 0x00), |
| 629 | /* |
| 630 | * VsmpsARegu |
| 631 | * VsmpsASelCtrl |
| 632 | * VsmpsAAutoMode |
| 633 | * VsmpsAPWMMode |
| 634 | */ |
| 635 | INIT_REGULATOR_REGISTER(AB8505_VSMPSAREGU, 0x00, 0x00), |
| 636 | /* |
| 637 | * VsmpsBRegu |
| 638 | * VsmpsBSelCtrl |
| 639 | * VsmpsBAutoMode |
| 640 | * VsmpsBPWMMode |
| 641 | */ |
| 642 | INIT_REGULATOR_REGISTER(AB8505_VSMPSBREGU, 0x00, 0x00), |
| 643 | /* |
| 644 | * VsafeRegu |
| 645 | * VsafeSelCtrl |
| 646 | * VsafeAutoMode |
| 647 | * VsafePWMMode |
| 648 | */ |
| 649 | INIT_REGULATOR_REGISTER(AB8505_VSAFEREGU, 0x00, 0x00), |
| 650 | /* |
| 651 | * VPll = Hw controlled (NOTE! PRCMU bits) |
| 652 | * VanaRegu = force off |
| 653 | */ |
| 654 | INIT_REGULATOR_REGISTER(AB8505_VPLLVANAREGU, 0x0f, 0x02), |
| 655 | /* |
| 656 | * VextSupply1Regu = force OFF (OTP_ExtSupply12LPnPolarity 1) |
| 657 | * VextSupply2Regu = force OFF (OTP_ExtSupply12LPnPolarity 1) |
| 658 | * VextSupply3Regu = force OFF (OTP_ExtSupply3LPnPolarity 0) |
| 659 | * ExtSupply2Bypass = ExtSupply12LPn ball is 0 when Ena is 0 |
| 660 | * ExtSupply3Bypass = ExtSupply3LPn ball is 0 when Ena is 0 |
| 661 | */ |
| 662 | INIT_REGULATOR_REGISTER(AB8505_EXTSUPPLYREGU, 0xff, 0x30), |
| 663 | /* |
| 664 | * Vaux1Regu = force HP |
| 665 | * Vaux2Regu = force off |
| 666 | */ |
| 667 | INIT_REGULATOR_REGISTER(AB8505_VAUX12REGU, 0x0f, 0x01), |
| 668 | /* |
| 669 | * Vaux3Regu = force off |
| 670 | */ |
| 671 | INIT_REGULATOR_REGISTER(AB8505_VRF1VAUX3REGU, 0x03, 0x00), |
| 672 | /* |
| 673 | * VsmpsASel1 |
| 674 | */ |
| 675 | INIT_REGULATOR_REGISTER(AB8505_VSMPSASEL1, 0x00, 0x00), |
| 676 | /* |
| 677 | * VsmpsASel2 |
| 678 | */ |
| 679 | INIT_REGULATOR_REGISTER(AB8505_VSMPSASEL2, 0x00, 0x00), |
| 680 | /* |
| 681 | * VsmpsASel3 |
| 682 | */ |
| 683 | INIT_REGULATOR_REGISTER(AB8505_VSMPSASEL3, 0x00, 0x00), |
| 684 | /* |
| 685 | * VsmpsBSel1 |
| 686 | */ |
| 687 | INIT_REGULATOR_REGISTER(AB8505_VSMPSBSEL1, 0x00, 0x00), |
| 688 | /* |
| 689 | * VsmpsBSel2 |
| 690 | */ |
| 691 | INIT_REGULATOR_REGISTER(AB8505_VSMPSBSEL2, 0x00, 0x00), |
| 692 | /* |
| 693 | * VsmpsBSel3 |
| 694 | */ |
| 695 | INIT_REGULATOR_REGISTER(AB8505_VSMPSBSEL3, 0x00, 0x00), |
| 696 | /* |
| 697 | * VsafeSel1 |
| 698 | */ |
| 699 | INIT_REGULATOR_REGISTER(AB8505_VSAFESEL1, 0x00, 0x00), |
| 700 | /* |
| 701 | * VsafeSel2 |
| 702 | */ |
| 703 | INIT_REGULATOR_REGISTER(AB8505_VSAFESEL2, 0x00, 0x00), |
| 704 | /* |
| 705 | * VsafeSel3 |
| 706 | */ |
| 707 | INIT_REGULATOR_REGISTER(AB8505_VSAFESEL3, 0x00, 0x00), |
| 708 | /* |
| 709 | * Vaux1Sel = 2.8 V |
| 710 | */ |
| 711 | INIT_REGULATOR_REGISTER(AB8505_VAUX1SEL, 0x0f, 0x0C), |
| 712 | /* |
| 713 | * Vaux2Sel = 2.9 V |
| 714 | */ |
| 715 | INIT_REGULATOR_REGISTER(AB8505_VAUX2SEL, 0x0f, 0x0d), |
| 716 | /* |
| 717 | * Vaux3Sel = 2.91 V |
| 718 | */ |
| 719 | INIT_REGULATOR_REGISTER(AB8505_VRF1VAUX3SEL, 0x07, 0x07), |
| 720 | /* |
| 721 | * Vaux4RequestCtrl |
| 722 | */ |
| 723 | INIT_REGULATOR_REGISTER(AB8505_VAUX4REQCTRL, 0x00, 0x00), |
| 724 | /* |
| 725 | * Vaux4Regu |
| 726 | */ |
| 727 | INIT_REGULATOR_REGISTER(AB8505_VAUX4REGU, 0x00, 0x00), |
| 728 | /* |
| 729 | * Vaux4Sel |
| 730 | */ |
| 731 | INIT_REGULATOR_REGISTER(AB8505_VAUX4SEL, 0x00, 0x00), |
| 732 | /* |
| 733 | * Vaux1Disch = short discharge time |
| 734 | * Vaux2Disch = short discharge time |
| 735 | * Vaux3Disch = short discharge time |
| 736 | * Vintcore12Disch = short discharge time |
| 737 | * VTVoutDisch = short discharge time |
| 738 | * VaudioDisch = short discharge time |
| 739 | */ |
| 740 | INIT_REGULATOR_REGISTER(AB8505_REGUCTRLDISCH, 0xfc, 0x00), |
| 741 | /* |
| 742 | * VanaDisch = short discharge time |
| 743 | * Vaux8PullDownEna = pulldown disabled when Vaux8 is disabled |
| 744 | * Vaux8Disch = short discharge time |
| 745 | */ |
| 746 | INIT_REGULATOR_REGISTER(AB8505_REGUCTRLDISCH2, 0x16, 0x00), |
| 747 | /* |
| 748 | * Vaux4Disch = short discharge time |
| 749 | */ |
| 750 | INIT_REGULATOR_REGISTER(AB8505_REGUCTRLDISCH3, 0x01, 0x00), |
| 751 | /* |
| 752 | * Vaux5Sel |
| 753 | * Vaux5LP |
| 754 | * Vaux5Ena |
| 755 | * Vaux5Disch |
| 756 | * Vaux5DisSfst |
| 757 | * Vaux5DisPulld |
| 758 | */ |
| 759 | INIT_REGULATOR_REGISTER(AB8505_CTRLVAUX5, 0x00, 0x00), |
| 760 | /* |
| 761 | * Vaux6Sel |
| 762 | * Vaux6LP |
| 763 | * Vaux6Ena |
| 764 | * Vaux6DisPulld |
| 765 | */ |
| 766 | INIT_REGULATOR_REGISTER(AB8505_CTRLVAUX6, 0x00, 0x00), |
| 767 | }; |
| 768 | |
| 769 | struct regulator_init_data ab8505_regulators[AB8505_NUM_REGULATORS] = { |
| 770 | /* supplies to the display/camera */ |
| 771 | [AB8505_LDO_AUX1] = { |
| 772 | .constraints = { |
| 773 | .name = "V-DISPLAY", |
| 774 | .min_uV = 2800000, |
| 775 | .max_uV = 3300000, |
| 776 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | |
| 777 | REGULATOR_CHANGE_STATUS, |
| 778 | .boot_on = 1, /* display is on at boot */ |
| 779 | }, |
| 780 | .num_consumer_supplies = ARRAY_SIZE(ab8500_vaux1_consumers), |
| 781 | .consumer_supplies = ab8500_vaux1_consumers, |
| 782 | }, |
| 783 | /* supplies to the on-board eMMC */ |
| 784 | [AB8505_LDO_AUX2] = { |
| 785 | .constraints = { |
| 786 | .name = "V-eMMC1", |
| 787 | .min_uV = 1100000, |
| 788 | .max_uV = 3300000, |
| 789 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | |
| 790 | REGULATOR_CHANGE_STATUS | |
| 791 | REGULATOR_CHANGE_MODE, |
| 792 | .valid_modes_mask = REGULATOR_MODE_NORMAL | |
| 793 | REGULATOR_MODE_IDLE, |
| 794 | }, |
| 795 | .num_consumer_supplies = ARRAY_SIZE(ab8500_vaux2_consumers), |
| 796 | .consumer_supplies = ab8500_vaux2_consumers, |
| 797 | }, |
| 798 | /* supply for VAUX3, supplies to SDcard slots */ |
| 799 | [AB8505_LDO_AUX3] = { |
| 800 | .constraints = { |
| 801 | .name = "V-MMC-SD", |
| 802 | .min_uV = 1100000, |
| 803 | .max_uV = 3300000, |
| 804 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | |
| 805 | REGULATOR_CHANGE_STATUS | |
| 806 | REGULATOR_CHANGE_MODE, |
| 807 | .valid_modes_mask = REGULATOR_MODE_NORMAL | |
| 808 | REGULATOR_MODE_IDLE, |
| 809 | }, |
| 810 | .num_consumer_supplies = ARRAY_SIZE(ab8500_vaux3_consumers), |
| 811 | .consumer_supplies = ab8500_vaux3_consumers, |
| 812 | }, |
| 813 | /* supply for VAUX4, supplies to NFC and standalone secure element */ |
| 814 | [AB8505_LDO_AUX4] = { |
| 815 | .constraints = { |
| 816 | .name = "V-NFC-SE", |
| 817 | .min_uV = 1100000, |
| 818 | .max_uV = 3300000, |
| 819 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | |
| 820 | REGULATOR_CHANGE_STATUS | |
| 821 | REGULATOR_CHANGE_MODE, |
| 822 | .valid_modes_mask = REGULATOR_MODE_NORMAL | |
| 823 | REGULATOR_MODE_IDLE, |
| 824 | }, |
| 825 | .num_consumer_supplies = ARRAY_SIZE(ab8505_vaux4_consumers), |
| 826 | .consumer_supplies = ab8505_vaux4_consumers, |
| 827 | }, |
| 828 | /* supply for VAUX5, supplies to TBD */ |
| 829 | [AB8505_LDO_AUX5] = { |
| 830 | .constraints = { |
| 831 | .name = "V-AUX5", |
| 832 | .min_uV = 1050000, |
| 833 | .max_uV = 2790000, |
| 834 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | |
| 835 | REGULATOR_CHANGE_STATUS | |
| 836 | REGULATOR_CHANGE_MODE, |
| 837 | .valid_modes_mask = REGULATOR_MODE_NORMAL | |
| 838 | REGULATOR_MODE_IDLE, |
| 839 | }, |
| 840 | .num_consumer_supplies = ARRAY_SIZE(ab8505_vaux5_consumers), |
| 841 | .consumer_supplies = ab8505_vaux5_consumers, |
| 842 | }, |
| 843 | /* supply for VAUX6, supplies to TBD */ |
| 844 | [AB8505_LDO_AUX6] = { |
| 845 | .constraints = { |
| 846 | .name = "V-AUX6", |
| 847 | .min_uV = 1050000, |
| 848 | .max_uV = 2790000, |
| 849 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | |
| 850 | REGULATOR_CHANGE_STATUS | |
| 851 | REGULATOR_CHANGE_MODE, |
| 852 | .valid_modes_mask = REGULATOR_MODE_NORMAL | |
| 853 | REGULATOR_MODE_IDLE, |
| 854 | }, |
| 855 | .num_consumer_supplies = ARRAY_SIZE(ab8505_vaux6_consumers), |
| 856 | .consumer_supplies = ab8505_vaux6_consumers, |
| 857 | }, |
| 858 | /* supply for gpadc, ADC LDO */ |
| 859 | [AB8505_LDO_ADC] = { |
| 860 | .constraints = { |
| 861 | .name = "V-ADC", |
| 862 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, |
| 863 | }, |
| 864 | .num_consumer_supplies = ARRAY_SIZE(ab8505_vadc_consumers), |
| 865 | .consumer_supplies = ab8505_vadc_consumers, |
| 866 | }, |
| 867 | /* supply for ab8500-vaudio, VAUDIO LDO */ |
| 868 | [AB8505_LDO_AUDIO] = { |
| 869 | .constraints = { |
| 870 | .name = "V-AUD", |
| 871 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, |
| 872 | }, |
| 873 | .num_consumer_supplies = ARRAY_SIZE(ab8500_vaud_consumers), |
| 874 | .consumer_supplies = ab8500_vaud_consumers, |
| 875 | }, |
| 876 | /* supply for v-anamic1 VAMic1-LDO */ |
| 877 | [AB8505_LDO_ANAMIC1] = { |
| 878 | .constraints = { |
| 879 | .name = "V-AMIC1", |
| 880 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, |
| 881 | }, |
| 882 | .num_consumer_supplies = ARRAY_SIZE(ab8500_vamic1_consumers), |
| 883 | .consumer_supplies = ab8500_vamic1_consumers, |
| 884 | }, |
| 885 | /* supply for v-amic2, VAMIC2 LDO, reuse constants for AMIC1 */ |
| 886 | [AB8505_LDO_ANAMIC2] = { |
| 887 | .constraints = { |
| 888 | .name = "V-AMIC2", |
| 889 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, |
| 890 | }, |
| 891 | .num_consumer_supplies = ARRAY_SIZE(ab8500_vamic2_consumers), |
| 892 | .consumer_supplies = ab8500_vamic2_consumers, |
| 893 | }, |
| 894 | /* supply for v-aux8, VAUX8 LDO */ |
| 895 | [AB8505_LDO_AUX8] = { |
| 896 | .constraints = { |
| 897 | .name = "V-AUX8", |
| 898 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, |
| 899 | }, |
| 900 | .num_consumer_supplies = ARRAY_SIZE(ab8505_vaux8_consumers), |
| 901 | .consumer_supplies = ab8505_vaux8_consumers, |
| 902 | }, |
| 903 | /* supply for v-intcore12, VINTCORE12 LDO */ |
| 904 | [AB8505_LDO_INTCORE] = { |
| 905 | .constraints = { |
| 906 | .name = "V-INTCORE", |
| 907 | .min_uV = 1250000, |
| 908 | .max_uV = 1350000, |
| 909 | .input_uV = 1800000, |
| 910 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | |
| 911 | REGULATOR_CHANGE_STATUS | |
| 912 | REGULATOR_CHANGE_MODE | |
| 913 | REGULATOR_CHANGE_DRMS, |
| 914 | .valid_modes_mask = REGULATOR_MODE_NORMAL | |
| 915 | REGULATOR_MODE_IDLE, |
| 916 | }, |
| 917 | .num_consumer_supplies = ARRAY_SIZE(ab8500_vintcore_consumers), |
| 918 | .consumer_supplies = ab8500_vintcore_consumers, |
| 919 | }, |
| 920 | /* supply for LDO USB */ |
| 921 | [AB8505_LDO_USB] = { |
| 922 | .constraints = { |
| 923 | .name = "V-USB", |
| 924 | .valid_ops_mask = REGULATOR_CHANGE_STATUS | |
| 925 | REGULATOR_CHANGE_MODE, |
| 926 | .valid_modes_mask = REGULATOR_MODE_NORMAL | |
| 927 | REGULATOR_MODE_IDLE, |
| 928 | }, |
| 929 | .num_consumer_supplies = ARRAY_SIZE(ab8505_usb_consumers), |
| 930 | .consumer_supplies = ab8505_usb_consumers, |
| 931 | }, |
| 932 | /* supply for U8500 CSI-DSI, VANA LDO */ |
| 933 | [AB8505_LDO_ANA] = { |
| 934 | .constraints = { |
| 935 | .name = "V-CSI-DSI", |
| 936 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, |
| 937 | }, |
| 938 | .num_consumer_supplies = ARRAY_SIZE(ab8500_vana_consumers), |
| 939 | .consumer_supplies = ab8500_vana_consumers, |
| 940 | }, |
| 941 | }; |
| 942 | |
Bengt Jonsson | 732805a | 2013-03-21 15:59:03 +0000 | [diff] [blame] | 943 | struct ab8500_regulator_platform_data ab8500_regulator_plat_data = { |
| 944 | .reg_init = ab8500_reg_init, |
| 945 | .num_reg_init = ARRAY_SIZE(ab8500_reg_init), |
| 946 | .regulator = ab8500_regulators, |
| 947 | .num_regulator = ARRAY_SIZE(ab8500_regulators), |
Lee Jones | a387ac5 | 2013-03-28 16:11:02 +0000 | [diff] [blame] | 948 | .ext_regulator = ab8500_ext_regulators, |
| 949 | .num_ext_regulator = ARRAY_SIZE(ab8500_ext_regulators), |
Bengt Jonsson | 732805a | 2013-03-21 15:59:03 +0000 | [diff] [blame] | 950 | }; |
Lee Jones | a1d4948 | 2013-03-28 16:11:03 +0000 | [diff] [blame] | 951 | |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame^] | 952 | /* Use the AB8500 init settings for AB8505 as they are the same right now */ |
| 953 | struct ab8500_regulator_platform_data ab8505_regulator_plat_data = { |
| 954 | .reg_init = ab8505_reg_init, |
| 955 | .num_reg_init = ARRAY_SIZE(ab8505_reg_init), |
| 956 | .regulator = ab8505_regulators, |
| 957 | .num_regulator = ARRAY_SIZE(ab8505_regulators), |
| 958 | }; |
| 959 | |
Lee Jones | a1d4948 | 2013-03-28 16:11:03 +0000 | [diff] [blame] | 960 | static void ab8500_modify_reg_init(int id, u8 mask, u8 value) |
| 961 | { |
| 962 | int i; |
| 963 | |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame^] | 964 | if (cpu_is_u8520()) { |
| 965 | for (i = ARRAY_SIZE(ab8505_reg_init) - 1; i >= 0; i--) { |
| 966 | if (ab8505_reg_init[i].id == id) { |
| 967 | u8 initval = ab8505_reg_init[i].value; |
| 968 | initval = (initval & ~mask) | (value & mask); |
| 969 | ab8505_reg_init[i].value = initval; |
Lee Jones | a1d4948 | 2013-03-28 16:11:03 +0000 | [diff] [blame] | 970 | |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame^] | 971 | BUG_ON(mask & ~ab8505_reg_init[i].mask); |
| 972 | return; |
| 973 | } |
| 974 | } |
| 975 | } else { |
| 976 | for (i = ARRAY_SIZE(ab8500_reg_init) - 1; i >= 0; i--) { |
| 977 | if (ab8500_reg_init[i].id == id) { |
| 978 | u8 initval = ab8500_reg_init[i].value; |
| 979 | initval = (initval & ~mask) | (value & mask); |
| 980 | ab8500_reg_init[i].value = initval; |
| 981 | |
| 982 | BUG_ON(mask & ~ab8500_reg_init[i].mask); |
| 983 | return; |
| 984 | } |
Lee Jones | a1d4948 | 2013-03-28 16:11:03 +0000 | [diff] [blame] | 985 | } |
| 986 | } |
| 987 | |
| 988 | BUG_ON(1); |
| 989 | } |
Lee Jones | 422d765 | 2013-03-28 16:11:04 +0000 | [diff] [blame] | 990 | |
| 991 | void mop500_regulator_init(void) |
| 992 | { |
| 993 | struct regulator_init_data *regulator; |
| 994 | |
| 995 | /* |
| 996 | * Handle VextSupply1 on older boards than HREFP_V22_V1x |
| 997 | * (turn off in suspend) |
| 998 | */ |
| 999 | if (cpu_is_u8500v20() || cpu_is_u8500v21()) { |
| 1000 | /* disable VextSupply1 in suspend */ |
| 1001 | regulator = &ab8500_ext_regulators[AB8500_EXT_SUPPLY1]; |
| 1002 | regulator->constraints.state_mem.disabled = 1; |
| 1003 | regulator->constraints.state_standby.disabled = 1; |
| 1004 | } |
Lee Jones | e0c4468 | 2013-03-28 16:11:05 +0000 | [diff] [blame] | 1005 | |
Lee Jones | 547f384 | 2013-03-28 16:11:14 +0000 | [diff] [blame^] | 1006 | if (cpu_is_u8520()) { |
| 1007 | /* Vaux2 initialized to be on */ |
| 1008 | ab8500_modify_reg_init(AB8505_VAUX12REGU, 0x0f, 0x05); |
| 1009 | } |
| 1010 | |
Lee Jones | e0c4468 | 2013-03-28 16:11:05 +0000 | [diff] [blame] | 1011 | /* |
| 1012 | * Handle AB8500_EXT_SUPPLY2 on HREFP_V20_V50 boards (do it for |
| 1013 | * all HREFP_V20 boards) |
| 1014 | */ |
| 1015 | if (cpu_is_u8500v20()) { |
| 1016 | /* VextSupply2RequestCtrl = HP/OFF depending on VxRequest */ |
| 1017 | ab8500_modify_reg_init(AB8500_REGUREQUESTCTRL3, 0x01, 0x01); |
| 1018 | |
| 1019 | /* VextSupply2SysClkReq1HPValid = SysClkReq1 controlled */ |
| 1020 | ab8500_modify_reg_init(AB8500_REGUSYSCLKREQ1HPVALID2, |
| 1021 | 0x20, 0x20); |
| 1022 | |
| 1023 | /* VextSupply2 = force HP at initialization */ |
| 1024 | ab8500_modify_reg_init(AB8500_EXTSUPPLYREGU, 0x0c, 0x04); |
| 1025 | |
| 1026 | /* enable VextSupply2 during platform active */ |
| 1027 | regulator = &ab8500_ext_regulators[AB8500_EXT_SUPPLY2]; |
| 1028 | regulator->constraints.always_on = 1; |
| 1029 | |
| 1030 | /* disable VextSupply2 in suspend */ |
| 1031 | regulator = &ab8500_ext_regulators[AB8500_EXT_SUPPLY2]; |
| 1032 | regulator->constraints.state_mem.disabled = 1; |
| 1033 | regulator->constraints.state_standby.disabled = 1; |
| 1034 | |
| 1035 | /* enable VextSupply2 HW control (used in suspend) */ |
| 1036 | regulator->driver_data = (void *)&ab8500_ext_supply2; |
| 1037 | } |
Lee Jones | 422d765 | 2013-03-28 16:11:04 +0000 | [diff] [blame] | 1038 | } |