diff mbox series

[v2,2/5] dt-bindings: rtc: abx80x: convert to yaml

Message ID 20240112-add-am64-som-v2-2-1385246c428c@solid-run.com (mailing list archive)
State New, archived
Headers show
Series arm64: dts: add description for solidrun am642 som and hummingboard evb | expand

Commit Message

Josua Mayer Jan. 12, 2024, 5:12 p.m. UTC
Convert the abracon abx80x rtc text bindings to dt-schema format.

Additionally added "interrupts" property which was missing from text
format, because abx80x and driver support them.

Signed-off-by: Josua Mayer <josua@solid-run.com>
---
 .../devicetree/bindings/rtc/abracon,abx80x.txt     | 31 ------------
 .../devicetree/bindings/rtc/abracon,abx80x.yaml    | 56 ++++++++++++++++++++++
 2 files changed, 56 insertions(+), 31 deletions(-)

Comments

Krzysztof Kozlowski Jan. 12, 2024, 5:18 p.m. UTC | #1
On 12/01/2024 18:12, Josua Mayer wrote:
> Convert the abracon abx80x rtc text bindings to dt-schema format.
> 
> Additionally added "interrupts" property which was missing from text
> format, because abx80x and driver support them.
> 
> Signed-off-by: Josua Mayer <josua@solid-run.com>
> ---


> --- /dev/null
> +++ b/Documentation/devicetree/bindings/rtc/abracon,abx80x.yaml
> @@ -0,0 +1,56 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/rtc/abracon,abx80x.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Abracon ABX80X I2C ultra low power RTC/Alarm chip
> +
> +maintainers: []

You need a name here. If there is no driver maintainer or anyone
interested, put devicetree list.

> +
> +allOf:
> +  - $ref: rtc.yaml#
> +
> +properties:
> +  compatible:
> +    anyOf:

Please do not invent your own solutions, but use existing code as
template. Just open example-schema or any other recent RTC binding.

> +      - description: auto-detection from id register
> +        const: abracon,abx80x
> +      - const: abracon,,ab0801
> +      - const: abracon,,ab0803
> +      - const: abracon,,ab0804
> +      - const: abracon,,ab0805
> +      - const: abracon,,ab1801
> +      - const: abracon,,ab1803
> +      - const: abracon,,ab1804
> +      - const: abracon,,ab1805
> +      - const: microcrystal,rv1805
> +
> +  reg:
> +    maxItems: 1
> +
> +  interrupts:
> +    maxItems: 1
> +
> +  abracon,tc-diode:

Missing type - string.

> +    description:
> +      Trickle-charge diode type.
> +      Required to enable charging backup battery.
> +    anyOf:

Use enum and explain the meanings of the values in descruption.

> +      - description: standard diode with 0.6V drop
> +        const: standard
> +      - description: schottky diode with 0.3V drop
> +        const: schottky
> +
> +  abracon,tc-resistor:
> +    description:
> +      Trickle-charge resistor value in kOhm.
> +      Required to enable charging backup battery.
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +    enum: [0, 3, 6, 11]
> +
> +required:
> +  - compatible
> +  - reg
> +
> +unevaluatedProperties: false

Provide example.

Best regards,
Krzysztof
Josua Mayer Jan. 14, 2024, 3:56 p.m. UTC | #2
Am 12.01.24 um 18:18 schrieb Krzysztof Kozlowski:
> On 12/01/2024 18:12, Josua Mayer wrote:
>> +++ b/Documentation/devicetree/bindings/rtc/abracon,abx80x.yaml
>> @@ -0,0 +1,56 @@
>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>> +%YAML 1.2
>> +---
>> +$id: http://devicetree.org/schemas/rtc/abracon,abx80x.yaml#
>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>> +
>> +title: Abracon ABX80X I2C ultra low power RTC/Alarm chip
>> +
>> +maintainers: []
> You need a name here. If there is no driver maintainer or anyone
> interested, put devicetree list.
Ack.
>> +
>> +allOf:
>> +  - $ref: rtc.yaml#
>> +
>> +properties:
>> +  compatible:
>> +    anyOf:
> Please do not invent your own solutions, but use existing code as
> template. Just open example-schema or any other recent RTC binding.

This was inspired by jsonschema / stackoverflow.
Will change it as requested.

