Skip to contentSkip to conversation

regulator da9062: support setting buck modes

PATCH Superseded Christoph Fritz 4 participants 11 messages Nov 7, 2019 – Nov 13, 2019

Subsystems (5)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover regulator da9062: support setting buck modes

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
Signature · 1 line
2.1.4
#1 lore raw

PATCH 1/4 regulator: da9062: refactor buck modes into header

This patch refactors buck modes into a header so that device trees can make use of these mode constants.

---
 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
drivers/regulator/da9062-regulator.c +10 -18
index 710e670..1a95982 100644
@@ -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;
include/dt-bindings/regulator/dlg,da906x-regulator.h new file +16 -0
new file mode 100644
index 00000000..848a4df
@@ -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
Signature · 1 line
2.1.4
#2 lore raw

RE: [PATCH 1/4] regulator: da9062: refactor buck modes into header

Quoted 16 lines · Christoph Fritz

This patch refactors buck modes into a header so that device trees can make use of these mode constants.

---
 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
drivers/regulator/da9062- renamed from drivers/regulator/da9062-regulator.c +0 -0

regulator.c
index 710e670..1a95982 100644

drivers/regulator/da9062-regulator.c line 19

Quoted 4 lines
drivers/regulator/da9062-regulator.c +1 -0
@@ -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.

Quoted 37 lines
drivers/regulator/da9062-regulator.c +3 -11
 /* 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:
drivers/regulator/da9062-regulator.c +0 -0
 		return -EINVAL;

drivers/regulator/da9062-regulator.c static unsigned da9062_buck_get_mode(struct · line 145

Quoted 9 lines
drivers/regulator/da9062-regulator.c +0 -1
@@ -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.

Quoted 36 lines
drivers/regulator/da9062-regulator.c +3 -3
-	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;
drivers/regulator/da9062-regulator.c +3 -3
 	}
@@ -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:
drivers/regulator/da9062-regulator.c +0 -0
 		return -EINVAL;
include/dt- renamed from include/dt-bindings/regulator/dlg,da906x-regulator.h +0 -0

bindings/regulator/dlg,da906x-regulator.h
new file mode 100644
index 00000000..848a4df

include/dt-bindings/regulator/dlg,da906x-regulator.h line 4

Quoted 4 lines
include/dt-bindings/regulator/dlg,da906x-regulator.h new file +4 -0
@@ -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

Quoted 14 lines
include/dt-bindings/regulator/dlg,da906x-regulator.h new file +12 -1
+
+/*
+ * 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

#3 lore raw

Re: [PATCH 1/4] regulator: da9062: refactor buck modes into header

Hi Adam

Quoted 9 lines · Adam Thomson

drivers/regulator/da9062-regulator.c line 19

Quoted 7 lines
drivers/regulator/da9062-regulator.c +1 -0
@@ -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

Quoted 14 lines

drivers/regulator/da9062-regulator.c static unsigned da9062_buck_get_mode(struct · line 145

Quoted 10 lines
drivers/regulator/da9062-regulator.c +0 -1
@@ -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

Quoted 5 lines
Quoted 5 lines
include/dt- renamed from include/dt-bindings/regulator/dlg,da906x-regulator.h +0 -0

bindings/regulator/dlg,da906x-regulator.h
new file mode 100644
index 00000000..848a4df
--- /dev/null

Quoted 8 lines

include/dt- line 4

Quoted 6 lines

+++ b/include/dt-bindings/regulator/dlg,da906x-regulator.h

include/dt- renamed from include/dt-bindings/regulator/dlg,da906x-regulator.h +4 -0
@@ -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

#4 lore raw

PATCH 2/4 regulator: da9062: add of_map_mode support for bucks

In reply to Christoph Fritz

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

---
 drivers/regulator/da9062-regulator.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
drivers/regulator/da9062-regulator.c +21 -0
index 1a95982..f5f2ead 100644
@@ -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 -
Signature · 1 line
2.1.4
#5 lore raw

RE: [PATCH 2/4] regulator: da9062: add of_map_mode support for bucks

Quoted 2 lines · Christoph Fritz

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.

Quoted 14 lines
---
 drivers/regulator/da9062-regulator.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
drivers/regulator/da9062- renamed from drivers/regulator/da9062-regulator.c +0 -0

regulator.c
index 1a95982..f5f2ead 100644

drivers/regulator/da9062-regulator.c static const unsigned int da9062_buck_b_limits[] = { · line 101

Quoted 4 lines
drivers/regulator/da9062-regulator.c +1 -0
@@ -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.

drivers/regulator/da9062-regulator.c static const unsigned int da9062_buck_b_limits[] = { · line 104

Quoted 3 lines
drivers/regulator/da9062-regulator.c +3 -0
+{
+	switch (mode) {
+	case DA906X_BUCK_MODE_SLEEP:

Obvioulsy these names will want updating as per my comments on patch 01 in the series.

Quoted 78 lines
drivers/regulator/da9062-regulator.c +11 -0
+		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,
drivers/regulator/da9062-regulator.c +1 -0
 			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,
drivers/regulator/da9062-regulator.c +1 -0
 			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,
drivers/regulator/da9062-regulator.c +1 -0
 			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,
drivers/regulator/da9062-regulator.c +1 -0
 			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,
drivers/regulator/da9062-regulator.c +1 -0
 			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,
drivers/regulator/da9062-regulator.c +1 -0
 			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

#6 lore raw

PATCH 3/4 dt-bindings: regulator: describe da906x buck regulator modes

In reply to Christoph Fritz

This patch adds DT description of da906x buck regulator modes.

---
 Documentation/devicetree/bindings/mfd/da9062.txt | 4 ++++
 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/mfd/da9062.txt +4 -0
index edca653..5989411 100644
@@ -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 {
Signature · 1 line
2.1.4
maintainer
#7 lore raw

Re: [PATCH 3/4] dt-bindings: regulator: describe da906x buck regulator modes

Quoted 1 line · Christoph Fritz

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.

#8 lore raw

RE: [PATCH 3/4] dt-bindings: regulator: describe da906x buck regulator modes

In reply to Christoph Fritz
Quoted 1 line · Christoph Fritz

This patch adds DT description of da906x buck regulator modes.

Just the renames from da906x to da9063 required as per 01 patch comments

Quoted 32 lines
---
 Documentation/devicetree/bindings/mfd/da9062.txt | 4 ++++
 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/mfd/da9062.txt +4 -0
index edca653..5989411 100644
@@ -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

#10 lore raw

PATCH 4/4 ARM: dts: phycore-imx6: set buck regulator modes explicitly

In reply to 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.

---
 arch/arm/boot/dts/imx6qdl-phytec-phycore-som.dtsi | 5 +++++
 1 file changed, 5 insertions(+)
arch/arm/boot/dts/imx6qdl-phytec-phycore-som.dtsi +5 -0
index 6486df3..e3f2181 100644
@@ -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;
 			};
 
Signature · 1 line
2.1.4