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