This patchset adds of_map_mode support to regulator da9062, documents its bindings and makes use of it in dts phycore-imx6 so that buck modes get configured explicitly for this hardware. Christoph Fritz (4): regulator: da9062: refactor buck modes into header regulator: da9062: add of_map_mode support for bucks dt-bindings: regulator: describe da906x buck regulator modes ARM: dts: phycore-imx6: set buck regulator modes explicitly Documentation/devicetree/bindings/mfd/da9062.txt | 4 ++ arch/arm/boot/dts/imx6qdl-phytec-phycore-som.dtsi | 5 +++ drivers/regulator/da9062-regulator.c | 49 ++++++++++++++-------- .../dt-bindings/regulator/dlg,da906x-regulator.h | 16 +++++++ 4 files changed, 56 insertions(+), 18 deletions(-) create mode 100644 include/dt-bindings/regulator/dlg,da906x-regulator.h -- 2.1.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
This patch refactors buck modes into a header so that device trees can make use of these mode constants. Signed-off-by: Christoph Fritz <chf.fritz@googlemail.com> --- drivers/regulator/da9062-regulator.c | 28 ++++++++-------------- .../dt-bindings/regulator/dlg,da906x-regulator.h | 16 +++++++++++++ 2 files changed, 26 insertions(+), 18 deletions(-) create mode 100644 include/dt-bindings/regulator/dlg,da906x-regulator.h diff --git a/drivers/regulator/da9062-regulator.c b/drivers/regulator/da9062-regulator.c index 710e670..1a95982 100644 --- a/drivers/regulator/da9062-regulator.c +++ b/drivers/regulator/da9062-regulator.c @@ -16,6 +16,7 @@ #include <linux/regulator/of_regulator.h> #include <linux/mfd/da9062/core.h> #include <linux/mfd/da9062/registers.h> +#include <dt-bindings/regulator/dlg,da906x-regulator.h> /* Regulator IDs */ enum { @@ -75,14 +76,6 @@ struct da9062_regulators { struct da9062_regulator regulator[0]; }; -/* BUCK modes */ -enum { - BUCK_MODE_MANUAL, /* 0 */ - BUCK_MODE_SLEEP, /* 1 */ - BUCK_MODE_SYNC, /* 2 */ - BUCK_MODE_AUTO /* 3 */ -}; - /* Regulator operations */ /* Current limits array (in uA) @@ -112,13 +105,13 @@ static int da9062_buck_set_mode(struct regulator_dev *rdev, unsigned mode) switch (mode) { case REGULATOR_MODE_FAST: - val = BUCK_MODE_SYNC; + val = DA906X_BUCK_MODE_SYNC; break; case REGULATOR_MODE_NORMAL: - val = BUCK_MODE_AUTO; + val = DA906X_BUCK_MODE_AUTO; break; case REGULATOR_MODE_STANDBY: - val = BUCK_MODE_SLEEP; + val = DA906X_BUCK_MODE_SLEEP; break; default: return -EINVAL; @@ -145,15 +138,14 @@ static unsigned da9062_buck_get_mode(struct regulator_dev *rdev) switch (val) { default: - case BUCK_MODE_MANUAL: mode = REGULATOR_MODE_FAST | REGULATOR_MODE_STANDBY; /* Sleep flag bit decides the mode */ break; - case BUCK_MODE_SLEEP: + case DA906X_BUCK_MODE_SLEEP: return REGULATOR_MODE_STANDBY; - case BUCK_MODE_SYNC: + case DA906X_BUCK_MODE_SYNC: return REGULATOR_MODE_FAST; - case BUCK_MODE_AUTO: + case DA906X_BUCK_MODE_AUTO: return REGULATOR_MODE_NORMAL; } @@ -282,13 +274,13 @@ static int da9062_buck_set_suspend_mode(struct regulator_dev *rdev, switch (mode) { case REGULATOR_MODE_FAST: - val = BUCK_MODE_SYNC; + val = DA906X_BUCK_MODE_SYNC; break; case REGULATOR_MODE_NORMAL: - val = BUCK_MODE_AUTO; + val = DA906X_BUCK_MODE_AUTO; break; case REGULATOR_MODE_STANDBY: - val = BUCK_MODE_SLEEP; + val = DA906X_BUCK_MODE_SLEEP; break; default: return -EINVAL; diff --git a/include/dt-bindings/regulator/dlg,da906x-regulator.h b/include/dt-bindings/regulator/dlg,da906x-regulator.h new file mode 100644 index 00000000..848a4df --- /dev/null +++ b/include/dt-bindings/regulator/dlg,da906x-regulator.h @@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#ifndef __DLG_DA906X_REGULATOR_H +#define __DLG_DA906X_REGULATOR_H + +/* + * These buck mode constants may be used to specify values in device tree + * properties (e.g. regulator-initial-mode). + * A description of the following modes is in the manufacturers datasheet. + */ + +#define DA906X_BUCK_MODE_SLEEP 1 +#define DA906X_BUCK_MODE_SYNC 2 +#define DA906X_BUCK_MODE_AUTO 3 + +#endif -- 2.1.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
This patch adds of_map_mode support for bucks to set regulator modes from within regulator framework. Signed-off-by: Christoph Fritz <chf.fritz@googlemail.com> Signed-off-by: Christian Hemp <c.hemp@phytec.de> Signed-off-by: Stefan Riedmueller <s.riedmueller@phytec.de> --- drivers/regulator/da9062-regulator.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/regulator/da9062-regulator.c b/drivers/regulator/da9062-regulator.c index 1a95982..f5f2ead 100644 --- a/drivers/regulator/da9062-regulator.c +++ b/drivers/regulator/da9062-regulator.c @@ -98,6 +98,20 @@ static const unsigned int da9062_buck_b_limits[] = { 2300000, 2400000, 2500000, 2600000, 2700000, 2800000, 2900000, 3000000 }; +static unsigned int da906x_map_buck_mode(unsigned int mode) +{ + switch (mode) { + case DA906X_BUCK_MODE_SLEEP: + return REGULATOR_MODE_STANDBY; + case DA906X_BUCK_MODE_SYNC: + return REGULATOR_MODE_FAST; + case DA906X_BUCK_MODE_AUTO: + return REGULATOR_MODE_NORMAL; + default: + return -EINVAL; + } +} + static int da9062_buck_set_mode(struct regulator_dev *rdev, unsigned mode) { struct da9062_regulator *regl = rdev_get_drvdata(rdev); @@ -363,6 +377,7 @@ static const struct da9062_regulator_info local_da9061_regulator_info[] = { .desc.vsel_reg = DA9062AA_VBUCK1_A, .desc.vsel_mask = DA9062AA_VBUCK1_A_MASK, .desc.linear_min_sel = 0, + .desc.of_map_mode = da906x_map_buck_mode, .sleep = REG_FIELD(DA9062AA_VBUCK1_A, __builtin_ffs((int)DA9062AA_BUCK1_SL_A_MASK) - 1, sizeof(unsigned int) * 8 - @@ -399,6 +414,7 @@ static const struct da9062_regulator_info local_da9061_regulator_info[] = { .desc.vsel_reg = DA9062AA_VBUCK3_A, .desc.vsel_mask = DA9062AA_VBUCK3_A_MASK, .desc.linear_min_sel = 0, + .desc.of_map_mode = da906x_map_buck_mode, .sleep = REG_FIELD(DA9062AA_VBUCK3_A, __builtin_ffs((int)DA9062AA_BUCK3_SL_A_MASK) - 1, sizeof(unsigned int) * 8 - @@ -435,6 +451,7 @@ static const struct da9062_regulator_info local_da9061_regulator_info[] = { .desc.vsel_reg = DA9062AA_VBUCK4_A, .desc.vsel_mask = DA9062AA_VBUCK4_A_MASK, .desc.linear_min_sel = 0, + .desc.of_map_mode = da906x_map_buck_mode, .sleep = REG_FIELD(DA9062AA_VBUCK4_A, __builtin_ffs((int)DA9062AA_BUCK4_SL_A_MASK) - 1, sizeof(unsigned int) * 8 - @@ -607,6 +624,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 = da906x_map_buck_mode, .sleep = REG_FIELD(DA9062AA_VBUCK1_A, __builtin_ffs((int)DA9062AA_BUCK1_SL_A_MASK) - 1, sizeof(unsigned int) * 8 - @@ -643,6 +661,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 = da906x_map_buck_mode, .sleep = REG_FIELD(DA9062AA_VBUCK2_A, __builtin_ffs((int)DA9062AA_BUCK2_SL_A_MASK) - 1, sizeof(unsigned int) * 8 - @@ -679,6 +698,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 = da906x_map_buck_mode, .sleep = REG_FIELD(DA9062AA_VBUCK3_A, __builtin_ffs((int)DA9062AA_BUCK3_SL_A_MASK) - 1, sizeof(unsigned int) * 8 - @@ -715,6 +735,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 = da906x_map_buck_mode, .sleep = REG_FIELD(DA9062AA_VBUCK4_A, __builtin_ffs((int)DA9062AA_BUCK4_SL_A_MASK) - 1, sizeof(unsigned int) * 8 - -- 2.1.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
This patch adds DT description of da906x buck regulator modes. Signed-off-by: Christoph Fritz <chf.fritz@googlemail.com> --- Documentation/devicetree/bindings/mfd/da9062.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/mfd/da9062.txt b/Documentation/devicetree/bindings/mfd/da9062.txt index edca653..5989411 100644 --- a/Documentation/devicetree/bindings/mfd/da9062.txt +++ b/Documentation/devicetree/bindings/mfd/da9062.txt @@ -66,6 +66,9 @@ Sub-nodes: details of individual regulator device can be found in: Documentation/devicetree/bindings/regulator/regulator.txt + regulator-initial-mode may be specified for buck regulators using mode values + from include/dt-bindings/regulator/dlg,da906x-regulator.h. + - rtc : This node defines settings required for the Real-Time Clock associated with the DA9062. There are currently no entries in this binding, however compatible = "dlg,da9062-rtc" should be added if a node is created. @@ -96,6 +99,7 @@ Example: regulator-max-microvolt = <1570000>; regulator-min-microamp = <500000>; regulator-max-microamp = <2000000>; + regulator-initial-mode = <DA906X_BUCK_MODE_SYNC>; regulator-boot-on; }; DA9062_LDO1: ldo1 { -- 2.1.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
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 <chf.fritz@googlemail.com> --- arch/arm/boot/dts/imx6qdl-phytec-phycore-som.dtsi | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm/boot/dts/imx6qdl-phytec-phycore-som.dtsi b/arch/arm/boot/dts/imx6qdl-phytec-phycore-som.dtsi index 6486df3..e3f2181 100644 --- a/arch/arm/boot/dts/imx6qdl-phytec-phycore-som.dtsi +++ b/arch/arm/boot/dts/imx6qdl-phytec-phycore-som.dtsi @@ -5,6 +5,7 @@ */ #include <dt-bindings/gpio/gpio.h> +#include <dt-bindings/regulator/dlg,da906x-regulator.h> / { aliases { @@ -109,6 +110,7 @@ regulator-name = "vdd_arm"; regulator-min-microvolt = <730000>; regulator-max-microvolt = <1380000>; + regulator-initial-mode = <DA906X_BUCK_MODE_SYNC>; regulator-always-on; }; @@ -116,6 +118,7 @@ regulator-name = "vdd_soc"; regulator-min-microvolt = <730000>; regulator-max-microvolt = <1380000>; + regulator-initial-mode = <DA906X_BUCK_MODE_SYNC>; regulator-always-on; }; @@ -123,6 +126,7 @@ regulator-name = "vdd_ddr3"; regulator-min-microvolt = <1500000>; regulator-max-microvolt = <1500000>; + regulator-initial-mode = <DA906X_BUCK_MODE_SYNC>; regulator-always-on; }; @@ -130,6 +134,7 @@ regulator-name = "vdd_eth"; regulator-min-microvolt = <1200000>; regulator-max-microvolt = <1200000>; + regulator-initial-mode = <DA906X_BUCK_MODE_SYNC>; regulator-always-on; }; -- 2.1.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
[-- Attachment #1.1: Type: text/plain, Size: 461 bytes --] On Thu, Nov 07, 2019 at 11:04:09AM +0100, Christoph Fritz wrote: > This patch adds DT description of da906x buck regulator modes. Please submit patches using subject lines reflecting the style for the subsystem, this makes it easier for people to identify relevant patches. Look at what existing commits in the area you're changing are doing and make sure your subject lines visually resemble what they're doing. There's no need to resubmit to fix this alone. [-- Attachment #1.2: signature.asc --] [-- Type: application/pgp-signature, Size: 488 bytes --] [-- Attachment #2: Type: text/plain, Size: 176 bytes --] _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
On 07 November 2019 10:04, Christoph Fritz wrote: > This patch refactors buck modes into a header so that device trees > can make use of these mode constants. > > Signed-off-by: Christoph Fritz <chf.fritz@googlemail.com> > --- > drivers/regulator/da9062-regulator.c | 28 ++++++++-------------- > .../dt-bindings/regulator/dlg,da906x-regulator.h | 16 +++++++++++++ > 2 files changed, 26 insertions(+), 18 deletions(-) > create mode 100644 include/dt-bindings/regulator/dlg,da906x-regulator.h > > diff --git a/drivers/regulator/da9062-regulator.c b/drivers/regulator/da9062- > regulator.c > index 710e670..1a95982 100644 > --- a/drivers/regulator/da9062-regulator.c > +++ b/drivers/regulator/da9062-regulator.c > @@ -16,6 +16,7 @@ > #include <linux/regulator/of_regulator.h> > #include <linux/mfd/da9062/core.h> > #include <linux/mfd/da9062/registers.h> > +#include <dt-bindings/regulator/dlg,da906x-regulator.h> Can we please rename this file to use da9063 instead of da906x as this header wouldn't necessarily be valid for other da906x prefixed devices outside of DA9061/2/3. DA9063 was the earlier chip so it makes sense to use that name over DA9062, and DA9063 driver code will want updating at some point in a similar manner. > > /* Regulator IDs */ > enum { > @@ -75,14 +76,6 @@ struct da9062_regulators { > struct da9062_regulator regulator[0]; > }; > > -/* BUCK modes */ > -enum { > - BUCK_MODE_MANUAL, /* 0 */ > - BUCK_MODE_SLEEP, /* 1 */ > - BUCK_MODE_SYNC, /* 2 */ > - BUCK_MODE_AUTO /* 3 */ > -}; > - > /* Regulator operations */ > > /* Current limits array (in uA) > @@ -112,13 +105,13 @@ static int da9062_buck_set_mode(struct regulator_dev > *rdev, unsigned mode) > > switch (mode) { > case REGULATOR_MODE_FAST: > - val = BUCK_MODE_SYNC; > + val = DA906X_BUCK_MODE_SYNC; > break; > case REGULATOR_MODE_NORMAL: > - val = BUCK_MODE_AUTO; > + val = DA906X_BUCK_MODE_AUTO; > break; > case REGULATOR_MODE_STANDBY: > - val = BUCK_MODE_SLEEP; > + val = DA906X_BUCK_MODE_SLEEP; > break; > default: > return -EINVAL; > @@ -145,15 +138,14 @@ static unsigned da9062_buck_get_mode(struct > regulator_dev *rdev) > > switch (val) { > default: > - case BUCK_MODE_MANUAL: > mode = REGULATOR_MODE_FAST | > REGULATOR_MODE_STANDBY; > /* Sleep flag bit decides the mode */ > break; I'm not sure your code is based on the latest regulator updates as I believe Axel Lin made some improvements to this bit of code. Checkout Mark's regulator fork of the kernel. > - case BUCK_MODE_SLEEP: > + case DA906X_BUCK_MODE_SLEEP: > return REGULATOR_MODE_STANDBY; > - case BUCK_MODE_SYNC: > + case DA906X_BUCK_MODE_SYNC: > return REGULATOR_MODE_FAST; > - case BUCK_MODE_AUTO: > + case DA906X_BUCK_MODE_AUTO: > return REGULATOR_MODE_NORMAL; > } > > @@ -282,13 +274,13 @@ static int da9062_buck_set_suspend_mode(struct > regulator_dev *rdev, > > switch (mode) { > case REGULATOR_MODE_FAST: > - val = BUCK_MODE_SYNC; > + val = DA906X_BUCK_MODE_SYNC; > break; > case REGULATOR_MODE_NORMAL: > - val = BUCK_MODE_AUTO; > + val = DA906X_BUCK_MODE_AUTO; > break; > case REGULATOR_MODE_STANDBY: > - val = BUCK_MODE_SLEEP; > + val = DA906X_BUCK_MODE_SLEEP; > break; > default: > return -EINVAL; > diff --git a/include/dt-bindings/regulator/dlg,da906x-regulator.h b/include/dt- > bindings/regulator/dlg,da906x-regulator.h > new file mode 100644 > index 00000000..848a4df > --- /dev/null > +++ b/include/dt-bindings/regulator/dlg,da906x-regulator.h > @@ -0,0 +1,16 @@ > +/* SPDX-License-Identifier: GPL-2.0 */ > + > +#ifndef __DLG_DA906X_REGULATOR_H > +#define __DLG_DA906X_REGULATOR_H Just to echo previous comment, rename from DA906X to DA9063 > + > +/* > + * These buck mode constants may be used to specify values in device tree > + * properties (e.g. regulator-initial-mode). > + * A description of the following modes is in the manufacturers datasheet. > + */ > + > +#define DA906X_BUCK_MODE_SLEEP 1 > +#define DA906X_BUCK_MODE_SYNC 2 > +#define DA906X_BUCK_MODE_AUTO 3 > + > +#endif > -- > 2.1.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
On 07 November 2019 10:04, Christoph Fritz wrote: > This patch adds of_map_mode support for bucks to set regulator modes > from within regulator framework. This looks fine to me, other than a couple of little points below. > > Signed-off-by: Christoph Fritz <chf.fritz@googlemail.com> > Signed-off-by: Christian Hemp <c.hemp@phytec.de> > Signed-off-by: Stefan Riedmueller <s.riedmueller@phytec.de> > --- > drivers/regulator/da9062-regulator.c | 21 +++++++++++++++++++++ > 1 file changed, 21 insertions(+) > > diff --git a/drivers/regulator/da9062-regulator.c b/drivers/regulator/da9062- > regulator.c > index 1a95982..f5f2ead 100644 > --- a/drivers/regulator/da9062-regulator.c > +++ b/drivers/regulator/da9062-regulator.c > @@ -98,6 +98,20 @@ static const unsigned int da9062_buck_b_limits[] = { > 2300000, 2400000, 2500000, 2600000, 2700000, 2800000, 2900000, 3000000 > }; > > +static unsigned int da906x_map_buck_mode(unsigned int mode) This can just be called da9062 as this function is only used in this file. > +{ > + switch (mode) { > + case DA906X_BUCK_MODE_SLEEP: Obvioulsy these names will want updating as per my comments on patch 01 in the series. > + return REGULATOR_MODE_STANDBY; > + case DA906X_BUCK_MODE_SYNC: > + return REGULATOR_MODE_FAST; > + case DA906X_BUCK_MODE_AUTO: > + return REGULATOR_MODE_NORMAL; > + default: > + return -EINVAL; > + } > +} > + > static int da9062_buck_set_mode(struct regulator_dev *rdev, unsigned mode) > { > struct da9062_regulator *regl = rdev_get_drvdata(rdev); > @@ -363,6 +377,7 @@ static const struct da9062_regulator_info > local_da9061_regulator_info[] = { > .desc.vsel_reg = DA9062AA_VBUCK1_A, > .desc.vsel_mask = DA9062AA_VBUCK1_A_MASK, > .desc.linear_min_sel = 0, > + .desc.of_map_mode = da906x_map_buck_mode, > .sleep = REG_FIELD(DA9062AA_VBUCK1_A, > __builtin_ffs((int)DA9062AA_BUCK1_SL_A_MASK) - 1, > sizeof(unsigned int) * 8 - > @@ -399,6 +414,7 @@ static const struct da9062_regulator_info > local_da9061_regulator_info[] = { > .desc.vsel_reg = DA9062AA_VBUCK3_A, > .desc.vsel_mask = DA9062AA_VBUCK3_A_MASK, > .desc.linear_min_sel = 0, > + .desc.of_map_mode = da906x_map_buck_mode, > .sleep = REG_FIELD(DA9062AA_VBUCK3_A, > __builtin_ffs((int)DA9062AA_BUCK3_SL_A_MASK) - 1, > sizeof(unsigned int) * 8 - > @@ -435,6 +451,7 @@ static const struct da9062_regulator_info > local_da9061_regulator_info[] = { > .desc.vsel_reg = DA9062AA_VBUCK4_A, > .desc.vsel_mask = DA9062AA_VBUCK4_A_MASK, > .desc.linear_min_sel = 0, > + .desc.of_map_mode = da906x_map_buck_mode, > .sleep = REG_FIELD(DA9062AA_VBUCK4_A, > __builtin_ffs((int)DA9062AA_BUCK4_SL_A_MASK) - 1, > sizeof(unsigned int) * 8 - > @@ -607,6 +624,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 = da906x_map_buck_mode, > .sleep = REG_FIELD(DA9062AA_VBUCK1_A, > __builtin_ffs((int)DA9062AA_BUCK1_SL_A_MASK) - 1, > sizeof(unsigned int) * 8 - > @@ -643,6 +661,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 = da906x_map_buck_mode, > .sleep = REG_FIELD(DA9062AA_VBUCK2_A, > __builtin_ffs((int)DA9062AA_BUCK2_SL_A_MASK) - 1, > sizeof(unsigned int) * 8 - > @@ -679,6 +698,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 = da906x_map_buck_mode, > .sleep = REG_FIELD(DA9062AA_VBUCK3_A, > __builtin_ffs((int)DA9062AA_BUCK3_SL_A_MASK) - 1, > sizeof(unsigned int) * 8 - > @@ -715,6 +735,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 = da906x_map_buck_mode, > .sleep = REG_FIELD(DA9062AA_VBUCK4_A, > __builtin_ffs((int)DA9062AA_BUCK4_SL_A_MASK) - 1, > sizeof(unsigned int) * 8 - > -- > 2.1.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
On 07 November 2019 10:04, Christoph Fritz wrote: > This patch adds DT description of da906x buck regulator modes. Just the renames from da906x to da9063 required as per 01 patch comments > > Signed-off-by: Christoph Fritz <chf.fritz@googlemail.com> > --- > Documentation/devicetree/bindings/mfd/da9062.txt | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/Documentation/devicetree/bindings/mfd/da9062.txt > b/Documentation/devicetree/bindings/mfd/da9062.txt > index edca653..5989411 100644 > --- a/Documentation/devicetree/bindings/mfd/da9062.txt > +++ b/Documentation/devicetree/bindings/mfd/da9062.txt > @@ -66,6 +66,9 @@ Sub-nodes: > details of individual regulator device can be found in: > Documentation/devicetree/bindings/regulator/regulator.txt > > + regulator-initial-mode may be specified for buck regulators using mode values > + from include/dt-bindings/regulator/dlg,da906x-regulator.h. > + > - rtc : This node defines settings required for the Real-Time Clock associated > with the DA9062. There are currently no entries in this binding, however > compatible = "dlg,da9062-rtc" should be added if a node is created. > @@ -96,6 +99,7 @@ Example: > regulator-max-microvolt = <1570000>; > regulator-min-microamp = <500000>; > regulator-max-microamp = <2000000>; > + regulator-initial-mode = > <DA906X_BUCK_MODE_SYNC>; > regulator-boot-on; > }; > DA9062_LDO1: ldo1 { > -- > 2.1.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Hi Adam On Fri, 2019-11-08 at 10:37 +0000, Adam Thomson wrote: > > --- a/drivers/regulator/da9062-regulator.c > > +++ b/drivers/regulator/da9062-regulator.c > > @@ -16,6 +16,7 @@ > > #include <linux/regulator/of_regulator.h> > > #include <linux/mfd/da9062/core.h> > > #include <linux/mfd/da9062/registers.h> > > +#include <dt-bindings/regulator/dlg,da906x-regulator.h> > > Can we please rename this file to use da9063 instead of da906x [..] sure > > @@ -145,15 +138,14 @@ static unsigned da9062_buck_get_mode(struct > > regulator_dev *rdev) > > > > switch (val) { > > default: > > - case BUCK_MODE_MANUAL: > > mode = REGULATOR_MODE_FAST | > > REGULATOR_MODE_STANDBY; > > /* Sleep flag bit decides the mode */ > > break; > > I'm not sure your code is based on the latest regulator updates as I believe > Axel Lin made some improvements to this bit of code. Checkout Mark's regulator > fork of the kernel. yes, the line mode = REGULATOR_MODE_FAST | REGULATOR_MODE_STANDBY; is now gone by commit be446f183ae35a8c76 regulator: da9062: Simplify da9062_buck_set_mode for BUCK_MODE_MANUAL case it's already in linux-next, I'll rebase this patchset > > diff --git a/include/dt-bindings/regulator/dlg,da906x-regulator.h b/include/dt- > > bindings/regulator/dlg,da906x-regulator.h > > new file mode 100644 > > index 00000000..848a4df > > --- /dev/null > > +++ b/include/dt-bindings/regulator/dlg,da906x-regulator.h > > @@ -0,0 +1,16 @@ > > +/* SPDX-License-Identifier: GPL-2.0 */ > > + > > +#ifndef __DLG_DA906X_REGULATOR_H > > +#define __DLG_DA906X_REGULATOR_H > > Just to echo previous comment, rename from DA906X to DA9063 ok _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
On Thu, 7 Nov 2019 11:04:09 +0100, Christoph Fritz wrote: > This patch adds DT description of da906x buck regulator modes. > > Signed-off-by: Christoph Fritz <chf.fritz@googlemail.com> > --- > Documentation/devicetree/bindings/mfd/da9062.txt | 4 ++++ > 1 file changed, 4 insertions(+) > Acked-by: Rob Herring <robh@kernel.org> _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel