Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dt-bindings: touchscreen: add touch-overlay property

The touch-overlay encompasses a number of touch areas that define a
clipped touchscreen area and/or buttons with a specific functionality.

A clipped touchscreen area avoids getting events from regions that are
physically hidden by overlay frames.

For touchscreens with printed overlay buttons, sub-nodes with a suitable
key code can be defined to report key events instead of the original
touch events.

Reviewed-by: Jeff LaBundy <jeff@labundy.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Javier Carrasco <javier.carrasco@wolfvision.net>
Link: https://lore.kernel.org/r/20241016-feature-ts_virtobj_patch-v11-1-b292a1bbb0a1@wolfvision.net
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Javier Carrasco and committed by
Dmitry Torokhov
19875cce 17eabb79

+119
+119
Documentation/devicetree/bindings/input/touchscreen/touchscreen.yaml
··· 87 87 touchscreen-y-plate-ohms: 88 88 description: Resistance of the Y-plate in Ohms 89 89 90 + touch-overlay: 91 + description: | 92 + List of nodes defining segments (touch areas) on the touchscreen. 93 + 94 + This object can be used to describe a series of segments to restrict 95 + the region within touch events are reported or buttons with a specific 96 + functionality. 97 + 98 + This is of special interest if the touchscreen is shipped with a physical 99 + overlay on top of it with a frame that hides some part of the original 100 + touchscreen area. Printed buttons on that overlay are also a typical 101 + use case. 102 + 103 + A new touchscreen area is defined as a sub-node without a key code. If a 104 + key code is defined in the sub-node, it will be interpreted as a button. 105 + 106 + The x-origin and y-origin properties of a touchscreen area define the 107 + offset of a new origin from where the touchscreen events are referenced. 108 + This offset is applied to the events accordingly. The x-size and y-size 109 + properties define the size of the touchscreen effective area. 110 + 111 + The following example shows a new touchscreen area with the new origin 112 + (0',0') for the touch events generated by the device. 113 + 114 + Touchscreen (full area) 115 + ┌────────────────────────────────────────┐ 116 + │ ┌───────────────────────────────┐ │ 117 + │ │ │ │ 118 + │ ├ y-size │ │ 119 + │ │ │ │ 120 + │ │ touchscreen area │ │ 121 + │ │ (no key code) │ │ 122 + │ │ │ │ 123 + │ │ x-size │ │ 124 + │ ┌└──────────────┴────────────────┘ │ 125 + │(0',0') │ 126 + ┌└────────────────────────────────────────┘ 127 + (0,0) 128 + 129 + where (0',0') = (0+x-origin,0+y-origin) 130 + 131 + Sub-nodes with key codes report the touch events on their surface as key 132 + events instead. 133 + 134 + The following example shows a touchscreen with a single button on it. 135 + 136 + Touchscreen (full area) 137 + ┌───────────────────────────────────┐ 138 + │ │ 139 + │ │ 140 + │ ┌─────────┐ │ 141 + │ │button 0 │ │ 142 + │ │KEY_POWER│ │ 143 + │ └─────────┘ │ 144 + │ │ 145 + │ │ 146 + ┌└───────────────────────────────────┘ 147 + (0,0) 148 + 149 + Segments defining buttons and clipped toushcreen areas can be combined 150 + as shown in the following example. 151 + In that case only the events within the touchscreen area are reported 152 + as touch events. Events within the button areas report their associated 153 + key code. Any events outside the defined areas are ignored. 154 + 155 + Touchscreen (full area) 156 + ┌─────────┬──────────────────────────────┐ 157 + │ │ │ 158 + │ │ ┌───────────────────────┐ │ 159 + │ button 0│ │ │ │ 160 + │KEY_POWER│ │ │ │ 161 + │ │ │ │ │ 162 + ├─────────┤ │ touchscreen area │ │ 163 + │ │ │ (no key code) │ │ 164 + │ │ │ │ │ 165 + │ button 1│ │ │ │ 166 + │ KEY_INFO│ ┌└───────────────────────┘ │ 167 + │ │(0',0') │ 168 + ┌└─────────┴──────────────────────────────┘ 169 + (0,0) 170 + 171 + type: object 172 + 173 + patternProperties: 174 + '^segment-': 175 + type: object 176 + description: 177 + Each segment is represented as a sub-node. 178 + properties: 179 + x-origin: 180 + description: horizontal origin of the node area 181 + $ref: /schemas/types.yaml#/definitions/uint32 182 + 183 + y-origin: 184 + description: vertical origin of the node area 185 + $ref: /schemas/types.yaml#/definitions/uint32 186 + 187 + x-size: 188 + description: horizontal resolution of the node area 189 + $ref: /schemas/types.yaml#/definitions/uint32 190 + 191 + y-size: 192 + description: vertical resolution of the node area 193 + $ref: /schemas/types.yaml#/definitions/uint32 194 + 195 + label: 196 + description: descriptive name of the segment 197 + $ref: /schemas/types.yaml#/definitions/string 198 + 199 + linux,code: true 200 + 201 + required: 202 + - x-origin 203 + - y-origin 204 + - x-size 205 + - y-size 206 + 207 + unevaluatedProperties: false 208 + 90 209 dependencies: 91 210 touchscreen-size-x: [ touchscreen-size-y ] 92 211 touchscreen-size-y: [ touchscreen-size-x ]