diff options
author | Philippe Langlais <philippe.langlais@linaro.org> | 2011-05-11 15:51:36 +0200 |
---|---|---|
committer | Henrik Aberg <henrik.aberg@stericsson.com> | 2011-05-18 09:40:16 +0200 |
commit | c9581376500c8f40b3cf4db4a653bef72129b8bb (patch) | |
tree | 52fe72db2c9423729e92614b37e2337b2ff5e9c4 | |
parent | 62d1369a3c43515962dfb330225ea05ea7c85554 (diff) |
ux500: move u8500 regulators to a separate file
Separate the regulator list from the implementation of the power state and
switch regulators so that the implementation can be reused for 5500.
ST-Ericsson Linux next: -
ST-Ericsson ID: WP257121
ST-Ericsson FOSS-OUT ID: Trivial
Change-Id: I47db5359f48a7d61c1b2ce62497b86bf6427aa0d
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/22310
Reviewed-by: QATEST
Tested-by: Rabin VINCENT <rabin.vincent@stericsson.com>
Reviewed-by: Bengt JONSSON <bengt.g.jonsson@stericsson.com>
Conflicts:
arch/arm/mach-ux500/include/mach/prcmu-fw-api.h
arch/arm/mach-ux500/regulator-ux500.c
-rw-r--r-- | arch/arm/mach-ux500/Makefile | 5 | ||||
-rw-r--r-- | arch/arm/mach-ux500/include/mach/prcmu-fw-api.h | 5 | ||||
-rw-r--r-- | arch/arm/mach-ux500/regulator-db8500.c | 274 | ||||
-rw-r--r-- | arch/arm/mach-ux500/regulator-ux500.c | 343 | ||||
-rw-r--r-- | arch/arm/mach-ux500/regulator-ux500.h | 39 |
5 files changed, 365 insertions, 301 deletions
diff --git a/arch/arm/mach-ux500/Makefile b/arch/arm/mach-ux500/Makefile index 7482e581e40..109a6fd8b28 100644 --- a/arch/arm/mach-ux500/Makefile +++ b/arch/arm/mach-ux500/Makefile @@ -32,6 +32,11 @@ obj-$(CONFIG_TEE_SVP) += tee_ta_start_modem_svp.o obj-$(CONFIG_DB8500_MLOADER) += mloader-db8500.o obj-$(CONFIG_UX500_PRCMU_TIMER) += timer-prcmu.o obj-$(CONFIG_REGULATOR) += regulator-ux500.o + +ifeq ($(CONFIG_UX500_SOC_DB8500), y) +obj-$(CONFIG_REGULATOR) += regulator-db8500.o +endif + obj-$(CONFIG_U8500_REGULATOR_DEBUG) += virt-regulator-u8500.o obj-$(CONFIG_UX500_PRCMU_DEBUG) += prcmu-debug.o obj-$(CONFIG_UX500_PRCMU_QOS_POWER) += prcmu-qos-power.o diff --git a/arch/arm/mach-ux500/include/mach/prcmu-fw-api.h b/arch/arm/mach-ux500/include/mach/prcmu-fw-api.h index a20db3f25e8..e694234e411 100644 --- a/arch/arm/mach-ux500/include/mach/prcmu-fw-api.h +++ b/arch/arm/mach-ux500/include/mach/prcmu-fw-api.h @@ -451,6 +451,11 @@ static inline bool prcmu_is_ac_wake_requested(void) return false; } +static inline int prcmu_set_epod(u16 epod_id, u8 epod_state) +{ + return 0; +} + #ifndef CONFIG_UX500_SOC_DB5500 static inline int prcmu_set_display_clocks(void) { diff --git a/arch/arm/mach-ux500/regulator-db8500.c b/arch/arm/mach-ux500/regulator-db8500.c new file mode 100644 index 00000000000..f08093687d8 --- /dev/null +++ b/arch/arm/mach-ux500/regulator-db8500.c @@ -0,0 +1,274 @@ +/* + * 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 <mach/prcmu-fw-api.h> + +#include "regulator-ux500.h" +#include "regulator-db8500.h" + +static struct u8500_regulator_info + db8500_regulator_info[DB8500_NUM_REGULATORS] = { + [DB8500_REGULATOR_VAPE] = { + .desc = { + .name = "db8500-vape", + .id = DB8500_REGULATOR_VAPE, + .ops = &ux500_regulator_ops, + .type = REGULATOR_VOLTAGE, + .owner = THIS_MODULE, + }, + }, + [DB8500_REGULATOR_VARM] = { + .desc = { + .name = "db8500-varm", + .id = DB8500_REGULATOR_VARM, + .ops = &ux500_regulator_ops, + .type = REGULATOR_VOLTAGE, + .owner = THIS_MODULE, + }, + }, + [DB8500_REGULATOR_VMODEM] = { + .desc = { + .name = "db8500-vmodem", + .id = DB8500_REGULATOR_VMODEM, + .ops = &ux500_regulator_ops, + .type = REGULATOR_VOLTAGE, + .owner = THIS_MODULE, + }, + }, + [DB8500_REGULATOR_VPLL] = { + .desc = { + .name = "db8500-vpll", + .id = DB8500_REGULATOR_VPLL, + .ops = &ux500_regulator_ops, + .type = REGULATOR_VOLTAGE, + .owner = THIS_MODULE, + }, + }, + [DB8500_REGULATOR_VSMPS1] = { + .desc = { + .name = "db8500-vsmps1", + .id = DB8500_REGULATOR_VSMPS1, + .ops = &ux500_regulator_ops, + .type = REGULATOR_VOLTAGE, + .owner = THIS_MODULE, + }, + }, + [DB8500_REGULATOR_VSMPS2] = { + .desc = { + .name = "db8500-vsmps2", + .id = DB8500_REGULATOR_VSMPS2, + .ops = &ux500_regulator_ops, + .type = REGULATOR_VOLTAGE, + .owner = THIS_MODULE, + }, + .exclude_from_power_state = true, + }, + [DB8500_REGULATOR_VSMPS3] = { + .desc = { + .name = "db8500-vsmps3", + .id = DB8500_REGULATOR_VSMPS3, + .ops = &ux500_regulator_ops, + .type = REGULATOR_VOLTAGE, + .owner = THIS_MODULE, + }, + }, + [DB8500_REGULATOR_VRF1] = { + .desc = { + .name = "db8500-vrf1", + .id = DB8500_REGULATOR_VRF1, + .ops = &ux500_regulator_ops, + .type = REGULATOR_VOLTAGE, + .owner = THIS_MODULE, + }, + }, + [DB8500_REGULATOR_SWITCH_SVAMMDSP] = { + .desc = { + .name = "db8500-sva-mmdsp", + .id = DB8500_REGULATOR_SWITCH_SVAMMDSP, + .ops = &ux500_regulator_switch_ops, + .type = REGULATOR_VOLTAGE, + .owner = THIS_MODULE, + }, + .epod_id = EPOD_ID_SVAMMDSP, + }, + [DB8500_REGULATOR_SWITCH_SVAMMDSPRET] = { + .desc = { + .name = "db8500-sva-mmdsp-ret", + .id = DB8500_REGULATOR_SWITCH_SVAMMDSPRET, + .ops = &ux500_regulator_switch_ops, + .type = REGULATOR_VOLTAGE, + .owner = THIS_MODULE, + }, + .epod_id = EPOD_ID_SVAMMDSP, + .is_ramret = true, + }, + [DB8500_REGULATOR_SWITCH_SVAPIPE] = { + .desc = { + .name = "db8500-sva-pipe", + .id = DB8500_REGULATOR_SWITCH_SVAPIPE, + .ops = &ux500_regulator_switch_ops, + .type = REGULATOR_VOLTAGE, + .owner = THIS_MODULE, + }, + .epod_id = EPOD_ID_SVAPIPE, + }, + [DB8500_REGULATOR_SWITCH_SIAMMDSP] = { + .desc = { + .name = "db8500-sia-mmdsp", + .id = DB8500_REGULATOR_SWITCH_SIAMMDSP, + .ops = &ux500_regulator_switch_ops, + .type = REGULATOR_VOLTAGE, + .owner = THIS_MODULE, + }, + .epod_id = EPOD_ID_SIAMMDSP, + }, + [DB8500_REGULATOR_SWITCH_SIAMMDSPRET] = { + .desc = { + .name = "db8500-sia-mmdsp-ret", + .id = DB8500_REGULATOR_SWITCH_SIAMMDSPRET, + .ops = &ux500_regulator_switch_ops, + .type = REGULATOR_VOLTAGE, + .owner = THIS_MODULE, + }, + .epod_id = EPOD_ID_SIAMMDSP, + .is_ramret = true, + }, + [DB8500_REGULATOR_SWITCH_SIAPIPE] = { + .desc = { + .name = "db8500-sia-pipe", + .id = DB8500_REGULATOR_SWITCH_SIAPIPE, + .ops = &ux500_regulator_switch_ops, + .type = REGULATOR_VOLTAGE, + .owner = THIS_MODULE, + }, + .epod_id = EPOD_ID_SIAPIPE, + }, + [DB8500_REGULATOR_SWITCH_SGA] = { + .desc = { + .name = "db8500-sga", + .id = DB8500_REGULATOR_SWITCH_SGA, + .ops = &ux500_regulator_switch_ops, + .type = REGULATOR_VOLTAGE, + .owner = THIS_MODULE, + }, + .epod_id = EPOD_ID_SGA, + }, + [DB8500_REGULATOR_SWITCH_B2R2_MCDE] = { + .desc = { + .name = "db8500-b2r2-mcde", + .id = DB8500_REGULATOR_SWITCH_B2R2_MCDE, + .ops = &ux500_regulator_switch_ops, + .type = REGULATOR_VOLTAGE, + .owner = THIS_MODULE, + }, + .epod_id = EPOD_ID_B2R2_MCDE, + }, + [DB8500_REGULATOR_SWITCH_ESRAM12] = { + .desc = { + .name = "db8500-esram12", + .id = DB8500_REGULATOR_SWITCH_ESRAM12, + .ops = &ux500_regulator_switch_ops, + .type = REGULATOR_VOLTAGE, + .owner = THIS_MODULE, + }, + .epod_id = EPOD_ID_ESRAM12, + .is_enabled = true, + }, + [DB8500_REGULATOR_SWITCH_ESRAM12RET] = { + .desc = { + .name = "db8500-esram12-ret", + .id = DB8500_REGULATOR_SWITCH_ESRAM12RET, + .ops = &ux500_regulator_switch_ops, + .type = REGULATOR_VOLTAGE, + .owner = THIS_MODULE, + }, + .epod_id = EPOD_ID_ESRAM12, + .is_ramret = true, + }, + [DB8500_REGULATOR_SWITCH_ESRAM34] = { + .desc = { + .name = "db8500-esram34", + .id = DB8500_REGULATOR_SWITCH_ESRAM34, + .ops = &ux500_regulator_switch_ops, + .type = REGULATOR_VOLTAGE, + .owner = THIS_MODULE, + }, + .epod_id = EPOD_ID_ESRAM34, + .is_enabled = true, + }, + [DB8500_REGULATOR_SWITCH_ESRAM34RET] = { + .desc = { + .name = "db8500-esram34-ret", + .id = DB8500_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 db8500_regulator_probe(struct platform_device *pdev) +{ + int ret; + + ret = ux500_regulator_probe(pdev, db8500_regulator_info, + ARRAY_SIZE(db8500_regulator_info)); + if (!ret) + regulator_has_full_constraints(); + + return ret; +} + +static int __devexit db8500_regulator_remove(struct platform_device *pdev) +{ + return ux500_regulator_remove(pdev, db8500_regulator_info, + ARRAY_SIZE(db8500_regulator_info)); +} + +static struct platform_driver db8500_regulator_driver = { + .driver = { + .name = "db8500-regulators", + .owner = THIS_MODULE, + }, + .remove = __devexit_p(db8500_regulator_remove), +}; + +static int __init db8500_regulator_init(void) +{ + int ret; + + ret = platform_driver_probe(&db8500_regulator_driver, + db8500_regulator_probe); + if (ret < 0) { + pr_info("db8500_regulator: platform_driver_register fails\n"); + return -ENODEV; + } + + return 0; +} + +static void __exit db8500_regulator_exit(void) +{ + platform_driver_unregister(&db8500_regulator_driver); +} + +/* replaced subsys_initcall as regulators must be turned on early */ +arch_initcall(db8500_regulator_init); +module_exit(db8500_regulator_exit); + +MODULE_AUTHOR("Bengt Jonsson <bengt.g.jonsson@stericsson.com>"); +MODULE_DESCRIPTION("DB8500 regulator driver"); +MODULE_LICENSE("GPL v2"); diff --git a/arch/arm/mach-ux500/regulator-ux500.c b/arch/arm/mach-ux500/regulator-ux500.c index b52530daabe..b9ded85fd96 100644 --- a/arch/arm/mach-ux500/regulator-ux500.c +++ b/arch/arm/mach-ux500/regulator-ux500.c @@ -5,7 +5,7 @@ * Authors: Sundar Iyer <sundar.iyer@stericsson.com> for ST-Ericsson * Bengt Jonsson <bengt.g.jonsson@stericsson.com> for ST-Ericsson * - * Power domain regulators on DB8500 + * Power domain regulators on UX500 */ #include <linux/kernel.h> @@ -16,7 +16,7 @@ #include <linux/regulator/driver.h> #include <linux/regulator/machine.h> -#include "regulator-db8500.h" +#include "regulator-ux500.h" #include <mach/prcmu-fw-api.h> @@ -144,33 +144,9 @@ void ux500_regulator_put(struct ux500_regulator *regulator) /* Here for symetric reasons and for possible future use */ } -#ifdef CONFIG_UX500_SOC_DB8500 - -/** - * struct db8500_regulator_info - db8500 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) - * - */ -struct db8500_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; -}; - -static int db8500_regulator_enable(struct regulator_dev *rdev) +static int u8500_regulator_enable(struct regulator_dev *rdev) { - struct db8500_regulator_info *info = rdev_get_drvdata(rdev); + struct u8500_regulator_info *info = rdev_get_drvdata(rdev); if (info == NULL) return -EINVAL; @@ -185,9 +161,9 @@ static int db8500_regulator_enable(struct regulator_dev *rdev) return 0; } -static int db8500_regulator_disable(struct regulator_dev *rdev) +static int u8500_regulator_disable(struct regulator_dev *rdev) { - struct db8500_regulator_info *info = rdev_get_drvdata(rdev); + struct u8500_regulator_info *info = rdev_get_drvdata(rdev); int ret = 0; if (info == NULL) @@ -203,9 +179,9 @@ static int db8500_regulator_disable(struct regulator_dev *rdev) return ret; } -static int db8500_regulator_is_enabled(struct regulator_dev *rdev) +static int u8500_regulator_is_enabled(struct regulator_dev *rdev) { - struct db8500_regulator_info *info = rdev_get_drvdata(rdev); + struct u8500_regulator_info *info = rdev_get_drvdata(rdev); if (info == NULL) return -EINVAL; @@ -216,11 +192,11 @@ static int db8500_regulator_is_enabled(struct regulator_dev *rdev) return info->is_enabled; } -/* db8500 regulator operations */ -static struct regulator_ops db8500_regulator_ops = { - .enable = db8500_regulator_enable, - .disable = db8500_regulator_disable, - .is_enabled = db8500_regulator_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, }; /* @@ -280,9 +256,9 @@ static int disable_epod(u16 epod_id, bool ramret) /* * Regulator switch */ -static int db8500_regulator_switch_enable(struct regulator_dev *rdev) +static int u8500_regulator_switch_enable(struct regulator_dev *rdev) { - struct db8500_regulator_info *info = rdev_get_drvdata(rdev); + struct u8500_regulator_info *info = rdev_get_drvdata(rdev); int ret; if (info == NULL) @@ -304,9 +280,9 @@ out: return ret; } -static int db8500_regulator_switch_disable(struct regulator_dev *rdev) +static int u8500_regulator_switch_disable(struct regulator_dev *rdev) { - struct db8500_regulator_info *info = rdev_get_drvdata(rdev); + struct u8500_regulator_info *info = rdev_get_drvdata(rdev); int ret; if (info == NULL) @@ -328,9 +304,9 @@ out: return ret; } -static int db8500_regulator_switch_is_enabled(struct regulator_dev *rdev) +static int u8500_regulator_switch_is_enabled(struct regulator_dev *rdev) { - struct db8500_regulator_info *info = rdev_get_drvdata(rdev); + struct u8500_regulator_info *info = rdev_get_drvdata(rdev); if (info == NULL) return -EINVAL; @@ -342,231 +318,28 @@ static int db8500_regulator_switch_is_enabled(struct regulator_dev *rdev) return info->is_enabled; } -static struct regulator_ops db8500_regulator_switch_ops = { - .enable = db8500_regulator_switch_enable, - .disable = db8500_regulator_switch_disable, - .is_enabled = db8500_regulator_switch_is_enabled, -}; - -/* - * Regulator information - */ -static struct db8500_regulator_info - db8500_regulator_info[DB8500_NUM_REGULATORS] = { - [DB8500_REGULATOR_VAPE] = { - .desc = { - .name = "db8500-vape", - .id = DB8500_REGULATOR_VAPE, - .ops = &db8500_regulator_ops, - .type = REGULATOR_VOLTAGE, - .owner = THIS_MODULE, - }, - }, - [DB8500_REGULATOR_VARM] = { - .desc = { - .name = "db8500-varm", - .id = DB8500_REGULATOR_VARM, - .ops = &db8500_regulator_ops, - .type = REGULATOR_VOLTAGE, - .owner = THIS_MODULE, - }, - }, - [DB8500_REGULATOR_VMODEM] = { - .desc = { - .name = "db8500-vmodem", - .id = DB8500_REGULATOR_VMODEM, - .ops = &db8500_regulator_ops, - .type = REGULATOR_VOLTAGE, - .owner = THIS_MODULE, - }, - }, - [DB8500_REGULATOR_VPLL] = { - .desc = { - .name = "db8500-vpll", - .id = DB8500_REGULATOR_VPLL, - .ops = &db8500_regulator_ops, - .type = REGULATOR_VOLTAGE, - .owner = THIS_MODULE, - }, - }, - [DB8500_REGULATOR_VSMPS1] = { - .desc = { - .name = "db8500-vsmps1", - .id = DB8500_REGULATOR_VSMPS1, - .ops = &db8500_regulator_ops, - .type = REGULATOR_VOLTAGE, - .owner = THIS_MODULE, - }, - }, - [DB8500_REGULATOR_VSMPS2] = { - .desc = { - .name = "db8500-vsmps2", - .id = DB8500_REGULATOR_VSMPS2, - .ops = &db8500_regulator_ops, - .type = REGULATOR_VOLTAGE, - .owner = THIS_MODULE, - }, - .exclude_from_power_state = true, - }, - [DB8500_REGULATOR_VSMPS3] = { - .desc = { - .name = "db8500-vsmps3", - .id = DB8500_REGULATOR_VSMPS3, - .ops = &db8500_regulator_ops, - .type = REGULATOR_VOLTAGE, - .owner = THIS_MODULE, - }, - }, - [DB8500_REGULATOR_VRF1] = { - .desc = { - .name = "db8500-vrf1", - .id = DB8500_REGULATOR_VRF1, - .ops = &db8500_regulator_ops, - .type = REGULATOR_VOLTAGE, - .owner = THIS_MODULE, - }, - }, - [DB8500_REGULATOR_SWITCH_SVAMMDSP] = { - .desc = { - .name = "db8500-sva-mmdsp", - .id = DB8500_REGULATOR_SWITCH_SVAMMDSP, - .ops = &db8500_regulator_switch_ops, - .type = REGULATOR_VOLTAGE, - .owner = THIS_MODULE, - }, - .epod_id = EPOD_ID_SVAMMDSP, - }, - [DB8500_REGULATOR_SWITCH_SVAMMDSPRET] = { - .desc = { - .name = "db8500-sva-mmdsp-ret", - .id = DB8500_REGULATOR_SWITCH_SVAMMDSPRET, - .ops = &db8500_regulator_switch_ops, - .type = REGULATOR_VOLTAGE, - .owner = THIS_MODULE, - }, - .epod_id = EPOD_ID_SVAMMDSP, - .is_ramret = true, - }, - [DB8500_REGULATOR_SWITCH_SVAPIPE] = { - .desc = { - .name = "db8500-sva-pipe", - .id = DB8500_REGULATOR_SWITCH_SVAPIPE, - .ops = &db8500_regulator_switch_ops, - .type = REGULATOR_VOLTAGE, - .owner = THIS_MODULE, - }, - .epod_id = EPOD_ID_SVAPIPE, - }, - [DB8500_REGULATOR_SWITCH_SIAMMDSP] = { - .desc = { - .name = "db8500-sia-mmdsp", - .id = DB8500_REGULATOR_SWITCH_SIAMMDSP, - .ops = &db8500_regulator_switch_ops, - .type = REGULATOR_VOLTAGE, - .owner = THIS_MODULE, - }, - .epod_id = EPOD_ID_SIAMMDSP, - }, - [DB8500_REGULATOR_SWITCH_SIAMMDSPRET] = { - .desc = { - .name = "db8500-sia-mmdsp-ret", - .id = DB8500_REGULATOR_SWITCH_SIAMMDSPRET, - .ops = &db8500_regulator_switch_ops, - .type = REGULATOR_VOLTAGE, - .owner = THIS_MODULE, - }, - .epod_id = EPOD_ID_SIAMMDSP, - .is_ramret = true, - }, - [DB8500_REGULATOR_SWITCH_SIAPIPE] = { - .desc = { - .name = "db8500-sia-pipe", - .id = DB8500_REGULATOR_SWITCH_SIAPIPE, - .ops = &db8500_regulator_switch_ops, - .type = REGULATOR_VOLTAGE, - .owner = THIS_MODULE, - }, - .epod_id = EPOD_ID_SIAPIPE, - }, - [DB8500_REGULATOR_SWITCH_SGA] = { - .desc = { - .name = "db8500-sga", - .id = DB8500_REGULATOR_SWITCH_SGA, - .ops = &db8500_regulator_switch_ops, - .type = REGULATOR_VOLTAGE, - .owner = THIS_MODULE, - }, - .epod_id = EPOD_ID_SGA, - }, - [DB8500_REGULATOR_SWITCH_B2R2_MCDE] = { - .desc = { - .name = "db8500-b2r2-mcde", - .id = DB8500_REGULATOR_SWITCH_B2R2_MCDE, - .ops = &db8500_regulator_switch_ops, - .type = REGULATOR_VOLTAGE, - .owner = THIS_MODULE, - }, - .epod_id = EPOD_ID_B2R2_MCDE, - }, - [DB8500_REGULATOR_SWITCH_ESRAM12] = { - .desc = { - .name = "db8500-esram12", - .id = DB8500_REGULATOR_SWITCH_ESRAM12, - .ops = &db8500_regulator_switch_ops, - .type = REGULATOR_VOLTAGE, - .owner = THIS_MODULE, - }, - .epod_id = EPOD_ID_ESRAM12, - .is_enabled = true, - }, - [DB8500_REGULATOR_SWITCH_ESRAM12RET] = { - .desc = { - .name = "db8500-esram12-ret", - .id = DB8500_REGULATOR_SWITCH_ESRAM12RET, - .ops = &db8500_regulator_switch_ops, - .type = REGULATOR_VOLTAGE, - .owner = THIS_MODULE, - }, - .epod_id = EPOD_ID_ESRAM12, - .is_ramret = true, - }, - [DB8500_REGULATOR_SWITCH_ESRAM34] = { - .desc = { - .name = "db8500-esram34", - .id = DB8500_REGULATOR_SWITCH_ESRAM34, - .ops = &db8500_regulator_switch_ops, - .type = REGULATOR_VOLTAGE, - .owner = THIS_MODULE, - }, - .epod_id = EPOD_ID_ESRAM34, - .is_enabled = true, - }, - [DB8500_REGULATOR_SWITCH_ESRAM34RET] = { - .desc = { - .name = "db8500-esram34-ret", - .id = DB8500_REGULATOR_SWITCH_ESRAM34RET, - .ops = &db8500_regulator_switch_ops, - .type = REGULATOR_VOLTAGE, - .owner = THIS_MODULE, - }, - .epod_id = EPOD_ID_ESRAM34, - .is_ramret = true, - }, +struct regulator_ops ux500_regulator_switch_ops = { + .enable = u8500_regulator_switch_enable, + .disable = u8500_regulator_switch_disable, + .is_enabled = u8500_regulator_switch_is_enabled, }; -static int __init db8500_regulator_probe(struct platform_device *pdev) +int __devinit +ux500_regulator_probe(struct platform_device *pdev, + struct u8500_regulator_info *regulator_info, + int num_regulators) { - struct regulator_init_data *db8500_init_data = + struct regulator_init_data *u8500_init_data = dev_get_platdata(&pdev->dev); int i, err; /* register all regulators */ - for (i = 0; i < ARRAY_SIZE(db8500_regulator_info); i++) { - struct db8500_regulator_info *info; - struct regulator_init_data *init_data = &db8500_init_data[i]; + 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 = &db8500_regulator_info[i]; + info = ®ulator_info[i]; info->dev = &pdev->dev; /* register with the regulator framework */ @@ -580,7 +353,7 @@ static int __init db8500_regulator_probe(struct platform_device *pdev) /* if failing, unregister all earlier regulators */ i--; while (i >= 0) { - info = &db8500_regulator_info[i]; + info = ®ulator_info[i]; regulator_unregister(info->rdev); i--; } @@ -596,13 +369,17 @@ static int __init db8500_regulator_probe(struct platform_device *pdev) return 0; } -static int __exit db8500_regulator_remove(struct platform_device *pdev) +int __devexit +ux500_regulator_remove(struct platform_device *pdev, + struct u8500_regulator_info *regulator_info, + int num_regulators) { - int i; + int i; + + for (i = 0; i < num_regulators; i++) { + struct u8500_regulator_info *info; - for (i = 0; i < ARRAY_SIZE(db8500_regulator_info); i++) { - struct db8500_regulator_info *info; - info = &db8500_regulator_info[i]; + info = ®ulator_info[i]; dev_vdbg(rdev_get_dev(info->rdev), "regulator-%s-remove\n", info->desc.name); @@ -612,39 +389,3 @@ static int __exit db8500_regulator_remove(struct platform_device *pdev) return 0; } - -static struct platform_driver db8500_regulator_driver = { - .driver = { - .name = "db8500-regulators", - .owner = THIS_MODULE, - }, - .remove = __exit_p(db8500_regulator_remove), -}; - -static int __init db8500_regulator_init(void) -{ - int ret; - - ret = platform_driver_probe(&db8500_regulator_driver, - db8500_regulator_probe); - if (ret < 0) { - pr_info("db8500_regulator: platform_driver_register fails\n"); - return -ENODEV; - } - - return 0; -} - -static void __exit db8500_regulator_exit(void) -{ - platform_driver_unregister(&db8500_regulator_driver); -} - -arch_initcall(db8500_regulator_init); -module_exit(db8500_regulator_exit); - -MODULE_AUTHOR("STMicroelectronics/ST-Ericsson"); -MODULE_DESCRIPTION("DB8500 regulator driver"); -MODULE_LICENSE("GPL v2"); - -#endif /* CONFIG_UX500_SOC_DB8500 */ diff --git a/arch/arm/mach-ux500/regulator-ux500.h b/arch/arm/mach-ux500/regulator-ux500.h new file mode 100644 index 00000000000..b62863881b1 --- /dev/null +++ b/arch/arm/mach-ux500/regulator-ux500.h @@ -0,0 +1,39 @@ +#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 |