>> +      - description: auto-detection from id register
>> +        const: abracon,abx80x
>> +      - const: abracon,,ab0801
>> +      - const: abracon,,ab0803
>> +      - const: abracon,,ab0804
>> +      - const: abracon,,ab0805
>> +      - const: abracon,,ab1801
>> +      - const: abracon,,ab1803
>> +      - const: abracon,,ab1804
>> +      - const: abracon,,ab1805
>> +      - const: microcrystal,rv1805
>> +
>> +  reg:
>> +    maxItems: 1
>> +
>> +  interrupts:
>> +    maxItems: 1
>> +
>> +  abracon,tc-diode:
> Missing type - string.
$ref: /schemas/types.yaml#/definitions/string ?
If so - ack.
>> +    description:
>> +      Trickle-charge diode type.
>> +      Required to enable charging backup battery.
>> +    anyOf:
> Use enum and explain the meanings of the values in descruption.
>
>> +      - description: standard diode with 0.6V drop
>> +        const: standard
>> +      - description: schottky diode with 0.3V drop
>> +        const: schottky
Here was the real motivation for different solution.
Will change it as requested.
>> +
>> +  abracon,tc-resistor:
>> +    description:
>> +      Trickle-charge resistor value in kOhm.
>> +      Required to enable charging backup battery.
>> +    $ref: /schemas/types.yaml#/definitions/uint32
>> +    enum: [0, 3, 6, 11]
>> +
>> +required:
>> +  - compatible
>> +  - reg
>> +
>> +unevaluatedProperties: false
> Provide example.
Okay.


Thanks. sincerely,
Josua Mayer
Josua Mayer Jan. 14, 2024, 4:26 p.m. UTC | #3
Am 14.01.24 um 16:56 schrieb Josua Mayer:

> Am 12.01.24 um 18:18 schrieb Krzysztof Kozlowski:
>> On 12/01/2024 18:12, Josua Mayer wrote:
>>> +++ b/Documentation/devicetree/bindings/rtc/abracon,abx80x.yaml
>>> @@ -0,0 +1,56 @@
>>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>>> +%YAML 1.2
>>> +---
>>> +$id: http://devicetree.org/schemas/rtc/abracon,abx80x.yaml#
>>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>>> +
>>> +title: Abracon ABX80X I2C ultra low power RTC/Alarm chip
>>> +
>>> +maintainers: []
>> You need a name here. If there is no driver maintainer or anyone
>> interested, put devicetree list.
> Ack.
>>> +
>>> +allOf:
>>> +  - $ref: rtc.yaml#

+ $ref: /schemas/interrupts.yaml#

Is it acceptable to reference generic interrupts schema?:

I see no rtc yaml doing that, and only some describe interrupts property explicitly. But Importing the schema would also cover -parent and -names.

>>> +
>>> +  interrupts:
>>> +    maxItems: 1


sincerely
Josua Mayer
Krzysztof Kozlowski Jan. 15, 2024, 7:29 a.m. UTC | #4
On 14/01/2024 17:26, Josua Mayer wrote:
>>>> +maintainers: []
>>> You need a name here. If there is no driver maintainer or anyone
>>> interested, put devicetree list.
>> Ack.
>>>> +
>>>> +allOf:
>>>> +  - $ref: rtc.yaml#
> 
> + $ref: /schemas/interrupts.yaml#
> 
> Is it acceptable to reference generic interrupts schema?:

Why? No.

> 
> I see no rtc yaml doing that, and only some describe interrupts property explicitly. But Importing the schema would also cover -parent and -names.

No, it wouldn't. It does not matter. I don't understand what are you
trying to solve.

Best regards,
Krzysztof
Josua Mayer Jan. 15, 2024, 10:17 a.m. UTC | #5
Am 15.01.24 um 08:29 schrieb Krzysztof Kozlowski:

> On 14/01/2024 17:26, Josua Mayer wrote:
>>>>> +maintainers: []
>>>> You need a name here. If there is no driver maintainer or anyone
>>>> interested, put devicetree list.
>>> Ack.
>>>>> +
>>>>> +allOf:
>>>>> +  - $ref: rtc.yaml#
>> + $ref: /schemas/interrupts.yaml#
>>
>> Is it acceptable to reference generic interrupts schema?:
> Why? No.
>
>> I see no rtc yaml doing that, and only some describe interrupts property explicitly. But Importing the schema would also cover -parent and -names.
> No, it wouldn't. It does not matter. I don't understand what are you
> trying to solve.
dtbs_check is complaining about interrupt-parent property,
because I added both interrrupts and interrupt-parent to my rtc node.

Also wondering whether interrupts property should be included in
the example.

I found this idea in yaml files outside rtc.
But no existing rtc yaml references that schema, so I asked.


