1
0
Fork 0

Merge remote-tracking branches 'regulator/topic/bcm590xx', 'regulator/topic/da9052', 'regulator/topic/da9055', 'regulator/topic/da9063', 'regulator/topic/da9210', 'regulator/topic/db8500' and 'regulator/topic/dbx500' into regulator-next

wifi-calibration
Mark Brown 2014-03-26 16:57:51 +00:00
9 changed files with 520 additions and 26 deletions

View File

@ -139,6 +139,14 @@ config REGULATOR_AS3722
AS3722 PMIC. This will enable support for all the software
controllable DCDC/LDO regulators.
config REGULATOR_BCM590XX
tristate "Broadcom BCM590xx PMU Regulators"
depends on MFD_BCM590XX
help
This driver provides support for the voltage regulators on the
BCM590xx PMUs. This will enable support for the software
controllable LDO/Switching regulators.
config REGULATOR_DA903X
tristate "Dialog Semiconductor DA9030/DA9034 regulators"
depends on PMIC_DA903X

View File

@ -20,6 +20,7 @@ obj-$(CONFIG_REGULATOR_ANATOP) += anatop-regulator.o
obj-$(CONFIG_REGULATOR_ARIZONA) += arizona-micsupp.o arizona-ldo1.o
obj-$(CONFIG_REGULATOR_AS3711) += as3711-regulator.o
obj-$(CONFIG_REGULATOR_AS3722) += as3722-regulator.o
obj-$(CONFIG_REGULATOR_BCM590XX) += bcm590xx-regulator.o
obj-$(CONFIG_REGULATOR_DA903X) += da903x.o
obj-$(CONFIG_REGULATOR_DA9052) += da9052-regulator.o
obj-$(CONFIG_REGULATOR_DA9055) += da9055-regulator.o

View File

