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

like@awinic.com posted 2 patches 2 years, 7 months ago
Only 1 patches received!
[PATCH V1 1/1] regulator: Add awinic,aw3750x.yaml
Posted by like@awinic.com 2 years, 7 months ago
From: Ke Li <like@awinic.com>

Signed-off-by: Ke Li <like@awinic.com>
---
 .../bindings/regulator/awinic,aw3750x.yaml    | 151 ++++++++++++++++++
 1 file changed, 151 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/awinic,aw3750x.yaml

diff --git a/Documentation/devicetree/bindings/regulator/awinic,aw3750x.yaml b/Documentation/devicetree/bindings/regulator/awinic,aw3750x.yaml
new file mode 100644
index 000000000000..cdb3d9dbf88f
--- /dev/null
+++ b/Documentation/devicetree/bindings/regulator/awinic,aw3750x.yaml
@@ -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 <wangweidong.a@awinic.com>
+  - Ke Li <like@awinic.com>
+
+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>;
+            };
+        };
+    };
-- 
2.41.0
Re: [PATCH V1 1/1] regulator: Add awinic,aw3750x.yaml
Posted by Krzysztof Kozlowski 2 years, 7 months ago
On 05/07/2023 10:19, like@awinic.com wrote:
> From: Ke Li <like@awinic.com>

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.

> 
> Signed-off-by: Ke Li <like@awinic.com>
> ---
>  .../bindings/regulator/awinic,aw3750x.yaml    | 151 ++++++++++++++++++
>  1 file changed, 151 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/regulator/awinic,aw3750x.yaml
> 
> diff --git a/Documentation/devicetree/bindings/regulator/awinic,aw3750x.yaml b/Documentation/devicetree/bindings/regulator/awinic,aw3750x.yaml
> new file mode 100644
> index 000000000000..cdb3d9dbf88f
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/regulator/awinic,aw3750x.yaml
> @@ -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.

> +%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 <wangweidong.a@awinic.com>
> +  - Ke Li <like@awinic.com>
> +
> +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.

> +
> +  enp:
> +    type: object
> +    $ref: regulator.yaml#
> +    description:
> +      Properties for single LDO regulator.
> +
> +    properties:
> +      regulator-name: true

Drop

> +
> +    required:
> +      - regulator-name

Is it really required?

> +
> +    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;
> +        };
> +      };

All this is incorrect and unrelated. Drop it.

> +
> +      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 {

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


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

> +            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
Re: [PATCH V1 1/1] regulator: Add awinic,aw3750x.yaml
Posted by Mark Brown 2 years, 7 months ago
On Wed, Jul 05, 2023 at 11:20:16AM +0200, Krzysztof Kozlowski wrote:
> On 05/07/2023 10:19, like@awinic.com wrote:
> > From: Ke Li <like@awinic.com>

> > +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.
Re: [PATCH V1 1/1] regulator: Add awinic,aw3750x.yaml
Posted by Krzysztof Kozlowski 2 years, 7 months ago
On 05/07/2023 13:52, Mark Brown wrote:
> On Wed, Jul 05, 2023 at 11:20:16AM +0200, Krzysztof Kozlowski wrote:
>> On 05/07/2023 10:19, like@awinic.com wrote:
>>> From: Ke Li <like@awinic.com>
> 
>>> +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.

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
Re: [PATCH V1 1/1] regulator: Add awinic,aw3750x.yaml
Posted by Rob Herring 2 years, 7 months ago
On Wed, 05 Jul 2023 08:19:41 +0000, like@awinic.com wrote:
> From: Ke Li <like@awinic.com>
> 
> Signed-off-by: Ke Li <like@awinic.com>
> ---
>  .../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/20230705081942.2608531-2-like@awinic.com

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.
  • [PATCH V1 1/1] regulator: Add awinic,aw3750x.yaml