sincerely
Josua Mayer
Krzysztof Kozlowski Jan. 15, 2024, 10:20 a.m. UTC | #6
On 15/01/2024 11:17, Josua Mayer wrote:
> Am 15.01.24 um 08:29 schrieb Krzysztof Kozlowski:
> 
>> On 14/01/2024 17:26, Josua Mayer wrote:
>>>>>> +maintainers: []
>>>>> You need a name here. If there is no driver maintainer or anyone
>>>>> interested, put devicetree list.
>>>> Ack.
>>>>>> +
>>>>>> +allOf:
>>>>>> +  - $ref: rtc.yaml#
>>> + $ref: /schemas/interrupts.yaml#
>>>
>>> Is it acceptable to reference generic interrupts schema?:
>> Why? No.
>>
>>> I see no rtc yaml doing that, and only some describe interrupts property explicitly. But Importing the schema would also cover -parent and -names.
>> No, it wouldn't. It does not matter. I don't understand what are you
>> trying to solve.
> dtbs_check is complaining about interrupt-parent property,
> because I added both interrrupts and interrupt-parent to my rtc node.

Difficult to say. You did not include example in your schema which
prevents parts of tests.

> 
> Also wondering whether interrupts property should be included in
> the example.

Yes, your example should be complete... but there is no example in the
first place :/



Best regards,
Krzysztof
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/rtc/abracon,abx80x.txt b/Documentation/devicetree/bindings/rtc/abracon,abx80x.txt
deleted file mode 100644
index 2405e35a1bc0..000000000000
--- a/Documentation/devicetree/bindings/rtc/abracon,abx80x.txt
+++ /dev/null
@@ -1,31 +0,0 @@ 
-Abracon ABX80X I2C ultra low power RTC/Alarm chip
-
-The Abracon ABX80X family consist of the ab0801, ab0803, ab0804, ab0805, ab1801,
-ab1803, ab1804 and ab1805. The ab0805 is the superset of ab080x and the ab1805
-is the superset of ab180x.
-
-Required properties:
-
- - "compatible": should one of:
-        "abracon,abx80x"
-        "abracon,ab0801"
-        "abracon,ab0803"
-        "abracon,ab0804"
-        "abracon,ab0805"
-        "abracon,ab1801"
-        "abracon,ab1803"
-        "abracon,ab1804"
-        "abracon,ab1805"
-        "microcrystal,rv1805"
-	Using "abracon,abx80x" will enable chip autodetection.
- - "reg": I2C bus address of the device
-
-Optional properties:
-
-The abx804 and abx805 have a trickle charger that is able to charge the
-connected battery or supercap. Both the following properties have to be defined
-and valid to enable charging:
-
- - "abracon,tc-diode": should be "standard" (0.6V) or "schottky" (0.3V)
- - "abracon,tc-resistor": should be <0>, <3>, <6> or <11>. 0 disables the output
-                          resistor, the other values are in kOhm.
diff --git a/Documentation/devicetree/bindings/rtc/abracon,abx80x.yaml b/Documentation/devicetree/bindings/rtc/abracon,abx80x.yaml
new file mode 100644
index 000000000000..c80d4a46a044
--- /dev/null
+++ b/Documentation/devicetree/bindings/rtc/abracon,abx80x.yaml
@@ -0,0 +1,56 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/rtc/abracon,abx80x.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Abracon ABX80X I2C ultra low power RTC/Alarm chip
+
+maintainers: []
+
+allOf:
+  - $ref: rtc.yaml#
+
+properties:
+  compatible:
+    anyOf:
+      - description: auto-detection from id register
+        const: abracon,abx80x
+      - const: abracon,,ab0801
+      - const: abracon,,ab0803
+      - const: abracon,,ab0804
+      - const: abracon,,ab0805
+      - const: abracon,,ab1801
+      - const: abracon,,ab1803
+      - const: abracon,,ab1804
+      - const: abracon,,ab1805
+      - const: microcrystal,rv1805
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  abracon,tc-diode:
+    description:
+      Trickle-charge diode type.
+      Required to enable charging backup battery.
+    anyOf:
+      - description: standard diode with 0.6V drop
+        const: standard
+      - description: schottky diode with 0.3V drop
+        const: schottky
+
+  abracon,tc-resistor:
+    description:
+      Trickle-charge resistor value in kOhm.
+      Required to enable charging backup battery.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [0, 3, 6, 11]
+
+required:
+  - compatible
+  - reg
+
+unevaluatedProperties: false