Skip to contentSkip to conversation

regulator: aw3750x: AW3750X regulator driver

PATCH New [email protected] 4 participants 6 messages Jul 5, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover regulator: aw3750x: AW3750X regulator driver

From: Ke Li <[email protected]>

AW37503 is a boost converter that integrates a step-up DC-DC converter, LDO and charge pump.Whose voltages can be programmed via an I2C compatible interface.
awinic,aw3750x.yaml describes pin information and output voltage.

Ke Li (2):
regulator: Add Awinic AW37503 boost regulator
regulator: aw3750x: Fix MODULE_LICENSE

 drivers/regulator/aw3750x.c | 1676 +++++++++++++++++++++++++++++++++++
 1 file changed, 1676 insertions(+)
 create mode 100644 drivers/regulator/aw3750x.c

base-commit: 3a8a670eeeaa40d87bd38a587438952741980c18

Signature · 1 line
2.41.0
#1 lore raw

PATCH 1/1 regulator: Add awinic,aw3750x.yaml

From: Ke Li <[email protected]>

---
 .../bindings/regulator/awinic,aw3750x.yaml    | 151 ++++++++++++++++++
 1 file changed, 151 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/awinic,aw3750x.yaml
Documentation/devicetree/bindings/regulator/awinic,aw3750x.yaml new file +151 -0
new file mode 100644
index 000000000000..cdb3d9dbf88f
@@ -0,0 +1,151 @@
+# SPDX-License-Identifier: GPL-2.0-only
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/regulator/awinic,aw3750x.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Awinic AW3750X Power Management IC
+
+maintainers:
+  - Weidong Wang <[email protected]>
+  - Ke Li <[email protected]>
+
+description: |
+  AW3750X is designed to generate both positive and negative bias voltages for.
+  TFT-LCD panels or other general dual-supply applications. It consists a highly
+  integrated synchronous boost converter with input voltage from 2.7V to 5.5V.
+
+properties:
+  compatible:
+    const: awinic,aw3750x_led
+
+  enp:
+    type: object
+    $ref: regulator.yaml#
+    description:
+      Properties for single LDO regulator.
+
+    properties:
+      regulator-name: true
+
+    required:
+      - regulator-name
+
+    unevaluatedProperties: false
+
+  enn:
+    type: object
+    $ref: regulator.yaml#
+    description:
+      Properties for single BOOST regulator.
+
+    properties:
+      regulator-name: true
+
+    required:
+      - regulator-name
+
+    unevaluatedProperties: false
+
+required:
+  - compatible
+  - enp
+  - enn
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/pinctrl/mt8186-pinfunc.h>
+    #include <dt-bindings/gpio/gpio.h>
+
+    pio: pinctrl@10005000 {
+      aw_enn_default: aw_enn_default {
+        pins_cmd_dat {
+          pinmux = <PINMUX_GPIO7__FUNC_GPIO7>;
+          slew-rate = <1>;
+          output-low;
+        };
+      };
+
+      aw_enn_output_high: aw_enn_output_high {
+        pins_cmd_dat {
+          pinmux = <PINMUX_GPIO7__FUNC_GPIO7>;
+          slew-rate = <1>;
+          output-high;
+        };
+      };
+
+      aw_enn_output_low: aw_enn_output_low {
+        pins_cmd_dat {
+          pinmux = <PINMUX_GPIO7__FUNC_GPIO7>;
+          slew-rate = <1>;
+          output-low;
+        };
+      };
+
+      aw_enp_default: aw_enp_default {
+        pins_cmd_dat {
+          pinmux = <PINMUX_GPIO1__FUNC_GPIO1>;
+          slew-rate = <1>;
+          output-low;
+        };
+      };
+
+      aw_enp_output_high: aw_enp_output_high {
+        pins_cmd_dat {
+          pinmux = <PINMUX_GPIO1__FUNC_GPIO1>;
+          slew-rate = <1>;
+          output-high;
+        };
+      };
+
+      aw_enp_output_low: aw_enp_output_low {
+        pins_cmd_dat {
+          pinmux = <PINMUX_GPIO1__FUNC_GPIO1>;
+          slew-rate = <1>;
+          output-low;
+        };
+      };
+
+    };
+
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        aw3750x@3e {
+            compatible = "awinic,aw3750x_led";
+            aw3750x_gpio_ctrl = <0>;
+            reg = <0x3e>;
+            outp = <0x0E>;
+            outn = <0x0E>;
+            enn-gpio = <&pio 7 0>;
+            enp-gpio = <&pio 1 0>;
+            pinctrl-names = "aw_enn_default", "aw_enn_output_high",
+                            "aw_enn_output_low", "aw_enp_default",
+                            "aw_enp_output_high", "aw_enp_output_low";
+            pinctrl-0 = <&aw_enn_default>;
+            pinctrl-1 = <&aw_enn_output_high>;
+            pinctrl-2 = <&aw_enn_output_low>;
+            pinctrl-3 = <&aw_enp_default>;
+            pinctrl-4 = <&aw_enp_output_high>;
+            pinctrl-5 = <&aw_enp_output_low>;
+
+            aw_lcdb_outp_vreg: enp {
+              label = "outp";
+              regulator-name = "outp";
+              regulator-min-microvolt = <4000000>;
+              regulator-max-microvolt = <6000000>;
+            };
+            aw_lcdb_outn_vreg: enn {
+              label = "outn";
+              regulator-name = "outn";
+              regulator-min-microvolt = <4000000>;
+              regulator-max-microvolt = <6000000>;
+            };
+        };
+    };
Signature · 1 line
2.41.0
#2 lore raw

