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