linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/4] regulator: mp886x: two features and dt json convert
@ 2020-07-29  5:08 Jisheng Zhang
  2020-07-29  5:09 ` [PATCH v2 1/4] regulator: mp886x: implement set_ramp_delay Jisheng Zhang
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Jisheng Zhang @ 2020-07-29  5:08 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Rob Herring, Saravanan Sekar
  Cc: linux-kernel, devicetree

From: Jisheng Zhang <Jisheng.Zhang@synaptics.com>

This is to improve the mp886x regulator driver support.
patch1 implments .set_ramp_delay
patch2 and patch3 support the switch freq setting
patch4 converts dt binding to json-schema

Since v2:
  - put any schema conversions at the end of the series as Mark
    suggested.

Jisheng Zhang (4):
  regulator: mp886x: implement set_ramp_delay
  dt-bindings: regulator: mp886x: support mps,switch-frequency
  regulator: mp886x: support setting switch freq
  dt-bindings: regulator: Convert mp886x to json-schema

 .../devicetree/bindings/regulator/mp886x.txt  |  27 -----
 .../bindings/regulator/mps,mp886x.yaml        |  58 ++++++++++
 drivers/regulator/mp886x.c                    | 109 +++++++++++++++++-
 3 files changed, 164 insertions(+), 30 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/regulator/mp886x.txt
 create mode 100644 Documentation/devicetree/bindings/regulator/mps,mp886x.yaml

-- 
2.28.0.rc1



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

* [PATCH v2 1/4] regulator: mp886x: implement set_ramp_delay
  2020-07-29  5:08 [PATCH v2 0/4] regulator: mp886x: two features and dt json convert Jisheng Zhang
@ 2020-07-29  5:09 ` Jisheng Zhang
  2020-07-29  5:09 ` [PATCH v2 2/4] dt-bindings: regulator: mp886x: support mps,switch-frequency Jisheng Zhang
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Jisheng Zhang @ 2020-07-29  5:09 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Rob Herring, Saravanan Sekar
  Cc: linux-kernel, devicetree

From: Jisheng Zhang <Jisheng.Zhang@synaptics.com>

Implement the .set_ramp_delay for MP8867 and MP8869. MP8867 and MP8869
could share the implementation, the only difference is the slew_rates
array.

Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
---
 drivers/regulator/mp886x.c | 67 ++++++++++++++++++++++++++++++++++++--
 1 file changed, 64 insertions(+), 3 deletions(-)

diff --git a/drivers/regulator/mp886x.c b/drivers/regulator/mp886x.c
index 1786f7162019..3c9a6605b115 100644
--- a/drivers/regulator/mp886x.c
+++ b/drivers/regulator/mp886x.c
@@ -18,18 +18,48 @@
 #define  MP886X_V_BOOT		(1 << 7)
 #define MP886X_SYSCNTLREG1	0x01
 #define  MP886X_MODE		(1 << 0)
+#define  MP886X_SLEW_SHIFT	3
+#define  MP886X_SLEW_MASK	(0x7 << MP886X_SLEW_SHIFT)
 #define  MP886X_GO		(1 << 6)
 #define  MP886X_EN		(1 << 7)
 
+struct mp886x_cfg_info {
+	const struct regulator_ops *rops;
+	const int slew_rates[8];
+};
+
 struct mp886x_device_info {
 	struct device *dev;
 	struct regulator_desc desc;
 	struct regulator_init_data *regulator;
 	struct gpio_desc *en_gpio;
+	const struct mp886x_cfg_info *ci;
 	u32 r[2];
 	unsigned int sel;
 };
 
+static int mp886x_set_ramp(struct regulator_dev *rdev, int ramp)
+{
+	struct mp886x_device_info *di = rdev_get_drvdata(rdev);
+	const struct mp886x_cfg_info *ci = di->ci;
+	int reg = -1, i;
+
+	for (i = 0; i < ARRAY_SIZE(ci->slew_rates); i++) {
+		if (ramp <= ci->slew_rates[i])
+			reg = i;
+		else
+			break;
+	}
+
+	if (reg < 0) {
+		dev_err(di->dev, "unsupported ramp value %d\n", ramp);
+		return -EINVAL;
+	}
+
+	return regmap_update_bits(rdev->regmap, MP886X_SYSCNTLREG1,
+				  MP886X_SLEW_MASK, reg << MP886X_SLEW_SHIFT);
+}
+
 static int mp886x_set_mode(struct regulator_dev *rdev, unsigned int mode)
 {
 	switch (mode) {
@@ -117,6 +147,21 @@ static const struct regulator_ops mp8869_regulator_ops = {
 	.is_enabled = regulator_is_enabled_regmap,
 	.set_mode = mp886x_set_mode,
 	.get_mode = mp886x_get_mode,
+	.set_ramp_delay = mp886x_set_ramp,
+};
+
+static const struct mp886x_cfg_info mp8869_ci = {
+	.rops = &mp8869_regulator_ops,
+	.slew_rates = {
+		40000,
+		30000,
+		20000,
+		10000,
+		5000,
+		2500,
+		1250,
+		625,
+	},
 };
 
 static int mp8867_set_voltage_sel(struct regulator_dev *rdev, unsigned int sel)
@@ -173,6 +218,21 @@ static const struct regulator_ops mp8867_regulator_ops = {
 	.is_enabled = regulator_is_enabled_regmap,
 	.set_mode = mp886x_set_mode,
 	.get_mode = mp886x_get_mode,
+	.set_ramp_delay = mp886x_set_ramp,
+};
+
+static const struct mp886x_cfg_info mp8867_ci = {
+	.rops = &mp8867_regulator_ops,
+	.slew_rates = {
+		64000,
+		32000,
+		16000,
+		8000,
+		4000,
+		2000,
+		1000,
+		500,
+	},
 };
 
 static int mp886x_regulator_register(struct mp886x_device_info *di,
@@ -183,7 +243,7 @@ static int mp886x_regulator_register(struct mp886x_device_info *di,
 
 	rdesc->name = "mp886x-reg";
 	rdesc->supply_name = "vin";
-	rdesc->ops = of_device_get_match_data(di->dev);
+	rdesc->ops = di->ci->rops;
 	rdesc->type = REGULATOR_VOLTAGE;
 	rdesc->n_voltages = 128;
 	rdesc->enable_reg = MP886X_SYSCNTLREG1;
@@ -235,6 +295,7 @@ static int mp886x_i2c_probe(struct i2c_client *client,
 	if (IS_ERR(di->en_gpio))
 		return PTR_ERR(di->en_gpio);
 
+	di->ci = of_device_get_match_data(dev);
 	di->dev = dev;
 
 	regmap = devm_regmap_init_i2c(client, &mp886x_regmap_config);
@@ -259,11 +320,11 @@ static int mp886x_i2c_probe(struct i2c_client *client,
 static const struct of_device_id mp886x_dt_ids[] = {
 	{
 		.compatible = "mps,mp8867",
-		.data = &mp8867_regulator_ops
+		.data = &mp8867_ci
 	},
 	{
 		.compatible = "mps,mp8869",
-		.data = &mp8869_regulator_ops
+		.data = &mp8869_ci
 	},
 	{ }
 };
-- 
2.28.0.rc1



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

* [PATCH v2 2/4] dt-bindings: regulator: mp886x: support mps,switch-frequency
  2020-07-29  5:08 [PATCH v2 0/4] regulator: mp886x: two features and dt json convert Jisheng Zhang
  2020-07-29  5:09 ` [PATCH v2 1/4] regulator: mp886x: implement set_ramp_delay Jisheng Zhang
