diff mbox series

[v2,1/8] dt-bindings: rtc: let aux-voltage-chargeable supersede trickle-diode-disable

Message ID 20200917183246.19446-2-bst@pengutronix.de
State Not Applicable
Headers show
Series rtc: expand charge support, implement rx8130 charging | expand

Checks

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

Commit Message

Bastian Krause Sept. 17, 2020, 6:32 p.m. UTC
Some RTCs can be equipped with a chargeable battery or supercap.
Every RTC allowing this whose driver's implement it are charged by
default. To disable this the trickle-diode-disable flag exists.

If a driver did not support charging and some time later one wants to
add that feature, there is currently no way to do it without breaking
dt backwards compatibility. RTCs on boards without the
trickle-diode-disable flag in their device tree would suddenly charge
their battery/supercap which is a change in behavior.

Change that by introducing aux-voltage-chargeable, not as a flag but as
a uint32 enum allowing to set "do not charge" (0) or "charge" (1). This
dt property is optional, so we can now distinguish these cases.

Care must be taken to support the old behavior for device trees without
aux-voltage-chargeable nonetheless to stay compatible.

Signed-off-by: Bastian Krause <bst@pengutronix.de>
---
Changes since v1:
- fixed dt_binding_check error by adding " |" after "description:"

v1 notes:
In a previous series aux-voltage-chargeable was added as a ds1307 dt
property. Discussions lead to turning that into a generic rtc dt
property:
https://lore.kernel.org/linux-rtc/98fa7181-3ebe-d7c3-cfac-fee841c81e15@pengutronix.de/T/
---
 Documentation/devicetree/bindings/rtc/rtc.yaml | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Rob Herring Sept. 23, 2020, 8:23 p.m. UTC | #1
On Thu, 17 Sep 2020 20:32:39 +0200, Bastian Krause wrote:
> Some RTCs can be equipped with a chargeable battery or supercap.
> Every RTC allowing this whose driver's implement it are charged by
> default. To disable this the trickle-diode-disable flag exists.
> 
> If a driver did not support charging and some time later one wants to
> add that feature, there is currently no way to do it without breaking
> dt backwards compatibility. RTCs on boards without the
> trickle-diode-disable flag in their device tree would suddenly charge
> their battery/supercap which is a change in behavior.
> 
> Change that by introducing aux-voltage-chargeable, not as a flag but as
> a uint32 enum allowing to set "do not charge" (0) or "charge" (1). This
> dt property is optional, so we can now distinguish these cases.
> 
> Care must be taken to support the old behavior for device trees without
> aux-voltage-chargeable nonetheless to stay compatible.
> 
> Signed-off-by: Bastian Krause <bst@pengutronix.de>
> ---
> Changes since v1:
> - fixed dt_binding_check error by adding " |" after "description:"
> 
> v1 notes:
> In a previous series aux-voltage-chargeable was added as a ds1307 dt
> property. Discussions lead to turning that into a generic rtc dt
> property:
> https://lore.kernel.org/linux-rtc/98fa7181-3ebe-d7c3-cfac-fee841c81e15@pengutronix.de/T/
> ---
>  Documentation/devicetree/bindings/rtc/rtc.yaml | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 

Reviewed-by: Rob Herring <robh@kernel.org>
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/rtc/rtc.yaml b/Documentation/devicetree/bindings/rtc/rtc.yaml
index ee237b2ed66a..6b8a11325691 100644
--- a/Documentation/devicetree/bindings/rtc/rtc.yaml
+++ b/Documentation/devicetree/bindings/rtc/rtc.yaml
@@ -17,6 +17,15 @@  properties:
   $nodename:
     pattern: "^rtc(@.*|-[0-9a-f])*$"
 
+  aux-voltage-chargeable:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [0, 1]
+    description: |
+      Tells whether the battery/supercap of the RTC (if any) is
+      chargeable or not:
+      0: not chargeable
+      1: chargeable
+
   quartz-load-femtofarads:
     $ref: /schemas/types.yaml#/definitions/uint32
     description:
@@ -35,6 +44,7 @@  properties:
     description:
       Do not use internal trickle charger diode. Should be given if
       internal trickle charger diode should be disabled.
+    deprecated: true
 
   trickle-resistor-ohms:
     $ref: /schemas/types.yaml#/definitions/uint32