xref: /linux/Documentation/devicetree/bindings/counter/interrupt-counter.yaml (revision 8be98d2f2a0a262f8bf8a0bc1fdf522b3c7aab17)
1*0b8061c3SOleksij Rempel# SPDX-License-Identifier: GPL-2.0
2*0b8061c3SOleksij Rempel%YAML 1.2
3*0b8061c3SOleksij Rempel---
4*0b8061c3SOleksij Rempel$id: http://devicetree.org/schemas/counter/interrupt-counter.yaml#
5*0b8061c3SOleksij Rempel$schema: http://devicetree.org/meta-schemas/core.yaml#
6*0b8061c3SOleksij Rempel
7*0b8061c3SOleksij Rempeltitle: Interrupt counter
8*0b8061c3SOleksij Rempel
9*0b8061c3SOleksij Rempelmaintainers:
10*0b8061c3SOleksij Rempel  - Oleksij Rempel <o.rempel@pengutronix.de>
11*0b8061c3SOleksij Rempel
12*0b8061c3SOleksij Rempeldescription: |
13*0b8061c3SOleksij Rempel  A generic interrupt counter to measure interrupt frequency. It was developed
14*0b8061c3SOleksij Rempel  and used for agricultural devices to measure rotation speed of wheels or
15*0b8061c3SOleksij Rempel  other tools. Since the direction of rotation is not important, only one
16*0b8061c3SOleksij Rempel  signal line is needed.
17*0b8061c3SOleksij Rempel  Interrupts or gpios are required. If both are defined, the interrupt will
18*0b8061c3SOleksij Rempel  take precedence for counting interrupts.
19*0b8061c3SOleksij Rempel
20*0b8061c3SOleksij Rempelproperties:
21*0b8061c3SOleksij Rempel  compatible:
22*0b8061c3SOleksij Rempel    const: interrupt-counter
23*0b8061c3SOleksij Rempel
24*0b8061c3SOleksij Rempel  interrupts:
25*0b8061c3SOleksij Rempel    maxItems: 1
26*0b8061c3SOleksij Rempel
27*0b8061c3SOleksij Rempel  gpios:
28*0b8061c3SOleksij Rempel    maxItems: 1
29*0b8061c3SOleksij Rempel
30*0b8061c3SOleksij Rempelrequired:
31*0b8061c3SOleksij Rempel  - compatible
32*0b8061c3SOleksij Rempel
33*0b8061c3SOleksij RempelanyOf:
34*0b8061c3SOleksij Rempel  - required: [ interrupts-extended ]
35*0b8061c3SOleksij Rempel  - required: [ interrupts ]
36*0b8061c3SOleksij Rempel  - required: [ gpios ]
37*0b8061c3SOleksij Rempel
38*0b8061c3SOleksij RempeladditionalProperties: false
39*0b8061c3SOleksij Rempel
40*0b8061c3SOleksij Rempelexamples:
41*0b8061c3SOleksij Rempel  - |
42*0b8061c3SOleksij Rempel
43*0b8061c3SOleksij Rempel    #include <dt-bindings/interrupt-controller/irq.h>
44*0b8061c3SOleksij Rempel    #include <dt-bindings/gpio/gpio.h>
45*0b8061c3SOleksij Rempel
46*0b8061c3SOleksij Rempel    counter-0 {
47*0b8061c3SOleksij Rempel        compatible = "interrupt-counter";
48*0b8061c3SOleksij Rempel        interrupts-extended = <&gpio 0 IRQ_TYPE_EDGE_RISING>;
49*0b8061c3SOleksij Rempel    };
50*0b8061c3SOleksij Rempel
51*0b8061c3SOleksij Rempel    counter-1 {
52*0b8061c3SOleksij Rempel        compatible = "interrupt-counter";
53*0b8061c3SOleksij Rempel        gpios = <&gpio 2 GPIO_ACTIVE_HIGH>;
54*0b8061c3SOleksij Rempel    };
55*0b8061c3SOleksij Rempel
56*0b8061c3SOleksij Rempel    counter-2 {
57*0b8061c3SOleksij Rempel        compatible = "interrupt-counter";
58*0b8061c3SOleksij Rempel        interrupts-extended = <&gpio 2 IRQ_TYPE_EDGE_RISING>;
59*0b8061c3SOleksij Rempel        gpios = <&gpio 2 GPIO_ACTIVE_HIGH>;
60*0b8061c3SOleksij Rempel    };
61*0b8061c3SOleksij Rempel
62*0b8061c3SOleksij Rempel...
63