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

Merge tag 'input-for-v6.17-rc0' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input

Pull input updates from Dmitry Torokhov:

- updates to several drivers consuming GPIO APIs to use setters
returning error codes

- an infrastructure allowing to define "overlays" for touchscreens
carving out regions implementing buttons and other elements from a
bigger sensors and a corresponding update to st1232 driver

- an update to AT/PS2 keyboard driver to map F13-F24 by default

- Samsung keypad driver got a facelift

- evdev input handler will now bind to all devices using EV_SYN event
instead of abusing id->driver_info

- two new sub-drivers implementing 1A (capacitive buttons) and 21
(forcepad button) functions in Synaptics RMI driver

- support for polling mode in Goodix touchscreen driver

- support for support for FocalTech FT8716 in edt-ft5x06 driver

- support for MT6359 in mtk-pmic-keys driver

- removal of pcf50633-input driver since platform it was used on is
gone

- new definitions for game controller "grip" buttons (BTN_GRIP*) and
corresponding changes to xpad and hid-steam controller drivers

- a new definition for "performance" key

* tag 'input-for-v6.17-rc0' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (38 commits)
HID: hid-steam: Use new BTN_GRIP* buttons
Input: add keycode for performance mode key
Input: max77693 - convert to atomic pwm operation
Input: st1232 - add touch-overlay handling
dt-bindings: input: touchscreen: st1232: add touch-overlay example
Input: touch-overlay - add touchscreen overlay handling
dt-bindings: touchscreen: add touch-overlay property
Input: atkbd - correctly map F13 - F24
Input: xpad - use new BTN_GRIP* buttons
Input: Add and document BTN_GRIP*
Input: xpad - change buttons the D-Pad gets mapped as to BTN_DPAD_*
Documentation: Fix capitalization of XBox -> Xbox
Input: synaptics-rmi4 - add support for F1A
dt-bindings: input: syna,rmi4: Document F1A function
Input: synaptics-rmi4 - add support for Forcepads (F21)
Input: mtk-pmic-keys - add support for MT6359 PMIC keys
Input: remove special handling of id->driver_info when matching
Input: evdev - switch matching to EV_SYN
Input: samsung-keypad - use BIT() and GENMASK() where appropriate
Input: samsung-keypad - use per-chip parameters
...

