diff mbox series

[v8,1/6] dt-bindings: rtc: Add pinctrl for S35390A

Message ID 20260831-rtc_s35390a_int1-v8-1-dac1dc86ce1f@posteo.de
State New
Headers show
Series rtc: s35390a: Allow use of output pin for interrupt signal 1 for wakealarm | expand

Commit Message

Markus Probst Aug. 31, 2026, 5:42 p.m. UTC
Synology NAS devices use the output pin for interrupt signal 1 to wake up
the system.

Move devicetree bindings for sii,s35390a into its own file.
Add necessary properties to configure the individual pins via pinctrl,
which allows the interrupt signal 1 to be used for wakeup alarm.

Signed-off-by: Markus Probst <markus.probst@posteo.de>
---
 .../devicetree/bindings/rtc/sii,s35390a.yaml       | 117 +++++++++++++++++++++
 .../devicetree/bindings/rtc/trivial-rtc.yaml       |   3 -
 2 files changed, 117 insertions(+), 3 deletions(-)

Comments

Krzysztof Kozlowski Sept. 1, 2026, 10:05 a.m. UTC | #1
On Mon, Aug 31, 2026 at 05:42:22PM +0000, Markus Probst wrote:
> Synology NAS devices use the output pin for interrupt signal 1 to wake up
> the system.
> 
> Move devicetree bindings for sii,s35390a into its own file.
> Add necessary properties to configure the individual pins via pinctrl,
> which allows the interrupt signal 1 to be used for wakeup alarm.
> 
> Signed-off-by: Markus Probst <markus.probst@posteo.de>
> ---
>  .../devicetree/bindings/rtc/sii,s35390a.yaml       | 117 +++++++++++++++++++++
>  .../devicetree/bindings/rtc/trivial-rtc.yaml       |   3 -
>  2 files changed, 117 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/rtc/sii,s35390a.yaml b/Documentation/devicetree/bindings/rtc/sii,s35390a.yaml
> new file mode 100644
> index 000000000000..dfe632c4b2c8
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/rtc/sii,s35390a.yaml
> @@ -0,0 +1,117 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/rtc/sii,s35390a.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: S-35390A 2-WIRE REAL-TIME CLOCK
> +
> +maintainers:
> +  - Markus Probst <markus.probst@posteo.de>
> +
> +description:
> +  The S-35390A is a CMOS 2-wire real-time clock IC which operates with the
> +  very low current consumption in the wide range of operation voltage.
> +
> +allOf:
> +  - $ref: rtc.yaml#
> +
> +properties:
> +  compatible:
> +    const: sii,s35390a
> +
> +  reg:
> +    maxItems: 1
> +
> +  interrupts:
> +    minItems: 1
> +    maxItems: 2
> +    description: Supports up to 2 interrupt lines via the INT1 and INT2 pins.
> +
> +  interrupt-names:
> +    items:
> +      - const: int1
> +      - const: int2
> +
> +  wakeup-parent: true
> +
> +  wakeup-source: true
> +
> +  "#clock-cells":
> +    const: 1
> +
> +patternProperties:
> +  "^pins":
> +    type: object
> +    additionalProperties: false
> +
> +    patternProperties:
> +      "-pins$":
> +        type: object
> +        additionalProperties: false
> +
> +        allOf:
> +          - $ref: /schemas/pinctrl/pinmux-node.yaml#
> +
> +        properties:
> +          pins:
> +            minItems: 1
> +            items:
> +              enum:
> +                - int1
> +                - int2
> +
> +          function:
> +            description: |
> +              Pin function:
> +              - ignore:  Preserve the previous state.
> +              - disable: Disable pin output.
> +              - wakeup:  Output wakes up the system.
> +              - clock:   Output clock pulse.
> +              - pmin1:   Minute periodical output with 50% duty.
> +              - pmin2:   Minute periodical output L for 7.81 ms.
> +                         Can only be used with pin int1.
> +            enum:
> +              - ignore
> +              - disable
> +              - wakeup
> +              - clock
> +              - pmin1
> +              - pmin2
> +
> +        required:
> +          - pins
> +          - function
> +
> +required:
> +  - compatible
> +  - reg
> +
> +unevaluatedProperties: false
> +
> +examples:
> +  - |
> +    i2c {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        rtc@30 {
> +            compatible = "sii,s35390a";
> +            reg = <0x30>;
> +            pinctrl-0 = <&rtc_pins_default>;
> +            pinctrl-names = "default";
> +
> +            wakeup-parent = <&int>;

I don't understand this need. Device does not generate interrupts - no
interrupts property - thus how can it wakeup?

As explained in commit msg, the signal at int1 goes to the SoC, right?
So where does it go? To which pin of which device? &int?

Can you show complete upstream DTS using this?


Best regards,
Krzysztof
Markus Probst Sept. 1, 2026, 1:28 p.m. UTC | #2
On Tue, 2026-09-01 at 12:05 +0200, Krzysztof Kozlowski wrote:
> On Mon, Aug 31, 2026 at 05:42:22PM +0000, Markus Probst wrote:
> > Synology NAS devices use the output pin for interrupt signal 1 to wake up
> > the system.
> > 
> > Move devicetree bindings for sii,s35390a into its own file.
> > Add necessary properties to configure the individual pins via pinctrl,
> > which allows the interrupt signal 1 to be used for wakeup alarm.
> > 
> > Signed-off-by: Markus Probst <markus.probst@posteo.de>
> > ---
> >  .../devicetree/bindings/rtc/sii,s35390a.yaml       | 117 +++++++++++++++++++++
> >  .../devicetree/bindings/rtc/trivial-rtc.yaml       |   3 -
> >  2 files changed, 117 insertions(+), 3 deletions(-)
> > 
> > diff --git a/Documentation/devicetree/bindings/rtc/sii,s35390a.yaml b/Documentation/devicetree/bindings/rtc/sii,s35390a.yaml
> > new file mode 100644
> > index 000000000000..dfe632c4b2c8
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/rtc/sii,s35390a.yaml
> > @@ -0,0 +1,117 @@
> > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/rtc/sii,s35390a.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: S-35390A 2-WIRE REAL-TIME CLOCK
> > +
> > +maintainers:
> > +  - Markus Probst <markus.probst@posteo.de>
> > +
> > +description:
> > +  The S-35390A is a CMOS 2-wire real-time clock IC which operates with the
> > +  very low current consumption in the wide range of operation voltage.
> > +
> > +allOf:
> > +  - $ref: rtc.yaml#
> > +
> > +properties:
> > +  compatible:
> > +    const: sii,s35390a
> > +
> > +  reg:
> > +    maxItems: 1
> > +
> > +  interrupts:
> > +    minItems: 1
> > +    maxItems: 2
> > +    description: Supports up to 2 interrupt lines via the INT1 and INT2 pins.
> > +
> > +  interrupt-names:
> > +    items:
> > +      - const: int1
> > +      - const: int2
> > +
> > +  wakeup-parent: true
> > +
> > +  wakeup-source: true
> > +
> > +  "#clock-cells":
> > +    const: 1
> > +
> > +patternProperties:
> > +  "^pins":
> > +    type: object
> > +    additionalProperties: false
> > +
> > +    patternProperties:
> > +      "-pins$":
> > +        type: object
> > +        additionalProperties: false
> > +
> > +        allOf:
> > +          - $ref: /schemas/pinctrl/pinmux-node.yaml#
> > +
> > +        properties:
> > +          pins:
> > +            minItems: 1
> > +            items:
> > +              enum:
> > +                - int1
> > +                - int2
> > +
> > +          function:
> > +            description: |
> > +              Pin function:
> > +              - ignore:  Preserve the previous state.
> > +              - disable: Disable pin output.
> > +              - wakeup:  Output wakes up the system.
> > +              - clock:   Output clock pulse.
> > +              - pmin1:   Minute periodical output with 50% duty.
> > +              - pmin2:   Minute periodical output L for 7.81 ms.
> > +                         Can only be used with pin int1.
> > +            enum:
> > +              - ignore
> > +              - disable
> > +              - wakeup
> > +              - clock
> > +              - pmin1
> > +              - pmin2
> > +
> > +        required:
> > +          - pins
> > +          - function
> > +
> > +required:
> > +  - compatible
> > +  - reg
> > +
> > +unevaluatedProperties: false
> > +
> > +examples:
> > +  - |
> > +    i2c {
> > +        #address-cells = <1>;
> > +        #size-cells = <0>;
> > +
> > +        rtc@30 {
> > +            compatible = "sii,s35390a";
> > +            reg = <0x30>;
> > +            pinctrl-0 = <&rtc_pins_default>;
> > +            pinctrl-names = "default";
> > +
> > +            wakeup-parent = <&int>;
> 
> I don't understand this need. Device does not generate interrupts - no
> interrupts property - thus how can it wakeup?
It is just an example.

> 
> As explained in commit msg, the signal at int1 goes to the SoC, right?
I assume.

> So where does it go? To which pin of which device? &int?
For my Synology DS923+ NAS, I do not have schematics. I only know for
sure from source code that INT1 is used for wakeup and I can confirm
that this does indeed wake the device up. 

> 
> Can you show complete upstream DTS using this?
There is arch/arm/boot/dts/ti/omap/am3517-som.dtsi, which has the pin
output of INT1 routed to a gpio pin. INT2 isn't connected at all.
According to the public schematic [1], this looks accurate.


Thanks
- Markus Probst

[1] https://www.scribd.com/doc/60133698/SOM-M2-Schematic

> 
> 
> Best regards,
> Krzysztof
Krzysztof Kozlowski Sept. 3, 2026, 9:35 a.m. UTC | #3
On Tue, Sep 01, 2026 at 01:28:36PM +0000, Markus Probst wrote:
> On Tue, 2026-09-01 at 12:05 +0200, Krzysztof Kozlowski wrote:
> > > +patternProperties:
> > > +  "^pins":
> > > +    type: object
> > > +    additionalProperties: false
> > > +
> > > +    patternProperties:
> > > +      "-pins$":
> > > +        type: object
> > > +        additionalProperties: false
> > > +
> > > +        allOf:
> > > +          - $ref: /schemas/pinctrl/pinmux-node.yaml#
> > > +
> > > +        properties:
> > > +          pins:
> > > +            minItems: 1
> > > +            items:
> > > +              enum:
> > > +                - int1
> > > +                - int2
> > > +
> > > +          function:
> > > +            description: |
> > > +              Pin function:
> > > +              - ignore:  Preserve the previous state.
> > > +              - disable: Disable pin output.
> > > +              - wakeup:  Output wakes up the system.
> > > +              - clock:   Output clock pulse.
> > > +              - pmin1:   Minute periodical output with 50% duty.
> > > +              - pmin2:   Minute periodical output L for 7.81 ms.
> > > +                         Can only be used with pin int1.
> > > +            enum:
> > > +              - ignore
> > > +              - disable
> > > +              - wakeup
> > > +              - clock
> > > +              - pmin1
> > > +              - pmin2
> > > +
> > > +        required:
> > > +          - pins
> > > +          - function
> > > +
> > > +required:
> > > +  - compatible
> > > +  - reg
> > > +
> > > +unevaluatedProperties: false
> > > +
> > > +examples:
> > > +  - |
> > > +    i2c {
> > > +        #address-cells = <1>;
> > > +        #size-cells = <0>;
> > > +
> > > +        rtc@30 {
> > > +            compatible = "sii,s35390a";
> > > +            reg = <0x30>;
> > > +            pinctrl-0 = <&rtc_pins_default>;
> > > +            pinctrl-names = "default";
> > > +
> > > +            wakeup-parent = <&int>;
> > 
> > I don't understand this need. Device does not generate interrupts - no
> > interrupts property - thus how can it wakeup?
> It is just an example.

But examplep should be complete and represent some real thing, not just
stiched random properties.

> 
> > 
> > As explained in commit msg, the signal at int1 goes to the SoC, right?
> I assume.
> 
> > So where does it go? To which pin of which device? &int?
> For my Synology DS923+ NAS, I do not have schematics. I only know for
> sure from source code that INT1 is used for wakeup and I can confirm
> that this does indeed wake the device up. 
> 
> > 
> > Can you show complete upstream DTS using this?
> There is arch/arm/boot/dts/ti/omap/am3517-som.dtsi, which has the pin
> output of INT1 routed to a gpio pin. INT2 isn't connected at all.
> According to the public schematic [1], this looks accurate.

And INT1 is part of the interrupts.

What I do not get, how this can wakeup anything without generating
an interrupt?

Best regards,
Krzysztof
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/rtc/sii,s35390a.yaml b/Documentation/devicetree/bindings/rtc/sii,s35390a.yaml
new file mode 100644
index 000000000000..dfe632c4b2c8
--- /dev/null
+++ b/Documentation/devicetree/bindings/rtc/sii,s35390a.yaml
@@ -0,0 +1,117 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/rtc/sii,s35390a.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: S-35390A 2-WIRE REAL-TIME CLOCK
+
+maintainers:
+  - Markus Probst <markus.probst@posteo.de>
+
+description:
+  The S-35390A is a CMOS 2-wire real-time clock IC which operates with the
+  very low current consumption in the wide range of operation voltage.
+
+allOf:
+  - $ref: rtc.yaml#
+
+properties:
+  compatible:
+    const: sii,s35390a
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    minItems: 1
+    maxItems: 2
+    description: Supports up to 2 interrupt lines via the INT1 and INT2 pins.
+
+  interrupt-names:
+    items:
+      - const: int1
+      - const: int2
+
+  wakeup-parent: true
+
+  wakeup-source: true
+
+  "#clock-cells":
+    const: 1
+
+patternProperties:
+  "^pins":
+    type: object
+    additionalProperties: false
+
+    patternProperties:
+      "-pins$":
+        type: object
+        additionalProperties: false
+
+        allOf:
+          - $ref: /schemas/pinctrl/pinmux-node.yaml#
+
+        properties:
+          pins:
+            minItems: 1
+            items:
+              enum:
+                - int1
+                - int2
+
+          function:
+            description: |
+              Pin function:
+              - ignore:  Preserve the previous state.
+              - disable: Disable pin output.
+              - wakeup:  Output wakes up the system.
+              - clock:   Output clock pulse.
+              - pmin1:   Minute periodical output with 50% duty.
+              - pmin2:   Minute periodical output L for 7.81 ms.
+                         Can only be used with pin int1.
+            enum:
+              - ignore
+              - disable
+              - wakeup
+              - clock
+              - pmin1
+              - pmin2
+
+        required:
+          - pins
+          - function
+
+required:
+  - compatible
+  - reg
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        rtc@30 {
+            compatible = "sii,s35390a";
+            reg = <0x30>;
+            pinctrl-0 = <&rtc_pins_default>;
+            pinctrl-names = "default";
+
+            wakeup-parent = <&int>;
+
+            rtc_pins_default: pins {
+              int1-pins {
+                pins = "int1";
+                function = "wakeup";
+              };
+              int2-pins {
+                pins = "int2";
+                function = "disable";
+              };
+            };
+        };
+    };
diff --git a/Documentation/devicetree/bindings/rtc/trivial-rtc.yaml b/Documentation/devicetree/bindings/rtc/trivial-rtc.yaml
index f4d0eed98a08..7b3f682ef4d5 100644
--- a/Documentation/devicetree/bindings/rtc/trivial-rtc.yaml
+++ b/Documentation/devicetree/bindings/rtc/trivial-rtc.yaml
@@ -81,8 +81,6 @@  properties:
       - ricoh,rv5c386
       # I2C bus SERIAL INTERFACE REAL-TIME CLOCK IC
       - ricoh,rv5c387a
-      # 2-wire CMOS real-time clock
-      - sii,s35390a
       # ST SPEAr Real-time Clock
       - st,spear600-rtc
       # VIA/Wondermedia VT8500 Real-time Clock
@@ -105,5 +103,4 @@  required:
   - reg
 
 additionalProperties: false
-
 ...