0001 # SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
0002 # Copyright 2019-2020 Artur Rojek
0003 %YAML 1.2
0004 ---
0005 $id: "http://devicetree.org/schemas/input/adc-joystick.yaml#"
0006 $schema: "http://devicetree.org/meta-schemas/core.yaml#"
0007
0008 title: ADC attached joystick
0009
0010 maintainers:
0011 - Artur Rojek <contact@artur-rojek.eu>
0012
0013 description: >
0014 Bindings for joystick devices connected to ADC controllers supporting
0015 the Industrial I/O subsystem.
0016
0017 properties:
0018 compatible:
0019 const: adc-joystick
0020
0021 io-channels:
0022 minItems: 1
0023 maxItems: 1024
0024 description: >
0025 List of phandle and IIO specifier pairs.
0026 Each pair defines one ADC channel to which a joystick axis is connected.
0027 See
0028 https://github.com/devicetree-org/dt-schema/blob/master/schemas/iio/iio-consumer.yaml
0029 for details.
0030
0031 '#address-cells':
0032 const: 1
0033
0034 '#size-cells':
0035 const: 0
0036
0037 required:
0038 - compatible
0039 - io-channels
0040 - '#address-cells'
0041 - '#size-cells'
0042
0043 additionalProperties: false
0044
0045 patternProperties:
0046 "^axis@[0-9a-f]+$":
0047 type: object
0048 $ref: input.yaml#
0049 description: >
0050 Represents a joystick axis bound to the given ADC channel.
0051 For each entry in the io-channels list, one axis subnode with a matching
0052 reg property must be specified.
0053
0054 properties:
0055 reg:
0056 minimum: 0
0057 maximum: 1023
0058 description: Index of an io-channels list entry bound to this axis.
0059
0060 linux,code:
0061 description: EV_ABS specific event code generated by the axis.
0062
0063 abs-range:
0064 $ref: /schemas/types.yaml#/definitions/uint32-array
0065 items:
0066 - description: minimum value
0067 - description: maximum value
0068 description: >
0069 Minimum and maximum values produced by the axis.
0070 For an ABS_X axis this will be the left-most and right-most
0071 inclination of the joystick. If min > max, it is left to userspace to
0072 treat the axis as inverted.
0073 This property is interpreted as two signed 32 bit values.
0074
0075 abs-fuzz:
0076 $ref: /schemas/types.yaml#/definitions/uint32
0077 description: >
0078 Amount of noise in the input value.
0079 Omitting this property indicates the axis is precise.
0080
0081 abs-flat:
0082 $ref: /schemas/types.yaml#/definitions/uint32
0083 description: >
0084 Axial "deadzone", or area around the center position, where the axis
0085 is considered to be at rest.
0086 Omitting this property indicates the axis always returns to exactly
0087 the center position.
0088
0089 required:
0090 - reg
0091 - linux,code
0092 - abs-range
0093
0094 additionalProperties: false
0095
0096 examples:
0097 - |
0098 #include <dt-bindings/iio/adc/ingenic,adc.h>
0099 #include <dt-bindings/input/input.h>
0100
0101 joystick: adc-joystick {
0102 compatible = "adc-joystick";
0103 io-channels = <&adc INGENIC_ADC_TOUCH_XP>,
0104 <&adc INGENIC_ADC_TOUCH_YP>;
0105 #address-cells = <1>;
0106 #size-cells = <0>;
0107
0108 axis@0 {
0109 reg = <0>;
0110 linux,code = <ABS_X>;
0111 abs-range = <3300 0>;
0112 abs-fuzz = <4>;
0113 abs-flat = <200>;
0114 };
0115 axis@1 {
0116 reg = <1>;
0117 linux,code = <ABS_Y>;
0118 abs-range = <0 3300>;
0119 abs-fuzz = <4>;
0120 abs-flat = <200>;
0121 };
0122 };