+1296 -425
+20
Documentation/devicetree/bindings/input/syna,rmi4.yaml
··· 89 89 required: 90 90 - reg 91 91 92 + rmi4-f1a@1a: 93 + type: object 94 + additionalProperties: false 95 + $ref: input.yaml# 96 + description: 97 + RMI4 Function 1A is for capacitive keys. 98 + 99 + properties: 100 + reg: 101 + maxItems: 1 102 + 103 + linux,keycodes: 104 + minItems: 1 105 + maxItems: 4 106 + 107 + required: 108 + - reg 109 + 92 110 patternProperties: 93 111 "^rmi4-f1[12]@1[12]$": 94 112 type: object ··· 219 201 220 202 examples: 221 203 - | 204 + #include <dt-bindings/input/linux-event-codes.h> 222 205 #include <dt-bindings/interrupt-controller/irq.h> 223 206 224 207 i2c { ··· 253 234 254 235 rmi4-f1a@1a { 255 236 reg = <0x1a>; 237 + linux,keycodes = <KEY_BACK KEY_HOME KEY_MENU>; 256 238 }; 257 239 }; 258 240 };
+1
Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.yaml
··· 43 43 - focaltech,ft5452 44 44 - focaltech,ft6236 45 45 - focaltech,ft8201 46 + - focaltech,ft8716 46 47 - focaltech,ft8719 47 48 48 49 reg:
-16
Documentation/devicetree/bindings/input/touchscreen/lpc32xx-tsc.txt
··· 1 - * NXP LPC32xx SoC Touchscreen Controller (TSC) 2 - 3 - Required properties: 4 - - compatible: must be "nxp,lpc3220-tsc" 5 - - reg: physical base address of the controller and length of memory mapped 6 - region. 7 - - interrupts: The TSC/ADC interrupt 8 - 9 - Example: 10 - 11 - tsc@40048000 { 12 - compatible = "nxp,lpc3220-tsc"; 13 - reg = <0x40048000 0x1000>; 14 - interrupt-parent = <&mic>; 15 - interrupts = <39 0>; 16 - };
+43
Documentation/devicetree/bindings/input/touchscreen/nxp,lpc3220-tsc.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/input/touchscreen/nxp,lpc3220-tsc.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: NXP LPC32xx SoC Touchscreen Controller (TSC) 8 + 9 + maintainers: 10 + - Frank Li <Frank.Li@nxp.com> 11 + 12 + properties: 13 + compatible: 14 + const: nxp,lpc3220-tsc 15 + 16 + reg: 17 + maxItems: 1 18 + 19 + clocks: 20 + maxItems: 1 21 + 22 + interrupts: 23 + maxItems: 1 24 + 25 + required: 26 + - compatible 27 + - reg 28 + - clocks 29 + - interrupts 30 + 31 + additionalProperties: false 32 + 33 + examples: 34 + - | 35 + #include <dt-bindings/clock/lpc32xx-clock.h> 36 + 37 + touchscreen@40048000 { 38 + compatible = "nxp,lpc3220-tsc"; 39 + reg = <0x40048000 0x1000>; 40 + interrupt-parent = <&mic>; 41 + interrupts = <39 0>; 42 + clocks = <&clk LPC32XX_CLK_ADC>; 43 + };
+29
Documentation/devicetree/bindings/input/touchscreen/sitronix,st1232.yaml
··· 37 37 38 38 examples: 39 39 - | 40 + #include <dt-bindings/input/linux-event-codes.h> 40 41 i2c { 41 42 #address-cells = <1>; 42 43 #size-cells = <0>; ··· 47 46 reg = <0x55>; 48 47 interrupts = <2 0>; 49 48 gpios = <&gpio1 166 0>; 49 + 50 + touch-overlay { 51 + segment-0 { 52 + label = "Touchscreen"; 53 + x-origin = <0>; 54 + x-size = <240>; 55 + y-origin = <40>; 56 + y-size = <280>; 57 + }; 58 + 59 + segment-1a { 60 + label = "Camera light"; 61 + linux,code = <KEY_LIGHTS_TOGGLE>; 62 + x-origin = <40>; 63 + x-size = <40>; 64 + y-origin = <0>; 65 + y-size = <40>; 66 + }; 67 + 68 + segment-2a { 69 + label = "Power"; 70 + linux,code = <KEY_POWER>; 71 + x-origin = <160>; 72 + x-size = <40>; 73 + y-origin = <0>; 74 + y-size = <40>; 75 + }; 76 + }; 50 77 }; 51 78 };
+75
Documentation/devicetree/bindings/input/touchscreen/ti.tsc2007.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/input/touchscreen/ti.tsc2007.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Texas Instruments tsc2007 touchscreen controller 8 + 9 + maintainers: 10 + - Frank Li <Frank.Li@nxp.com> 11 + 12 + properties: 13 + compatible: 14 + const: ti,tsc2007 15 + 16 + reg: 17 + maxItems: 1 18 + 19 + interrupts: 20 + maxItems: 1 21 + 22 + ti,x-plate-ohms: 23 + description: X-plate resistance in ohms. 24 + 25 + gpios: true 26 + 27 + pendown-gpio: true 28 + 29 + ti,max-rt: 30 + $ref: /schemas/types.yaml#/definitions/uint32 31 + description: maximum pressure. 32 + 33 + ti,fuzzx: 34 + $ref: /schemas/types.yaml#/definitions/uint32 35 + description: 36 + specifies the absolute input fuzz x value. 37 + If set, it will permit noise in the data up to +- the value given to the fuzz 38 + parameter, that is used to filter noise from the event stream. 39 + 40 + ti,fuzzy: 41 + $ref: /schemas/types.yaml#/definitions/uint32 42 + description: specifies the absolute input fuzz y value. 43 + 44 + ti,fuzzz: 45 + $ref: /schemas/types.yaml#/definitions/uint32 46 + description: specifies the absolute input fuzz z value. 47 + 48 + ti,poll-period: 49 + $ref: /schemas/types.yaml#/definitions/uint32 50 + description: 51 + how much time to wait (in milliseconds) before reading again the 52 + values from the tsc2007. 53 + 54 + required: 55 + - compatible 56 + - reg 57 + - ti,x-plate-ohms 58 + 59 + additionalProperties: false 60 + 61 + examples: 62 + - | 63 + i2c { 64 + #address-cells = <1>; 65 + #size-cells = <0>; 66 + 67 + touch@49 { 68 + compatible = "ti,tsc2007"; 69 + reg = <0x49>; 70 + interrupt-parent = <&gpio4>; 71 + interrupts = <0x0 0x8>; 72 + gpios = <&gpio4 0 0>; 73 + ti,x-plate-ohms = <180>; 74 + }; 75 + };
+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 ]
-39
Documentation/devicetree/bindings/input/touchscreen/tsc2007.txt
··· 1 - * Texas Instruments tsc2007 touchscreen controller 2 - 3 - Required properties: 4 - - compatible: must be "ti,tsc2007". 5 - - reg: I2C address of the chip. 6 - - ti,x-plate-ohms: X-plate resistance in ohms. 7 - 8 - Optional properties: 9 - - gpios: the interrupt gpio the chip is connected to (through the penirq pin). 10 - The penirq pin goes to low when the panel is touched. 11 - (see GPIO binding[1] for more details). 12 - - interrupts: (gpio) interrupt to which the chip is connected 13 - (see interrupt binding[0]). 14 - - ti,max-rt: maximum pressure. 15 - - ti,fuzzx: specifies the absolute input fuzz x value. 16 - If set, it will permit noise in the data up to +- the value given to the fuzz 17 - parameter, that is used to filter noise from the event stream. 18 - - ti,fuzzy: specifies the absolute input fuzz y value. 19 - - ti,fuzzz: specifies the absolute input fuzz z value. 20 - - ti,poll-period: how much time to wait (in milliseconds) before reading again the 21 - values from the tsc2007. 22 - 23 - [0]: Documentation/devicetree/bindings/interrupt-controller/interrupts.txt 24 - [1]: Documentation/devicetree/bindings/gpio/gpio.txt 25 - 26 - Example: 27 - &i2c1 { 28 - /* ... */ 29 - tsc2007@49 { 30 - compatible = "ti,tsc2007"; 31 - reg = <0x49>; 32 - interrupt-parent = <&gpio4>; 33 - interrupts = <0x0 0x8>; 34 - gpios = <&gpio4 0 0>; 35 - ti,x-plate-ohms = <180>; 36 - }; 37 - 38 - /* ... */ 39 - };
+19 -2
Documentation/input/devices/edt-ft5x06.rst
··· 29 29 30 30 31 31 For debugging purposes the driver provides a few files in the debug 32 - filesystem (if available in the kernel). In /sys/kernel/debug/edt_ft5x06 33 - you'll find the following files: 32 + filesystem (if available in the kernel). They are located in: 33 + 34 + /sys/kernel/debug/i2c/<i2c-bus>/<i2c-device>/ 35 + 36 + If you don't know the bus and device numbers, you can look them up with this 37 + command: 38 + 39 + $ ls -l /sys/bus/i2c/drivers/edt_ft5x06 40 + 41 + The dereference of the symlink will contain the needed information. You will 42 + need the last two elements of its path: 43 + 44 + 0-0038 -> ../../../../devices/platform/soc/fcfee800.i2c/i2c-0/0-0038 45 + 46 + So in this case, the location for the debug files is: 47 + 48 + /sys/kernel/debug/i2c/i2c-0/0-0038/ 49 + 50 + There, you'll find the following files: 34 51 35 52 num_x, num_y: 36 53 (readonly) contains the number of sensor fields in X- and
+16 -3
Documentation/input/gamepad.rst
··· 190 190 191 191 Rumble is advertised as FF_RUMBLE. 192 192 193 + - Grip buttons: 194 + 195 + Many pads include buttons on the rear, usually referred to as either grip or 196 + rear buttons, or paddles. These are often reprogrammable by the firmware to 197 + appear as "normal" buttons, but are sometimes exposed to software too. Some 198 + notable examples of this are the Steam Deck, which has R4, R5, L4, and L5 on 199 + the back; the Xbox Elite pads, which have P1-P4; and the Switch 2 Pro 200 + Controller, which has GL and GR. 201 + 202 + For these controllers, BTN_GRIPR and BTN_GRIPR2 should be used for the top 203 + and bottom (if present) right grip button(s), and BTN_GRIPL and BTN_GRIPL2 204 + should be used for the top and bottom (if present) left grip button(s). 205 + 193 206 - Profile: 194 207 195 - Some pads provide a multi-value profile selection switch. An example is the 196 - XBox Adaptive and the XBox Elite 2 controllers. When the active profile is 197 - switched, its newly selected value is emitted as an ABS_PROFILE event. 208 + Some pads provide a multi-value profile selection switch. Examples include 209 + the Xbox Adaptive and the Xbox Elite 2 controllers. When the active profile 210 + is switched, its newly selected value is emitted as an ABS_PROFILE event.
+2 -2
Documentation/userspace-api/media/rc/rc-protos.rst
··· 449 449 xbox-dvd (RC_PROTO_XBOX_DVD) 450 450 ---------------------------- 451 451 452 - This protocol is used by XBox DVD Remote, which was made for the original 453 - XBox. There is no in-kernel decoder or encoder for this protocol. The usb 452 + This protocol is used by Xbox DVD Remote, which was made for the original 453 + Xbox. There is no in-kernel decoder or encoder for this protocol. The usb 454 454 device decodes the protocol. There is a BPF decoder available in v4l-utils.
+7
MAINTAINERS
··· 25499 25499 S: Maintained 25500 25500 F: drivers/platform/x86/toshiba-wmi.c 25501 25501 25502 + TOUCH OVERLAY 25503 + M: Javier Carrasco <javier.carrasco@wolfvision.net> 25504 + L: linux-input@vger.kernel.org 25505 + S: Maintained 25506 + F: drivers/input/touch-overlay.c 25507 + F: include/linux/input/touch-overlay.h 25508 + 25502 25509 TPM DEVICE DRIVER 25503 25510 M: Peter Huewe <peterhuewe@gmx.de> 25504 25511 M: Jarkko Sakkinen <jarkko@kernel.org>
+2
drivers/hid/hid-debug.c
··· 3291 3291 [BTN_TR2] = "BtnTR2", [BTN_SELECT] = "BtnSelect", 3292 3292 [BTN_START] = "BtnStart", [BTN_MODE] = "BtnMode", 3293 3293 [BTN_THUMBL] = "BtnThumbL", [BTN_THUMBR] = "BtnThumbR", 3294 + [BTN_GRIPL] = "BtnGripL", [BTN_GRIPR] = "BtnGripR", 3295 + [BTN_GRIPL2] = "BtnGripL2", [BTN_GRIPR2] = "BtnGripR2", 3294 3296 [BTN_TOOL_PEN] = "ToolPen", [BTN_TOOL_RUBBER] = "ToolRubber", 3295 3297 [BTN_TOOL_BRUSH] = "ToolBrush", [BTN_TOOL_PENCIL] = "ToolPencil", 3296 3298 [BTN_TOOL_AIRBRUSH] = "ToolAirbrush", [BTN_TOOL_FINGER] = "ToolFinger",
+16 -19
drivers/hid/hid-steam.c
··· 755 755 input_set_capability(input, EV_KEY, BTN_THUMBL); 756 756 input_set_capability(input, EV_KEY, BTN_THUMB); 757 757 input_set_capability(input, EV_KEY, BTN_THUMB2); 758 + input_set_capability(input, EV_KEY, BTN_GRIPL); 759 + input_set_capability(input, EV_KEY, BTN_GRIPR); 758 760 if (steam->quirks & STEAM_QUIRK_DECK) { 759 761 input_set_capability(input, EV_KEY, BTN_BASE); 760 - input_set_capability(input, EV_KEY, BTN_TRIGGER_HAPPY1); 761 - input_set_capability(input, EV_KEY, BTN_TRIGGER_HAPPY2); 762 - input_set_capability(input, EV_KEY, BTN_TRIGGER_HAPPY3); 763 - input_set_capability(input, EV_KEY, BTN_TRIGGER_HAPPY4); 764 - } else { 765 - input_set_capability(input, EV_KEY, BTN_GEAR_DOWN); 766 - input_set_capability(input, EV_KEY, BTN_GEAR_UP); 762 + input_set_capability(input, EV_KEY, BTN_GRIPL2); 763 + input_set_capability(input, EV_KEY, BTN_GRIPR2); 767 764 } 768 765 769 766 input_set_abs_params(input, ABS_X, -32767, 32767, 0, 0); ··· 1416 1419 * 9.4 | BTN_SELECT | menu left 1417 1420 * 9.5 | BTN_MODE | steam logo 1418 1421 * 9.6 | BTN_START | menu right 1419 - * 9.7 | BTN_GEAR_DOWN | left back lever 1420 - * 10.0 | BTN_GEAR_UP | right back lever 1422 + * 9.7 | BTN_GRIPL | left back lever 1423 + * 10.0 | BTN_GRIPR | right back lever 1421 1424 * 10.1 | -- | left-pad clicked 1422 1425 * 10.2 | BTN_THUMBR | right-pad clicked 1423 1426 * 10.3 | BTN_THUMB | left-pad touched (but see explanation below) ··· 1482 1485 input_event(input, EV_KEY, BTN_SELECT, !!(b9 & BIT(4))); 1483 1486 input_event(input, EV_KEY, BTN_MODE, !!(b9 & BIT(5))); 1484 1487 input_event(input, EV_KEY, BTN_START, !!(b9 & BIT(6))); 1485 - input_event(input, EV_KEY, BTN_GEAR_DOWN, !!(b9 & BIT(7))); 1486 - input_event(input, EV_KEY, BTN_GEAR_UP, !!(b10 & BIT(0))); 1488 + input_event(input, EV_KEY, BTN_GRIPL, !!(b9 & BIT(7))); 1489 + input_event(input, EV_KEY, BTN_GRIPR, !!(b10 & BIT(0))); 1487 1490 input_event(input, EV_KEY, BTN_THUMBR, !!(b10 & BIT(2))); 1488 1491 input_event(input, EV_KEY, BTN_THUMBL, !!(b10 & BIT(6))); 1489 1492 input_event(input, EV_KEY, BTN_THUMB, lpad_touched || lpad_and_joy); ··· 1544 1547 * 9.4 | BTN_SELECT | menu left 1545 1548 * 9.5 | BTN_MODE | steam logo 1546 1549 * 9.6 | BTN_START | menu right 1547 - * 9.7 | BTN_TRIGGER_HAPPY3 | left bottom grip button 1548 - * 10.0 | BTN_TRIGGER_HAPPY4 | right bottom grip button 1550 + * 9.7 | BTN_GRIPL2 | left bottom grip button 1551 + * 10.0 | BTN_GRIPR2 | right bottom grip button 1549 1552 * 10.1 | BTN_THUMB | left pad pressed 1550 1553 * 10.2 | BTN_THUMB2 | right pad pressed 1551 1554 * 10.3 | -- | left pad touched ··· 1570 1573 * 12.6 | -- | unknown 1571 1574 * 12.7 | -- | unknown 1572 1575 * 13.0 | -- | unknown 1573 - * 13.1 | BTN_TRIGGER_HAPPY1 | left top grip button 1574 - * 13.2 | BTN_TRIGGER_HAPPY2 | right top grip button 1576 + * 13.1 | BTN_GRIPL | left top grip button 1577 + * 13.2 | BTN_GRIPR | right top grip button 1575 1578 * 13.3 | -- | unknown 1576 1579 * 13.4 | -- | unknown 1577 1580 * 13.5 | -- | unknown ··· 1656 1659 input_event(input, EV_KEY, BTN_SELECT, !!(b9 & BIT(4))); 1657 1660 input_event(input, EV_KEY, BTN_MODE, !!(b9 & BIT(5))); 1658 1661 input_event(input, EV_KEY, BTN_START, !!(b9 & BIT(6))); 1659 - input_event(input, EV_KEY, BTN_TRIGGER_HAPPY3, !!(b9 & BIT(7))); 1660 - input_event(input, EV_KEY, BTN_TRIGGER_HAPPY4, !!(b10 & BIT(0))); 1662 + input_event(input, EV_KEY, BTN_GRIPL2, !!(b9 & BIT(7))); 1663 + input_event(input, EV_KEY, BTN_GRIPR2, !!(b10 & BIT(0))); 1661 1664 input_event(input, EV_KEY, BTN_THUMBL, !!(b10 & BIT(6))); 1662 1665 input_event(input, EV_KEY, BTN_THUMBR, !!(b11 & BIT(2))); 1663 1666 input_event(input, EV_KEY, BTN_DPAD_UP, !!(b9 & BIT(0))); ··· 1666 1669 input_event(input, EV_KEY, BTN_DPAD_DOWN, !!(b9 & BIT(3))); 1667 1670 input_event(input, EV_KEY, BTN_THUMB, !!(b10 & BIT(1))); 1668 1671 input_event(input, EV_KEY, BTN_THUMB2, !!(b10 & BIT(2))); 1669 - input_event(input, EV_KEY, BTN_TRIGGER_HAPPY1, !!(b13 & BIT(1))); 1670 - input_event(input, EV_KEY, BTN_TRIGGER_HAPPY2, !!(b13 & BIT(2))); 1672 + input_event(input, EV_KEY, BTN_GRIPL, !!(b13 & BIT(1))); 1673 + input_event(input, EV_KEY, BTN_GRIPR, !!(b13 & BIT(2))); 1671 1674 input_event(input, EV_KEY, BTN_BASE, !!(b14 & BIT(2))); 1672 1675 1673 1676 input_sync(input);
+1 -1
drivers/input/Makefile
··· 7 7 8 8 obj-$(CONFIG_INPUT) += input-core.o 9 9 input-core-y := input.o input-compat.o input-mt.o input-poller.o ff-core.o 10 - input-core-y += touchscreen.o 10 + input-core-y += touchscreen.o touch-overlay.o 11 11 12 12 obj-$(CONFIG_INPUT_FF_MEMLESS) += ff-memless.o 13 13 obj-$(CONFIG_INPUT_SPARSEKMAP) += sparse-keymap.o
+6 -2
drivers/input/evdev.c
··· 1408 1408 } 1409 1409 1410 1410 static const struct input_device_id evdev_ids[] = { 1411 - { .driver_info = 1 }, /* Matches all devices */ 1412 - { }, /* Terminating zero entry */ 1411 + { 1412 + /* Matches all devices */ 1413 + .flags = INPUT_DEVICE_ID_MATCH_EVBIT, 1414 + .evbit = { BIT_MASK(EV_SYN) }, 1415 + }, 1416 + { } /* Terminating zero entry */ 1413 1417 }; 1414 1418 1415 1419 MODULE_DEVICE_TABLE(input, evdev_ids);
+1 -1
drivers/input/input.c
··· 971 971 { 972 972 const struct input_device_id *id; 973 973 974 - for (id = handler->id_table; id->flags || id->driver_info; id++) { 974 + for (id = handler->id_table; id->flags; id++) { 975 975 if (input_match_device_id(dev, id) && 976 976 (!handler->match || handler->match(handler, dev))) { 977 977 return id;
+32 -32
drivers/input/joystick/xpad.c
··· 442 442 443 443 /* used when dpad is mapped to buttons */ 444 444 static const signed short xpad_btn_pad[] = { 445 - BTN_TRIGGER_HAPPY1, BTN_TRIGGER_HAPPY2, /* d-pad left, right */ 446 - BTN_TRIGGER_HAPPY3, BTN_TRIGGER_HAPPY4, /* d-pad up, down */ 445 + BTN_DPAD_LEFT, BTN_DPAD_RIGHT, /* d-pad left, right */ 446 + BTN_DPAD_UP, BTN_DPAD_DOWN, /* d-pad up, down */ 447 447 -1 /* terminating entry */ 448 448 }; 449 449 ··· 479 479 480 480 /* used when the controller has extra paddle buttons */ 481 481 static const signed short xpad_btn_paddles[] = { 482 - BTN_TRIGGER_HAPPY5, BTN_TRIGGER_HAPPY6, /* paddle upper right, lower right */ 483 - BTN_TRIGGER_HAPPY7, BTN_TRIGGER_HAPPY8, /* paddle upper left, lower left */ 482 + BTN_GRIPR, BTN_GRIPR2, /* paddle upper right, lower right */ 483 + BTN_GRIPL, BTN_GRIPL2, /* paddle upper left, lower left */ 484 484 -1 /* terminating entry */ 485 485 }; 486 486 ··· 840 840 /* digital pad */ 841 841 if (xpad->mapping & MAP_DPAD_TO_BUTTONS) { 842 842 /* dpad as buttons (left, right, up, down) */ 843 - input_report_key(dev, BTN_TRIGGER_HAPPY1, data[2] & BIT(2)); 844 - input_report_key(dev, BTN_TRIGGER_HAPPY2, data[2] & BIT(3)); 845 - input_report_key(dev, BTN_TRIGGER_HAPPY3, data[2] & BIT(0)); 846 - input_report_key(dev, BTN_TRIGGER_HAPPY4, data[2] & BIT(1)); 843 + input_report_key(dev, BTN_DPAD_LEFT, data[2] & BIT(2)); 844 + input_report_key(dev, BTN_DPAD_RIGHT, data[2] & BIT(3)); 845 + input_report_key(dev, BTN_DPAD_UP, data[2] & BIT(0)); 846 + input_report_key(dev, BTN_DPAD_DOWN, data[2] & BIT(1)); 847 847 } else { 848 848 input_report_abs(dev, ABS_HAT0X, 849 849 !!(data[2] & 0x08) - !!(data[2] & 0x04)); ··· 891 891 /* digital pad */ 892 892 if (xpad->mapping & MAP_DPAD_TO_BUTTONS) { 893 893 /* dpad as buttons (left, right, up, down) */ 894 - input_report_key(dev, BTN_TRIGGER_HAPPY1, data[2] & BIT(2)); 895 - input_report_key(dev, BTN_TRIGGER_HAPPY2, data[2] & BIT(3)); 896 - input_report_key(dev, BTN_TRIGGER_HAPPY3, data[2] & BIT(0)); 897 - input_report_key(dev, BTN_TRIGGER_HAPPY4, data[2] & BIT(1)); 894 + input_report_key(dev, BTN_DPAD_LEFT, data[2] & BIT(2)); 895 + input_report_key(dev, BTN_DPAD_RIGHT, data[2] & BIT(3)); 896 + input_report_key(dev, BTN_DPAD_UP, data[2] & BIT(0)); 897 + input_report_key(dev, BTN_DPAD_DOWN, data[2] & BIT(1)); 898 898 } 899 899 900 900 /* ··· 1075 1075 data[18] = 0; 1076 1076 1077 1077 /* Elite Series 2 split packet paddle bits */ 1078 - input_report_key(dev, BTN_TRIGGER_HAPPY5, data[18] & BIT(0)); 1079 - input_report_key(dev, BTN_TRIGGER_HAPPY6, data[18] & BIT(1)); 1080 - input_report_key(dev, BTN_TRIGGER_HAPPY7, data[18] & BIT(2)); 1081 - input_report_key(dev, BTN_TRIGGER_HAPPY8, data[18] & BIT(3)); 1078 + input_report_key(dev, BTN_GRIPR, data[18] & BIT(0)); 1079 + input_report_key(dev, BTN_GRIPR2, data[18] & BIT(1)); 1080 + input_report_key(dev, BTN_GRIPL, data[18] & BIT(2)); 1081 + input_report_key(dev, BTN_GRIPL2, data[18] & BIT(3)); 1082 1082 1083 1083 do_sync = true; 1084 1084 } ··· 1113 1113 /* digital pad */ 1114 1114 if (xpad->mapping & MAP_DPAD_TO_BUTTONS) { 1115 1115 /* dpad as buttons (left, right, up, down) */ 1116 - input_report_key(dev, BTN_TRIGGER_HAPPY1, data[5] & BIT(2)); 1117 - input_report_key(dev, BTN_TRIGGER_HAPPY2, data[5] & BIT(3)); 1118 - input_report_key(dev, BTN_TRIGGER_HAPPY3, data[5] & BIT(0)); 1119 - input_report_key(dev, BTN_TRIGGER_HAPPY4, data[5] & BIT(1)); 1116 + input_report_key(dev, BTN_DPAD_LEFT, data[5] & BIT(2)); 1117 + input_report_key(dev, BTN_DPAD_RIGHT, data[5] & BIT(3)); 1118 + input_report_key(dev, BTN_DPAD_UP, data[5] & BIT(0)); 1119 + input_report_key(dev, BTN_DPAD_DOWN, data[5] & BIT(1)); 1120 1120 } else { 1121 1121 input_report_abs(dev, ABS_HAT0X, 1122 1122 !!(data[5] & 0x08) - !!(data[5] & 0x04)); ··· 1175 1175 data[32] = 0; 1176 1176 1177 1177 /* OG Elite Series Controller paddle bits */ 1178 - input_report_key(dev, BTN_TRIGGER_HAPPY5, data[32] & BIT(1)); 1179 - input_report_key(dev, BTN_TRIGGER_HAPPY6, data[32] & BIT(3)); 1180 - input_report_key(dev, BTN_TRIGGER_HAPPY7, data[32] & BIT(0)); 1181 - input_report_key(dev, BTN_TRIGGER_HAPPY8, data[32] & BIT(2)); 1178 + input_report_key(dev, BTN_GRIPR, data[32] & BIT(1)); 1179 + input_report_key(dev, BTN_GRIPR2, data[32] & BIT(3)); 1180 + input_report_key(dev, BTN_GRIPL, data[32] & BIT(0)); 1181 + input_report_key(dev, BTN_GRIPL2, data[32] & BIT(2)); 1182 1182 } else if (xpad->packet_type == PKT_XBE2_FW_OLD) { 1183 1183 /* Mute paddles if controller has a custom mapping applied. 1184 1184 * Checked by comparing the current mapping ··· 1188 1188 data[18] = 0; 1189 1189 1190 1190 /* Elite Series 2 4.x firmware paddle bits */ 1191 - input_report_key(dev, BTN_TRIGGER_HAPPY5, data[18] & BIT(0)); 1192 - input_report_key(dev, BTN_TRIGGER_HAPPY6, data[18] & BIT(1)); 1193 - input_report_key(dev, BTN_TRIGGER_HAPPY7, data[18] & BIT(2)); 1194 - input_report_key(dev, BTN_TRIGGER_HAPPY8, data[18] & BIT(3)); 1191 + input_report_key(dev, BTN_GRIPR, data[18] & BIT(0)); 1192 + input_report_key(dev, BTN_GRIPR2, data[18] & BIT(1)); 1193 + input_report_key(dev, BTN_GRIPL, data[18] & BIT(2)); 1194 + input_report_key(dev, BTN_GRIPL2, data[18] & BIT(3)); 1195 1195 } else if (xpad->packet_type == PKT_XBE2_FW_5_EARLY) { 1196 1196 /* Mute paddles if controller has a custom mapping applied. 1197 1197 * Checked by comparing the current mapping ··· 1203 1203 /* Elite Series 2 5.x firmware paddle bits 1204 1204 * (before the packet was split) 1205 1205 */ 1206 - input_report_key(dev, BTN_TRIGGER_HAPPY5, data[22] & BIT(0)); 1207 - input_report_key(dev, BTN_TRIGGER_HAPPY6, data[22] & BIT(1)); 1208 - input_report_key(dev, BTN_TRIGGER_HAPPY7, data[22] & BIT(2)); 1209 - input_report_key(dev, BTN_TRIGGER_HAPPY8, data[22] & BIT(3)); 1206 + input_report_key(dev, BTN_GRIPR, data[22] & BIT(0)); 1207 + input_report_key(dev, BTN_GRIPR2, data[22] & BIT(1)); 1208 + input_report_key(dev, BTN_GRIPL, data[22] & BIT(2)); 1209 + input_report_key(dev, BTN_GRIPL2, data[22] & BIT(3)); 1210 1210 } 1211 1211 } 1212 1212
+5 -4
drivers/input/keyboard/adp5588-keys.c
··· 232 232 return !!(val & bit); 233 233 } 234 234 235 - static void adp5588_gpio_set_value(struct gpio_chip *chip, 236 - unsigned int off, int val) 235 + static int adp5588_gpio_set_value(struct gpio_chip *chip, unsigned int off, 236 + int val) 237 237 { 238 238 struct adp5588_kpad *kpad = gpiochip_get_data(chip); 239 239 unsigned int bank = ADP5588_BANK(kpad->gpiomap[off]); ··· 246 246 else 247 247 kpad->dat_out[bank] &= ~bit; 248 248 249 - adp5588_write(kpad->client, GPIO_DAT_OUT1 + bank, kpad->dat_out[bank]); 249 + return adp5588_write(kpad->client, GPIO_DAT_OUT1 + bank, 250 + kpad->dat_out[bank]); 250 251 } 251 252 252 253 static int adp5588_gpio_set_config(struct gpio_chip *chip, unsigned int off, ··· 425 424 kpad->gc.direction_input = adp5588_gpio_direction_input; 426 425 kpad->gc.direction_output = adp5588_gpio_direction_output; 427 426 kpad->gc.get = adp5588_gpio_get_value; 428 - kpad->gc.set = adp5588_gpio_set_value; 427 + kpad->gc.set_rv = adp5588_gpio_set_value; 429 428 kpad->gc.set_config = adp5588_gpio_set_config; 430 429 kpad->gc.can_sleep = 1; 431 430
+6 -6
drivers/input/keyboard/atkbd.c
··· 84 84 #include "hpps2atkbd.h" /* include the keyboard scancodes */ 85 85 86 86 #else 87 - 0, 67, 65, 63, 61, 59, 60, 88, 0, 68, 66, 64, 62, 15, 41,117, 88 - 0, 56, 42, 93, 29, 16, 2, 0, 0, 0, 44, 31, 30, 17, 3, 0, 89 - 0, 46, 45, 32, 18, 5, 4, 95, 0, 57, 47, 33, 20, 19, 6,183, 90 - 0, 49, 48, 35, 34, 21, 7,184, 0, 0, 50, 36, 22, 8, 9,185, 91 - 0, 51, 37, 23, 24, 11, 10, 0, 0, 52, 53, 38, 39, 25, 12, 0, 92 - 0, 89, 40, 0, 26, 13, 0,193, 58, 54, 28, 27, 0, 43, 0, 85, 87 + 0, 67, 65, 63, 61, 59, 60, 88,183, 68, 66, 64, 62, 15, 41,117, 88 + 184, 56, 42, 93, 29, 16, 2, 0,185, 0, 44, 31, 30, 17, 3, 0, 89 + 186, 46, 45, 32, 18, 5, 4, 95,187, 57, 47, 33, 20, 19, 6,183, 90 + 188, 49, 48, 35, 34, 21, 7,184,189, 0, 50, 36, 22, 8, 9,185, 91 + 190, 51, 37, 23, 24, 11, 10, 0,191, 52, 53, 38, 39, 25, 12, 0, 92 + 192, 89, 40, 0, 26, 13, 0,193, 58, 54, 28, 27, 0, 43, 0,194, 93 93 0, 86, 91, 90, 92, 0, 14, 94, 0, 79,124, 75, 71,121, 0, 0, 94 94 82, 83, 80, 76, 77, 72, 1, 69, 87, 78, 81, 74, 55, 73, 70, 99, 95 95
+17
drivers/input/keyboard/mtk-pmic-keys.c
··· 12 12 #include <linux/mfd/mt6331/registers.h> 13 13 #include <linux/mfd/mt6357/registers.h> 14 14 #include <linux/mfd/mt6358/registers.h> 15 + #include <linux/mfd/mt6359/registers.h> 15 16 #include <linux/mfd/mt6397/core.h> 16 17 #include <linux/mfd/mt6397/registers.h> 17 18 #include <linux/module.h> ··· 115 114 0x8, MT6358_PSC_TOP_INT_CON0, 0xa, 116 115 MTK_PMIC_HOMEKEY_RST), 117 116 .pmic_rst_reg = MT6358_TOP_RST_MISC, 117 + .rst_lprst_mask = MTK_PMIC_RST_DU_MASK, 118 + }; 119 + 120 + static const struct mtk_pmic_regs mt6359_regs = { 121 + .keys_regs[MTK_PMIC_PWRKEY_INDEX] = 122 + MTK_PMIC_KEYS_REGS(MT6359_TOPSTATUS, 123 + 0x2, MT6359_PSC_TOP_INT_CON0, 0x5, 124 + MTK_PMIC_PWRKEY_RST), 125 + .keys_regs[MTK_PMIC_HOMEKEY_INDEX] = 126 + MTK_PMIC_KEYS_REGS(MT6359_TOPSTATUS, 127 + 0x8, MT6359_PSC_TOP_INT_CON0, 0xa, 128 + MTK_PMIC_HOMEKEY_RST), 129 + .pmic_rst_reg = MT6359_TOP_RST_MISC, 118 130 .rst_lprst_mask = MTK_PMIC_RST_DU_MASK, 119 131 }; 120 132 ··· 310 296 }, { 311 297 .compatible = "mediatek,mt6358-keys", 312 298 .data = &mt6358_regs, 299 + }, { 300 + .compatible = "mediatek,mt6359-keys", 301 + .data = &mt6359_regs, 313 302 }, { 314 303 /* sentinel */ 315 304 }
+64 -73
drivers/input/keyboard/samsung-keypad.c
··· 7 7 * Author: Donghwa Lee <dh09.lee@samsung.com> 8 8 */ 9 9 10 + #include <linux/bits.h> 10 11 #include <linux/clk.h> 11 12 #include <linux/delay.h> 12 13 #include <linux/err.h> ··· 30 29 #define SAMSUNG_KEYIFFC 0x10 31 30 32 31 /* SAMSUNG_KEYIFCON */ 33 - #define SAMSUNG_KEYIFCON_INT_F_EN (1 << 0) 34 - #define SAMSUNG_KEYIFCON_INT_R_EN (1 << 1) 35 - #define SAMSUNG_KEYIFCON_DF_EN (1 << 2) 36 - #define SAMSUNG_KEYIFCON_FC_EN (1 << 3) 37 - #define SAMSUNG_KEYIFCON_WAKEUPEN (1 << 4) 32 + #define SAMSUNG_KEYIFCON_INT_F_EN BIT(0) 33 + #define SAMSUNG_KEYIFCON_INT_R_EN BIT(1) 34 + #define SAMSUNG_KEYIFCON_DF_EN BIT(2) 35 + #define SAMSUNG_KEYIFCON_FC_EN BIT(3) 36 + #define SAMSUNG_KEYIFCON_WAKEUPEN BIT(4) 38 37 39 38 /* SAMSUNG_KEYIFSTSCLR */ 40 39 #define SAMSUNG_KEYIFSTSCLR_P_INT_MASK (0xff << 0) ··· 45 44 #define S5PV210_KEYIFSTSCLR_R_INT_OFFSET 16 46 45 47 46 /* SAMSUNG_KEYIFCOL */ 48 - #define SAMSUNG_KEYIFCOL_MASK (0xff << 0) 49 - #define S5PV210_KEYIFCOLEN_MASK (0xff << 8) 47 + #define SAMSUNG_KEYIFCOL_MASK 0xff 50 48 51 49 /* SAMSUNG_KEYIFROW */ 52 50 #define SAMSUNG_KEYIFROW_MASK (0xff << 0) ··· 54 54 /* SAMSUNG_KEYIFFC */ 55 55 #define SAMSUNG_KEYIFFC_MASK (0x3ff << 0) 56 56 57 - enum samsung_keypad_type { 58 - KEYPAD_TYPE_SAMSUNG, 59 - KEYPAD_TYPE_S5PV210, 57 + struct samsung_chip_info { 58 + unsigned int column_shift; 60 59 }; 61 60 62 61 struct samsung_keypad { 62 + const struct samsung_chip_info *chip; 63 63 struct input_dev *input_dev; 64 64 struct platform_device *pdev; 65 65 struct clk *clk; ··· 68 68 bool stopped; 69 69 bool wake_enabled; 70 70 int irq; 71 - enum samsung_keypad_type type; 72 71 unsigned int row_shift; 73 72 unsigned int rows; 74 73 unsigned int cols; ··· 82 83 unsigned int val; 83 84 84 85 for (col = 0; col < keypad->cols; col++) { 85 - if (keypad->type == KEYPAD_TYPE_S5PV210) { 86 - val = S5PV210_KEYIFCOLEN_MASK; 87 - val &= ~(1 << col) << 8; 88 - } else { 89 - val = SAMSUNG_KEYIFCOL_MASK; 90 - val &= ~(1 << col); 91 - } 86 + val = SAMSUNG_KEYIFCOL_MASK & ~BIT(col); 87 + val <<= keypad->chip->column_shift; 92 88 93 89 writel(val, keypad->base + SAMSUNG_KEYIFCOL); 94 90 mdelay(1); 95 91 96 92 val = readl(keypad->base + SAMSUNG_KEYIFROW); 97 - row_state[col] = ~val & ((1 << keypad->rows) - 1); 93 + row_state[col] = ~val & GENMASK(keypad->rows - 1, 0); 98 94 } 99 95 100 96 /* KEYIFCOL reg clear */ ··· 113 119 continue; 114 120 115 121 for (row = 0; row < keypad->rows; row++) { 116 - if (!(changed & (1 << row))) 122 + if (!(changed & BIT(row))) 117 123 continue; 118 124 119 - pressed = row_state[col] & (1 << row); 125 + pressed = row_state[col] & BIT(row); 120 126 121 127 dev_dbg(&keypad->input_dev->dev, 122 128 "key %s, row: %d, col: %d\n", ··· 308 314 { 309 315 const struct samsung_keypad_platdata *pdata; 310 316 const struct matrix_keymap_data *keymap_data; 317 + const struct platform_device_id *id; 311 318 struct samsung_keypad *keypad; 312 319 struct resource *res; 313 320 struct input_dev *input_dev; 314 321 unsigned int row_shift; 315 - unsigned int keymap_size; 316 322 int error; 317 323 318 324 pdata = dev_get_platdata(&pdev->dev); ··· 339 345 pdata->cfg_gpio(pdata->rows, pdata->cols); 340 346 341 347 row_shift = get_count_order(pdata->cols); 342 - keymap_size = (pdata->rows << row_shift) * sizeof(keypad->keycodes[0]); 343 348 344 - keypad = devm_kzalloc(&pdev->dev, sizeof(*keypad) + keymap_size, 349 + keypad = devm_kzalloc(&pdev->dev, 350 + struct_size(keypad, keycodes, 351 + pdata->rows << row_shift), 345 352 GFP_KERNEL); 353 + if (!keypad) 354 + return -ENOMEM; 355 + 346 356 input_dev = devm_input_allocate_device(&pdev->dev); 347 - if (!keypad || !input_dev) 357 + if (!input_dev) 348 358 return -ENOMEM; 349 359 350 360 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ··· 359 361 if (!keypad->base) 360 362 return -EBUSY; 361 363 362 - keypad->clk = devm_clk_get(&pdev->dev, "keypad"); 364 + keypad->clk = devm_clk_get_prepared(&pdev->dev, "keypad"); 363 365 if (IS_ERR(keypad->clk)) { 364 366 dev_err(&pdev->dev, "failed to get keypad clk\n"); 365 367 return PTR_ERR(keypad->clk); 366 - } 367 - 368 - error = clk_prepare(keypad->clk); 369 - if (error) { 370 - dev_err(&pdev->dev, "keypad clock prepare failed\n"); 371 - return error; 372 368 } 373 369 374 370 keypad->input_dev = input_dev; ··· 373 381 keypad->stopped = true; 374 382 init_waitqueue_head(&keypad->wait); 375 383 376 - if (pdev->dev.of_node) 377 - keypad->type = of_device_is_compatible(pdev->dev.of_node, 378 - "samsung,s5pv210-keypad"); 379 - else 380 - keypad->type = platform_get_device_id(pdev)->driver_data; 384 + keypad->chip = device_get_match_data(&pdev->dev); 385 + if (!keypad->chip) { 386 + id = platform_get_device_id(pdev); 387 + if (id) 388 + keypad->chip = (const void *)id->driver_data; 389 + } 390 + 391 + if (!keypad->chip) { 392 + dev_err(&pdev->dev, "Unable to determine chip type"); 393 + return -EINVAL; 394 + } 381 395 382 396 input_dev->name = pdev->name; 383 397 input_dev->id.bustype = BUS_HOST; 384 - input_dev->dev.parent = &pdev->dev; 385 398 386 399 input_dev->open = samsung_keypad_open; 387 400 input_dev->close = samsung_keypad_close; ··· 396 399 keypad->keycodes, input_dev); 397 400 if (error) { 398 401 dev_err(&pdev->dev, "failed to build keymap\n"); 399 - goto err_unprepare_clk; 402 + return error; 400 403 } 401 404 402 405 input_set_capability(input_dev, EV_MSC, MSC_SCAN); ··· 408 411 keypad->irq = platform_get_irq(pdev, 0); 409 412 if (keypad->irq < 0) { 410 413 error = keypad->irq; 411 - goto err_unprepare_clk; 414 + return error; 412 415 } 413 416 414 417 error = devm_request_threaded_irq(&pdev->dev, keypad->irq, NULL, ··· 416 419 dev_name(&pdev->dev), keypad); 417 420 if (error) { 418 421 dev_err(&pdev->dev, "failed to register keypad interrupt\n"); 419 - goto err_unprepare_clk; 422 + return error; 420 423 } 421 424 422 425 device_init_wakeup(&pdev->dev, pdata->wakeup); 423 426 platform_set_drvdata(pdev, keypad); 424 - pm_runtime_enable(&pdev->dev); 427 + 428 + error = devm_pm_runtime_enable(&pdev->dev); 429 + if (error) 430 + return error; 425 431 426 432 error = input_register_device(keypad->input_dev); 427 433 if (error) 428 - goto err_disable_runtime_pm; 434 + return error; 429 435 430 436 if (pdev->dev.of_node) { 431 437 devm_kfree(&pdev->dev, (void *)pdata->keymap_data->keymap); ··· 436 436 devm_kfree(&pdev->dev, (void *)pdata); 437 437 } 438 438 return 0; 439 - 440 - err_disable_runtime_pm: 441 - pm_runtime_disable(&pdev->dev); 442 - err_unprepare_clk: 443 - clk_unprepare(keypad->clk); 444 - return error; 445 - } 446 - 447 - static void samsung_keypad_remove(struct platform_device *pdev) 448 - { 449 - struct samsung_keypad *keypad = platform_get_drvdata(pdev); 450 - 451 - pm_runtime_disable(&pdev->dev); 452 - 453 - input_unregister_device(keypad->input_dev); 454 - 455 - clk_unprepare(keypad->clk); 456 439 } 457 440 458 441 static int samsung_keypad_runtime_suspend(struct device *dev) ··· 511 528 struct samsung_keypad *keypad = platform_get_drvdata(pdev); 512 529 struct input_dev *input_dev = keypad->input_dev; 513 530 514 - mutex_lock(&input_dev->mutex); 531 + guard(mutex)(&input_dev->mutex); 515 532 516 533 if (input_device_enabled(input_dev)) 517 534 samsung_keypad_stop(keypad); 518 535 519 536 samsung_keypad_toggle_wakeup(keypad, true); 520 - 521 - mutex_unlock(&input_dev->mutex); 522 537 523 538 return 0; 524 539 } ··· 527 546 struct samsung_keypad *keypad = platform_get_drvdata(pdev); 528 547 struct input_dev *input_dev = keypad->input_dev; 529 548 530 - mutex_lock(&input_dev->mutex); 549 + guard(mutex)(&input_dev->mutex); 531 550 532 551 samsung_keypad_toggle_wakeup(keypad, false); 533 552 534 553 if (input_device_enabled(input_dev)) 535 554 samsung_keypad_start(keypad); 536 - 537 - mutex_unlock(&input_dev->mutex); 538 555 539 556 return 0; 540 557 } ··· 543 564 samsung_keypad_runtime_resume, NULL) 544 565 }; 545 566 567 + static const struct samsung_chip_info samsung_s3c6410_chip_info = { 568 + .column_shift = 0, 569 + }; 570 + 571 + static const struct samsung_chip_info samsung_s5pv210_chip_info = { 572 + .column_shift = 8, 573 + }; 574 + 546 575 #ifdef CONFIG_OF 547 576 static const struct of_device_id samsung_keypad_dt_match[] = { 548 - { .compatible = "samsung,s3c6410-keypad" }, 549 - { .compatible = "samsung,s5pv210-keypad" }, 550 - {}, 577 + { 578 + .compatible = "samsung,s3c6410-keypad", 579 + .data = &samsung_s3c6410_chip_info, 580 + }, { 581 + .compatible = "samsung,s5pv210-keypad", 582 + .data = &samsung_s5pv210_chip_info, 583 + }, 584 + { } 551 585 }; 552 586 MODULE_DEVICE_TABLE(of, samsung_keypad_dt_match); 553 587 #endif ··· 568 576 static const struct platform_device_id samsung_keypad_driver_ids[] = { 569 577 { 570 578 .name = "samsung-keypad", 571 - .driver_data = KEYPAD_TYPE_SAMSUNG, 579 + .driver_data = (kernel_ulong_t)&samsung_s3c6410_chip_info, 572 580 }, { 573 581 .name = "s5pv210-keypad", 574 - .driver_data = KEYPAD_TYPE_S5PV210, 582 + .driver_data = (kernel_ulong_t)&samsung_s5pv210_chip_info, 575 583 }, 576 - { }, 584 + { } 577 585 }; 578 586 MODULE_DEVICE_TABLE(platform, samsung_keypad_driver_ids); 579 587 580 588 static struct platform_driver samsung_keypad_driver = { 581 589 .probe = samsung_keypad_probe, 582 - .remove = samsung_keypad_remove, 583 590 .driver = { 584 591 .name = "samsung-keypad", 585 592 .of_match_table = of_match_ptr(samsung_keypad_dt_match),
-7
drivers/input/misc/Kconfig
··· 584 584 To compile this driver as a module, choose M here. The module will 585 585 be called palmas_pwrbutton. 586 586 587 - config INPUT_PCF50633_PMU 588 - tristate "PCF50633 PMU events" 589 - depends on MFD_PCF50633 590 - help 591 - Say Y to include support for delivering PMU events via input 592 - layer on NXP PCF50633. 593 - 594 587 config INPUT_PCF8574 595 588 tristate "PCF8574 Keypad input device" 596 589 depends on I2C
-1
drivers/input/misc/Makefile
··· 59 59 obj-$(CONFIG_INPUT_MMA8450) += mma8450.o 60 60 obj-$(CONFIG_INPUT_PALMAS_PWRBUTTON) += palmas-pwrbutton.o 61 61 obj-$(CONFIG_INPUT_PCAP) += pcap_keys.o 62 - obj-$(CONFIG_INPUT_PCF50633_PMU) += pcf50633-input.o 63 62 obj-$(CONFIG_INPUT_PCF8574) += pcf8574_keypad.o 64 63 obj-$(CONFIG_INPUT_PCSPKR) += pcspkr.o 65 64 obj-$(CONFIG_INPUT_PM8941_PWRKEY) += pm8941-pwrkey.o
-1
drivers/input/misc/cs40l50-vibra.c
··· 482 482 483 483 static void cs40l50_remove_wq(void *data) 484 484 { 485 - flush_workqueue(data); 486 485 destroy_workqueue(data); 487 486 } 488 487
+18 -23
drivers/input/misc/max77693-haptic.c
··· 68 68 69 69 static int max77693_haptic_set_duty_cycle(struct max77693_haptic *haptic) 70 70 { 71 - struct pwm_args pargs; 72 - int delta; 71 + struct pwm_state state; 73 72 int error; 74 73 75 - pwm_get_args(haptic->pwm_dev, &pargs); 76 - delta = (pargs.period + haptic->pwm_duty) / 2; 77 - error = pwm_config(haptic->pwm_dev, delta, pargs.period); 74 + pwm_init_state(haptic->pwm_dev, &state); 75 + state.duty_cycle = (state.period + haptic->pwm_duty) / 2; 76 + 77 + error = pwm_apply_might_sleep(haptic->pwm_dev, &state); 78 78 if (error) { 79 - dev_err(haptic->dev, "failed to configure pwm: %d\n", error); 79 + dev_err(haptic->dev, 80 + "failed to set pwm duty cycle: %d\n", error); 80 81 return error; 81 82 } 82 83 ··· 167 166 168 167 static void max77693_haptic_enable(struct max77693_haptic *haptic) 169 168 { 169 + struct pwm_state state; 170 170 int error; 171 171 172 172 if (haptic->enabled) 173 173 return; 174 174 175 - error = pwm_enable(haptic->pwm_dev); 175 + pwm_init_state(haptic->pwm_dev, &state); 176 + state.duty_cycle = (state.period + haptic->pwm_duty) / 2; 177 + state.enabled = true; 178 + 179 + error = pwm_apply_might_sleep(haptic->pwm_dev, &state); 176 180 if (error) { 177 181 dev_err(haptic->dev, 178 182 "failed to enable haptic pwm device: %d\n", error); ··· 230 224 { 231 225 struct max77693_haptic *haptic = 232 226 container_of(work, struct max77693_haptic, work); 233 - int error; 234 227 235 - error = max77693_haptic_set_duty_cycle(haptic); 236 - if (error) { 237 - dev_err(haptic->dev, "failed to set duty cycle: %d\n", error); 238 - return; 239 - } 240 - 241 - if (haptic->magnitude) 242 - max77693_haptic_enable(haptic); 243 - else 228 + if (!haptic->magnitude) 244 229 max77693_haptic_disable(haptic); 230 + else if (haptic->enabled) 231 + max77693_haptic_set_duty_cycle(haptic); 232 + else 233 + max77693_haptic_enable(haptic); 245 234 } 246 235 247 236 static int max77693_haptic_play_effect(struct input_dev *dev, void *data, ··· 340 339 dev_err(&pdev->dev, "failed to get pwm device\n"); 341 340 return PTR_ERR(haptic->pwm_dev); 342 341 } 343 - 344 - /* 345 - * FIXME: pwm_apply_args() should be removed when switching to the 346 - * atomic PWM API. 347 - */ 348 - pwm_apply_args(haptic->pwm_dev); 349 342 350 343 haptic->motor_reg = devm_regulator_get(&pdev->dev, "haptic"); 351 344 if (IS_ERR(haptic->motor_reg)) {
+48 -50
drivers/input/misc/max8997_haptic.c
··· 53 53 unsigned int pattern_signal_period; 54 54 }; 55 55 56 - static int max8997_haptic_set_duty_cycle(struct max8997_haptic *chip) 56 + static void max8997_haptic_set_internal_duty_cycle(struct max8997_haptic *chip) 57 57 { 58 - int ret = 0; 58 + u8 duty_index = DIV_ROUND_UP(chip->level * 64, 100); 59 59 60 - if (chip->mode == MAX8997_EXTERNAL_MODE) { 61 - unsigned int duty = chip->pwm_period * chip->level / 100; 62 - ret = pwm_config(chip->pwm, duty, chip->pwm_period); 63 - } else { 64 - u8 duty_index = 0; 65 - 66 - duty_index = DIV_ROUND_UP(chip->level * 64, 100); 67 - 68 - switch (chip->internal_mode_pattern) { 69 - case 0: 70 - max8997_write_reg(chip->client, 71 - MAX8997_HAPTIC_REG_SIGPWMDC1, duty_index); 72 - break; 73 - case 1: 74 - max8997_write_reg(chip->client, 75 - MAX8997_HAPTIC_REG_SIGPWMDC2, duty_index); 76 - break; 77 - case 2: 78 - max8997_write_reg(chip->client, 79 - MAX8997_HAPTIC_REG_SIGPWMDC3, duty_index); 80 - break; 81 - case 3: 82 - max8997_write_reg(chip->client, 83 - MAX8997_HAPTIC_REG_SIGPWMDC4, duty_index); 84 - break; 85 - default: 86 - break; 87 - } 60 + switch (chip->internal_mode_pattern) { 61 + case 0: 62 + max8997_write_reg(chip->client, 63 + MAX8997_HAPTIC_REG_SIGPWMDC1, duty_index); 64 + break; 65 + case 1: 66 + max8997_write_reg(chip->client, 67 + MAX8997_HAPTIC_REG_SIGPWMDC2, duty_index); 68 + break; 69 + case 2: 70 + max8997_write_reg(chip->client, 71 + MAX8997_HAPTIC_REG_SIGPWMDC3, duty_index); 72 + break; 73 + case 3: 74 + max8997_write_reg(chip->client, 75 + MAX8997_HAPTIC_REG_SIGPWMDC4, duty_index); 76 + break; 77 + default: 78 + break; 88 79 } 89 - return ret; 90 80 } 91 81 92 82 static void max8997_haptic_configure(struct max8997_haptic *chip) ··· 145 155 146 156 guard(mutex)(&chip->mutex); 147 157 148 - error = max8997_haptic_set_duty_cycle(chip); 149 - if (error) { 150 - dev_err(chip->dev, "set_pwm_cycle failed, error: %d\n", error); 151 - return; 152 - } 158 + if (chip->mode != MAX8997_EXTERNAL_MODE) 159 + max8997_haptic_set_internal_duty_cycle(chip); 153 160 154 161 if (!chip->enabled) { 155 162 error = regulator_enable(chip->regulator); ··· 155 168 return; 156 169 } 157 170 max8997_haptic_configure(chip); 158 - if (chip->mode == MAX8997_EXTERNAL_MODE) { 159 - error = pwm_enable(chip->pwm); 160 - if (error) { 161 - dev_err(chip->dev, "Failed to enable PWM\n"); 162 - regulator_disable(chip->regulator); 163 - return; 164 - } 165 - } 166 - chip->enabled = true; 167 171 } 172 + 173 + /* 174 + * It would be more straight forward to configure the external PWM 175 + * earlier i.e. when the internal duty_cycle is setup in internal mode. 176 + * But historically this is done only after the regulator was enabled 177 + * and max8997_haptic_configure() set the enable bit in 178 + * MAX8997_HAPTIC_REG_CONF2. So better keep it this way. 179 + */ 180 + if (chip->mode == MAX8997_EXTERNAL_MODE) { 181 + struct pwm_state state; 182 + 183 + pwm_init_state(chip->pwm, &state); 184 + state.period = chip->pwm_period; 185 + state.duty_cycle = chip->pwm_period * chip->level / 100; 186 + state.enabled = true; 187 + 188 + error = pwm_apply_might_sleep(chip->pwm, &state); 189 + if (error) { 190 + dev_err(chip->dev, "Failed to enable PWM\n"); 191 + regulator_disable(chip->regulator); 192 + return; 193 + } 194 + } 195 + 196 + chip->enabled = true; 168 197 } 169 198 170 199 static void max8997_haptic_disable(struct max8997_haptic *chip) ··· 285 282 goto err_free_mem; 286 283 } 287 284 288 - /* 289 - * FIXME: pwm_apply_args() should be removed when switching to 290 - * the atomic PWM API. 291 - */ 292 - pwm_apply_args(chip->pwm); 293 285 break; 294 286 295 287 default:
-113
drivers/input/misc/pcf50633-input.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-or-later 2 - /* NXP PCF50633 Input Driver 3 - * 4 - * (C) 2006-2008 by Openmoko, Inc. 5 - * Author: Balaji Rao <balajirrao@openmoko.org> 6 - * All rights reserved. 7 - * 8 - * Broken down from monstrous PCF50633 driver mainly by 9 - * Harald Welte, Andy Green and Werner Almesberger 10 - */ 11 - 12 - #include <linux/kernel.h> 13 - #include <linux/module.h> 14 - #include <linux/device.h> 15 - #include <linux/platform_device.h> 16 - #include <linux/input.h> 17 - #include <linux/slab.h> 18 - 19 - #include <linux/mfd/pcf50633/core.h> 20 - 21 - #define PCF50633_OOCSTAT_ONKEY 0x01 22 - #define PCF50633_REG_OOCSTAT 0x12 23 - #define PCF50633_REG_OOCMODE 0x10 24 - 25 - struct pcf50633_input { 26 - struct pcf50633 *pcf; 27 - struct input_dev *input_dev; 28 - }; 29 - 30 - static void 31 - pcf50633_input_irq(int irq, void *data) 32 - { 33 - struct pcf50633_input *input; 34 - int onkey_released; 35 - 36 - input = data; 37 - 38 - /* We report only one event depending on the key press status */ 39 - onkey_released = pcf50633_reg_read(input->pcf, PCF50633_REG_OOCSTAT) 40 - & PCF50633_OOCSTAT_ONKEY; 41 - 42 - if (irq == PCF50633_IRQ_ONKEYF && !onkey_released) 43 - input_report_key(input->input_dev, KEY_POWER, 1); 44 - else if (irq == PCF50633_IRQ_ONKEYR && onkey_released) 45 - input_report_key(input->input_dev, KEY_POWER, 0); 46 - 47 - input_sync(input->input_dev); 48 - } 49 - 50 - static int pcf50633_input_probe(struct platform_device *pdev) 51 - { 52 - struct pcf50633_input *input; 53 - struct input_dev *input_dev; 54 - int ret; 55 - 56 - 57 - input = kzalloc(sizeof(*input), GFP_KERNEL); 58 - if (!input) 59 - return -ENOMEM; 60 - 61 - input_dev = input_allocate_device(); 62 - if (!input_dev) { 63 - kfree(input); 64 - return -ENOMEM; 65 - } 66 - 67 - platform_set_drvdata(pdev, input); 68 - input->pcf = dev_to_pcf50633(pdev->dev.parent); 69 - input->input_dev = input_dev; 70 - 71 - input_dev->name = "PCF50633 PMU events"; 72 - input_dev->id.bustype = BUS_I2C; 73 - input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_PWR); 74 - set_bit(KEY_POWER, input_dev->keybit); 75 - 76 - ret = input_register_device(input_dev); 77 - if (ret) { 78 - input_free_device(input_dev); 79 - kfree(input); 80 - return ret; 81 - } 82 - pcf50633_register_irq(input->pcf, PCF50633_IRQ_ONKEYR, 83 - pcf50633_input_irq, input); 84 - pcf50633_register_irq(input->pcf, PCF50633_IRQ_ONKEYF, 85 - pcf50633_input_irq, input); 86 - 87 - return 0; 88 - } 89 - 90 - static void pcf50633_input_remove(struct platform_device *pdev) 91 - { 92 - struct pcf50633_input *input = platform_get_drvdata(pdev); 93 - 94 - pcf50633_free_irq(input->pcf, PCF50633_IRQ_ONKEYR); 95 - pcf50633_free_irq(input->pcf, PCF50633_IRQ_ONKEYF); 96 - 97 - input_unregister_device(input->input_dev); 98 - kfree(input); 99 - } 100 - 101 - static struct platform_driver pcf50633_input_driver = { 102 - .driver = { 103 - .name = "pcf50633-input", 104 - }, 105 - .probe = pcf50633_input_probe, 106 - .remove = pcf50633_input_remove, 107 - }; 108 - module_platform_driver(pcf50633_input_driver); 109 - 110 - MODULE_AUTHOR("Balaji Rao <balajirrao@openmoko.org>"); 111 - MODULE_DESCRIPTION("PCF50633 input driver"); 112 - MODULE_LICENSE("GPL"); 113 - MODULE_ALIAS("platform:pcf50633-input");
+15
drivers/input/rmi4/Kconfig
··· 82 82 touchpads. For sensors that support relative pointing, F12 also 83 83 provides mouse input. 84 84 85 + config RMI4_F1A 86 + bool "RMI4 Function 1A (0D pointing)" 87 + help 88 + Say Y here if you want to add support for RMI4 function 1A. 89 + 90 + Function 1A provides capacitive keys support for RMI4 devices. 91 + 92 + config RMI4_F21 93 + bool "RMI4 Function 21 (PRESSURE)" 94 + help 95 + Say Y here if you want to add support for RMI4 function 21. 96 + 97 + Function 21 provides buttons/pressure handling for RMI4 devices. 98 + This includes support for buttons/pressure on PressurePad. 99 + 85 100 config RMI4_F30 86 101 bool "RMI4 Function 30 (GPIO LED)" 87 102 help
+2
drivers/input/rmi4/Makefile
··· 8 8 rmi_core-$(CONFIG_RMI4_F03) += rmi_f03.o 9 9 rmi_core-$(CONFIG_RMI4_F11) += rmi_f11.o 10 10 rmi_core-$(CONFIG_RMI4_F12) += rmi_f12.o 11 + rmi_core-$(CONFIG_RMI4_F1A) += rmi_f1a.o 12 + rmi_core-$(CONFIG_RMI4_F21) += rmi_f21.o 11 13 rmi_core-$(CONFIG_RMI4_F30) += rmi_f30.o 12 14 rmi_core-$(CONFIG_RMI4_F34) += rmi_f34.o rmi_f34v7.o 13 15 rmi_core-$(CONFIG_RMI4_F3A) += rmi_f3a.o
+6
drivers/input/rmi4/rmi_bus.c
··· 360 360 #ifdef CONFIG_RMI4_F12 361 361 &rmi_f12_handler, 362 362 #endif 363 + #ifdef CONFIG_RMI4_F1A 364 + &rmi_f1a_handler, 365 + #endif 366 + #ifdef CONFIG_RMI4_F21 367 + &rmi_f21_handler, 368 + #endif 363 369 #ifdef CONFIG_RMI4_F30 364 370 &rmi_f30_handler, 365 371 #endif
+2
drivers/input/rmi4/rmi_driver.h
··· 133 133 extern struct rmi_function_handler rmi_f03_handler; 134 134 extern struct rmi_function_handler rmi_f11_handler; 135 135 extern struct rmi_function_handler rmi_f12_handler; 136 + extern struct rmi_function_handler rmi_f1a_handler; 137 + extern struct rmi_function_handler rmi_f21_handler; 136 138 extern struct rmi_function_handler rmi_f30_handler; 137 139 extern struct rmi_function_handler rmi_f34_handler; 138 140 extern struct rmi_function_handler rmi_f3a_handler;
+143
drivers/input/rmi4/rmi_f1a.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-only 2 + /* 3 + * Copyright (c) 2025 André Apitzsch <git@apitzsch.eu> 4 + */ 5 + 6 + #include <linux/input.h> 7 + #include <linux/property.h> 8 + #include "rmi_driver.h" 9 + 10 + struct f1a_data { 11 + struct input_dev *input; 12 + 13 + u32 *keymap; 14 + unsigned int num_keys; 15 + }; 16 + 17 + static int rmi_f1a_parse_device_properties(struct rmi_function *fn, struct f1a_data *f1a) 18 + { 19 + static const char buttons_property[] = "linux,keycodes"; 20 + struct device *dev = &fn->dev; 21 + u32 *buttonmap; 22 + int n_keys; 23 + int error; 24 + 25 + if (!device_property_present(dev, buttons_property)) 26 + return 0; 27 + 28 + n_keys = device_property_count_u32(dev, buttons_property); 29 + if (n_keys <= 0) { 30 + error = n_keys < 0 ? n_keys : -EINVAL; 31 + dev_err(dev, "Invalid/malformed '%s' property: %d\n", 32 + buttons_property, error); 33 + return error; 34 + } 35 + 36 + buttonmap = devm_kmalloc_array(dev, n_keys, sizeof(*buttonmap), 37 + GFP_KERNEL); 38 + if (!buttonmap) 39 + return -ENOMEM; 40 + 41 + error = device_property_read_u32_array(dev, buttons_property, 42 + buttonmap, n_keys); 43 + if (error) { 44 + dev_err(dev, "Failed to parse '%s' property: %d\n", 45 + buttons_property, error); 46 + return error; 47 + } 48 + 49 + f1a->keymap = buttonmap; 50 + f1a->num_keys = n_keys; 51 + 52 + return 0; 53 + } 54 + 55 + static irqreturn_t rmi_f1a_attention(int irq, void *ctx) 56 + { 57 + struct rmi_function *fn = ctx; 58 + struct f1a_data *f1a = dev_get_drvdata(&fn->dev); 59 + char button_bitmask; 60 + int key; 61 + int error; 62 + 63 + error = rmi_read_block(fn->rmi_dev, fn->fd.data_base_addr, 64 + &button_bitmask, sizeof(button_bitmask)); 65 + if (error) { 66 + dev_err(&fn->dev, "Failed to read object data. Code: %d.\n", 67 + error); 68 + return IRQ_RETVAL(error); 69 + } 70 + 71 + for (key = 0; key < f1a->num_keys; key++) 72 + input_report_key(f1a->input, f1a->keymap[key], 73 + button_bitmask & BIT(key)); 74 + 75 + return IRQ_HANDLED; 76 + } 77 + 78 + static int rmi_f1a_config(struct rmi_function *fn) 79 + { 80 + struct f1a_data *f1a = dev_get_drvdata(&fn->dev); 81 + struct rmi_driver *drv = fn->rmi_dev->driver; 82 + 83 + if (f1a->num_keys) 84 + drv->set_irq_bits(fn->rmi_dev, fn->irq_mask); 85 + 86 + return 0; 87 + } 88 + 89 + static int rmi_f1a_initialize(struct rmi_function *fn, struct f1a_data *f1a) 90 + { 91 + int error; 92 + int i; 93 + 94 + error = rmi_f1a_parse_device_properties(fn, f1a); 95 + if (error) 96 + return error; 97 + 98 + for (i = 0; i < f1a->num_keys; i++) 99 + input_set_capability(f1a->input, EV_KEY, f1a->keymap[i]); 100 + 101 + f1a->input->keycode = f1a->keymap; 102 + f1a->input->keycodemax = f1a->num_keys; 103 + f1a->input->keycodesize = sizeof(f1a->keymap[0]); 104 + 105 + return 0; 106 + } 107 + 108 + static int rmi_f1a_probe(struct rmi_function *fn) 109 + { 110 + struct rmi_device *rmi_dev = fn->rmi_dev; 111 + struct rmi_driver_data *drv_data = dev_get_drvdata(&rmi_dev->dev); 112 + struct f1a_data *f1a; 113 + int error; 114 + 115 + if (!drv_data->input) { 116 + dev_info(&fn->dev, "F1A: no input device found, ignoring\n"); 117 + return -ENXIO; 118 + } 119 + 120 + f1a = devm_kzalloc(&fn->dev, sizeof(*f1a), GFP_KERNEL); 121 + if (!f1a) 122 + return -ENOMEM; 123 + 124 + f1a->input = drv_data->input; 125 + 126 + error = rmi_f1a_initialize(fn, f1a); 127 + if (error) 128 + return error; 129 + 130 + dev_set_drvdata(&fn->dev, f1a); 131 + 132 + return 0; 133 + } 134 + 135 + struct rmi_function_handler rmi_f1a_handler = { 136 + .driver = { 137 + .name = "rmi4_f1a", 138 + }, 139 + .func = 0x1a, 140 + .probe = rmi_f1a_probe, 141 + .config = rmi_f1a_config, 142 + .attention = rmi_f1a_attention, 143 + };
+179
drivers/input/rmi4/rmi_f21.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-only 2 + /* 3 + * Copyright (c) 2012-2025 Synaptics Incorporated 4 + */ 5 + 6 + #include <linux/bits.h> 7 + #include <linux/dev_printk.h> 8 + #include <linux/kernel.h> 9 + #include <linux/rmi.h> 10 + #include <linux/input.h> 11 + #include <linux/slab.h> 12 + #include "rmi_driver.h" 13 + 14 + #define RMI_F21_SENSOR_COUNT_MASK GENMASK(3, 0) 15 + #define RMI_F21_FINGER_COUNT_PRESENT BIT(5) 16 + #define RMI_F21_NEW_REPORT_FORMAT BIT(6) 17 + 18 + #define RMI_F21_FINGER_COUNT_MASK GENMASK(3, 0) 19 + 20 + #define RMI_F21_MAX_SENSORS 16 21 + #define RMI_F21_MAX_FINGERS 16 22 + #define RMI_F21_DATA_REGS_MAX_SIZE (RMI_F21_MAX_SENSORS * 2 + \ 23 + RMI_F21_MAX_FINGERS * 2 + 1) 24 + 25 + #define RMI_F21_FORCE_CLICK_BIT BIT(0) 26 + 27 + #define RMI_F21_FORCEPAD_BUTTON_COUNT 1 28 + 29 + struct f21_data { 30 + struct input_dev *input; 31 + u16 key_code; 32 + 33 + unsigned int attn_data_size; 34 + unsigned int attn_data_button_offset; 35 + 36 + unsigned int data_reg_size; 37 + unsigned int data_reg_button_offset; 38 + u8 data_regs[RMI_F21_DATA_REGS_MAX_SIZE]; 39 + }; 40 + 41 + static irqreturn_t rmi_f21_attention(int irq, void *ctx) 42 + { 43 + struct rmi_function *fn = ctx; 44 + struct f21_data *f21 = dev_get_drvdata(&fn->dev); 45 + struct rmi_driver_data *drvdata = dev_get_drvdata(&fn->rmi_dev->dev); 46 + u8 *pdata; 47 + int error; 48 + bool pressed; 49 + 50 + if (drvdata->attn_data.data) { 51 + if (drvdata->attn_data.size < f21->attn_data_size) { 52 + dev_warn(&fn->dev, "f21 interrupt, but data is missing\n"); 53 + return IRQ_HANDLED; 54 + } 55 + 56 + pdata = drvdata->attn_data.data + f21->attn_data_button_offset; 57 + 58 + drvdata->attn_data.data += f21->attn_data_size; 59 + drvdata->attn_data.size -= f21->attn_data_size; 60 + } else { 61 + error = rmi_read_block(fn->rmi_dev, fn->fd.data_base_addr, 62 + f21->data_regs, f21->data_reg_size); 63 + if (error) { 64 + dev_err(&fn->dev, "failed to read f21 data registers: %d\n", 65 + error); 66 + return IRQ_RETVAL(error); 67 + } 68 + 69 + pdata = f21->data_regs + f21->data_reg_button_offset; 70 + } 71 + 72 + pressed = *pdata & RMI_F21_FORCE_CLICK_BIT; 73 + input_report_key(f21->input, f21->key_code, pressed); 74 + 75 + return IRQ_HANDLED; 76 + } 77 + 78 + static int rmi_f21_config(struct rmi_function *fn) 79 + { 80 + struct rmi_driver *drv = fn->rmi_dev->driver; 81 + 82 + drv->set_irq_bits(fn->rmi_dev, fn->irq_mask); 83 + 84 + return 0; 85 + } 86 + 87 + static int rmi_f21_initialize(struct rmi_function *fn, struct f21_data *f21) 88 + { 89 + struct input_dev *input = f21->input; 90 + 91 + f21->key_code = BTN_LEFT; 92 + 93 + input->keycode = &f21->key_code; 94 + input->keycodesize = sizeof(f21->key_code); 95 + input->keycodemax = RMI_F21_FORCEPAD_BUTTON_COUNT; 96 + 97 + input_set_capability(input, EV_KEY, f21->key_code); 98 + __set_bit(INPUT_PROP_BUTTONPAD, input->propbit); 99 + 100 + return 0; 101 + } 102 + 103 + static int rmi_f21_probe(struct rmi_function *fn) 104 + { 105 + struct rmi_device *rmi_dev = fn->rmi_dev; 106 + struct rmi_driver_data *drv_data = dev_get_drvdata(&rmi_dev->dev); 107 + struct f21_data *f21; 108 + unsigned int sensor_count; 109 + unsigned int max_fingers; 110 + unsigned int query15_offset; 111 + u8 query15_data; 112 + int error; 113 + 114 + if (!drv_data->input) { 115 + dev_info(&fn->dev, "f21: no input device found, ignoring\n"); 116 + return -ENXIO; 117 + } 118 + 119 + f21 = devm_kzalloc(&fn->dev, sizeof(*f21), GFP_KERNEL); 120 + if (!f21) 121 + return -ENOMEM; 122 + 123 + f21->input = drv_data->input; 124 + 125 + error = rmi_f21_initialize(fn, f21); 126 + if (error) 127 + return error; 128 + 129 + dev_set_drvdata(&fn->dev, f21); 130 + 131 + sensor_count = fn->fd.query_base_addr & RMI_F21_SENSOR_COUNT_MASK; 132 + if (fn->fd.query_base_addr & RMI_F21_FINGER_COUNT_PRESENT) { 133 + query15_offset = fn->fd.query_base_addr & RMI_F21_NEW_REPORT_FORMAT ? 2 : 1; 134 + error = rmi_read_block(fn->rmi_dev, 135 + fn->fd.query_base_addr + query15_offset, 136 + &query15_data, sizeof(query15_data)); 137 + if (error) 138 + return dev_err_probe(&fn->dev, error, 139 + "failed to read 'query15' data"); 140 + 141 + max_fingers = query15_data & RMI_F21_FINGER_COUNT_MASK; 142 + } else { 143 + max_fingers = 5; 144 + } 145 + 146 + if (fn->fd.query_base_addr & RMI_F21_NEW_REPORT_FORMAT) { 147 + /* Each finger uses one byte, and the button state uses one byte.*/ 148 + f21->attn_data_size = max_fingers + 1; 149 + f21->attn_data_button_offset = f21->attn_data_size - 1; 150 + /* 151 + * Each sensor uses two bytes, the button state uses one byte, 152 + * and each finger uses two bytes. 153 + */ 154 + f21->data_reg_size = sensor_count * 2 + 1 + max_fingers * 2; 155 + f21->data_reg_button_offset = sensor_count * 2; 156 + } else { 157 + /* 158 + * Regardless of the transport each finger uses two bytes, 159 + * and the button state uses one byte. 160 + */ 161 + f21->attn_data_size = sensor_count * 2 + 1; 162 + f21->attn_data_button_offset = sensor_count * 2; 163 + 164 + f21->data_reg_size = f21->attn_data_size; 165 + f21->data_reg_button_offset = f21->attn_data_button_offset; 166 + } 167 + 168 + return 0; 169 + } 170 + 171 + struct rmi_function_handler rmi_f21_handler = { 172 + .driver = { 173 + .name = "rmi4_f21", 174 + }, 175 + .func = 0x21, 176 + .probe = rmi_f21_probe, 177 + .config = rmi_f21_config, 178 + .attention = rmi_f21_attention, 179 + };
+277
drivers/input/touch-overlay.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-only 2 + /* 3 + * Helper functions for overlay objects on touchscreens 4 + * 5 + * Copyright (c) 2023 Javier Carrasco <javier.carrasco@wolfvision.net> 6 + */ 7 + 8 + #include <linux/input.h> 9 + #include <linux/input/mt.h> 10 + #include <linux/input/touch-overlay.h> 11 + #include <linux/list.h> 12 + #include <linux/module.h> 13 + #include <linux/property.h> 14 + 15 + struct touch_overlay_segment { 16 + struct list_head list; 17 + u32 x_origin; 18 + u32 y_origin; 19 + u32 x_size; 20 + u32 y_size; 21 + u32 key; 22 + bool pressed; 23 + int slot; 24 + }; 25 + 26 + static int touch_overlay_get_segment(struct fwnode_handle *segment_node, 27 + struct touch_overlay_segment *segment, 28 + struct input_dev *input) 29 + { 30 + int error; 31 + 32 + error = fwnode_property_read_u32(segment_node, "x-origin", 33 + &segment->x_origin); 34 + if (error) 35 + return error; 36 + 37 + error = fwnode_property_read_u32(segment_node, "y-origin", 38 + &segment->y_origin); 39 + if (error) 40 + return error; 41 + 42 + error = fwnode_property_read_u32(segment_node, "x-size", 43 + &segment->x_size); 44 + if (error) 45 + return error; 46 + 47 + error = fwnode_property_read_u32(segment_node, "y-size", 48 + &segment->y_size); 49 + if (error) 50 + return error; 51 + 52 + error = fwnode_property_read_u32(segment_node, "linux,code", 53 + &segment->key); 54 + if (!error) 55 + input_set_capability(input, EV_KEY, segment->key); 56 + else if (error != -EINVAL) 57 + return error; 58 + 59 + return 0; 60 + } 61 + 62 + /** 63 + * touch_overlay_map - map overlay objects from the device tree and set 64 + * key capabilities if buttons are defined. 65 + * @list: pointer to the list that will hold the segments 66 + * @input: pointer to the already allocated input_dev 67 + * 68 + * Returns 0 on success and error number otherwise. 69 + * 70 + * If buttons are defined, key capabilities are set accordingly. 71 + */ 72 + int touch_overlay_map(struct list_head *list, struct input_dev *input) 73 + { 74 + struct fwnode_handle *fw_segment; 75 + struct device *dev = input->dev.parent; 76 + struct touch_overlay_segment *segment; 77 + int error; 78 + 79 + struct fwnode_handle *overlay __free(fwnode_handle) = 80 + device_get_named_child_node(dev, "touch-overlay"); 81 + if (!overlay) 82 + return 0; 83 + 84 + fwnode_for_each_available_child_node(overlay, fw_segment) { 85 + segment = devm_kzalloc(dev, sizeof(*segment), GFP_KERNEL); 86 + if (!segment) { 87 + fwnode_handle_put(fw_segment); 88 + return -ENOMEM; 89 + } 90 + error = touch_overlay_get_segment(fw_segment, segment, input); 91 + if (error) { 92 + fwnode_handle_put(fw_segment); 93 + return error; 94 + } 95 + list_add_tail(&segment->list, list); 96 + } 97 + 98 + return 0; 99 + } 100 + EXPORT_SYMBOL(touch_overlay_map); 101 + 102 + /** 103 + * touch_overlay_get_touchscreen_abs - get abs size from the touchscreen area. 104 + * @list: pointer to the list that holds the segments 105 + * @x: horizontal abs 106 + * @y: vertical abs 107 + */ 108 + void touch_overlay_get_touchscreen_abs(struct list_head *list, u16 *x, u16 *y) 109 + { 110 + struct touch_overlay_segment *segment; 111 + struct list_head *ptr; 112 + 113 + list_for_each(ptr, list) { 114 + segment = list_entry(ptr, struct touch_overlay_segment, list); 115 + if (!segment->key) { 116 + *x = segment->x_size - 1; 117 + *y = segment->y_size - 1; 118 + break; 119 + } 120 + } 121 + } 122 + EXPORT_SYMBOL(touch_overlay_get_touchscreen_abs); 123 + 124 + static bool touch_overlay_segment_event(struct touch_overlay_segment *seg, 125 + struct input_mt_pos *pos) 126 + { 127 + if (pos->x >= seg->x_origin && pos->x < (seg->x_origin + seg->x_size) && 128 + pos->y >= seg->y_origin && pos->y < (seg->y_origin + seg->y_size)) 129 + return true; 130 + 131 + return false; 132 + } 133 + 134 + /** 135 + * touch_overlay_mapped_touchscreen - check if a touchscreen area is mapped 136 + * @list: pointer to the list that holds the segments 137 + * 138 + * Returns true if a touchscreen area is mapped or false otherwise. 139 + */ 140 + bool touch_overlay_mapped_touchscreen(struct list_head *list) 141 + { 142 + struct touch_overlay_segment *segment; 143 + struct list_head *ptr; 144 + 145 + list_for_each(ptr, list) { 146 + segment = list_entry(ptr, struct touch_overlay_segment, list); 147 + if (!segment->key) 148 + return true; 149 + } 150 + 151 + return false; 152 + } 153 + EXPORT_SYMBOL(touch_overlay_mapped_touchscreen); 154 + 155 + static bool touch_overlay_event_on_ts(struct list_head *list, 156 + struct input_mt_pos *pos) 157 + { 158 + struct touch_overlay_segment *segment; 159 + struct list_head *ptr; 160 + 161 + list_for_each(ptr, list) { 162 + segment = list_entry(ptr, struct touch_overlay_segment, list); 163 + if (segment->key) 164 + continue; 165 + 166 + if (touch_overlay_segment_event(segment, pos)) { 167 + pos->x -= segment->x_origin; 168 + pos->y -= segment->y_origin; 169 + return true; 170 + } 171 + /* ignore touch events outside the defined area */ 172 + return false; 173 + } 174 + 175 + return true; 176 + } 177 + 178 + static bool touch_overlay_button_event(struct input_dev *input, 179 + struct touch_overlay_segment *segment, 180 + struct input_mt_pos *pos, int slot) 181 + { 182 + struct input_mt *mt = input->mt; 183 + struct input_mt_slot *s = &mt->slots[slot]; 184 + bool button_contact = touch_overlay_segment_event(segment, pos); 185 + 186 + if (segment->slot == slot && segment->pressed) { 187 + /* sliding out of the button releases it */ 188 + if (!button_contact) { 189 + input_report_key(input, segment->key, false); 190 + segment->pressed = false; 191 + /* keep available for a possible touch event */ 192 + return false; 193 + } 194 + /* ignore sliding on the button while pressed */ 195 + s->frame = mt->frame; 196 + return true; 197 + } else if (button_contact) { 198 + input_report_key(input, segment->key, true); 199 + s->frame = mt->frame; 200 + segment->slot = slot; 201 + segment->pressed = true; 202 + return true; 203 + } 204 + 205 + return false; 206 + } 207 + 208 + /** 209 + * touch_overlay_sync_frame - update the status of the segments and report 210 + * buttons whose tracked slot is unused. 211 + * @list: pointer to the list that holds the segments 212 + * @input: pointer to the input device associated to the contact 213 + */ 214 + void touch_overlay_sync_frame(struct list_head *list, struct input_dev *input) 215 + { 216 + struct touch_overlay_segment *segment; 217 + struct input_mt *mt = input->mt; 218 + struct input_mt_slot *s; 219 + struct list_head *ptr; 220 + 221 + list_for_each(ptr, list) { 222 + segment = list_entry(ptr, struct touch_overlay_segment, list); 223 + if (!segment->key) 224 + continue; 225 + 226 + s = &mt->slots[segment->slot]; 227 + if (!input_mt_is_used(mt, s) && segment->pressed) { 228 + input_report_key(input, segment->key, false); 229 + segment->pressed = false; 230 + } 231 + } 232 + } 233 + EXPORT_SYMBOL(touch_overlay_sync_frame); 234 + 235 + /** 236 + * touch_overlay_process_contact - process contacts according to the overlay 237 + * mapping. This function acts as a filter to release the calling driver 238 + * from the contacts that are either related to overlay buttons or out of the 239 + * overlay touchscreen area, if defined. 240 + * @list: pointer to the list that holds the segments 241 + * @input: pointer to the input device associated to the contact 242 + * @pos: pointer to the contact position 243 + * @slot: slot associated to the contact (0 if multitouch is not supported) 244 + * 245 + * Returns true if the contact was processed (reported for valid key events 246 + * and dropped for contacts outside the overlay touchscreen area) or false 247 + * if the contact must be processed by the caller. In that case this function 248 + * shifts the (x,y) coordinates to the overlay touchscreen axis if required. 249 + */ 250 + bool touch_overlay_process_contact(struct list_head *list, 251 + struct input_dev *input, 252 + struct input_mt_pos *pos, int slot) 253 + { 254 + struct touch_overlay_segment *segment; 255 + struct list_head *ptr; 256 + 257 + /* 258 + * buttons must be prioritized over overlay touchscreens to account for 259 + * overlappings e.g. a button inside the touchscreen area. 260 + */ 261 + list_for_each(ptr, list) { 262 + segment = list_entry(ptr, struct touch_overlay_segment, list); 263 + if (segment->key && 264 + touch_overlay_button_event(input, segment, pos, slot)) 265 + return true; 266 + } 267 + 268 + /* 269 + * valid contacts on the overlay touchscreen are left for the client 270 + * to be processed/reported according to its (possibly) unique features. 271 + */ 272 + return !touch_overlay_event_on_ts(list, pos); 273 + } 274 + EXPORT_SYMBOL(touch_overlay_process_contact); 275 + 276 + MODULE_LICENSE("GPL"); 277 + MODULE_DESCRIPTION("Helper functions for overlay objects on touch devices");
+7 -4
drivers/input/touchscreen/ad7879.c
··· 444 444 return !!(val & AD7879_GPIO_DATA); 445 445 } 446 446 447 - static void ad7879_gpio_set_value(struct gpio_chip *chip, 448 - unsigned gpio, int value) 447 + static int ad7879_gpio_set_value(struct gpio_chip *chip, unsigned int gpio, 448 + int value) 449 449 { 450 450 struct ad7879 *ts = gpiochip_get_data(chip); 451 + int ret; 451 452 452 453 mutex_lock(&ts->mutex); 453 454 if (value) ··· 456 455 else 457 456 ts->cmd_crtl2 &= ~AD7879_GPIO_DATA; 458 457 459 - ad7879_write(ts, AD7879_REG_CTRL2, ts->cmd_crtl2); 458 + ret = ad7879_write(ts, AD7879_REG_CTRL2, ts->cmd_crtl2); 460 459 mutex_unlock(&ts->mutex); 460 + 461 + return ret; 461 462 } 462 463 463 464 static int ad7879_gpio_add(struct ad7879 *ts) ··· 475 472 ts->gc.direction_input = ad7879_gpio_direction_input; 476 473 ts->gc.direction_output = ad7879_gpio_direction_output; 477 474 ts->gc.get = ad7879_gpio_get_value; 478 - ts->gc.set = ad7879_gpio_set_value; 475 + ts->gc.set_rv = ad7879_gpio_set_value; 479 476 ts->gc.can_sleep = 1; 480 477 ts->gc.base = -1; 481 478 ts->gc.ngpio = 1;
+14 -12
drivers/input/touchscreen/edt-ft5x06.c
··· 120 120 struct regmap *regmap; 121 121 122 122 #if defined(CONFIG_DEBUG_FS) 123 - struct dentry *debug_dir; 124 123 u8 *raw_buffer; 125 124 size_t raw_bufsize; 126 125 #endif ··· 814 815 .read = edt_ft5x06_debugfs_raw_data_read, 815 816 }; 816 817 817 - static void edt_ft5x06_ts_prepare_debugfs(struct edt_ft5x06_ts_data *tsdata, 818 - const char *debugfs_name) 818 + static void edt_ft5x06_ts_prepare_debugfs(struct edt_ft5x06_ts_data *tsdata) 819 819 { 820 - tsdata->debug_dir = debugfs_create_dir(debugfs_name, NULL); 820 + struct dentry *debug_dir = tsdata->client->debugfs; 821 821 822 - debugfs_create_u16("num_x", S_IRUSR, tsdata->debug_dir, &tsdata->num_x); 823 - debugfs_create_u16("num_y", S_IRUSR, tsdata->debug_dir, &tsdata->num_y); 822 + debugfs_create_u16("num_x", S_IRUSR, debug_dir, &tsdata->num_x); 823 + debugfs_create_u16("num_y", S_IRUSR, debug_dir, &tsdata->num_y); 824 824 825 825 debugfs_create_file("mode", S_IRUSR | S_IWUSR, 826 - tsdata->debug_dir, tsdata, &debugfs_mode_fops); 826 + debug_dir, tsdata, &debugfs_mode_fops); 827 827 debugfs_create_file("raw_data", S_IRUSR, 828 - tsdata->debug_dir, tsdata, &debugfs_raw_data_fops); 828 + debug_dir, tsdata, &debugfs_raw_data_fops); 829 829 } 830 830 831 831 static void edt_ft5x06_ts_teardown_debugfs(struct edt_ft5x06_ts_data *tsdata) 832 832 { 833 - debugfs_remove_recursive(tsdata->debug_dir); 834 833 kfree(tsdata->raw_buffer); 835 834 } 836 835 ··· 839 842 return -ENOSYS; 840 843 } 841 844 842 - static void edt_ft5x06_ts_prepare_debugfs(struct edt_ft5x06_ts_data *tsdata, 843 - const char *debugfs_name) 845 + static void edt_ft5x06_ts_prepare_debugfs(struct edt_ft5x06_ts_data *tsdata) 844 846 { 845 847 } 846 848 ··· 1345 1349 if (error) 1346 1350 return error; 1347 1351 1348 - edt_ft5x06_ts_prepare_debugfs(tsdata, dev_driver_string(&client->dev)); 1352 + edt_ft5x06_ts_prepare_debugfs(tsdata); 1349 1353 1350 1354 dev_dbg(&client->dev, 1351 1355 "EDT FT5x06 initialized: IRQ %d, WAKE pin %d, Reset pin %d.\n", ··· 1491 1495 .max_support_points = 10, 1492 1496 }; 1493 1497 1498 + static const struct edt_i2c_chip_data edt_ft8716_data = { 1499 + .max_support_points = 10, 1500 + }; 1501 + 1494 1502 static const struct edt_i2c_chip_data edt_ft8719_data = { 1495 1503 .max_support_points = 10, 1496 1504 }; ··· 1507 1507 /* Note no edt- prefix for compatibility with the ft6236.c driver */ 1508 1508 { .name = "ft6236", .driver_data = (long)&edt_ft6236_data }, 1509 1509 { .name = "ft8201", .driver_data = (long)&edt_ft8201_data }, 1510 + { .name = "ft8716", .driver_data = (long)&edt_ft8716_data }, 1510 1511 { .name = "ft8719", .driver_data = (long)&edt_ft8719_data }, 1511 1512 { /* sentinel */ } 1512 1513 }; ··· 1524 1523 /* Note focaltech vendor prefix for compatibility with ft6236.c */ 1525 1524 { .compatible = "focaltech,ft6236", .data = &edt_ft6236_data }, 1526 1525 { .compatible = "focaltech,ft8201", .data = &edt_ft8201_data }, 1526 + { .compatible = "focaltech,ft8716", .data = &edt_ft8716_data }, 1527 1527 { .compatible = "focaltech,ft8719", .data = &edt_ft8719_data }, 1528 1528 { /* sentinel */ } 1529 1529 };
+44 -6
drivers/input/touchscreen/goodix.c
··· 44 44 #define GOODIX_HAVE_KEY BIT(4) 45 45 #define GOODIX_BUFFER_STATUS_TIMEOUT 20 46 46 47 - #define RESOLUTION_LOC 1 48 - #define MAX_CONTACTS_LOC 5 49 - #define TRIGGER_LOC 6 47 + #define RESOLUTION_LOC 1 48 + #define MAX_CONTACTS_LOC 5 49 + #define TRIGGER_LOC 6 50 + 51 + #define GOODIX_POLL_INTERVAL_MS 17 /* 17ms = 60fps */ 50 52 51 53 /* Our special handling for GPIO accesses through ACPI is x86 specific */ 52 54 #if defined CONFIG_X86 && defined CONFIG_ACPI ··· 499 497 input_sync(ts->input_dev); 500 498 } 501 499 500 + static void goodix_ts_work_i2c_poll(struct input_dev *input) 501 + { 502 + struct goodix_ts_data *ts = input_get_drvdata(input); 503 + 504 + goodix_process_events(ts); 505 + goodix_i2c_write_u8(ts->client, GOODIX_READ_COOR_ADDR, 0); 506 + } 507 + 502 508 /** 503 509 * goodix_ts_irq_handler - The IRQ handler 504 510 * ··· 523 513 return IRQ_HANDLED; 524 514 } 525 515 516 + static void goodix_enable_irq(struct goodix_ts_data *ts) 517 + { 518 + if (ts->client->irq) 519 + enable_irq(ts->client->irq); 520 + } 521 + 522 + static void goodix_disable_irq(struct goodix_ts_data *ts) 523 + { 524 + if (ts->client->irq) 525 + disable_irq(ts->client->irq); 526 + } 527 + 526 528 static void goodix_free_irq(struct goodix_ts_data *ts) 527 529 { 528 - devm_free_irq(&ts->client->dev, ts->client->irq, ts); 530 + if (ts->client->irq) 531 + devm_free_irq(&ts->client->dev, ts->client->irq, ts); 529 532 } 530 533 531 534 static int goodix_request_irq(struct goodix_ts_data *ts) 532 535 { 536 + if (!ts->client->irq) 537 + return 0; 538 + 533 539 return devm_request_threaded_irq(&ts->client->dev, ts->client->irq, 534 540 NULL, goodix_ts_irq_handler, 535 541 ts->irq_flags, ts->client->name, ts); ··· 1245 1219 return error; 1246 1220 } 1247 1221 1222 + input_set_drvdata(ts->input_dev, ts); 1223 + 1224 + if (!ts->client->irq) { 1225 + error = input_setup_polling(ts->input_dev, goodix_ts_work_i2c_poll); 1226 + if (error) { 1227 + dev_err(&ts->client->dev, 1228 + "could not set up polling mode, %d\n", error); 1229 + return error; 1230 + } 1231 + input_set_poll_interval(ts->input_dev, GOODIX_POLL_INTERVAL_MS); 1232 + } 1233 + 1248 1234 error = input_register_device(ts->input_dev); 1249 1235 if (error) { 1250 1236 dev_err(&ts->client->dev, ··· 1460 1422 1461 1423 /* We need gpio pins to suspend/resume */ 1462 1424 if (ts->irq_pin_access_method == IRQ_PIN_ACCESS_NONE) { 1463 - disable_irq(client->irq); 1425 + goodix_disable_irq(ts); 1464 1426 return 0; 1465 1427 } 1466 1428 ··· 1504 1466 int error; 1505 1467 1506 1468 if (ts->irq_pin_access_method == IRQ_PIN_ACCESS_NONE) { 1507 - enable_irq(client->irq); 1469 + goodix_enable_irq(ts); 1508 1470 return 0; 1509 1471 } 1510 1472
+27 -8
drivers/input/touchscreen/st1232.c
··· 22 22 #include <linux/pm_qos.h> 23 23 #include <linux/slab.h> 24 24 #include <linux/types.h> 25 + #include <linux/input/touch-overlay.h> 25 26 26 27 #define ST1232_TS_NAME "st1232-ts" 27 28 #define ST1633_TS_NAME "st1633-ts" ··· 58 57 struct dev_pm_qos_request low_latency_req; 59 58 struct gpio_desc *reset_gpio; 60 59 const struct st_chip_info *chip_info; 60 + struct list_head touch_overlay_list; 61 61 int read_buf_len; 62 62 u8 *read_buf; 63 63 }; ··· 158 156 159 157 input_mt_assign_slots(input, slots, pos, n_contacts, 0); 160 158 for (i = 0; i < n_contacts; i++) { 159 + if (touch_overlay_process_contact(&ts->touch_overlay_list, 160 + input, &pos[i], slots[i])) 161 + continue; 162 + 161 163 input_mt_slot(input, slots[i]); 162 164 input_mt_report_slot_state(input, MT_TOOL_FINGER, true); 163 165 input_report_abs(input, ABS_MT_POSITION_X, pos[i].x); ··· 170 164 input_report_abs(input, ABS_MT_TOUCH_MAJOR, z[i]); 171 165 } 172 166 167 + touch_overlay_sync_frame(&ts->touch_overlay_list, input); 173 168 input_mt_sync_frame(input); 174 169 input_sync(input); 175 170 ··· 299 292 if (error) 300 293 return error; 301 294 302 - /* Read resolution from the chip */ 303 - error = st1232_ts_read_resolution(ts, &max_x, &max_y); 304 - if (error) { 305 - dev_err(&client->dev, 306 - "Failed to read resolution: %d\n", error); 307 - return error; 308 - } 309 - 310 295 if (ts->chip_info->have_z) 311 296 input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 0, 312 297 ts->chip_info->max_area, 0, 0); 298 + 299 + /* map overlay objects if defined in the device tree */ 300 + INIT_LIST_HEAD(&ts->touch_overlay_list); 301 + error = touch_overlay_map(&ts->touch_overlay_list, input_dev); 302 + if (error) 303 + return error; 304 + 305 + if (touch_overlay_mapped_touchscreen(&ts->touch_overlay_list)) { 306 + /* Read resolution from the overlay touchscreen if defined */ 307 + touch_overlay_get_touchscreen_abs(&ts->touch_overlay_list, 308 + &max_x, &max_y); 309 + } else { 310 + /* Read resolution from the chip */ 311 + error = st1232_ts_read_resolution(ts, &max_x, &max_y); 312 + if (error) { 313 + dev_err(&client->dev, 314 + "Failed to read resolution: %d\n", error); 315 + return error; 316 + } 317 + } 313 318 314 319 input_set_abs_params(input_dev, ABS_MT_POSITION_X, 315 320 0, max_x, 0, 0);
+25
include/linux/input/touch-overlay.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0-only */ 2 + /* 3 + * Copyright (c) 2023 Javier Carrasco <javier.carrasco@wolfvision.net> 4 + */ 5 + 6 + #ifndef _TOUCH_OVERLAY 7 + #define _TOUCH_OVERLAY 8 + 9 + #include <linux/types.h> 10 + 11 + struct input_dev; 12 + 13 + int touch_overlay_map(struct list_head *list, struct input_dev *input); 14 + 15 + void touch_overlay_get_touchscreen_abs(struct list_head *list, u16 *x, u16 *y); 16 + 17 + bool touch_overlay_mapped_touchscreen(struct list_head *list); 18 + 19 + bool touch_overlay_process_contact(struct list_head *list, 20 + struct input_dev *input, 21 + struct input_mt_pos *pos, int slot); 22 + 23 + void touch_overlay_sync_frame(struct list_head *list, struct input_dev *input); 24 + 25 + #endif
+8
include/uapi/linux/input-event-codes.h
··· 601 601 #define BTN_DPAD_LEFT 0x222 602 602 #define BTN_DPAD_RIGHT 0x223 603 603 604 + #define BTN_GRIPL 0x224 605 + #define BTN_GRIPR 0x225 606 + #define BTN_GRIPL2 0x226 607 + #define BTN_GRIPR2 0x227 608 + 604 609 #define KEY_ALS_TOGGLE 0x230 /* Ambient light sensor */ 605 610 #define KEY_ROTATE_LOCK_TOGGLE 0x231 /* Display rotation lock */ 606 611 #define KEY_REFRESH_RATE_TOGGLE 0x232 /* Display refresh rate toggle */ ··· 769 764 #define KEY_KBD_LCD_MENU3 0x2ba 770 765 #define KEY_KBD_LCD_MENU4 0x2bb 771 766 #define KEY_KBD_LCD_MENU5 0x2bc 767 + 768 + /* Performance Boost key (Alienware)/G-Mode key (Dell) */ 769 + #define KEY_PERFORMANCE 0x2bd 772 770 773 771 #define BTN_TRIGGER_HAPPY 0x2c0 774 772 #define BTN_TRIGGER_HAPPY1 0x2c0