Skip to content

Commit

Permalink
Merge branch 'regulator-drivers' into regulator-supply
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Brown committed Feb 2, 2012
2 parents 62aa2b5 + 20a14b8 commit fb87ef1
Show file tree
Hide file tree
Showing 14 changed files with 2,492 additions and 122 deletions.
31 changes: 31 additions & 0 deletions drivers/regulator/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,14 @@ config REGULATOR_MAX8998
via I2C bus. The provided regulator is suitable for S3C6410
and S5PC1XX chips to control VCC_CORE and VCC_USIM voltages.

config REGULATOR_S5M8767
tristate "Samsung S5M8767A voltage regulator"
depends on MFD_S5M_CORE
help
This driver supports a Samsung S5M8767A voltage output regulator
via I2C bus. S5M8767A have 9 Bucks and 28 LDOs output and
supports DVS mode with 8bits of output voltage control.

config REGULATOR_TWL4030
bool "TI TWL4030/TWL5030/TWL6030/TPS659x0 PMIC"
depends on TWL4030_CORE
Expand Down Expand Up @@ -267,6 +275,15 @@ config REGULATOR_TPS6507X
three step-down converters and two general-purpose LDO voltage regulators.
It supports TI's software based Class-2 SmartReflex implementation.

config REGULATOR_TPS65217
tristate "TI TPS65217 Power regulators"
depends on MFD_TPS65217
help
This driver supports TPS65217 voltage regulator chips. TPS65217
provides three step-down converters and four general-purpose LDO
voltage regulators. It supports software based voltage control
for different voltage domains

config REGULATOR_TPS65912
tristate "TI TPS65912 Power regulator"
depends on (MFD_TPS65912_I2C || MFD_TPS65912_SPI)
Expand Down Expand Up @@ -299,9 +316,13 @@ config REGULATOR_AB8500
This driver supports the regulators found on the ST-Ericsson mixed
signal AB8500 PMIC

config REGULATOR_DBX500_PRCMU
bool

config REGULATOR_DB8500_PRCMU
bool "ST-Ericsson DB8500 Voltage Domain Regulators"
depends on MFD_DB8500_PRCMU
select REGULATOR_DBX500_PRCMU
help
This driver supports the voltage domain regulators controlled by the
DB8500 PRCMU
Expand All @@ -328,6 +349,16 @@ config REGULATOR_TPS65910
help
This driver supports TPS65910 voltage regulator chips.

config REGULATOR_TPS62360
tristate "TI TPS62360 Power Regulator"
depends on I2C
select REGMAP_I2C
help
This driver supports TPS62360 voltage regulator chip. This
regulator is meant for processor core supply. This chip is
high-frequency synchronous step down dc-dc converter optimized
for battery-powered portable applications.

config REGULATOR_AAT2870
tristate "AnalogicTech AAT2870 Regulators"
depends on MFD_AAT2870_CORE
Expand Down
5 changes: 5 additions & 0 deletions drivers/regulator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,18 @@ obj-$(CONFIG_REGULATOR_AB3100) += ab3100.o
obj-$(CONFIG_REGULATOR_TPS6105X) += tps6105x-regulator.o
obj-$(CONFIG_REGULATOR_TPS65023) += tps65023-regulator.o
obj-$(CONFIG_REGULATOR_TPS6507X) += tps6507x-regulator.o
obj-$(CONFIG_REGULATOR_TPS65217) += tps65217-regulator.o
obj-$(CONFIG_REGULATOR_TPS6524X) += tps6524x-regulator.o
obj-$(CONFIG_REGULATOR_TPS65912) += tps65912-regulator.o
obj-$(CONFIG_REGULATOR_88PM8607) += 88pm8607.o
obj-$(CONFIG_REGULATOR_ISL6271A) += isl6271a-regulator.o
obj-$(CONFIG_REGULATOR_AB8500) += ab8500.o
obj-$(CONFIG_REGULATOR_DBX500_PRCMU) += dbx500-prcmu.o
obj-$(CONFIG_REGULATOR_DB8500_PRCMU) += db8500-prcmu.o
obj-$(CONFIG_REGULATOR_TPS65910) += tps65910-regulator.o
obj-$(CONFIG_REGULATOR_TPS62360) += tps62360-regulator.o
obj-$(CONFIG_REGULATOR_AAT2870) += aat2870-regulator.o
obj-$(CONFIG_REGULATOR_S5M8767) += s5m8767.o


ccflags-$(CONFIG_REGULATOR_DEBUG) += -DDEBUG
118 changes: 32 additions & 86 deletions drivers/regulator/db8500-prcmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,91 +18,30 @@
#include <linux/regulator/machine.h>
#include <linux/regulator/db8500-prcmu.h>
#include <linux/module.h>

