Messages in this thread Patch in this message | | | From | Abhilash Kesavan <> | Subject | [RFC PATCH 2/3] regulator: max77686: Add support for various operating modes | Date | Mon, 10 Dec 2012 11:56:23 +0530 |
| |
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@samsung.com> --- 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(®ulators[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
| |