@ 2020-07-29  5:09 ` Jisheng Zhang
  2020-07-31 21:18   ` Rob Herring
  2020-07-29  5:10 ` [PATCH v2 3/4] regulator: mp886x: support setting switch freq Jisheng Zhang
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 8+ messages in thread
From: Jisheng Zhang @ 2020-07-29  5:09 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Rob Herring, Saravanan Sekar
  Cc: linux-kernel, devicetree

From: Jisheng Zhang <Jisheng.Zhang@synaptics.com>

Both MP8867 and MP8869 support different switch frequency.

Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
---
 Documentation/devicetree/bindings/regulator/mp886x.txt | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Documentation/devicetree/bindings/regulator/mp886x.txt b/Documentation/devicetree/bindings/regulator/mp886x.txt
index 551867829459..e747000cebba 100644
--- a/Documentation/devicetree/bindings/regulator/mp886x.txt
+++ b/Documentation/devicetree/bindings/regulator/mp886x.txt
@@ -9,6 +9,10 @@ Required properties:
 - mps,fb-voltage-divider: An array of two integers containing the resistor
   values R1 and R2 of the feedback voltage divider in kilo ohms.
 
+Optional properties:
+- mps,switch-frequency: The valid switch frequency in Hertz. Available values
+  are: 500000, 750000, 1000000, 1250000, 1500000
+
 Any property defined as part of the core regulator binding, defined in
 ./regulator.txt, can also be used.
 
-- 
2.28.0.rc1



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

* [PATCH v2 3/4] regulator: mp886x: support setting switch freq
  2020-07-29  5:08 [PATCH v2 0/4] regulator: mp886x: two features and dt json convert Jisheng Zhang
  2020-07-29  5:09 ` [PATCH v2 1/4] regulator: mp886x: implement set_ramp_delay Jisheng Zhang
  2020-07-29  5:09 ` [PATCH v2 2/4] dt-bindings: regulator: mp886x: support mps,switch-frequency Jisheng Zhang
@ 2020-07-29  5:10 ` Jisheng Zhang
  2020-07-29  5:10 ` [PATCH v2 4/4] dt-bindings: regulator: Convert mp886x to json-schema Jisheng Zhang
  2020-08-03 15:52 ` [PATCH v2 0/4] regulator: mp886x: two features and dt json convert Mark Brown
  4 siblings, 0 replies; 8+ messages in thread