/*
* 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 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;
};
#include "dbx500-prcmu.h"

static int db8500_regulator_enable(struct regulator_dev *rdev)
{
struct db8500_regulator_info *info = rdev_get_drvdata(rdev);
struct dbx500_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 = true;
if (!info->exclude_from_power_state)
power_state_active_enable();
if (!info->is_enabled) {
info->is_enabled = true;
if (!info->exclude_from_power_state)
power_state_active_enable();
}

return 0;
}

static int db8500_regulator_disable(struct regulator_dev *rdev)
{
struct db8500_regulator_info *info = rdev_get_drvdata(rdev);
struct dbx500_regulator_info *info = rdev_get_drvdata(rdev);
int ret = 0;

if (info == NULL)
Expand All @@ -111,16 +50,18 @@ static int db8500_regulator_disable(struct regulator_dev *rdev)
dev_vdbg(rdev_get_dev(rdev), "regulator-%s-disable\n",
info->desc.name);

info->is_enabled = false;
if (!info->exclude_from_power_state)
ret = power_state_active_disable();
if (info->is_enabled) {
info->is_enabled = false;
if (!info->exclude_from_power_state)
ret = power_state_active_disable();
}

return ret;
}

static int db8500_regulator_is_enabled(struct regulator_dev *rdev)
{
struct db8500_regulator_info *info = rdev_get_drvdata(rdev);
struct dbx500_regulator_info *info = rdev_get_drvdata(rdev);

if (info == NULL)
return -EINVAL;
Expand Down Expand Up @@ -197,7 +138,7 @@ static int disable_epod(u16 epod_id, bool ramret)
*/
static int db8500_regulator_switch_enable(struct regulator_dev *rdev)
{
struct db8500_regulator_info *info = rdev_get_drvdata(rdev);
struct dbx500_regulator_info *info = rdev_get_drvdata(rdev);
int ret;

if (info == NULL)
Expand All @@ -221,7 +162,7 @@ static int db8500_regulator_switch_enable(struct regulator_dev *rdev)

static int db8500_regulator_switch_disable(struct regulator_dev *rdev)
{
struct db8500_regulator_info *info = rdev_get_drvdata(rdev);
struct dbx500_regulator_info *info = rdev_get_drvdata(rdev);
int ret;

if (info == NULL)
Expand All @@ -245,7 +186,7 @@ static int db8500_regulator_switch_disable(struct regulator_dev *rdev)

static int db8500_regulator_switch_is_enabled(struct regulator_dev *rdev)
{
struct db8500_regulator_info *info = rdev_get_drvdata(rdev);
struct dbx500_regulator_info *info = rdev_get_drvdata(rdev);

if (info == NULL)
return -EINVAL;
Expand All @@ -266,8 +207,8 @@ static struct regulator_ops db8500_regulator_switch_ops = {
/*
* Regulator information
*/
static struct db8500_regulator_info
db8500_regulator_info[DB8500_NUM_REGULATORS] = {
static struct dbx500_regulator_info
dbx500_regulator_info[DB8500_NUM_REGULATORS] = {
[DB8500_REGULATOR_VAPE] = {
.desc = {
.name = "db8500-vape",
Expand Down Expand Up @@ -476,12 +417,12 @@ static int __devinit db8500_regulator_probe(struct platform_device *pdev)
int i, err;

/* register all regulators */
for (i = 0; i < ARRAY_SIZE(db8500_regulator_info); i++) {
struct db8500_regulator_info *info;
for (i = 0; i < ARRAY_SIZE(dbx500_regulator_info); i++) {
struct dbx500_regulator_info *info;
struct regulator_init_data *init_data = &db8500_init_data[i];

/* assign per-regulator data */
info = &db8500_regulator_info[i];
info = &dbx500_regulator_info[i];
info->dev = &pdev->dev;

/* register with the regulator framework */
Expand All @@ -494,7 +435,7 @@ static int __devinit db8500_regulator_probe(struct platform_device *pdev)

/* if failing, unregister all earlier regulators */
while (--i >= 0) {
info = &db8500_regulator_info[i];
info = &dbx500_regulator_info[i];
regulator_unregister(info->rdev);
}
return err;
Expand All @@ -503,17 +444,22 @@ static int __devinit db8500_regulator_probe(struct platform_device *pdev)
dev_dbg(rdev_get_dev(info->rdev),
"regulator-%s-probed\n", info->desc.name);
}
err = ux500_regulator_debug_init(pdev,
dbx500_regulator_info,
ARRAY_SIZE(dbx500_regulator_info));

return 0;
return err;
}

static int __exit db8500_regulator_remove(struct platform_device *pdev)
{
int i;

for (i = 0; i < ARRAY_SIZE(db8500_regulator_info); i++) {
struct db8500_regulator_info *info;
info = &db8500_regulator_info[i];
ux500_regulator_debug_exit();

for (i = 0; i < ARRAY_SIZE(dbx500_regulator_info); i++) {
struct dbx500_regulator_info *info;
info = &dbx500_regulator_info[i];

dev_vdbg(rdev_get_dev(info->rdev),
"regulator-%s-remove\n", info->desc.name);
Expand Down
Loading

0 comments on commit fb87ef1

Please sign in to comment.