diff mbox series

[v1,1/2] regulator: rt6245: Add the binding document for Richtek RT6245

Message ID 1622009578-15577-1-git-send-email-u0084500@gmail.com
State Superseded, archived
Headers show
Series [v1,1/2] regulator: rt6245: Add the binding document for Richtek RT6245 | expand

Checks

Context Check Description
robh/dtbs-check success
robh/checkpatch success
robh/dt-meta-schema success

Commit Message

ChiYuan Huang May 26, 2021, 6:12 a.m. UTC
From: ChiYuan Huang <cy_huang@richtek.com>

Add the binding document for Richtek RT6245.

Signed-off-by: ChiYuan Huang <cy_huang@richtek.com>
---
 .../regulator/richtek,rt6245-regulator.yaml        | 89 ++++++++++++++++++++++
 1 file changed, 89 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/richtek,rt6245-regulator.yaml

Comments

Mark Brown May 26, 2021, 6:21 p.m. UTC | #1
On Wed, May 26, 2021 at 02:12:58PM +0800, cy_huang wrote:

> +	/* xor checksum for bit 6 to 0 */
> +	bit_count = __sw_hweight8(code & RT6245_CODE_MASK);

This doesn't compile with an x86 allmodconfig:

ERROR: modpost: "__sw_hweight8" [drivers/regulator/rt6245-regulator.ko] undefined!
ChiYuan Huang May 27, 2021, 3:54 a.m. UTC | #2
HI,

Mark Brown <broonie@kernel.org> 於 2021年5月27日 週四 上午2:21寫道:
>
> On Wed, May 26, 2021 at 02:12:58PM +0800, cy_huang wrote:
>
> > +     /* xor checksum for bit 6 to 0 */
> > +     bit_count = __sw_hweight8(code & RT6245_CODE_MASK);
>
> This doesn't compile with an x86 allmodconfig:
>
> ERROR: modpost: "__sw_hweight8" [drivers/regulator/rt6245-regulator.ko] undefined!

I think I found the problem, x86 only defined __sw_hweight32 and __sw_hweight64.
If user touch hweight8 or 16, it will auto convert to use thest two functions.
And the x86 arch didn't define __sw_hweight8 or __sw_hweight16.
The best way is to use hweight8 macro and let the macro convert it to
arch_hweight8
Ack in next, Thanks for reminding me.
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/regulator/richtek,rt6245-regulator.yaml b/Documentation/devicetree/bindings/regulator/richtek,rt6245-regulator.yaml
new file mode 100644
index 00000000..796ceac
--- /dev/null
+++ b/Documentation/devicetree/bindings/regulator/richtek,rt6245-regulator.yaml
@@ -0,0 +1,89 @@ 
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/regulator/richtek,rt6245-regulator.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Richtek RT6245 High Current Voltage Regulator
+
+maintainers:
+  - ChiYuan Huang <cy_huang@richtek.com>
+
+description: |
+  The RT6245 is a high-performance, synchronous step-down converter
+  that can deliver up to 14A output current with an input supply
+  voltage range of 4.5V to 17V.
+
+allOf:
+  - $ref: regulator.yaml#
+
+properties:
+  compatible:
+    enum:
+      - richtek,rt6245
+
+  reg:
+    maxItems: 1
+
+  enable-gpios:
+    description: |
+      A connection of the chip 'enable' gpio line. If not provided,
+      it will be treat as a default-on power.
+    maxItems: 1
+
+  richtek,oc-level-select:
+    $ref: "/schemas/types.yaml#/definitions/uint8"
+    enum: [0, 1, 2, 3]
+    description: |
+      Over current level selection. Each respective value means the current
+      limit 8A, 14A, 12A, 10A. If this property is missing then keep in
+      in chip default.
+
+  richtek,ot-level-select:
+    $ref: "/schemas/types.yaml#/definitions/uint8"
+    enum: [0, 1, 2]
+    description: |
+      Over temperature level selection. Each respective value means the degree
+      150'c, 130'c, 170'c. If this property is missing then keep in chip
+      default.
+
+  richtek,pgdly-time-select:
+    $ref: "/schemas/types.yaml#/definitions/uint8"
+    enum: [0, 1, 2, 3]
+    description: |
+      Power good signal delay time selection. Each respective value means the
+      delay time 0us, 10us, 20us, 40us. If this property is missing then keep
+      in chip default.
+
+
+  richtek,switch-freq-select:
+    $ref: "/schemas/types.yaml#/definitions/uint8"
+    enum: [0, 1, 2]
+    description: |
+      Buck switch frequency selection. Each respective value means 400KHz,
+      800KHz, 1200KHz. If this property is missing then keep in chip default.
+
+required:
+  - compatible
+  - reg
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    i2c {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      rt6245@34 {
+        compatible = "richtek,rt6245";
+        status = "okay";
+        reg = <0x34>;
+        enable-gpios = <&gpio26 2 0>;
+
+        regulator-name = "rt6245-regulator";
+        regulator-min-microvolt = <437500>;
+        regulator-max-microvolt = <1387500>;
+        regulator-boot-on;
+      };
+    };