From: Jisheng Zhang @ 2020-07-29  5:10 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Rob Herring, Saravanan Sekar
  Cc: linux-kernel, devicetree

From: Jisheng Zhang <Jisheng.Zhang@synaptics.com>

Both MP8867 and MP8869 support different switch frequency.

Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
---
 drivers/regulator/mp886x.c | 42 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/drivers/regulator/mp886x.c b/drivers/regulator/mp886x.c
index 3c9a6605b115..e3c7813bed4b 100644
--- a/drivers/regulator/mp886x.c
+++ b/drivers/regulator/mp886x.c
@@ -22,10 +22,14 @@
 #define  MP886X_SLEW_MASK	(0x7 << MP886X_SLEW_SHIFT)
 #define  MP886X_GO		(1 << 6)
 #define  MP886X_EN		(1 << 7)
+#define MP8869_SYSCNTLREG2	0x02
 
 struct mp886x_cfg_info {
 	const struct regulator_ops *rops;
 	const int slew_rates[8];
+	const int switch_freq[4];
+	const u8 fs_reg;
+	const u8 fs_shift;
 };
 
 struct mp886x_device_info {
@@ -60,6 +64,24 @@ static int mp886x_set_ramp(struct regulator_dev *rdev, int ramp)
 				  MP886X_SLEW_MASK, reg << MP886X_SLEW_SHIFT);
 }
 
