[RFC PATCH 2/3] regulator: max77686: Add support for various operatingmodes

From: Abhilash Kesavan
Date: Mon Dec 10 2012 - 01:20:21 EST


Currently, we cannot specify the regulator suspend state via device
tree. Add an optional operating mode property which can be used to
set initially the regulator mode.
We are currently bypassing the set_suspend_disable and set_suspend_mode
call-backs.

Signed-off-by: Abhilash Kesavan <a.kesavan@xxxxxxxxxxx>
---
drivers/regulator/max77686.c | 11 ++++++++++-
include/linux/mfd/max77686.h | 1 +
2 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/drivers/regulator/max77686.c b/drivers/regulator/max77686.c
index b85040c..7f16bc7 100644
--- a/drivers/regulator/max77686.c
+++ b/drivers/regulator/max77686.c
@@ -410,6 +410,12 @@ static int max77686_pmic_dt_parse_pdata(struct max77686_dev *iodev,
of_regulator_match(iodev->dev, regulators_np, &rmatch, 1);
rdata[i].initdata = rmatch.init_data;
rdata[i].of_node = rmatch.of_node;
+ if (of_property_read_u32(rdata[i].of_node, "max77686-opmode",
+ &rdata[i].opmode)) {
+ dev_warn(iodev->dev, "no op_mode property property at %s\n",
+ rmatch.name);
+ rdata[i].opmode = regulators[i].enable_mask;
+ }
}

pdata->regulators = rdata;
@@ -465,7 +471,10 @@ static int max77686_pmic_probe(struct platform_device *pdev)
config.init_data = pdata->regulators[i].initdata;
config.of_node = pdata->regulators[i].of_node;

- max77686->opmode[i] = regulators[i].enable_mask;
+ if (config.of_node)
+ max77686->opmode[i] = pdata->regulators[i].opmode;
+ else
+ max77686->opmode[i] = regulators[i].enable_mask;
max77686->rdev[i] = regulator_register(&regulators[i], &config);
if (IS_ERR(max77686->rdev[i])) {
ret = PTR_ERR(max77686->rdev[i]);
diff --git a/include/linux/mfd/max77686.h b/include/linux/mfd/max77686.h
index 46c0f32..e8bd83b 100644
--- a/include/linux/mfd/max77686.h
+++ b/include/linux/mfd/max77686.h
@@ -73,6 +73,7 @@ enum max77686_regulators {

struct max77686_regulator_data {
int id;
+ int opmode;
struct regulator_init_data *initdata;
struct device_node *of_node;
};
--
1.7.8.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/