Device tree support for regulators
Subsystems (8)
v5 cover Device tree support for regulators
v5 is based on 3.2-rc2 and has the following changes -1- Used microvolt/microamp in bindings instead of uV/uA -2- Added more documentation surrounding regulator-consumer mapping in the core bindings
-3- Dropped CONFIG_OF_REGULATOR and use just CONFIG_OF -4- Reused core regulator bindings on Fixed regulator bindings -5- Corrected the gpio binding for Fixed regulator
The patches can be found here:git://gitorious.org/omap-pm/linux.git for-dt/regulator
For the first 2 patches (1/4 and 2/4) I have dropped Acks from Mark, since they have changed to some extent from the last post and retained the Acks recieved on the last 2 patches (3/4 and 4/4) as they remain unchanged.
regards,
Rajendra
Rajendra Nayak (4):
regulator: helper routine to extract regulator_init_data
regulator: adapt fixed regulator driver to dt
regulator: pass additional of_node to regulator_register()
regulator: map consumer regulator based on device tree
.../bindings/regulator/fixed-regulator.txt | 29 +++++++ .../devicetree/bindings/regulator/regulator.txt | 54 +++++++++++++ drivers/regulator/88pm8607.c | 2 +- drivers/regulator/Makefile | 1 + drivers/regulator/aat2870-regulator.c | 2 +- drivers/regulator/ab3100.c | 2 +- drivers/regulator/ab8500.c | 2 +- drivers/regulator/ad5398.c | 2 +- drivers/regulator/bq24022.c | 2 +- drivers/regulator/core.c | 82 ++++++++++++++++--- drivers/regulator/da903x.c | 2 +- drivers/regulator/db8500-prcmu.c | 2 +- drivers/regulator/dummy.c | 2 +- drivers/regulator/fixed.c | 62 +++++++++++++++- drivers/regulator/isl6271a-regulator.c | 2 +- drivers/regulator/lp3971.c | 2 +- drivers/regulator/lp3972.c | 2 +- drivers/regulator/max1586.c | 2 +- drivers/regulator/max8649.c | 2 +- drivers/regulator/max8660.c | 2 +- drivers/regulator/max8925-regulator.c | 2 +- drivers/regulator/max8952.c | 2 +- drivers/regulator/max8997.c | 2 +- drivers/regulator/max8998.c | 2 +- drivers/regulator/mc13783-regulator.c | 2 +- drivers/regulator/mc13892-regulator.c | 2 +- drivers/regulator/of_regulator.c | 81 +++++++++++++++++++ drivers/regulator/pcap-regulator.c | 2 +- drivers/regulator/pcf50633-regulator.c | 2 +- drivers/regulator/tps6105x-regulator.c | 3 +- drivers/regulator/tps65023-regulator.c | 2 +- drivers/regulator/tps6507x-regulator.c | 2 +- drivers/regulator/tps6524x-regulator.c | 2 +- drivers/regulator/tps6586x-regulator.c | 2 +- drivers/regulator/tps65910-regulator.c | 2 +- drivers/regulator/tps65912-regulator.c | 2 +- drivers/regulator/twl-regulator.c | 2 +- drivers/regulator/wm831x-dcdc.c | 8 +- drivers/regulator/wm831x-isink.c | 2 +- drivers/regulator/wm831x-ldo.c | 6 +- drivers/regulator/wm8350-regulator.c | 2 +- drivers/regulator/wm8400-regulator.c | 2 +- drivers/regulator/wm8994-regulator.c | 2 +- include/linux/regulator/driver.h | 4 +- include/linux/regulator/of_regulator.h | 20 +++++ sound/soc/codecs/sgtl5000.c | 2 +- 46 files changed, 362 insertions(+), 58 deletions(-) create mode 100644 Documentation/devicetree/bindings/regulator/fixed-regulator.txt create mode 100644 Documentation/devicetree/bindings/regulator/regulator.txt create mode 100644 drivers/regulator/of_regulator.c create mode 100644 include/linux/regulator/of_regulator.h
PATCH v5 1/4 regulator: helper routine to extract regulator_init_data
The helper routine is meant to be used by the regulator drivers to extract the regulator_init_data structure from the data that is passed from device tree.
'consumer_supplies' which is part of regulator_init_data is not extracted as the regulator consumer mappings are passed through DT differently, implemented in subsequent patches.
Similarly the regulator<-->parent/supply mapping is handled in subsequent patches.
Also add documentation for regulator bindings to be used to pass regulator_init_data struct information from device tree.
Some of the regulator properties which are linux and board specific, are left out since its not clear if they can
be in someway embedded into the kernel or passed in from DT. They will be revisited later.
--- .../devicetree/bindings/regulator/regulator.txt | 54 +++++++++++++ drivers/regulator/Makefile | 1 + drivers/regulator/of_regulator.c | 81 ++++++++++++++++++++ include/linux/regulator/of_regulator.h | 20 +++++ 4 files changed, 156 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/regulator/regulator.txt create mode 100644 drivers/regulator/of_regulator.c create mode 100644 include/linux/regulator/of_regulator.h
Documentation/devicetree/bindings/regulator/regulator.txt new file +54 -0
@@ -0,0 +1,54 @@ +Voltage/Current Regulators + +Optional properties: +- regulator-name: A string used as a descriptive name for regulator outputs +- regulator-min-microvolt: smallest voltage consumers may set +- regulator-max-microvolt: largest voltage consumers may set +- regulator-microvolt-offset: Offset applied to voltages to compensate for voltage drops +- regulator-min-microamp: smallest current consumers may set +- regulator-max-microamp: largest current consumers may set +- regulator-always-on: boolean, regulator should never be disabled +- regulator-boot-on: bootloader/firmware enabled regulator +- <name>-supply: phandle to the parent supply/regulator node + +Example: + + xyzreg: regulator at 0 { + regulator-min-microvolt = <1000000>; + regulator-max-microvolt = <2500000>; + regulator-always-on; + vin-supply = <&vin>; + }; + +Regulator Consumers: +Consumer nodes can reference one or more of its supplies/ +regulators using the below bindings. + +- <name>-supply: phandle to the regulator node + +These are the same bindings that a regulator in the above +example used to reference its own supply, in which case +its just seen as a special case of a regulator being a +consumer itself. + +Example of a consumer device node (mmc) referencing two +regulators (twl-reg1 and twl-reg2), + + twl-reg1: regulator at 0 { + ... + ... + ... + }; + + twl-reg2: regulator at 1 { + ... + ... + ... + }; + + mmc: mmc at 0x0 { + ... + ... + vmmc-supply = <&twl-reg1>; + vmmcaux-supply = <&twl-reg2>; + };
drivers/regulator/Makefile +1 -0
@@ -4,6 +4,7 @@ obj-$(CONFIG_REGULATOR) += core.o dummy.o +obj-$(CONFIG_OF) += of_regulator.o obj-$(CONFIG_REGULATOR_FIXED_VOLTAGE) += fixed.o obj-$(CONFIG_REGULATOR_VIRTUAL_CONSUMER) += virtual.o obj-$(CONFIG_REGULATOR_USERSPACE_CONSUMER) += userspace-consumer.o
drivers/regulator/of_regulator.c new file +81 -0
81 lines not on this page · raw message
include/linux/regulator/of_regulator.h new file +20 -0
@@ -0,0 +1,20 @@ +/* +* OpenFirmware regulator support routines +* +*/ + +#ifndef __LINUX_OF_REG_H +#define __LINUX_OF_REG_H + +#if defined(CONFIG_OF ) +extern struct regulator_init_data + *of_get_regulator_init_data (struct device *dev); +#else +static inline struct regulator_init_data + *of_get_regulator_init_data (struct device *dev) +{ +return NULL ; +} +#endif /* CONFIG_OF */ + +#endif /* __LINUX_OF_REG_H */
Signature · 1 line
1.7.1
PATCH v5 2/4 regulator: adapt fixed regulator driver to dt
In reply to Rajendra NayakThe fixed regulator driver uses of_get_fixed_voltage_config() to extract fixed_voltage_config structure contents from device tree.
Also add documenation for additional bindings for fixed regulators that can be passed through dt.
--- .../bindings/regulator/fixed-regulator.txt | 29 +++++++++ drivers/regulator/fixed.c | 65 ++++++++++++++++++++ 2 files changed, 94 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/regulator/fixed-regulator.txt
Documentation/devicetree/bindings/regulator/fixed-regulator.txt new file +29 -0
@@ -0,0 +1,29 @@ +Fixed Voltage regulators + +Required properties: +- compatible: Must be "regulator-fixed"; + +Optional properties: +- gpio: gpio to use for enable control +- startup-delay-us: startup time in microseconds +- enable-active-high: Polarity of GPIO is Active high +If this property is missing, the default assumed is Active low. + +Any property defined as part of the core regulator +binding, defined in regulator.txt, can also be used. +However a fixed voltage regulator is expected to have the +regulator-min-microvolt and regulator-max-microvolt +to be the same. + +Example: + + abc: fixedregulator at 0 { + compatible = "regulator-fixed"; + regulator-name = "fixed-supply"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + gpio = <&gpio1 16 0>; + startup-delay-us = <70000>; + enable-active-high; + regulator-boot-on + };
drivers/regulator/fixed.c +65 -0
95 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH v5 3/4 regulator: pass additional of_node to regulator_register()
In reply to Rajendra NayakWith device tree support for regulators, its needed that the regulator_dev->dev device has the right of_node attached. To be able to do this add an additional parameter to the regulator_register() api, wherein the dt-adapted driver can then pass this additional info onto the regulator core.
--- drivers/regulator/88pm8607.c | 2 +- drivers/regulator/aat2870-regulator.c | 2 +- drivers/regulator/ab3100.c | 2 +- drivers/regulator/ab8500.c | 2 +- drivers/regulator/ad5398.c | 2 +- drivers/regulator/bq24022.c | 2 +- drivers/regulator/core.c | 3 ++- drivers/regulator/da903x.c | 2 +- drivers/regulator/db8500-prcmu.c | 2 +- drivers/regulator/dummy.c | 2 +- drivers/regulator/fixed.c | 2 +- drivers/regulator/isl6271a-regulator.c | 2 +- drivers/regulator/lp3971.c | 2 +- drivers/regulator/lp3972.c | 2 +- drivers/regulator/max1586.c | 2 +- drivers/regulator/max8649.c | 2 +- drivers/regulator/max8660.c | 2 +- drivers/regulator/max8925-regulator.c | 2 +- drivers/regulator/max8952.c | 2 +- drivers/regulator/max8997.c | 2 +- drivers/regulator/max8998.c | 2 +- drivers/regulator/mc13783-regulator.c | 2 +- drivers/regulator/mc13892-regulator.c | 2 +- drivers/regulator/pcap-regulator.c | 2 +- drivers/regulator/pcf50633-regulator.c | 2 +- drivers/regulator/tps6105x-regulator.c | 3 ++- drivers/regulator/tps65023-regulator.c | 2 +- drivers/regulator/tps6507x-regulator.c | 2 +- drivers/regulator/tps6524x-regulator.c | 2 +- drivers/regulator/tps6586x-regulator.c | 2 +- drivers/regulator/tps65910-regulator.c | 2 +- drivers/regulator/tps65912-regulator.c | 2 +- drivers/regulator/twl-regulator.c | 2 +- drivers/regulator/wm831x-dcdc.c | 8 ++++---- drivers/regulator/wm831x-isink.c | 2 +- drivers/regulator/wm831x-ldo.c | 6 +++--- drivers/regulator/wm8350-regulator.c | 2 +- drivers/regulator/wm8400-regulator.c | 2 +- drivers/regulator/wm8994-regulator.c | 2 +- include/linux/regulator/driver.h | 2 +- sound/soc/codecs/sgtl5000.c | 2 +- 41 files changed, 48 insertions(+), 46 deletions(-)
drivers/regulator/88pm8607.c +1 -1
@@ -427,7 +427,7 @@ static int __devinit pm8607_regulator_probe(struct platform_device *pdev)/* replace driver_data with info */ info->regulator =regulator_register (&info->desc, &pdev->dev, - pdata, info); + pdata, info,NULL );if (IS_ERR (info->regulator)) {dev_err (&pdev->dev,"failed to register regulator %s\n" , info->desc.name);
drivers/regulator/aat2870-regulator.c +1 -1
@@ -188,7 +188,7 @@ static int aat2870_regulator_probe(struct platform_device *pdev) ri->pdev = pdev; rdev =regulator_register (&ri->desc, &pdev->dev, - pdev->dev.platform_data, ri); + pdev->dev.platform_data, ri,NULL );if (IS_ERR (rdev)) {dev_err (&pdev->dev,"Failed to register regulator %s\n" , ri->desc.name);
drivers/regulator/ab3100.c +1 -1
@@ -634,7 +634,7 @@ static int __devinit ab3100_regulators_probe(struct platform_device *pdev) rdev =regulator_register (&ab3100_regulator_desc[i], &pdev->dev, &plfdata->reg_constraints[i], - reg); + reg,NULL );if (IS_ERR (rdev)) { err =PTR_ERR (rdev);
drivers/regulator/ab8500.c +1 -1
@@ -822,7 +822,7 @@ static __devinit int ab8500_regulator_probe(struct platform_device *pdev)/* register regulator with framework */ info->regulator =regulator_register (&info->desc, &pdev->dev, - &pdata->regulator[i], info); + &pdata->regulator[i], info,NULL );if (IS_ERR (info->regulator)) { err =PTR_ERR (info->regulator); dev_err(&pdev->dev, "failed to register regulator %s\n",
drivers/regulator/ad5398.c +1 -1
@@ -233,7 +233,7 @@ static int __devinit ad5398_probe(struct i2c_client *client, chip->current_mask = (chip->current_level -1 ) << chip->current_offset; chip->rdev =regulator_register (&ad5398_reg, &client->dev, - init_data, chip); + init_data, chip,NULL );if (IS_ERR (chip->rdev)) { ret =PTR_ERR (chip->rdev); dev_err(&client->dev, "failed to register %s %s\n",
drivers/regulator/bq24022.c +1 -1
@@ -107,7 +107,7 @@ static int __init bq24022_probe(struct platform_device *pdev) ret =gpio_direction_output (pdata->gpio_nce,1 ); bq24022 =regulator_register (&bq24022_desc, &pdev->dev, - pdata->init_data, pdata); + pdata->init_data, pdata,NULL );if (IS_ERR (bq24022)) {dev_dbg (&pdev->dev,"couldn't register regulator\n" ); ret =PTR_ERR (bq24022);
drivers/regulator/core.c +2 -1
@@ -2637,7 +2637,7 @@ static void rdev_init_debugfs(struct regulator_dev *rdev)*/ struct regulator_dev *regulator_register (struct regulator_desc *regulator_desc,struct device *dev,const struct regulator_init_data *init_data, -void *driver_data) +void *driver_data,struct device_node *of_node) {static atomic_t regulator_no =ATOMIC_INIT (0 );struct regulator_dev *rdev;
@@ -2696,6 +2696,7 @@ struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc,/* register with sysfs */ rdev->dev.class = ®ulator_class; + rdev->dev.of_node = of_node; rdev->dev.parent = dev;dev_set_name (&rdev->dev,"regulator.%d" ,atomic_inc_return (®ulator_no) -1 );
drivers/regulator/da903x.c +1 -1
@@ -537,7 +537,7 @@ static int __devinit da903x_regulator_probe(struct platform_device *pdev) ri->desc.ops = &da9030_regulator_ldo1_15_ops; rdev =regulator_register (&ri->desc, &pdev->dev, - pdev->dev.platform_data, ri); + pdev->dev.platform_data, ri,NULL );if (IS_ERR (rdev)) {dev_err (&pdev->dev,"failed to register regulator %s\n" , ri->desc.name);
drivers/regulator/db8500-prcmu.c +1 -1
@@ -486,7 +486,7 @@ static int __devinit db8500_regulator_probe(struct platform_device *pdev)/* register with the regulator framework */ info->rdev =regulator_register (&info->desc, &pdev->dev, - init_data, info); + init_data, info,NULL );if (IS_ERR (info->rdev)) { err =PTR_ERR (info->rdev); dev_err(&pdev->dev, "failed to register %s: err %i\n",
drivers/regulator/dummy.c +1 -1
@@ -42,7 +42,7 @@ static int __devinit dummy_regulator_probe(struct platform_device *pdev)int ret; dummy_regulator_rdev =regulator_register (&dummy_desc,NULL , - &dummy_initdata,NULL ); + &dummy_initdata,NULL ,NULL );if (IS_ERR (dummy_regulator_rdev)) { ret =PTR_ERR (dummy_regulator_rdev);pr_err ("Failed to register regulator: %d\n" , ret);
drivers/regulator/fixed.c +1 -1
@@ -234,7 +234,7 @@ static int __devinit reg_fixed_voltage_probe(struct platform_device *pdev) } drvdata->dev =regulator_register (&drvdata->desc, &pdev->dev, - config->init_data, drvdata); + config->init_data, drvdata,NULL );if (IS_ERR (drvdata->dev)) { ret =PTR_ERR (drvdata->dev);dev_err (&pdev->dev,"Failed to register regulator: %d\n" , ret);
drivers/regulator/isl6271a-regulator.c +1 -1
@@ -170,7 +170,7 @@ static int __devinit isl6271a_probe(struct i2c_client *i2c,for (i =0 ; i <3 ; i++) { pmic->rdev[i] =regulator_register (&isl_rd[i], &i2c->dev, - init_data, pmic); + init_data, pmic,NULL );if (IS_ERR (pmic->rdev[i])) {dev_err (&i2c->dev,"failed to register %s\n" , id->name); err =PTR_ERR (pmic->rdev[i]);
drivers/regulator/lp3971.c +1 -1
@@ -451,7 +451,7 @@ static int __devinit setup_regulators(struct lp3971 *lp3971,for (i =0 ; i < pdata->num_regulators; i++) {struct lp3971_regulator_subdev *reg = &pdata->regulators[i]; lp3971->rdev[i] =regulator_register (®ulators[reg->id], - lp3971->dev, reg->initdata, lp3971); + lp3971->dev, reg->initdata, lp3971,NULL );if (IS_ERR (lp3971->rdev[i])) { err =PTR_ERR (lp3971->rdev[i]);
drivers/regulator/lp3972.c +1 -1
@@ -555,7 +555,7 @@ static int __devinit setup_regulators(struct lp3972 *lp3972,for (i =0 ; i < pdata->num_regulators; i++) {struct lp3972_regulator_subdev *reg = &pdata->regulators[i]; lp3972->rdev[i] =regulator_register (®ulators[reg->id], - lp3972->dev, reg->initdata, lp3972); + lp3972->dev, reg->initdata, lp3972,NULL );if (IS_ERR (lp3972->rdev[i])) { err =PTR_ERR (lp3972->rdev[i]);
drivers/regulator/max1586.c +1 -1
@@ -214,7 +214,7 @@ static int __devinit max1586_pmic_probe(struct i2c_client *client, } rdev[i] =regulator_register (&max1586_reg[id], &client->dev, pdata->subdevs[i].platform_data, - max1586); + max1586,NULL );if (IS_ERR (rdev[i])) { ret =PTR_ERR (rdev[i]); dev_err(&client->dev, "failed to register %s\n",
drivers/regulator/max8649.c +1 -1
@@ -347,7 +347,7 @@ static int __devinit max8649_regulator_probe(struct i2c_client *client, } info->regulator =regulator_register (&dcdc_desc, &client->dev, - pdata->regulator, info); + pdata->regulator, info,NULL );if (IS_ERR (info->regulator)) {dev_err (info->dev,"failed to register regulator %s\n" , dcdc_desc.name);
drivers/regulator/max8660.c +1 -1
@@ -449,7 +449,7 @@ static int __devinit max8660_probe(struct i2c_client *client, rdev[i] =regulator_register (&max8660_reg[id], &client->dev, pdata->subdevs[i].platform_data, - max8660); + max8660,NULL );if (IS_ERR (rdev[i])) { ret =PTR_ERR (rdev[i]); dev_err(&client->dev, "failed to register %s\n",
drivers/regulator/max8925-regulator.c +1 -1
@@ -266,7 +266,7 @@ static int __devinit max8925_regulator_probe(struct platform_device *pdev) ri->chip = chip; rdev =regulator_register (&ri->desc, &pdev->dev, - pdata->regulator[pdev->id], ri); + pdata->regulator[pdev->id], ri,NULL );if (IS_ERR (rdev)) {dev_err (&pdev->dev,"failed to register regulator %s\n" , ri->desc.name);
drivers/regulator/max8952.c +1 -1
@@ -208,7 +208,7 @@ static int __devinit max8952_pmic_probe(struct i2c_client *client, max8952->pdata = pdata; max8952->rdev =regulator_register (®ulator, max8952->dev, - &pdata->reg_data, max8952); + &pdata->reg_data, max8952,NULL );if (IS_ERR (max8952->rdev)) { ret =PTR_ERR (max8952->rdev);
drivers/regulator/max8997.c +1 -1
@@ -1146,7 +1146,7 @@ static __devinit int max8997_pmic_probe(struct platform_device *pdev) regulators[id].n_voltages =16 ; rdev[i] =regulator_register (®ulators[id], max8997->dev, - pdata->regulators[i].initdata, max8997); + pdata->regulators[i].initdata, max8997,NULL );if (IS_ERR (rdev[i])) { ret =PTR_ERR (rdev[i]); dev_err(max8997->dev, "regulator init failed for %d\n",
drivers/regulator/max8998.c +1 -1
@@ -847,7 +847,7 @@ static __devinit int max8998_pmic_probe(struct platform_device *pdev) regulators[index].n_voltages = count; } rdev[i] =regulator_register (®ulators[index], max8998->dev, - pdata->regulators[i].initdata, max8998); + pdata->regulators[i].initdata, max8998,NULL );if (IS_ERR (rdev[i])) { ret =PTR_ERR (rdev[i]);dev_err (max8998->dev,"regulator init failed\n" );
drivers/regulator/mc13783-regulator.c +1 -1
@@ -357,7 +357,7 @@ static int __devinit mc13783_regulator_probe(struct platform_device *pdev) init_data = &pdata->regulators[i]; priv->regulators[i] =regulator_register ( &mc13783_regulators[init_data->id].desc, - &pdev->dev, init_data->init_data, priv); + &pdev->dev, init_data->init_data, priv,NULL );if (IS_ERR (priv->regulators[i])) { dev_err(&pdev->dev, "failed to register regulator %s\n",
drivers/regulator/mc13892-regulator.c +1 -1
@@ -573,7 +573,7 @@ static int __devinit mc13892_regulator_probe(struct platform_device *pdev) init_data = &pdata->regulators[i]; priv->regulators[i] =regulator_register ( &mc13892_regulators[init_data->id].desc, - &pdev->dev, init_data->init_data, priv); + &pdev->dev, init_data->init_data, priv,NULL );if (IS_ERR (priv->regulators[i])) { dev_err(&pdev->dev, "failed to register regulator %s\n",
drivers/regulator/pcap-regulator.c +1 -1
@@ -277,7 +277,7 @@ static int __devinit pcap_regulator_probe(struct platform_device *pdev)void *pcap =dev_get_drvdata (pdev->dev.parent); rdev =regulator_register (&pcap_regulators[pdev->id], &pdev->dev, - pdev->dev.platform_data, pcap); + pdev->dev.platform_data, pcap,NULL );if (IS_ERR (rdev))return PTR_ERR (rdev);
drivers/regulator/pcf50633-regulator.c +1 -1
@@ -320,7 +320,7 @@ static int __devinit pcf50633_regulator_probe(struct platform_device *pdev) pcf =dev_to_pcf50633 (pdev->dev.parent); rdev =regulator_register (®ulators[pdev->id], &pdev->dev, - pdev->dev.platform_data, pcf); + pdev->dev.platform_data, pcf,NULL );if (IS_ERR (rdev))return PTR_ERR (rdev);
drivers/regulator/tps6105x-regulator.c +2 -1
@@ -151,7 +151,8 @@ static int __devinit tps6105x_regulator_probe(struct platform_device *pdev)/* Register regulator with framework */ tps6105x->regulator =regulator_register (&tps6105x_regulator_desc, &tps6105x->client->dev, - pdata->regulator_data, tps6105x); + pdata->regulator_data, tps6105x, +NULL );if (IS_ERR (tps6105x->regulator)) { ret =PTR_ERR (tps6105x->regulator); dev_err(&tps6105x->client->dev,
drivers/regulator/tps65023-regulator.c +1 -1
@@ -496,7 +496,7 @@ static int __devinit tps_65023_probe(struct i2c_client *client,/* Register the regulators */ rdev =regulator_register (&tps->desc[i], &client->dev, - init_data, tps); + init_data, tps,NULL );if (IS_ERR (rdev)) {dev_err (&client->dev,"failed to register %s\n" , id->name);
drivers/regulator/tps6507x-regulator.c +1 -1
@@ -599,7 +599,7 @@ int tps6507x_pmic_probe(struct platform_device *pdev) tps->desc[i].owner =THIS_MODULE ; rdev =regulator_register (&tps->desc[i], - tps6507x_dev->dev, init_data, tps); + tps6507x_dev->dev, init_data, tps,NULL );if (IS_ERR (rdev)) { dev_err(tps6507x_dev->dev, "failed to register %s regulator\n",
drivers/regulator/tps6524x-regulator.c +1 -1
@@ -651,7 +651,7 @@ static int __devinit pmic_probe(struct spi_device *spi) hw->desc[i].n_voltages =1 ; hw->rdev[i] =regulator_register (&hw->desc[i], dev, - init_data, hw); + init_data, hw,NULL );if (IS_ERR (hw->rdev[i])) { ret =PTR_ERR (hw->rdev[i]); hw->rdev[i] =NULL ;
drivers/regulator/tps6586x-regulator.c +1 -1
@@ -396,7 +396,7 @@ static int __devinit tps6586x_regulator_probe(struct platform_device *pdev)return err; rdev =regulator_register (&ri->desc, &pdev->dev, - pdev->dev.platform_data, ri); + pdev->dev.platform_data, ri,NULL );if (IS_ERR (rdev)) {dev_err (&pdev->dev,"failed to register regulator %s\n" , ri->desc.name);
drivers/regulator/tps65910-regulator.c +1 -1
@@ -963,7 +963,7 @@ static __devinit int tps65910_probe(struct platform_device *pdev) pmic->desc[i].owner =THIS_MODULE ; rdev =regulator_register (&pmic->desc[i], - tps65910->dev, reg_data, pmic); + tps65910->dev, reg_data, pmic,NULL );if (IS_ERR (rdev)) { dev_err(tps65910->dev, "failed to register %s regulator\n",
drivers/regulator/tps65912-regulator.c +1 -1
@@ -727,7 +727,7 @@ static __devinit int tps65912_probe(struct platform_device *pdev) pmic->desc[i].owner =THIS_MODULE ; range =tps65912_get_range (pmic, i); rdev =regulator_register (&pmic->desc[i], - tps65912->dev, reg_data, pmic); + tps65912->dev, reg_data, pmic,NULL );if (IS_ERR (rdev)) { dev_err(tps65912->dev, "failed to register %s regulator\n",
drivers/regulator/twl-regulator.c +1 -1
@@ -1070,7 +1070,7 @@ static int __devinit twlreg_probe(struct platform_device *pdev)break ; } - rdev =regulator_register (&info->desc, &pdev->dev, initdata, info); + rdev =regulator_register (&info->desc, &pdev->dev, initdata, info,NULL );if (IS_ERR (rdev)) {dev_err (&pdev->dev,"can't register %s, %ld\n" , info->desc.name,PTR_ERR (rdev));
drivers/regulator/wm831x-dcdc.c +4 -4
@@ -553,7 +553,7 @@ static __devinit int wm831x_buckv_probe(struct platform_device *pdev)wm831x_buckv_dvs_init (dcdc, pdata->dcdc[id]->driver_data); dcdc->regulator =regulator_register (&dcdc->desc, &pdev->dev, - pdata->dcdc[id], dcdc); + pdata->dcdc[id], dcdc,NULL );if (IS_ERR (dcdc->regulator)) { ret =PTR_ERR (dcdc->regulator); dev_err(wm831x->dev, "Failed to register DCDC%d: %d\n",
@@ -747,7 +747,7 @@ static __devinit int wm831x_buckp_probe(struct platform_device *pdev) dcdc->desc.owner =THIS_MODULE ; dcdc->regulator =regulator_register (&dcdc->desc, &pdev->dev, - pdata->dcdc[id], dcdc); + pdata->dcdc[id], dcdc,NULL );if (IS_ERR (dcdc->regulator)) { ret =PTR_ERR (dcdc->regulator); dev_err(wm831x->dev, "Failed to register DCDC%d: %d\n",
@@ -874,7 +874,7 @@ static __devinit int wm831x_boostp_probe(struct platform_device *pdev) dcdc->desc.owner =THIS_MODULE ; dcdc->regulator =regulator_register (&dcdc->desc, &pdev->dev, - pdata->dcdc[id], dcdc); + pdata->dcdc[id], dcdc,NULL );if (IS_ERR (dcdc->regulator)) { ret =PTR_ERR (dcdc->regulator); dev_err(wm831x->dev, "Failed to register DCDC%d: %d\n",
@@ -973,7 +973,7 @@ static __devinit int wm831x_epe_probe(struct platform_device *pdev) dcdc->desc.owner =THIS_MODULE ; dcdc->regulator =regulator_register (&dcdc->desc, &pdev->dev, - pdata->epe[id], dcdc); + pdata->epe[id], dcdc,NULL );if (IS_ERR (dcdc->regulator)) { ret =PTR_ERR (dcdc->regulator); dev_err(wm831x->dev, "Failed to register EPE%d: %d\n",
drivers/regulator/wm831x-isink.c +1 -1
@@ -189,7 +189,7 @@ static __devinit int wm831x_isink_probe(struct platform_device *pdev) isink->desc.owner =THIS_MODULE ; isink->regulator =regulator_register (&isink->desc, &pdev->dev, - pdata->isink[id], isink); + pdata->isink[id], isink,NULL );if (IS_ERR (isink->regulator)) { ret =PTR_ERR (isink->regulator); dev_err(wm831x->dev, "Failed to register ISINK%d: %d\n",
drivers/regulator/wm831x-ldo.c +3 -3
@@ -351,7 +351,7 @@ static __devinit int wm831x_gp_ldo_probe(struct platform_device *pdev) ldo->desc.owner =THIS_MODULE ; ldo->regulator =regulator_register (&ldo->desc, &pdev->dev, - pdata->ldo[id], ldo); + pdata->ldo[id], ldo,NULL );if (IS_ERR (ldo->regulator)) { ret =PTR_ERR (ldo->regulator); dev_err(wm831x->dev, "Failed to register LDO%d: %d\n",
@@ -621,7 +621,7 @@ static __devinit int wm831x_aldo_probe(struct platform_device *pdev) ldo->desc.owner =THIS_MODULE ; ldo->regulator =regulator_register (&ldo->desc, &pdev->dev, - pdata->ldo[id], ldo); + pdata->ldo[id], ldo,NULL );if (IS_ERR (ldo->regulator)) { ret =PTR_ERR (ldo->regulator); dev_err(wm831x->dev, "Failed to register LDO%d: %d\n",
@@ -818,7 +818,7 @@ static __devinit int wm831x_alive_ldo_probe(struct platform_device *pdev) ldo->desc.owner =THIS_MODULE ; ldo->regulator =regulator_register (&ldo->desc, &pdev->dev, - pdata->ldo[id], ldo); + pdata->ldo[id], ldo,NULL );if (IS_ERR (ldo->regulator)) { ret =PTR_ERR (ldo->regulator); dev_err(wm831x->dev, "Failed to register LDO%d: %d\n",
drivers/regulator/wm8350-regulator.c +1 -1
@@ -1428,7 +1428,7 @@ static int wm8350_regulator_probe(struct platform_device *pdev)/* register regulator */ rdev =regulator_register (&wm8350_reg[pdev->id], &pdev->dev, pdev->dev.platform_data, -dev_get_drvdata (&pdev->dev)); +dev_get_drvdata (&pdev->dev),NULL );if (IS_ERR (rdev)) {dev_err (&pdev->dev,"failed to register %s\n" , wm8350_reg[pdev->id].name);
drivers/regulator/wm8400-regulator.c +1 -1
@@ -326,7 +326,7 @@ static int __devinit wm8400_regulator_probe(struct platform_device *pdev)struct regulator_dev *rdev; rdev =regulator_register (®ulators[pdev->id], &pdev->dev, - pdev->dev.platform_data, wm8400); + pdev->dev.platform_data, wm8400,NULL );if (IS_ERR (rdev))return PTR_ERR (rdev);
drivers/regulator/wm8994-regulator.c +1 -1
@@ -269,7 +269,7 @@ static __devinit int wm8994_ldo_probe(struct platform_device *pdev) ldo->is_enabled = true; ldo->regulator =regulator_register (&wm8994_ldo_desc[id], &pdev->dev, - pdata->ldo[id].init_data, ldo); + pdata->ldo[id].init_data, ldo,NULL );if (IS_ERR (ldo->regulator)) { ret =PTR_ERR (ldo->regulator); dev_err(wm8994->dev, "Failed to register LDO%d: %d\n",
include/linux/regulator/driver.h +1 -1
@@ -212,7 +212,7 @@ struct regulator_dev {struct regulator_dev *regulator_register (struct regulator_desc *regulator_desc,struct device *dev,const struct regulator_init_data *init_data, -void *driver_data); +void *driver_data,struct device_node *of_node);void regulator_unregister (struct regulator_dev *rdev); int regulator_notifier_call_chain(struct regulator_dev *rdev,
sound/soc/codecs/sgtl5000.c +1 -1
@@ -833,7 +833,7 @@ static int ldo_regulator_register(struct snd_soc_codec *codec, ldo->voltage = voltage; ldo->dev =regulator_register (&ldo->desc, codec->dev, - init_data, ldo); + init_data, ldo,NULL );if (IS_ERR (ldo->dev)) {int ret =PTR_ERR (ldo->dev);
Signature · 1 line
1.7.1
PATCH v5 4/4 regulator: map consumer regulator based on device tree
In reply to Rajendra NayakDevice nodes in DT can associate themselves with one or more regulators/supply by providing a list of phandles (to regulator nodes) and corresponding supply names.
For Example:
devicenode: node at 0x0 {
...
...
vmmc-supply = <®ulator1>;
vpll-supply = <®ulator2>;
};The driver would then do a regulator_get(dev, "vmmc"); to get regulator1 and do a regulator_get(dev, "vpll"); to get regulator2.
of_get_regulator() extracts the regulator node for a given device, based on the supply name.
Use it to look up the regulator for a given consumer from device tree, during a regulator_get(). If not found fallback and lookup through
the regulator_map_list instead.
Also, since the regulator dt nodes can use the same binding to associate with a parent regulator/supply, allow the drivers to specify a supply_name, which can then be used to lookup dt to find the parent phandle.
--- drivers/regulator/core.c | 79 ++++++++++++++++++++++++++++++++------ include/linux/regulator/driver.h | 2 + 2 files changed, 69 insertions(+), 12 deletions(-)
drivers/regulator/core.c +67 -12
@@ -25,6 +25,8 @@#include <linux/mutex.h> #include <linux/suspend.h> #include <linux/delay.h> +#include <linux/of.h> +#include <linux/regulator/of_regulator.h> #include <linux/regulator/consumer.h> #include <linux/regulator/driver.h> #include <linux/regulator/machine.h>
@@ -132,6 +134,33 @@ static struct regulator *get_device_regulator(struct device *dev)return NULL ; } +/** +* of_get_regulator - get a regulator device node based on supply name +* @dev: Device pointer for the consumer (of regulator) device +* @supply: regulator supply name +* +* Extract the regulator device node corresponding to the supply name. +* retruns the device node corresponding to the regulator if found, else +* returns NULL. +*/ +static struct device_node *of_get_regulator (struct device *dev,const char *supply) +{ +struct device_node *regnode =NULL ; +char prop_name[32 ];/* 32 is max size of property name */ + +dev_dbg (dev,"Looking up %s-supply from device tree\n" , supply); + +snprintf (prop_name,32 ,"%s-supply" , supply); + regnode =of_parse_phandle (dev->of_node, prop_name,0 ); + +if (!regnode) { +dev_warn (dev,"%s property in node %s references invalid phandle" , + prop_name, dev->of_node->full_name); +return NULL ; + } +return regnode; +} +/* Platform voltage constraint check */ static int regulator_check_voltage (struct regulator_dev *rdev,int *min_uV,int *max_uV)
@@ -1148,6 +1177,30 @@ static int _regulator_get_enable_time(struct regulator_dev *rdev)return rdev->desc->ops->enable_time (rdev); } +static struct regulator_dev *regulator_dev_lookup (struct device *dev, +const char *supply) +{ +struct regulator_dev *r; +struct device_node *node; + +/* first do a dt based lookup */ +if (dev && dev->of_node) { + node =of_get_regulator (dev, supply); +if (node) +list_for_each_entry (r, ®ulator_list, list) +if (r->dev.parent && + node == r->dev.of_node) +return r; + } + +/* if not found, try doing it non-dt way */ +list_for_each_entry (r, ®ulator_list, list) +if (strcmp (rdev_get_name (r), supply) ==0 ) +return r; + +return NULL ; +} +/* Internal regulator request function */ static struct regulator *_regulator_get (struct device *dev,const char *id,int exclusive)
@@ -1168,6 +1221,10 @@ static struct regulator *_regulator_get(struct device *dev, const char *id,mutex_lock (®ulator_list_mutex); + rdev =regulator_dev_lookup (dev, id); +if (rdev) + goto found; +list_for_each_entry (map, ®ulator_map_list, list) {/* If the mapping has a device set up it must match */ if (map->dev_name &&
@@ -2642,6 +2699,7 @@ struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc,static atomic_t regulator_no =ATOMIC_INIT (0 );struct regulator_dev *rdev;int ret, i; +const char *supply =NULL ;if (regulator_desc ==NULL )return ERR_PTR (-EINVAL );
@@ -2718,21 +2776,18 @@ struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc,if (ret <0 ) goto scrub; -if (init_data->supply_regulator) { +if (init_data->supply_regulator) + supply = init_data->supply_regulator; +else if (regulator_desc->supply_name) + supply = regulator_desc->supply_name; + +if (supply) {struct regulator_dev *r; -int found =0 ; -list_for_each_entry (r, ®ulator_list, list) { -if (strcmp (rdev_get_name (r), - init_data->supply_regulator) ==0 ) { - found =1 ; -break ; - } - } + r =regulator_dev_lookup (dev, supply); -if (!found) { -dev_err (dev,"Failed to find supply %s\n" , - init_data->supply_regulator); +if (!r) { +dev_err (dev,"Failed to find supply %s\n" , supply); ret = -ENODEV ; goto scrub; }
include/linux/regulator/driver.h +2 -0
@@ -154,6 +154,7 @@ enum regulator_type {* this type. * * @name: Identifying name for the regulator. +* @supply_name: Identifying the regulator supply * @id: Numerical identifier for the regulator. * @n_voltages: Number of selectors available for ops.list_voltage(). * @ops: Regulator operations table.
@@ -163,6 +164,7 @@ enum regulator_type {*/ struct regulator_desc {const char *name; +const char *supply_name;int id;unsigned n_voltages;struct regulator_ops *ops;
Signature · 1 line
1.7.1
Re: [PATCH v5 4/4] regulator: map consumer regulator based on device tree
drivers/regulator/core.c static struct regulator *get_device_regulator(struct device *dev) · line 149
Quoted 2 lines · Rajendra Nayak
drivers/regulator/core.c +2
-0+struct device_node *regnode =NULL ; +char prop_name[32 ];/* 32 is max size of property name */
There ought to be a #define for that though I can't see one right now - this can't be the only place where we need to do stuff like this.
drivers/regulator/core.c static struct regulator *get_device_regulator(struct device *dev) · line 153
Quoted 4 lines
drivers/regulator/core.c +4
-0+ +dev_dbg (dev,"Looking up %s-supply from device tree\n" , supply); + +snprintf (prop_name,32 ,"%s-supply" , supply);
sizeof().
Quoted 4 lines · Rajendra Nayak
For the first 2 patches (1/4 and 2/4) I have dropped Acks from Mark, since they have changed to some extent from the last post and retained the Acks recieved on the last 2 patches (3/4 and 4/4) as they remain unchanged.
Looks good and nobody complained yet so I've dropped this into -next to get it a bit of exposure. I'm reasonably happy that the DT people have already had a good chance to look at this stuff on previous iterations. Unless there's any major changes or we need to back it out later on for some other reason please send incremental patches.
Re: [PATCH v5 3/4] regulator: pass additional of_node to regulator_register()
In reply to Rajendra NayakHi Rajendra,
Quoted 58 lines · Rajendra Nayak
With device tree support for regulators, its needed that the
regulator_dev->devdevice has the rightof_nodeattached. To be able to do this add an additional parameter to theregulator_register()api, wherein the dt-adapted driver can then pass this additional info onto the regulator core.Signed-off-by Rajendra Nayak <[email protected]>Acked-by Mark Brown <[email protected]>Cc Michael Hennerich <[email protected]>Cc Ian Lartey <[email protected]>Cc Dimitris Papastamos <[email protected]>Cc Jaroslav Kysela <[email protected]>Cc Takashi Iwai <[email protected]>Cc Wolfram Sang <[email protected]>Cc Zeng Zhaoming <[email protected]>Cc Dan Carpenter <[email protected]>---
?drivers/regulator/88pm8607.c ? ? ? ? ? | ? ?2 +- ?drivers/regulator/aat2870-regulator.c ?| ? ?2 +- ?drivers/regulator/ab3100.c ? ? ? ? ? ? | ? ?2 +- ?drivers/regulator/ab8500.c ? ? ? ? ? ? | ? ?2 +- ?drivers/regulator/ad5398.c ? ? ? ? ? ? | ? ?2 +- ?drivers/regulator/bq24022.c ? ? ? ? ? ?| ? ?2 +- ?drivers/regulator/core.c ? ? ? ? ? ? ? | ? ?3 ++- ?drivers/regulator/da903x.c ? ? ? ? ? ? | ? ?2 +- ?drivers/regulator/db8500-prcmu.c ? ? ? | ? ?2 +- ?drivers/regulator/dummy.c ? ? ? ? ? ? ?| ? ?2 +- ?drivers/regulator/fixed.c ? ? ? ? ? ? ?| ? ?2 +- ?drivers/regulator/isl6271a-regulator.c | ? ?2 +- ?drivers/regulator/lp3971.c ? ? ? ? ? ? | ? ?2 +- ?drivers/regulator/lp3972.c ? ? ? ? ? ? | ? ?2 +- ?drivers/regulator/max1586.c ? ? ? ? ? ?| ? ?2 +- ?drivers/regulator/max8649.c ? ? ? ? ? ?| ? ?2 +- ?drivers/regulator/max8660.c ? ? ? ? ? ?| ? ?2 +- ?drivers/regulator/max8925-regulator.c ?| ? ?2 +- ?drivers/regulator/max8952.c ? ? ? ? ? ?| ? ?2 +- ?drivers/regulator/max8997.c ? ? ? ? ? ?| ? ?2 +- ?drivers/regulator/max8998.c ? ? ? ? ? ?| ? ?2 +- ?drivers/regulator/mc13783-regulator.c ?| ? ?2 +- ?drivers/regulator/mc13892-regulator.c ?| ? ?2 +- ?drivers/regulator/pcap-regulator.c ? ? | ? ?2 +- ?drivers/regulator/pcf50633-regulator.c | ? ?2 +- ?drivers/regulator/tps6105x-regulator.c | ? ?3 ++- ?drivers/regulator/tps65023-regulator.c | ? ?2 +- ?drivers/regulator/tps6507x-regulator.c | ? ?2 +- ?drivers/regulator/tps6524x-regulator.c | ? ?2 +- ?drivers/regulator/tps6586x-regulator.c | ? ?2 +- ?drivers/regulator/tps65910-regulator.c | ? ?2 +- ?drivers/regulator/tps65912-regulator.c | ? ?2 +- ?drivers/regulator/twl-regulator.c ? ? ?| ? ?2 +- ?drivers/regulator/wm831x-dcdc.c ? ? ? ?| ? ?8 ++++---- ?drivers/regulator/wm831x-isink.c ? ? ? | ? ?2 +- ?drivers/regulator/wm831x-ldo.c ? ? ? ? | ? ?6 +++--- ?drivers/regulator/wm8350-regulator.c ? | ? ?2 +- ?drivers/regulator/wm8400-regulator.c ? | ? ?2 +- ?drivers/regulator/wm8994-regulator.c ? | ? ?2 +- ?include/linux/regulator/driver.h ? ? ? | ? ?2 +- ?sound/soc/codecs/sgtl5000.c ? ? ? ? ? ?| ? ?2 +-
Quoted 1 line
?41 files changed, 48 insertions(+), 46 deletions(-)
Documentation/power/regulator/regulator.txt would also require an update the reflect the change in api.
Thanks,
Thomas.
[...]
Re: [PATCH v5 1/4] regulator: helper routine to extract regulator_init_data
In reply to Rajendra NayakQuoted 36 lines · Rajendra Nayak
The helper routine is meant to be used by the regulator drivers to extract the
regulator_init_datastructure from the data that is passed from device tree.
'consumer_supplies' which is part ofregulator_init_datais not extracted as the regulator consumer mappings are passed through DT differently, implemented in subsequent patches.
Similarly the regulator<-->parent/supply mapping is handled in subsequent patches.Also add documentation for regulator bindings to be used to pass
regulator_init_datastruct information from device tree.Some of the regulator properties which are linux and board specific, are left out since its not clear if they can
be in someway embedded into the kernel or passed in from DT. They will be revisited later.Signed-off-by Rajendra Nayak <[email protected]>---
?.../devicetree/bindings/regulator/regulator.txt ? ?| ? 54 +++++++++++++ ?drivers/regulator/Makefile ? ? ? ? ? ? ? ? ? ? ? ? | ? ?1 + ?drivers/regulator/of_regulator.c ? ? ? ? ? ? ? ? ? | ? 81 ++++++++++++++++++++ ?include/linux/regulator/of_regulator.h ? ? ? ? ? ? | ? 20 +++++?4 files changed, 156 insertions(+), 0 deletions(-)
?create mode 100644Documentation/devicetree/bindings/regulator/regulator.txt?create mode 100644drivers/regulator/of_regulator.c
?create mode 100644include/linux/regulator/of_regulator.hDocumentation/devicetree/bindings/regulator/regulator.txt new file +2
-0@@ -0,0 +1,54 @@ +Voltage/Current Regulators +
Documentation/devicetree/bindings/regulator/regulator.txt line 12
Quoted 10 lines
Documentation/devicetree/bindings/regulator/regulator.txt new file +10
-0+Optional properties: +- regulator-name: A string used as a descriptive name for regulator outputs +- regulator-min-microvolt: smallest voltage consumers may set +- regulator-max-microvolt: largest voltage consumers may set +- regulator-microvolt-offset: Offset applied to voltages to compensate for voltage drops +- regulator-min-microamp: smallest current consumers may set +- regulator-max-microamp: largest current consumers may set +- regulator-always-on: boolean, regulator should never be disabled +- regulator-boot-on: bootloader/firmware enabled regulator +- <name>-supply: phandle to the parent supply/regulator node
For regulators that are not turned on by bootloader, and which require 'apply_uV' constraint, is there any alternative for turning on the regulator when using dt?
Or, how about adding a additional check as below.
drivers/regulator/core.c +0 -0
@@ -816,8 +816,9 @@ static int machine_constraints_voltage(struct
regulator_dev *rdev,
int ret;
/* do we need to apply the constraint voltage */
- if (rdev->constraints->apply_uV &&
- rdev->constraints->min_uV == rdev->constraints->max_uV) {
+ if ((rdev->constraints->apply_uV &&
+ rdev->constraints->min_uV == rdev->constraints->max_uV) ||
+ (!rdev->constraints->boot_on && rdev->constraints->always_on)) {
ret = _regulator_do_set_voltage(rdev,
rdev->constraints->min_uV, rdev->constraints->max_uV);
Thanks,
Thomas.
Re: [PATCH v5 1/4] regulator: helper routine to extract regulator_init_data
Quoted 3 lines · Thomas Abraham
For regulators that are not turned on by bootloader, and which require '
apply_uV' constraint, is there any alternative for turning on the regulator when using dt?
If the regulator isn't software managed then always_on covers this - the regulator core will enable any always_on regulators that haven't been enabled already.
Review
Quoted 9 lines
(quoted diff) +3
-2/* do we need to apply the constraint voltage */ - if (rdev->constraints->apply_uV && - rdev->constraints->min_uV == rdev->constraints->max_uV) { + if ((rdev->constraints->apply_uV && + rdev->constraints->min_uV == rdev->constraints->max_uV) || + (!rdev->constraints->boot_on && rdev->constraints->always_on)) { ret = _regulator_do_set_voltage(rdev, rdev->constraints->min_uV, rdev->constraints->max_uV);
I'm not sure I understand the intended logic there. Voltage constraints and enable/disable constraints are orthogonal here.
Re: [PATCH v5 3/4] regulator: pass additional of_node to regulator_register()
In reply to Thomas AbrahamQuoted 3 lines
Documentation/power/regulator/regulator.txtwould also require an update the reflect the change in api.
Thanks Thomas, I just sent a patch to fix this up.
regards,
Rajendra
Quoted 5 lines
Thanks,
Thomas.[...]
Re: [PATCH v5 1/4] regulator: helper routine to extract regulator_init_data
In reply to Mark BrownHi Mark,
Quoted 9 lines · Mark Brown
Quoted 3 lines · Thomas Abraham
For regulators that are not turned on by bootloader, and which require '
apply_uV' constraint, is there any alternative for turning on the regulator when using dt?If the regulator isn't software managed then
always_oncovers this - the regulator core will enable anyalways_onregulators that haven't been enabled already.
Thanks for the hint. I was trying to deal with a regulator that was not software managed but also required the voltage level to be set to certain level. That was possible with 'apply_uV' constraint in non-dt case. Anyway, I have modified the code to manage the regulator and this works fine in dt case as well without the 'apply_uV' constraint.
Quoted 11 lines
Quoted 10 lines
? ? ? /* do we need to apply the constraint voltage */
- ? ? if (rdev->constraints->apply_uV&&
- ? ? ? ?rdev->constraints->min_uV==rdev->constraints->max_uV) {
+ ? ? if ((rdev->constraints->apply_uV&&
+ ? ? ? ?rdev->constraints->min_uV==rdev->constraints->max_uV) ||
+ ? ? ? ? ? ? (!rdev->constraints->boot_on &&rdev->constraints->always_on)) { ? ? ? ? ? ? ? ret = _regulator_do_set_voltage(rdev,
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?rdev->constraints->min_uV, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?rdev->constraints->max_uV);
Quoted 2 lines
I'm not sure I understand the intended logic there. ?Voltage constraints and enable/disable constraints are orthogonal here.
Ok. I guess the above change is incorrect then.
Thanks,
Thomas.
Re: [PATCH v5 1/4] regulator: helper routine to extract regulator_init_data
Quoted 11 lines · Thomas Abraham
On 4 December 2011 21:24, Mark Brown
Quoted 3 lines
If the regulator isn't software managed then
always_oncovers this - the regulator core will enable anyalways_onregulators that haven't been enabled already.Thanks for the hint. I was trying to deal with a regulator that was not software managed but also required the voltage level to be set to certain level. That was possible with '
apply_uV' constraint in non-dt case. Anyway, I have modified the code to manage the regulator and this works fine in dt case as well without the 'apply_uV' constraint.
With the regulator device tree bindings if the regulator is configured to run a single voltage the bindings will set apply_uV unconditionally so there's no need for a separate constraint.
Re: [PATCH v5 1/4] regulator: helper routine to extract regulator_init_data
Quoted 13 lines · Mark Brown
Quoted 11 lines · Thomas Abraham
On 4 December 2011 21:24, Mark Brown
Quoted 3 lines
If the regulator isn't software managed then
always_oncovers this - the regulator core will enable anyalways_onregulators that haven't been enabled already.Thanks for the hint. I was trying to deal with a regulator that was not software managed but also required the voltage level to be set to certain level. That was possible with '
apply_uV' constraint in non-dt case. Anyway, I have modified the code to manage the regulator and this works fine in dt case as well without the 'apply_uV' constraint.
Quoted 4 lines
With the regulator device tree bindings if the regulator is configured to run a single voltage the bindings will set
apply_uVunconditionally so there's no need for a separate constraint.
Sorry if I have missed this, but I could not find 'apply_uV' being set as you described in the v5 of the regulator-dt patchset.
Thanks,
Thomas.
Re: [PATCH v5 1/4] regulator: helper routine to extract regulator_init_data
Quoted 8 lines · Thomas Abraham
On 5 December 2011 16:04, Mark Brown
Quoted 3 lines
With the regulator device tree bindings if the regulator is configured to run a single voltage the bindings will set
apply_uVunconditionally so there's no need for a separate constraint.Sorry if I have missed this, but I could not find '
apply_uV' being set as you described in the v5 of the regulator-dt patchset.
Yes, looks like Rajendra missed that - just fixed it.
Re: [PATCH v5 1/4] regulator: helper routine to extract regulator_init_data
Quoted 12 lines · Mark Brown
Quoted 8 lines · Thomas Abraham
On 5 December 2011 16:04, Mark Brown
Quoted 3 lines
With the regulator device tree bindings if the regulator is configured to run a single voltage the bindings will set
apply_uVunconditionally so there's no need for a separate constraint.Sorry if I have missed this, but I could not find '
apply_uV' being set as you described in the v5 of the regulator-dt patchset.Yes, looks like Rajendra missed that - just fixed it.
Thanks Mark. Could you please push your change.
Regards,
Thomas.
Re: [PATCH v5 1/4] regulator: helper routine to extract regulator_init_data
In reply to Mark BrownQuoted 11 lines · Mark Brown
Quoted 8 lines · Thomas Abraham
On 5 December 2011 16:04, Mark Brown
Quoted 3 lines
With the regulator device tree bindings if the regulator is configured to run a single voltage the bindings will set
apply_uVunconditionally so there's no need for a separate constraint.Sorry if I have missed this, but I could not find '
apply_uV' being set as you described in the v5 of the regulator-dt patchset.Yes, looks like Rajendra missed that - just fixed it.
Thanks Mark, I certainly seem to have missed it.
Re: [PATCH v5 1/4] regulator: helper routine to extract regulator_init_data
In reply to Rajendra NayakDocumentation/devicetree/bindings/regulator/regulator.txt line 21
Quoted 6 lines · Rajendra Nayak
Documentation/devicetree/bindings/regulator/regulator.txt new file +6
-0+ xyzreg: regulator at 0 { + regulator-min-microvolt = <1000000>; + regulator-max-microvolt = <2500000>; + regulator-always-on; + vin-supply = <&vin>; + };
Just noticed this, but the '@0' shouldn't be on the name, since there isn't a reg attribute on this node. Perhaps it should be "regulator-xyz"?
David
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.