+static void mp886x_set_switch_freq(struct mp886x_device_info *di,
+				   struct regmap *regmap,
+				   u32 freq)
+{
+	const struct mp886x_cfg_info *ci = di->ci;
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(ci->switch_freq); i++) {
+		if (freq == ci->switch_freq[i]) {
+			regmap_update_bits(regmap, ci->fs_reg,
+				  0x3 << ci->fs_shift, i << ci->fs_shift);
+			return;
+		}
+	}
+
+	dev_err(di->dev, "invalid frequency %d\n", freq);
+}
+
 static int mp886x_set_mode(struct regulator_dev *rdev, unsigned int mode)
 {
 	switch (mode) {
@@ -162,6 +184,14 @@ static const struct mp886x_cfg_info mp8869_ci = {
 		1250,
 		625,
 	},
+	.switch_freq = {
+		500000,
+		750000,
+		1000000,
+		1250000,
+	},
+	.fs_reg = MP8869_SYSCNTLREG2,
+	.fs_shift = 4,
 };
 
 static int mp8867_set_voltage_sel(struct regulator_dev *rdev, unsigned int sel)
@@ -233,6 +263,14 @@ static const struct mp886x_cfg_info mp8867_ci = {
 		1000,
 		500,
 	},
+	.switch_freq = {
+		500000,
+		750000,
+		1000000,
+		1500000,
+	},
+	.fs_reg = MP886X_SYSCNTLREG1,
+	.fs_shift = 1,
 };
 
 static int mp886x_regulator_register(struct mp886x_device_info *di,
@@ -274,6 +312,7 @@ static int mp886x_i2c_probe(struct i2c_client *client,
 	struct mp886x_device_info *di;
 	struct regulator_config config = { };
 	struct regmap *regmap;
+	u32 freq;
 	int ret;
 
 	di = devm_kzalloc(dev, sizeof(struct mp886x_device_info), GFP_KERNEL);
@@ -311,6 +350,9 @@ static int mp886x_i2c_probe(struct i2c_client *client,
 	config.driver_data = di;
 	config.of_node = np;
 
+	if (!of_property_read_u32(np, "mps,switch-frequency", &freq))
+		mp886x_set_switch_freq(di, regmap, freq);
+
 	ret = mp886x_regulator_register(di, &config);
 	if (ret < 0)
 		dev_err(dev, "Failed to register regulator!\n");
-- 
2.28.0.rc1



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

* [PATCH v2 4/4] dt-bindings: regulator: Convert mp886x to json-schema
  2020-07-29  5:08 [PATCH v2 0/4] regulator: mp886x: two features and dt json convert Jisheng Zhang
                   ` (2 preceding siblings ...)
  2020-07-29  5:10 ` [PATCH v2 3/4] regulator: mp886x: support setting switch freq Jisheng Zhang
@ 2020-07-29  5:10 ` Jisheng Zhang
  2020-07-31 21:20   ` Rob Herring
  2020-08-03 15:52 ` [PATCH v2 0/4] regulator: mp886x: two features and dt json convert Mark Brown
  4 siblings, 1 reply; 8+ messages in thread
From: Jisheng Zhang @ 2020-07-29  5:10 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Rob Herring, Saravanan Sekar
  Cc: linux-kernel, devicetree

From: Jisheng Zhang <Jisheng.Zhang@synaptics.com>

Convert the mp886x binding to DT schema format using json-schema.

Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
---
 .../devicetree/bindings/regulator/mp886x.txt  | 31 ----------
 .../bindings/regulator/mps,mp886x.yaml        | 58 +++++++++++++++++++
 2 files changed, 58 insertions(+), 31 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/regulator/mp886x.txt
 create mode 100644 Documentation/devicetree/bindings/regulator/mps,mp886x.yaml

diff --git a/Documentation/devicetree/bindings/regulator/mp886x.txt b/Documentation/devicetree/bindings/regulator/mp886x.txt
deleted file mode 100644
index e747000cebba..000000000000
--- a/Documentation/devicetree/bindings/regulator/mp886x.txt
+++ /dev/null
@@ -1,31 +0,0 @@
-Monolithic Power Systems MP8867/MP8869 voltage regulator
-
-Required properties:
-- compatible: Must be one of the following.
-	"mps,mp8867"
-	"mps,mp8869"
-- reg: I2C slave address.
-- enable-gpios: enable gpios.
-- mps,fb-voltage-divider: An array of two integers containing the resistor
-  values R1 and R2 of the feedback voltage divider in kilo ohms.
-
-Optional properties:
-- mps,switch-frequency: The valid switch frequency in Hertz. Available values
-  are: 500000, 750000, 1000000, 1250000, 1500000
-
-Any property defined as part of the core regulator binding, defined in
-./regulator.txt, can also be used.
-
-Example:
-
-	vcpu: regulator@62 {
-		compatible = "mps,mp8869";
-		regulator-name = "vcpu";
-		regulator-min-microvolt = <700000>;
-		regulator-max-microvolt = <850000>;
-		regulator-always-on;
-		regulator-boot-on;
-		enable-gpios = <&porta 1 GPIO_ACTIVE_LOW>;
-		mps,fb-voltage-divider = <80 240>;
-		reg = <0x62>;
-	};
diff --git a/Documentation/devicetree/bindings/regulator/mps,mp886x.yaml b/Documentation/devicetree/bindings/regulator/mps,mp886x.yaml
new file mode 100644
index 000000000000..991f2de7eda8
--- /dev/null
+++ b/Documentation/devicetree/bindings/regulator/mps,mp886x.yaml
@@ -0,0 +1,58 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/regulator/mps,mp886x.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Monolithic Power Systems MP8867/MP8869 voltage regulator
+
+maintainers:
+  - Jisheng Zhang <jszhang@kernel.org>
+
+properties:
+  compatible:
+    enum:
+      - mps,mp8867
+      - mps,mp8869
+
+  reg:
+    maxItems: 1
+
+  enable-gpios:
+    description: GPIO to enable/disable the regulator.
+    maxItems: 1
+
+  mps,fb-voltage-divider:
+    description: An array of two integers containing the resistor
+      values R1 and R2 of the feedback voltage divider in kilo ohms.
+    $ref: "/schemas/types.yaml#/definitions/uint32-array"
+
+  mps,switch-frequency:
+    description: The valid switch frequency in Hertz.
+    enum: [500000, 750000, 1000000, 1250000, 1500000]
+    $ref: "/schemas/types.yaml#/definitions/uint32"
+
+required:
+  - compatible
+  - reg
+  - enable-gpios
+  - mps,fb-voltage-divider
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+        regulator@62 {
+          compatible = "mps,mp8869";
+          regulator-name = "vcpu";
+          regulator-min-microvolt = <800000>;
+          regulator-max-microvolt = <1150000>;
+          enable-gpios = <&porta 1 GPIO_ACTIVE_LOW>;
+          mps,fb-voltage-divider = <80 240>;
+          reg = <0x62>;
+        };
+    };
+
+...
-- 
2.28.0.rc1



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

* Re: [PATCH v2 2/4] dt-bindings: regulator: mp886x: support mps,switch-frequency
  2020-07-29  5:09 ` [PATCH v2 2/4] dt-bindings: regulator: mp886x: support mps,switch-frequency Jisheng Zhang
@ 2020-07-31 21:18   ` Rob Herring
  0 siblings, 0 replies; 8+ messages in thread
From: Rob Herring @ 2020-07-31 21:18 UTC (permalink / raw)
  To: Jisheng Zhang
  Cc: Liam Girdwood, Mark Brown, Saravanan Sekar, linux-kernel, devicetree

On Wed, Jul 29, 2020 at 01:09:52PM +0800, Jisheng Zhang wrote:
> From: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
> 
> Both MP8867 and MP8869 support different switch frequency.
> 
> Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
> ---
>  Documentation/devicetree/bindings/regulator/mp886x.txt | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/regulator/mp886x.txt b/Documentation/devicetree/bindings/regulator/mp886x.txt
> index 551867829459..e747000cebba 100644
> --- a/Documentation/devicetree/bindings/regulator/mp886x.txt
> +++ b/Documentation/devicetree/bindings/regulator/mp886x.txt
> @@ -9,6 +9,10 @@ Required properties:
>  - mps,fb-voltage-divider: An array of two integers containing the resistor
>    values R1 and R2 of the feedback voltage divider in kilo ohms.
>  
> +Optional properties:
> +- mps,switch-frequency: The valid switch frequency in Hertz. Available values

mps,switch-frequency-hz

> +  are: 500000, 750000, 1000000, 1250000, 1500000
> +
>  Any property defined as part of the core regulator binding, defined in
>  ./regulator.txt, can also be used.
>  
> -- 
> 2.28.0.rc1
> 
> 

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

* Re: [PATCH v2 4/4] dt-bindings: regulator: Convert mp886x to json-schema
  2020-07-29  5:10 ` [PATCH v2 4/4] dt-bindings: regulator: Convert mp886x to json-schema Jisheng Zhang
@ 2020-07-31 21:20   ` Rob Herring
  0 siblings, 0 replies; 8+ messages in thread
From: Rob Herring @ 2020-07-31 21:20 UTC (permalink / raw)
  To: Jisheng Zhang
  Cc: Liam Girdwood, Mark Brown, Saravanan Sekar, linux-kernel, devicetree

On Wed, Jul 29, 2020 at 01:10:52PM +0800, Jisheng Zhang wrote:
> From: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
> 
> Convert the mp886x binding to DT schema format using json-schema.
> 
> Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
> ---
>  .../devicetree/bindings/regulator/mp886x.txt  | 31 ----------
>  .../bindings/regulator/mps,mp886x.yaml        | 58 +++++++++++++++++++
>  2 files changed, 58 insertions(+), 31 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/regulator/mp886x.txt
>  create mode 100644 Documentation/devicetree/bindings/regulator/mps,mp886x.yaml
> 
> diff --git a/Documentation/devicetree/bindings/regulator/mp886x.txt b/Documentation/devicetree/bindings/regulator/mp886x.txt
> deleted file mode 100644
> index e747000cebba..000000000000
> --- a/Documentation/devicetree/bindings/regulator/mp886x.txt
> +++ /dev/null
> @@ -1,31 +0,0 @@
> -Monolithic Power Systems MP8867/MP8869 voltage regulator
> -
> -Required properties:
> -- compatible: Must be one of the following.
> -	"mps,mp8867"
> -	"mps,mp8869"
> -- reg: I2C slave address.
> -- enable-gpios: enable gpios.
> -- mps,fb-voltage-divider: An array of two integers containing the resistor
> -  values R1 and R2 of the feedback voltage divider in kilo ohms.
> -
> -Optional properties:
> -- mps,switch-frequency: The valid switch frequency in Hertz. Available values
> -  are: 500000, 750000, 1000000, 1250000, 1500000
> -
> -Any property defined as part of the core regulator binding, defined in
> -./regulator.txt, can also be used.
> -
> -Example:
> -
> -	vcpu: regulator@62 {
> -		compatible = "mps,mp8869";
> -		regulator-name = "vcpu";
> -		regulator-min-microvolt = <700000>;
> -		regulator-max-microvolt = <850000>;
> -		regulator-always-on;
> -		regulator-boot-on;
> -		enable-gpios = <&porta 1 GPIO_ACTIVE_LOW>;
> -		mps,fb-voltage-divider = <80 240>;
> -		reg = <0x62>;
> -	};
> diff --git a/Documentation/devicetree/bindings/regulator/mps,mp886x.yaml b/Documentation/devicetree/bindings/regulator/mps,mp886x.yaml
> new file mode 100644
> index 000000000000..991f2de7eda8
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/regulator/mps,mp886x.yaml
> @@ -0,0 +1,58 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/regulator/mps,mp886x.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Monolithic Power Systems MP8867/MP8869 voltage regulator
> +
> +maintainers:
> +  - Jisheng Zhang <jszhang@kernel.org>

Needs a $ref to regulator.yaml.

> +
> +properties:
> +  compatible:
> +    enum:
> +      - mps,mp8867
> +      - mps,mp8869
> +
> +  reg:
> +    maxItems: 1
> +
> +  enable-gpios:
> +    description: GPIO to enable/disable the regulator.
> +    maxItems: 1
> +
> +  mps,fb-voltage-divider:
> +    description: An array of two integers containing the resistor

Sounds like a constraint. Add 'maxItems: 2'.

> +      values R1 and R2 of the feedback voltage divider in kilo ohms.
> +    $ref: "/schemas/types.yaml#/definitions/uint32-array"
> +
> +  mps,switch-frequency:
> +    description: The valid switch frequency in Hertz.
> +    enum: [500000, 750000, 1000000, 1250000, 1500000]
> +    $ref: "/schemas/types.yaml#/definitions/uint32"

With -hz added, the type will already be defined, so you can drop the 
$ref.

> +
> +required:
> +  - compatible
> +  - reg
> +  - enable-gpios
> +  - mps,fb-voltage-divider
> +
> +examples:
> +  - |
> +    #include <dt-bindings/gpio/gpio.h>
> +    i2c {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +        regulator@62 {
> +          compatible = "mps,mp8869";
> +          regulator-name = "vcpu";
> +          regulator-min-microvolt = <800000>;
> +          regulator-max-microvolt = <1150000>;
> +          enable-gpios = <&porta 1 GPIO_ACTIVE_LOW>;
> +          mps,fb-voltage-divider = <80 240>;
> +          reg = <0x62>;
> +        };
> +    };
> +
> +...
> -- 
> 2.28.0.rc1
> 
> 

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

* Re: [PATCH v2 0/4] regulator: mp886x: two features and dt json convert
  2020-07-29  5:08 [PATCH v2 0/4] regulator: mp886x: two features and dt json convert Jisheng Zhang
                   ` (3 preceding siblings ...)
  2020-07-29  5:10 ` [PATCH v2 4/4] dt-bindings: regulator: Convert mp886x to json-schema Jisheng Zhang
@ 2020-08-03 15:52 ` Mark Brown
  4 siblings, 0 replies; 8+ messages in thread
From: Mark Brown @ 2020-08-03 15:52 UTC (permalink / raw)
  To: Rob Herring, Saravanan Sekar, Liam Girdwood, Jisheng Zhang
  Cc: linux-kernel, devicetree

On Wed, 29 Jul 2020 13:08:39 +0800, Jisheng Zhang wrote:
> This is to improve the mp886x regulator driver support.
> patch1 implments .set_ramp_delay
> patch2 and patch3 support the switch freq setting
> patch4 converts dt binding to json-schema
> 
> Since v2:
>   - put any schema conversions at the end of the series as Mark
>     suggested.
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next

Thanks!

[1/3] regulator: mp886x: implement set_ramp_delay
      commit: 0eddcf0267f913cb6336af64cadaf5acf6b19b7b
[2/3] regulator: mp886x: support mps,switch-frequency
      commit: b4b85af052f434bc3be5ee18462164986618feb1
[3/3] regulator: mp886x: support setting switch freq
      commit: ee6ad5a24575071b66bd37ffb2d8747a64fcb45f

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

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

end of thread, other threads:[~2020-08-03 15:53 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-29  5:08 [PATCH v2 0/4] regulator: mp886x: two features and dt json convert Jisheng Zhang
2020-07-29  5:09 ` [PATCH v2 1/4] regulator: mp886x: implement set_ramp_delay Jisheng Zhang
2020-07-29  5:09 ` [PATCH v2 2/4] dt-bindings: regulator: mp886x: support mps,switch-frequency Jisheng Zhang
2020-07-31 21:18   ` Rob Herring
2020-07-29  5:10 ` [PATCH v2 3/4] regulator: mp886x: support setting switch freq Jisheng Zhang
2020-07-29  5:10 ` [PATCH v2 4/4] dt-bindings: regulator: Convert mp886x to json-schema Jisheng Zhang
2020-07-31 21:20   ` Rob Herring
2020-08-03 15:52 ` [PATCH v2 0/4] regulator: mp886x: two features and dt json convert Mark Brown

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).