@ -0,0 +1,403 @@
/*
* Broadcom BCM590xx regulator driver
*
* Copyright 2014 Linaro Limited
* Author: Matt Porter <mporter@linaro.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*/
#include <linux/err.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/mfd/bcm590xx.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/regulator/driver.h>
#include <linux/regulator/machine.h>
#include <linux/regulator/of_regulator.h>
#include <linux/slab.h>
/* Register defs */
#define BCM590XX_RFLDOPMCTRL1 0x60
#define BCM590XX_IOSR1PMCTRL1 0x7a
#define BCM590XX_IOSR2PMCTRL1 0x7c
#define BCM590XX_CSRPMCTRL1 0x7e
#define BCM590XX_SDSR1PMCTRL1 0x82
#define BCM590XX_SDSR2PMCTRL1 0x86
#define BCM590XX_MSRPMCTRL1 0x8a
#define BCM590XX_VSRPMCTRL1 0x8e
#define BCM590XX_REG_ENABLE BIT(7)
#define BCM590XX_RFLDOCTRL 0x96
#define BCM590XX_CSRVOUT1 0xc0
#define BCM590XX_LDO_VSEL_MASK GENMASK(5, 3)
#define BCM590XX_SR_VSEL_MASK GENMASK(5, 0)
/* LDO regulator IDs */
#define BCM590XX_REG_RFLDO 0
#define BCM590XX_REG_CAMLDO1 1
#define BCM590XX_REG_CAMLDO2 2
#define BCM590XX_REG_SIMLDO1 3
#define BCM590XX_REG_SIMLDO2 4
#define BCM590XX_REG_SDLDO 5
#define BCM590XX_REG_SDXLDO 6
#define BCM590XX_REG_MMCLDO1 7
#define BCM590XX_REG_MMCLDO2 8
#define BCM590XX_REG_AUDLDO 9
#define BCM590XX_REG_MICLDO 10
#define BCM590XX_REG_USBLDO 11
#define BCM590XX_REG_VIBLDO 12
/* DCDC regulator IDs */
#define BCM590XX_REG_CSR 13
#define BCM590XX_REG_IOSR1 14
#define BCM590XX_REG_IOSR2 15
#define BCM590XX_REG_MSR 16
#define BCM590XX_REG_SDSR1 17
#define BCM590XX_REG_SDSR2 18
#define BCM590XX_REG_VSR 19
#define BCM590XX_NUM_REGS 20
#define BCM590XX_REG_IS_LDO(n) (n < BCM590XX_REG_CSR)
struct bcm590xx_board {
struct regulator_init_data *bcm590xx_pmu_init_data[BCM590XX_NUM_REGS];
};
/* LDO group A: supported voltages in microvolts */
static const unsigned int ldo_a_table[] = {
1200000, 1800000, 2500000, 2700000, 2800000,
2900000, 3000000, 3300000,
};
/* LDO group C: supported voltages in microvolts */
static const unsigned int ldo_c_table[] = {
3100000, 1800000, 2500000, 2700000, 2800000,
2900000, 3000000, 3300000,
};
/* DCDC group CSR: supported voltages in microvolts */
static const struct regulator_linear_range dcdc_csr_ranges[] = {
REGULATOR_LINEAR_RANGE(860000, 2, 50, 10000),
REGULATOR_LINEAR_RANGE(1360000, 51, 55, 20000),
REGULATOR_LINEAR_RANGE(900000, 56, 63, 0),
};
/* DCDC group IOSR1: supported voltages in microvolts */
static const struct regulator_linear_range dcdc_iosr1_ranges[] = {
REGULATOR_LINEAR_RANGE(860000, 2, 51, 10000),
REGULATOR_LINEAR_RANGE(1500000, 52, 52, 0),
REGULATOR_LINEAR_RANGE(1800000, 53, 53, 0),
REGULATOR_LINEAR_RANGE(900000, 54, 63, 0),
};
/* DCDC group SDSR1: supported voltages in microvolts */
static const struct regulator_linear_range dcdc_sdsr1_ranges[] = {
REGULATOR_LINEAR_RANGE(860000, 2, 50, 10000),
REGULATOR_LINEAR_RANGE(1340000, 51, 51, 0),
REGULATOR_LINEAR_RANGE(900000, 52, 63, 0),
};
struct bcm590xx_info {
const char *name;
const char *vin_name;
u8 n_voltages;
const unsigned int *volt_table;
u8 n_linear_ranges;
const struct regulator_linear_range *linear_ranges;
};
#define BCM590XX_REG_TABLE(_name, _table) \
{ \
.name = #_name, \
.n_voltages = ARRAY_SIZE(_table), \
.volt_table = _table, \
}
#define BCM590XX_REG_RANGES(_name, _ranges) \
{ \
.name = #_name, \
.n_linear_ranges = ARRAY_SIZE(_ranges), \
.linear_ranges = _ranges, \
}
static struct bcm590xx_info bcm590xx_regs[] = {
BCM590XX_REG_TABLE(rfldo, ldo_a_table),
BCM590XX_REG_TABLE(camldo1, ldo_c_table),
BCM590XX_REG_TABLE(camldo2, ldo_c_table),
BCM590XX_REG_TABLE(simldo1, ldo_a_table),
BCM590XX_REG_TABLE(simldo2, ldo_a_table),
BCM590XX_REG_TABLE(sdldo, ldo_c_table),
BCM590XX_REG_TABLE(sdxldo, ldo_a_table),
BCM590XX_REG_TABLE(mmcldo1, ldo_a_table),
BCM590XX_REG_TABLE(mmcldo2, ldo_a_table),
BCM590XX_REG_TABLE(audldo, ldo_a_table),
BCM590XX_REG_TABLE(micldo, ldo_a_table),
BCM590XX_REG_TABLE(usbldo, ldo_a_table),
BCM590XX_REG_TABLE(vibldo, ldo_c_table),
BCM590XX_REG_RANGES(csr, dcdc_csr_ranges),
BCM590XX_REG_RANGES(iosr1, dcdc_iosr1_ranges),
BCM590XX_REG_RANGES(iosr2, dcdc_iosr1_ranges),
BCM590XX_REG_RANGES(msr, dcdc_iosr1_ranges),
BCM590XX_REG_RANGES(sdsr1, dcdc_sdsr1_ranges),
BCM590XX_REG_RANGES(sdsr2, dcdc_iosr1_ranges),
BCM590XX_REG_RANGES(vsr, dcdc_iosr1_ranges),
};
struct bcm590xx_reg {
struct regulator_desc *desc;
struct bcm590xx *mfd;
struct bcm590xx_info **info;
};
static int bcm590xx_get_vsel_register(int id)
{
if (BCM590XX_REG_IS_LDO(id))
return BCM590XX_RFLDOCTRL + id;
else
return BCM590XX_CSRVOUT1 + (id - BCM590XX_REG_CSR) * 3;
}
static int bcm590xx_get_enable_register(int id)
{
int reg = 0;
if (BCM590XX_REG_IS_LDO(id))
reg = BCM590XX_RFLDOPMCTRL1 + id * 2;
else
switch (id) {
case BCM590XX_REG_CSR:
reg = BCM590XX_CSRPMCTRL1;
break;
case BCM590XX_REG_IOSR1:
reg = BCM590XX_IOSR1PMCTRL1;
break;
case BCM590XX_REG_IOSR2:
reg = BCM590XX_IOSR2PMCTRL1;
break;
case BCM590XX_REG_MSR:
reg = BCM590XX_MSRPMCTRL1;
break;
case BCM590XX_REG_SDSR1:
reg = BCM590XX_SDSR1PMCTRL1;
break;
case BCM590XX_REG_SDSR2:
reg = BCM590XX_SDSR2PMCTRL1;
break;
};
return reg;
}
static struct regulator_ops bcm590xx_ops_ldo = {
.is_enabled = regulator_is_enabled_regmap,
.enable = regulator_enable_regmap,
.disable = regulator_disable_regmap,
.get_voltage_sel = regulator_get_voltage_sel_regmap,
.set_voltage_sel = regulator_set_voltage_sel_regmap,
.list_voltage = regulator_list_voltage_table,
.map_voltage = regulator_map_voltage_iterate,
};
static struct regulator_ops bcm590xx_ops_dcdc = {
.is_enabled = regulator_is_enabled_regmap,
.enable = regulator_enable_regmap,
.disable = regulator_disable_regmap,
.get_voltage_sel = regulator_get_voltage_sel_regmap,
.set_voltage_sel = regulator_set_voltage_sel_regmap,
.list_voltage = regulator_list_voltage_linear_range,
.map_voltage = regulator_map_voltage_linear_range,
};
#define BCM590XX_MATCH(_name, _id) \
{ \
.name = #_name, \
.driver_data = (void *)&bcm590xx_regs[BCM590XX_REG_##_id], \
}
static struct of_regulator_match bcm590xx_matches[] = {
BCM590XX_MATCH(rfldo, RFLDO),
BCM590XX_MATCH(camldo1, CAMLDO1),
BCM590XX_MATCH(camldo2, CAMLDO2),
BCM590XX_MATCH(simldo1, SIMLDO1),
BCM590XX_MATCH(simldo2, SIMLDO2),
BCM590XX_MATCH(sdldo, SDLDO),
BCM590XX_MATCH(sdxldo, SDXLDO),
BCM590XX_MATCH(mmcldo1, MMCLDO1),
BCM590XX_MATCH(mmcldo2, MMCLDO2),
BCM590XX_MATCH(audldo, AUDLDO),
BCM590XX_MATCH(micldo, MICLDO),
BCM590XX_MATCH(usbldo, USBLDO),
BCM590XX_MATCH(vibldo, VIBLDO),
BCM590XX_MATCH(csr, CSR),
BCM590XX_MATCH(iosr1, IOSR1),
BCM590XX_MATCH(iosr2, IOSR2),
BCM590XX_MATCH(msr, MSR),
BCM590XX_MATCH(sdsr1, SDSR1),
BCM590XX_MATCH(sdsr2, SDSR2),
BCM590XX_MATCH(vsr, VSR),
};
static struct bcm590xx_board *bcm590xx_parse_dt_reg_data(
struct platform_device *pdev,
struct of_regulator_match **bcm590xx_reg_matches)
{
struct bcm590xx_board *data;
struct device_node *np = pdev->dev.parent->of_node;
struct device_node *regulators;
struct of_regulator_match *matches = bcm590xx_matches;
int count = ARRAY_SIZE(bcm590xx_matches);
int idx = 0;
int ret;
if (!np) {
dev_err(&pdev->dev, "of node not found\n");
return NULL;
}
data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
if (!data) {
dev_err(&pdev->dev, "failed to allocate regulator board data\n");
return NULL;
}
np = of_node_get(np);
regulators = of_get_child_by_name(np, "regulators");
if (!regulators) {
dev_warn(&pdev->dev, "regulator node not found\n");
return NULL;
}
ret = of_regulator_match(&pdev->dev, regulators, matches, count);
of_node_put(regulators);
if (ret < 0) {
dev_err(&pdev->dev, "Error parsing regulator init data: %d\n",
ret);
return NULL;
}
*bcm590xx_reg_matches = matches;
for (idx = 0; idx < count; idx++) {
if (!matches[idx].init_data || !matches[idx].of_node)
continue;
data->bcm590xx_pmu_init_data[idx] = matches[idx].init_data;
}
return data;
}
static int bcm590xx_probe(struct platform_device *pdev)
{
struct bcm590xx *bcm590xx = dev_get_drvdata(pdev->dev.parent);
struct bcm590xx_board *pmu_data = NULL;
struct bcm590xx_reg *pmu;
struct regulator_config config = { };
struct bcm590xx_info *info;
struct regulator_init_data *reg_data;
struct regulator_dev *rdev;
struct of_regulator_match *bcm590xx_reg_matches = NULL;
int i;
pmu_data = bcm590xx_parse_dt_reg_data(pdev,
&bcm590xx_reg_matches);
pmu = devm_kzalloc(&pdev->dev, sizeof(*pmu), GFP_KERNEL);
if (!pmu) {
dev_err(&pdev->dev, "Memory allocation failed for pmu\n");
return -ENOMEM;
}
pmu->mfd = bcm590xx;
platform_set_drvdata(pdev, pmu);
pmu->desc = devm_kzalloc(&pdev->dev, BCM590XX_NUM_REGS *
sizeof(struct regulator_desc), GFP_KERNEL);
if (!pmu->desc) {
dev_err(&pdev->dev, "Memory alloc fails for desc\n");
return -ENOMEM;
}
pmu->info = devm_kzalloc(&pdev->dev, BCM590XX_NUM_REGS *
sizeof(struct bcm590xx_info *), GFP_KERNEL);
if (!pmu->info) {
dev_err(&pdev->dev, "Memory alloc fails for info\n");
return -ENOMEM;
}
info = bcm590xx_regs;
for (i = 0; i < BCM590XX_NUM_REGS; i++, info++) {
if (pmu_data)
reg_data = pmu_data->bcm590xx_pmu_init_data[i];
else
reg_data = NULL;
/* Register the regulators */
pmu->info[i] = info;
pmu->desc[i].name = info->name;
pmu->desc[i].supply_name = info->vin_name;
pmu->desc[i].id = i;
pmu->desc[i].volt_table = info->volt_table;
pmu->desc[i].n_voltages = info->n_voltages;
pmu->desc[i].linear_ranges = info->linear_ranges;
pmu->desc[i].n_linear_ranges = info->n_linear_ranges;
if (BCM590XX_REG_IS_LDO(i)) {
pmu->desc[i].ops = &bcm590xx_ops_ldo;
pmu->desc[i].vsel_mask = BCM590XX_LDO_VSEL_MASK;
} else {
pmu->desc[i].ops = &bcm590xx_ops_dcdc;
pmu->desc[i].vsel_mask = BCM590XX_SR_VSEL_MASK;
}
pmu->desc[i].vsel_reg = bcm590xx_get_vsel_register(i);
pmu->desc[i].enable_is_inverted = true;
pmu->desc[i].enable_mask = BCM590XX_REG_ENABLE;
pmu->desc[i].enable_reg = bcm590xx_get_enable_register(i);
pmu->desc[i].type = REGULATOR_VOLTAGE;
pmu->desc[i].owner = THIS_MODULE;
config.dev = bcm590xx->dev;
config.init_data = reg_data;
config.driver_data = pmu;
config.regmap = bcm590xx->regmap;
if (bcm590xx_reg_matches)
config.of_node = bcm590xx_reg_matches[i].of_node;
rdev = devm_regulator_register(&pdev->dev, &pmu->desc[i],
&config);
if (IS_ERR(rdev)) {
dev_err(bcm590xx->dev,
"failed to register %s regulator\n",
pdev->name);
return PTR_ERR(rdev);
}
}
return 0;
}
static struct platform_driver bcm590xx_regulator_driver = {
.driver = {
.name = "bcm590xx-vregs",
.owner = THIS_MODULE,
},
.probe = bcm590xx_probe,
};
module_platform_driver(bcm590xx_regulator_driver);
MODULE_AUTHOR("Matt Porter <mporter@linaro.org>");
MODULE_DESCRIPTION("BCM590xx voltage regulator driver");
MODULE_LICENSE("GPL v2");
MODULE_ALIAS("platform:bcm590xx-vregs");

View File

@ -240,6 +240,31 @@ static int da9052_regulator_set_voltage_sel(struct regulator_dev *rdev,
return ret;
}
static int da9052_regulator_set_voltage_time_sel(struct regulator_dev *rdev,
unsigned int old_sel,
unsigned int new_sel)
{
struct da9052_regulator *regulator = rdev_get_drvdata(rdev);
struct da9052_regulator_info *info = regulator->info;
int id = rdev_get_id(rdev);
int ret = 0;
/* The DVC controlled LDOs and DCDCs ramp with 6.25mV/µs after enabling
* the activate bit.
*/
switch (id) {
case DA9052_ID_BUCK1:
case DA9052_ID_BUCK2:
case DA9052_ID_BUCK3:
case DA9052_ID_LDO2:
case DA9052_ID_LDO3:
ret = (new_sel - old_sel) * info->step_uV / 6250;
break;
}
return ret;
}
static struct regulator_ops da9052_dcdc_ops = {
.get_current_limit = da9052_dcdc_get_current_limit,
.set_current_limit = da9052_dcdc_set_current_limit,
@ -248,6 +273,7 @@ static struct regulator_ops da9052_dcdc_ops = {
.map_voltage = da9052_map_voltage,
.get_voltage_sel = regulator_get_voltage_sel_regmap,
.set_voltage_sel = da9052_regulator_set_voltage_sel,
.set_voltage_time_sel = da9052_regulator_set_voltage_time_sel,
.is_enabled = regulator_is_enabled_regmap,
.enable = regulator_enable_regmap,
.disable = regulator_disable_regmap,
@ -258,6 +284,7 @@ static struct regulator_ops da9052_ldo_ops = {
.map_voltage = da9052_map_voltage,
.get_voltage_sel = regulator_get_voltage_sel_regmap,
.set_voltage_sel = da9052_regulator_set_voltage_sel,
.set_voltage_time_sel = da9052_regulator_set_voltage_time_sel,
.is_enabled = regulator_is_enabled_regmap,
.enable = regulator_enable_regmap,
.disable = regulator_disable_regmap,
@ -401,7 +428,7 @@ static int da9052_regulator_probe(struct platform_device *pdev)
if (!nproot)
return -ENODEV;
nproot = of_find_node_by_name(nproot, "regulators");
nproot = of_get_child_by_name(nproot, "regulators");
if (!nproot)
return -ENODEV;

View File

@ -19,6 +19,8 @@
#include <linux/platform_device.h>
#include <linux/regulator/driver.h>
#include <linux/regulator/machine.h>
#include <linux/of.h>
#include <linux/regulator/of_regulator.h>
#include <linux/mfd/da9055/core.h>
#include <linux/mfd/da9055/reg.h>
@ -446,6 +448,9 @@ static int da9055_gpio_init(struct da9055_regulator *regulator,
struct da9055_regulator_info *info = regulator->info;
int ret = 0;
if (!pdata)
return 0;
if (pdata->gpio_ren && pdata->gpio_ren[id]) {
char name[18];
int gpio_mux = pdata->gpio_ren[id];
@ -530,6 +535,59 @@ static inline struct da9055_regulator_info *find_regulator_info(int id)
return NULL;
}
#ifdef CONFIG_OF
static struct of_regulator_match da9055_reg_matches[] = {
{ .name = "BUCK1", },
{ .name = "BUCK2", },
{ .name = "LDO1", },
{ .name = "LDO2", },
{ .name = "LDO3", },
{ .name = "LDO4", },
{ .name = "LDO5", },
{ .name = "LDO6", },
};
static int da9055_regulator_dt_init(struct platform_device *pdev,
struct da9055_regulator *regulator,
struct regulator_config *config,
int regid)
{
struct device_node *nproot, *np;
int ret;
nproot = of_node_get(pdev->dev.parent->of_node);
if (!nproot)
return -ENODEV;
np = of_get_child_by_name(nproot, "regulators");
if (!np)
return -ENODEV;
ret = of_regulator_match(&pdev->dev, np, &da9055_reg_matches[regid], 1);
of_node_put(nproot);
if (ret < 0) {
dev_err(&pdev->dev, "Error matching regulator: %d\n", ret);
return ret;
}
config->init_data = da9055_reg_matches[regid].init_data;
config->of_node = da9055_reg_matches[regid].of_node;
if (!config->of_node)
return -ENODEV;
return 0;
}
#else
static inline int da9055_regulator_dt_init(struct platform_device *pdev,
struct da9055_regulator *regulator,
struct regulator_config *config,
int regid)
{
return -ENODEV;
}
#endif /* CONFIG_OF */
static int da9055_regulator_probe(struct platform_device *pdev)
{
struct regulator_config config = { };
@ -538,9 +596,6 @@ static int da9055_regulator_probe(struct platform_device *pdev)
struct da9055_pdata *pdata = dev_get_platdata(da9055->dev);
int ret, irq;
if (pdata == NULL || pdata->regulators[pdev->id] == NULL)
return -ENODEV;
regulator = devm_kzalloc(&pdev->dev, sizeof(struct da9055_regulator),
GFP_KERNEL);
if (!regulator)
@ -557,8 +612,14 @@ static int da9055_regulator_probe(struct platform_device *pdev)
config.driver_data = regulator;
config.regmap = da9055->regmap;
if (pdata && pdata->regulators)
if (pdata && pdata->regulators) {
config.init_data = pdata->regulators[pdev->id];
} else {
ret = da9055_regulator_dt_init(pdev, regulator, &config,
pdev->id);
if (ret < 0)
return ret;
}
ret = da9055_gpio_init(regulator, &config, pdata, pdev->id);
if (ret < 0)

View File

@ -365,7 +365,7 @@ static int da9063_set_suspend_voltage(struct regulator_dev *rdev, int uV)
sel = regulator_map_voltage_linear(rdev, uV, uV);
if (sel < 0)
return -EINVAL;
return sel;
sel <<= ffs(rdev->desc->vsel_mask) - 1;
@ -666,7 +666,7 @@ static struct da9063_regulators_pdata *da9063_parse_regulators_dt(
struct device_node *node;
int i, n, num;
node = of_find_node_by_name(pdev->dev.parent->of_node, "regulators");
node = of_get_child_by_name(pdev->dev.parent->of_node, "regulators");
if (!node) {
dev_err(&pdev->dev, "Regulators device node not found\n");
return ERR_PTR(-ENODEV);
@ -674,6 +674,7 @@ static struct da9063_regulators_pdata *da9063_parse_regulators_dt(
num = of_regulator_match(&pdev->dev, node, da9063_matches,
ARRAY_SIZE(da9063_matches));
of_node_put(node);
if (num < 0) {
dev_err(&pdev->dev, "Failed to match regulators\n");
return ERR_PTR(-EINVAL);
@ -710,7 +711,7 @@ static struct da9063_regulators_pdata *da9063_parse_regulators_dt(
struct platform_device *pdev,
struct of_regulator_match **da9063_reg_matches)
{
da9063_reg_matches = NULL;
*da9063_reg_matches = NULL;
return ERR_PTR(-ENODEV);
}
#endif
@ -756,7 +757,7 @@ static int da9063_regulator_probe(struct platform_device *pdev)
if (ret < 0) {
dev_err(&pdev->dev,
"Error while reading BUCKs configuration\n");
return -EIO;
return ret;
}
bcores_merged = val & DA9063_BCORE_MERGE;
bmem_bio_merged = val & DA9063_BUCK_MERGE;
@ -775,10 +776,8 @@ static int da9063_regulator_probe(struct platform_device *pdev)
size = sizeof(struct da9063_regulators) +
n_regulators * sizeof(struct da9063_regulator);
regulators = devm_kzalloc(&pdev->dev, size, GFP_KERNEL);
if (!regulators) {
dev_err(&pdev->dev, "No memory for regulators\n");
if (!regulators)
return -ENOMEM;
}
regulators->n_regulators = n_regulators;
platform_set_drvdata(pdev, regulators);

View File

@ -134,11 +134,8 @@ static int da9210_i2c_probe(struct i2c_client *i2c,
int error;
chip = devm_kzalloc(&i2c->dev, sizeof(struct da9210), GFP_KERNEL);
if (NULL == chip) {
dev_err(&i2c->dev,
"Cannot kzalloc memory for regulator structure\n");
if (!chip)
return -ENOMEM;
}
chip->regmap = devm_regmap_init_i2c(i2c, &da9210_regmap_config);
if (IS_ERR(chip->regmap)) {

View File

@ -263,6 +263,8 @@ dbx500_regulator_info[DB8500_NUM_REGULATORS] = {
.ops = &db8500_regulator_ops,
.type = REGULATOR_VOLTAGE,
.owner = THIS_MODULE,
.fixed_uV = 1800000,
.n_voltages = 1,
},
.exclude_from_power_state = true,
},

View File

@ -78,6 +78,7 @@ static struct ux500_regulator_debug {
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;
@ -86,6 +87,7 @@ void ux500_regulator_suspend_debug(void)
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;
@ -127,9 +129,9 @@ static int ux500_regulator_status_print(struct seq_file *s, void *p)
int i;
/* print dump header */
err = seq_printf(s, "ux500-regulator status:\n");
err = seq_puts(s, "ux500-regulator status:\n");
if (err < 0)
dev_err(dev, "seq_printf overflow\n");
dev_err(dev, "seq_puts overflow\n");
err = seq_printf(s, "%31s : %8s : %8s\n", "current",
"before", "after");
@ -202,18 +204,12 @@ ux500_regulator_debug_init(struct platform_device *pdev,
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");
if (!rdebug.state_before_suspend)
goto exit_destroy_power_state;
}
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");
if (!rdebug.state_after_suspend)
goto exit_free;
}
dbx500_regulator_testcase(regulator_info, num_regulators);
return 0;