Skip to content

Commit

Permalink
Merge remote-tracking branches 'regulator/topic/isl9305', 'regulator/…
Browse files Browse the repository at this point in the history
…topic/lp872x', 'regulator/topic/max14577', 'regulator/topic/max7686' and 'regulator/topic/max77843' into regulator-next
  • Loading branch information
Mark Brown committed Feb 8, 2015
6 parents 30c5c53 + 6fd7535 + 8538c40 + e951cee + 64d3d25 + 9dfffb7 commit f3ba729
Show file tree
Hide file tree
Showing 9 changed files with 340 additions and 76 deletions.
14 changes: 14 additions & 0 deletions Documentation/devicetree/bindings/mfd/max77686.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ to get matched with their hardware counterparts as follow:
-BUCKn : 1-4.
Use standard regulator bindings for it ('regulator-off-in-suspend').

LDO20, LDO21, LDO22, BUCK8 and BUCK9 can be configured to GPIO enable
control. To turn this feature on this property must be added to the regulator
sub-node:
- maxim,ena-gpios : one GPIO specifier enable control (the gpio
flags are actually ignored and always
ACTIVE_HIGH is used)

Example:

Expand All @@ -65,4 +71,12 @@ Example:
regulator-always-on;
regulator-boot-on;
};

buck9_reg {
regulator-compatible = "BUCK9";
regulator-name = "CAM_ISP_CORE_1.2V";
regulator-min-microvolt = <1000000>;
regulator-max-microvolt = <1200000>;
maxim,ena-gpios = <&gpm0 3 GPIO_ACTIVE_HIGH>;
};
}
4 changes: 2 additions & 2 deletions Documentation/devicetree/bindings/regulator/isl9305.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Intersil ISL9305/ISL9305H voltage regulator

Required properties:

- compatible: "isl,isl9305" or "isl,isl9305h"
- compatible: "isil,isl9305" or "isil,isl9305h"
- reg: I2C slave address, usually 0x68.
- regulators: A node that houses a sub-node for each regulator within the
device. Each sub-node is identified using the node's name, with valid
Expand All @@ -19,7 +19,7 @@ Optional properties:
Example

