xref: /freebsd-src/sys/contrib/device-tree/Bindings/input/adc-joystick.yaml (revision fac71e4e09885bb2afa3d984a0c239a52e1a7418)
16be33864SEmmanuel Vadot# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
26be33864SEmmanuel Vadot# Copyright 2019-2020 Artur Rojek
36be33864SEmmanuel Vadot%YAML 1.2
46be33864SEmmanuel Vadot---
5*fac71e4eSEmmanuel Vadot$id: http://devicetree.org/schemas/input/adc-joystick.yaml#
6*fac71e4eSEmmanuel Vadot$schema: http://devicetree.org/meta-schemas/core.yaml#
76be33864SEmmanuel Vadot
86be33864SEmmanuel Vadottitle: ADC attached joystick
96be33864SEmmanuel Vadot
106be33864SEmmanuel Vadotmaintainers:
116be33864SEmmanuel Vadot  - Artur Rojek <contact@artur-rojek.eu>
126be33864SEmmanuel Vadot
136be33864SEmmanuel Vadotdescription: >
146be33864SEmmanuel Vadot  Bindings for joystick devices connected to ADC controllers supporting
156be33864SEmmanuel Vadot  the Industrial I/O subsystem.
166be33864SEmmanuel Vadot
177ef62cebSEmmanuel VadotallOf:
187ef62cebSEmmanuel Vadot  - $ref: input.yaml#
197ef62cebSEmmanuel Vadot
206be33864SEmmanuel Vadotproperties:
216be33864SEmmanuel Vadot  compatible:
226be33864SEmmanuel Vadot    const: adc-joystick
236be33864SEmmanuel Vadot
246be33864SEmmanuel Vadot  io-channels:
256be33864SEmmanuel Vadot    minItems: 1
266be33864SEmmanuel Vadot    maxItems: 1024
276be33864SEmmanuel Vadot    description: >
286be33864SEmmanuel Vadot      List of phandle and IIO specifier pairs.
296be33864SEmmanuel Vadot      Each pair defines one ADC channel to which a joystick axis is connected.
3082ea1a07SEmmanuel Vadot      See
3182ea1a07SEmmanuel Vadot      https://github.com/devicetree-org/dt-schema/blob/master/schemas/iio/iio-consumer.yaml
3282ea1a07SEmmanuel Vadot      for details.
336be33864SEmmanuel Vadot
347ef62cebSEmmanuel Vadot  poll-interval: true
357ef62cebSEmmanuel Vadot
366be33864SEmmanuel Vadot  '#address-cells':
376be33864SEmmanuel Vadot    const: 1
386be33864SEmmanuel Vadot
396be33864SEmmanuel Vadot  '#size-cells':
406be33864SEmmanuel Vadot    const: 0
416be33864SEmmanuel Vadot
426be33864SEmmanuel Vadotrequired:
436be33864SEmmanuel Vadot  - compatible
446be33864SEmmanuel Vadot  - io-channels
456be33864SEmmanuel Vadot  - '#address-cells'
466be33864SEmmanuel Vadot  - '#size-cells'
476be33864SEmmanuel Vadot
486be33864SEmmanuel VadotadditionalProperties: false
496be33864SEmmanuel Vadot
506be33864SEmmanuel VadotpatternProperties:
516be33864SEmmanuel Vadot  "^axis@[0-9a-f]+$":
526be33864SEmmanuel Vadot    type: object
53b97ee269SEmmanuel Vadot    $ref: input.yaml#
546be33864SEmmanuel Vadot    description: >
556be33864SEmmanuel Vadot      Represents a joystick axis bound to the given ADC channel.
566be33864SEmmanuel Vadot      For each entry in the io-channels list, one axis subnode with a matching
576be33864SEmmanuel Vadot      reg property must be specified.
586be33864SEmmanuel Vadot
596be33864SEmmanuel Vadot    properties:
606be33864SEmmanuel Vadot      reg:
616be33864SEmmanuel Vadot        minimum: 0
626be33864SEmmanuel Vadot        maximum: 1023
636be33864SEmmanuel Vadot        description: Index of an io-channels list entry bound to this axis.
646be33864SEmmanuel Vadot
656be33864SEmmanuel Vadot      linux,code:
666be33864SEmmanuel Vadot        description: EV_ABS specific event code generated by the axis.
676be33864SEmmanuel Vadot
686be33864SEmmanuel Vadot      abs-range:
69c9ccf3a3SEmmanuel Vadot        $ref: /schemas/types.yaml#/definitions/uint32-array
70c9ccf3a3SEmmanuel Vadot        items:
716be33864SEmmanuel Vadot          - description: minimum value
726be33864SEmmanuel Vadot          - description: maximum value
736be33864SEmmanuel Vadot        description: >
746be33864SEmmanuel Vadot          Minimum and maximum values produced by the axis.
756be33864SEmmanuel Vadot          For an ABS_X axis this will be the left-most and right-most
766be33864SEmmanuel Vadot          inclination of the joystick. If min > max, it is left to userspace to
776be33864SEmmanuel Vadot          treat the axis as inverted.
786be33864SEmmanuel Vadot          This property is interpreted as two signed 32 bit values.
796be33864SEmmanuel Vadot
806be33864SEmmanuel Vadot      abs-fuzz:
816be33864SEmmanuel Vadot        $ref: /schemas/types.yaml#/definitions/uint32
826be33864SEmmanuel Vadot        description: >
836be33864SEmmanuel Vadot          Amount of noise in the input value.
846be33864SEmmanuel Vadot          Omitting this property indicates the axis is precise.
856be33864SEmmanuel Vadot
866be33864SEmmanuel Vadot      abs-flat:
876be33864SEmmanuel Vadot        $ref: /schemas/types.yaml#/definitions/uint32
886be33864SEmmanuel Vadot        description: >
896be33864SEmmanuel Vadot          Axial "deadzone", or area around the center position, where the axis
906be33864SEmmanuel Vadot          is considered to be at rest.
916be33864SEmmanuel Vadot          Omitting this property indicates the axis always returns to exactly
926be33864SEmmanuel Vadot          the center position.
936be33864SEmmanuel Vadot
946be33864SEmmanuel Vadot    required:
956be33864SEmmanuel Vadot      - reg
966be33864SEmmanuel Vadot      - linux,code
976be33864SEmmanuel Vadot      - abs-range
986be33864SEmmanuel Vadot
996be33864SEmmanuel Vadot    additionalProperties: false
1006be33864SEmmanuel Vadot
1016be33864SEmmanuel Vadotexamples:
1026be33864SEmmanuel Vadot  - |
1036be33864SEmmanuel Vadot    #include <dt-bindings/iio/adc/ingenic,adc.h>
1046be33864SEmmanuel Vadot    #include <dt-bindings/input/input.h>
1056be33864SEmmanuel Vadot
1066be33864SEmmanuel Vadot    joystick: adc-joystick {
1076be33864SEmmanuel Vadot      compatible = "adc-joystick";
1086be33864SEmmanuel Vadot      io-channels = <&adc INGENIC_ADC_TOUCH_XP>,
1096be33864SEmmanuel Vadot                    <&adc INGENIC_ADC_TOUCH_YP>;
1106be33864SEmmanuel Vadot      #address-cells = <1>;
1116be33864SEmmanuel Vadot      #size-cells = <0>;
1126be33864SEmmanuel Vadot
1136be33864SEmmanuel Vadot      axis@0 {
1146be33864SEmmanuel Vadot              reg = <0>;
1156be33864SEmmanuel Vadot              linux,code = <ABS_X>;
1166be33864SEmmanuel Vadot              abs-range = <3300 0>;
1176be33864SEmmanuel Vadot              abs-fuzz = <4>;
1186be33864SEmmanuel Vadot              abs-flat = <200>;
1196be33864SEmmanuel Vadot      };
1206be33864SEmmanuel Vadot      axis@1 {
1216be33864SEmmanuel Vadot              reg = <1>;
1226be33864SEmmanuel Vadot              linux,code = <ABS_Y>;
1236be33864SEmmanuel Vadot              abs-range = <0 3300>;
1246be33864SEmmanuel Vadot              abs-fuzz = <4>;
1256be33864SEmmanuel Vadot              abs-flat = <200>;
1266be33864SEmmanuel Vadot      };
1276be33864SEmmanuel Vadot    };
128