regulator da9062: add and make use of map_mode support
Subsystems (5)
cover regulator da9062: add and make use of map_mode support
This patchset adds of_map_mode support to regulator da9062, documents its bindings and makes use of it in dts phycore-imx6.
Christoph Fritz (3):
regulator: da9062: add of_map_mode support for bucks
dt-bindings: regulator: describe da9062's regulator modes
ARM: dts: phycore-imx6: set buck regulator modes explicitly
Documentation/devicetree/bindings/mfd/da9062.txt | 8 ++++++++ arch/arm/boot/dts/imx6qdl-phytec-phycore-som.dtsi | 4 ++++ drivers/regulator/da9062-regulator.c | 20 ++++++++++++++++++++ 3 files changed, 32 insertions(+)
Signature · 1 line
2.1.4
PATCH 1/3 regulator: da9062: add of_map_mode support for bucks
This patch adds of_map_mode support for bucks to set regulator modes from within regulator framework.
--- drivers/regulator/da9062-regulator.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
drivers/regulator/da9062-regulator.c +20 -0
@@ -119,6 +119,22 @@ static const int da9062_buck_b_limits[] = { 2300000, 2400000, 2500000, 2600000, 2700000, 2800000, 2900000, 3000000 }; +static inline unsigned int da9062_map_mode (unsigned int mode) +{ +switch (mode) { +case BUCK_MODE_MANUAL : +return REGULATOR_MODE_FAST |REGULATOR_MODE_STANDBY ; +case BUCK_MODE_SLEEP : +return REGULATOR_MODE_STANDBY ; +case BUCK_MODE_SYNC : +return REGULATOR_MODE_FAST ; +case BUCK_MODE_AUTO : +return REGULATOR_MODE_NORMAL ; +default : +return -EINVAL ; + } +} +static int da9062_set_current_limit (struct regulator_dev *rdev,int min_ua,int max_ua) {
@@ -686,6 +702,7 @@ static const struct da9062_regulator_info local_da9062_regulator_info[] = { .desc.vsel_reg = DA9062AA_VBUCK1_A, .desc.vsel_mask = DA9062AA_VBUCK1_A_MASK, .desc.linear_min_sel = 0, + .desc.of_map_mode = da9062_map_mode, .sleep = REG_FIELD(DA9062AA_VBUCK1_A, __builtin_ffs((int)DA9062AA_BUCK1_SL_A_MASK) - 1, sizeof(unsigned int) * 8 -
@@ -724,6 +741,7 @@ static const struct da9062_regulator_info local_da9062_regulator_info[] = { .desc.vsel_reg = DA9062AA_VBUCK2_A, .desc.vsel_mask = DA9062AA_VBUCK2_A_MASK, .desc.linear_min_sel = 0, + .desc.of_map_mode = da9062_map_mode, .sleep = REG_FIELD(DA9062AA_VBUCK2_A, __builtin_ffs((int)DA9062AA_BUCK2_SL_A_MASK) - 1, sizeof(unsigned int) * 8 -
@@ -762,6 +780,7 @@ static const struct da9062_regulator_info local_da9062_regulator_info[] = { .desc.vsel_reg = DA9062AA_VBUCK3_A, .desc.vsel_mask = DA9062AA_VBUCK3_A_MASK, .desc.linear_min_sel = 0, + .desc.of_map_mode = da9062_map_mode, .sleep = REG_FIELD(DA9062AA_VBUCK3_A, __builtin_ffs((int)DA9062AA_BUCK3_SL_A_MASK) - 1, sizeof(unsigned int) * 8 -
@@ -800,6 +819,7 @@ static const struct da9062_regulator_info local_da9062_regulator_info[] = { .desc.vsel_reg = DA9062AA_VBUCK4_A, .desc.vsel_mask = DA9062AA_VBUCK4_A_MASK, .desc.linear_min_sel = 0, + .desc.of_map_mode = da9062_map_mode, .sleep = REG_FIELD(DA9062AA_VBUCK4_A, __builtin_ffs((int)DA9062AA_BUCK4_SL_A_MASK) - 1, sizeof(unsigned int) * 8 -
Signature · 1 line
2.1.4
Fabio Estevam
reviewerPATCH 1/3 regulator: da9062: add of_map_mode support for bucks
Quoted 5 lines · Christoph Fritz
This patch adds
of_map_modesupport for bucks to set regulator modes from within regulator framework.Signed-off-by Christoph Fritz <[email protected]>Signed-off-by Christian Hemp <[email protected]>
PATCH 2/3 dt-bindings: regulator: describe da9062's regulator modes
In reply to Christoph FritzThis patch adds DT description of da9062's buck regulator modes.
--- Documentation/devicetree/bindings/mfd/da9062.txt | 8 ++++++++ 1 file changed, 8 insertions(+)
Documentation/devicetree/bindings/mfd/da9062.txt +8 -0
@@ -64,6 +64,14 @@ Sub-nodes: ldo3 : LDO_3 ldo4 : LDO_4 + The DA9062 regulators optionally support setting "regulator-initial-mode" + and "regulator-mode" for its buck nodes to following numbers listed below: + + 0 : BUCK_MODE_MANUAL + 1 : BUCK_MODE_SLEEP + 2 : BUCK_MODE_SYNC + 3 : BUCK_MODE_AUTO + The component follows the standard regulator framework and the bindings details of individual regulator device can be found in: Documentation/devicetree/bindings/regulator/regulator.txt
Signature · 1 line
2.1.4
Fabio Estevam
reviewerPATCH 2/3 dt-bindings: regulator: describe da9062's regulator modes
Quoted 12 lines · Christoph Fritz
This patch adds DT description of da9062's buck regulator modes.
Signed-off-by Christoph Fritz <[email protected]>--- Documentation/devicetree/bindings/mfd/da9062.txt | 8 ++++++++ 1 file changed, 8 insertions(+)Documentation/devicetree/bindings/mfd/da9062.txt +0
-0
Documentation/devicetree/bindings/mfd/da9062.txt Sub-nodes: · line 67
Quoted 4 lines
Documentation/devicetree/bindings/mfd/da9062.txt +1
-0@@ -64,6 +64,14 @@ Sub-nodes: ldo3 : LDO_3 ldo4 : LDO_4 + The DA9062 regulators optionally support setting "regulator-initial-mode"
It would be clearer if this text goes into a "Optional Properties" section.
PATCH 3/3 ARM: dts: phycore-imx6: set buck regulator modes explicitly
In reply to Christoph FritzThis patch sets initial buck regulator modes explicitly to a state this hardware needs. So a wrong initial mode set by bootloader or pmic itself does not interfere anymore.
--- arch/arm/boot/dts/imx6qdl-phytec-phycore-som.dtsi | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm/boot/dts/imx6qdl-phytec-phycore-som.dtsi +4 -0
@@ -109,6 +109,7 @@ regulator-name = "vdd_arm"; regulator-min-microvolt = <730000>; regulator-max-microvolt = <1380000>; + regulator-initial-mode = <2>; /* SYNC */ regulator-always-on; };
@@ -116,6 +117,7 @@ regulator-name = "vdd_soc"; regulator-min-microvolt = <730000>; regulator-max-microvolt = <1380000>; + regulator-initial-mode = <2>; /* SYNC */ regulator-always-on; };
@@ -123,6 +125,7 @@ regulator-name = "vdd_ddr3"; regulator-min-microvolt = <1500000>; regulator-max-microvolt = <1500000>; + regulator-initial-mode = <2>; /* SYNC */ regulator-always-on; };
@@ -130,6 +133,7 @@ regulator-name = "vdd_eth"; regulator-min-microvolt = <1200000>; regulator-max-microvolt = <1200000>; + regulator-initial-mode = <2>; /* SYNC */ regulator-always-on; };
Signature · 1 line
2.1.4
Fabio Estevam
reviewerPATCH 3/3 ARM: dts: phycore-imx6: set buck regulator modes explicitly
Quoted 6 lines · Christoph Fritz
This patch sets initial buck regulator modes explicitly to a state this hardware needs. So a wrong initial mode set by bootloader or pmic itself does not interfere anymore.
Signed-off-by Christoph Fritz <[email protected]>Signed-off-by Christian Hemp <[email protected]>
PATCH 3/3 ARM: dts: phycore-imx6: set buck regulator modes explicitly
In reply to Christoph FritzQuoted 6 lines · Christoph Fritz
This patch sets initial buck regulator modes explicitly to a state this hardware needs. So a wrong initial mode set by bootloader or pmic itself does not interfere anymore.
Signed-off-by Christoph Fritz <[email protected]>Signed-off-by Christian Hemp <[email protected]>
Looks good to me. Ping me to pick it up when first two patches are accepted.
Shawn
Quoted 43 lines
--- arch/arm/boot/dts/imx6qdl-phytec-phycore-som.dtsi | 4 ++++ 1 file changed, 4 insertions(+)arch/arm/boot/dts/imx6qdl-phytec-phycore-som.dtsi +4
-0@@ -109,6 +109,7 @@ regulator-name = "vdd_arm"; regulator-min-microvolt = <730000>; regulator-max-microvolt = <1380000>; + regulator-initial-mode = <2>; /* SYNC */ regulator-always-on; };@@ -116,6 +117,7 @@ regulator-name = "vdd_soc"; regulator-min-microvolt = <730000>; regulator-max-microvolt = <1380000>; + regulator-initial-mode = <2>; /* SYNC */ regulator-always-on; };@@ -123,6 +125,7 @@ regulator-name = "vdd_ddr3"; regulator-min-microvolt = <1500000>; regulator-max-microvolt = <1500000>; + regulator-initial-mode = <2>; /* SYNC */ regulator-always-on; };@@ -130,6 +133,7 @@ regulator-name = "vdd_eth"; regulator-min-microvolt = <1200000>; regulator-max-microvolt = <1200000>; + regulator-initial-mode = <2>; /* SYNC */ regulator-always-on; };Signature · 1 line
2.1.4