devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] regulator da9062: add and make use of map_mode support
@ 2018-02-09 10:05 Christoph Fritz
       [not found] ` <1518170721-28198-1-git-send-email-chf.fritz-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Christoph Fritz @ 2018-02-09 10:05 UTC (permalink / raw)
  To: Shawn Guo, Rob Herring, Fabio Estevam
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	Christian Hemp

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(+)

-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/3] regulator: da9062: add of_map_mode support for bucks
       [not found] ` <1518170721-28198-1-git-send-email-chf.fritz-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
@ 2018-02-09 10:05   ` Christoph Fritz
       [not found]     ` <1518170721-28198-2-git-send-email-chf.fritz-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
  2018-02-09 10:05   ` [PATCH 2/3] dt-bindings: regulator: describe da9062's regulator modes Christoph Fritz
  2018-02-09 10:05   ` [PATCH 3/3] ARM: dts: phycore-imx6: set buck regulator modes explicitly Christoph Fritz
  2 siblings, 1 reply; 8+ messages in thread
From: Christoph Fritz @ 2018-02-09 10:05 UTC (permalink / raw)
  To: Shawn Guo, Rob Herring, Fabio Estevam
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	Christian Hemp

This patch adds of_map_mode support for bucks to set regulator modes
from within regulator framework.

Signed-off-by: Christoph Fritz <chf.fritz-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
Signed-off-by: Christian Hemp <c.hemp-guT5V/WYfQezQB+pC5nmwQ@public.gmane.org>
---
 drivers/regulator/da9062-regulator.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/drivers/regulator/da9062-regulator.c b/drivers/regulator/da9062-regulator.c
index 34a70d9..321abd0 100644
--- a/drivers/regulator/da9062-regulator.c
+++ b/drivers/regulator/da9062-regulator.c
@@ -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 -
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/3] dt-bindings: regulator: describe da9062's regulator modes
       [not found] ` <1518170721-28198-1-git-send-email-chf.fritz-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
  2018-02-09 10:05   ` [PATCH 1/3] regulator: da9062: add of_map_mode support for bucks Christoph Fritz
@ 2018-02-09 10:05   ` Christoph Fritz
       [not found]     ` <1518170721-28198-3-git-send-email-chf.fritz-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
  2018-02-09 10:05   ` [PATCH 3/3] ARM: dts: phycore-imx6: set buck regulator modes explicitly Christoph Fritz
  2 siblings, 1 reply; 8+ messages in thread
From: Christoph Fritz @ 2018-02-09 10:05 UTC (permalink / raw)
  To: Shawn Guo, Rob Herring, Fabio Estevam
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	Christian Hemp

This patch adds DT description of da9062's buck regulator modes.

Signed-off-by: Christoph Fritz <chf.fritz-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
---
 Documentation/devicetree/bindings/mfd/da9062.txt | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/Documentation/devicetree/bindings/mfd/da9062.txt b/Documentation/devicetree/bindings/mfd/da9062.txt
index c0a418c..b871bc2 100644
--- a/Documentation/devicetree/bindings/mfd/da9062.txt
+++ b/Documentation/devicetree/bindings/mfd/da9062.txt
@@ -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
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/3] ARM: dts: phycore-imx6: set buck regulator modes explicitly
       [not found] ` <1518170721-28198-1-git-send-email-chf.fritz-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
  2018-02-09 10:05   ` [PATCH 1/3] regulator: da9062: add of_map_mode support for bucks Christoph Fritz
  2018-02-09 10:05   ` [PATCH 2/3] dt-bindings: regulator: describe da9062's regulator modes Christoph Fritz
@ 2018-02-09 10:05   ` Christoph Fritz
       [not found]     ` <1518170721-28198-4-git-send-email-chf.fritz-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
  2018-02-24  7:17     ` Shawn Guo
  2 siblings, 2 replies; 8+ messages in thread
From: Christoph Fritz @ 2018-02-09 10:05 UTC (permalink / raw)
  To: Shawn Guo, Rob Herring, Fabio Estevam
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	Christian Hemp

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-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
Signed-off-by: Christian Hemp <c.hemp-guT5V/WYfQezQB+pC5nmwQ@public.gmane.org>
---
 arch/arm/boot/dts/imx6qdl-phytec-phycore-som.dtsi | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/boot/dts/imx6qdl-phytec-phycore-som.dtsi b/arch/arm/boot/dts/imx6qdl-phytec-phycore-som.dtsi
index 53e4337..2ad1336 100644
--- a/arch/arm/boot/dts/imx6qdl-phytec-phycore-som.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-phytec-phycore-som.dtsi
@@ -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;
 			};
 
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/3] regulator: da9062: add of_map_mode support for bucks
       [not found]     ` <1518170721-28198-2-git-send-email-chf.fritz-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