Re: [PATCH V1 1/1] regulator: Add awinic,aw3750x.yaml

Quoted 1 line · On 05/07/2023 10:19, [email protected] wrote:

From: Ke Li <[email protected]>

Please use subject prefixes matching the subsystem. You can get them for example with git log --oneline -- DIRECTORY_OR_FILE on the directory your patch is touching.

Missing commit msg.

Quoted 13 lines
---
 .../bindings/regulator/awinic,aw3750x.yaml    | 151 ++++++++++++++++++
 1 file changed, 151 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/awinic,aw3750x.yaml
Documentation/devicetree/bindings/regulator/awinic,aw3750x.yaml new file +0 -0
new file mode 100644
index 000000000000..cdb3d9dbf88f

Documentation/devicetree/bindings/regulator/awinic,aw3750x.yaml line 1

Quoted 1 line
Documentation/devicetree/bindings/regulator/awinic,aw3750x.yaml new file +1 -0
@@ -0,0 +1,151 @@
+# SPDX-License-Identifier: GPL-2.0-only

Dual license.

Please run scripts/checkpatch.pl and fix reported warnings. Some warnings can be ignored, but the code here looks like it needs a fix. Feel free to get in touch if the warning is not clear.

Quoted 9 lines
Documentation/devicetree/bindings/regulator/awinic,aw3750x.yaml new file +9 -0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/regulator/awinic,aw3750x.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Awinic AW3750X Power Management IC
+
+maintainers:
+  - Weidong Wang <[email protected]>

Documentation/devicetree/bindings/regulator/awinic,aw3750x.yaml line 20

Quoted 10 lines
Documentation/devicetree/bindings/regulator/awinic,aw3750x.yaml new file +10 -0
+  - Ke Li <[email protected]>
+
+description: |
+  AW3750X is designed to generate both positive and negative bias voltages for.
+  TFT-LCD panels or other general dual-supply applications. It consists a highly
+  integrated synchronous boost converter with input voltage from 2.7V to 5.5V.
+
+properties:
+  compatible:
+    const: awinic,aw3750x_led

I don't understand why there is _led suffix. Isn't this regulator? Can it be anything else?

Also, x looks like a wildcard, which is not allowed in compatibles.

Documentation/devicetree/bindings/regulator/awinic,aw3750x.yaml line 29

Quoted 9 lines
Documentation/devicetree/bindings/regulator/awinic,aw3750x.yaml new file +9 -0
+
+  enp:
+    type: object
+    $ref: regulator.yaml#
+    description:
+      Properties for single LDO regulator.
+
+    properties:
+      regulator-name: true

Drop

Documentation/devicetree/bindings/regulator/awinic,aw3750x.yaml line 32

