summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMian Yousaf Kaukab <mian.yousaf.kaukab@stericsson.com>2011-09-20 10:40:09 +0200
committerJonas ABERG <jonas.aberg@stericsson.com>2011-09-29 08:58:32 +0200
commitf0556f4b66a3e7bdeb67cd46431d1d6db6a47f3b (patch)
treefcd38cf4b487be0aeacab14f7a4f06afd751e476
parentd76ed1790418ece795b28625a7a1c0ce89af16b1 (diff)
regulator: restore ab8500 and db8500 regulators to linux-next state
State is restored to the following patch in linux-next tree: commit 4b8f00480cecabdffd80d7a7bf79a99508422666 Author: Linus Walleij <linus.walleij@linaro.org> Date: Mon Aug 29 14:49:49 2011 +0200 Merge branch 'mfd-prcmu' into next Change-Id: I603d50f61f99ccec89c1f6e32f7d95e6c925cb87 Signed-off-by: Mian Yousaf Kaukab <mian.yousaf.kaukab@stericsson.com> Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/32091 Reviewed-by: Jonas ABERG <jonas.aberg@stericsson.com> Tested-by: Jonas ABERG <jonas.aberg@stericsson.com>
-rw-r--r--arch/arm/mach-ux500/Kconfig6
-rw-r--r--arch/arm/mach-ux500/Makefile4
-rw-r--r--arch/arm/mach-ux500/board-mop500-regulators.c1082
-rw-r--r--arch/arm/mach-ux500/board-mop500-regulators.h28
-rw-r--r--arch/arm/mach-ux500/board-mop500.c49
-rw-r--r--arch/arm/mach-ux500/include/mach/regulator.h96
-rw-r--r--arch/arm/mach-ux500/pm/runtime.c2
-rw-r--r--arch/arm/mach-ux500/regulator-u8500.c265
-rw-r--r--arch/arm/mach-ux500/regulator-u8500.h46
-rw-r--r--arch/arm/mach-ux500/regulator-ux500.c562
-rw-r--r--arch/arm/mach-ux500/regulator-ux500.h39
-rw-r--r--arch/arm/mach-ux500/virt-regulator-u8500.c333
-rw-r--r--drivers/regulator/ab8500-debug.c1868
-rw-r--r--drivers/regulator/ab8500.c546
-rw-r--r--drivers/regulator/db8500-prcmu.c4
-rw-r--r--drivers/regulator/dbx500-prcmu.c97
-rw-r--r--drivers/regulator/dbx500-prcmu.h17
-rw-r--r--include/linux/regulator/ab8500-debug.h21
-rw-r--r--include/linux/regulator/ab8500.h26
-rw-r--r--include/linux/regulator/db8500-prcmu.h8
-rw-r--r--include/linux/regulator/dbx500-prcmu.h96
21 files changed, 290 insertions, 4905 deletions
diff --git a/arch/arm/mach-ux500/Kconfig b/arch/arm/mach-ux500/Kconfig
index 7da7b8d457d..697a4da87ef 100644
--- a/arch/arm/mach-ux500/Kconfig
+++ b/arch/arm/mach-ux500/Kconfig
@@ -80,12 +80,6 @@ config UX500_DEBUG_UART
Choose the UART on which kernel low-level debug messages should be
output.
-config U8500_REGULATOR_DEBUG
- bool "Regulator debug support"
- depends on REGULATOR_VIRTUAL_CONSUMER
- help
- Add support for U8500 regulator debug
-
config SENSORS1P_MOP
tristate "HAL and Proximity sensors support"
depends on REGULATOR && (GPIO_STMPE2401 || GPIO_TC35892)
diff --git a/arch/arm/mach-ux500/Makefile b/arch/arm/mach-ux500/Makefile
index 8d5d620ef4f..86eaa8444f1 100644
--- a/arch/arm/mach-ux500/Makefile
+++ b/arch/arm/mach-ux500/Makefile
@@ -8,7 +8,7 @@ obj-y := clock.o cpu.o devices.o dcache.o \
uart-db8500.o
obj-y += pm/
-obj-$(CONFIG_REGULATOR) += regulator-ux500.o
+
ifeq ($(CONFIG_UX500_SOC_DB5500), y)
obj-$(CONFIG_REGULATOR) += regulator-u5500.o
@@ -18,7 +18,7 @@ obj-$(CONFIG_UX500_SOC_DBX500) += cpu-db5500.o dma-db5500.o \
obj-$(CONFIG_TOUCHSCREEN_CYTTSP_SPI) += board-u5500-cyttsp.o
endif
ifeq ($(CONFIG_UX500_SOC_DB8500), y)
-obj-$(CONFIG_REGULATOR) += regulator-u8500.o
+
obj-$(CONFIG_UX500_SOC_DBX500) += cpu-db8500.o devices-db8500.o \
clock-db8500.o dma-db8500.o
endif
diff --git a/arch/arm/mach-ux500/board-mop500-regulators.c b/arch/arm/mach-ux500/board-mop500-regulators.c
index 92af82bec47..2735d03996c 100644
--- a/arch/arm/mach-ux500/board-mop500-regulators.c
+++ b/arch/arm/mach-ux500/board-mop500-regulators.c
@@ -1,102 +1,155 @@
/*
- * Copyright (C) STMicroelectronics 2009
* Copyright (C) ST-Ericsson SA 2010
*
* License Terms: GNU General Public License v2
*
- * Authors: Sundar Iyer <sundar.iyer@stericsson.com> for ST-Ericsson
- * Bengt Jonsson <bengt.g.jonsson@stericsson.com> for ST-Ericsson
+ * Authors: Sundar Iyer <sundar.iyer@stericsson.com>
+ * Bengt Jonsson <bengt.g.jonsson@stericsson.com>
*
* MOP500 board specific initialization for regulators
*/
-
-#include <linux/init.h>
-#include <linux/platform_device.h>
-#include <linux/amba/bus.h>
+#include <linux/kernel.h>
#include <linux/regulator/machine.h>
-
+#include <linux/regulator/ab8500.h>
#include "board-mop500-regulators.h"
-#include "board-mop500-mcde.h"
-
-#ifdef CONFIG_U8500_REGULATOR_DEBUG
-#define REGULATOR_SUPPLY_DEBUG REGULATOR_SUPPLY
-#else
-#define REGULATOR_SUPPLY_DEBUG(_name, _dev_name)
-#endif
/*
- * AB8500 Regulator Configuration
+ * TPS61052 regulator
*/
+static struct regulator_consumer_supply tps61052_vaudio_consumers[] = {
+ /*
+ * Boost converter supply to raise voltage on audio speaker, this
+ * is actually connected to three pins, VInVhfL (left amplifier)
+ * VInVhfR (right amplifier) and VIntDClassInt - all three must
+ * be connected to the same voltage.
+ */
+ REGULATOR_SUPPLY("vintdclassint", "ab8500-codec.0"),
+};
+
+struct regulator_init_data tps61052_regulator = {
+ .constraints = {
+ .name = "vaudio-hf",
+ .min_uV = 4500000,
+ .max_uV = 4500000,
+ .valid_ops_mask = REGULATOR_CHANGE_STATUS,
+ },
+ .num_consumer_supplies = ARRAY_SIZE(tps61052_vaudio_consumers),
+ .consumer_supplies = tps61052_vaudio_consumers,
+};
+
+static struct regulator_consumer_supply ab8500_vaux1_consumers[] = {
+ /* External displays, connector on board 2v5 power supply */
+ REGULATOR_SUPPLY("vaux12v5", "mcde.0"),
+ /* SFH7741 proximity sensor */
+ REGULATOR_SUPPLY("vcc", "gpio-keys.0"),
+ /* BH1780GLS ambient light sensor */
+ REGULATOR_SUPPLY("vcc", "2-0029"),
+ /* lsm303dlh accelerometer */
+ REGULATOR_SUPPLY("vdd", "3-0018"),
+ /* lsm303dlh magnetometer */
+ REGULATOR_SUPPLY("vdd", "3-001e"),
+ /* Rohm BU21013 Touchscreen devices */
+ REGULATOR_SUPPLY("avdd", "3-005c"),
+ REGULATOR_SUPPLY("avdd", "3-005d"),
+ /* Synaptics RMI4 Touchscreen device */
+ REGULATOR_SUPPLY("vdd", "3-004b"),
+};
+
+static struct regulator_consumer_supply ab8500_vaux2_consumers[] = {
+ /* On-board eMMC power */
+ REGULATOR_SUPPLY("vmmc", "sdi4"),
+ /* AB8500 audio codec */
+ REGULATOR_SUPPLY("vcc-N2158", "ab8500-codec.0"),
+};
+
+static struct regulator_consumer_supply ab8500_vaux3_consumers[] = {
+ /* External MMC slot power */
+ REGULATOR_SUPPLY("vmmc", "sdi0"),
+};
+
+static struct regulator_consumer_supply ab8500_vtvout_consumers[] = {
+ /* TV-out DENC supply */
+ REGULATOR_SUPPLY("vtvout", "ab8500-denc.0"),
+ /* Internal general-purpose ADC */
+ REGULATOR_SUPPLY("vddadc", "ab8500-gpadc.0"),
+};
+
+static struct regulator_consumer_supply ab8500_vintcore_consumers[] = {
+ /* SoC core supply, no device */
+ REGULATOR_SUPPLY("v-intcore", NULL),
+ /* USB Transceiver */
+ REGULATOR_SUPPLY("vddulpivio18", "ab8500-usb.0"),
+};
+
+static struct regulator_consumer_supply ab8500_vana_consumers[] = {
+ /* External displays, connector on board, 1v8 power supply */
+ REGULATOR_SUPPLY("vsmps2", "mcde.0"),
+};
/* ab8500 regulator register initialization */
struct ab8500_regulator_reg_init
- ab8500_regulator_reg_init[AB8500_NUM_REGULATOR_REGISTERS] = {
+ab8500_regulator_reg_init[AB8500_NUM_REGULATOR_REGISTERS] = {
/*
* VanaRequestCtrl = HP/LP depending on VxRequest
- * VpllRequestCtrl = HP/LP depending on VxRequest
* VextSupply1RequestCtrl = HP/LP depending on VxRequest
*/
- INIT_REGULATOR_REGISTER(AB8500_REGUREQUESTCTRL2, 0xfc, 0x00),
+ INIT_REGULATOR_REGISTER(AB8500_REGUREQUESTCTRL2, 0x00),
/*
* VextSupply2RequestCtrl = HP/LP depending on VxRequest
* VextSupply3RequestCtrl = HP/LP depending on VxRequest
* Vaux1RequestCtrl = HP/LP depending on VxRequest
* Vaux2RequestCtrl = HP/LP depending on VxRequest
*/
- INIT_REGULATOR_REGISTER(AB8500_REGUREQUESTCTRL3, 0xff, 0x00),
+ INIT_REGULATOR_REGISTER(AB8500_REGUREQUESTCTRL3, 0x00),
/*
* Vaux3RequestCtrl = HP/LP depending on VxRequest
* SwHPReq = Control through SWValid disabled
*/
- INIT_REGULATOR_REGISTER(AB8500_REGUREQUESTCTRL4, 0x07, 0x00),
+ INIT_REGULATOR_REGISTER(AB8500_REGUREQUESTCTRL4, 0x00),
/*
- * Vsmps1SysClkReq1HPValid = enabled
- * Vsmps2SysClkReq1HPValid = enabled
- * Vsmps3SysClkReq1HPValid = enabled
* VanaSysClkReq1HPValid = disabled
- * VpllSysClkReq1HPValid = enabled
* Vaux1SysClkReq1HPValid = disabled
* Vaux2SysClkReq1HPValid = disabled
* Vaux3SysClkReq1HPValid = disabled
*/
- INIT_REGULATOR_REGISTER(AB8500_REGUSYSCLKREQ1HPVALID1, 0xff, 0x17),
+ INIT_REGULATOR_REGISTER(AB8500_REGUSYSCLKREQ1HPVALID1, 0x00),
/*
* VextSupply1SysClkReq1HPValid = disabled
* VextSupply2SysClkReq1HPValid = disabled
* VextSupply3SysClkReq1HPValid = SysClkReq1 controlled
*/
- INIT_REGULATOR_REGISTER(AB8500_REGUSYSCLKREQ1HPVALID2, 0x70, 0x40),
+ INIT_REGULATOR_REGISTER(AB8500_REGUSYSCLKREQ1HPVALID2, 0x40),
/*
* VanaHwHPReq1Valid = disabled
* Vaux1HwHPreq1Valid = disabled
* Vaux2HwHPReq1Valid = disabled
* Vaux3HwHPReqValid = disabled
*/
- INIT_REGULATOR_REGISTER(AB8500_REGUHWHPREQ1VALID1, 0xe8, 0x00),
+ INIT_REGULATOR_REGISTER(AB8500_REGUHWHPREQ1VALID1, 0x00),
/*
* VextSupply1HwHPReq1Valid = disabled
* VextSupply2HwHPReq1Valid = disabled
* VextSupply3HwHPReq1Valid = disabled
*/
- INIT_REGULATOR_REGISTER(AB8500_REGUHWHPREQ1VALID2, 0x07, 0x00),
+ INIT_REGULATOR_REGISTER(AB8500_REGUHWHPREQ1VALID2, 0x00),
/*
* VanaHwHPReq2Valid = disabled
* Vaux1HwHPReq2Valid = disabled
* Vaux2HwHPReq2Valid = disabled
* Vaux3HwHPReq2Valid = disabled
*/
- INIT_REGULATOR_REGISTER(AB8500_REGUHWHPREQ2VALID1, 0xe8, 0x00),
+ INIT_REGULATOR_REGISTER(AB8500_REGUHWHPREQ2VALID1, 0x00),
/*
* VextSupply1HwHPReq2Valid = disabled
* VextSupply2HwHPReq2Valid = disabled
* VextSupply3HwHPReq2Valid = HWReq2 controlled
*/
- INIT_REGULATOR_REGISTER(AB8500_REGUHWHPREQ2VALID2, 0x07, 0x04),
+ INIT_REGULATOR_REGISTER(AB8500_REGUHWHPREQ2VALID2, 0x04),
/*
* VanaSwHPReqValid = disabled
* Vaux1SwHPReqValid = disabled
*/
- INIT_REGULATOR_REGISTER(AB8500_REGUSWHPREQVALID1, 0xa0, 0x00),
+ INIT_REGULATOR_REGISTER(AB8500_REGUSWHPREQVALID1, 0x00),
/*
* Vaux2SwHPReqValid = disabled
* Vaux3SwHPReqValid = disabled
@@ -104,7 +157,7 @@ struct ab8500_regulator_reg_init
* VextSupply2SwHPReqValid = disabled
* VextSupply3SwHPReqValid = disabled
*/
- INIT_REGULATOR_REGISTER(AB8500_REGUSWHPREQVALID2, 0x1f, 0x00),
+ INIT_REGULATOR_REGISTER(AB8500_REGUSWHPREQVALID2, 0x00),
/*
* SysClkReq2Valid1 = SysClkReq2 controlled
* SysClkReq3Valid1 = disabled
@@ -114,7 +167,7 @@ struct ab8500_regulator_reg_init
* SysClkReq7Valid1 = disabled
* SysClkReq8Valid1 = disabled
*/
- INIT_REGULATOR_REGISTER(AB8500_REGUSYSCLKREQVALID1, 0xfe, 0x2a),
+ INIT_REGULATOR_REGISTER(AB8500_REGUSYSCLKREQVALID1, 0x2a),
/*
* SysClkReq2Valid2 = disabled
* SysClkReq3Valid2 = disabled
@@ -124,7 +177,7 @@ struct ab8500_regulator_reg_init
* SysClkReq7Valid2 = disabled
* SysClkReq8Valid2 = disabled
*/
- INIT_REGULATOR_REGISTER(AB8500_REGUSYSCLKREQVALID2, 0xfe, 0x20),
+ INIT_REGULATOR_REGISTER(AB8500_REGUSYSCLKREQVALID2, 0x20),
/*
* VTVoutEna = disabled
* Vintcore12Ena = disabled
@@ -132,93 +185,66 @@ struct ab8500_regulator_reg_init
* Vintcore12LP = inactive (HP)
* VTVoutLP = inactive (HP)
*/
- INIT_REGULATOR_REGISTER(AB8500_REGUMISC1, 0xfe, 0x10),
+ INIT_REGULATOR_REGISTER(AB8500_REGUMISC1, 0x10),
/*
* VaudioEna = disabled
* VdmicEna = disabled
* Vamic1Ena = disabled
* Vamic2Ena = disabled
*/
- INIT_REGULATOR_REGISTER(AB8500_VAUDIOSUPPLY, 0x1e, 0x00),
+ INIT_REGULATOR_REGISTER(AB8500_VAUDIOSUPPLY, 0x00),
/*
* Vamic1_dzout = high-Z when Vamic1 is disabled
* Vamic2_dzout = high-Z when Vamic2 is disabled
*/
- INIT_REGULATOR_REGISTER(AB8500_REGUCTRL1VAMIC, 0x03, 0x00),
- /*
- * Vsmps1Regu = HW control
- * Vsmps1SelCtrl = Vsmps1 voltage defined by Vsmsp1Sel2
- */
- INIT_REGULATOR_REGISTER(AB8500_VSMPS1REGU, 0x0f, 0x06),
- /*
- * Vsmps2Regu = HW control
- * Vsmps2SelCtrl = Vsmps2 voltage defined by Vsmsp2Sel2
- */
- INIT_REGULATOR_REGISTER(AB8500_VSMPS2REGU, 0x0f, 0x06),
- /*
- * Vsmps3Sel2 = 1.2125 V
- * NOTE! PRCMU register
- */
- INIT_REGULATOR_REGISTER(AB8500_VSMPS3SEL2, 0x7f, 0x29),
- /*
- * Vsmps3Regu = HW control
- * Vsmps3SelCtrl = Vsmps3 voltage defined by Vsmps3Sel2
- * NOTE! PRCMU register
- */
- INIT_REGULATOR_REGISTER(AB8500_VSMPS3REGU, 0x0f, 0x06),
- /*
- * Vsmps3Sel1 = 0.925V
- * NOTE! PRCMU register
- */
- INIT_REGULATOR_REGISTER(AB8500_VSMPS3SEL1, 0x7f, 0x12),
+ INIT_REGULATOR_REGISTER(AB8500_REGUCTRL1VAMIC, 0x00),
/*
* VPll = Hw controlled
* VanaRegu = force off
*/
- INIT_REGULATOR_REGISTER(AB8500_VPLLVANAREGU, 0x0f, 0x02),
+ INIT_REGULATOR_REGISTER(AB8500_VPLLVANAREGU, 0x02),
/*
* VrefDDREna = disabled
* VrefDDRSleepMode = inactive (no pulldown)
*/
- INIT_REGULATOR_REGISTER(AB8500_VREFDDR, 0x03, 0x00),
+ INIT_REGULATOR_REGISTER(AB8500_VREFDDR, 0x00),
/*
* VextSupply1Regu = HW control
* VextSupply2Regu = HW control
- * VextSupply3Regu = Low Power mode
+ * VextSupply3Regu = HW control
* ExtSupply2Bypass = ExtSupply12LPn ball is 0 when Ena is 0
* ExtSupply3Bypass = ExtSupply3LPn ball is 0 when Ena is 0
*/
- INIT_REGULATOR_REGISTER(AB8500_EXTSUPPLYREGU, 0xff, 0x1a),
+ INIT_REGULATOR_REGISTER(AB8500_EXTSUPPLYREGU, 0x2a),
/*
* Vaux1Regu = force HP
* Vaux2Regu = force off
*/
- INIT_REGULATOR_REGISTER(AB8500_VAUX12REGU, 0x0f, 0x01),
+ INIT_REGULATOR_REGISTER(AB8500_VAUX12REGU, 0x01),
/*
- * Vrf1Regu = HW control
- * Vaux3Regu = force off
+ * Vaux3regu = force off
*/
- INIT_REGULATOR_REGISTER(AB8500_VRF1VAUX3REGU, 0x0f, 0x08),
+ INIT_REGULATOR_REGISTER(AB8500_VRF1VAUX3REGU, 0x00),
/*
- * Vsmps1Sel1 = 1.2 V
+ * Vsmps1 = 1.15V
*/
- INIT_REGULATOR_REGISTER(AB8500_VSMPS1SEL1, 0x3f, 0x28),
+ INIT_REGULATOR_REGISTER(AB8500_VSMPS1SEL1, 0x24),
/*
- * Vaux1Sel = 2.8 V
+ * Vaux1Sel = 2.5 V
*/
- INIT_REGULATOR_REGISTER(AB8500_VAUX1SEL, 0x0f, 0x0C),
+ INIT_REGULATOR_REGISTER(AB8500_VAUX1SEL, 0x08),
/*
* Vaux2Sel = 2.9 V
*/
- INIT_REGULATOR_REGISTER(AB8500_VAUX2SEL, 0x0f, 0x0d),
+ INIT_REGULATOR_REGISTER(AB8500_VAUX2SEL, 0x0d),
/*
* Vaux3Sel = 2.91 V
*/
- INIT_REGULATOR_REGISTER(AB8500_VRF1VAUX3SEL, 0x07, 0x07),
+ INIT_REGULATOR_REGISTER(AB8500_VRF1VAUX3SEL, 0x07),
/*
* VextSupply12LP = disabled (no LP)
*/
- INIT_REGULATOR_REGISTER(AB8500_REGUCTRL2SPARE, 0x01, 0x00),
+ INIT_REGULATOR_REGISTER(AB8500_REGUCTRL2SPARE, 0x00),
/*
* Vaux1Disch = short discharge time
* Vaux2Disch = short discharge time
@@ -227,241 +253,33 @@ struct ab8500_regulator_reg_init
* VTVoutDisch = short discharge time
* VaudioDisch = short discharge time
*/
- INIT_REGULATOR_REGISTER(AB8500_REGUCTRLDISCH, 0xfc, 0x00),
+ INIT_REGULATOR_REGISTER(AB8500_REGUCTRLDISCH, 0x00),
/*
* VanaDisch = short discharge time
* VdmicPullDownEna = pulldown disabled when Vdmic is disabled
* VdmicDisch = short discharge time
*/
- INIT_REGULATOR_REGISTER(AB8500_REGUCTRLDISCH2, 0x16, 0x00),
-};
-
-/* vana regulator configuration, for analogue part of displays */
-static struct regulator_consumer_supply ab8500_vana_consumers[] = {
- /* External displays, connector on board, 1v8 power supply */
- REGULATOR_SUPPLY("vsmps2", "mcde.0"),
- {
- .dev_name = "mcde",
- .supply = "v-ana",
- },
- {
- .dev_name = "mmio_camera",
- .supply = "v-ana",
- },
-#ifdef CONFIG_U8500_REGULATOR_DEBUG
- {
- .dev_name = "reg-virt-consumer.9",
- .supply = "ana",
- },
-#endif
-};
-
-#ifdef CONFIG_SENSORS1P_MOP
-extern struct platform_device sensors1p_device;
-#endif
-
-/* vaux1 regulator configuration */
-static struct regulator_consumer_supply ab8500_vaux1_consumers[] = {
- /* External displays, connector on board 2v5 power supply */
- REGULATOR_SUPPLY("vaux12v5", "mcde_disp_generic.0"),
- /* SFH7741 proximity sensor */
- REGULATOR_SUPPLY("vcc", "gpio-keys.0"),
- /* BH1780GLS ambient light sensor */
- REGULATOR_SUPPLY("vcc", "2-0029"),
- /* lsm303dlh accelerometer */
- REGULATOR_SUPPLY("vdd", "lsm303dlh.0"),
- /* lsm303dlh magnetometer */
- REGULATOR_SUPPLY("vdd", "lsm303dlh.1"),
- /* Rohm BU21013 Touchscreen devices */
- REGULATOR_SUPPLY("avdd", "3-005c"),
- REGULATOR_SUPPLY("avdd", "3-005d"),
- /* Synaptics RMI4 Touchscreen device */
- REGULATOR_SUPPLY("vdd", "3-004b"),
- /* L3G4200D Gyroscope device */
- REGULATOR_SUPPLY("vdd", "l3g4200d"),
- REGULATOR_SUPPLY("v-mmio-camera", "mmio_camera"),
-
- {
- .dev = NULL,
- .supply = "v-display",
- },
-#ifdef CONFIG_SENSORS1P_MOP
- {
- .dev = &sensors1p_device.dev,
- .supply = "v-proximity",
- },
- {
- .dev = &sensors1p_device.dev,
- .supply = "v-hal",
- },
-#endif
-#ifdef CONFIG_SENSORS_BH1780
- {
- .dev_name = "bh1780",
- .supply = "v-als",
- },
-#endif
- {
- .dev_name = "spi8.0",
- .supply = "vcpin",
- },
- REGULATOR_SUPPLY_DEBUG("aux1", "reg-virt-consumer.0")
+ INIT_REGULATOR_REGISTER(AB8500_REGUCTRLDISCH2, 0x00),
};
-/* vaux2 regulator configuration */
-static struct regulator_consumer_supply ab8500_vaux2_consumers[] = {
- /* On-board eMMC power */
- REGULATOR_SUPPLY("vmmc", "sdi4"),
- /* AB8500 audio codec */
- REGULATOR_SUPPLY("vcc-avswitch", "ab8500-codec.0"),
- REGULATOR_SUPPLY("vcc-avswitch", "ab8500-acc-det.0"),
- {
- .dev_name = "sdi4",
- .supply = "v-eMMC",
- },
-#ifdef CONFIG_DISPLAY_AB8500_TERTIARY
- {
- .dev = &tvout_ab8500_display.dev,
- .supply = "v-ab8500-AV-switch",
- },
-#endif
-#ifdef CONFIG_DISPLAY_AV8100_TERTIARY
- {
- .dev = &av8100_hdmi.dev,
- .supply = "v-av8100-AV-switch",
- },
-#endif
- REGULATOR_SUPPLY_DEBUG("aux2", "reg-virt-consumer.1")
-};
-
-/* vaux3 regulator configuration */
-static struct regulator_consumer_supply ab8500_vaux3_consumers[] = {
- /* External MMC slot power */
- REGULATOR_SUPPLY("vmmc", "sdi0"),
-
- {
- .dev_name = "sdi0",
- .supply = "v-MMC-SD"
- },
- REGULATOR_SUPPLY_DEBUG("aux3", "reg-virt-consumer.2")
-};
-
-/* vtvout regulator configuration, supply for tvout, gpadc, TVOUT LDO */
-static struct regulator_consumer_supply ab8500_vtvout_consumers[] = {
- /* TV-out DENC supply */
- REGULATOR_SUPPLY("vtvout", "ab8500-denc.0"),
- /* Internal general-purpose ADC */
- REGULATOR_SUPPLY("vddadc", "ab8500-gpadc.0"),
- REGULATOR_SUPPLY("vddadc", "ab8500-charger.0"),
-#ifdef CONFIG_DISPLAY_AB8500_TERTIARY
- {
- .dev = &tvout_ab8500_display.dev,
- .supply = "v-tvout",
- },
-#endif
- REGULATOR_SUPPLY_DEBUG("tvout", "reg-virt-consumer.4")
-};
-
-/* vaudio regulator configuration, supply for ab8500-vaudio, VAUDIO LDO */
-static struct regulator_consumer_supply ab8500_vaudio_consumers[] = {
- /* vaudio regulator, supply for ab8500-vaudio */
- REGULATOR_SUPPLY("v-audio", NULL),
- REGULATOR_SUPPLY_DEBUG("audio", "reg-virt-consumer.5")
-};
-
-/* vamic1 regulator configuration */
-static struct regulator_consumer_supply ab8500_vamic1_consumers[] = {
- {
- .supply = "v-amic1",
- },
-#ifdef CONFIG_U8500_REGULATOR_DEBUG
- {
- .dev_name = "reg-virt-consumer.6",
- .supply = "anamic1",
- },
-#endif
-};
-
-/* supply for v-amic2, VAMIC2 LDO, reuse constants for AMIC1 */
-static struct regulator_consumer_supply ab8500_vamic2_consumers[] = {
- {
- .supply = "v-amic2",
- },
-#ifdef CONFIG_U8500_REGULATOR_DEBUG
- {
- .dev_name = "reg-virt-consumer.7",
- .supply = "anamic2",
- },
-#endif
-};
-
-/* supply for v-dmic, VDMIC LDO */
-static struct regulator_consumer_supply ab8500_vdmic_consumers[] = {
- {
- .supply = "v-dmic",
- },
-#ifdef CONFIG_U8500_REGULATOR_DEBUG
- {
- .dev_name = "reg-virt-consumer.8",
- .supply = "dmic",
- },
-#endif
-};
-
-/* supply for v-intcore12, VINTCORE12 LDO */
-static struct regulator_consumer_supply ab8500_vintcore_consumers[] = {
- /* SoC core supply, no device */
- REGULATOR_SUPPLY("v-intcore", NULL),
- /* USB Transciever */
- REGULATOR_SUPPLY("vddulpivio18", "ab8500-usb.0"),
- {
- .dev_name = "ab8500-usb.0",
- .supply = "v-intcore",
- },
- REGULATOR_SUPPLY_DEBUG("intcore", "reg-virt-consumer.3")
-};
-
-/* supply for CG2900 */
-static struct regulator_consumer_supply ab8500_sysclkreq_2_consumers[] = {
- {
- .dev_name = "cg2900-uart.0",
- .supply = "gbf_1v8",
- },
-#ifdef CONFIG_U8500_REGULATOR_DEBUG
- {
- .dev_name = "reg-virt-consumer.10",
- .supply = "sysclkreq-2",
- },
-#endif
-};
-
-/* supply for CW1200 */
-static struct regulator_consumer_supply ab8500_sysclkreq_4_consumers[] = {
- {
- .dev_name = "cw1200",
- .supply = "wlan_1v8",
- },
-#ifdef CONFIG_U8500_REGULATOR_DEBUG
- {
- .dev_name = "reg-virt-consumer.11",
- .supply = "sysclkreq-4",
- },
-#endif
-};
-
-/*
- * AB8500 regulators
- */
+/* AB8500 regulators */
struct regulator_init_data ab8500_regulators[AB8500_NUM_REGULATORS] = {
/* supplies to the display/camera */
[AB8500_LDO_AUX1] = {
.constraints = {
- .name = "ab8500-vaux1",
- .min_uV = 2800000,
- .max_uV = 3300000,
+ .name = "V-DISPLAY",
+ .min_uV = 2500000,
+ .max_uV = 2900000,
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
REGULATOR_CHANGE_STATUS,
- .boot_on = 1, /* must be on for display */
+ .boot_on = 1, /* display is on at boot */
+ /*
+ * This voltage cannot be disabled right now because
+ * it is somehow affecting the external MMC
+ * functionality, though that typically will use
+ * AUX3.
+ */
+ .always_on = 1,
},
.num_consumer_supplies = ARRAY_SIZE(ab8500_vaux1_consumers),
.consumer_supplies = ab8500_vaux1_consumers,
@@ -469,14 +287,11 @@ struct regulator_init_data ab8500_regulators[AB8500_NUM_REGULATORS] = {
/* supplies to the on-board eMMC */
[AB8500_LDO_AUX2] = {
.constraints = {
- .name = "ab8500-vaux2",
+ .name = "V-eMMC1",
.min_uV = 1100000,
.max_uV = 3300000,
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
- REGULATOR_CHANGE_STATUS |
- REGULATOR_CHANGE_MODE,
- .valid_modes_mask = REGULATOR_MODE_NORMAL |
- REGULATOR_MODE_IDLE,
+ REGULATOR_CHANGE_STATUS,
},
.num_consumer_supplies = ARRAY_SIZE(ab8500_vaux2_consumers),
.consumer_supplies = ab8500_vaux2_consumers,
@@ -484,14 +299,11 @@ struct regulator_init_data ab8500_regulators[AB8500_NUM_REGULATORS] = {
/* supply for VAUX3, supplies to SDcard slots */
[AB8500_LDO_AUX3] = {
.constraints = {
- .name = "ab8500-vaux3",
+ .name = "V-MMC-SD",
.min_uV = 1100000,
.max_uV = 3300000,
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
- REGULATOR_CHANGE_STATUS |
- REGULATOR_CHANGE_MODE,
- .valid_modes_mask = REGULATOR_MODE_NORMAL |
- REGULATOR_MODE_IDLE,
+ REGULATOR_CHANGE_STATUS,
},
.num_consumer_supplies = ARRAY_SIZE(ab8500_vaux3_consumers),
.consumer_supplies = ab8500_vaux3_consumers,
@@ -499,7 +311,7 @@ struct regulator_init_data ab8500_regulators[AB8500_NUM_REGULATORS] = {
/* supply for tvout, gpadc, TVOUT LDO */
[AB8500_LDO_TVOUT] = {
.constraints = {
- .name = "ab8500-vtvout",
+ .name = "V-TVOUT",
.valid_ops_mask = REGULATOR_CHANGE_STATUS,
},
.num_consumer_supplies = ARRAY_SIZE(ab8500_vtvout_consumers),
@@ -508,52 +320,36 @@ struct regulator_init_data ab8500_regulators[AB8500_NUM_REGULATORS] = {
/* supply for ab8500-vaudio, VAUDIO LDO */
[AB8500_LDO_AUDIO] = {
.constraints = {
- .name = "ab8500-vaudio",
+ .name = "V-AUD",
.valid_ops_mask = REGULATOR_CHANGE_STATUS,
},
- .num_consumer_supplies = ARRAY_SIZE(ab8500_vaudio_consumers),
- .consumer_supplies = ab8500_vaudio_consumers,
},
/* supply for v-anamic1 VAMic1-LDO */
[AB8500_LDO_ANAMIC1] = {
.constraints = {
- .name = "ab8500-vamic1",
+ .name = "V-AMIC1",
.valid_ops_mask = REGULATOR_CHANGE_STATUS,
},
- .num_consumer_supplies = ARRAY_SIZE(ab8500_vamic1_consumers),
- .consumer_supplies = ab8500_vamic1_consumers,
},
/* supply for v-amic2, VAMIC2 LDO, reuse constants for AMIC1 */
[AB8500_LDO_ANAMIC2] = {
.constraints = {
- .name = "ab8500-vamic2",
+ .name = "V-AMIC2",
.valid_ops_mask = REGULATOR_CHANGE_STATUS,
},
- .num_consumer_supplies = ARRAY_SIZE(ab8500_vamic2_consumers),
- .consumer_supplies = ab8500_vamic2_consumers,
},
/* supply for v-dmic, VDMIC LDO */
[AB8500_LDO_DMIC] = {
.constraints = {
- .name = "ab8500-vdmic",
+ .name = "V-DMIC",
.valid_ops_mask = REGULATOR_CHANGE_STATUS,
},
- .num_consumer_supplies = ARRAY_SIZE(ab8500_vdmic_consumers),
- .consumer_supplies = ab8500_vdmic_consumers,
},
/* supply for v-intcore12, VINTCORE12 LDO */
[AB8500_LDO_INTCORE] = {
.constraints = {
- .name = "ab8500-vintcore",
- .min_uV = 1250000,
- .max_uV = 1350000,
- .input_uV = 1800000,
- .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
- REGULATOR_CHANGE_STATUS |
- REGULATOR_CHANGE_MODE |
- REGULATOR_CHANGE_DRMS,
- .valid_modes_mask = REGULATOR_MODE_NORMAL |
- REGULATOR_MODE_IDLE,
+ .name = "V-INTCORE",
+ .valid_ops_mask = REGULATOR_CHANGE_STATUS,
},
.num_consumer_supplies = ARRAY_SIZE(ab8500_vintcore_consumers),
.consumer_supplies = ab8500_vintcore_consumers,
@@ -561,626 +357,10 @@ struct regulator_init_data ab8500_regulators[AB8500_NUM_REGULATORS] = {
/* supply for U8500 CSI/DSI, VANA LDO */
[AB8500_LDO_ANA] = {
.constraints = {
- .name = "ab8500-vana",
+ .name = "V-CSI/DSI",
.valid_ops_mask = REGULATOR_CHANGE_STATUS,
},
.num_consumer_supplies = ARRAY_SIZE(ab8500_vana_consumers),
.consumer_supplies = ab8500_vana_consumers,
},
- /* sysclkreq 2 pin */
- [AB8500_SYSCLKREQ_2] = {
- .constraints = {
- .name = "ab8500-sysclkreq-2",
- .valid_ops_mask = REGULATOR_CHANGE_STATUS,
- },
- .num_consumer_supplies =
- ARRAY_SIZE(ab8500_sysclkreq_2_consumers),
- .consumer_supplies = ab8500_sysclkreq_2_consumers,
- },
- /* sysclkreq 4 pin */
- [AB8500_SYSCLKREQ_4] = {
- .constraints = {
- .name = "ab8500-sysclkreq-4",
- .valid_ops_mask = REGULATOR_CHANGE_STATUS,
- },
- .num_consumer_supplies =
- ARRAY_SIZE(ab8500_sysclkreq_4_consumers),
- .consumer_supplies = ab8500_sysclkreq_4_consumers,
- },
-};
-
-/*
- * Power State Regulator Configuration
- */
-#define U8500_VAPE_REGULATOR_MIN_VOLTAGE 1800000
-#define U8500_VAPE_REGULATOR_MAX_VOLTAGE 2000000
-
-/* vape regulator configuration */
-static struct regulator_consumer_supply u8500_vape_consumers[] = {
- {
- .supply = "v-ape",
- },
- {
- .dev_name = "nmk-i2c.0",
- .supply = "v-i2c",
- },
- {
- .dev_name = "nmk-i2c.1",
- .supply = "v-i2c",
- },
- {
- .dev_name = "nmk-i2c.2",
- .supply = "v-i2c",
- },
- {
- .dev_name = "nmk-i2c.3",
- .supply = "v-i2c",
- },
- {
- .dev_name = "sdi0",
- .supply = "v-mmc",
- },
- {
- .dev_name = "sdi1",
- .supply = "v-mmc",
- },
- {
- .dev_name = "sdi2",
- .supply = "v-mmc",
- },
- {
- .dev_name = "sdi4",
- .supply = "v-mmc",
- },
- {
- .dev_name = "dma40.0",
- .supply = "v-dma",
- },
- {
- .dev_name = "ab8500-usb.0",
- .supply = "v-ape",
- },
- {
- .dev_name = "uart0",
- .supply = "v-uart",
- },
- {
- .dev_name = "uart1",
- .supply = "v-uart",
- },
- {
- .dev_name = "uart2",
- .supply = "v-uart",
- },
- {
- .dev_name = "nmk-ske-keypad",
- .supply = "v-ape",
- },
- {
- .dev_name = "ste_hsi.0",
- .supply = "v-hsi",
- },
-#ifdef CONFIG_U8500_REGULATOR_DEBUG
- {
- .dev_name = "reg-virt-consumer.12",
- .supply = "test",
- },
-#endif
-};
-
-struct regulator_init_data u8500_vape_regulator = {
- .constraints = {
- .name = "u8500-vape",
- .min_uV = U8500_VAPE_REGULATOR_MIN_VOLTAGE,
- .max_uV = U8500_VAPE_REGULATOR_MAX_VOLTAGE,
- .input_uV = 1, /* notional, for set_mode* */
- .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
- REGULATOR_CHANGE_MODE | REGULATOR_CHANGE_DRMS |
- REGULATOR_CHANGE_STATUS,
- .valid_modes_mask = REGULATOR_MODE_NORMAL |
- REGULATOR_MODE_IDLE,
- },
- .consumer_supplies = u8500_vape_consumers,
- .num_consumer_supplies = ARRAY_SIZE(u8500_vape_consumers),
-};
-
-/* varm regulator_configuration */
-static struct regulator_consumer_supply u8500_varm_consumers[] = {
-#ifdef CONFIG_U8500_REGULATOR_DEBUG
- {
- .dev_name = "reg-virt-consumer.13",
- .supply = "test",
- },
-#endif
-};
-
-struct regulator_init_data u8500_varm_regulator = {
- .constraints = {
- .name = "u8500-varm",
- .valid_ops_mask = REGULATOR_CHANGE_STATUS,
- },
- .consumer_supplies = u8500_varm_consumers,
- .num_consumer_supplies = ARRAY_SIZE(u8500_varm_consumers),
-};
-
-/* vmodem regulator configuration */
-static struct regulator_consumer_supply u8500_vmodem_consumers[] = {
-#ifdef CONFIG_U8500_REGULATOR_DEBUG
- {
- .dev_name = "reg-virt-consumer.14",
- .supply = "test",
- },
-#endif
-};
-
-struct regulator_init_data u8500_vmodem_regulator = {
- .constraints = {
- .name = "u8500-vmodem",
- .valid_ops_mask = REGULATOR_CHANGE_STATUS,
- },
- .consumer_supplies = u8500_vmodem_consumers,
- .num_consumer_supplies = ARRAY_SIZE(u8500_vmodem_consumers),
-};
-
-/* vpll regulator configuration */
-static struct regulator_consumer_supply u8500_vpll_consumers[] = {
-#ifdef CONFIG_U8500_REGULATOR_DEBUG
- {
- .dev_name = "reg-virt-consumer.15",
- .supply = "test",
- },
-#endif
-};
-
-struct regulator_init_data u8500_vpll_regulator = {
- .constraints = {
- .name = "u8500-vpll",
- .valid_ops_mask = REGULATOR_CHANGE_STATUS,
- },
- .consumer_supplies = u8500_vpll_consumers,
- .num_consumer_supplies = ARRAY_SIZE(u8500_vpll_consumers),
-};
-
-/* vsmps1 regulator configuration */
-static struct regulator_consumer_supply u8500_vsmps1_consumers[] = {
-#ifdef CONFIG_U8500_REGULATOR_DEBUG
- {
- .dev_name = "reg-virt-consumer.16",
- .supply = "test",
- },
-#endif
-};
-
-struct regulator_init_data u8500_vsmps1_regulator = {
- .constraints = {
- .name = "u8500-vsmps1",
- .valid_ops_mask = REGULATOR_CHANGE_STATUS,
- },
- .consumer_supplies = u8500_vsmps1_consumers,
- .num_consumer_supplies = ARRAY_SIZE(u8500_vsmps1_consumers),
-};
-
-/* vsmsp2 regulator configuration */
-static struct regulator_consumer_supply u8500_vsmps2_consumers[] = {
- {
- .dev_name = "ab8500-usb.0",
- .supply = "musb_1v8",
- },
- {
- .dev_name = "0-0070",
- .supply = "hdmi_1v8",
- },
-#ifdef CONFIG_U8500_REGULATOR_DEBUG
- {
- .dev_name = "reg-virt-consumer.17",
- .supply = "test",
- },
-#endif
-};
-
-struct regulator_init_data u8500_vsmps2_regulator = {
- .constraints = {
- .name = "u8500-vsmps2",
- .valid_ops_mask = REGULATOR_CHANGE_STATUS,
- },
- .consumer_supplies = u8500_vsmps2_consumers,
- .num_consumer_supplies = ARRAY_SIZE(u8500_vsmps2_consumers),
-};
-
-/* vsmps3 regulator configuration */
-static struct regulator_consumer_supply u8500_vsmps3_consumers[] = {
-#ifdef CONFIG_U8500_REGULATOR_DEBUG
- {
- .dev_name = "reg-virt-consumer.18",
- .supply = "test",
- },
-#endif
-};
-
-struct regulator_init_data u8500_vsmps3_regulator = {
- .constraints = {
- .name = "u8500-vsmps3",
- .valid_ops_mask = REGULATOR_CHANGE_STATUS,
- },
- .consumer_supplies = u8500_vsmps3_consumers,
- .num_consumer_supplies = ARRAY_SIZE(u8500_vsmps3_consumers),
-};
-
-/* vrf1 regulator configuration */
-static struct regulator_consumer_supply u8500_vrf1_consumers[] = {
-#ifdef CONFIG_U8500_REGULATOR_DEBUG
- {
- .dev_name = "reg-virt-consumer.19",
- .supply = "test",
- },
-#endif
-};
-
-struct regulator_init_data u8500_vrf1_regulator = {
- .constraints = {
- .name = "u8500-vrf1",
- .valid_ops_mask = REGULATOR_CHANGE_STATUS,
- },
- .consumer_supplies = u8500_vrf1_consumers,
- .num_consumer_supplies = ARRAY_SIZE(u8500_vrf1_consumers),
-};
-
-/*
- * Power Domain Switch Configuration
- */
-
-/* SVA MMDSP regulator switch */
-static struct regulator_consumer_supply u8500_svammdsp_consumers[] = {
- {
- /* NOTE! This is a temporary supply for prcmu_set_hwacc */
- .supply = "hwacc-sva-mmdsp",
- },
- {
- .dev_name = "cm_control",
- .supply = "sva-mmdsp",
- },
-#ifdef CONFIG_U8500_REGULATOR_DEBUG
- {
- .dev_name = "reg-virt-consumer.20",
- .supply = "test",
- },
-#endif
-};
-
-struct regulator_init_data u8500_svammdsp_regulator = {
- /* dependency to u8500-vape is handled outside regulator framework */
- .constraints = {
- .name = "u8500-sva-mmdsp",
- .valid_ops_mask = REGULATOR_CHANGE_STATUS,
- },
- .consumer_supplies = u8500_svammdsp_consumers,
- .num_consumer_supplies = ARRAY_SIZE(u8500_svammdsp_consumers),
-};
-
-/* SVA MMDSP retention regulator switch */
-static struct regulator_consumer_supply u8500_svammdspret_consumers[] = {
- {
- /* NOTE! This is a temporary supply for prcmu_set_hwacc */
- .supply = "hwacc-sva-mmdsp-ret",
- },
-#ifdef CONFIG_U8500_REGULATOR_DEBUG
- {
- .dev_name = "reg-virt-consumer.21",
- .supply = "test",
- },
-#endif
-};
-
-struct regulator_init_data u8500_svammdspret_regulator = {
- .constraints = {
- .name = "u8500-sva-mmdsp-ret",
- .valid_ops_mask = REGULATOR_CHANGE_STATUS,
- },
- .consumer_supplies = u8500_svammdspret_consumers,
- .num_consumer_supplies = ARRAY_SIZE(u8500_svammdspret_consumers),
-};
-
-/* SVA pipe regulator switch */
-static struct regulator_consumer_supply u8500_svapipe_consumers[] = {
- /* Add SVA pipe device supply here */
- {
- /* NOTE! This is a temporary supply for prcmu_set_hwacc */
- .supply = "hwacc-sva-pipe",
- },
- {
- .dev_name = "cm_control",
- .supply = "sva-pipe",
- },
-#ifdef CONFIG_U8500_REGULATOR_DEBUG
- {
- .dev_name = "reg-virt-consumer.22",
- .supply = "test",
- },
-#endif
-};
-
-struct regulator_init_data u8500_svapipe_regulator = {
- /* dependency to u8500-vape is handled outside regulator framework */
- .constraints = {
- .name = "u8500-sva-pipe",
- .valid_ops_mask = REGULATOR_CHANGE_STATUS,
- },
- .consumer_supplies = u8500_svapipe_consumers,
- .num_consumer_supplies = ARRAY_SIZE(u8500_svapipe_consumers),
-};
-
-/* SIA MMDSP regulator switch */
-static struct regulator_consumer_supply u8500_siammdsp_consumers[] = {
- {
- /* NOTE! This is a temporary supply for prcmu_set_hwacc */
- .supply = "hwacc-sia-mmdsp",
- },
- {
- .dev_name = "cm_control",
- .supply = "sia-mmdsp",
- },
-#ifdef CONFIG_U8500_REGULATOR_DEBUG
- {
- .dev_name = "reg-virt-consumer.23",
- .supply = "test",
- },
-#endif
-};
-
-struct regulator_init_data u8500_siammdsp_regulator = {
- /* dependency to u8500-vape is handled outside regulator framework */
- .constraints = {
- .name = "u8500-sia-mmdsp",
- .valid_ops_mask = REGULATOR_CHANGE_STATUS,
- },
- .consumer_supplies = u8500_siammdsp_consumers,
- .num_consumer_supplies = ARRAY_SIZE(u8500_siammdsp_consumers),
-};
-
-/* SIA MMDSP retention regulator switch */
-static struct regulator_consumer_supply u8500_siammdspret_consumers[] = {
- {
- /* NOTE! This is a temporary supply for prcmu_set_hwacc */
- .supply = "hwacc-sia-mmdsp-ret",
- },
-#ifdef CONFIG_U8500_REGULATOR_DEBUG
- {
- .dev_name = "reg-virt-consumer.24",
- .supply = "test",
- },
-#endif
-};
-
-struct regulator_init_data u8500_siammdspret_regulator = {
- .constraints = {
- .name = "u8500-sia-mmdsp-ret",
- .valid_ops_mask = REGULATOR_CHANGE_STATUS,
- },
- .consumer_supplies = u8500_siammdspret_consumers,
- .num_consumer_supplies = ARRAY_SIZE(u8500_siammdspret_consumers),
-};
-
-/* SIA pipe regulator switch */
-static struct regulator_consumer_supply u8500_siapipe_consumers[] = {
- /* Add SIA pipe device supply here */
- {
- /* NOTE! This is a temporary supply for prcmu_set_hwacc */
- .supply = "hwacc-sia-pipe",
- },
- {
- .dev_name = "cm_control",
- .supply = "sia-pipe",
- },
-#ifdef CONFIG_U8500_REGULATOR_DEBUG
- {
- .dev_name = "reg-virt-consumer.25",
- .supply = "test",
- },
-#endif
-};
-
-struct regulator_init_data u8500_siapipe_regulator = {
- /* dependency to u8500-vape is handled outside regulator framework */
- .constraints = {
- .name = "u8500-sia-pipe",
- .valid_ops_mask = REGULATOR_CHANGE_STATUS,
- },
- .consumer_supplies = u8500_siapipe_consumers,
- .num_consumer_supplies = ARRAY_SIZE(u8500_siapipe_consumers),
-};
-
-/* SGA regulator switch */
-static struct regulator_consumer_supply u8500_sga_consumers[] = {
- /* Add SGA device supply here */
- {
- /* NOTE! This is a temporary supply for prcmu_set_hwacc */
- .supply = "hwacc-sga",
- },
- {
- /*
- * The Mali driver doesn't have access to the device when
- * requesting the SGA regulator. Therefore only supply name.
- */
- .supply = "v-mali",
- },
-#ifdef CONFIG_U8500_REGULATOR_DEBUG
- {
- .dev_name = "reg-virt-consumer.26",
- .supply = "test",
- },
-#endif
-};
-
-struct regulator_init_data u8500_sga_regulator = {
- .supply_regulator = "u8500-vape",
- .constraints = {
- .name = "u8500-sga",
- .valid_ops_mask = REGULATOR_CHANGE_STATUS,
- },
- .consumer_supplies = u8500_sga_consumers,
- .num_consumer_supplies = ARRAY_SIZE(u8500_sga_consumers),
-};
-
-/* B2R2-MCDE regulator switch */
-static struct regulator_consumer_supply u8500_b2r2_mcde_consumers[] = {
- {
- .dev_name = "b2r2_bus",
- .supply = "vsupply",
- },
- {
- .dev_name = "mcde",
- .supply = "vsupply",
- },
- {
- /* NOTE! This is a temporary supply for prcmu_set_hwacc */
- .supply = "hwacc-b2r2",
- },
- {
- /* NOTE! This is a temporary supply for prcmu_set_hwacc */
- .supply = "hwacc-mcde",
- },
-#ifdef CONFIG_U8500_REGULATOR_DEBUG
- {
- .dev_name = "reg-virt-consumer.27",
- .supply = "test",
- },
-#endif
-};
-
-struct regulator_init_data u8500_b2r2_mcde_regulator = {
- .supply_regulator = "u8500-vape",
- .constraints = {
- .name = "u8500-b2r2-mcde",
- .valid_ops_mask = REGULATOR_CHANGE_STATUS,
- },
- .consumer_supplies = u8500_b2r2_mcde_consumers,
- .num_consumer_supplies = ARRAY_SIZE(u8500_b2r2_mcde_consumers),
-};
-
-/* ESRAM1 and 2 regulator switch */
-static struct regulator_consumer_supply u8500_esram12_consumers[] = {
- {
- /* NOTE! This is a temporary supply for prcmu_set_hwacc */
- .supply = "hwacc-esram1",
- },
- {
- /* NOTE! This is a temporary supply for prcmu_set_hwacc */
- .supply = "hwacc-esram2",
- },
- {
- .dev_name = "cm_control",
- .supply = "esram12",
- },
-#ifdef CONFIG_U8500_REGULATOR_DEBUG
- {
- .dev_name = "reg-virt-consumer.28",
- .supply = "test",
- },
-#endif
-};
-
-struct regulator_init_data u8500_esram12_regulator = {
- /*
- * esram12 is set in retention and supplied by Vsafe when Vape is off,
- * no need to hold Vape
- */
- .constraints = {
- .name = "u8500-esram12",
- .valid_ops_mask = REGULATOR_CHANGE_STATUS,
- },
- .consumer_supplies = u8500_esram12_consumers,
- .num_consumer_supplies = ARRAY_SIZE(u8500_esram12_consumers),
-};
-
-/* ESRAM1 and 2 retention regulator switch */
-static struct regulator_consumer_supply u8500_esram12ret_consumers[] = {
- {
- /* NOTE! This is a temporary supply for prcmu_set_hwacc */
- .supply = "hwacc-esram1-ret",
- },
- {
- /* NOTE! This is a temporary supply for prcmu_set_hwacc */
- .supply = "hwacc-esram2-ret",
- },
-#ifdef CONFIG_U8500_REGULATOR_DEBUG
- {
- .dev_name = "reg-virt-consumer.29",
- .supply = "test",
- },
-#endif
-};
-
-struct regulator_init_data u8500_esram12ret_regulator = {
- .constraints = {
- .name = "u8500-esram12-ret",
- .valid_ops_mask = REGULATOR_CHANGE_STATUS,
- },
- .consumer_supplies = u8500_esram12ret_consumers,
- .num_consumer_supplies = ARRAY_SIZE(u8500_esram12ret_consumers),
-};
-
-/* ESRAM3 and 4 regulator switch */
-static struct regulator_consumer_supply u8500_esram34_consumers[] = {
- {
- .dev_name = "mcde",
- .supply = "v-esram34",
- },
- {
- /* NOTE! This is a temporary supply for prcmu_set_hwacc */
- .supply = "hwacc-esram3",
- },
- {
- /* NOTE! This is a temporary supply for prcmu_set_hwacc */
- .supply = "hwacc-esram4",
- },
- {
- .dev_name = "cm_control",
- .supply = "esram34",
- },
-#ifdef CONFIG_U8500_REGULATOR_DEBUG
- {
- .dev_name = "reg-virt-consumer.30",
- .supply = "test",
- },
-#endif
-};
-
-struct regulator_init_data u8500_esram34_regulator = {
- /*
- * esram34 is set in retention and supplied by Vsafe when Vape is off,
- * no need to hold Vape
- */
- .constraints = {
- .name = "u8500-esram34",
- .valid_ops_mask = REGULATOR_CHANGE_STATUS,
- },
- .consumer_supplies = u8500_esram34_consumers,
- .num_consumer_supplies = ARRAY_SIZE(u8500_esram34_consumers),
-};
-
-/* ESRAM3 and 4 retention regulator switch */
-static struct regulator_consumer_supply u8500_esram34ret_consumers[] = {
- {
- /* NOTE! This is a temporary supply for prcmu_set_hwacc */
- .supply = "hwacc-esram3-ret",
- },
- {
- /* NOTE! This is a temporary supply for prcmu_set_hwacc */
- .supply = "hwacc-esram4-ret",
- },
-#ifdef CONFIG_U8500_REGULATOR_DEBUG
- {
- .dev_name = "reg-virt-consumer.31",
- .supply = "test",
- },
-#endif
-};
-
-struct regulator_init_data u8500_esram34ret_regulator = {
- .constraints = {
- .name = "u8500-esram34-ret",
- .valid_ops_mask = REGULATOR_CHANGE_STATUS,
- },
- .consumer_supplies = u8500_esram34ret_consumers,
- .num_consumer_supplies = ARRAY_SIZE(u8500_esram34ret_consumers),
};
diff --git a/arch/arm/mach-ux500/board-mop500-regulators.h b/arch/arm/mach-ux500/board-mop500-regulators.h
index 5a4f9560b1e..94992158d96 100644
--- a/arch/arm/mach-ux500/board-mop500-regulators.h
+++ b/arch/arm/mach-ux500/board-mop500-regulators.h
@@ -14,33 +14,9 @@
#include <linux/regulator/machine.h>
#include <linux/regulator/ab8500.h>
-/* AB8500 regulators */
extern struct ab8500_regulator_reg_init
- ab8500_regulator_reg_init[AB8500_NUM_REGULATOR_REGISTERS];
+ab8500_regulator_reg_init[AB8500_NUM_REGULATOR_REGISTERS];
extern struct regulator_init_data ab8500_regulators[AB8500_NUM_REGULATORS];
-
-/* U8500 specific regulators */
-extern struct regulator_init_data u8500_vape_regulator;
-extern struct regulator_init_data u8500_varm_regulator;
-extern struct regulator_init_data u8500_vmodem_regulator;
-extern struct regulator_init_data u8500_vpll_regulator;
-extern struct regulator_init_data u8500_vsmps1_regulator;
-extern struct regulator_init_data u8500_vsmps2_regulator;
-extern struct regulator_init_data u8500_vsmps3_regulator;
-extern struct regulator_init_data u8500_vrf1_regulator;
-
-/* U8500 specific regulator switches */
-extern struct regulator_init_data u8500_svammdsp_regulator;
-extern struct regulator_init_data u8500_svammdspret_regulator;
-extern struct regulator_init_data u8500_svapipe_regulator;
-extern struct regulator_init_data u8500_siammdsp_regulator;
-extern struct regulator_init_data u8500_siammdspret_regulator;
-extern struct regulator_init_data u8500_siapipe_regulator;
-extern struct regulator_init_data u8500_sga_regulator;
-extern struct regulator_init_data u8500_b2r2_mcde_regulator;
-extern struct regulator_init_data u8500_esram12_regulator;
-extern struct regulator_init_data u8500_esram12ret_regulator;
-extern struct regulator_init_data u8500_esram34_regulator;
-extern struct regulator_init_data u8500_esram34ret_regulator;
+extern struct regulator_init_data tps61052_regulator;
#endif
diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c
index 0060f0399a4..6d6a3d4c5ac 100644
--- a/arch/arm/mach-ux500/board-mop500.c
+++ b/arch/arm/mach-ux500/board-mop500.c
@@ -68,7 +68,6 @@
#include "devices-db8500.h"
#include "board-mop500.h"
#include "board-mop500-regulators.h"
-#include "regulator-u8500.h"
#include "board-mop500-bm.h"
#include "board-mop500-wlan.h"
#include "board-ux500-usb.h"
@@ -108,7 +107,7 @@ static struct platform_device snowball_led_dev = {
static struct ab8500_gpio_platform_data ab8500_gpio_pdata = {
.gpio_base = MOP500_AB8500_GPIO(0),
.irq_base = MOP500_AB8500_VIR_GPIO_IRQ_BASE,
- /* initial_pin_config is the initial configuration of ab8500 pins.
+ /* config_reg is the initial configuration of ab8500 pins.
* The pins can be configured as GPIO or alt functions based
* on value present in GpioSel1 to GpioSel6 and AlternatFunction
* register. This is the array of 7 configuration settings.
@@ -129,18 +128,18 @@ static struct ab8500_gpio_platform_data ab8500_gpio_pdata = {
* AlternaFunction = 0x00 => If Pins GPIO10 to 13 are not configured
* as GPIO then this register selectes the alternate functions
*/
- .initial_pin_config = {0x0F, 0x9E, 0x80, 0x01, 0x78, 0x02, 0x00},
+ .config_reg = {0x0F, 0x9E, 0x80, 0x01, 0x78, 0x02, 0x00},
- /* initial_pin_direction allows for the initial GPIO direction to
+ /* config_direction allows for the initial GPIO direction to
* be set. For Snowball we set GPIO26 to output.
*/
- .initial_pin_direction = {0x00, 0x00, 0x00, 0x02, 0x00, 0x00},
+ .config_direction = {0x00, 0x00, 0x00, 0x02, 0x00, 0x00},
/*
- * initial_pin_pullups allows for the intial configuration of the
+ * config_pullups allows for the intial configuration of the
* GPIO pullup/pulldown configuration.
*/
- .initial_pin_pullups = {0xE0, 0x01, 0x00, 0x00, 0x00, 0x00},
+ .config_pullups = {0xE0, 0x01, 0x00, 0x00, 0x00, 0x00},
};
#ifdef CONFIG_INPUT_AB8500_ACCDET
@@ -243,38 +242,6 @@ static struct platform_device snowball_sbnet_dev = {
},
};
-static struct regulator_init_data *u8500_regulators[U8500_NUM_REGULATORS] = {
- [U8500_REGULATOR_VAPE] = &u8500_vape_regulator,
- [U8500_REGULATOR_VARM] = &u8500_varm_regulator,
- [U8500_REGULATOR_VMODEM] = &u8500_vmodem_regulator,
- [U8500_REGULATOR_VPLL] = &u8500_vpll_regulator,
- [U8500_REGULATOR_VSMPS1] = &u8500_vsmps1_regulator,
- [U8500_REGULATOR_VSMPS2] = &u8500_vsmps2_regulator,
- [U8500_REGULATOR_VSMPS3] = &u8500_vsmps3_regulator,
- [U8500_REGULATOR_VRF1] = &u8500_vrf1_regulator,
- [U8500_REGULATOR_SWITCH_SVAMMDSP] = &u8500_svammdsp_regulator,
- [U8500_REGULATOR_SWITCH_SVAMMDSPRET] = &u8500_svammdspret_regulator,
- [U8500_REGULATOR_SWITCH_SVAPIPE] = &u8500_svapipe_regulator,
- [U8500_REGULATOR_SWITCH_SIAMMDSP] = &u8500_siammdsp_regulator,
- [U8500_REGULATOR_SWITCH_SIAMMDSPRET] = &u8500_siammdspret_regulator,
- [U8500_REGULATOR_SWITCH_SIAPIPE] = &u8500_siapipe_regulator,
- [U8500_REGULATOR_SWITCH_SGA] = &u8500_sga_regulator,
- [U8500_REGULATOR_SWITCH_B2R2_MCDE] = &u8500_b2r2_mcde_regulator,
- [U8500_REGULATOR_SWITCH_ESRAM12] = &u8500_esram12_regulator,
- [U8500_REGULATOR_SWITCH_ESRAM12RET] = &u8500_esram12ret_regulator,
- [U8500_REGULATOR_SWITCH_ESRAM34] = &u8500_esram34_regulator,
- [U8500_REGULATOR_SWITCH_ESRAM34RET] = &u8500_esram34ret_regulator,
-};
-
-static struct platform_device u8500_regulator_dev = {
- .name = "u8500-regulators",
- .id = 0,
- .dev = {
- .platform_data = u8500_regulators,
- },
-};
-
-
#ifdef CONFIG_MODEM_U8500
static struct platform_device u8500_modem_dev = {
.name = "u8500-modem",
@@ -1181,10 +1148,6 @@ static void __init mop500_init_machine(void)
{
int i2c0_devs;
-#ifdef CONFIG_REGULATOR
- platform_device_register(&u8500_regulator_dev);
-#endif
-
/*
* The HREFv60 board removed a GPIO expander and routed
* all these GPIO pins to the internal GPIO controller
diff --git a/arch/arm/mach-ux500/include/mach/regulator.h b/arch/arm/mach-ux500/include/mach/regulator.h
deleted file mode 100644
index 18c0a011a8f..00000000000
--- a/arch/arm/mach-ux500/include/mach/regulator.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (C) ST-Ericsson SA 2010
- *
- * Author: Bengt Jonsson <bengt.jonsson@stericsson.com> for ST-Ericsson,
- * Jonas Aaberg <jonas.aberg@stericsson.com> for ST-Ericsson
- *
- * License Terms: GNU General Public License v2
- *
- */
-
-#ifndef MACH_UX500_REGULATOR_H
-#define MACH_UX500_REGULATOR_H
-
-#include <linux/device.h>
-
-struct ux500_regulator;
-
-#ifdef CONFIG_REGULATOR
-/*
- * NOTE! The device will be connected to the correct regulator by this
- * new framework. A list with connections will match up dev_name(dev)
- * to the specific regulator. This follows the same principle as the
- * normal regulator framework.
- *
- * This framework shall only be used in special cases when a regulator
- * has to be enabled/disabled in atomic context.
- */
-
-/**
- * ux500_regulator_get()
- *
- * @dev: Drivers device struct
- *
- * Returns a ux500_regulator struct. Shall be used as argument for
- * ux500_regulator_atomic_enable/disable calls.
- * Return ERR_PTR(-EINVAL) upon no matching regulator found.
- */
-struct ux500_regulator *__must_check ux500_regulator_get(struct device *dev);
-
-/**
- * ux500_regulator_atomic_enable()
- *
- * @regulator: Regulator handle, provided from ux500_regulator_get.
- *
- * The enable/disable functions keep an internal counter, so every
- * enable must be paired with an disable in order to turn off regulator.
- */
-int ux500_regulator_atomic_enable(struct ux500_regulator *regulator);
-
-/**
- * ux500_regulator_atomic_disable()
- *
- * @regulator: Regulator handle, provided from ux500_regulator_get.
- *
- */
-int ux500_regulator_atomic_disable(struct ux500_regulator *regulator);
-
-/**
- * ux500_regulator_put()
- *
- * @regulator: Regulator handle, provided from ux500_regulator_get.
- */
-void ux500_regulator_put(struct ux500_regulator *regulator);
-#else
-static inline struct ux500_regulator *__must_check
-ux500_regulator_get(struct device *dev)
-{
- return ERR_PTR(-EINVAL);
-}
-
-static inline int
-ux500_regulator_atomic_enable(struct ux500_regulator *regulator)
-{
- return -EINVAL;
-}
-
-static inline int
-ux500_regulator_atomic_disable(struct ux500_regulator *regulator)
-{
- return -EINVAL;
-}
-
-static inline void ux500_regulator_put(struct ux500_regulator *regulator)
-{
-}
-#endif
-
-#ifdef CONFIG_REGULATOR_DEBUG
-void ux500_regulator_suspend_debug(void);
-void ux500_regulator_resume_debug(void);
-#else
-static inline void ux500_regulator_suspend_debug(void) { }
-static inline void ux500_regulator_resume_debug(void) { }
-#endif
-
-#endif
diff --git a/arch/arm/mach-ux500/pm/runtime.c b/arch/arm/mach-ux500/pm/runtime.c
index f50d934bd2d..839b6a007b3 100644
--- a/arch/arm/mach-ux500/pm/runtime.c
+++ b/arch/arm/mach-ux500/pm/runtime.c
@@ -17,9 +17,9 @@
#include <linux/pm_runtime.h>
#include <linux/platform_device.h>
#include <linux/amba/bus.h>
+#include <linux/mfd/dbx500-prcmu.h>
#include <linux/clk.h>
#include <plat/pincfg.h>
-#include <mach/regulator.h>
#include "../pins.h"
diff --git a/arch/arm/mach-ux500/regulator-u8500.c b/arch/arm/mach-ux500/regulator-u8500.c
deleted file mode 100644
index 49900251b06..00000000000
--- a/arch/arm/mach-ux500/regulator-u8500.c
+++ /dev/null
@@ -1,265 +0,0 @@
-/*
- * Copyright (C) ST-Ericsson SA 2010
- *
- * License Terms: GNU General Public License v2
- * Author: Bengt Jonsson <bengt.g.jonsson@stericsson.com> for ST-Ericsson
- */
-
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/module.h>
-#include <linux/platform_device.h>
-#include <linux/regulator/driver.h>
-#include <linux/regulator/machine.h>
-#include <linux/mfd/dbx500-prcmu.h>
-
-#include "regulator-ux500.h"
-#include "regulator-u8500.h"
-
-static struct u8500_regulator_info
- u8500_regulator_info[U8500_NUM_REGULATORS] = {
- [U8500_REGULATOR_VAPE] = {
- .desc = {
- .name = "u8500-vape",
- .id = U8500_REGULATOR_VAPE,
- .ops = &ux500_regulator_ops,
- .type = REGULATOR_VOLTAGE,
- .owner = THIS_MODULE,
- },
- },
- [U8500_REGULATOR_VARM] = {
- .desc = {
- .name = "u8500-varm",
- .id = U8500_REGULATOR_VARM,
- .ops = &ux500_regulator_ops,
- .type = REGULATOR_VOLTAGE,
- .owner = THIS_MODULE,
- },
- },
- [U8500_REGULATOR_VMODEM] = {
- .desc = {
- .name = "u8500-vmodem",
- .id = U8500_REGULATOR_VMODEM,
- .ops = &ux500_regulator_ops,
- .type = REGULATOR_VOLTAGE,
- .owner = THIS_MODULE,
- },
- },
- [U8500_REGULATOR_VPLL] = {
- .desc = {
- .name = "u8500-vpll",
- .id = U8500_REGULATOR_VPLL,
- .ops = &ux500_regulator_ops,
- .type = REGULATOR_VOLTAGE,
- .owner = THIS_MODULE,
- },
- },
- [U8500_REGULATOR_VSMPS1] = {
- .desc = {
- .name = "u8500-vsmps1",
- .id = U8500_REGULATOR_VSMPS1,
- .ops = &ux500_regulator_ops,
- .type = REGULATOR_VOLTAGE,
- .owner = THIS_MODULE,
- },
- },
- [U8500_REGULATOR_VSMPS2] = {
- .desc = {
- .name = "u8500-vsmps2",
- .id = U8500_REGULATOR_VSMPS2,
- .ops = &ux500_regulator_ops,
- .type = REGULATOR_VOLTAGE,
- .owner = THIS_MODULE,
- },
- .exclude_from_power_state = true,
- },
- [U8500_REGULATOR_VSMPS3] = {
- .desc = {
- .name = "u8500-vsmps3",
- .id = U8500_REGULATOR_VSMPS3,
- .ops = &ux500_regulator_ops,
- .type = REGULATOR_VOLTAGE,
- .owner = THIS_MODULE,
- },
- },
- [U8500_REGULATOR_VRF1] = {
- .desc = {
- .name = "u8500-vrf1",
- .id = U8500_REGULATOR_VRF1,
- .ops = &ux500_regulator_ops,
- .type = REGULATOR_VOLTAGE,
- .owner = THIS_MODULE,
- },
- },
- [U8500_REGULATOR_SWITCH_SVAMMDSP] = {
- .desc = {
- .name = "u8500-sva-mmdsp",
- .id = U8500_REGULATOR_SWITCH_SVAMMDSP,
- .ops = &ux500_regulator_switch_ops,
- .type = REGULATOR_VOLTAGE,
- .owner = THIS_MODULE,
- },
- .epod_id = EPOD_ID_SVAMMDSP,
- },
- [U8500_REGULATOR_SWITCH_SVAMMDSPRET] = {
- .desc = {
- .name = "u8500-sva-mmdsp-ret",
- .id = U8500_REGULATOR_SWITCH_SVAMMDSPRET,
- .ops = &ux500_regulator_switch_ops,
- .type = REGULATOR_VOLTAGE,
- .owner = THIS_MODULE,
- },
- .epod_id = EPOD_ID_SVAMMDSP,
- .is_ramret = true,
- },
- [U8500_REGULATOR_SWITCH_SVAPIPE] = {
- .desc = {
- .name = "u8500-sva-pipe",
- .id = U8500_REGULATOR_SWITCH_SVAPIPE,
- .ops = &ux500_regulator_switch_ops,
- .type = REGULATOR_VOLTAGE,
- .owner = THIS_MODULE,
- },
- .epod_id = EPOD_ID_SVAPIPE,
- },
- [U8500_REGULATOR_SWITCH_SIAMMDSP] = {
- .desc = {
- .name = "u8500-sia-mmdsp",
- .id = U8500_REGULATOR_SWITCH_SIAMMDSP,
- .ops = &ux500_regulator_switch_ops,
- .type = REGULATOR_VOLTAGE,
- .owner = THIS_MODULE,
- },
- .epod_id = EPOD_ID_SIAMMDSP,
- },
- [U8500_REGULATOR_SWITCH_SIAMMDSPRET] = {
- .desc = {
- .name = "u8500-sia-mmdsp-ret",
- .id = U8500_REGULATOR_SWITCH_SIAMMDSPRET,
- .ops = &ux500_regulator_switch_ops,
- .type = REGULATOR_VOLTAGE,
- .owner = THIS_MODULE,
- },
- .epod_id = EPOD_ID_SIAMMDSP,
- .is_ramret = true,
- },
- [U8500_REGULATOR_SWITCH_SIAPIPE] = {
- .desc = {
- .name = "u8500-sia-pipe",
- .id = U8500_REGULATOR_SWITCH_SIAPIPE,
- .ops = &ux500_regulator_switch_ops,
- .type = REGULATOR_VOLTAGE,
- .owner = THIS_MODULE,
- },
- .epod_id = EPOD_ID_SIAPIPE,
- },
- [U8500_REGULATOR_SWITCH_SGA] = {
- .desc = {
- .name = "u8500-sga",
- .id = U8500_REGULATOR_SWITCH_SGA,
- .ops = &ux500_regulator_switch_ops,
- .type = REGULATOR_VOLTAGE,
- .owner = THIS_MODULE,
- },
- .epod_id = EPOD_ID_SGA,
- },
- [U8500_REGULATOR_SWITCH_B2R2_MCDE] = {
- .desc = {
- .name = "u8500-b2r2-mcde",
- .id = U8500_REGULATOR_SWITCH_B2R2_MCDE,
- .ops = &ux500_regulator_switch_ops,
- .type = REGULATOR_VOLTAGE,
- .owner = THIS_MODULE,
- },
- .epod_id = EPOD_ID_B2R2_MCDE,
- },
- [U8500_REGULATOR_SWITCH_ESRAM12] = {
- .desc = {
- .name = "u8500-esram12",
- .id = U8500_REGULATOR_SWITCH_ESRAM12,
- .ops = &ux500_regulator_switch_ops,
- .type = REGULATOR_VOLTAGE,
- .owner = THIS_MODULE,
- },
- .epod_id = EPOD_ID_ESRAM12,
- .is_enabled = true,
- },
- [U8500_REGULATOR_SWITCH_ESRAM12RET] = {
- .desc = {
- .name = "u8500-esram12-ret",
- .id = U8500_REGULATOR_SWITCH_ESRAM12RET,
- .ops = &ux500_regulator_switch_ops,
- .type = REGULATOR_VOLTAGE,
- .owner = THIS_MODULE,
- },
- .epod_id = EPOD_ID_ESRAM12,
- .is_ramret = true,
- },
- [U8500_REGULATOR_SWITCH_ESRAM34] = {
- .desc = {
- .name = "u8500-esram34",
- .id = U8500_REGULATOR_SWITCH_ESRAM34,
- .ops = &ux500_regulator_switch_ops,
- .type = REGULATOR_VOLTAGE,
- .owner = THIS_MODULE,
- },
- .epod_id = EPOD_ID_ESRAM34,
- .is_enabled = true,
- },
- [U8500_REGULATOR_SWITCH_ESRAM34RET] = {
- .desc = {
- .name = "u8500-esram34-ret",
- .id = U8500_REGULATOR_SWITCH_ESRAM34RET,
- .ops = &ux500_regulator_switch_ops,
- .type = REGULATOR_VOLTAGE,
- .owner = THIS_MODULE,
- },
- .epod_id = EPOD_ID_ESRAM34,
- .is_ramret = true,
- },
-};
-
-static int __devinit u8500_regulator_probe(struct platform_device *pdev)
-{
- int ret;
-
- ret = ux500_regulator_probe(pdev, u8500_regulator_info,
- ARRAY_SIZE(u8500_regulator_info));
- if (!ret)
- regulator_has_full_constraints();
-
- return ret;
-}
-
-static int __devexit u8500_regulator_remove(struct platform_device *pdev)
-{
- return ux500_regulator_remove(pdev, u8500_regulator_info,
- ARRAY_SIZE(u8500_regulator_info));
-}
-
-static struct platform_driver u8500_regulator_driver = {
- .driver = {
- .name = "u8500-regulators",
- .owner = THIS_MODULE,
- },
- .probe = u8500_regulator_probe,
- .remove = __devexit_p(u8500_regulator_remove),
-};
-
-static int __init u8500_regulator_init(void)
-{
- return platform_driver_register(&u8500_regulator_driver);
-}
-
-static void __exit u8500_regulator_exit(void)
-{
- platform_driver_unregister(&u8500_regulator_driver);
-}
-
-/* replaced subsys_initcall as regulators must be turned on early */
-arch_initcall(u8500_regulator_init);
-module_exit(u8500_regulator_exit);
-
-MODULE_AUTHOR("Bengt Jonsson <bengt.g.jonsson@stericsson.com>");
-MODULE_DESCRIPTION("U8500 regulator driver");
-MODULE_LICENSE("GPL v2");
diff --git a/arch/arm/mach-ux500/regulator-u8500.h b/arch/arm/mach-ux500/regulator-u8500.h
deleted file mode 100644
index 01dfeeb9da7..00000000000
--- a/arch/arm/mach-ux500/regulator-u8500.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) ST-Ericsson SA 2010
- *
- * License Terms: GNU General Public License v2
- *
- * Author: Bengt Jonsson <bengt.g.jonsson@stericsson.com> for ST-Ericsson
- *
- * Interface to platform specific regulators on U8500
- */
-
-#ifndef __REGULATOR_H__
-#define __REGULATOR_H__
-
-/* Number of U8500 regulators and regulator enumeration */
-enum u8500_regulator_id {
- U8500_REGULATOR_VAPE,
- U8500_REGULATOR_VARM,
- U8500_REGULATOR_VMODEM,
- U8500_REGULATOR_VPLL,
- U8500_REGULATOR_VSMPS1,
- U8500_REGULATOR_VSMPS2,
- U8500_REGULATOR_VSMPS3,
- U8500_REGULATOR_VRF1,
- U8500_REGULATOR_SWITCH_SVAMMDSP,
- U8500_REGULATOR_SWITCH_SVAMMDSPRET,
- U8500_REGULATOR_SWITCH_SVAPIPE,
- U8500_REGULATOR_SWITCH_SIAMMDSP,
- U8500_REGULATOR_SWITCH_SIAMMDSPRET,
- U8500_REGULATOR_SWITCH_SIAPIPE,
- U8500_REGULATOR_SWITCH_SGA,
- U8500_REGULATOR_SWITCH_B2R2_MCDE,
- U8500_REGULATOR_SWITCH_ESRAM12,
- U8500_REGULATOR_SWITCH_ESRAM12RET,
- U8500_REGULATOR_SWITCH_ESRAM34,
- U8500_REGULATOR_SWITCH_ESRAM34RET,
- U8500_NUM_REGULATORS
-};
-
-/*
- * Exported interface for CPUIdle only. This function is called with all
- * interrupts turned off.
- */
-int power_state_active_is_enabled(void);
-
-#endif
-
diff --git a/arch/arm/mach-ux500/regulator-ux500.c b/arch/arm/mach-ux500/regulator-ux500.c
deleted file mode 100644
index 4f84b9ac48d..00000000000
--- a/arch/arm/mach-ux500/regulator-ux500.c
+++ /dev/null
@@ -1,562 +0,0 @@
-/*
- * Copyright (C) ST-Ericsson SA 2010
- *
- * License Terms: GNU General Public License v2
- * Authors: Sundar Iyer <sundar.iyer@stericsson.com> for ST-Ericsson
- * Bengt Jonsson <bengt.g.jonsson@stericsson.com> for ST-Ericsson
- *
- * Platform specific regulators on U8500
- *
- * NOTE! The power domains in here will be updated once B2R2 and MCDE are
- * converted to use the regulator API.
- */
-
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/err.h>
-#include <linux/spinlock.h>
-#include <linux/platform_device.h>
-#include <linux/regulator/driver.h>
-#include <linux/regulator/machine.h>
-#include <linux/mfd/dbx500-prcmu.h>
-#include <linux/debugfs.h>
-#include <linux/seq_file.h>
-#include <linux/slab.h>
-
-#include "regulator-ux500.h"
-
-#ifdef CONFIG_REGULATOR_DEBUG
-
-static struct ux500_regulator_debug {
- struct dentry *dir;
- struct dentry *status_file;
- struct u8500_regulator_info *regulator_array;
- int num_regulators;
- u8 *state_before_suspend;
- u8 *state_after_suspend;
-} rdebug;
-
-void ux500_regulator_suspend_debug(void)
-{
- int i;
- for (i = 0; i < rdebug.num_regulators; i++)
- rdebug.state_before_suspend[i] =
- rdebug.regulator_array[i].is_enabled;
-}
-
-void ux500_regulator_resume_debug(void)
-{
- int i;
- for (i = 0; i < rdebug.num_regulators; i++)
- rdebug.state_after_suspend[i] =
- rdebug.regulator_array[i].is_enabled;
-}
-
-static int ux500_regulator_status_print(struct seq_file *s, void *p)
-{
- struct device *dev = s->private;
- int err;
- int i;
-
- /* print dump header */
- err = seq_printf(s, "ux500-regulator status:\n");
- if (err < 0)
- dev_err(dev, "seq_printf overflow\n");
-
- err = seq_printf(s, "%31s : %8s : %8s\n", "current",
- "before", "after");
- if (err < 0)
- dev_err(dev, "seq_printf overflow\n");
-
- for (i = 0; i < rdebug.num_regulators; i++) {
- struct u8500_regulator_info *info;
- /* Access per-regulator data */
- info = &rdebug.regulator_array[i];
-
- /* print status */
- err = seq_printf(s, "%20s : %8s : %8s : %8s\n", info->desc.name,
- info->is_enabled ? "enabled" : "disabled",
- rdebug.state_before_suspend[i] ? "enabled" : "disabled",
- rdebug.state_after_suspend[i] ? "enabled" : "disabled");
- if (err < 0)
- dev_err(dev, "seq_printf overflow\n");
- }
-
- return 0;
-}
-
-static int ux500_regulator_status_open(struct inode *inode, struct file *file)
-{
- return single_open(file, ux500_regulator_status_print,
- inode->i_private);
-}
-
-static const struct file_operations ux500_regulator_status_fops = {
- .open = ux500_regulator_status_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = single_release,
- .owner = THIS_MODULE,
-};
-
-static int __devinit
-ux500_regulator_debug_init(struct platform_device *pdev,
- struct u8500_regulator_info *regulator_info,
- int num_regulators)
-{
- /* create directory */
- rdebug.dir = debugfs_create_dir("ux500-regulator", NULL);
- if (!rdebug.dir)
- goto exit_no_debugfs;
-
- /* create "status" file */
- rdebug.status_file = debugfs_create_file("status",
- S_IRUGO, rdebug.dir, &pdev->dev,
- &ux500_regulator_status_fops);
- if (!rdebug.status_file)
- goto exit_destroy_dir;
-
- rdebug.regulator_array = regulator_info;
- rdebug.num_regulators = num_regulators;
-
- rdebug.state_before_suspend = kzalloc(num_regulators, GFP_KERNEL);
- if (!rdebug.state_before_suspend) {
- dev_err(&pdev->dev,
- "could not allocate memory for saving state\n");
- goto exit_destory_status;
- }
-
- rdebug.state_after_suspend = kzalloc(num_regulators, GFP_KERNEL);
- if (!rdebug.state_after_suspend) {
- dev_err(&pdev->dev,
- "could not allocate memory for saving state\n");
- goto exit_free;
- }
- return 0;
-
-exit_free:
- kfree(rdebug.state_before_suspend);
-exit_destory_status:
- debugfs_remove(rdebug.status_file);
-exit_destroy_dir:
- debugfs_remove(rdebug.dir);
-exit_no_debugfs:
- dev_err(&pdev->dev, "failed to create debugfs entries.\n");
- return -ENOMEM;
-}
-
-static int __devexit ux500_regulator_debug_exit(void)
-{
- debugfs_remove_recursive(rdebug.dir);
- kfree(rdebug.state_after_suspend);
- kfree(rdebug.state_before_suspend);
-
- return 0;
-}
-
-#else
-
-static inline int
-ux500_regulator_debug_init(struct platform_device *pdev,
- struct u8500_regulator_info *regulator_info,
- int num_regulators) {}
-
-static inline int ux500_regulator_debug_exit(void) {}
-
-#endif
-
-/*
- * power state reference count
- */
-static int power_state_active_cnt; /* will initialize to zero */
-static DEFINE_SPINLOCK(power_state_active_lock);
-
-static void power_state_active_enable(void)
-{
- unsigned long flags;
-
- spin_lock_irqsave(&power_state_active_lock, flags);
- power_state_active_cnt++;
- spin_unlock_irqrestore(&power_state_active_lock, flags);
-}
-
-static int power_state_active_disable(void)
-{
- int ret = 0;
- unsigned long flags;
-
- spin_lock_irqsave(&power_state_active_lock, flags);
- if (power_state_active_cnt <= 0) {
- pr_err("power state: unbalanced enable/disable calls\n");
- ret = -EINVAL;
- goto out;
- }
-
- power_state_active_cnt--;
-out:
- spin_unlock_irqrestore(&power_state_active_lock, flags);
- return ret;
-}
-
-/*
- * Exported interface for CPUIdle only. This function is called when interrupts
- * are turned off. Hence, no locking.
- */
-int power_state_active_is_enabled(void)
-{
- return (power_state_active_cnt > 0);
-}
-
-struct ux500_regulator {
- char *name;
- void (*enable)(void);
- int (*disable)(void);
-};
-
-/*
- * Don't add any clients to this struct without checking with regulator
- * responsible!
- */
-static struct ux500_regulator ux500_atomic_regulators[] = {
- {
- .name = "dma40.0",
- .enable = power_state_active_enable,
- .disable = power_state_active_disable,
- },
- {
- .name = "ssp0",
- .enable = power_state_active_enable,
- .disable = power_state_active_disable,
- },
- {
- .name = "ssp1",
- .enable = power_state_active_enable,
- .disable = power_state_active_disable,
- },
- {
- .name = "spi0",
- .enable = power_state_active_enable,
- .disable = power_state_active_disable,
- },
- {
- .name = "spi1",
- .enable = power_state_active_enable,
- .disable = power_state_active_disable,
- },
- {
- .name = "spi2",
- .enable = power_state_active_enable,
- .disable = power_state_active_disable,
- },
- {
- .name = "spi3",
- .enable = power_state_active_enable,
- .disable = power_state_active_disable,
- },
- {
- .name = "cryp1",
- .enable = power_state_active_enable,
- .disable = power_state_active_disable,
- },
- {
- .name = "hash1",
- .enable = power_state_active_enable,
- .disable = power_state_active_disable,
- },
-};
-
-struct ux500_regulator *__must_check ux500_regulator_get(struct device *dev)
-{
- int i;
-
- for (i = 0; i < ARRAY_SIZE(ux500_atomic_regulators); i++) {
- if (!strcmp(dev_name(dev), ux500_atomic_regulators[i].name))
- return &ux500_atomic_regulators[i];
- }
-
- return ERR_PTR(-EINVAL);
-}
-EXPORT_SYMBOL_GPL(ux500_regulator_get);
-
-int ux500_regulator_atomic_enable(struct ux500_regulator *regulator)
-{
- if (regulator) {
- regulator->enable();
- return 0;
- }
- return -EINVAL;
-}
-EXPORT_SYMBOL_GPL(ux500_regulator_atomic_enable);
-
-int ux500_regulator_atomic_disable(struct ux500_regulator *regulator)
-{
- if (regulator)
- return regulator->disable();
- else
- return -EINVAL;
-}
-EXPORT_SYMBOL_GPL(ux500_regulator_atomic_disable);
-
-void ux500_regulator_put(struct ux500_regulator *regulator)
-{
- /* Here for symetric reasons and for possible future use */
-}
-EXPORT_SYMBOL_GPL(ux500_regulator_put);
-
-static int u8500_regulator_enable(struct regulator_dev *rdev)
-{
- struct u8500_regulator_info *info = rdev_get_drvdata(rdev);
-
- if (info == NULL)
- return -EINVAL;
-
- dev_vdbg(rdev_get_dev(rdev), "regulator-%s-enable\n",
- info->desc.name);
-
- info->is_enabled = 1;
- if (!info->exclude_from_power_state)
- power_state_active_enable();
-
- return 0;
-}
-
-static int u8500_regulator_disable(struct regulator_dev *rdev)
-{
- struct u8500_regulator_info *info = rdev_get_drvdata(rdev);
- int ret = 0;
-
- if (info == NULL)
- return -EINVAL;
-
- dev_vdbg(rdev_get_dev(rdev), "regulator-%s-disable\n",
- info->desc.name);
-
- info->is_enabled = 0;
- if (!info->exclude_from_power_state)
- ret = power_state_active_disable();
-
- return ret;
-}
-
-static int u8500_regulator_is_enabled(struct regulator_dev *rdev)
-{
- struct u8500_regulator_info *info = rdev_get_drvdata(rdev);
-
- if (info == NULL)
- return -EINVAL;
-
- dev_vdbg(rdev_get_dev(rdev), "regulator-%s-is_enabled (is_enabled):"
- " %i\n", info->desc.name, info->is_enabled);
-
- return info->is_enabled;
-}
-
-/* u8500 regulator operations */
-struct regulator_ops ux500_regulator_ops = {
- .enable = u8500_regulator_enable,
- .disable = u8500_regulator_disable,
- .is_enabled = u8500_regulator_is_enabled,
-};
-
-/*
- * EPOD control
- */
-static bool epod_on[NUM_EPOD_ID];
-static bool epod_ramret[NUM_EPOD_ID];
-
-static int epod_id_to_index(u16 epod_id)
-{
- if (cpu_is_u5500())
- return epod_id - DB5500_EPOD_ID_BASE;
- else
- return epod_id;
-}
-
-static int enable_epod(u16 epod_id, bool ramret)
-{
- int idx = epod_id_to_index(epod_id);
- int ret;
-
- if (ramret) {
- if (!epod_on[idx]) {
- ret = prcmu_set_epod(epod_id, EPOD_STATE_RAMRET);
- if (ret < 0)
- return ret;
- }
- epod_ramret[idx] = true;
- } else {
- ret = prcmu_set_epod(epod_id, EPOD_STATE_ON);
- if (ret < 0)
- return ret;
- epod_on[idx] = true;
- }
-
- return 0;
-}
-
-static int disable_epod(u16 epod_id, bool ramret)
-{
- int idx = epod_id_to_index(epod_id);
- int ret;
-
- if (ramret) {
- if (!epod_on[idx]) {
- ret = prcmu_set_epod(epod_id, EPOD_STATE_OFF);
- if (ret < 0)
- return ret;
- }
- epod_ramret[idx] = false;
- } else {
- if (epod_ramret[idx]) {
- ret = prcmu_set_epod(epod_id, EPOD_STATE_RAMRET);
- if (ret < 0)
- return ret;
- } else {
- ret = prcmu_set_epod(epod_id, EPOD_STATE_OFF);
- if (ret < 0)
- return ret;
- }
- epod_on[idx] = false;
- }
-
- return 0;
-}
-
-/*
- * Regulator switch
- */
-static int u8500_regulator_switch_enable(struct regulator_dev *rdev)
-{
- struct u8500_regulator_info *info = rdev_get_drvdata(rdev);
- int ret;
-
- if (info == NULL)
- return -EINVAL;
-
- dev_vdbg(rdev_get_dev(rdev), "regulator-switch-%s-enable\n",
- info->desc.name);
-
- ret = enable_epod(info->epod_id, info->is_ramret);
- if (ret < 0) {
- dev_err(rdev_get_dev(rdev),
- "regulator-switch-%s-enable: prcmu call failed\n",
- info->desc.name);
- goto out;
- }
-
- info->is_enabled = 1;
-out:
- return ret;
-}
-
-static int u8500_regulator_switch_disable(struct regulator_dev *rdev)
-{
- struct u8500_regulator_info *info = rdev_get_drvdata(rdev);
- int ret;
-
- if (info == NULL)
- return -EINVAL;
-
- dev_vdbg(rdev_get_dev(rdev), "regulator-switch-%s-disable\n",
- info->desc.name);
-
- ret = disable_epod(info->epod_id, info->is_ramret);
- if (ret < 0) {
- dev_err(rdev_get_dev(rdev),
- "regulator_switch-%s-disable: prcmu call failed\n",
- info->desc.name);
- goto out;
- }
-
- info->is_enabled = 0;
-out:
- return ret;
-}
-
-static int u8500_regulator_switch_is_enabled(struct regulator_dev *rdev)
-{
- struct u8500_regulator_info *info = rdev_get_drvdata(rdev);
-
- if (info == NULL)
- return -EINVAL;
-
- dev_vdbg(rdev_get_dev(rdev),
- "regulator-switch-%s-is_enabled (is_enabled): %i\n",
- info->desc.name, info->is_enabled);
-
- return info->is_enabled;
-}
-
-struct regulator_ops ux500_regulator_switch_ops = {
- .enable = u8500_regulator_switch_enable,
- .disable = u8500_regulator_switch_disable,
- .is_enabled = u8500_regulator_switch_is_enabled,
-};
-
-int __devinit
-ux500_regulator_probe(struct platform_device *pdev,
- struct u8500_regulator_info *regulator_info,
- int num_regulators)
-{
- struct regulator_init_data **u8500_init_data =
- dev_get_platdata(&pdev->dev);
- int i, err;
-
- /* register all regulators */
- for (i = 0; i < num_regulators; i++) {
- struct u8500_regulator_info *info;
- struct regulator_init_data *init_data = u8500_init_data[i];
-
- /* assign per-regulator data */
- info = &regulator_info[i];
- info->dev = &pdev->dev;
-
- /* register with the regulator framework */
- info->rdev = regulator_register(&info->desc, &pdev->dev,
- init_data, info);
- if (IS_ERR(info->rdev)) {
- err = PTR_ERR(info->rdev);
- dev_err(&pdev->dev, "failed to register %s: err %i\n",
- info->desc.name, err);
-
- /* if failing, unregister all earlier regulators */
- i--;
- while (i >= 0) {
- info = &regulator_info[i];
- regulator_unregister(info->rdev);
- i--;
- }
- return err;
- }
-
- dev_vdbg(rdev_get_dev(info->rdev),
- "regulator-%s-probed\n", info->desc.name);
- }
-
- err = ux500_regulator_debug_init(pdev, regulator_info, num_regulators);
-
- return err;
-}
-
-int __devexit
-ux500_regulator_remove(struct platform_device *pdev,
- struct u8500_regulator_info *regulator_info,
- int num_regulators)
-{
- int i;
-
- ux500_regulator_debug_exit();
-
- for (i = 0; i < num_regulators; i++) {
- struct u8500_regulator_info *info;
-
- info = &regulator_info[i];
-
- dev_vdbg(rdev_get_dev(info->rdev),
- "regulator-%s-remove\n", info->desc.name);
-
- regulator_unregister(info->rdev);
- }
-
- return 0;
-}
diff --git a/arch/arm/mach-ux500/regulator-ux500.h b/arch/arm/mach-ux500/regulator-ux500.h
deleted file mode 100644
index b62863881b1..00000000000
--- a/arch/arm/mach-ux500/regulator-ux500.h
+++ /dev/null
@@ -1,39 +0,0 @@
-#ifndef __REGULATOR_UX500_H
-#define __REGULATOR_UX500_H
-
-struct platform_device;
-
-/**
- * struct u8500_regulator_info - u8500 regulator information
- * @dev: device pointer
- * @desc: regulator description
- * @rdev: regulator device pointer
- * @is_enabled: status of the regulator
- * @epod_id: id for EPOD (power domain)
- * @is_ramret: RAM retention switch for EPOD (power domain)
- * @operating_point: operating point (only for vape, to be removed)
- * @exclude_from_power_state: don't let this regulator prevent ApSLeep
- */
-struct u8500_regulator_info {
- struct device *dev;
- struct regulator_desc desc;
- struct regulator_dev *rdev;
- bool is_enabled;
- u16 epod_id;
- bool is_ramret;
- bool exclude_from_power_state;
- unsigned int operating_point;
-};
-
-extern struct regulator_ops ux500_regulator_ops;
-extern struct regulator_ops ux500_regulator_switch_ops;
-
-int ux500_regulator_probe(struct platform_device *pdev,
- struct u8500_regulator_info *info,
- int num_regulators);
-
-int ux500_regulator_remove(struct platform_device *pdev,
- struct u8500_regulator_info *info,
- int num_regulators);
-
-#endif
diff --git a/arch/arm/mach-ux500/virt-regulator-u8500.c b/arch/arm/mach-ux500/virt-regulator-u8500.c
deleted file mode 100644
index 4915a4cf636..00000000000
--- a/arch/arm/mach-ux500/virt-regulator-u8500.c
+++ /dev/null
@@ -1,333 +0,0 @@
-/*
- * Copyright (C) ST-Ericsson SA 2010
- *
- * License Terms: GNU General Public License v2
- * Author: Bengt Jonsson <bengt.g.jonsson@stericsson.com> for ST-Ericsson
- *
- * Board specific file for configuration of virtual regulators. These virtual
- * regulators are used for debug purposes. They connect to the regulator device
- * just like any other consumer and expose controls in sysfs, so that
- * regulators can be controlled from user space.
- */
-
-#include <linux/init.h>
-#include <linux/platform_device.h>
-
-/*
- * Configuration for AB8500 virtual regulators
- */
-static struct platform_device u8500_aux1_virtual_regulator_device = {
- .name = "reg-virt-consumer",
- .id = 0,
- .dev = {
- .platform_data = "aux1",
- },
-};
-
-static struct platform_device u8500_aux2_virtual_regulator_device = {
- .name = "reg-virt-consumer",
- .id = 1,
- .dev = {
- .platform_data = "aux2",
- },
-};
-
-static struct platform_device u8500_aux3_virtual_regulator_device = {
- .name = "reg-virt-consumer",
- .id = 2,
- .dev = {
- .platform_data = "aux3",
- },
-};
-
-static struct platform_device u8500_intcore_virtual_regulator_device = {
- .name = "reg-virt-consumer",
- .id = 3,
- .dev = {
- .platform_data = "intcore",
- },
-};
-
-static struct platform_device u8500_tvout_virtual_regulator_device = {
- .name = "reg-virt-consumer",
- .id = 4,
- .dev = {
- .platform_data = "tvout",
- },
-};
-
-static struct platform_device u8500_audio_virtual_regulator_device = {
- .name = "reg-virt-consumer",
- .id = 5,
- .dev = {
- .platform_data = "audio",
- },
-};
-
-static struct platform_device u8500_anamic1_virtual_regulator_device = {
- .name = "reg-virt-consumer",
- .id = 6,
- .dev = {
- .platform_data = "anamic1",
- },
-};
-
-static struct platform_device u8500_anamic2_virtual_regulator_device = {
- .name = "reg-virt-consumer",
- .id = 7,
- .dev = {
- .platform_data = "anamic2",
- },
-};
-
-static struct platform_device u8500_dmic_virtual_regulator_device = {
- .name = "reg-virt-consumer",
- .id = 8,
- .dev = {
- .platform_data = "dmic",
- },
-};
-
-static struct platform_device u8500_ana_virtual_regulator_device = {
- .name = "reg-virt-consumer",
- .id = 9,
- .dev = {
- .platform_data = "ana",
- },
-};
-
-static struct platform_device u8500_sysclkreq_2_virtual_regulator_device = {
- .name = "reg-virt-consumer",
- .id = 10,
- .dev = {
- .platform_data = "sysclkreq-2",
- },
-};
-
-static struct platform_device u8500_sysclkreq_4_virtual_regulator_device = {
- .name = "reg-virt-consumer",
- .id = 11,
- .dev = {
- .platform_data = "sysclkreq-4",
- },
-};
-
-/*
- * Configuration for other U8500 virtual regulators
- */
-static struct platform_device u8500_ape_virtual_regulator_device = {
- .name = "reg-virt-consumer",
- .id = 12,
- .dev = {
- .platform_data = "test",
- },
-};
-
-static struct platform_device u8500_arm_virtual_regulator_device = {
- .name = "reg-virt-consumer",
- .id = 13,
- .dev = {
- .platform_data = "test",
- },
-};
-
-static struct platform_device u8500_modem_virtual_regulator_device = {
- .name = "reg-virt-consumer",
- .id = 14,
- .dev = {
- .platform_data = "test",
- },
-};
-
-static struct platform_device u8500_pll_virtual_regulator_device = {
- .name = "reg-virt-consumer",
- .id = 15,
- .dev = {
- .platform_data = "test",
- },
-};
-
-static struct platform_device u8500_smps1_virtual_regulator_device = {
- .name = "reg-virt-consumer",
- .id = 16,
- .dev = {
- .platform_data = "test",
- },
-};
-
-static struct platform_device u8500_smps2_virtual_regulator_device = {
- .name = "reg-virt-consumer",
- .id = 17,
- .dev = {
- .platform_data = "test",
- },
-};
-
-static struct platform_device u8500_smps3_virtual_regulator_device = {
- .name = "reg-virt-consumer",
- .id = 18,
- .dev = {
- .platform_data = "test",
- },
-};
-
-static struct platform_device u8500_rf1_virtual_regulator_device = {
- .name = "reg-virt-consumer",
- .id = 19,
- .dev = {
- .platform_data = "test",
- },
-};
-
-/*
- * Configuration for U8500 power domain virtual regulators
- */
-static struct platform_device u8500_sva_mmdsp_virtual_regulator_device = {
- .name = "reg-virt-consumer",
- .id = 20,
- .dev = {
- .platform_data = "test",
- },
-};
-
-static struct platform_device u8500_sva_mmdsp_ret_virtual_regulator_device = {
- .name = "reg-virt-consumer",
- .id = 21,
- .dev = {
- .platform_data = "test",
- },
-};
-
-static struct platform_device u8500_sva_pipe_virtual_regulator_device = {
- .name = "reg-virt-consumer",
- .id = 22,
- .dev = {
- .platform_data = "test",
- },
-};
-
-static struct platform_device u8500_sia_mmdsp_virtual_regulator_device = {
- .name = "reg-virt-consumer",
- .id = 23,
- .dev = {
- .platform_data = "test",
- },
-};
-
-static struct platform_device u8500_sia_mmdsp_ret_virtual_regulator_device = {
- .name = "reg-virt-consumer",
- .id = 24,
- .dev = {
- .platform_data = "test",
- },
-};
-
-static struct platform_device u8500_sia_pipe_virtual_regulator_device = {
- .name = "reg-virt-consumer",
- .id = 25,
- .dev = {
- .platform_data = "test",
- },
-};
-
-static struct platform_device u8500_sga_virtual_regulator_device = {
- .name = "reg-virt-consumer",
- .id = 26,
- .dev = {
- .platform_data = "test",
- },
-};
-
-static struct platform_device u8500_b2r2_mcde_virtual_regulator_device = {
- .name = "reg-virt-consumer",
- .id = 27,
- .dev = {
- .platform_data = "test",
- },
-};
-
-static struct platform_device u8500_esram12_virtual_regulator_device = {
- .name = "reg-virt-consumer",
- .id = 28,
- .dev = {
- .platform_data = "test",
- },
-};
-
-static struct platform_device u8500_esram12_ret_virtual_regulator_device = {
- .name = "reg-virt-consumer",
- .id = 29,
- .dev = {
- .platform_data = "test",
- },
-};
-
-static struct platform_device u8500_esram34_virtual_regulator_device = {
- .name = "reg-virt-consumer",
- .id = 30,
- .dev = {
- .platform_data = "test",
- },
-};
-
-static struct platform_device u8500_esram34_ret_virtual_regulator_device = {
- .name = "reg-virt-consumer",
- .id = 31,
- .dev = {
- .platform_data = "test",
- },
-};
-
-static struct platform_device *u8500_virtual_regulator_devices[] = {
- &u8500_aux1_virtual_regulator_device,
- &u8500_aux2_virtual_regulator_device,
- &u8500_aux3_virtual_regulator_device,
- &u8500_intcore_virtual_regulator_device,
- &u8500_tvout_virtual_regulator_device,
- &u8500_audio_virtual_regulator_device,
- &u8500_anamic1_virtual_regulator_device,
- &u8500_anamic2_virtual_regulator_device,
- &u8500_dmic_virtual_regulator_device,
- &u8500_ana_virtual_regulator_device,
- &u8500_sysclkreq_2_virtual_regulator_device,
- &u8500_sysclkreq_4_virtual_regulator_device,
- &u8500_ape_virtual_regulator_device,
- &u8500_arm_virtual_regulator_device,
- &u8500_modem_virtual_regulator_device,
- &u8500_pll_virtual_regulator_device,
- &u8500_smps1_virtual_regulator_device,
- &u8500_smps2_virtual_regulator_device,
- &u8500_smps3_virtual_regulator_device,
- &u8500_rf1_virtual_regulator_device,
- &u8500_sva_mmdsp_virtual_regulator_device,
- &u8500_sva_mmdsp_ret_virtual_regulator_device,
- &u8500_sva_pipe_virtual_regulator_device,
- &u8500_sia_mmdsp_virtual_regulator_device,
- &u8500_sia_mmdsp_ret_virtual_regulator_device,
- &u8500_sia_pipe_virtual_regulator_device,
- &u8500_sga_virtual_regulator_device,
- &u8500_b2r2_mcde_virtual_regulator_device,
- &u8500_esram12_virtual_regulator_device,
- &u8500_esram12_ret_virtual_regulator_device,
- &u8500_esram34_virtual_regulator_device,
- &u8500_esram34_ret_virtual_regulator_device,
-};
-
-static int __init u8500_virtual_regulator_init(void)
-{
- int ret;
-
- ret = platform_add_devices(u8500_virtual_regulator_devices,
- ARRAY_SIZE(u8500_virtual_regulator_devices));
- if (ret != 0)
- pr_err("Failed to register U8500 virtual regulator devices:"
- " %d\n", ret);
-
- return ret;
-}
-module_init(u8500_virtual_regulator_init);
-
-MODULE_LICENSE("GPL v2");
-MODULE_AUTHOR("Bengt Jonsson <bengt.g.jonsson@stericsson.com");
-MODULE_DESCRIPTION("Configuration of u8500 virtual regulators");
-MODULE_ALIAS("platform:u8500-virtual-regulator");
diff --git a/drivers/regulator/ab8500-debug.c b/drivers/regulator/ab8500-debug.c
deleted file mode 100644
index 661386890af..00000000000
--- a/drivers/regulator/ab8500-debug.c
+++ /dev/null
@@ -1,1868 +0,0 @@
-/*
- * Copyright (C) ST-Ericsson SA 2010
- *
- * Author: Bengt Jonsson <bengt.g.jonsson@stericsson.com> for ST-Ericsson.
- *
- * License Terms: GNU General Public License v2
- */
-
-#include <linux/seq_file.h>
-#include <linux/uaccess.h>
-#include <linux/fs.h>
-#include <linux/debugfs.h>
-#include <linux/platform_device.h>
-#include <linux/kobject.h>
-#include <linux/slab.h>
-#include <linux/mfd/abx500.h>
-#include <linux/regulator/ab8500-debug.h>
-#include <linux/io.h>
-#include <mach/db8500-regs.h> /* U8500_BACKUPRAM1_BASE */
-#include <mach/hardware.h>
-
-/* board profile address - to determine if suspend-force is default */
-#define BOOT_INFO_BACKUPRAM1 (U8500_BACKUPRAM1_BASE + 0xffc)
-#define BOARD_PROFILE_BACKUPRAM1 (0x3)
-
-/* board profile option */
-#define OPTION_BOARD_VERSION_V5X 50
-
-/* for error prints */
-struct device *dev;
-struct platform_device *pdev;
-
-/* setting for suspend force (disabled by default) */
-static bool setting_suspend_force;
-
-/*
- * regulator states
- */
-enum ab8500_regulator_state_id {
- AB8500_REGULATOR_STATE_INIT,
- AB8500_REGULATOR_STATE_SUSPEND,
- AB8500_REGULATOR_STATE_SUSPEND_CORE,
- AB8500_REGULATOR_STATE_RESUME_CORE,
- AB8500_REGULATOR_STATE_RESUME,
- AB8500_REGULATOR_STATE_CURRENT,
- NUM_REGULATOR_STATE
-};
-
-static const char *regulator_state_name[NUM_REGULATOR_STATE] = {
- [AB8500_REGULATOR_STATE_INIT] = "init",
- [AB8500_REGULATOR_STATE_SUSPEND] = "suspend",
- [AB8500_REGULATOR_STATE_SUSPEND_CORE] = "suspend-core",
- [AB8500_REGULATOR_STATE_RESUME_CORE] = "resume-core",
- [AB8500_REGULATOR_STATE_RESUME] = "resume",
- [AB8500_REGULATOR_STATE_CURRENT] = "current",
-};
-
-/*
- * regulator register definitions
- */
-enum ab8500_register_id {
- AB8500_REGU_NOUSE, /* if not defined */
- AB8500_REGU_REQUEST_CTRL1,
- AB8500_REGU_REQUEST_CTRL2,
- AB8500_REGU_REQUEST_CTRL3,
- AB8500_REGU_REQUEST_CTRL4,
- AB8500_REGU_SYSCLK_REQ1_HP_VALID1,
- AB8500_REGU_SYSCLK_REQ1_HP_VALID2,
- AB8500_REGU_HW_HP_REQ1_VALID1,
- AB8500_REGU_HW_HP_REQ1_VALID2,
- AB8500_REGU_HW_HP_REQ2_VALID1,
- AB8500_REGU_HW_HP_REQ2_VALID2,
- AB8500_REGU_SW_HP_REQ_VALID1,
- AB8500_REGU_SW_HP_REQ_VALID2,
- AB8500_REGU_SYSCLK_REQ1_VALID,
- AB8500_REGU_SYSCLK_REQ2_VALID,
- AB8500_REGU_MISC1,
- AB8500_REGU_OTG_SUPPLY_CTRL,
- AB8500_REGU_VUSB_CTRL,
- AB8500_REGU_VAUDIO_SUPPLY,
- AB8500_REGU_CTRL1_VAMIC,
- AB8500_REGU_ARM_REGU1,
- AB8500_REGU_ARM_REGU2,
- AB8500_REGU_VAPE_REGU,
- AB8500_REGU_VSMPS1_REGU,
- AB8500_REGU_VSMPS2_REGU,
- AB8500_REGU_VSMPS3_REGU,
- AB8500_REGU_VPLL_VANA_REGU,
- AB8500_REGU_VREF_DDR,
- AB8500_REGU_EXT_SUPPLY_REGU,
- AB8500_REGU_VAUX12_REGU,
- AB8500_REGU_VRF1_VAUX3_REGU,
- AB8500_REGU_VARM_SEL1,
- AB8500_REGU_VARM_SEL2,
- AB8500_REGU_VARM_SEL3,
- AB8500_REGU_VAPE_SEL1,
- AB8500_REGU_VAPE_SEL2,
- AB8500_REGU_VAPE_SEL3,
- AB8500_REGU_VBB_SEL1,
- AB8500_REGU_VBB_SEL2,
- AB8500_REGU_VSMPS1_SEL1,
- AB8500_REGU_VSMPS1_SEL2,
- AB8500_REGU_VSMPS1_SEL3,
- AB8500_REGU_VSMPS2_SEL1,
- AB8500_REGU_VSMPS2_SEL2,
- AB8500_REGU_VSMPS2_SEL3,
- AB8500_REGU_VSMPS3_SEL1,
- AB8500_REGU_VSMPS3_SEL2,
- AB8500_REGU_VSMPS3_SEL3,
- AB8500_REGU_VAUX1_SEL,
- AB8500_REGU_VAUX2_SEL,
- AB8500_REGU_VRF1_VAUX3_SEL,
- AB8500_REGU_CTRL_EXT_SUP,
- AB8500_REGU_VMOD_REGU,
- AB8500_REGU_VMOD_SEL1,
- AB8500_REGU_VMOD_SEL2,
- AB8500_REGU_CTRL_DISCH,
- AB8500_REGU_CTRL_DISCH2,
- AB8500_OTHER_SYSCLK_CTRL, /* Other */
- AB8500_OTHER_VSIM_SYSCLK_CTRL, /* Other */
- AB8500_OTHER_SYSULPCLK_CTRL1, /* Other */
- AB8500_OTHER_TVOUT_CTRL, /* Other */
- NUM_AB8500_REGISTER
-};
-
-struct ab8500_register {
- const char *name;
- u8 bank;
- u8 addr;
-};
-
-static struct ab8500_register
- ab8500_register[NUM_AB8500_REGISTER] = {
- [AB8500_REGU_REQUEST_CTRL1] = {
- .name = "ReguRequestCtrl1",
- .bank = 0x03,
- .addr = 0x03,
- },
- [AB8500_REGU_REQUEST_CTRL2] = {
- .name = "ReguRequestCtrl2",
- .bank = 0x03,
- .addr = 0x04,
- },
- [AB8500_REGU_REQUEST_CTRL3] = {
- .name = "ReguRequestCtrl3",
- .bank = 0x03,
- .addr = 0x05,
- },
- [AB8500_REGU_REQUEST_CTRL4] = {
- .name = "ReguRequestCtrl4",
- .bank = 0x03,
- .addr = 0x06,
- },
- [AB8500_REGU_SYSCLK_REQ1_HP_VALID1] = {
- .name = "ReguSysClkReq1HPValid",
- .bank = 0x03,
- .addr = 0x07,
- },
- [AB8500_REGU_SYSCLK_REQ1_HP_VALID2] = {
- .name = "ReguSysClkReq1HPValid2",
- .bank = 0x03,
- .addr = 0x08,
- },
- [AB8500_REGU_HW_HP_REQ1_VALID1] = {
- .name = "ReguHwHPReq1Valid1",
- .bank = 0x03,
- .addr = 0x09,
- },
- [AB8500_REGU_HW_HP_REQ1_VALID2] = {
- .name = "ReguHwHPReq1Valid2",
- .bank = 0x03,
- .addr = 0x0a,
- },
- [AB8500_REGU_HW_HP_REQ2_VALID1] = {
- .name = "ReguHwHPReq2Valid1",
- .bank = 0x03,
- .addr = 0x0b,
- },
- [AB8500_REGU_HW_HP_REQ2_VALID2] = {
- .name = "ReguHwHPReq2Valid2",
- .bank = 0x03,
- .addr = 0x0c,
- },
- [AB8500_REGU_SW_HP_REQ_VALID1] = {
- .name = "ReguSwHPReqValid1",
- .bank = 0x03,
- .addr = 0x0d,
- },
- [AB8500_REGU_SW_HP_REQ_VALID2] = {
- .name = "ReguSwHPReqValid2",
- .bank = 0x03,
- .addr = 0x0e,
- },
- [AB8500_REGU_SYSCLK_REQ1_VALID] = {
- .name = "ReguSysClkReqValid1",
- .bank = 0x03,
- .addr = 0x0f,
- },
- [AB8500_REGU_SYSCLK_REQ2_VALID] = {
- .name = "ReguSysClkReqValid2",
- .bank = 0x03,
- .addr = 0x10,
- },
- [AB8500_REGU_MISC1] = {
- .name = "ReguMisc1",
- .bank = 0x03,
- .addr = 0x80,
- },
- [AB8500_REGU_OTG_SUPPLY_CTRL] = {
- .name = "OTGSupplyCtrl",
- .bank = 0x03,
- .addr = 0x81,
- },
- [AB8500_REGU_VUSB_CTRL] = {
- .name = "VusbCtrl",
- .bank = 0x03,
- .addr = 0x82,
- },
- [AB8500_REGU_VAUDIO_SUPPLY] = {
- .name = "VaudioSupply",
- .bank = 0x03,
- .addr = 0x83,
- },
- [AB8500_REGU_CTRL1_VAMIC] = {
- .name = "ReguCtrl1VAmic",
- .bank = 0x03,
- .addr = 0x84,
- },
- [AB8500_REGU_ARM_REGU1] = {
- .name = "ArmRegu1",
- .bank = 0x04,
- .addr = 0x00,
- },
- [AB8500_REGU_ARM_REGU2] = {
- .name = "ArmRegu2",
- .bank = 0x04,
- .addr = 0x01,
- },
- [AB8500_REGU_VAPE_REGU] = {
- .name = "VapeRegu",
- .bank = 0x04,
- .addr = 0x02,
- },
- [AB8500_REGU_VSMPS1_REGU] = {
- .name = "Vsmps1Regu",
- .bank = 0x04,
- .addr = 0x03,
- },
- [AB8500_REGU_VSMPS2_REGU] = {
- .name = "Vsmps2Regu",
- .bank = 0x04,
- .addr = 0x04,
- },
- [AB8500_REGU_VSMPS3_REGU] = {
- .name = "Vsmps3Regu",
- .bank = 0x04,
- .addr = 0x05,
- },
- [AB8500_REGU_VPLL_VANA_REGU] = {
- .name = "VpllVanaRegu",
- .bank = 0x04,
- .addr = 0x06,
- },
- [AB8500_REGU_VREF_DDR] = {
- .name = "VrefDDR",
- .bank = 0x04,
- .addr = 0x07,
- },
- [AB8500_REGU_EXT_SUPPLY_REGU] = {
- .name = "ExtSupplyRegu",
- .bank = 0x04,
- .addr = 0x08,
- },
- [AB8500_REGU_VAUX12_REGU] = {
- .name = "Vaux12Regu",
- .bank = 0x04,
- .addr = 0x09,
- },
- [AB8500_REGU_VRF1_VAUX3_REGU] = {
- .name = "VRF1Vaux3Regu",
- .bank = 0x04,
- .addr = 0x0a,
- },
- [AB8500_REGU_VARM_SEL1] = {
- .name = "VarmSel1",
- .bank = 0x04,
- .addr = 0x0b,
- },
- [AB8500_REGU_VARM_SEL2] = {
- .name = "VarmSel2",
- .bank = 0x04,
- .addr = 0x0c,
- },
- [AB8500_REGU_VARM_SEL3] = {
- .name = "VarmSel3",
- .bank = 0x04,
- .addr = 0x0d,
- },
- [AB8500_REGU_VAPE_SEL1] = {
- .name = "VapeSel1",
- .bank = 0x04,
- .addr = 0x0e,
- },
- [AB8500_REGU_VAPE_SEL2] = {
- .name = "VapeSel2",
- .bank = 0x04,
- .addr = 0x0f,
- },
- [AB8500_REGU_VAPE_SEL3] = {
- .name = "VapeSel3",
- .bank = 0x04,
- .addr = 0x10,
- },
- [AB8500_REGU_VBB_SEL1] = {
- .name = "VBBSel1",
- .bank = 0x04,
- .addr = 0x11,
- },
- [AB8500_REGU_VBB_SEL2] = {
- .name = "VBBSel2",
- .bank = 0x04,
- .addr = 0x12,
- },
- [AB8500_REGU_VSMPS1_SEL1] = {
- .name = "Vsmps1Sel1",
- .bank = 0x04,
- .addr = 0x13,
- },
- [AB8500_REGU_VSMPS1_SEL2] = {
- .name = "Vsmps1Sel2",
- .bank = 0x04,
- .addr = 0x14,
- },
- [AB8500_REGU_VSMPS1_SEL3] = {
- .name = "Vsmps1Sel3",
- .bank = 0x04,
- .addr = 0x15,
- },
- [AB8500_REGU_VSMPS2_SEL1] = {
- .name = "Vsmps2Sel1",
- .bank = 0x04,
- .addr = 0x17,
- },
- [AB8500_REGU_VSMPS2_SEL2] = {
- .name = "Vsmps2Sel2",
- .bank = 0x04,
- .addr = 0x18,
- },
- [AB8500_REGU_VSMPS2_SEL3] = {
- .name = "Vsmps2Sel3",
- .bank = 0x04,
- .addr = 0x19,
- },
- [AB8500_REGU_VSMPS3_SEL1] = {
- .name = "Vsmps3Sel1",
- .bank = 0x04,
- .addr = 0x1b,
- },
- [AB8500_REGU_VSMPS3_SEL2] = {
- .name = "Vsmps3Sel2",
- .bank = 0x04,
- .addr = 0x1c,
- },
- [AB8500_REGU_VSMPS3_SEL3] = {
- .name = "Vsmps3Sel3",
- .bank = 0x04,
- .addr = 0x1d,
- },
- [AB8500_REGU_VAUX1_SEL] = {
- .name = "Vaux1Sel",
- .bank = 0x04,
- .addr = 0x1f,
- },
- [AB8500_REGU_VAUX2_SEL] = {
- .name = "Vaux2Sel",
- .bank = 0x04,
- .addr = 0x20,
- },
- [AB8500_REGU_VRF1_VAUX3_SEL] = {
- .name = "VRF1Vaux3Sel",
- .bank = 0x04,
- .addr = 0x21,
- },
- [AB8500_REGU_CTRL_EXT_SUP] = {
- .name = "ReguCtrlExtSup",
- .bank = 0x04,
- .addr = 0x22,
- },
- [AB8500_REGU_VMOD_REGU] = {
- .name = "VmodRegu",
- .bank = 0x04,
- .addr = 0x40,
- },
- [AB8500_REGU_VMOD_SEL1] = {
- .name = "VmodSel1",
- .bank = 0x04,
- .addr = 0x41,
- },
- [AB8500_REGU_VMOD_SEL2] = {
- .name = "VmodSel2",
- .bank = 0x04,
- .addr = 0x42,
- },
- [AB8500_REGU_CTRL_DISCH] = {
- .name = "ReguCtrlDisch",
- .bank = 0x04,
- .addr = 0x43,
- },
- [AB8500_REGU_CTRL_DISCH2] = {
- .name = "ReguCtrlDisch2",
- .bank = 0x04,
- .addr = 0x44,
- },
- /* Outside regulator banks */
- [AB8500_OTHER_SYSCLK_CTRL] = {
- .name = "SysClkCtrl",
- .bank = 0x02,
- .addr = 0x0c,
- },
- [AB8500_OTHER_VSIM_SYSCLK_CTRL] = {
- .name = "VsimSysClkCtrl",
- .bank = 0x02,
- .addr = 0x33,
- },
- [AB8500_OTHER_SYSULPCLK_CTRL1] = {
- .name = "SysUlpClkCtrl1",
- .bank = 0x02,
- .addr = 0x0b,
- },
- [AB8500_OTHER_TVOUT_CTRL] = {
- .name = "TVoutCtrl",
- .bank = 0x06,
- .addr = 0x80,
- },
-};
-
-static u8 ab8500_register_state[NUM_REGULATOR_STATE][NUM_AB8500_REGISTER];
-static bool ab8500_register_state_saved[NUM_REGULATOR_STATE];
-static bool ab8500_register_state_save = true;
-
-static int ab8500_regulator_record_state(int state)
-{
- u8 val;
- int i;
- int ret;
-
- /* check arguments */
- if ((state > NUM_REGULATOR_STATE) || (state < 0)) {
- dev_err(dev, "Wrong state specified\n");
- return -EINVAL;
- }
-
- /* record */
- if (!ab8500_register_state_save)
- goto exit;
-
- ab8500_register_state_saved[state] = true;
-
- for (i = 1; i < NUM_AB8500_REGISTER; i++) {
- ret = abx500_get_register_interruptible(dev,
- ab8500_register[i].bank,
- ab8500_register[i].addr,
- &val);
- if (ret < 0) {
- dev_err(dev, "abx500_get_reg fail %d, %d\n",
- ret, __LINE__);
- return -EINVAL;
- }
-
- ab8500_register_state[state][i] = val;
- }
-exit:
- return 0;
-}
-
-/*
- * regulator register dump
- */
-static int ab8500_regulator_dump_print(struct seq_file *s, void *p)
-{
- struct device *dev = s->private;
- int state, reg_id, i;
- int err;
-
- /* record current state */
- ab8500_regulator_record_state(AB8500_REGULATOR_STATE_CURRENT);
-
- /* print dump header */
- err = seq_printf(s, "ab8500-regulator dump:\n");
- if (err < 0)
- dev_err(dev, "seq_printf overflow\n");
-
- /* print states */
- for (state = NUM_REGULATOR_STATE - 1; state >= 0; state--) {
- if (ab8500_register_state_saved[state])
- err = seq_printf(s, "%16s saved -------",
- regulator_state_name[state]);
- else
- err = seq_printf(s, "%12s not saved -------",
- regulator_state_name[state]);
- if (err < 0)
- dev_err(dev, "seq_printf overflow: %i\n", __LINE__);
-
- for (i = 0; i < NUM_REGULATOR_STATE; i++) {
- if (i < state)
- err = seq_printf(s, "-----");
- else if (i == state)
- err = seq_printf(s, "----+");
- else
- err = seq_printf(s, " |");
- if (err < 0)
- dev_err(dev, "seq_printf overflow: %i\n",
- __LINE__);
- }
- err = seq_printf(s, "\n");
- if (err < 0)
- dev_err(dev, "seq_printf overflow: %i\n", __LINE__);
- }
-
- /* print labels */
- err = seq_printf(s, "\n addr\n");
- if (err < 0)
- dev_err(dev, "seq_printf overflow: %i\n", __LINE__);
-
- /* dump registers */
- for (reg_id = 1; reg_id < NUM_AB8500_REGISTER; reg_id++) {
- err = seq_printf(s, "%22s 0x%02x%02x:",
- ab8500_register[reg_id].name,
- ab8500_register[reg_id].bank,
- ab8500_register[reg_id].addr);
- if (err < 0)
- dev_err(dev, "seq_printf overflow: %i, %i\n",
- reg_id, __LINE__);
-
- for (state = 0; state < NUM_REGULATOR_STATE; state++) {
- err = seq_printf(s, " 0x%02x",
- ab8500_register_state[state][reg_id]);
- if (err < 0)
- dev_err(dev, "seq_printf overflow: %i, %i\n",
- reg_id, __LINE__);
- }
-
- err = seq_printf(s, "\n");
- if (err < 0)
- dev_err(dev, "seq_printf overflow: %i, %i\n",
- reg_id, __LINE__);
- }
-
- return 0;
-}
-
-static int ab8500_regulator_dump_open(struct inode *inode, struct file *file)
-{
- return single_open(file, ab8500_regulator_dump_print, inode->i_private);
-}
-
-static const struct file_operations ab8500_regulator_dump_fops = {
- .open = ab8500_regulator_dump_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = single_release,
- .owner = THIS_MODULE,
-};
-
-/*
- * regulator status print
- */
-enum ab8500_regulator_id {
- AB8500_VARM,
- AB8500_VBBP,
- AB8500_VBBN,
- AB8500_VAPE,
- AB8500_VSMPS1,
- AB8500_VSMPS2,
- AB8500_VSMPS3,
- AB8500_VPLL,
- AB8500_VREFDDR,
- AB8500_VMOD,
- AB8500_VEXTSUPPLY1,
- AB8500_VEXTSUPPLY2,
- AB8500_VEXTSUPPLY3,
- AB8500_VRF1,
- AB8500_VANA,
- AB8500_VAUX1,
- AB8500_VAUX2,
- AB8500_VAUX3,
- AB8500_VINTCORE,
- AB8500_VTVOUT,
- AB8500_VAUDIO,
- AB8500_VANAMIC1,
- AB8500_VANAMIC2,
- AB8500_VDMIC,
- AB8500_VUSB,
- AB8500_VOTG,
- AB8500_VBUSBIS,
- AB8500_NUM_REGULATORS,
-};
-
-/*
- * regulator_voltage
- */
-struct regulator_volt {
- u8 value;
- int volt;
-};
-
-struct regulator_volt_range {
- struct regulator_volt start;
- struct regulator_volt step;
- struct regulator_volt end;
-};
-
-/*
- * ab8500_regulator
- * @name
- * @update_regid
- * @update_mask
- * @update_val[4] {off, on, hw, lp}
- * @hw_mode_regid
- * @hw_mode_mask
- * @hw_mode_val[4] {hp/lp, hp/off, hp, hp}
- * @hw_valid_regid[4] {sysclkreq1, hw1, hw2, sw}
- * @hw_valid_mask[4] {sysclkreq1, hw1, hw2, sw}
- * @vsel_sel_regid
- * @vsel_sel_mask
- * @vsel_val[333] {sel1, sel2, sel3, sel3}
- * @vsel_regid
- * @vsel_mask
- * @vsel_range
- * @vsel_range_len
- */
-struct ab8500_regulator {
- const char *name;
- int update_regid;
- u8 update_mask;
- u8 update_val[4];
- int hw_mode_regid;
- u8 hw_mode_mask;
- u8 hw_mode_val[4];
- int hw_valid_regid[4];
- u8 hw_valid_mask[4];
- int vsel_sel_regid;
- u8 vsel_sel_mask;
- u8 vsel_sel_val[4];
- int vsel_regid[3];
- u8 vsel_mask[3];
- struct regulator_volt_range const *vsel_range[3];
- int vsel_range_len[3];
-};
-
-static const char *update_val_name[] = {
- "off",
- "on ",
- "hw ",
- "lp ",
- " - " /* undefined value */
-};
-
-static const char *hw_mode_val_name[] = {
- "hp/lp ",
- "hp/off",
- "hp ",
- "hp ",
- "-/- ", /* undefined value */
-};
-
-/* voltage selection */
-static const struct regulator_volt_range varm_vape_vmod_vsel[] = {
- { {0x00, 700000}, {0x01, 12500}, {0x35, 1362500} },
- { {0x36, 1362500}, {0x01, 0}, {0x3f, 1362500} },
-};
-
-static const struct regulator_volt_range vbbp_vsel[] = {
- { {0x00, 0}, {0x10, 100000}, {0x40, 400000} },
- { {0x50, 400000}, {0x10, 0}, {0x70, 400000} },
- { {0x80, -400000}, {0x10, 0}, {0xb0, -400000} },
- { {0xc0, -400000}, {0x10, 100000}, {0xf0, -100000} },
-};
-
-static const struct regulator_volt_range vbbn_vsel[] = {
- { {0x00, 0}, {0x01, -100000}, {0x04, -400000} },
- { {0x05, -400000}, {0x01, 0}, {0x07, -400000} },
- { {0x08, 0}, {0x01, 100000}, {0x0c, 400000} },
- { {0x0d, 400000}, {0x01, 0}, {0x0f, 400000} },
-};
-
-static const struct regulator_volt_range vsmps1_vsel[] = {
- { {0x00, 1100000}, {0x01, 0}, {0x1f, 1100000} },
- { {0x20, 1100000}, {0x01, 12500}, {0x30, 1300000} },
- { {0x31, 1300000}, {0x01, 0}, {0x3f, 1300000} },
-};
-
-static const struct regulator_volt_range vsmps2_vsel[] = {
- { {0x00, 1800000}, {0x01, 0}, {0x38, 1800000} },
- { {0x39, 1800000}, {0x01, 12500}, {0x7f, 1875000} },
-};
-
-static const struct regulator_volt_range vsmps3_vsel[] = {
- { {0x00, 700000}, {0x01, 12500}, {0x35, 1363500} },
- { {0x36, 1363500}, {0x01, 0}, {0x7f, 1363500} },
-};
-
-static const struct regulator_volt_range vaux1_vaux2_vsel[] = {
- { {0x00, 1100000}, {0x01, 100000}, {0x04, 1500000} },
- { {0x05, 1800000}, {0x01, 50000}, {0x07, 1900000} },
- { {0x08, 2500000}, {0x01, 0}, {0x08, 2500000} },
- { {0x09, 2650000}, {0x01, 50000}, {0x0c, 2800000} },
- { {0x0d, 2900000}, {0x01, 100000}, {0x0e, 3000000} },
- { {0x0f, 3300000}, {0x01, 0}, {0x0f, 3300000} },
-};
-
-static const struct regulator_volt_range vaux3_vsel[] = {
- { {0x00, 1200000}, {0x01, 300000}, {0x03, 2100000} },
- { {0x04, 2500000}, {0x01, 250000}, {0x05, 2750000} },
- { {0x06, 2790000}, {0x01, 0}, {0x06, 2790000} },
- { {0x07, 2910000}, {0x01, 0}, {0x07, 2910000} },
-};
-
-static const struct regulator_volt_range vrf1_vsel[] = {
- { {0x00, 1800000}, {0x10, 200000}, {0x10, 2000000} },
- { {0x20, 2150000}, {0x10, 0}, {0x20, 2150000} },
- { {0x30, 2500000}, {0x10, 0}, {0x30, 2500000} },
-};
-
-static const struct regulator_volt_range vintcore12_vsel[] = {
- { {0x00, 1200000}, {0x08, 25000}, {0x30, 1350000} },
- { {0x38, 1350000}, {0x01, 0}, {0x38, 1350000} },
-};
-
-/* regulators */
-static struct ab8500_regulator ab8500_regulator[AB8500_NUM_REGULATORS] = {
- [AB8500_VARM] = {
- .name = "Varm",
- .update_regid = AB8500_REGU_ARM_REGU1,
- .update_mask = 0x03,
- .update_val = {0x00, 0x01, 0x02, 0x03},
- .hw_mode_regid = AB8500_REGU_REQUEST_CTRL1,
- .hw_mode_mask = 0x03,
- .hw_mode_val = {0x00, 0x01, 0x02, 0x03},
- .hw_valid_regid[0] = AB8500_REGU_SYSCLK_REQ1_HP_VALID2,
- .hw_valid_mask[0] = 0x02,
- .hw_valid_regid[3] = AB8500_REGU_SW_HP_REQ_VALID1,
- .hw_valid_mask[3] = 0x02,
- .vsel_sel_regid = AB8500_REGU_ARM_REGU1,
- .vsel_sel_mask = 0x0c,
- .vsel_sel_val = {0x00, 0x04, 0x08, 0x0c},
- .vsel_regid[0] = AB8500_REGU_VARM_SEL1,
- .vsel_mask[0] = 0x3f,
- .vsel_range[0] = varm_vape_vmod_vsel,
- .vsel_range_len[0] = ARRAY_SIZE(varm_vape_vmod_vsel),
- .vsel_regid[1] = AB8500_REGU_VARM_SEL2,
- .vsel_mask[1] = 0x3f,
- .vsel_range[1] = varm_vape_vmod_vsel,
- .vsel_range_len[1] = ARRAY_SIZE(varm_vape_vmod_vsel),
- .vsel_regid[2] = AB8500_REGU_VARM_SEL3,
- .vsel_mask[2] = 0x3f,
- .vsel_range[2] = varm_vape_vmod_vsel,
- .vsel_range_len[2] = ARRAY_SIZE(varm_vape_vmod_vsel),
- },
- [AB8500_VBBP] = {
- .name = "Vbbp",
- .update_regid = AB8500_REGU_ARM_REGU2,
- .update_mask = 0x03,
- .update_val = {0x00, 0x01, 0x02, 0x00},
- .hw_valid_regid[0] = AB8500_REGU_SYSCLK_REQ1_HP_VALID2,
- .hw_valid_mask[0] = 0x04,
- .vsel_sel_regid = AB8500_REGU_ARM_REGU1,
- .vsel_sel_mask = 0x10,
- .vsel_sel_val = {0x00, 0x10, 0x00, 0x00},
- .vsel_regid[0] = AB8500_REGU_VBB_SEL1,
- .vsel_mask[0] = 0xf0,
- .vsel_range[0] = vbbp_vsel,
- .vsel_range_len[0] = ARRAY_SIZE(vbbp_vsel),
- .vsel_regid[1] = AB8500_REGU_VBB_SEL2,
- .vsel_mask[1] = 0xf0,
- .vsel_range[1] = vbbp_vsel,
- .vsel_range_len[1] = ARRAY_SIZE(vbbp_vsel),
- },
- [AB8500_VBBN] = {
- .name = "Vbbn",
- .update_regid = AB8500_REGU_ARM_REGU2,
- .update_mask = 0x0c,
- .update_val = {0x00, 0x04, 0x08, 0x00},
- .hw_valid_regid[0] = AB8500_REGU_SYSCLK_REQ1_HP_VALID2,
- .hw_valid_mask[0] = 0x04,
- .vsel_sel_regid = AB8500_REGU_ARM_REGU1,
- .vsel_sel_mask = 0x20,
- .vsel_sel_val = {0x00, 0x20, 0x00, 0x00},
- .vsel_regid[0] = AB8500_REGU_VBB_SEL1,
- .vsel_mask[0] = 0x0f,
- .vsel_range[0] = vbbn_vsel,
- .vsel_range_len[0] = ARRAY_SIZE(vbbn_vsel),
- .vsel_regid[1] = AB8500_REGU_VBB_SEL2,
- .vsel_mask[1] = 0x0f,
- .vsel_range[1] = vbbn_vsel,
- .vsel_range_len[1] = ARRAY_SIZE(vbbn_vsel),
- },
- [AB8500_VAPE] = {
- .name = "Vape",
- .update_regid = AB8500_REGU_VAPE_REGU,
- .update_mask = 0x03,
- .update_val = {0x00, 0x01, 0x02, 0x03},
- .hw_mode_regid = AB8500_REGU_REQUEST_CTRL1,
- .hw_mode_mask = 0x0c,
- .hw_mode_val = {0x00, 0x04, 0x08, 0x0c},
- .hw_valid_regid[0] = AB8500_REGU_SYSCLK_REQ1_HP_VALID2,
- .hw_valid_mask[0] = 0x01,
- .hw_valid_regid[3] = AB8500_REGU_SW_HP_REQ_VALID1,
- .hw_valid_mask[3] = 0x01,
- .vsel_sel_regid = AB8500_REGU_VAPE_REGU,
- .vsel_sel_mask = 0x24,
- .vsel_sel_val = {0x00, 0x04, 0x20, 0x24},
- .vsel_regid[0] = AB8500_REGU_VAPE_SEL1,
- .vsel_mask[0] = 0x3f,
- .vsel_range[0] = varm_vape_vmod_vsel,
- .vsel_range_len[0] = ARRAY_SIZE(varm_vape_vmod_vsel),
- .vsel_regid[1] = AB8500_REGU_VAPE_SEL2,
- .vsel_mask[1] = 0x3f,
- .vsel_range[1] = varm_vape_vmod_vsel,
- .vsel_range_len[1] = ARRAY_SIZE(varm_vape_vmod_vsel),
- .vsel_regid[2] = AB8500_REGU_VAPE_SEL3,
- .vsel_mask[2] = 0x3f,
- .vsel_range[2] = varm_vape_vmod_vsel,
- .vsel_range_len[2] = ARRAY_SIZE(varm_vape_vmod_vsel),
- },
- [AB8500_VSMPS1] = {
- .name = "Vsmps1",
- .update_regid = AB8500_REGU_VSMPS1_REGU,
- .update_mask = 0x03,
- .update_val = {0x00, 0x01, 0x02, 0x03},
- .hw_mode_regid = AB8500_REGU_REQUEST_CTRL1,
- .hw_mode_mask = 0x30,
- .hw_mode_val = {0x00, 0x10, 0x20, 0x30},
- .hw_valid_regid[0] = AB8500_REGU_SYSCLK_REQ1_HP_VALID1,
- .hw_valid_mask[0] = 0x01,
- .hw_valid_regid[1] = AB8500_REGU_HW_HP_REQ1_VALID1,
- .hw_valid_mask[1] = 0x01,
- .hw_valid_regid[2] = AB8500_REGU_HW_HP_REQ2_VALID1,
- .hw_valid_mask[2] = 0x01,
- .hw_valid_regid[3] = AB8500_REGU_SW_HP_REQ_VALID1,
- .hw_valid_mask[3] = 0x04,
- .vsel_sel_regid = AB8500_REGU_VSMPS1_REGU,
- .vsel_sel_mask = 0x0c,
- .vsel_sel_val = {0x00, 0x04, 0x08, 0x0c},
- .vsel_regid[0] = AB8500_REGU_VSMPS1_SEL1,
- .vsel_mask[0] = 0x3f,
- .vsel_range[0] = vsmps1_vsel,
- .vsel_range_len[0] = ARRAY_SIZE(vsmps1_vsel),
- .vsel_regid[1] = AB8500_REGU_VSMPS1_SEL2,
- .vsel_mask[1] = 0x3f,
- .vsel_range[1] = vsmps1_vsel,
- .vsel_range_len[1] = ARRAY_SIZE(vsmps1_vsel),
- .vsel_regid[2] = AB8500_REGU_VSMPS1_SEL3,
- .vsel_mask[2] = 0x3f,
- .vsel_range[2] = vsmps1_vsel,
- .vsel_range_len[2] = ARRAY_SIZE(vsmps1_vsel),
- },
- [AB8500_VSMPS2] = {
- .name = "Vsmps2",
- .update_regid = AB8500_REGU_VSMPS2_REGU,
- .update_mask = 0x03,
- .update_val = {0x00, 0x01, 0x02, 0x03},
- .hw_mode_regid = AB8500_REGU_REQUEST_CTRL1,
- .hw_mode_mask = 0xc0,
- .hw_mode_val = {0x00, 0x40, 0x80, 0xc0},
- .hw_valid_regid[0] = AB8500_REGU_SYSCLK_REQ1_HP_VALID1,
- .hw_valid_mask[0] = 0x02,
- .hw_valid_regid[1] = AB8500_REGU_HW_HP_REQ1_VALID1,
- .hw_valid_mask[1] = 0x02,
- .hw_valid_regid[2] = AB8500_REGU_HW_HP_REQ2_VALID1,
- .hw_valid_mask[2] = 0x02,
- .hw_valid_regid[3] = AB8500_REGU_SW_HP_REQ_VALID1,
- .hw_valid_mask[3] = 0x08,
- .vsel_sel_regid = AB8500_REGU_VSMPS2_REGU,
- .vsel_sel_mask = 0x0c,
- .vsel_sel_val = {0x00, 0x04, 0x08, 0x0c},
- .vsel_regid[0] = AB8500_REGU_VSMPS2_SEL1,
- .vsel_mask[0] = 0x3f,
- .vsel_range[0] = vsmps2_vsel,
- .vsel_range_len[0] = ARRAY_SIZE(vsmps2_vsel),
- .vsel_regid[1] = AB8500_REGU_VSMPS2_SEL2,
- .vsel_mask[1] = 0x3f,
- .vsel_range[1] = vsmps2_vsel,
- .vsel_range_len[1] = ARRAY_SIZE(vsmps2_vsel),
- .vsel_regid[2] = AB8500_REGU_VSMPS2_SEL3,
- .vsel_mask[2] = 0x3f,
- .vsel_range[2] = vsmps2_vsel,
- .vsel_range_len[2] = ARRAY_SIZE(vsmps2_vsel),
- },
- [AB8500_VSMPS3] = {
- .name = "Vsmps3",
- .update_regid = AB8500_REGU_VSMPS3_REGU,
- .update_mask = 0x03,
- .update_val = {0x00, 0x01, 0x02, 0x03},
- .hw_mode_regid = AB8500_REGU_REQUEST_CTRL2,
- .hw_mode_mask = 0x03,
- .hw_mode_val = {0x00, 0x01, 0x02, 0x03},
- .hw_valid_regid[0] = AB8500_REGU_SYSCLK_REQ1_HP_VALID1,
- .hw_valid_mask[0] = 0x04,
- .hw_valid_regid[1] = AB8500_REGU_HW_HP_REQ1_VALID1,
- .hw_valid_mask[1] = 0x04,
- .hw_valid_regid[2] = AB8500_REGU_HW_HP_REQ2_VALID1,
- .hw_valid_mask[2] = 0x04,
- .hw_valid_regid[3] = AB8500_REGU_SW_HP_REQ_VALID1,
- .hw_valid_mask[3] = 0x10,
- .vsel_sel_regid = AB8500_REGU_VSMPS3_REGU,
- .vsel_sel_mask = 0x0c,
- .vsel_sel_val = {0x00, 0x04, 0x08, 0x0c},
- .vsel_regid[0] = AB8500_REGU_VSMPS3_SEL1,
- .vsel_mask[0] = 0x7f,
- .vsel_range[0] = vsmps3_vsel,
- .vsel_range_len[0] = ARRAY_SIZE(vsmps3_vsel),
- .vsel_regid[1] = AB8500_REGU_VSMPS3_SEL2,
- .vsel_mask[1] = 0x7f,
- .vsel_range[1] = vsmps3_vsel,
- .vsel_range_len[1] = ARRAY_SIZE(vsmps3_vsel),
- .vsel_regid[2] = AB8500_REGU_VSMPS3_SEL3,
- .vsel_mask[2] = 0x7f,
- .vsel_range[2] = vsmps3_vsel,
- .vsel_range_len[2] = ARRAY_SIZE(vsmps3_vsel),
- },
- [AB8500_VPLL] = {
- .name = "Vpll",
- .update_regid = AB8500_REGU_VPLL_VANA_REGU,
- .update_mask = 0x03,
- .update_val = {0x00, 0x01, 0x02, 0x03},
- .hw_mode_regid = AB8500_REGU_REQUEST_CTRL2,
- .hw_mode_mask = 0x0c,
- .hw_mode_val = {0x00, 0x04, 0x08, 0x0c},
- .hw_valid_regid[0] = AB8500_REGU_SYSCLK_REQ1_HP_VALID1,
- .hw_valid_mask[0] = 0x10,
- .hw_valid_regid[1] = AB8500_REGU_HW_HP_REQ1_VALID1,
- .hw_valid_mask[1] = 0x10,
- .hw_valid_regid[2] = AB8500_REGU_HW_HP_REQ2_VALID1,
- .hw_valid_mask[2] = 0x10,
- .hw_valid_regid[3] = AB8500_REGU_SW_HP_REQ_VALID1,
- .hw_valid_mask[3] = 0x40,
- },
- [AB8500_VREFDDR] = {
- .name = "VrefDDR",
- .update_regid = AB8500_REGU_VREF_DDR,
- .update_mask = 0x01,
- .update_val = {0x00, 0x01, 0x00, 0x00},
- },
- [AB8500_VMOD] = {
- .name = "Vmod",
- .update_regid = AB8500_REGU_VMOD_REGU,
- .update_mask = 0x03,
- .update_val = {0x00, 0x01, 0x02, 0x03},
- .hw_mode_regid = AB8500_REGU_VMOD_REGU,
- .hw_mode_mask = 0xc0,
- .hw_mode_val = {0x00, 0x40, 0x80, 0xc0},
- .hw_valid_regid[0] = AB8500_REGU_SYSCLK_REQ1_HP_VALID2,
- .hw_valid_mask[0] = 0x08,
- .hw_valid_regid[1] = AB8500_REGU_HW_HP_REQ1_VALID2,
- .hw_valid_mask[1] = 0x08,
- .hw_valid_regid[2] = AB8500_REGU_HW_HP_REQ2_VALID2,
- .hw_valid_mask[2] = 0x08,
- .hw_valid_regid[3] = AB8500_REGU_SW_HP_REQ_VALID2,
- .hw_valid_mask[3] = 0x20,
- .vsel_sel_regid = AB8500_REGU_VMOD_REGU,
- .vsel_sel_mask = 0x04,
- .vsel_sel_val = {0x00, 0x04, 0x00, 0x00},
- .vsel_regid[0] = AB8500_REGU_VMOD_SEL1,
- .vsel_mask[0] = 0x3f,
- .vsel_range[0] = varm_vape_vmod_vsel,
- .vsel_range_len[0] = ARRAY_SIZE(varm_vape_vmod_vsel),
- .vsel_regid[1] = AB8500_REGU_VMOD_SEL2,
- .vsel_mask[1] = 0x3f,
- .vsel_range[1] = varm_vape_vmod_vsel,
- .vsel_range_len[1] = ARRAY_SIZE(varm_vape_vmod_vsel),
- },
- [AB8500_VEXTSUPPLY1] = {
- .name = "Vextsupply1",
- .update_regid = AB8500_REGU_EXT_SUPPLY_REGU,
- .update_mask = 0x03,
- .update_val = {0x00, 0x01, 0x02, 0x03},
- .hw_mode_regid = AB8500_REGU_REQUEST_CTRL2,
- .hw_mode_mask = 0xc0,
- .hw_mode_val = {0x00, 0x40, 0x80, 0xc0},
- .hw_valid_regid[0] = AB8500_REGU_SYSCLK_REQ1_HP_VALID2,
- .hw_valid_mask[0] = 0x10,
- .hw_valid_regid[1] = AB8500_REGU_HW_HP_REQ1_VALID2,
- .hw_valid_mask[1] = 0x01,
- .hw_valid_regid[2] = AB8500_REGU_HW_HP_REQ2_VALID2,
- .hw_valid_mask[2] = 0x01,
- .hw_valid_regid[3] = AB8500_REGU_SW_HP_REQ_VALID2,
- .hw_valid_mask[3] = 0x04,
- },
- [AB8500_VEXTSUPPLY2] = {
- .name = "VextSupply2",
- .update_regid = AB8500_REGU_EXT_SUPPLY_REGU,
- .update_mask = 0x0c,
- .update_val = {0x00, 0x04, 0x08, 0x0c},
- .hw_mode_regid = AB8500_REGU_REQUEST_CTRL3,
- .hw_mode_mask = 0x03,
- .hw_mode_val = {0x00, 0x01, 0x02, 0x03},
- .hw_valid_regid[0] = AB8500_REGU_SYSCLK_REQ1_HP_VALID2,
- .hw_valid_mask[0] = 0x20,
- .hw_valid_regid[1] = AB8500_REGU_HW_HP_REQ1_VALID2,
- .hw_valid_mask[1] = 0x02,
- .hw_valid_regid[2] = AB8500_REGU_HW_HP_REQ2_VALID2,
- .hw_valid_mask[2] = 0x02,
- .hw_valid_regid[3] = AB8500_REGU_SW_HP_REQ_VALID2,
- .hw_valid_mask[3] = 0x08,
- },
- [AB8500_VEXTSUPPLY3] = {
- .name = "VextSupply3",
- .update_regid = AB8500_REGU_EXT_SUPPLY_REGU,
- .update_mask = 0x30,
- .update_val = {0x00, 0x10, 0x20, 0x30},
- .hw_mode_regid = AB8500_REGU_REQUEST_CTRL3,
- .hw_mode_mask = 0x0c,
- .hw_mode_val = {0x00, 0x04, 0x08, 0x0c},
- .hw_valid_regid[0] = AB8500_REGU_SYSCLK_REQ1_HP_VALID2,
- .hw_valid_mask[0] = 0x40,
- .hw_valid_regid[1] = AB8500_REGU_HW_HP_REQ1_VALID2,
- .hw_valid_mask[1] = 0x04,
- .hw_valid_regid[2] = AB8500_REGU_HW_HP_REQ2_VALID2,
- .hw_valid_mask[2] = 0x04,
- .hw_valid_regid[3] = AB8500_REGU_SW_HP_REQ_VALID2,
- .hw_valid_mask[3] = 0x10,
- },
- [AB8500_VRF1] = {
- .name = "Vrf1",
- .update_regid = AB8500_REGU_VRF1_VAUX3_REGU,
- .update_mask = 0x0c,
- .update_val = {0x00, 0x04, 0x08, 0x0c},
- .vsel_regid[0] = AB8500_REGU_VRF1_VAUX3_SEL,
- .vsel_mask[0] = 0x30,
- .vsel_range[0] = vrf1_vsel,
- .vsel_range_len[0] = ARRAY_SIZE(vrf1_vsel),
- },
- [AB8500_VANA] = {
- .name = "Vana",
- .update_regid = AB8500_REGU_VPLL_VANA_REGU,
- .update_mask = 0x0c,
- .update_val = {0x00, 0x04, 0x08, 0x0c},
- .hw_mode_regid = AB8500_REGU_REQUEST_CTRL2,
- .hw_mode_mask = 0x30,
- .hw_mode_val = {0x00, 0x10, 0x20, 0x30},
- .hw_valid_regid[0] = AB8500_REGU_SYSCLK_REQ1_HP_VALID1,
- .hw_valid_mask[0] = 0x08,
- .hw_valid_regid[1] = AB8500_REGU_HW_HP_REQ1_VALID1,
- .hw_valid_mask[1] = 0x08,
- .hw_valid_regid[2] = AB8500_REGU_HW_HP_REQ2_VALID1,
- .hw_valid_mask[2] = 0x08,
- .hw_valid_regid[3] = AB8500_REGU_SW_HP_REQ_VALID1,
- .hw_valid_mask[3] = 0x20,
- },
- [AB8500_VAUX1] = {
- .name = "Vaux1",
- .update_regid = AB8500_REGU_VAUX12_REGU,
- .update_mask = 0x03,
- .update_val = {0x00, 0x01, 0x02, 0x03},
- .hw_mode_regid = AB8500_REGU_REQUEST_CTRL3,
- .hw_mode_mask = 0x30,
- .hw_mode_val = {0x00, 0x10, 0x20, 0x30},
- .hw_valid_regid[0] = AB8500_REGU_SYSCLK_REQ1_HP_VALID1,
- .hw_valid_mask[0] = 0x20,
- .hw_valid_regid[1] = AB8500_REGU_HW_HP_REQ1_VALID1,
- .hw_valid_mask[1] = 0x20,
- .hw_valid_regid[2] = AB8500_REGU_HW_HP_REQ2_VALID1,
- .hw_valid_mask[2] = 0x20,
- .hw_valid_regid[3] = AB8500_REGU_SW_HP_REQ_VALID1,
- .hw_valid_mask[3] = 0x80,
- .vsel_regid[0] = AB8500_REGU_VAUX1_SEL,
- .vsel_mask[0] = 0x0f,
- .vsel_range[0] = vaux1_vaux2_vsel,
- .vsel_range_len[0] = ARRAY_SIZE(vaux1_vaux2_vsel),
- },
- [AB8500_VAUX2] = {
- .name = "Vaux2",
- .update_regid = AB8500_REGU_VAUX12_REGU,
- .update_mask = 0x0c,
- .update_val = {0x00, 0x04, 0x08, 0x0c},
- .hw_mode_regid = AB8500_REGU_REQUEST_CTRL3,
- .hw_mode_mask = 0xc0,
- .hw_mode_val = {0x00, 0x40, 0x80, 0xc0},
- .hw_valid_regid[0] = AB8500_REGU_SYSCLK_REQ1_HP_VALID1,
- .hw_valid_mask[0] = 0x40,
- .hw_valid_regid[1] = AB8500_REGU_HW_HP_REQ1_VALID1,
- .hw_valid_mask[1] = 0x40,
- .hw_valid_regid[2] = AB8500_REGU_HW_HP_REQ2_VALID1,
- .hw_valid_mask[2] = 0x40,
- .hw_valid_regid[3] = AB8500_REGU_SW_HP_REQ_VALID2,
- .hw_valid_mask[3] = 0x01,
- .vsel_regid[0] = AB8500_REGU_VAUX2_SEL,
- .vsel_mask[0] = 0x0f,
- .vsel_range[0] = vaux1_vaux2_vsel,
- .vsel_range_len[0] = ARRAY_SIZE(vaux1_vaux2_vsel),
- },
- [AB8500_VAUX3] = {
- .name = "Vaux3",
- .update_regid = AB8500_REGU_VRF1_VAUX3_REGU,
- .update_mask = 0x03,
- .update_val = {0x00, 0x01, 0x02, 0x03},
- .hw_mode_regid = AB8500_REGU_REQUEST_CTRL4,
- .hw_mode_mask = 0x03,
- .hw_mode_val = {0x00, 0x01, 0x02, 0x03},
- .hw_valid_regid[0] = AB8500_REGU_SYSCLK_REQ1_HP_VALID1,
- .hw_valid_mask[0] = 0x80,
- .hw_valid_regid[1] = AB8500_REGU_HW_HP_REQ1_VALID1,
- .hw_valid_mask[1] = 0x80,
- .hw_valid_regid[2] = AB8500_REGU_HW_HP_REQ2_VALID1,
- .hw_valid_mask[2] = 0x80,
- .hw_valid_regid[3] = AB8500_REGU_SW_HP_REQ_VALID2,
- .hw_valid_mask[3] = 0x02,
- .vsel_regid[0] = AB8500_REGU_VRF1_VAUX3_SEL,
- .vsel_mask[0] = 0x07,
- .vsel_range[0] = vaux3_vsel,
- .vsel_range_len[0] = ARRAY_SIZE(vaux3_vsel),
- },
- [AB8500_VINTCORE] = {
- .name = "VintCore12",
- .update_regid = AB8500_REGU_MISC1,
- .update_mask = 0x44,
- .update_val = {0x00, 0x04, 0x00, 0x44},
- .vsel_regid[0] = AB8500_REGU_MISC1,
- .vsel_mask[0] = 0x38,
- .vsel_range[0] = vintcore12_vsel,
- .vsel_range_len[0] = ARRAY_SIZE(vintcore12_vsel),
- },
- [AB8500_VTVOUT] = {
- .name = "VTVout",
- .update_regid = AB8500_REGU_MISC1,
- .update_mask = 0x82,
- .update_val = {0x00, 0x02, 0x00, 0x82},
- },
- [AB8500_VAUDIO] = {
- .name = "Vaudio",
- .update_regid = AB8500_REGU_VAUDIO_SUPPLY,
- .update_mask = 0x02,
- .update_val = {0x00, 0x02, 0x00, 0x00},
- },
- [AB8500_VANAMIC1] = {
- .name = "Vanamic1",
- .update_regid = AB8500_REGU_VAUDIO_SUPPLY,
- .update_mask = 0x08,
- .update_val = {0x00, 0x08, 0x00, 0x00},
- },
- [AB8500_VANAMIC2] = {
- .name = "Vanamic2",
- .update_regid = AB8500_REGU_VAUDIO_SUPPLY,
- .update_mask = 0x10,
- .update_val = {0x00, 0x10, 0x00, 0x00},
- },
- [AB8500_VDMIC] = {
- .name = "Vdmic",
- .update_regid = AB8500_REGU_VAUDIO_SUPPLY,
- .update_mask = 0x04,
- .update_val = {0x00, 0x04, 0x00, 0x00},
- },
- [AB8500_VUSB] = {
- .name = "Vusb",
- .update_regid = AB8500_REGU_VUSB_CTRL,
- .update_mask = 0x03,
- .update_val = {0x00, 0x01, 0x00, 0x03},
- },
- [AB8500_VOTG] = {
- .name = "VOTG",
- .update_regid = AB8500_REGU_OTG_SUPPLY_CTRL,
- .update_mask = 0x03,
- .update_val = {0x00, 0x01, 0x00, 0x03},
- },
- [AB8500_VBUSBIS] = {
- .name = "Vbusbis",
- .update_regid = AB8500_REGU_OTG_SUPPLY_CTRL,
- .update_mask = 0x08,
- .update_val = {0x00, 0x08, 0x00, 0x00},
- },
-};
-
-static int status_state;
-
-static int _get_voltage(struct regulator_volt_range const *volt_range,
- u8 value, int *volt)
-{
- u8 start = volt_range->start.value;
- u8 end = volt_range->end.value;
- u8 step = volt_range->step.value;
-
- /* Check if witin range */
- if (step == 0) {
- if (value == start) {
- *volt = volt_range->start.volt;
- return 1;
- }
- } else {
- if ((start <= value) && (value <= end)) {
- if ((value - start)%step != 0)
- return -EINVAL; /* invalid setting */
- *volt = volt_range->start.volt
- + volt_range->step.volt
- *((value - start)/step);
- return 1;
- }
- }
-
- return 0;
-}
-
-static int get_voltage(struct regulator_volt_range const *volt_range,
- int volt_range_len,
- u8 value)
-{
- int volt;
- int i, ret;
-
- for (i = 0; i < volt_range_len; i++) {
- ret = _get_voltage(&volt_range[i], value, &volt);
- if (ret < 0)
- break; /* invalid setting */
- if (ret == 1)
- return volt; /* successful */
- }
-
- return -EINVAL;
-}
-
-static int ab8500_regulator_status_print(struct seq_file *s, void *p)
-{
- struct device *dev = s->private;
- int id, regid;
- int i;
- u8 val;
- int err;
-
- /* record current state */
- ab8500_regulator_record_state(AB8500_REGULATOR_STATE_CURRENT);
-
- /* check if chosen state is recorded */
- if (!ab8500_register_state_saved[status_state]) {
- seq_printf(s, "ab8500-regulator status is not recorded.\n");
- goto exit;
- }
-
- /* print dump header */
- err = seq_printf(s, "ab8500-regulator status:\n");
- if (err < 0)
- dev_err(dev, "seq_printf overflow\n");
-
- /* print state */
- err = seq_printf(s, "%12s\n",
- regulator_state_name[status_state]);
- if (err < 0)
- dev_err(dev, "seq_printf overflow\n");
-
- /* print labels */
- err = seq_printf(s,
- "+-----------+----+--------------+-------------------------+\n");
- if (err < 0)
- dev_err(dev, "seq_printf overflow: %i\n", __LINE__);
- err = seq_printf(s,
- "| name|man |auto |voltage |\n");
- if (err < 0)
- dev_err(dev, "seq_printf overflow: %i\n", __LINE__);
- err = seq_printf(s,
- "+-----------+----+--------------+ +-----------------------+\n");
- if (err < 0)
- dev_err(dev, "seq_printf overflow: %i\n", __LINE__);
- err = seq_printf(s,
- "| |mode|mode |0|1|2|3| | 1 | 2 | 3 |\n");
- if (err < 0)
- dev_err(dev, "seq_printf overflow: %i\n", __LINE__);
- err = seq_printf(s,
- "+-----------+----+------+-+-+-+-+-+-------+-------+-------+\n");
- if (err < 0)
- dev_err(dev, "seq_printf overflow: %i\n", __LINE__);
-
- /* dump registers */
- for (id = 0; id < AB8500_NUM_REGULATORS; id++) {
- /* print name */
- err = seq_printf(s, "|%11s|",
- ab8500_regulator[id].name);
- if (err < 0)
- dev_err(dev, "seq_printf overflow: %i, %i\n",
- id, __LINE__);
-
- /* print manual mode */
- regid = ab8500_regulator[id].update_regid;
- val = ab8500_register_state[status_state][regid]
- & ab8500_regulator[id].update_mask;
- for (i = 0; i < 4; i++) {
- if (val == ab8500_regulator[id].update_val[i])
- break;
- }
- err = seq_printf(s, "%4s|",
- update_val_name[i]);
- if (err < 0)
- dev_err(dev, "seq_printf overflow: %i, %i\n",
- id, __LINE__);
-
- /* print auto mode */
- regid = ab8500_regulator[id].hw_mode_regid;
- if (regid) {
- val = ab8500_register_state[status_state][regid]
- & ab8500_regulator[id].hw_mode_mask;
- for (i = 0; i < 4; i++) {
- if (val == ab8500_regulator[id].hw_mode_val[i])
- break;
- }
- err = seq_printf(s, "%6s|",
- hw_mode_val_name[i]);
- } else {
- err = seq_printf(s, " |");
- }
- if (err < 0)
- dev_err(dev, "seq_printf overflow: %i, %i\n",
- id, __LINE__);
-
- /* print valid bits */
- for (i = 0; i < 4; i++) {
- regid = ab8500_regulator[id].hw_valid_regid[i];
- if (regid) {
- val = ab8500_register_state[status_state][regid]
- & ab8500_regulator[id].hw_valid_mask[i];
- if (val)
- err = seq_printf(s, "1|");
- else
- err = seq_printf(s, "0|");
- } else {
- err = seq_printf(s, " |");
- }
- if (err < 0)
- dev_err(dev, "seq_printf overflow: %i, %i\n",
- regid, __LINE__);
- }
-
- /* print voltage selection */
- regid = ab8500_regulator[id].vsel_sel_regid;
- if (regid) {
- val = ab8500_register_state[status_state][regid]
- & ab8500_regulator[id].vsel_sel_mask;
- for (i = 0; i < 3; i++) {
- if (val == ab8500_regulator[id].vsel_sel_val[i])
- break;
- }
- if (i < 3)
- seq_printf(s, "%i|", i + 1);
- else
- seq_printf(s, "-|");
- } else {
- seq_printf(s, " |");
- }
- if (err < 0)
- dev_err(dev, "seq_printf overflow: %i, %i\n",
- regid, __LINE__);
-
- for (i = 0; i < 3; i++) {
- int volt;
-
- regid = ab8500_regulator[id].vsel_regid[i];
- if (regid) {
- val = ab8500_register_state[status_state][regid]
- & ab8500_regulator[id].vsel_mask[i];
- volt = get_voltage(
- ab8500_regulator[id].vsel_range[i],
- ab8500_regulator[id].vsel_range_len[i],
- val);
- seq_printf(s, "%7i|", volt);
- } else {
- seq_printf(s, " |");
- }
- if (err < 0)
- dev_err(dev, "seq_printf overflow: %i, %i\n",
- regid, __LINE__);
- }
-
- err = seq_printf(s, "\n");
- if (err < 0)
- dev_err(dev, "seq_printf overflow: %i, %i\n",
- regid, __LINE__);
-
- }
- err = seq_printf(s,
- "+-----------+----+------+-+-+-+-+-+-------+-------+-------+\n");
- if (err < 0)
- dev_err(dev, "seq_printf overflow: %i\n", __LINE__);
- err = seq_printf(s,
- "Note! In HW mode, voltage selection is controlled by HW.\n");
- if (err < 0)
- dev_err(dev, "seq_printf overflow: %i\n", __LINE__);
-
-
-exit:
- return 0;
-}
-
-static int ab8500_regulator_status_write(struct file *file,
- const char __user *user_buf,
- size_t count, loff_t *ppos)
-{
- char buf[32];
- int buf_size;
- unsigned long user_val;
- int err;
-
- /* copy user data */
- buf_size = min(count, (sizeof(buf) - 1));
- if (copy_from_user(buf, user_buf, buf_size))
- return -EFAULT;
- buf[buf_size] = 0;
-
- /* convert */
- err = strict_strtoul(buf, 0, &user_val);
- if (err)
- return -EINVAL;
-
- /* set suspend force setting */
- if (user_val > NUM_REGULATOR_STATE) {
- dev_err(dev, "debugfs error input > number of states\n");
- return -EINVAL;
- }
-
- status_state = user_val;
-
- return buf_size;
-}
-
-
-static int ab8500_regulator_status_open(struct inode *inode, struct file *file)
-{
- return single_open(file, ab8500_regulator_status_print,
- inode->i_private);
-}
-
-static const struct file_operations ab8500_regulator_status_fops = {
- .open = ab8500_regulator_status_open,
- .write = ab8500_regulator_status_write,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = single_release,
- .owner = THIS_MODULE,
-};
-
-#ifdef CONFIG_PM
-
-struct ab8500_force_reg {
- char *name;
- u8 bank;
- u8 addr;
- u8 mask;
- u8 val;
- bool restore;
- u8 restore_val;
-};
-
-static struct ab8500_force_reg ab8500_force_reg[] = {
- {
- /*
- * SysClkCtrl
- * OTP: 0x00, HSI: 0x06, suspend: 0x00/0x07 (value/mask)
- * [ 2] USBClkEna = disable SysClk path to USB block
- * [ 1] TVoutClkEna = disable 27Mhz clock to TVout block
- * [ 0] TVoutPllEna = disable TVout pll
- * (generate 27Mhz from SysClk)
- */
- .name = "SysClkCtrl",
- .bank = 0x02,
- .addr = 0x0c,
- .mask = 0x07,
- .val = 0x00,
- },
- {
- /*
- * ReguSysClkReq1HPValid2
- * OTP: 0x03, HSI: 0x40, suspend: 0x60/0x70 (value/mask)
- * [ 5] VextSupply2SysClkReq1HPValid = Vext2 set by SysClkReq1
- */
- .name = "ReguSysClkReq1HPValid2",
- .bank = 0x03,
- .addr = 0x08,
- .mask = 0x20, /* test and compare with 0x7f */
- .val = 0x20,
- },
- {
- /*
- * ReguRequestCtrl3
- * OTP: 0x00, HSI: 0x00, suspend: 0x05/0x0f (value/mask)
- * [1:0] VExtSupply2RequestCtrl[1:0] = VExt2 set in HP/OFF mode
- */
- .name = "ReguRequestCtrl3",
- .bank = 0x03,
- .addr = 0x05,
- .mask = 0x03, /* test and compare with 0xff */
- .val = 0x01,
- },
- {
- /*
- * VsimSysClkCtrl
- * OTP: 0x01, HSI: 0x21, suspend: 0x01/0xff (value/mask)
- * [ 7] VsimSysClkReq8Valid = no connection
- * [ 6] VsimSysClkReq7Valid = no connection
- * [ 5] VsimSysClkReq6Valid = no connection
- * [ 4] VsimSysClkReq5Valid = no connection
- * [ 3] VsimSysClkReq4Valid = no connection
- * [ 2] VsimSysClkReq3Valid = no connection
- * [ 1] VsimSysClkReq2Valid = no connection
- * [ 0] VsimSysClkReq1Valid = Vsim set by SysClkReq1
- */
- .name = "VsimSysClkCtrl",
- .bank = 0x02,
- .addr = 0x33,
- .mask = 0xff,
- .val = 0x01,
- },
- {
- /*
- * SysUlpClkCtrl1
- * OTP: 0x00, HSI: 0x00, suspend: 0x00/0x0f (value/mask)
- * [ 3] 4500SysClkReq = inactive
- * [ 2] UlpClkReq = inactive
- * [1:0] SysUlpClkIntSel[1:0] = no internal clock switching.
- * Internal clock is SysClk.
- */
- .name = "SysUlpClkCtrl1",
- .bank = 0x02,
- .addr = 0x0b,
- .mask = 0x0f,
- .val = 0x00,
- },
- {
- /*
- * ExtSupplyRegu (HSI: 0x2a on v2-v40?)
- * OTP: 0x15, HSI: 0x28, suspend: 0x28/0x3f (value/mask)
- * [5:4] VExtSupply3Regu[1:0] = 10 = Vext3 off
- * [3:2] VExtSupply2Regu[1:0] = 10 = Vext2 in HW control
- * [1:0] VExtSupply1Regu[1:0] = 00 = Vext1 off
- */
- .name = "ExtSupplyRegu",
- .bank = 0x04,
- .addr = 0x08,
- .mask = 0x3f,
- .val = 0x08,
- },
- {
- /*
- * TVoutCtrl
- * OTP: N/A, HSI: N/A, suspend: 0x00/0x03 (value/mask)
- * [ 2] PlugTvOn = plug/unplug detection disabled
- * [1:0] TvoutDacCtrl[1:0] = "0" forced on DAC input (test)
- */
- .name = "TVoutCtrl",
- .bank = 0x06,
- .addr = 0x80,
- .mask = 0x03,
- .val = 0x00,
- },
-};
-
-void ab8500_regulator_debug_force(void)
-{
- int ret, i;
-
- /* save state of registers */
- ret = ab8500_regulator_record_state(AB8500_REGULATOR_STATE_SUSPEND);
- if (ret < 0)
- dev_err(&pdev->dev, "Failed to record suspend state.\n");
-
- /* check if registers should be forced */
- if (!setting_suspend_force)
- goto exit;
-
- /*
- * Optimize href v2_v50_pwr board for ApSleep/ApDeepSleep
- * power consumption measurements
- */
-
- for (i = 0; i < ARRAY_SIZE(ab8500_force_reg); i++) {
- dev_vdbg(&pdev->dev, "Save and set %s: "
- "0x%02x, 0x%02x, 0x%02x, 0x%02x.\n",
- ab8500_force_reg[i].name,
- ab8500_force_reg[i].bank,
- ab8500_force_reg[i].addr,
- ab8500_force_reg[i].mask,
- ab8500_force_reg[i].val);
-
- /* assume that register should be restored */
- ab8500_force_reg[i].restore = true;
-
- /* get register value before forcing it */
- ret = abx500_get_register_interruptible(&pdev->dev,
- ab8500_force_reg[i].bank,
- ab8500_force_reg[i].addr,
- &ab8500_force_reg[i].restore_val);
- if (ret < 0) {
- dev_err(dev, "Failed to read %s.\n",
- ab8500_force_reg[i].name);
- ab8500_force_reg[i].restore = false;
- break;
- }
-
- /* force register value */
- ret = abx500_mask_and_set_register_interruptible(&pdev->dev,
- ab8500_force_reg[i].bank,
- ab8500_force_reg[i].addr,
- ab8500_force_reg[i].mask,
- ab8500_force_reg[i].val);
- if (ret < 0) {
- dev_err(&pdev->dev, "Failed to write %s.\n",
- ab8500_force_reg[i].name);
- ab8500_force_reg[i].restore = false;
- }
- }
-
-exit:
- /* save state of registers */
- ret = ab8500_regulator_record_state(
- AB8500_REGULATOR_STATE_SUSPEND_CORE);
- if (ret < 0)
- dev_err(&pdev->dev, "Failed to record suspend state.\n");
-
- return;
-}
-
-void ab8500_regulator_debug_restore(void)
-{
- int ret, i;
-
- /* save state of registers */
- ret = ab8500_regulator_record_state(AB8500_REGULATOR_STATE_RESUME_CORE);
- if (ret < 0)
- dev_err(&pdev->dev, "Failed to record resume state.\n");
- for (i = ARRAY_SIZE(ab8500_force_reg) - 1; i >= 0; i--) {
- /* restore register value */
- if (ab8500_force_reg[i].restore) {
- ret = abx500_mask_and_set_register_interruptible(
- &pdev->dev,
- ab8500_force_reg[i].bank,
- ab8500_force_reg[i].addr,
- ab8500_force_reg[i].mask,
- ab8500_force_reg[i].restore_val);
- if (ret < 0)
- dev_err(&pdev->dev, "Failed to restore %s.\n",
- ab8500_force_reg[i].name);
- dev_vdbg(&pdev->dev, "Restore %s: "
- "0x%02x, 0x%02x, 0x%02x, 0x%02x\n",
- ab8500_force_reg[i].name,
- ab8500_force_reg[i].bank,
- ab8500_force_reg[i].addr,
- ab8500_force_reg[i].mask,
- ab8500_force_reg[i].restore_val);
- }
- }
-
- /* save state of registers */
- ret = ab8500_regulator_record_state(AB8500_REGULATOR_STATE_RESUME);
- if (ret < 0)
- dev_err(&pdev->dev, "Failed to record resume state.\n");
-
- return;
-}
-
-#endif
-
-static int ab8500_regulator_suspend_force_show(struct seq_file *s, void *p)
-{
- /* print suspend standby status */
- if (setting_suspend_force)
- return seq_printf(s, "suspend force enabled\n");
- else
- return seq_printf(s, "no suspend force\n");
-}
-
-static int ab8500_regulator_suspend_force_write(struct file *file,
- const char __user *user_buf,
- size_t count, loff_t *ppos)
-{
- char buf[32];
- int buf_size;
- unsigned long user_val;
- int err;
-
- /* copy user data */
- buf_size = min(count, (sizeof(buf) - 1));
- if (copy_from_user(buf, user_buf, buf_size))
- return -EFAULT;
- buf[buf_size] = 0;
-
- /* convert */
- err = strict_strtoul(buf, 0, &user_val);
- if (err)
- return -EINVAL;
-
- /* set suspend force setting */
- if (user_val > 1) {
- dev_err(dev, "debugfs error input > 1\n");
- return -EINVAL;
- }
-
- if (user_val)
- setting_suspend_force = true;
- else
- setting_suspend_force = false;
-
- return buf_size;
-}
-
-static int ab8500_regulator_suspend_force_open(struct inode *inode,
- struct file *file)
-{
- return single_open(file, ab8500_regulator_suspend_force_show,
- inode->i_private);
-}
-
-static const struct file_operations ab8500_regulator_suspend_force_fops = {
- .open = ab8500_regulator_suspend_force_open,
- .write = ab8500_regulator_suspend_force_write,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = single_release,
- .owner = THIS_MODULE,
-};
-
-static struct dentry *ab8500_regulator_dir;
-static struct dentry *ab8500_regulator_dump_file;
-static struct dentry *ab8500_regulator_status_file;
-static struct dentry *ab8500_regulator_suspend_force_file;
-
-static int __devinit ab8500_regulator_debug_probe(struct platform_device *plf)
-{
- void __iomem *boot_info_backupram;
- int ret, i;
-
- /* setup dev pointers */
- dev = &plf->dev;
- pdev = plf;
-
- /* save state of registers */
- ret = ab8500_regulator_record_state(AB8500_REGULATOR_STATE_INIT);
- if (ret < 0)
- dev_err(&plf->dev, "Failed to record init state.\n");
-
- /* remove force of external regulators if AB8500 3.0 and DB8500 v2.2 */
- if ((abx500_get_chip_id(&pdev->dev) >= 0x30) && cpu_is_u8500v22()) {
- /*
- * find ExtSupplyRegu register (bank 0x04, addr 0x08)
- * and update value (Vext1 in low-power, Vext2 off).
- */
- for (i = 0; i < ARRAY_SIZE(ab8500_force_reg); i++) {
- if (ab8500_force_reg[i].bank == 0x04 &&
- ab8500_force_reg[i].addr == 0x08) {
- u8 val, val_mask = 0x0f;
-
- val = ab8500_force_reg[i].val;
- val = (val & ~val_mask) | (0x03 & val_mask);
- ab8500_force_reg[i].val = val;
- }
- }
- }
-
- /*
- * find ExtSupplyRegu register (bank 0x04, addr 0x08)
- * and update value (Vext3 in high power).
- */
- for (i = 0; i < ARRAY_SIZE(ab8500_force_reg); i++) {
- if (ab8500_force_reg[i].bank == 0x04 &&
- ab8500_force_reg[i].addr == 0x08) {
- u8 val, val_mask = 0x30;
-
- val = ab8500_force_reg[i].val;
- val = (val & ~val_mask) | (0x10 & val_mask);
- ab8500_force_reg[i].val = val;
- }
- }
-
- /* make suspend-force default if board profile is v5x-power */
- boot_info_backupram = ioremap(BOOT_INFO_BACKUPRAM1, 0x4);
-
- if (boot_info_backupram) {
- u8 board_profile;
- board_profile = readb(
- boot_info_backupram + BOARD_PROFILE_BACKUPRAM1);
- dev_dbg(dev, "Board profile is 0x%02x\n", board_profile);
-
- if (board_profile >= OPTION_BOARD_VERSION_V5X)
- setting_suspend_force = true;
-
- iounmap(boot_info_backupram);
- } else {
- dev_err(dev, "Failed to read backupram.\n");
- }
-
- /* create directory */
- ab8500_regulator_dir = debugfs_create_dir("ab8500-regulator", NULL);
- if (!ab8500_regulator_dir)
- goto exit_no_debugfs;
-
- /* create "dump" file */
- ab8500_regulator_dump_file = debugfs_create_file("dump",
- S_IRUGO, ab8500_regulator_dir, &plf->dev,
- &ab8500_regulator_dump_fops);
- if (!ab8500_regulator_dump_file)
- goto exit_destroy_dir;
-
- /* create "status" file */
- ab8500_regulator_status_file = debugfs_create_file("status",
- S_IRUGO, ab8500_regulator_dir, &plf->dev,
- &ab8500_regulator_status_fops);
- if (!ab8500_regulator_status_file)
- goto exit_destroy_dump_file;
-
- /*
- * create "suspend-force-v5x" file. As indicated by the name, this is
- * only applicable for v2_v5x hardware versions.
- */
- ab8500_regulator_suspend_force_file = debugfs_create_file(
- "suspend-force-v5x",
- S_IRUGO, ab8500_regulator_dir, &plf->dev,
- &ab8500_regulator_suspend_force_fops);
- if (!ab8500_regulator_suspend_force_file)
- goto exit_destroy_status_file;
-
- return 0;
-
-exit_destroy_status_file:
- debugfs_remove(ab8500_regulator_status_file);
-exit_destroy_dump_file:
- debugfs_remove(ab8500_regulator_dump_file);
-exit_destroy_dir:
- debugfs_remove(ab8500_regulator_dir);
-exit_no_debugfs:
- dev_err(&plf->dev, "failed to create debugfs entries.\n");
- return -ENOMEM;
-}
-
-static int __devexit ab8500_regulator_debug_remove(struct platform_device *plf)
-{
- debugfs_remove(ab8500_regulator_suspend_force_file);
- debugfs_remove(ab8500_regulator_status_file);
- debugfs_remove(ab8500_regulator_dump_file);
- debugfs_remove(ab8500_regulator_dir);
-
- return 0;
-}
-
-static struct platform_driver ab8500_regulator_debug_driver = {
- .driver = {
- .name = "ab8500-regulator-debug",
- .owner = THIS_MODULE,
- },
- .probe = ab8500_regulator_debug_probe,
- .remove = __devexit_p(ab8500_regulator_debug_remove),
-};
-
-static int __init ab8500_regulator_debug_init(void)
-{
- int ret;
-
- ret = platform_driver_register(&ab8500_regulator_debug_driver);
- if (ret)
- pr_err("Failed to register ab8500 regulator: %d\n", ret);
-
- return ret;
-}
-subsys_initcall(ab8500_regulator_debug_init);
-
-static void __exit ab8500_regulator_debug_exit(void)
-{
- platform_driver_unregister(&ab8500_regulator_debug_driver);
-}
-module_exit(ab8500_regulator_debug_exit);
-
-MODULE_LICENSE("GPL v2");
-MODULE_AUTHOR("Bengt Jonsson <bengt.g.jonsson@stericsson.com");
-MODULE_DESCRIPTION("AB8500 Regulator Debug");
-MODULE_ALIAS("platform:ab8500-regulator-debug");
diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c
index 00c275a6da7..02f3c2333c8 100644
--- a/drivers/regulator/ab8500.c
+++ b/drivers/regulator/ab8500.c
@@ -14,61 +14,49 @@
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/err.h>
-#include <linux/delay.h>
#include <linux/platform_device.h>
#include <linux/mfd/ab8500.h>
#include <linux/mfd/abx500.h>
#include <linux/regulator/driver.h>
#include <linux/regulator/machine.h>
#include <linux/regulator/ab8500.h>
-#include <linux/mfd/ab8500/gpio.h> /* for sysclkreq pins */
/**
* struct ab8500_regulator_info - ab8500 regulator information
* @dev: device pointer
* @desc: regulator description
* @regulator_dev: regulator device
- * @is_enabled: status of regulator (on/off)
* @max_uV: maximum voltage (for variable voltage supplies)
* @min_uV: minimum voltage (for variable voltage supplies)
* @fixed_uV: typical voltage (for fixed voltage supplies)
- * @load_lp_uA: maximum load in idle (low power) mode
* @update_bank: bank to control on/off
* @update_reg: register to control on/off
- * @update_mask: mask to enable/disable and set mode of regulator
- * @update_val: bits holding the regulator current mode
- * @update_val_idle: bits to enable the regulator in idle (low power) mode
- * @update_val_normal: bits to enable the regulator in normal (high power) mode
+ * @update_mask: mask to enable/disable regulator
+ * @update_val_enable: bits to enable the regulator in normal (high power) mode
* @voltage_bank: bank to control regulator voltage
* @voltage_reg: register to control regulator voltage
* @voltage_mask: mask to control regulator voltage
* @voltages: supported voltage table
* @voltages_len: number of supported voltages for the regulator
- * @delay: startup delay in ms
- * @gpio_pin: gpio pin number (for sysclkreq regulator only)
+ * @delay: startup/set voltage delay in us
*/
struct ab8500_regulator_info {
struct device *dev;
struct regulator_desc desc;
struct regulator_dev *regulator;
- bool is_enabled;
int max_uV;
int min_uV;
int fixed_uV;
- int load_lp_uA;
u8 update_bank;
u8 update_reg;
u8 update_mask;
- u8 update_val;
- u8 update_val_idle;
- u8 update_val_normal;
+ u8 update_val_enable;
u8 voltage_bank;
u8 voltage_reg;
u8 voltage_mask;
int const *voltages;
int voltages_len;
unsigned int delay;
- unsigned int gpio_pin;
};
/* voltage tables for the vauxn/vintcore supplies */
@@ -124,19 +112,15 @@ static int ab8500_regulator_enable(struct regulator_dev *rdev)
ret = abx500_mask_and_set_register_interruptible(info->dev,
info->update_bank, info->update_reg,
- info->update_mask, info->update_val);
+ info->update_mask, info->update_val_enable);
if (ret < 0)
dev_err(rdev_get_dev(rdev),
"couldn't set enable bits for regulator\n");
- msleep(info->delay);
-
- info->is_enabled = true;
-
dev_vdbg(rdev_get_dev(rdev),
"%s-enable (bank, reg, mask, value): 0x%x, 0x%x, 0x%x, 0x%x\n",
info->desc.name, info->update_bank, info->update_reg,
- info->update_mask, info->update_val);
+ info->update_mask, info->update_val_enable);
return ret;
}
@@ -158,10 +142,6 @@ static int ab8500_regulator_disable(struct regulator_dev *rdev)
dev_err(rdev_get_dev(rdev),
"couldn't set disable bits for regulator\n");
- msleep(info->delay);
-
- info->is_enabled = false;
-
dev_vdbg(rdev_get_dev(rdev),
"%s-disable (bank, reg, mask, value): 0x%x, 0x%x, 0x%x, 0x%x\n",
info->desc.name, info->update_bank, info->update_reg,
@@ -170,88 +150,6 @@ static int ab8500_regulator_disable(struct regulator_dev *rdev)
return ret;
}
-static unsigned int ab8500_regulator_get_optimum_mode(
- struct regulator_dev *rdev, int input_uV,
- int output_uV, int load_uA)
-{
- unsigned int mode;
-
- struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
-
- if (info == NULL) {
- dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
- return -EINVAL;
- }
-
- if (load_uA <= info->load_lp_uA)
- mode = REGULATOR_MODE_IDLE;
- else
- mode = REGULATOR_MODE_NORMAL;
-
- return mode;
-}
-
-static int ab8500_regulator_set_mode(struct regulator_dev *rdev,
- unsigned int mode)
-{
- int ret = 0;
-
- struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
-
- if (info == NULL) {
- dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
- return -EINVAL;
- }
-
- switch (mode) {
- case REGULATOR_MODE_NORMAL:
- info->update_val = info->update_val_normal;
- break;
- case REGULATOR_MODE_IDLE:
- info->update_val = info->update_val_idle;
- break;
- default:
- return -EINVAL;
- }
-
- if (info->is_enabled) {
- ret = abx500_mask_and_set_register_interruptible(info->dev,
- info->update_bank, info->update_reg,
- info->update_mask, info->update_val);
- if (ret < 0)
- dev_err(rdev_get_dev(rdev),
- "couldn't set regulator mode\n");
-
- dev_vdbg(rdev_get_dev(rdev),
- "%s-set_mode (bank, reg, mask, value): "
- "0x%x, 0x%x, 0x%x, 0x%x\n",
- info->desc.name, info->update_bank, info->update_reg,
- info->update_mask, info->update_val);
- }
-
- return ret;
-}
-
-static unsigned int ab8500_regulator_get_mode(struct regulator_dev *rdev)
-{
- struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
- int ret;
-
- if (info == NULL) {
- dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
- return -EINVAL;
- }
-
- if (info->update_val == info->update_val_normal)
- ret = REGULATOR_MODE_NORMAL;
- else if (info->update_val == info->update_val_idle)
- ret = REGULATOR_MODE_IDLE;
- else
- ret = -EINVAL;
-
- return ret;
-}
-
static int ab8500_regulator_is_enabled(struct regulator_dev *rdev)
{
int ret;
@@ -278,11 +176,9 @@ static int ab8500_regulator_is_enabled(struct regulator_dev *rdev)
info->update_mask, regval);
if (regval & info->update_mask)
- info->is_enabled = true;
+ return true;
else
- info->is_enabled = false;
-
- return info->is_enabled;
+ return false;
}
static int ab8500_list_voltage(struct regulator_dev *rdev, unsigned selector)
@@ -356,7 +252,8 @@ static int ab8500_get_best_voltage_index(struct regulator_dev *rdev,
}
static int ab8500_regulator_set_voltage(struct regulator_dev *rdev,
- int min_uV, int max_uV, unsigned *selector)
+ int min_uV, int max_uV,
+ unsigned *selector)
{
int ret;
struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
@@ -377,13 +274,8 @@ static int ab8500_regulator_set_voltage(struct regulator_dev *rdev,
*selector = ret;
- /* vintcore register has a different layout */
- if (info->desc.id == AB8500_LDO_INTCORE)
- regval = ((u8)ret) << 3;
- else
- regval = (u8)ret;
-
/* set the registers for the request */
+ regval = (u8)ret;
ret = abx500_mask_and_set_register_interruptible(info->dev,
info->voltage_bank, info->voltage_reg,
info->voltage_mask, regval);
@@ -391,8 +283,6 @@ static int ab8500_regulator_set_voltage(struct regulator_dev *rdev,
dev_err(rdev_get_dev(rdev),
"couldn't set voltage reg for regulator\n");
- msleep(info->delay);
-
dev_vdbg(rdev_get_dev(rdev),
"%s-set_voltage (bank, reg, mask, value): 0x%x, 0x%x, 0x%x,"
" 0x%x\n",
@@ -402,146 +292,74 @@ static int ab8500_regulator_set_voltage(struct regulator_dev *rdev,
return ret;
}
-static struct regulator_ops ab8500_regulator_volt_mode_ops = {
- .enable = ab8500_regulator_enable,
- .disable = ab8500_regulator_disable,
- .is_enabled = ab8500_regulator_is_enabled,
- .get_optimum_mode = ab8500_regulator_get_optimum_mode,
- .set_mode = ab8500_regulator_set_mode,
- .get_mode = ab8500_regulator_get_mode,
- .get_voltage = ab8500_regulator_get_voltage,
- .set_voltage = ab8500_regulator_set_voltage,
- .list_voltage = ab8500_list_voltage,
-};
-
-static int ab8500_fixed_get_voltage(struct regulator_dev *rdev)
+static int ab8500_regulator_enable_time(struct regulator_dev *rdev)
{
struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
- if (info == NULL) {
- dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
- return -EINVAL;
- }
-
- return info->fixed_uV;
+ return info->delay;
}
-static struct regulator_ops ab8500_regulator_mode_ops = {
- .enable = ab8500_regulator_enable,
- .disable = ab8500_regulator_disable,
- .is_enabled = ab8500_regulator_is_enabled,
- .get_optimum_mode = ab8500_regulator_get_optimum_mode,
- .set_mode = ab8500_regulator_set_mode,
- .get_mode = ab8500_regulator_get_mode,
- .get_voltage = ab8500_fixed_get_voltage,
- .list_voltage = ab8500_list_voltage,
-};
-
-static struct regulator_ops ab8500_regulator_ops = {
- .enable = ab8500_regulator_enable,
- .disable = ab8500_regulator_disable,
- .is_enabled = ab8500_regulator_is_enabled,
- .get_voltage = ab8500_fixed_get_voltage,
- .list_voltage = ab8500_list_voltage,
-};
-
-static int ab8500_sysclkreq_enable(struct regulator_dev *rdev)
+static int ab8500_regulator_set_voltage_time_sel(struct regulator_dev *rdev,
+ unsigned int old_sel,
+ unsigned int new_sel)
{
- int ret;
struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
-
- if (info == NULL) {
- dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
- return -EINVAL;
- }
-
- ret = ab8500_gpio_config_select(info->dev, info->gpio_pin, false);
- if (ret < 0) {
- dev_err(rdev_get_dev(rdev),
- "couldn't set sysclkreq pin selection\n");
- return ret;
- }
-
- info->is_enabled = true;
-
- dev_vdbg(rdev_get_dev(rdev),
- "%s-enable (gpio_pin, gpio_select): %i, false\n",
- info->desc.name, info->gpio_pin);
-
- return ret;
-}
-
-static int ab8500_sysclkreq_disable(struct regulator_dev *rdev)
-{
int ret;
- struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
- if (info == NULL) {
- dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
- return -EINVAL;
- }
-
- ret = ab8500_gpio_config_select(info->dev, info->gpio_pin, true);
- if (ret < 0) {
- dev_err(rdev_get_dev(rdev),
- "couldn't set gpio pin selection\n");
+ /* If the regulator isn't on, it won't take time here */
+ ret = ab8500_regulator_is_enabled(rdev);
+ if (ret < 0)
return ret;
- }
-
- info->is_enabled = false;
-
- dev_vdbg(rdev_get_dev(rdev),
- "%s-disable (gpio_pin, gpio_select): %i, true\n",
- info->desc.name, info->gpio_pin);
-
- return ret;
+ if (!ret)
+ return 0;
+ return info->delay;
}
-static int ab8500_sysclkreq_is_enabled(struct regulator_dev *rdev)
+static struct regulator_ops ab8500_regulator_ops = {
+ .enable = ab8500_regulator_enable,
+ .disable = ab8500_regulator_disable,
+ .is_enabled = ab8500_regulator_is_enabled,
+ .get_voltage = ab8500_regulator_get_voltage,
+ .set_voltage = ab8500_regulator_set_voltage,
+ .list_voltage = ab8500_list_voltage,
+ .enable_time = ab8500_regulator_enable_time,
+ .set_voltage_time_sel = ab8500_regulator_set_voltage_time_sel,
+};
+
+static int ab8500_fixed_get_voltage(struct regulator_dev *rdev)
{
- int ret;
struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
- bool gpio_select;
if (info == NULL) {
dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
return -EINVAL;
}
- ret = ab8500_gpio_config_get_select(info->dev, info->gpio_pin,
- &gpio_select);
- if (ret < 0) {
- dev_err(rdev_get_dev(rdev),
- "couldn't read gpio pin selection\n");
- return ret;
- }
-
- info->is_enabled = !gpio_select;
-
- dev_vdbg(rdev_get_dev(rdev),
- "%s-is_enabled (gpio_pin, is_enabled): %i, %i\n",
- info->desc.name, info->gpio_pin, !gpio_select);
-
- return info->is_enabled;
+ return info->fixed_uV;
}
-static struct regulator_ops ab8500_sysclkreq_ops = {
- .enable = ab8500_sysclkreq_enable,
- .disable = ab8500_sysclkreq_disable,
- .is_enabled = ab8500_sysclkreq_is_enabled,
+static struct regulator_ops ab8500_regulator_fixed_ops = {
+ .enable = ab8500_regulator_enable,
+ .disable = ab8500_regulator_disable,
+ .is_enabled = ab8500_regulator_is_enabled,
.get_voltage = ab8500_fixed_get_voltage,
.list_voltage = ab8500_list_voltage,
+ .enable_time = ab8500_regulator_enable_time,
+ .set_voltage_time_sel = ab8500_regulator_set_voltage_time_sel,
};
static struct ab8500_regulator_info
ab8500_regulator_info[AB8500_NUM_REGULATORS] = {
/*
- * Regulators with variable voltage and normal/idle modes
+ * Variable Voltage Regulators
+ * name, min mV, max mV,
+ * update bank, reg, mask, enable val
+ * volt bank, reg, mask, table, table length
*/
[AB8500_LDO_AUX1] = {
.desc = {
.name = "LDO-AUX1",
- .ops = &ab8500_regulator_volt_mode_ops,
+ .ops = &ab8500_regulator_ops,
.type = REGULATOR_VOLTAGE,
.id = AB8500_LDO_AUX1,
.owner = THIS_MODULE,
@@ -549,13 +367,10 @@ static struct ab8500_regulator_info
},
.min_uV = 1100000,
.max_uV = 3300000,
- .load_lp_uA = 5000,
.update_bank = 0x04,
.update_reg = 0x09,
.update_mask = 0x03,
- .update_val = 0x01,
- .update_val_idle = 0x03,
- .update_val_normal = 0x01,
+ .update_val_enable = 0x01,
.voltage_bank = 0x04,
.voltage_reg = 0x1f,
.voltage_mask = 0x0f,
@@ -565,7 +380,7 @@ static struct ab8500_regulator_info
[AB8500_LDO_AUX2] = {
.desc = {
.name = "LDO-AUX2",
- .ops = &ab8500_regulator_volt_mode_ops,
+ .ops = &ab8500_regulator_ops,
.type = REGULATOR_VOLTAGE,
.id = AB8500_LDO_AUX2,
.owner = THIS_MODULE,
@@ -573,13 +388,10 @@ static struct ab8500_regulator_info
},
.min_uV = 1100000,
.max_uV = 3300000,
- .load_lp_uA = 5000,
.update_bank = 0x04,
.update_reg = 0x09,
.update_mask = 0x0c,
- .update_val = 0x04,
- .update_val_idle = 0x0c,
- .update_val_normal = 0x04,
+ .update_val_enable = 0x04,
.voltage_bank = 0x04,
.voltage_reg = 0x20,
.voltage_mask = 0x0f,
@@ -589,7 +401,7 @@ static struct ab8500_regulator_info
[AB8500_LDO_AUX3] = {
.desc = {
.name = "LDO-AUX3",
- .ops = &ab8500_regulator_volt_mode_ops,
+ .ops = &ab8500_regulator_ops,
.type = REGULATOR_VOLTAGE,
.id = AB8500_LDO_AUX3,
.owner = THIS_MODULE,
@@ -597,13 +409,10 @@ static struct ab8500_regulator_info
},
.min_uV = 1100000,
.max_uV = 3300000,
- .load_lp_uA = 5000,
.update_bank = 0x04,
.update_reg = 0x0a,
.update_mask = 0x03,
- .update_val = 0x01,
- .update_val_idle = 0x03,
- .update_val_normal = 0x01,
+ .update_val_enable = 0x01,
.voltage_bank = 0x04,
.voltage_reg = 0x21,
.voltage_mask = 0x07,
@@ -613,7 +422,7 @@ static struct ab8500_regulator_info
[AB8500_LDO_INTCORE] = {
.desc = {
.name = "LDO-INTCORE",
- .ops = &ab8500_regulator_volt_mode_ops,
+ .ops = &ab8500_regulator_ops,
.type = REGULATOR_VOLTAGE,
.id = AB8500_LDO_INTCORE,
.owner = THIS_MODULE,
@@ -621,13 +430,10 @@ static struct ab8500_regulator_info
},
.min_uV = 1100000,
.max_uV = 3300000,
- .load_lp_uA = 5000,
.update_bank = 0x03,
.update_reg = 0x80,
.update_mask = 0x44,
- .update_val = 0x44,
- .update_val_idle = 0x44,
- .update_val_normal = 0x04,
+ .update_val_enable = 0x04,
.voltage_bank = 0x03,
.voltage_reg = 0x80,
.voltage_mask = 0x38,
@@ -636,35 +442,45 @@ static struct ab8500_regulator_info
},
/*
- * Regulators with fixed voltage and normal/idle modes
+ * Fixed Voltage Regulators
+ * name, fixed mV,
+ * update bank, reg, mask, enable val
*/
[AB8500_LDO_TVOUT] = {
.desc = {
.name = "LDO-TVOUT",
- .ops = &ab8500_regulator_mode_ops,
+ .ops = &ab8500_regulator_fixed_ops,
.type = REGULATOR_VOLTAGE,
.id = AB8500_LDO_TVOUT,
.owner = THIS_MODULE,
.n_voltages = 1,
},
- .delay = 10,
+ .delay = 10000,
.fixed_uV = 2000000,
- .load_lp_uA = 1000,
.update_bank = 0x03,
.update_reg = 0x80,
.update_mask = 0x82,
- .update_val = 0x02,
- .update_val_idle = 0x82,
- .update_val_normal = 0x02,
+ .update_val_enable = 0x02,
+ },
+ [AB8500_LDO_USB] = {
+ .desc = {
+ .name = "LDO-USB",
+ .ops = &ab8500_regulator_fixed_ops,
+ .type = REGULATOR_VOLTAGE,
+ .id = AB8500_LDO_USB,
+ .owner = THIS_MODULE,
+ .n_voltages = 1,
+ },
+ .fixed_uV = 3300000,
+ .update_bank = 0x03,
+ .update_reg = 0x82,
+ .update_mask = 0x03,
+ .update_val_enable = 0x01,
},
-
- /*
- * Regulators with fixed voltage and normal mode
- */
[AB8500_LDO_AUDIO] = {
.desc = {
.name = "LDO-AUDIO",
- .ops = &ab8500_regulator_ops,
+ .ops = &ab8500_regulator_fixed_ops,
.type = REGULATOR_VOLTAGE,
.id = AB8500_LDO_AUDIO,
.owner = THIS_MODULE,
@@ -674,12 +490,12 @@ static struct ab8500_regulator_info
.update_bank = 0x03,
.update_reg = 0x83,
.update_mask = 0x02,
- .update_val = 0x02,
+ .update_val_enable = 0x02,
},
[AB8500_LDO_ANAMIC1] = {
.desc = {
.name = "LDO-ANAMIC1",
- .ops = &ab8500_regulator_ops,
+ .ops = &ab8500_regulator_fixed_ops,
.type = REGULATOR_VOLTAGE,
.id = AB8500_LDO_ANAMIC1,
.owner = THIS_MODULE,
@@ -689,12 +505,12 @@ static struct ab8500_regulator_info
.update_bank = 0x03,
.update_reg = 0x83,
.update_mask = 0x08,
- .update_val = 0x08,
+ .update_val_enable = 0x08,
},
[AB8500_LDO_ANAMIC2] = {
.desc = {
.name = "LDO-ANAMIC2",
- .ops = &ab8500_regulator_ops,
+ .ops = &ab8500_regulator_fixed_ops,
.type = REGULATOR_VOLTAGE,
.id = AB8500_LDO_ANAMIC2,
.owner = THIS_MODULE,
@@ -704,12 +520,12 @@ static struct ab8500_regulator_info
.update_bank = 0x03,
.update_reg = 0x83,
.update_mask = 0x10,
- .update_val = 0x10,
+ .update_val_enable = 0x10,
},
[AB8500_LDO_DMIC] = {
.desc = {
.name = "LDO-DMIC",
- .ops = &ab8500_regulator_ops,
+ .ops = &ab8500_regulator_fixed_ops,
.type = REGULATOR_VOLTAGE,
.id = AB8500_LDO_DMIC,
.owner = THIS_MODULE,
@@ -719,58 +535,25 @@ static struct ab8500_regulator_info
.update_bank = 0x03,
.update_reg = 0x83,
.update_mask = 0x04,
- .update_val = 0x04,
+ .update_val_enable = 0x04,
},
-
- /*
- * Regulators with fixed voltage and normal/idle modes
- */
[AB8500_LDO_ANA] = {
.desc = {
.name = "LDO-ANA",
- .ops = &ab8500_regulator_mode_ops,
+ .ops = &ab8500_regulator_fixed_ops,
.type = REGULATOR_VOLTAGE,
.id = AB8500_LDO_ANA,
.owner = THIS_MODULE,
.n_voltages = 1,
},
.fixed_uV = 1200000,
- .load_lp_uA = 1000,
.update_bank = 0x04,
.update_reg = 0x06,
.update_mask = 0x0c,
- .update_val = 0x04,
- .update_val_idle = 0x0c,
- .update_val_normal = 0x04,
+ .update_val_enable = 0x04,
},
- /*
- * SysClkReq regulators
- */
- [AB8500_SYSCLKREQ_2] = {
- .desc = {
- .name = "SYSCLKREQ-2",
- .ops = &ab8500_sysclkreq_ops,
- .type = REGULATOR_VOLTAGE,
- .id = AB8500_SYSCLKREQ_2,
- .owner = THIS_MODULE,
- .n_voltages = 1,
- },
- .fixed_uV = 1, /* bogus value */
- .gpio_pin = 0, /* AB8500_PIN_GPIO1 */
- },
- [AB8500_SYSCLKREQ_4] = {
- .desc = {
- .name = "SYSCLKREQ-4",
- .ops = &ab8500_sysclkreq_ops,
- .type = REGULATOR_VOLTAGE,
- .id = AB8500_SYSCLKREQ_4,
- .owner = THIS_MODULE,
- .n_voltages = 1,
- },
- .fixed_uV = 1, /* bogus value */
- .gpio_pin = 2, /* AB8500_PIN_GPIO3 */
- },
+
};
struct ab8500_reg_init {
@@ -788,19 +571,11 @@ struct ab8500_reg_init {
static struct ab8500_reg_init ab8500_reg_init[] = {
/*
- * 0x03, VarmRequestCtrl
- * 0x0c, VapeRequestCtrl
- * 0x30, Vsmps1RequestCtrl
- * 0xc0, Vsmps2RequestCtrl
- */
- REG_INIT(AB8500_REGUREQUESTCTRL1, 0x03, 0x03, 0xff),
- /*
- * 0x03, Vsmps3RequestCtrl
- * 0x0c, VpllRequestCtrl
* 0x30, VanaRequestCtrl
+ * 0x0C, VpllRequestCtrl
* 0xc0, VextSupply1RequestCtrl
*/
- REG_INIT(AB8500_REGUREQUESTCTRL2, 0x03, 0x04, 0xff),
+ REG_INIT(AB8500_REGUREQUESTCTRL2, 0x03, 0x04, 0xfc),
/*
* 0x03, VextSupply2RequestCtrl
* 0x0c, VextSupply3RequestCtrl
@@ -814,82 +589,57 @@ static struct ab8500_reg_init ab8500_reg_init[] = {
*/
REG_INIT(AB8500_REGUREQUESTCTRL4, 0x03, 0x06, 0x07),
/*
- * 0x01, Vsmps1SysClkReq1HPValid
- * 0x02, Vsmps2SysClkReq1HPValid
- * 0x04, Vsmps3SysClkReq1HPValid
* 0x08, VanaSysClkReq1HPValid
- * 0x10, VpllSysClkReq1HPValid
* 0x20, Vaux1SysClkReq1HPValid
* 0x40, Vaux2SysClkReq1HPValid
* 0x80, Vaux3SysClkReq1HPValid
*/
- REG_INIT(AB8500_REGUSYSCLKREQ1HPVALID1, 0x03, 0x07, 0xff),
+ REG_INIT(AB8500_REGUSYSCLKREQ1HPVALID1, 0x03, 0x07, 0xe8),
/*
- * 0x01, VapeSysClkReq1HPValid
- * 0x02, VarmSysClkReq1HPValid
- * 0x04, VbbSysClkReq1HPValid
- * 0x08, VmodSysClkReq1HPValid
* 0x10, VextSupply1SysClkReq1HPValid
* 0x20, VextSupply2SysClkReq1HPValid
* 0x40, VextSupply3SysClkReq1HPValid
*/
- REG_INIT(AB8500_REGUSYSCLKREQ1HPVALID2, 0x03, 0x08, 0x7f),
+ REG_INIT(AB8500_REGUSYSCLKREQ1HPVALID2, 0x03, 0x08, 0x70),
/*
- * 0x01, Vsmps1HwHPReq1Valid
- * 0x02, Vsmps2HwHPReq1Valid
- * 0x04, Vsmps3HwHPReq1Valid
* 0x08, VanaHwHPReq1Valid
- * 0x10, VpllHwHPReq1Valid
* 0x20, Vaux1HwHPReq1Valid
* 0x40, Vaux2HwHPReq1Valid
* 0x80, Vaux3HwHPReq1Valid
*/
- REG_INIT(AB8500_REGUHWHPREQ1VALID1, 0x03, 0x09, 0xff),
+ REG_INIT(AB8500_REGUHWHPREQ1VALID1, 0x03, 0x09, 0xe8),
/*
* 0x01, VextSupply1HwHPReq1Valid
* 0x02, VextSupply2HwHPReq1Valid
* 0x04, VextSupply3HwHPReq1Valid
- * 0x08, VmodHwHPReq1Valid
*/
- REG_INIT(AB8500_REGUHWHPREQ1VALID2, 0x03, 0x0a, 0x0f),
+ REG_INIT(AB8500_REGUHWHPREQ1VALID2, 0x03, 0x0a, 0x07),
/*
- * 0x01, Vsmps1HwHPReq2Valid
- * 0x02, Vsmps2HwHPReq2Valid
- * 0x03, Vsmps3HwHPReq2Valid
* 0x08, VanaHwHPReq2Valid
- * 0x10, VpllHwHPReq2Valid
* 0x20, Vaux1HwHPReq2Valid
* 0x40, Vaux2HwHPReq2Valid
* 0x80, Vaux3HwHPReq2Valid
*/
- REG_INIT(AB8500_REGUHWHPREQ2VALID1, 0x03, 0x0b, 0xff),
+ REG_INIT(AB8500_REGUHWHPREQ2VALID1, 0x03, 0x0b, 0xe8),
/*
* 0x01, VextSupply1HwHPReq2Valid
* 0x02, VextSupply2HwHPReq2Valid
* 0x04, VextSupply3HwHPReq2Valid
- * 0x08, VmodHwHPReq2Valid
*/
- REG_INIT(AB8500_REGUHWHPREQ2VALID2, 0x03, 0x0c, 0x0f),
+ REG_INIT(AB8500_REGUHWHPREQ2VALID2, 0x03, 0x0c, 0x07),
/*
- * 0x01, VapeSwHPReqValid
- * 0x02, VarmSwHPReqValid
- * 0x04, Vsmps1SwHPReqValid
- * 0x08, Vsmps2SwHPReqValid
- * 0x10, Vsmps3SwHPReqValid
* 0x20, VanaSwHPReqValid
- * 0x40, VpllSwHPReqValid
* 0x80, Vaux1SwHPReqValid
*/
- REG_INIT(AB8500_REGUSWHPREQVALID1, 0x03, 0x0d, 0xff),
+ REG_INIT(AB8500_REGUSWHPREQVALID1, 0x03, 0x0d, 0xa0),
/*
* 0x01, Vaux2SwHPReqValid
* 0x02, Vaux3SwHPReqValid
* 0x04, VextSupply1SwHPReqValid
* 0x08, VextSupply2SwHPReqValid
* 0x10, VextSupply3SwHPReqValid
- * 0x20, VmodSwHPReqValid
*/
- REG_INIT(AB8500_REGUSWHPREQVALID2, 0x03, 0x0e, 0x3f),
+ REG_INIT(AB8500_REGUSWHPREQVALID2, 0x03, 0x0e, 0x1f),
/*
* 0x02, SysClkReq2Valid1
* ...
@@ -923,28 +673,8 @@ static struct ab8500_reg_init ab8500_reg_init[] = {
*/
REG_INIT(AB8500_REGUCTRL1VAMIC, 0x03, 0x84, 0x03),
/*
- * 0x03, Vsmps1Regu
- * 0x0c, Vsmps1SelCtrl
- * 0x10, Vsmps1AutoMode
- * 0x20, Vsmps1PWMMode
- */
- REG_INIT(AB8500_VSMPS1REGU, 0x04, 0x03, 0x3f),
- /*
- * 0x03, Vsmps2Regu
- * 0x0c, Vsmps2SelCtrl
- * 0x10, Vsmps2AutoMode
- * 0x20, Vsmps2PWMMode
- */
- REG_INIT(AB8500_VSMPS2REGU, 0x04, 0x04, 0x3f),
- /*
- * 0x03, Vsmps3Regu
- * 0x0c, Vsmps3SelCtrl
- * NOTE! PRCMU register
- */
- REG_INIT(AB8500_VSMPS3REGU, 0x04, 0x05, 0x0f),
- /*
- * 0x03, VpllRegu
* 0x0c, VanaRegu
+ * 0x03, VpllRegu
*/
REG_INIT(AB8500_VPLLVANAREGU, 0x04, 0x06, 0x0f),
/*
@@ -966,45 +696,14 @@ static struct ab8500_reg_init ab8500_reg_init[] = {
*/
REG_INIT(AB8500_VAUX12REGU, 0x04, 0x09, 0x0f),
/*
- * 0x0c, Vrf1Regu
* 0x03, Vaux3Regu
*/
- REG_INIT(AB8500_VRF1VAUX3REGU, 0x04, 0x0a, 0x0f),
+ REG_INIT(AB8500_VRF1VAUX3REGU, 0x04, 0x0a, 0x03),
/*
* 0x3f, Vsmps1Sel1
*/
REG_INIT(AB8500_VSMPS1SEL1, 0x04, 0x13, 0x3f),
/*
- * 0x3f, Vsmps1Sel2
- */
- REG_INIT(AB8500_VSMPS1SEL2, 0x04, 0x14, 0x3f),
- /*
- * 0x3f, Vsmps1Sel3
- */
- REG_INIT(AB8500_VSMPS1SEL3, 0x04, 0x15, 0x3f),
- /*
- * 0x3f, Vsmps2Sel1
- */
- REG_INIT(AB8500_VSMPS2SEL1, 0x04, 0x17, 0x3f),
- /*
- * 0x3f, Vsmps2Sel2
- */
- REG_INIT(AB8500_VSMPS2SEL2, 0x04, 0x18, 0x3f),
- /*
- * 0x3f, Vsmps2Sel3
- */
- REG_INIT(AB8500_VSMPS2SEL3, 0x04, 0x19, 0x3f),
- /*
- * 0x7f, Vsmps3Sel1
- * NOTE! PRCMU register
- */
- REG_INIT(AB8500_VSMPS3SEL1, 0x04, 0x1b, 0x7f),
- /*
- * 0x7f, Vsmps3Sel2
- * NOTE! PRCMU register
- */
- REG_INIT(AB8500_VSMPS3SEL2, 0x04, 0x1c, 0x7f),
- /*
* 0x0f, Vaux1Sel
*/
REG_INIT(AB8500_VAUX1SEL, 0x04, 0x1f, 0x0f),
@@ -1014,16 +713,13 @@ static struct ab8500_reg_init ab8500_reg_init[] = {
REG_INIT(AB8500_VAUX2SEL, 0x04, 0x20, 0x0f),
/*
* 0x07, Vaux3Sel
- * 0x30, Vrf1Sel
*/
- REG_INIT(AB8500_VRF1VAUX3SEL, 0x04, 0x21, 0x37),
+ REG_INIT(AB8500_VRF1VAUX3SEL, 0x04, 0x21, 0x07),
/*
* 0x01, VextSupply12LP
*/
REG_INIT(AB8500_REGUCTRL2SPARE, 0x04, 0x22, 0x01),
/*
- * 0x01, VpllDisch
- * 0x02, Vrf1Disch
* 0x04, Vaux1Disch
* 0x08, Vaux2Disch
* 0x10, Vaux3Disch
@@ -1031,15 +727,13 @@ static struct ab8500_reg_init ab8500_reg_init[] = {
* 0x40, VTVoutDisch
* 0x80, VaudioDisch
*/
- REG_INIT(AB8500_REGUCTRLDISCH, 0x04, 0x43, 0xff),
+ REG_INIT(AB8500_REGUCTRLDISCH, 0x04, 0x43, 0xfc),
/*
- * 0x01, VsimDisch
* 0x02, VanaDisch
* 0x04, VdmicPullDownEna
- * 0x08, VpllPullDownEna
* 0x10, VdmicDisch
*/
- REG_INIT(AB8500_REGUCTRLDISCH2, 0x04, 0x44, 0x1f),
+ REG_INIT(AB8500_REGUCTRLDISCH2, 0x04, 0x44, 0x16),
};
static __devinit int ab8500_regulator_probe(struct platform_device *pdev)
@@ -1067,22 +761,29 @@ static __devinit int ab8500_regulator_probe(struct platform_device *pdev)
/* initialize registers */
for (i = 0; i < pdata->num_regulator_reg_init; i++) {
int id;
- u8 mask, value;
+ u8 value;
id = pdata->regulator_reg_init[i].id;
- mask = pdata->regulator_reg_init[i].mask;
value = pdata->regulator_reg_init[i].value;
/* check for configuration errors */
- BUG_ON(id >= AB8500_NUM_REGULATOR_REGISTERS);
- BUG_ON(value & ~mask);
- BUG_ON(mask & ~ab8500_reg_init[id].mask);
+ if (id >= AB8500_NUM_REGULATOR_REGISTERS) {
+ dev_err(&pdev->dev,
+ "Configuration error: id outside range.\n");
+ return -EINVAL;
+ }
+ if (value & ~ab8500_reg_init[id].mask) {
+ dev_err(&pdev->dev,
+ "Configuration error: value outside mask.\n");
+ return -EINVAL;
+ }
/* initialize register */
err = abx500_mask_and_set_register_interruptible(&pdev->dev,
ab8500_reg_init[id].bank,
ab8500_reg_init[id].addr,
- mask, value);
+ ab8500_reg_init[id].mask,
+ value);
if (err < 0) {
dev_err(&pdev->dev,
"Failed to initialize 0x%02x, 0x%02x.\n",
@@ -1094,25 +795,8 @@ static __devinit int ab8500_regulator_probe(struct platform_device *pdev)
" init: 0x%02x, 0x%02x, 0x%02x, 0x%02x\n",
ab8500_reg_init[id].bank,
ab8500_reg_init[id].addr,
- mask, value);
- }
-
- /*
- * Remove below when ab8500v2.0 is no longer important.
- * Below only affects power consumption and is depending on the
- * HREF OTP configuration.
- * It changes the default setting for VextSupply3Regu to Low Power.
- * Active high or low is depending on OTP which is changed from ab8500v3.0.
- */
- if (abx500_get_chip_id(&pdev->dev) < 0x30) {
- err = abx500_mask_and_set_register_interruptible(&pdev->dev,
- AB8500_REGU_CTRL2, 0x08, 0x30, 0x30);
- if (err < 0) {
- dev_err(&pdev->dev,
- "Failed to override 0x%02x, 0x%02x.\n",
- AB8500_REGU_CTRL2, 0x08);
- return err;
- }
+ ab8500_reg_init[id].mask,
+ value);
}
/* register all regulators */
diff --git a/drivers/regulator/db8500-prcmu.c b/drivers/regulator/db8500-prcmu.c
index caca20b141f..a6156496fde 100644
--- a/drivers/regulator/db8500-prcmu.c
+++ b/drivers/regulator/db8500-prcmu.c
@@ -13,11 +13,11 @@
#include <linux/err.h>
#include <linux/spinlock.h>
#include <linux/platform_device.h>
+#include <linux/mfd/dbx500-prcmu.h>
#include <linux/regulator/driver.h>
#include <linux/regulator/machine.h>
#include <linux/regulator/db8500-prcmu.h>
-#include <linux/mfd/dbx500-prcmu.h>
-
+#include "dbx500-prcmu.h"
/**
* struct db8500_regulator_info - db8500 regulator information
diff --git a/drivers/regulator/dbx500-prcmu.c b/drivers/regulator/dbx500-prcmu.c
index 1ee6f6a7c4a..409cb8574fe 100644
--- a/drivers/regulator/dbx500-prcmu.c
+++ b/drivers/regulator/dbx500-prcmu.c
@@ -5,13 +5,13 @@
* Authors: Sundar Iyer <sundar.iyer@stericsson.com> for ST-Ericsson
* Bengt Jonsson <bengt.g.jonsson@stericsson.com> for ST-Ericsson
*
- * UX500 common part of Power domain regulators (atomic regulators)
+ * UX500 common part of Power domain regulators
*/
#include <linux/kernel.h>
#include <linux/err.h>
#include <linux/regulator/driver.h>
-#include <linux/regulator/dbx500-prcmu.h>
+#include "dbx500-prcmu.h"
/*
* power state reference count
@@ -27,7 +27,6 @@ void power_state_active_enable(void)
power_state_active_cnt++;
spin_unlock_irqrestore(&power_state_active_lock, flags);
}
-EXPORT_SYMBOL_GPL(power_state_active_enable);
int power_state_active_disable(void)
{
@@ -46,7 +45,6 @@ out:
spin_unlock_irqrestore(&power_state_active_lock, flags);
return ret;
}
-EXPORT_SYMBOL_GPL(power_state_active_disable);
/*
* Exported interface for CPUIdle only. This function is called when interrupts
@@ -56,100 +54,9 @@ int power_state_active_is_enabled(void)
{
return (power_state_active_cnt > 0);
}
-EXPORT_SYMBOL_GPL(power_state_active_is_enabled);
struct ux500_regulator {
char *name;
void (*enable)(void);
int (*disable)(void);
};
-
-/*
- * Don't add any clients to this struct without checking with regulator
- * responsible!
- */
-static struct ux500_regulator ux500_atomic_regulators[] = {
- {
- .name = "dma40.0",
- .enable = power_state_active_enable,
- .disable = power_state_active_disable,
- },
- {
- .name = "ssp0",
- .enable = power_state_active_enable,
- .disable = power_state_active_disable,
- },
- {
- .name = "ssp1",
- .enable = power_state_active_enable,
- .disable = power_state_active_disable,
- },
- {
- .name = "spi0",
- .enable = power_state_active_enable,
- .disable = power_state_active_disable,
- },
- {
- .name = "spi1",
- .enable = power_state_active_enable,
- .disable = power_state_active_disable,
- },
- {
- .name = "spi2",
- .enable = power_state_active_enable,
- .disable = power_state_active_disable,
- },
- {
- .name = "spi3",
- .enable = power_state_active_enable,
- .disable = power_state_active_disable,
- },
- {
- .name = "cryp1",
- .enable = power_state_active_enable,
- .disable = power_state_active_disable,
- },
- {
- .name = "hash1",
- .enable = power_state_active_enable,
- .disable = power_state_active_disable,
- },
-};
-
-struct ux500_regulator *__must_check ux500_regulator_get(struct device *dev)
-{
- int i;
-
- for (i = 0; i < ARRAY_SIZE(ux500_atomic_regulators); i++) {
- if (!strcmp(dev_name(dev), ux500_atomic_regulators[i].name))
- return &ux500_atomic_regulators[i];
- }
-
- return ERR_PTR(-EINVAL);
-}
-EXPORT_SYMBOL_GPL(ux500_regulator_get);
-
-int ux500_regulator_atomic_enable(struct ux500_regulator *regulator)
-{
- if (regulator) {
- regulator->enable();
- return 0;
- }
- return -EINVAL;
-}
-EXPORT_SYMBOL_GPL(ux500_regulator_atomic_enable);
-
-int ux500_regulator_atomic_disable(struct ux500_regulator *regulator)
-{
- if (regulator)
- return regulator->disable();
- else
- return -EINVAL;
-}
-EXPORT_SYMBOL_GPL(ux500_regulator_atomic_disable);
-
-void ux500_regulator_put(struct ux500_regulator *regulator)
-{
- /* Here for symetric reasons and for possible future use */
-}
-EXPORT_SYMBOL_GPL(ux500_regulator_put);
diff --git a/drivers/regulator/dbx500-prcmu.h b/drivers/regulator/dbx500-prcmu.h
new file mode 100644
index 00000000000..bc6191943b1
--- /dev/null
+++ b/drivers/regulator/dbx500-prcmu.h
@@ -0,0 +1,17 @@
+/*
+ * Copyright (C) ST-Ericsson SA 2010
+ *
+ * Author: Bengt Jonsson <bengt.jonsson@stericsson.com> for ST-Ericsson,
+ * Jonas Aaberg <jonas.aberg@stericsson.com> for ST-Ericsson
+ *
+ * License Terms: GNU General Public License v2
+ *
+ */
+
+#ifndef DBX500_REGULATOR_H
+#define DBX500_REGULATOR_H
+
+void power_state_active_enable(void);
+int power_state_active_disable(void);
+
+#endif
diff --git a/include/linux/regulator/ab8500-debug.h b/include/linux/regulator/ab8500-debug.h
deleted file mode 100644
index 01655fc7fc1..00000000000
--- a/include/linux/regulator/ab8500-debug.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright (C) ST-Ericsson SA 2010
- *
- * License Terms: GNU General Public License v2
- *
- * Authors: Bengt Jonsson <bengt.g.jonsson@stericsson.com> for ST-Ericsson
- */
-
-#ifndef __LINUX_MFD_AB8500_REGULATOR_DEBUG_H
-#define __LINUX_MFD_AB8500_REGULATOR_DEBUG_H
-
-#ifdef CONFIG_REGULATOR_AB8500_DEBUG
-/* AB8500 debug force/restore functions */
-void ab8500_regulator_debug_force(void);
-void ab8500_regulator_debug_restore(void);
-#else
-static inline void ab8500_regulator_debug_force(void) {}
-static inline void ab8500_regulator_debug_restore(void) {}
-#endif
-
-#endif
diff --git a/include/linux/regulator/ab8500.h b/include/linux/regulator/ab8500.h
index 09ddc33ae61..76579f964a2 100644
--- a/include/linux/regulator/ab8500.h
+++ b/include/linux/regulator/ab8500.h
@@ -17,33 +17,29 @@ enum ab8500_regulator_id {
AB8500_LDO_AUX3,
AB8500_LDO_INTCORE,
AB8500_LDO_TVOUT,
+ AB8500_LDO_USB,
AB8500_LDO_AUDIO,
AB8500_LDO_ANAMIC1,
AB8500_LDO_ANAMIC2,
AB8500_LDO_DMIC,
AB8500_LDO_ANA,
- AB8500_SYSCLKREQ_2,
- AB8500_SYSCLKREQ_4,
AB8500_NUM_REGULATORS,
};
/* AB8500 register initialization */
struct ab8500_regulator_reg_init {
int id;
- u8 mask;
u8 value;
};
-#define INIT_REGULATOR_REGISTER(_id, _mask, _value) \
- { \
- .id = _id, \
- .mask = _mask, \
- .value = _value, \
+#define INIT_REGULATOR_REGISTER(_id, _value) \
+ { \
+ .id = _id, \
+ .value = _value, \
}
/* AB8500 registers */
enum ab8500_regulator_reg {
- AB8500_REGUREQUESTCTRL1,
AB8500_REGUREQUESTCTRL2,
AB8500_REGUREQUESTCTRL3,
AB8500_REGUREQUESTCTRL4,
@@ -60,28 +56,18 @@ enum ab8500_regulator_reg {
AB8500_REGUMISC1,
AB8500_VAUDIOSUPPLY,
AB8500_REGUCTRL1VAMIC,
- AB8500_VSMPS1REGU,
- AB8500_VSMPS2REGU,
- AB8500_VSMPS3REGU, /* NOTE! PRCMU register */
AB8500_VPLLVANAREGU,
AB8500_VREFDDR,
AB8500_EXTSUPPLYREGU,
AB8500_VAUX12REGU,
AB8500_VRF1VAUX3REGU,
- AB8500_VSMPS1SEL1,
- AB8500_VSMPS1SEL2,
- AB8500_VSMPS1SEL3,
- AB8500_VSMPS2SEL1,
- AB8500_VSMPS2SEL2,
- AB8500_VSMPS2SEL3,
- AB8500_VSMPS3SEL1, /* NOTE! PRCMU register */
- AB8500_VSMPS3SEL2, /* NOTE! PRCMU register */
AB8500_VAUX1SEL,
AB8500_VAUX2SEL,
AB8500_VRF1VAUX3SEL,
AB8500_REGUCTRL2SPARE,
AB8500_REGUCTRLDISCH,
AB8500_REGUCTRLDISCH2,
+ AB8500_VSMPS1SEL1,
AB8500_NUM_REGULATOR_REGISTERS,
};
diff --git a/include/linux/regulator/db8500-prcmu.h b/include/linux/regulator/db8500-prcmu.h
index a3138ea2177..612062313b6 100644
--- a/include/linux/regulator/db8500-prcmu.h
+++ b/include/linux/regulator/db8500-prcmu.h
@@ -11,8 +11,6 @@
#ifndef __REGULATOR_H__
#define __REGULATOR_H__
-#include <linux/regulator/dbx500-prcmu.h>
-
/* Number of DB8500 regulators and regulator enumeration */
enum db8500_regulator_id {
DB8500_REGULATOR_VAPE,
@@ -38,4 +36,10 @@ enum db8500_regulator_id {
DB8500_NUM_REGULATORS
};
+/*
+ * Exported interface for CPUIdle only. This function is called with all
+ * interrupts turned off.
+ */
+int power_state_active_is_enabled(void);
+
#endif
diff --git a/include/linux/regulator/dbx500-prcmu.h b/include/linux/regulator/dbx500-prcmu.h
deleted file mode 100644
index a18cf6c4107..00000000000
--- a/include/linux/regulator/dbx500-prcmu.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (C) ST-Ericsson SA 2010
- *
- * Author: Bengt Jonsson <bengt.jonsson@stericsson.com> for ST-Ericsson,
- * Jonas Aaberg <jonas.aberg@stericsson.com> for ST-Ericsson
- *
- * License Terms: GNU General Public License v2
- *
- */
-
-#ifndef DBX500_REGULATOR_H
-#define DBX500_REGULATOR_H
-
-#include <linux/device.h>
-
-struct ux500_regulator;
-
-#ifdef CONFIG_REGULATOR
-/*
- * NOTE! The device will be connected to the correct regulator by this
- * new framework. A list with connections will match up dev_name(dev)
- * to the specific regulator. This follows the same principle as the
- * normal regulator framework.
- *
- * This framework shall only be used in special cases when a regulator
- * has to be enabled/disabled in atomic context.
- */
-
-void power_state_active_enable(void);
-int power_state_active_disable(void);
-/*
- * Exported interface for CPUIdle only. This function is called with all
- * interrupts turned off.
- */
-int power_state_active_is_enabled(void);
-
-/**
- * ux500_regulator_get()
- *
- * @dev: Drivers device struct
- *
- * Returns a ux500_regulator struct. Shall be used as argument for
- * ux500_regulator_atomic_enable/disable calls.
- * Return ERR_PTR(-EINVAL) upon no matching regulator found.
- */
-struct ux500_regulator *__must_check ux500_regulator_get(struct device *dev);
-
-/**
- * ux500_regulator_atomic_enable()
- *
- * @regulator: Regulator handle, provided from ux500_regulator_get.
- *
- * The enable/disable functions keep an internal counter, so every
- * enable must be paired with an disable in order to turn off regulator.
- */
-int ux500_regulator_atomic_enable(struct ux500_regulator *regulator);
-
-/**
- * ux500_regulator_atomic_disable()
- *
- * @regulator: Regulator handle, provided from ux500_regulator_get.
- *
- */
-int ux500_regulator_atomic_disable(struct ux500_regulator *regulator);
-
-/**
- * ux500_regulator_put()
- *
- * @regulator: Regulator handle, provided from ux500_regulator_get.
- */
-void ux500_regulator_put(struct ux500_regulator *regulator);
-#else
-static inline struct ux500_regulator *__must_check
-ux500_regulator_get(struct device *dev)
-{
- return ERR_PTR(-EINVAL);
-}
-
-static inline int
-ux500_regulator_atomic_enable(struct ux500_regulator *regulator)
-{
- return -EINVAL;
-}
-
-static inline int
-ux500_regulator_atomic_disable(struct ux500_regulator *regulator)
-{
- return -EINVAL;
-}
-
-static inline void ux500_regulator_put(struct ux500_regulator *regulator)
-{
-}
-#endif
-
-#endif