@ 2018-02-09 20:11       ` Fabio Estevam
  0 siblings, 0 replies; 8+ messages in thread
From: Fabio Estevam @ 2018-02-09 20:11 UTC (permalink / raw)
  To: Christoph Fritz
  Cc: Shawn Guo, Rob Herring, Fabio Estevam,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
	Christian Hemp

On Fri, Feb 9, 2018 at 8:05 AM, Christoph Fritz
<chf.fritz-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:
> This patch adds of_map_mode support for bucks to set regulator modes
> from within regulator framework.
>
> Signed-off-by: Christoph Fritz <chf.fritz-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
> Signed-off-by: Christian Hemp <c.hemp-guT5V/WYfQezQB+pC5nmwQ@public.gmane.org>

Reviewed-by: Fabio Estevam <fabio.estevam-3arQi8VN3Tc@public.gmane.org>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/3] dt-bindings: regulator: describe da9062's regulator modes
       [not found]     ` <1518170721-28198-3-git-send-email-chf.fritz-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
@ 2018-02-09 20:14       ` Fabio Estevam
  0 siblings, 0 replies; 8+ messages in thread
From: Fabio Estevam @ 2018-02-09 20:14 UTC (permalink / raw)
  To: Christoph Fritz
  Cc: Shawn Guo, Rob Herring, Fabio Estevam,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
	Christian Hemp

On Fri, Feb 9, 2018 at 8:05 AM, Christoph Fritz
<chf.fritz-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:
> This patch adds DT description of da9062's buck regulator modes.
>
> Signed-off-by: Christoph Fritz <chf.fritz-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
> ---
>  Documentation/devicetree/bindings/mfd/da9062.txt | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/mfd/da9062.txt b/Documentation/devicetree/bindings/mfd/da9062.txt
> index c0a418c..b871bc2 100644
> --- a/Documentation/devicetree/bindings/mfd/da9062.txt
> +++ b/Documentation/devicetree/bindings/mfd/da9062.txt
> @@ -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.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/3] ARM: dts: phycore-imx6: set buck regulator modes explicitly
       [not found]     ` <1518170721-28198-4-git-send-email-chf.fritz-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
@ 2018-02-09 20:14       ` Fabio Estevam
  0 siblings, 0 replies; 8+ messages in thread
From: Fabio Estevam @ 2018-02-09 20:14 UTC (permalink / raw)
  To: Christoph Fritz
  Cc: Shawn Guo, Rob Herring, Fabio Estevam,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
	Christian Hemp

On Fri, Feb 9, 2018 at 8:05 AM, Christoph Fritz
<chf.fritz-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:
> 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-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
> Signed-off-by: Christian Hemp <c.hemp-guT5V/WYfQezQB+pC5nmwQ@public.gmane.org>

Reviewed-by: Fabio Estevam <fabio.estevam-3arQi8VN3Tc@public.gmane.org>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/3] ARM: dts: phycore-imx6: set buck regulator modes explicitly
  2018-02-09 10:05   ` [PATCH 3/3] ARM: dts: phycore-imx6: set buck regulator modes explicitly Christoph Fritz
       [not found]     ` <1518170721-28198-4-git-send-email-chf.fritz-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
@ 2018-02-24  7:17     ` Shawn Guo
  1 sibling, 0 replies; 8+ messages in thread
From: Shawn Guo @ 2018-02-24  7:17 UTC (permalink / raw)
  To: Christoph Fritz
  Cc: Fabio Estevam, devicetree, Rob Herring, linux-arm-kernel, Christian Hemp

On Fri, Feb 09, 2018 at 11:05:21AM +0100, Christoph Fritz wrote:
> 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>
> Signed-off-by: Christian Hemp <c.hemp@phytec.de>

Looks good to me.  Ping me to pick it up when first two patches are
accepted.

Shawn

> ---
>  arch/arm/boot/dts/imx6qdl-phytec-phycore-som.dtsi | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/imx6qdl-phytec-phycore-som.dtsi b/arch/arm/boot/dts/imx6qdl-phytec-phycore-som.dtsi
> index 53e4337..2ad1336 100644
> --- a/arch/arm/boot/dts/imx6qdl-phytec-phycore-som.dtsi
> +++ b/arch/arm/boot/dts/imx6qdl-phytec-phycore-som.dtsi
> @@ -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;
>  			};
>  
> -- 
> 2.1.4
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-02-24  7:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-09 10:05 [PATCH 0/3] regulator da9062: add and make use of map_mode support Christoph Fritz
     [not found] ` <1518170721-28198-1-git-send-email-chf.fritz-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
2018-02-09 10:05   ` [PATCH 1/3] regulator: da9062: add of_map_mode support for bucks Christoph Fritz
     [not found]     ` <1518170721-28198-2-git-send-email-chf.fritz-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
2018-02-09 20:11       ` Fabio Estevam
2018-02-09 10:05   ` [PATCH 2/3] dt-bindings: regulator: describe da9062's regulator modes Christoph Fritz
     [not found]     ` <1518170721-28198-3-git-send-email-chf.fritz-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
2018-02-09 20:14       ` Fabio Estevam
2018-02-09 10:05   ` [PATCH 3/3] ARM: dts: phycore-imx6: set buck regulator modes explicitly Christoph Fritz
     [not found]     ` <1518170721-28198-4-git-send-email-chf.fritz-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
2018-02-09 20:14       ` Fabio Estevam
2018-02-24  7:17     ` Shawn Guo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).