Quoted 3 lines
Documentation/devicetree/bindings/regulator/awinic,aw3750x.yaml new file +3 -0
+
+    required:
+      - regulator-name

Is it really required?

Quoted 51 lines
Documentation/devicetree/bindings/regulator/awinic,aw3750x.yaml new file +51 -0
+
+    unevaluatedProperties: false
+
+  enn:
+    type: object
+    $ref: regulator.yaml#
+    description:
+      Properties for single BOOST regulator.
+
+    properties:
+      regulator-name: true
+
+    required:
+      - regulator-name
+
+    unevaluatedProperties: false
+
+required:
+  - compatible
+  - enp
+  - enn
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/pinctrl/mt8186-pinfunc.h>
+    #include <dt-bindings/gpio/gpio.h>
+
+    pio: pinctrl@10005000 {
+      aw_enn_default: aw_enn_default {
+        pins_cmd_dat {
+          pinmux = <PINMUX_GPIO7__FUNC_GPIO7>;
+          slew-rate = <1>;
+          output-low;
+        };
+      };
+
+      aw_enn_output_high: aw_enn_output_high {
+        pins_cmd_dat {
+          pinmux = <PINMUX_GPIO7__FUNC_GPIO7>;
+          slew-rate = <1>;
+          output-high;
+        };
+      };
+
+      aw_enn_output_low: aw_enn_output_low {
+        pins_cmd_dat {
+          pinmux = <PINMUX_GPIO7__FUNC_GPIO7>;
+          slew-rate = <1>;
+          output-low;

Documentation/devicetree/bindings/regulator/awinic,aw3750x.yaml line 93

Quoted 10 lines
Documentation/devicetree/bindings/regulator/awinic,aw3750x.yaml new file +10 -0
+        };
+      };
+
+      aw_enp_default: aw_enp_default {
+        pins_cmd_dat {
+          pinmux = <PINMUX_GPIO1__FUNC_GPIO1>;
+          slew-rate = <1>;
+          output-low;
+        };
+      };

All this is incorrect and unrelated. Drop it.

Quoted 17 lines
Documentation/devicetree/bindings/regulator/awinic,aw3750x.yaml new file +17 -0
+
+      aw_enp_output_high: aw_enp_output_high {
+        pins_cmd_dat {
+          pinmux = <PINMUX_GPIO1__FUNC_GPIO1>;
+          slew-rate = <1>;
+          output-high;
+        };
+      };
+
+      aw_enp_output_low: aw_enp_output_low {
+        pins_cmd_dat {
+          pinmux = <PINMUX_GPIO1__FUNC_GPIO1>;
+          slew-rate = <1>;
+          output-low;
+        };
+      };
+

Documentation/devicetree/bindings/regulator/awinic,aw3750x.yaml line 120

Quoted 10 lines
Documentation/devicetree/bindings/regulator/awinic,aw3750x.yaml new file +10 -0
+    };
+
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        aw3750x@3e {

Node names should be generic. See also explanation and list of examples in DT specification:
https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation

Documentation/devicetree/bindings/regulator/awinic,aw3750x.yaml line 127

Quoted 7 lines
Documentation/devicetree/bindings/regulator/awinic,aw3750x.yaml new file +7 -0
+            compatible = "awinic,aw3750x_led";
+            aw3750x_gpio_ctrl = <0>;
+            reg = <0x3e>;
+            outp = <0x0E>;
+            outn = <0x0E>;
+            enn-gpio = <&pio 7 0>;
+            enp-gpio = <&pio 1 0>;

It does not look like you tested the bindings, at least after quick look. Please run make dt_binding_check (see Documentation/devicetree/bindings/writing-schema.rst for instructions). Maybe you need to update your dtschema and yamllint.

Documentation/devicetree/bindings/regulator/awinic,aw3750x.yaml line 139

Quoted 12 lines
Documentation/devicetree/bindings/regulator/awinic,aw3750x.yaml new file +12 -0
+            pinctrl-names = "aw_enn_default", "aw_enn_output_high",
+                            "aw_enn_output_low", "aw_enp_default",
+                            "aw_enp_output_high", "aw_enp_output_low";
+            pinctrl-0 = <&aw_enn_default>;
+            pinctrl-1 = <&aw_enn_output_high>;
+            pinctrl-2 = <&aw_enn_output_low>;
+            pinctrl-3 = <&aw_enp_default>;
+            pinctrl-4 = <&aw_enp_output_high>;
+            pinctrl-5 = <&aw_enp_output_low>;
+
+            aw_lcdb_outp_vreg: enp {
+              label = "outp";

Really?

Best regards,
Krzysztof

maintainer
#3 lore raw

Re: [PATCH V1 1/1] regulator: Add awinic,aw3750x.yaml

Quoted 9 lines · Krzysztof Kozlowski

Documentation/devicetree/bindings/regulator/awinic,aw3750x.yaml line 20

Quoted 5 lines · On 05/07/2023 10:19, [email protected] wrote:

From: Ke Li <[email protected]>

Documentation/devicetree/bindings/regulator/awinic,aw3750x.yaml new file +3 -0
+properties:
+  compatible:
+    const: awinic,aw3750x_led

I don't understand why there is _led suffix. Isn't this regulator? Can it be anything else?

Boost regulators are almost always used to drive LEDs for things like backlights.

#4 lore raw

Re: [PATCH V1 1/1] regulator: Add awinic,aw3750x.yaml

Quoted 8 lines · Mark Brown
Quoted 6 lines · Krzysztof Kozlowski
Quoted 5 lines · On 05/07/2023 10:19, [email protected] wrote:

From: Ke Li <[email protected]>

Documentation/devicetree/bindings/regulator/awinic,aw3750x.yaml new file +3 -0
+properties:
+  compatible:
+    const: awinic,aw3750x_led
Quoted 5 lines
Quoted 2 lines

I don't understand why there is _led suffix. Isn't this regulator? Can it be anything else?

Boost regulators are almost always used to drive LEDs for things like backlights.

Let me be a bit more precise - if this device can have multiple functions, then the compatible usually has some suffixes (although no underscores). If this device has only one feature - regardless whether for backlight or for anything else - the compatible has only model.

Best regards,
Krzysztof

maintainer
#5 lore raw

Re: [PATCH V1 1/1] regulator: Add awinic,aw3750x.yaml

In reply to [email protected]
Quoted 8 lines · On Wed, 05 Jul 2023 08:19:41 +0000, [email protected] wrote:

From: Ke Li <[email protected]>

---
 .../bindings/regulator/awinic,aw3750x.yaml    | 151 ++++++++++++++++++
 1 file changed, 151 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/awinic,aw3750x.yaml

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
Documentation/devicetree/bindings/regulator/awinic,aw3750x.example.dts:21.31-70.11: Warning (unit_address_vs_reg): /example-0/pinctrl@10005000: node has a unit name, but no reg or ranges property Documentation/devicetree/bindings/regulator/awinic,aw3750x.example.dts:94.24-124.15: Warning (gpios_property): /example-1/i2c/aw3750x@3e: Missing property '#gpio-cells' in node /example-0/pinctrl@10005000 or bad phandle (referred from enn-gpio[0]) Documentation/devicetree/bindings/regulator/awinic,aw3750x.example.dts:94.24-124.15: Warning (gpios_property): /example-1/i2c/aw3750x@3e: Missing property '#gpio-cells' in node /example-0/pinctrl@10005000 or bad phandle (referred from enp-gpio[0]) /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/regulator/awinic,aw3750x.example.dtb: aw3750x@3e: enp: Unevaluated properties are not allowed ('label' was unexpected)

	from schema $id: http://devicetree.org/schemas/regulator/awinic,aw3750x.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/regulator/awinic,aw3750x.example.dtb: aw3750x@3e: enn: Unevaluated properties are not allowed ('label' was unexpected)
	from schema $id: http://devicetree.org/schemas/regulator/awinic,aw3750x.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/regulator/awinic,aw3750x.example.dtb: aw3750x@3e: 'aw3750x_gpio_ctrl', 'enn-gpio', 'enp-gpio', 'outn', 'outp', 'reg' do not match any of the regexes: 'pinctrl-[0-9]+'
	from schema $id: http://devicetree.org/schemas/regulator/awinic,aw3750x.yaml#

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]

The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.