pmic: isl9305@68 {
compatible = "isl,isl9305";
compatible = "isil,isl9305";
reg = <0x68>;

VINDCD1-supply = <&system_power>;
Expand Down
8 changes: 8 additions & 0 deletions drivers/regulator/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,14 @@ config REGULATOR_MAX77802
Exynos5420/Exynos5800 SoCs to control various voltages.
It includes support for control of voltage and ramp speed.

config REGULATOR_MAX77843
tristate "Maxim 77843 regulator"
depends on MFD_MAX77843
help
This driver controls a Maxim 77843 regulator.
The regulator include two 'SAFEOUT' for USB(Universal Serial Bus)
This is suitable for Exynos5433 SoC chips.

config REGULATOR_MC13XXX_CORE
tristate

Expand Down
1 change: 1 addition & 0 deletions drivers/regulator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ obj-$(CONFIG_REGULATOR_MAX8998) += max8998.o
obj-$(CONFIG_REGULATOR_MAX77686) += max77686.o
obj-$(CONFIG_REGULATOR_MAX77693) += max77693.o
obj-$(CONFIG_REGULATOR_MAX77802) += max77802.o
obj-$(CONFIG_REGULATOR_MAX77843) += max77843.o
obj-$(CONFIG_REGULATOR_MC13783) += mc13783-regulator.o
obj-$(CONFIG_REGULATOR_MC13892) += mc13892-regulator.o
obj-$(CONFIG_REGULATOR_MC13XXX_CORE) += mc13xxx-regulator-core.o
Expand Down
6 changes: 4 additions & 2 deletions drivers/regulator/isl9305.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,10 @@ static int isl9305_i2c_probe(struct i2c_client *i2c,

#ifdef CONFIG_OF
static const struct of_device_id isl9305_dt_ids[] = {
{ .compatible = "isl,isl9305" },
{ .compatible = "isl,isl9305h" },
{ .compatible = "isl,isl9305" }, /* for backward compat., don't use */
{ .compatible = "isil,isl9305" },
{ .compatible = "isl,isl9305h" }, /* for backward compat., don't use */
{ .compatible = "isil,isl9305h" },
{},
};
#endif
Expand Down
24 changes: 5 additions & 19 deletions drivers/regulator/lp872x.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ struct lp872x {
struct device *dev;
enum lp872x_id chipid;
struct lp872x_platform_data *pdata;
struct regulator_dev **regulators;
int num_regulators;
enum lp872x_dvs_state dvs_pin;
int dvs_gpio;
Expand Down Expand Up @@ -801,8 +800,6 @@ static int lp872x_regulator_register(struct lp872x *lp)
dev_err(lp->dev, "regulator register err");
return PTR_ERR(rdev);
}

*(lp->regulators + i) = rdev;
}

return 0;
Expand Down Expand Up @@ -906,7 +903,7 @@ static struct lp872x_platform_data
static int lp872x_probe(struct i2c_client *cl, const struct i2c_device_id *id)
{
struct lp872x *lp;
int ret, size, num_regulators;
int ret;
const int lp872x_num_regulators[] = {
[LP8720] = LP8720_NUM_REGULATORS,
[LP8725] = LP8725_NUM_REGULATORS,
Expand All @@ -918,38 +915,27 @@ static int lp872x_probe(struct i2c_client *cl, const struct i2c_device_id *id)

lp = devm_kzalloc(&cl->dev, sizeof(struct lp872x), GFP_KERNEL);
if (!lp)
goto err_mem;

num_regulators = lp872x_num_regulators[id->driver_data];
size = sizeof(struct regulator_dev *) * num_regulators;
return -ENOMEM;

lp->regulators = devm_kzalloc(&cl->dev, size, GFP_KERNEL);
if (!lp->regulators)
goto err_mem;
lp->num_regulators = lp872x_num_regulators[id->driver_data];

lp->regmap = devm_regmap_init_i2c(cl, &lp872x_regmap_config);
if (IS_ERR(lp->regmap)) {
ret = PTR_ERR(lp->regmap);
dev_err(&cl->dev, "regmap init i2c err: %d\n", ret);
goto err_dev;
return ret;
}

lp->dev = &cl->dev;
lp->pdata = dev_get_platdata(&cl->dev);
lp->chipid = id->driver_data;
lp->num_regulators = num_regulators;
i2c_set_clientdata(cl, lp);

ret = lp872x_config(lp);
if (ret)
goto err_dev;
return ret;

return lp872x_regulator_register(lp);

err_mem:
return -ENOMEM;
err_dev:
return ret;
}

static const struct of_device_id lp872x_dt_ids[] = {
Expand Down
62 changes: 14 additions & 48 deletions drivers/regulator/max14577.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ static struct regulator_ops max14577_charger_ops = {
static const struct regulator_desc max14577_supported_regulators[] = {
[MAX14577_SAFEOUT] = {
.name = "SAFEOUT",
.of_match = of_match_ptr("SAFEOUT"),
.regulators_node = of_match_ptr("regulators"),
.id = MAX14577_SAFEOUT,
.ops = &max14577_safeout_ops,
.type = REGULATOR_VOLTAGE,
Expand All @@ -114,6 +116,8 @@ static const struct regulator_desc max14577_supported_regulators[] = {
},
[MAX14577_CHARGER] = {
.name = "CHARGER",
.of_match = of_match_ptr("CHARGER"),
.regulators_node = of_match_ptr("regulators"),
.id = MAX14577_CHARGER,
.ops = &max14577_charger_ops,
.type = REGULATOR_CURRENT,
Expand All @@ -137,6 +141,8 @@ static struct regulator_ops max77836_ldo_ops = {
static const struct regulator_desc max77836_supported_regulators[] = {
[MAX14577_SAFEOUT] = {
.name = "SAFEOUT",
.of_match = of_match_ptr("SAFEOUT"),
.regulators_node = of_match_ptr("regulators"),
.id = MAX14577_SAFEOUT,
.ops = &max14577_safeout_ops,
.type = REGULATOR_VOLTAGE,
Expand All @@ -148,6 +154,8 @@ static const struct regulator_desc max77836_supported_regulators[] = {
},
[MAX14577_CHARGER] = {
.name = "CHARGER",
.of_match = of_match_ptr("CHARGER"),
.regulators_node = of_match_ptr("regulators"),
.id = MAX14577_CHARGER,
.ops = &max14577_charger_ops,
.type = REGULATOR_CURRENT,
Expand All @@ -157,6 +165,8 @@ static const struct regulator_desc max77836_supported_regulators[] = {
},
[MAX77836_LDO1] = {
.name = "LDO1",
.of_match = of_match_ptr("LDO1"),
.regulators_node = of_match_ptr("regulators"),
.id = MAX77836_LDO1,
.ops = &max77836_ldo_ops,
.type = REGULATOR_VOLTAGE,
Expand All @@ -171,6 +181,8 @@ static const struct regulator_desc max77836_supported_regulators[] = {
},
[MAX77836_LDO2] = {
.name = "LDO2",
.of_match = of_match_ptr("LDO2"),
.regulators_node = of_match_ptr("regulators"),
.id = MAX77836_LDO2,
.ops = &max77836_ldo_ops,
.type = REGULATOR_VOLTAGE,
Expand Down Expand Up @@ -198,43 +210,6 @@ static struct of_regulator_match max77836_regulator_matches[] = {
{ .name = "LDO2", },
};

static int max14577_regulator_dt_parse_pdata(struct platform_device *pdev,
enum maxim_device_type dev_type)
{
int ret;
struct device_node *np;
struct of_regulator_match *regulator_matches;
unsigned int regulator_matches_size;

np = of_get_child_by_name(pdev->dev.parent->of_node, "regulators");
if (!np) {
dev_err(&pdev->dev, "Failed to get child OF node for regulators\n");
return -EINVAL;
}

switch (dev_type) {
case MAXIM_DEVICE_TYPE_MAX77836:
regulator_matches = max77836_regulator_matches;
regulator_matches_size = ARRAY_SIZE(max77836_regulator_matches);
break;
case MAXIM_DEVICE_TYPE_MAX14577:
default:
regulator_matches = max14577_regulator_matches;
regulator_matches_size = ARRAY_SIZE(max14577_regulator_matches);
}

ret = of_regulator_match(&pdev->dev, np, regulator_matches,
regulator_matches_size);
if (ret < 0)
dev_err(&pdev->dev, "Error parsing regulator init data: %d\n", ret);
else
ret = 0;

of_node_put(np);

return ret;
}

static inline struct regulator_init_data *match_init_data(int index,
enum maxim_device_type dev_type)
{
Expand All @@ -261,11 +236,6 @@ static inline struct device_node *match_of_node(int index,
}
}
#else /* CONFIG_OF */
static int max14577_regulator_dt_parse_pdata(struct platform_device *pdev,
enum maxim_device_type dev_type)
{
return 0;
}
static inline struct regulator_init_data *match_init_data(int index,
enum maxim_device_type dev_type)
{
Expand Down Expand Up @@ -308,16 +278,12 @@ static int max14577_regulator_probe(struct platform_device *pdev)
{
struct max14577 *max14577 = dev_get_drvdata(pdev->dev.parent);
struct max14577_platform_data *pdata = dev_get_platdata(max14577->dev);
int i, ret;
int i, ret = 0;
struct regulator_config config = {};
const struct regulator_desc *supported_regulators;
unsigned int supported_regulators_size;
enum maxim_device_type dev_type = max14577->dev_type;

ret = max14577_regulator_dt_parse_pdata(pdev, dev_type);
if (ret)
return ret;

switch (dev_type) {
case MAXIM_DEVICE_TYPE_MAX77836:
supported_regulators = max77836_supported_regulators;
Expand All @@ -329,7 +295,7 @@ static int max14577_regulator_probe(struct platform_device *pdev)
supported_regulators_size = ARRAY_SIZE(max14577_supported_regulators);
}

config.dev = &pdev->dev;
config.dev = max14577->dev;
config.driver_data = max14577;

for (i = 0; i < supported_regulators_size; i++) {
Expand Down
Loading

0 comments on commit f3ba729

Please sign in to comment.