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

Configure Feed

Select the types of activity you want to include in your feed.

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

Pull input updates from Dmitry Torokhov:

- a new driver for Cypress Generation 5 touchscreens

- a new driver for Hynitron cstxxx touchscreens

- a new driver for Himax hx83112b touchscreen

- I2C input devices have been converted to use i2c's probe_new()

- a large number of input devices are now using
DEFINE_SIMPLE_DEV_PM_OPS and pm_sleep_ptr() and no longer use
__maybe_unused annotations

- improvements to msg2638 touchscreen driver to also support msg2138

- conversion of several input deevine bindings to yaml/DT schema

- changes to select touch drivers to move handling of wake irqs to the
PM core

- other assorted fixes and improvements.

* tag 'input-for-v6.2-rc0' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (165 commits)
Input: elants_i2c - delay longer with reset asserted
dt-bindings: input: Convert ti,drv260x to DT schema
dt-bindings: input: gpio-beeper: Convert to yaml schema
Input: pxspad - fix unused data warning when force feedback not enabled
Input: lpc32xx - allow building with COMPILE_TEST
Input: nomadik-ske-keypad - allow building with COMPILE_TEST
Input: pxa27xx-keypad - allow build with COMPILE_TEST
Input: spear-keyboard - improve build coverage using COMPILE_TEST
Input: tegra-kbc - allow build with COMPILE_TEST
Input: tegra-kbc - switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
Input: tca6416-keypad - switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
Input: tc3589x - switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
Input: st-keyscan - switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
Input: sh-keysc - switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
Input: qt1070 - switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
Input: pxa27x_keypad - switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
Input: pmic8xxx-keypad - switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
Input: nomadik-ske-keypad - switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
Input: mcs-touchkey - switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
Input: max7359-keypad - switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
...

+3100 -811
+3 -1
Documentation/devicetree/bindings/input/allwinner,sun4i-a10-lradc-keys.yaml
··· 16 16 - const: allwinner,sun4i-a10-lradc-keys 17 17 - const: allwinner,sun8i-a83t-r-lradc 18 18 - items: 19 - - const: allwinner,sun50i-a64-lradc 19 + - enum: 20 + - allwinner,suniv-f1c100s-lradc 21 + - allwinner,sun50i-a64-lradc 20 22 - const: allwinner,sun8i-a83t-r-lradc 21 23 - const: allwinner,sun50i-r329-lradc 22 24 - items:
+10 -15
Documentation/devicetree/bindings/input/azoteq,iqs7222.yaml
··· 473 473 Specifies whether the event is to be interpreted as a key (1) 474 474 or a switch (5). 475 475 476 - required: 477 - - linux,code 478 - 479 476 additionalProperties: false 480 477 481 478 dependencies: ··· 498 501 499 502 azoteq,slider-size: 500 503 $ref: /schemas/types.yaml#/definitions/uint32 501 - minimum: 0 504 + minimum: 1 502 505 maximum: 65535 503 506 description: 504 507 Specifies the slider's one-dimensional resolution, equal to the ··· 572 575 linux,code: true 573 576 574 577 azoteq,gesture-max-ms: 575 - multipleOf: 4 578 + multipleOf: 16 576 579 minimum: 0 577 - maximum: 1020 580 + maximum: 4080 578 581 description: 579 582 Specifies the length of time (in ms) within which a tap, swipe 580 583 or flick gesture must be completed in order to be acknowledged ··· 582 585 gesture applies to all remaining swipe or flick gestures. 583 586 584 587 azoteq,gesture-min-ms: 585 - multipleOf: 4 588 + multipleOf: 16 586 589 minimum: 0 587 - maximum: 124 590 + maximum: 496 588 591 description: 589 592 Specifies the length of time (in ms) for which a tap gesture must 590 593 be held in order to be acknowledged by the device. ··· 616 619 Note that although multiple events can be mapped to a single 617 620 GPIO, they must all be of the same type (proximity, touch or 618 621 slider gesture). 619 - 620 - required: 621 - - linux,code 622 622 623 623 additionalProperties: false 624 624 ··· 687 693 properties: 688 694 azoteq,slider-size: 689 695 multipleOf: 16 696 + minimum: 16 690 697 maximum: 4080 691 698 692 699 azoteq,top-speed: ··· 930 935 931 936 event-tap { 932 937 linux,code = <KEY_PLAYPAUSE>; 933 - azoteq,gesture-max-ms = <600>; 934 - azoteq,gesture-min-ms = <24>; 938 + azoteq,gesture-max-ms = <400>; 939 + azoteq,gesture-min-ms = <32>; 935 940 }; 936 941 937 942 event-flick-pos { 938 943 linux,code = <KEY_NEXTSONG>; 939 - azoteq,gesture-max-ms = <600>; 940 - azoteq,gesture-dist = <816>; 944 + azoteq,gesture-max-ms = <800>; 945 + azoteq,gesture-dist = <800>; 941 946 }; 942 947 943 948 event-flick-neg {
-13
Documentation/devicetree/bindings/input/gpio-beeper.txt
··· 1 - * GPIO beeper device tree bindings 2 - 3 - Register a beeper connected to GPIO pin. 4 - 5 - Required properties: 6 - - compatible: Should be "gpio-beeper". 7 - - gpios: From common gpio binding; gpio connection to beeper enable pin. 8 - 9 - Example: 10 - beeper: beeper { 11 - compatible = "gpio-beeper"; 12 - gpios = <&gpio3 23 GPIO_ACTIVE_HIGH>; 13 - };
+33
Documentation/devicetree/bindings/input/gpio-beeper.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/gpio-beeper.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: GPIO controlled beeper 8 + 9 + maintainers: 10 + - Fabio Estevam <festevam@denx.de> 11 + 12 + properties: 13 + compatible: 14 + const: gpio-beeper 15 + 16 + gpios: 17 + maxItems: 1 18 + description: 19 + GPIO that drives the beeper. 20 + 21 + required: 22 + - compatible 23 + - gpios 24 + 25 + additionalProperties: false 26 + 27 + examples: 28 + - | 29 + #include <dt-bindings/gpio/gpio.h> 30 + beeper { 31 + compatible = "gpio-beeper"; 32 + gpios = <&gpio3 23 GPIO_ACTIVE_HIGH>; 33 + };
+75
Documentation/devicetree/bindings/input/qcom,pm8921-pwrkey.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/input/qcom,pm8921-pwrkey.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Qualcomm PM8921 PMIC Power Key 8 + 9 + maintainers: 10 + - Bjorn Andersson <andersson@kernel.org> 11 + 12 + allOf: 13 + - $ref: input.yaml# 14 + 15 + properties: 16 + compatible: 17 + oneOf: 18 + - enum: 19 + - qcom,pm8921-pwrkey 20 + - qcom,pm8058-pwrkey 21 + - items: 22 + - enum: 23 + - qcom,pm8018-pwrkey 24 + - const: qcom,pm8921-pwrkey 25 + 26 + reg: 27 + maxItems: 1 28 + 29 + interrupts: 30 + items: 31 + - description: key release 32 + - description: key press 33 + 34 + debounce: 35 + description: 36 + Time in microseconds that key must be pressed or 37 + released for state change interrupt to trigger. 38 + $ref: /schemas/types.yaml#/definitions/uint32 39 + 40 + pull-up: 41 + description: 42 + Presence of this property indicates that the KPDPWR_N 43 + pin should be configured for pull up. 44 + $ref: /schemas/types.yaml#/definitions/flag 45 + 46 + required: 47 + - compatible 48 + - reg 49 + - interrupts 50 + 51 + unevaluatedProperties: false 52 + 53 + examples: 54 + - | 55 + #include <dt-bindings/interrupt-controller/irq.h> 56 + ssbi { 57 + #address-cells = <1>; 58 + #size-cells = <0>; 59 + 60 + pmic@0 { 61 + reg = <0x0>; 62 + #address-cells = <1>; 63 + #size-cells = <0>; 64 + 65 + pwrkey@1c { 66 + compatible = "qcom,pm8921-pwrkey"; 67 + reg = <0x1c>; 68 + interrupt-parent = <&pmicint>; 69 + interrupts = <50 IRQ_TYPE_EDGE_RISING>, <51 IRQ_TYPE_EDGE_RISING>; 70 + debounce = <15625>; 71 + pull-up; 72 + }; 73 + }; 74 + }; 75 + ...
-46
Documentation/devicetree/bindings/input/qcom,pm8xxx-pwrkey.txt
··· 1 - Qualcomm PM8xxx PMIC Power Key 2 - 3 - PROPERTIES 4 - 5 - - compatible: 6 - Usage: required 7 - Value type: <string> 8 - Definition: must be one of: 9 - "qcom,pm8058-pwrkey" 10 - "qcom,pm8921-pwrkey" 11 - 12 - - reg: 13 - Usage: required 14 - Value type: <prop-encoded-array> 15 - Definition: address of power key control register 16 - 17 - - interrupts: 18 - Usage: required 19 - Value type: <prop-encoded-array> 20 - Definition: the first interrupt specifies the key release interrupt 21 - and the second interrupt specifies the key press interrupt. 22 - The format of the specifier is defined by the binding 23 - document describing the node's interrupt parent. 24 - 25 - - debounce: 26 - Usage: optional 27 - Value type: <u32> 28 - Definition: time in microseconds that key must be pressed or release 29 - for state change interrupt to trigger. 30 - 31 - - pull-up: 32 - Usage: optional 33 - Value type: <empty> 34 - Definition: presence of this property indicates that the KPDPWR_N pin 35 - should be configured for pull up. 36 - 37 - EXAMPLE 38 - 39 - pwrkey@1c { 40 - compatible = "qcom,pm8921-pwrkey"; 41 - reg = <0x1c>; 42 - interrupt-parent = <&pmicintc>; 43 - interrupts = <50 1>, <51 1>; 44 - debounce = <15625>; 45 - pull-up; 46 - };
-50
Documentation/devicetree/bindings/input/ti,drv260x.txt
··· 1 - * Texas Instruments - drv260x Haptics driver family 2 - 3 - Required properties: 4 - - compatible - One of: 5 - "ti,drv2604" - DRV2604 6 - "ti,drv2605" - DRV2605 7 - "ti,drv2605l" - DRV2605L 8 - - reg - I2C slave address 9 - - vbat-supply - Required supply regulator 10 - - mode - Power up mode of the chip (defined in include/dt-bindings/input/ti-drv260x.h) 11 - DRV260X_LRA_MODE - Linear Resonance Actuator mode (Piezoelectric) 12 - DRV260X_LRA_NO_CAL_MODE - This is a LRA Mode but there is no calibration 13 - sequence during init. And the device is configured for real 14 - time playback mode (RTP mode). 15 - DRV260X_ERM_MODE - Eccentric Rotating Mass mode (Rotary vibrator) 16 - - library-sel - These are ROM based waveforms pre-programmed into the IC. 17 - This should be set to set the library to use at power up. 18 - (defined in include/dt-bindings/input/ti-drv260x.h) 19 - DRV260X_LIB_EMPTY - Do not use a pre-programmed library 20 - DRV260X_ERM_LIB_A - Pre-programmed Library 21 - DRV260X_ERM_LIB_B - Pre-programmed Library 22 - DRV260X_ERM_LIB_C - Pre-programmed Library 23 - DRV260X_ERM_LIB_D - Pre-programmed Library 24 - DRV260X_ERM_LIB_E - Pre-programmed Library 25 - DRV260X_ERM_LIB_F - Pre-programmed Library 26 - DRV260X_LIB_LRA - Pre-programmed LRA Library 27 - 28 - Optional properties: 29 - - enable-gpio - gpio pin to enable/disable the device. 30 - - vib-rated-mv - The rated voltage of the actuator in millivolts. 31 - If this is not set then the value will be defaulted to 32 - 3.2 v. 33 - - vib-overdrive-mv - The overdrive voltage of the actuator in millivolts. 34 - If this is not set then the value will be defaulted to 35 - 3.2 v. 36 - Example: 37 - 38 - haptics: haptics@5a { 39 - compatible = "ti,drv2605l"; 40 - reg = <0x5a>; 41 - vbat-supply = <&vbat>; 42 - enable-gpio = <&gpio1 28 GPIO_ACTIVE_HIGH>; 43 - mode = <DRV260X_LRA_MODE>; 44 - library-sel = <DRV260X_LIB_LRA>; 45 - vib-rated-mv = <3200>; 46 - vib-overdrive-mv = <3200>; 47 - } 48 - 49 - For more product information please see the link below: 50 - http://www.ti.com/product/drv2605
+109
Documentation/devicetree/bindings/input/ti,drv260x.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/input/ti,drv260x.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Texas Instruments - drv260x Haptics driver family 8 + 9 + maintainers: 10 + - Andrew Davis <afd@ti.com> 11 + 12 + properties: 13 + compatible: 14 + enum: 15 + - ti,drv2604 16 + - ti,drv2605 17 + - ti,drv2605l 18 + 19 + reg: 20 + maxItems: 1 21 + 22 + vbat-supply: 23 + description: Power supply to the haptic motor 24 + 25 + # TODO: Deprecate 'mode' in favor of differently named property 26 + mode: 27 + $ref: /schemas/types.yaml#/definitions/uint32 28 + description: | 29 + Power up mode of the chip 30 + (defined in include/dt-bindings/input/ti-drv260x.h) 31 + 32 + DRV260X_LRA_MODE 33 + Linear Resonance Actuator mode (Piezoelectric) 34 + 35 + DRV260X_LRA_NO_CAL_MODE 36 + This is a LRA Mode but there is no calibration sequence during init. 37 + And the device is configured for real time playback mode (RTP mode). 38 + 39 + DRV260X_ERM_MODE 40 + Eccentric Rotating Mass mode (Rotary vibrator) 41 + enum: [ 0, 1, 2 ] 42 + 43 + library-sel: 44 + $ref: /schemas/types.yaml#/definitions/uint32 45 + description: | 46 + These are ROM based waveforms pre-programmed into the IC. 47 + This should be set to set the library to use at power up. 48 + (defined in include/dt-bindings/input/ti-drv260x.h) 49 + 50 + DRV260X_LIB_EMPTY - Do not use a pre-programmed library 51 + DRV260X_ERM_LIB_A - Pre-programmed Library 52 + DRV260X_ERM_LIB_B - Pre-programmed Library 53 + DRV260X_ERM_LIB_C - Pre-programmed Library 54 + DRV260X_ERM_LIB_D - Pre-programmed Library 55 + DRV260X_ERM_LIB_E - Pre-programmed Library 56 + DRV260X_ERM_LIB_F - Pre-programmed Library 57 + DRV260X_LIB_LRA - Pre-programmed LRA Library 58 + enum: [ 0, 1, 2, 3, 4, 5, 6, 7 ] 59 + 60 + enable-gpio: 61 + maxItems: 1 62 + deprecated: true 63 + 64 + enable-gpios: 65 + maxItems: 1 66 + 67 + vib-rated-mv: 68 + $ref: /schemas/types.yaml#/definitions/uint32 69 + description: | 70 + The rated voltage of the actuator in millivolts. 71 + If this is not set then the value will be defaulted to 3200 mV. 72 + default: 3200 73 + 74 + vib-overdrive-mv: 75 + $ref: /schemas/types.yaml#/definitions/uint32 76 + description: | 77 + The overdrive voltage of the actuator in millivolts. 78 + If this is not set then the value will be defaulted to 3200 mV. 79 + default: 3200 80 + 81 + required: 82 + - compatible 83 + - reg 84 + - enable-gpios 85 + - mode 86 + - library-sel 87 + 88 + additionalProperties: false 89 + 90 + examples: 91 + - | 92 + #include <dt-bindings/gpio/gpio.h> 93 + #include <dt-bindings/input/ti-drv260x.h> 94 + 95 + i2c { 96 + #address-cells = <1>; 97 + #size-cells = <0>; 98 + 99 + haptics@5a { 100 + compatible = "ti,drv2605l"; 101 + reg = <0x5a>; 102 + vbat-supply = <&vbat>; 103 + enable-gpios = <&gpio1 28 GPIO_ACTIVE_HIGH>; 104 + mode = <DRV260X_LRA_MODE>; 105 + library-sel = <DRV260X_LIB_LRA>; 106 + vib-rated-mv = <3200>; 107 + vib-overdrive-mv = <3200>; 108 + }; 109 + };
+106
Documentation/devicetree/bindings/input/touchscreen/cypress,tt21000.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/cypress,tt21000.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Cypress TT21000 touchscreen controller 8 + 9 + description: The Cypress TT21000 series (also known as "CYTTSP5" after 10 + the marketing name Cypress TrueTouch Standard Product series 5). 11 + 12 + maintainers: 13 + - Alistair Francis <alistair@alistair23.me> 14 + 15 + allOf: 16 + - $ref: touchscreen.yaml# 17 + 18 + properties: 19 + compatible: 20 + const: cypress,tt21000 21 + 22 + reg: 23 + maxItems: 1 24 + 25 + '#address-cells': 26 + const: 1 27 + 28 + '#size-cells': 29 + const: 0 30 + 31 + interrupts: 32 + maxItems: 1 33 + 34 + vdd-supply: 35 + description: Regulator for voltage. 36 + 37 + reset-gpios: 38 + maxItems: 1 39 + 40 + linux,keycodes: 41 + description: EV_ABS specific event code generated by the axis. 42 + 43 + patternProperties: 44 + "^button@[0-9]+$": 45 + type: object 46 + $ref: ../input.yaml# 47 + properties: 48 + reg: 49 + maxItems: 1 50 + linux,keycodes: 51 + description: Keycode to emit 52 + 53 + required: 54 + - reg 55 + - linux,keycodes 56 + 57 + additionalProperties: false 58 + 59 + required: 60 + - compatible 61 + - reg 62 + - interrupts 63 + - vdd-supply 64 + 65 + unevaluatedProperties: false 66 + 67 + examples: 68 + - | 69 + #include <dt-bindings/interrupt-controller/irq.h> 70 + #include <dt-bindings/gpio/gpio.h> 71 + #include <dt-bindings/input/linux-event-codes.h> 72 + 73 + i2c { 74 + #address-cells = <1>; 75 + #size-cells = <0>; 76 + 77 + touchscreen@24 { 78 + #address-cells = <1>; 79 + #size-cells = <0>; 80 + 81 + compatible = "cypress,tt21000"; 82 + reg = <0x24>; 83 + pinctrl-names = "default"; 84 + pinctrl-0 = <&tp_reset_ds203>; 85 + interrupt-parent = <&pio>; 86 + interrupts = <1 5 IRQ_TYPE_LEVEL_LOW>; 87 + reset-gpios = <&pio 7 1 GPIO_ACTIVE_LOW>; 88 + vdd-supply = <&reg_touch>; 89 + 90 + button@0 { 91 + reg = <0>; 92 + linux,keycodes = <KEY_HOMEPAGE>; 93 + }; 94 + 95 + button@1 { 96 + reg = <1>; 97 + linux,keycodes = <KEY_MENU>; 98 + }; 99 + 100 + button@2 { 101 + reg = <2>; 102 + linux,keycodes = <KEY_BACK>; 103 + }; 104 + }; 105 + }; 106 + ...
+2 -2
Documentation/devicetree/bindings/input/touchscreen/egalax-ts.txt
··· 13 13 compatible = "eeti,egalax_ts"; 14 14 reg = <0x04>; 15 15 interrupt-parent = <&gpio1>; 16 - interrupts = <9 2>; 17 - wakeup-gpios = <&gpio1 9 0>; 16 + interrupts = <9 IRQ_TYPE_LEVEL_LOW>; 17 + wakeup-gpios = <&gpio1 9 GPIO_ACTIVE_LOW>; 18 18 };
+63
Documentation/devicetree/bindings/input/touchscreen/himax,hx83112b.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/himax,hx83112b.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Himax hx83112b touchscreen controller bindings 8 + 9 + maintainers: 10 + - Job Noorman <job@noorman.info> 11 + 12 + allOf: 13 + - $ref: touchscreen.yaml# 14 + 15 + properties: 16 + compatible: 17 + enum: 18 + - himax,hx83112b 19 + 20 + reg: 21 + maxItems: 1 22 + 23 + interrupts: 24 + maxItems: 1 25 + 26 + reset-gpios: 27 + maxItems: 1 28 + 29 + touchscreen-inverted-x: true 30 + touchscreen-inverted-y: true 31 + touchscreen-size-x: true 32 + touchscreen-size-y: true 33 + touchscreen-swapped-x-y: true 34 + 35 + additionalProperties: false 36 + 37 + required: 38 + - compatible 39 + - reg 40 + - interrupts 41 + - reset-gpios 42 + - touchscreen-size-x 43 + - touchscreen-size-y 44 + 45 + examples: 46 + - | 47 + #include <dt-bindings/interrupt-controller/irq.h> 48 + #include <dt-bindings/gpio/gpio.h> 49 + i2c { 50 + #address-cells = <1>; 51 + #size-cells = <0>; 52 + touchscreen@48 { 53 + compatible = "himax,hx83112b"; 54 + reg = <0x48>; 55 + interrupt-parent = <&tlmm>; 56 + interrupts = <65 IRQ_TYPE_LEVEL_LOW>; 57 + touchscreen-size-x = <1080>; 58 + touchscreen-size-y = <2160>; 59 + reset-gpios = <&tlmm 64 GPIO_ACTIVE_LOW>; 60 + }; 61 + }; 62 + 63 + ...
+65
Documentation/devicetree/bindings/input/touchscreen/hynitron,cstxxx.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/hynitron,cstxxx.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Hynitron cstxxx series touchscreen controller 8 + 9 + description: | 10 + Bindings for Hynitron cstxxx series multi-touch touchscreen 11 + controllers. 12 + 13 + maintainers: 14 + - Chris Morgan <macromorgan@hotmail.com> 15 + 16 + allOf: 17 + - $ref: touchscreen.yaml# 18 + 19 + properties: 20 + compatible: 21 + enum: 22 + - hynitron,cst340 23 + 24 + reg: 25 + maxItems: 1 26 + 27 + interrupts: 28 + maxItems: 1 29 + 30 + reset-gpios: 31 + maxItems: 1 32 + 33 + touchscreen-size-x: true 34 + touchscreen-size-y: true 35 + touchscreen-inverted-x: true 36 + touchscreen-inverted-y: true 37 + touchscreen-swapped-x-y: true 38 + 39 + additionalProperties: false 40 + 41 + required: 42 + - compatible 43 + - reg 44 + - interrupts 45 + - reset-gpios 46 + 47 + examples: 48 + - | 49 + #include <dt-bindings/gpio/gpio.h> 50 + #include <dt-bindings/interrupt-controller/arm-gic.h> 51 + i2c { 52 + #address-cells = <1>; 53 + #size-cells = <0>; 54 + touchscreen@1a { 55 + compatible = "hynitron,cst340"; 56 + reg = <0x1a>; 57 + interrupt-parent = <&gpio4>; 58 + interrupts = <9 IRQ_TYPE_EDGE_FALLING>; 59 + reset-gpios = <&gpio4 6 GPIO_ACTIVE_LOW>; 60 + touchscreen-size-x = <640>; 61 + touchscreen-size-y = <480>; 62 + }; 63 + }; 64 + 65 + ...
+7 -1
Documentation/devicetree/bindings/input/touchscreen/mstar,msg2638.yaml
··· 14 14 15 15 properties: 16 16 compatible: 17 - const: mstar,msg2638 17 + enum: 18 + - mstar,msg2138 19 + - mstar,msg2638 18 20 19 21 reg: 20 22 const: 0x26 ··· 35 33 36 34 touchscreen-size-x: true 37 35 touchscreen-size-y: true 36 + 37 + linux,keycodes: 38 + minItems: 1 39 + maxItems: 4 38 40 39 41 additionalProperties: false 40 42
+2
Documentation/devicetree/bindings/vendor-prefixes.yaml
··· 573 573 description: Hycon Technology Corp. 574 574 "^hydis,.*": 575 575 description: Hydis Technologies 576 + "^hynitron,.*": 577 + description: Shanghai Hynitron Microelectronics Co. Ltd. 576 578 "^hynix,.*": 577 579 description: SK Hynix Inc. 578 580 "^hyundai,.*":
+8 -1
MAINTAINERS
··· 9220 9220 F: Documentation/scsi/hptiop.rst 9221 9221 F: drivers/scsi/hptiop.c 9222 9222 9223 + HIMAX HX83112B TOUCHSCREEN SUPPORT 9224 + M: Job Noorman <job@noorman.info> 9225 + L: linux-input@vger.kernel.org 9226 + S: Maintained 9227 + F: Documentation/devicetree/bindings/input/touchscreen/himax,hx83112b.yaml 9228 + F: drivers/input/touchscreen/himax_hx83112b.c 9229 + 9223 9230 HIPPI 9224 9231 M: Jes Sorensen <jes@trained-monkey.org> 9225 9232 L: linux-hippi@sunsite.dk ··· 19031 19024 F: include/video/sisfb.h 19032 19025 19033 19026 SIS I2C TOUCHSCREEN DRIVER 19034 - M: Mika Penttilä <mika.penttila@nextfour.com> 19027 + M: Mika Penttilä <mpenttil@redhat.com> 19035 19028 L: linux-input@vger.kernel.org 19036 19029 S: Maintained 19037 19030 F: Documentation/devicetree/bindings/input/touchscreen/sis_i2c.txt
+2 -2
arch/arm/boot/dts/imx6qdl-sabreauto.dtsi
··· 452 452 pinctrl-names = "default"; 453 453 pinctrl-0 = <&pinctrl_egalax_int>; 454 454 interrupt-parent = <&gpio2>; 455 - interrupts = <28 IRQ_TYPE_EDGE_FALLING>; 456 - wakeup-gpios = <&gpio2 28 GPIO_ACTIVE_HIGH>; 455 + interrupts = <28 IRQ_TYPE_LEVEL_LOW>; 456 + wakeup-gpios = <&gpio2 28 GPIO_ACTIVE_LOW>; 457 457 }; 458 458 }; 459 459
+4 -4
arch/arm/boot/dts/imx6qdl-sabresd.dtsi
··· 311 311 pinctrl-names = "default"; 312 312 pinctrl-0 = <&pinctrl_i2c2_egalax_int>; 313 313 interrupt-parent = <&gpio6>; 314 - interrupts = <8 IRQ_TYPE_EDGE_FALLING>; 315 - wakeup-gpios = <&gpio6 8 GPIO_ACTIVE_HIGH>; 314 + interrupts = <8 IRQ_TYPE_LEVEL_LOW>; 315 + wakeup-gpios = <&gpio6 8 GPIO_ACTIVE_LOW>; 316 316 }; 317 317 318 318 ov5640: camera@3c { ··· 450 450 compatible = "eeti,egalax_ts"; 451 451 reg = <0x04>; 452 452 interrupt-parent = <&gpio6>; 453 - interrupts = <7 2>; 454 - wakeup-gpios = <&gpio6 7 0>; 453 + interrupts = <7 IRQ_TYPE_LEVEL_LOW>; 454 + wakeup-gpios = <&gpio6 7 GPIO_ACTIVE_LOW>; 455 455 }; 456 456 457 457 magnetometer@e {
+1
arch/arm/mach-s3c/mach-crag6410.c
··· 14 14 #include <linux/fb.h> 15 15 #include <linux/io.h> 16 16 #include <linux/init.h> 17 + #include <linux/input-event-codes.h> 17 18 #include <linux/gpio.h> 18 19 #include <linux/gpio/machine.h> 19 20 #include <linux/leds.h>
+3
drivers/hid/hid-debug.c
··· 971 971 [KEY_ASSISTANT] = "Assistant", 972 972 [KEY_KBD_LAYOUT_NEXT] = "KbdLayoutNext", 973 973 [KEY_EMOJI_PICKER] = "EmojiPicker", 974 + [KEY_CAMERA_ACCESS_ENABLE] = "CameraAccessEnable", 975 + [KEY_CAMERA_ACCESS_DISABLE] = "CameraAccessDisable", 976 + [KEY_CAMERA_ACCESS_TOGGLE] = "CameraAccessToggle", 974 977 [KEY_DICTATE] = "Dictate", 975 978 [KEY_BRIGHTNESS_MIN] = "BrightnessMin", 976 979 [KEY_BRIGHTNESS_MAX] = "BrightnessMax",
+3
drivers/hid/hid-input.c
··· 1086 1086 case 0x0cd: map_key_clear(KEY_PLAYPAUSE); break; 1087 1087 case 0x0cf: map_key_clear(KEY_VOICECOMMAND); break; 1088 1088 1089 + case 0x0d5: map_key_clear(KEY_CAMERA_ACCESS_ENABLE); break; 1090 + case 0x0d6: map_key_clear(KEY_CAMERA_ACCESS_DISABLE); break; 1091 + case 0x0d7: map_key_clear(KEY_CAMERA_ACCESS_TOGGLE); break; 1089 1092 case 0x0d8: map_key_clear(KEY_DICTATE); break; 1090 1093 case 0x0d9: map_key_clear(KEY_EMOJI_PICKER); break; 1091 1094
-5
drivers/hid/i2c-hid/i2c-hid-acpi.c
··· 105 105 106 106 acpi_device_fix_up_power(adev); 107 107 108 - if (acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0) { 109 - device_set_wakeup_capable(dev, true); 110 - device_set_wakeup_enable(dev, false); 111 - } 112 - 113 108 return i2c_hid_core_probe(client, &ihid_acpi->ops, 114 109 hid_descriptor_address, 0); 115 110 }
+3 -21
drivers/hid/i2c-hid/i2c-hid-core.c
··· 26 26 #include <linux/delay.h> 27 27 #include <linux/slab.h> 28 28 #include <linux/pm.h> 29 + #include <linux/pm_wakeirq.h> 29 30 #include <linux/device.h> 30 31 #include <linux/wait.h> 31 32 #include <linux/err.h> ··· 113 112 114 113 wait_queue_head_t wait; /* For waiting the interrupt */ 115 114 116 - bool irq_wake_enabled; 117 115 struct mutex reset_lock; 118 116 119 117 struct i2chid_ops *ops; ··· 1099 1099 struct i2c_hid *ihid = i2c_get_clientdata(client); 1100 1100 struct hid_device *hid = ihid->hid; 1101 1101 int ret; 1102 - int wake_status; 1103 1102 1104 1103 ret = hid_driver_suspend(hid, PMSG_SUSPEND); 1105 1104 if (ret < 0) ··· 1109 1110 1110 1111 disable_irq(client->irq); 1111 1112 1112 - if (device_may_wakeup(&client->dev)) { 1113 - wake_status = enable_irq_wake(client->irq); 1114 - if (!wake_status) 1115 - ihid->irq_wake_enabled = true; 1116 - else 1117 - hid_warn(hid, "Failed to enable irq wake: %d\n", 1118 - wake_status); 1119 - } else { 1113 + if (!device_may_wakeup(&client->dev)) 1120 1114 i2c_hid_core_power_down(ihid); 1121 - } 1122 1115 1123 1116 return 0; 1124 1117 } ··· 1121 1130 struct i2c_client *client = to_i2c_client(dev); 1122 1131 struct i2c_hid *ihid = i2c_get_clientdata(client); 1123 1132 struct hid_device *hid = ihid->hid; 1124 - int wake_status; 1125 1133 1126 - if (!device_may_wakeup(&client->dev)) { 1134 + if (!device_may_wakeup(&client->dev)) 1127 1135 i2c_hid_core_power_up(ihid); 1128 - } else if (ihid->irq_wake_enabled) { 1129 - wake_status = disable_irq_wake(client->irq); 1130 - if (!wake_status) 1131 - ihid->irq_wake_enabled = false; 1132 - else 1133 - hid_warn(hid, "Failed to disable irq wake: %d\n", 1134 - wake_status); 1135 - } 1136 1136 1137 1137 enable_irq(client->irq); 1138 1138
+1
drivers/iio/adc/twl4030-madc.c
··· 30 30 #include <linux/types.h> 31 31 #include <linux/gfp.h> 32 32 #include <linux/err.h> 33 + #include <linux/of.h> 33 34 #include <linux/regulator/consumer.h> 34 35 35 36 #include <linux/iio/iio.h>
+2 -1
drivers/input/input.c
··· 21 21 #include <linux/seq_file.h> 22 22 #include <linux/poll.h> 23 23 #include <linux/device.h> 24 + #include <linux/kstrtox.h> 24 25 #include <linux/mutex.h> 25 26 #include <linux/rcupdate.h> 26 27 #include "input-compat.h" ··· 1466 1465 ssize_t rv; 1467 1466 bool inhibited; 1468 1467 1469 - if (strtobool(buf, &inhibited)) 1468 + if (kstrtobool(buf, &inhibited)) 1470 1469 return -EINVAL; 1471 1470 1472 1471 if (inhibited)
+1
drivers/input/joystick/Kconfig
··· 46 46 config JOYSTICK_ADC 47 47 tristate "Simple joystick connected over ADC" 48 48 depends on IIO 49 + select IIO_BUFFER 49 50 select IIO_BUFFER_CB 50 51 help 51 52 Say Y here if you have a simple joystick connected over ADC.
+2 -3
drivers/input/joystick/as5011.c
··· 212 212 return 0; 213 213 } 214 214 215 - static int as5011_probe(struct i2c_client *client, 216 - const struct i2c_device_id *id) 215 + static int as5011_probe(struct i2c_client *client) 217 216 { 218 217 const struct as5011_platform_data *plat_data; 219 218 struct as5011_device *as5011; ··· 348 349 .driver = { 349 350 .name = "as5011", 350 351 }, 351 - .probe = as5011_probe, 352 + .probe_new = as5011_probe, 352 353 .remove = as5011_remove, 353 354 .id_table = as5011_id, 354 355 };
+6 -3
drivers/input/joystick/psxpad-spi.c
··· 44 44 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 45 45 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 46 46 }; 47 + 48 + #ifdef CONFIG_JOYSTICK_PSXPAD_SPI_FF 47 49 /* 0x01, 0x43, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 */ 48 50 static const u8 PSX_CMD_ENTER_CFG[] = { 49 51 0x80, 0xC2, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00 ··· 58 56 static const u8 PSX_CMD_ENABLE_MOTOR[] = { 59 57 0x80, 0xB2, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0xFF 60 58 }; 59 + #endif /* CONFIG_JOYSTICK_PSXPAD_SPI_FF */ 61 60 62 61 struct psxpad { 63 62 struct spi_device *spi; ··· 374 371 return 0; 375 372 } 376 373 377 - static int __maybe_unused psxpad_spi_suspend(struct device *dev) 374 + static int psxpad_spi_suspend(struct device *dev) 378 375 { 379 376 struct spi_device *spi = to_spi_device(dev); 380 377 struct psxpad *pad = spi_get_drvdata(spi); ··· 384 381 return 0; 385 382 } 386 383 387 - static SIMPLE_DEV_PM_OPS(psxpad_spi_pm, psxpad_spi_suspend, NULL); 384 + static DEFINE_SIMPLE_DEV_PM_OPS(psxpad_spi_pm, psxpad_spi_suspend, NULL); 388 385 389 386 static const struct spi_device_id psxpad_spi_id[] = { 390 387 { "psxpad-spi", 0 }, ··· 395 392 static struct spi_driver psxpad_spi_driver = { 396 393 .driver = { 397 394 .name = "psxpad-spi", 398 - .pm = &psxpad_spi_pm, 395 + .pm = pm_sleep_ptr(&psxpad_spi_pm), 399 396 }, 400 397 .id_table = psxpad_spi_id, 401 398 .probe = psxpad_spi_probe,
+5 -5
drivers/input/keyboard/Kconfig
··· 390 390 391 391 config KEYBOARD_LPC32XX 392 392 tristate "LPC32XX matrix key scanner support" 393 - depends on ARCH_LPC32XX && OF 393 + depends on (ARCH_LPC32XX && OF) || COMPILE_TEST 394 394 select INPUT_MATRIXKMAP 395 395 help 396 396 Say Y here if you want to use NXP LPC32XX SoC key scanner interface, ··· 487 487 488 488 config KEYBOARD_NOMADIK 489 489 tristate "ST-Ericsson Nomadik SKE keyboard" 490 - depends on (ARCH_NOMADIK || ARCH_U8500) 490 + depends on (ARCH_NOMADIK || ARCH_U8500 || COMPILE_TEST) 491 491 select INPUT_MATRIXKMAP 492 492 help 493 493 Say Y here if you want to use a keypad provided on the SKE controller ··· 508 508 509 509 config KEYBOARD_TEGRA 510 510 tristate "NVIDIA Tegra internal matrix keyboard controller support" 511 - depends on ARCH_TEGRA && OF 511 + depends on (ARCH_TEGRA && OF) || COMPILE_TEST 512 512 select INPUT_MATRIXKMAP 513 513 help 514 514 Say Y here if you want to use a matrix keyboard connected directly ··· 542 542 543 543 config KEYBOARD_PXA27x 544 544 tristate "PXA27x/PXA3xx keypad support" 545 - depends on PXA27x || PXA3xx || ARCH_MMP 545 + depends on PXA27x || PXA3xx || ARCH_MMP || COMPILE_TEST 546 546 select INPUT_MATRIXKMAP 547 547 help 548 548 Enable support for PXA27x/PXA3xx keypad controller. ··· 709 709 710 710 config KEYBOARD_SPEAR 711 711 tristate "ST SPEAR keyboard support" 712 - depends on PLAT_SPEAR 712 + depends on PLAT_SPEAR || COMPILE_TEST 713 713 select INPUT_MATRIXKMAP 714 714 help 715 715 Say Y here if you want to use the SPEAR keyboard.
+2 -3
drivers/input/keyboard/adp5588-keys.c
··· 718 718 regulator_disable(reg); 719 719 } 720 720 721 - static int adp5588_probe(struct i2c_client *client, 722 - const struct i2c_device_id *id) 721 + static int adp5588_probe(struct i2c_client *client) 723 722 { 724 723 struct adp5588_kpad *kpad; 725 724 struct input_dev *input; ··· 866 867 .of_match_table = adp5588_of_match, 867 868 .pm = pm_sleep_ptr(&adp5588_dev_pm_ops), 868 869 }, 869 - .probe = adp5588_probe, 870 + .probe_new = adp5588_probe, 870 871 .remove = adp5588_remove, 871 872 .id_table = adp5588_id, 872 873 };
+7 -7
drivers/input/keyboard/adp5589-keys.c
··· 942 942 adp5589_write(client, kpad->var->reg(ADP5589_GENERAL_CFG), 0); 943 943 } 944 944 945 - static int adp5589_probe(struct i2c_client *client, 946 - const struct i2c_device_id *id) 945 + static int adp5589_probe(struct i2c_client *client) 947 946 { 947 + const struct i2c_device_id *id = i2c_client_get_device_id(client); 948 948 struct adp5589_kpad *kpad; 949 949 const struct adp5589_kpad_platform_data *pdata = 950 950 dev_get_platdata(&client->dev); ··· 1016 1016 return 0; 1017 1017 } 1018 1018 1019 - static int __maybe_unused adp5589_suspend(struct device *dev) 1019 + static int adp5589_suspend(struct device *dev) 1020 1020 { 1021 1021 struct i2c_client *client = to_i2c_client(dev); 1022 1022 struct adp5589_kpad *kpad = i2c_get_clientdata(client); ··· 1027 1027 return 0; 1028 1028 } 1029 1029 1030 - static int __maybe_unused adp5589_resume(struct device *dev) 1030 + static int adp5589_resume(struct device *dev) 1031 1031 { 1032 1032 struct i2c_client *client = to_i2c_client(dev); 1033 1033 struct adp5589_kpad *kpad = i2c_get_clientdata(client); ··· 1038 1038 return 0; 1039 1039 } 1040 1040 1041 - static SIMPLE_DEV_PM_OPS(adp5589_dev_pm_ops, adp5589_suspend, adp5589_resume); 1041 + static DEFINE_SIMPLE_DEV_PM_OPS(adp5589_dev_pm_ops, adp5589_suspend, adp5589_resume); 1042 1042 1043 1043 static const struct i2c_device_id adp5589_id[] = { 1044 1044 {"adp5589-keys", ADP5589}, ··· 1052 1052 static struct i2c_driver adp5589_driver = { 1053 1053 .driver = { 1054 1054 .name = KBUILD_MODNAME, 1055 - .pm = &adp5589_dev_pm_ops, 1055 + .pm = pm_sleep_ptr(&adp5589_dev_pm_ops), 1056 1056 }, 1057 - .probe = adp5589_probe, 1057 + .probe_new = adp5589_probe, 1058 1058 .id_table = adp5589_id, 1059 1059 }; 1060 1060
+3 -3
drivers/input/keyboard/cap11xx.c
··· 321 321 } 322 322 #endif 323 323 324 - static int cap11xx_i2c_probe(struct i2c_client *i2c_client, 325 - const struct i2c_device_id *id) 324 + static int cap11xx_i2c_probe(struct i2c_client *i2c_client) 326 325 { 326 + const struct i2c_device_id *id = i2c_client_get_device_id(i2c_client); 327 327 struct device *dev = &i2c_client->dev; 328 328 struct cap11xx_priv *priv; 329 329 struct device_node *node; ··· 503 503 .of_match_table = cap11xx_dt_ids, 504 504 }, 505 505 .id_table = cap11xx_i2c_ids, 506 - .probe = cap11xx_i2c_probe, 506 + .probe_new = cap11xx_i2c_probe, 507 507 }; 508 508 509 509 module_i2c_driver(cap11xx_i2c_driver);
+3 -3
drivers/input/keyboard/cros_ec_keyb.c
··· 415 415 * 416 416 * Returns 0 if no error or -error upon error. 417 417 */ 418 - static __maybe_unused int cros_ec_keyb_resume(struct device *dev) 418 + static int cros_ec_keyb_resume(struct device *dev) 419 419 { 420 420 struct cros_ec_keyb *ckdev = dev_get_drvdata(dev); 421 421 ··· 760 760 MODULE_DEVICE_TABLE(of, cros_ec_keyb_of_match); 761 761 #endif 762 762 763 - static SIMPLE_DEV_PM_OPS(cros_ec_keyb_pm_ops, NULL, cros_ec_keyb_resume); 763 + static DEFINE_SIMPLE_DEV_PM_OPS(cros_ec_keyb_pm_ops, NULL, cros_ec_keyb_resume); 764 764 765 765 static struct platform_driver cros_ec_keyb_driver = { 766 766 .probe = cros_ec_keyb_probe, ··· 769 769 .name = "cros-ec-keyb", 770 770 .of_match_table = of_match_ptr(cros_ec_keyb_of_match), 771 771 .acpi_match_table = ACPI_PTR(cros_ec_keyb_acpi_match), 772 - .pm = &cros_ec_keyb_pm_ops, 772 + .pm = pm_sleep_ptr(&cros_ec_keyb_pm_ops), 773 773 }, 774 774 }; 775 775
+5 -5
drivers/input/keyboard/cypress-sf.c
··· 168 168 return 0; 169 169 }; 170 170 171 - static int __maybe_unused cypress_sf_suspend(struct device *dev) 171 + static int cypress_sf_suspend(struct device *dev) 172 172 { 173 173 struct i2c_client *client = to_i2c_client(dev); 174 174 struct cypress_sf_data *touchkey = i2c_get_clientdata(client); ··· 187 187 return 0; 188 188 } 189 189 190 - static int __maybe_unused cypress_sf_resume(struct device *dev) 190 + static int cypress_sf_resume(struct device *dev) 191 191 { 192 192 struct i2c_client *client = to_i2c_client(dev); 193 193 struct cypress_sf_data *touchkey = i2c_get_clientdata(client); ··· 205 205 return 0; 206 206 } 207 207 208 - static SIMPLE_DEV_PM_OPS(cypress_sf_pm_ops, 209 - cypress_sf_suspend, cypress_sf_resume); 208 + static DEFINE_SIMPLE_DEV_PM_OPS(cypress_sf_pm_ops, 209 + cypress_sf_suspend, cypress_sf_resume); 210 210 211 211 static struct i2c_device_id cypress_sf_id_table[] = { 212 212 { CYPRESS_SF_DEV_NAME, 0 }, ··· 225 225 static struct i2c_driver cypress_sf_driver = { 226 226 .driver = { 227 227 .name = CYPRESS_SF_DEV_NAME, 228 - .pm = &cypress_sf_pm_ops, 228 + .pm = pm_sleep_ptr(&cypress_sf_pm_ops), 229 229 .of_match_table = of_match_ptr(cypress_sf_of_match), 230 230 }, 231 231 .id_table = cypress_sf_id_table,
+5 -5
drivers/input/keyboard/ep93xx_keypad.c
··· 178 178 } 179 179 180 180 181 - static int __maybe_unused ep93xx_keypad_suspend(struct device *dev) 181 + static int ep93xx_keypad_suspend(struct device *dev) 182 182 { 183 183 struct platform_device *pdev = to_platform_device(dev); 184 184 struct ep93xx_keypad *keypad = platform_get_drvdata(pdev); ··· 196 196 return 0; 197 197 } 198 198 199 - static int __maybe_unused ep93xx_keypad_resume(struct device *dev) 199 + static int ep93xx_keypad_resume(struct device *dev) 200 200 { 201 201 struct platform_device *pdev = to_platform_device(dev); 202 202 struct ep93xx_keypad *keypad = platform_get_drvdata(pdev); ··· 217 217 return 0; 218 218 } 219 219 220 - static SIMPLE_DEV_PM_OPS(ep93xx_keypad_pm_ops, 221 - ep93xx_keypad_suspend, ep93xx_keypad_resume); 220 + static DEFINE_SIMPLE_DEV_PM_OPS(ep93xx_keypad_pm_ops, 221 + ep93xx_keypad_suspend, ep93xx_keypad_resume); 222 222 223 223 static void ep93xx_keypad_release_gpio_action(void *_pdev) 224 224 { ··· 318 318 static struct platform_driver ep93xx_keypad_driver = { 319 319 .driver = { 320 320 .name = "ep93xx-keypad", 321 - .pm = &ep93xx_keypad_pm_ops, 321 + .pm = pm_sleep_ptr(&ep93xx_keypad_pm_ops), 322 322 }, 323 323 .probe = ep93xx_keypad_probe, 324 324 .remove = ep93xx_keypad_remove,
+4 -4
drivers/input/keyboard/gpio_keys.c
··· 992 992 } 993 993 } 994 994 995 - static int __maybe_unused gpio_keys_suspend(struct device *dev) 995 + static int gpio_keys_suspend(struct device *dev) 996 996 { 997 997 struct gpio_keys_drvdata *ddata = dev_get_drvdata(dev); 998 998 struct input_dev *input = ddata->input; ··· 1012 1012 return 0; 1013 1013 } 1014 1014 1015 - static int __maybe_unused gpio_keys_resume(struct device *dev) 1015 + static int gpio_keys_resume(struct device *dev) 1016 1016 { 1017 1017 struct gpio_keys_drvdata *ddata = dev_get_drvdata(dev); 1018 1018 struct input_dev *input = ddata->input; ··· 1034 1034 return 0; 1035 1035 } 1036 1036 1037 - static SIMPLE_DEV_PM_OPS(gpio_keys_pm_ops, gpio_keys_suspend, gpio_keys_resume); 1037 + static DEFINE_SIMPLE_DEV_PM_OPS(gpio_keys_pm_ops, gpio_keys_suspend, gpio_keys_resume); 1038 1038 1039 1039 static void gpio_keys_shutdown(struct platform_device *pdev) 1040 1040 { ··· 1050 1050 .shutdown = gpio_keys_shutdown, 1051 1051 .driver = { 1052 1052 .name = "gpio-keys", 1053 - .pm = &gpio_keys_pm_ops, 1053 + .pm = pm_sleep_ptr(&gpio_keys_pm_ops), 1054 1054 .of_match_table = gpio_keys_of_match, 1055 1055 .dev_groups = gpio_keys_groups, 1056 1056 }
+5 -5
drivers/input/keyboard/ipaq-micro-keys.c
··· 124 124 return 0; 125 125 } 126 126 127 - static int __maybe_unused micro_key_suspend(struct device *dev) 127 + static int micro_key_suspend(struct device *dev) 128 128 { 129 129 struct ipaq_micro_keys *keys = dev_get_drvdata(dev); 130 130 ··· 133 133 return 0; 134 134 } 135 135 136 - static int __maybe_unused micro_key_resume(struct device *dev) 136 + static int micro_key_resume(struct device *dev) 137 137 { 138 138 struct ipaq_micro_keys *keys = dev_get_drvdata(dev); 139 139 struct input_dev *input = keys->input; ··· 148 148 return 0; 149 149 } 150 150 151 - static SIMPLE_DEV_PM_OPS(micro_key_dev_pm_ops, 152 - micro_key_suspend, micro_key_resume); 151 + static DEFINE_SIMPLE_DEV_PM_OPS(micro_key_dev_pm_ops, 152 + micro_key_suspend, micro_key_resume); 153 153 154 154 static struct platform_driver micro_key_device_driver = { 155 155 .driver = { 156 156 .name = "ipaq-micro-keys", 157 - .pm = &micro_key_dev_pm_ops, 157 + .pm = pm_sleep_ptr(&micro_key_dev_pm_ops), 158 158 }, 159 159 .probe = micro_key_probe, 160 160 };
+4 -7
drivers/input/keyboard/lm8323.c
··· 615 615 } 616 616 static DEVICE_ATTR(disable_kp, 0644, lm8323_show_disable, lm8323_set_disable); 617 617 618 - static int lm8323_probe(struct i2c_client *client, 619 - const struct i2c_device_id *id) 618 + static int lm8323_probe(struct i2c_client *client) 620 619 { 621 620 struct lm8323_platform_data *pdata = dev_get_platdata(&client->dev); 622 621 struct input_dev *idev; ··· 770 771 kfree(lm); 771 772 } 772 773 773 - #ifdef CONFIG_PM_SLEEP 774 774 /* 775 775 * We don't need to explicitly suspend the chip, as it already switches off 776 776 * when there's no activity. ··· 813 815 814 816 return 0; 815 817 } 816 - #endif 817 818 818 - static SIMPLE_DEV_PM_OPS(lm8323_pm_ops, lm8323_suspend, lm8323_resume); 819 + static DEFINE_SIMPLE_DEV_PM_OPS(lm8323_pm_ops, lm8323_suspend, lm8323_resume); 819 820 820 821 static const struct i2c_device_id lm8323_id[] = { 821 822 { "lm8323", 0 }, ··· 824 827 static struct i2c_driver lm8323_i2c_driver = { 825 828 .driver = { 826 829 .name = "lm8323", 827 - .pm = &lm8323_pm_ops, 830 + .pm = pm_sleep_ptr(&lm8323_pm_ops), 828 831 }, 829 - .probe = lm8323_probe, 832 + .probe_new = lm8323_probe, 830 833 .remove = lm8323_remove, 831 834 .id_table = lm8323_id, 832 835 };
+2 -3
drivers/input/keyboard/lm8333.c
··· 125 125 return IRQ_HANDLED; 126 126 } 127 127 128 - static int lm8333_probe(struct i2c_client *client, 129 - const struct i2c_device_id *id) 128 + static int lm8333_probe(struct i2c_client *client) 130 129 { 131 130 const struct lm8333_platform_data *pdata = 132 131 dev_get_platdata(&client->dev); ··· 218 219 .driver = { 219 220 .name = "lm8333", 220 221 }, 221 - .probe = lm8333_probe, 222 + .probe_new = lm8333_probe, 222 223 .remove = lm8333_remove, 223 224 .id_table = lm8333_id, 224 225 };
+3 -5
drivers/input/keyboard/lpc32xx-keys.c
··· 264 264 return 0; 265 265 } 266 266 267 - #ifdef CONFIG_PM_SLEEP 268 267 static int lpc32xx_kscan_suspend(struct device *dev) 269 268 { 270 269 struct platform_device *pdev = to_platform_device(dev); ··· 301 302 mutex_unlock(&input->mutex); 302 303 return retval; 303 304 } 304 - #endif 305 305 306 - static SIMPLE_DEV_PM_OPS(lpc32xx_kscan_pm_ops, lpc32xx_kscan_suspend, 307 - lpc32xx_kscan_resume); 306 + static DEFINE_SIMPLE_DEV_PM_OPS(lpc32xx_kscan_pm_ops, lpc32xx_kscan_suspend, 307 + lpc32xx_kscan_resume); 308 308 309 309 static const struct of_device_id lpc32xx_kscan_match[] = { 310 310 { .compatible = "nxp,lpc3220-key" }, ··· 315 317 .probe = lpc32xx_kscan_probe, 316 318 .driver = { 317 319 .name = DRV_NAME, 318 - .pm = &lpc32xx_kscan_pm_ops, 320 + .pm = pm_sleep_ptr(&lpc32xx_kscan_pm_ops), 319 321 .of_match_table = lpc32xx_kscan_match, 320 322 } 321 323 };
+6 -5
drivers/input/keyboard/matrix_keypad.c
··· 127 127 128 128 memset(new_state, 0, sizeof(new_state)); 129 129 130 + for (row = 0; row < pdata->num_row_gpios; row++) 131 + gpio_direction_input(pdata->row_gpios[row]); 132 + 130 133 /* assert each column and read the row status out */ 131 134 for (col = 0; col < pdata->num_col_gpios; col++) { 132 135 ··· 230 227 disable_row_irqs(keypad); 231 228 } 232 229 233 - #ifdef CONFIG_PM_SLEEP 234 230 static void matrix_keypad_enable_wakeup(struct matrix_keypad *keypad) 235 231 { 236 232 const struct matrix_keypad_platform_data *pdata = keypad->pdata; ··· 298 296 299 297 return 0; 300 298 } 301 - #endif 302 299 303 - static SIMPLE_DEV_PM_OPS(matrix_keypad_pm_ops, 304 - matrix_keypad_suspend, matrix_keypad_resume); 300 + static DEFINE_SIMPLE_DEV_PM_OPS(matrix_keypad_pm_ops, 301 + matrix_keypad_suspend, matrix_keypad_resume); 305 302 306 303 static int matrix_keypad_init_gpio(struct platform_device *pdev, 307 304 struct matrix_keypad *keypad) ··· 575 574 .remove = matrix_keypad_remove, 576 575 .driver = { 577 576 .name = "matrix-keypad", 578 - .pm = &matrix_keypad_pm_ops, 577 + .pm = pm_sleep_ptr(&matrix_keypad_pm_ops), 579 578 .of_match_table = of_match_ptr(matrix_keypad_dt_match), 580 579 }, 581 580 };
+4 -7
drivers/input/keyboard/max7359_keypad.c
··· 155 155 max7359_fall_deepsleep(client); 156 156 } 157 157 158 - static int max7359_probe(struct i2c_client *client, 159 - const struct i2c_device_id *id) 158 + static int max7359_probe(struct i2c_client *client) 160 159 { 161 160 const struct matrix_keymap_data *keymap_data = 162 161 dev_get_platdata(&client->dev); ··· 242 243 return 0; 243 244 } 244 245 245 - #ifdef CONFIG_PM_SLEEP 246 246 static int max7359_suspend(struct device *dev) 247 247 { 248 248 struct i2c_client *client = to_i2c_client(dev); ··· 266 268 267 269 return 0; 268 270 } 269 - #endif 270 271 271 - static SIMPLE_DEV_PM_OPS(max7359_pm, max7359_suspend, max7359_resume); 272 + static DEFINE_SIMPLE_DEV_PM_OPS(max7359_pm, max7359_suspend, max7359_resume); 272 273 273 274 static const struct i2c_device_id max7359_ids[] = { 274 275 { "max7359", 0 }, ··· 278 281 static struct i2c_driver max7359_i2c_driver = { 279 282 .driver = { 280 283 .name = "max7359", 281 - .pm = &max7359_pm, 284 + .pm = pm_sleep_ptr(&max7359_pm), 282 285 }, 283 - .probe = max7359_probe, 286 + .probe_new = max7359_probe, 284 287 .id_table = max7359_ids, 285 288 }; 286 289
+6 -8
drivers/input/keyboard/mcs_touchkey.c
··· 92 92 return IRQ_HANDLED; 93 93 } 94 94 95 - static int mcs_touchkey_probe(struct i2c_client *client, 96 - const struct i2c_device_id *id) 95 + static int mcs_touchkey_probe(struct i2c_client *client) 97 96 { 97 + const struct i2c_device_id *id = i2c_client_get_device_id(client); 98 98 const struct mcs_platform_data *pdata; 99 99 struct mcs_touchkey_data *data; 100 100 struct input_dev *input_dev; ··· 213 213 data->poweron(false); 214 214 } 215 215 216 - #ifdef CONFIG_PM_SLEEP 217 216 static int mcs_touchkey_suspend(struct device *dev) 218 217 { 219 218 struct mcs_touchkey_data *data = dev_get_drvdata(dev); ··· 242 243 243 244 return 0; 244 245 } 245 - #endif 246 246 247 - static SIMPLE_DEV_PM_OPS(mcs_touchkey_pm_ops, 248 - mcs_touchkey_suspend, mcs_touchkey_resume); 247 + static DEFINE_SIMPLE_DEV_PM_OPS(mcs_touchkey_pm_ops, 248 + mcs_touchkey_suspend, mcs_touchkey_resume); 249 249 250 250 static const struct i2c_device_id mcs_touchkey_id[] = { 251 251 { "mcs5000_touchkey", MCS5000_TOUCHKEY }, ··· 256 258 static struct i2c_driver mcs_touchkey_driver = { 257 259 .driver = { 258 260 .name = "mcs_touchkey", 259 - .pm = &mcs_touchkey_pm_ops, 261 + .pm = pm_sleep_ptr(&mcs_touchkey_pm_ops), 260 262 }, 261 - .probe = mcs_touchkey_probe, 263 + .probe_new = mcs_touchkey_probe, 262 264 .remove = mcs_touchkey_remove, 263 265 .shutdown = mcs_touchkey_shutdown, 264 266 .id_table = mcs_touchkey_id,
+6 -7
drivers/input/keyboard/mpr121_touchkey.c
··· 230 230 return ret; 231 231 } 232 232 233 - static int mpr_touchkey_probe(struct i2c_client *client, 234 - const struct i2c_device_id *id) 233 + static int mpr_touchkey_probe(struct i2c_client *client) 235 234 { 236 235 struct device *dev = &client->dev; 237 236 struct regulator *vdd_supply; ··· 340 341 return 0; 341 342 } 342 343 343 - static int __maybe_unused mpr_suspend(struct device *dev) 344 + static int mpr_suspend(struct device *dev) 344 345 { 345 346 struct i2c_client *client = to_i2c_client(dev); 346 347 ··· 352 353 return 0; 353 354 } 354 355 355 - static int __maybe_unused mpr_resume(struct device *dev) 356 + static int mpr_resume(struct device *dev) 356 357 { 357 358 struct i2c_client *client = to_i2c_client(dev); 358 359 struct mpr121_touchkey *mpr121 = i2c_get_clientdata(client); ··· 366 367 return 0; 367 368 } 368 369 369 - static SIMPLE_DEV_PM_OPS(mpr121_touchkey_pm_ops, mpr_suspend, mpr_resume); 370 + static DEFINE_SIMPLE_DEV_PM_OPS(mpr121_touchkey_pm_ops, mpr_suspend, mpr_resume); 370 371 371 372 static const struct i2c_device_id mpr121_id[] = { 372 373 { "mpr121_touchkey", 0 }, ··· 385 386 static struct i2c_driver mpr_touchkey_driver = { 386 387 .driver = { 387 388 .name = "mpr121", 388 - .pm = &mpr121_touchkey_pm_ops, 389 + .pm = pm_sleep_ptr(&mpr121_touchkey_pm_ops), 389 390 .of_match_table = of_match_ptr(mpr121_touchkey_dt_match_table), 390 391 }, 391 392 .id_table = mpr121_id, 392 - .probe = mpr_touchkey_probe, 393 + .probe_new = mpr_touchkey_probe, 393 394 }; 394 395 395 396 module_i2c_driver(mpr_touchkey_driver);
+5 -5
drivers/input/keyboard/mtk-pmic-keys.c
··· 231 231 return 0; 232 232 } 233 233 234 - static int __maybe_unused mtk_pmic_keys_suspend(struct device *dev) 234 + static int mtk_pmic_keys_suspend(struct device *dev) 235 235 { 236 236 struct mtk_pmic_keys *keys = dev_get_drvdata(dev); 237 237 int index; ··· 247 247 return 0; 248 248 } 249 249 250 - static int __maybe_unused mtk_pmic_keys_resume(struct device *dev) 250 + static int mtk_pmic_keys_resume(struct device *dev) 251 251 { 252 252 struct mtk_pmic_keys *keys = dev_get_drvdata(dev); 253 253 int index; ··· 263 263 return 0; 264 264 } 265 265 266 - static SIMPLE_DEV_PM_OPS(mtk_pmic_keys_pm_ops, mtk_pmic_keys_suspend, 267 - mtk_pmic_keys_resume); 266 + static DEFINE_SIMPLE_DEV_PM_OPS(mtk_pmic_keys_pm_ops, mtk_pmic_keys_suspend, 267 + mtk_pmic_keys_resume); 268 268 269 269 static const struct of_device_id of_mtk_pmic_keys_match_tbl[] = { 270 270 { ··· 387 387 .driver = { 388 388 .name = "mtk-pmic-keys", 389 389 .of_match_table = of_mtk_pmic_keys_match_tbl, 390 - .pm = &mtk_pmic_keys_pm_ops, 390 + .pm = pm_sleep_ptr(&mtk_pmic_keys_pm_ops), 391 391 }, 392 392 }; 393 393
+3 -5
drivers/input/keyboard/nomadik-ske-keypad.c
··· 388 388 return 0; 389 389 } 390 390 391 - #ifdef CONFIG_PM_SLEEP 392 391 static int ske_keypad_suspend(struct device *dev) 393 392 { 394 393 struct platform_device *pdev = to_platform_device(dev); ··· 415 416 416 417 return 0; 417 418 } 418 - #endif 419 419 420 - static SIMPLE_DEV_PM_OPS(ske_keypad_dev_pm_ops, 421 - ske_keypad_suspend, ske_keypad_resume); 420 + static DEFINE_SIMPLE_DEV_PM_OPS(ske_keypad_dev_pm_ops, 421 + ske_keypad_suspend, ske_keypad_resume); 422 422 423 423 static struct platform_driver ske_keypad_driver = { 424 424 .driver = { 425 425 .name = "nmk-ske-keypad", 426 - .pm = &ske_keypad_dev_pm_ops, 426 + .pm = pm_sleep_ptr(&ske_keypad_dev_pm_ops), 427 427 }, 428 428 .remove = ske_keypad_remove, 429 429 };
+3 -5
drivers/input/keyboard/pmic8xxx-keypad.c
··· 621 621 return 0; 622 622 } 623 623 624 - #ifdef CONFIG_PM_SLEEP 625 624 static int pmic8xxx_kp_suspend(struct device *dev) 626 625 { 627 626 struct platform_device *pdev = to_platform_device(dev); ··· 660 661 661 662 return 0; 662 663 } 663 - #endif 664 664 665 - static SIMPLE_DEV_PM_OPS(pm8xxx_kp_pm_ops, 666 - pmic8xxx_kp_suspend, pmic8xxx_kp_resume); 665 + static DEFINE_SIMPLE_DEV_PM_OPS(pm8xxx_kp_pm_ops, 666 + pmic8xxx_kp_suspend, pmic8xxx_kp_resume); 667 667 668 668 static const struct of_device_id pm8xxx_match_table[] = { 669 669 { .compatible = "qcom,pm8058-keypad" }, ··· 675 677 .probe = pmic8xxx_kp_probe, 676 678 .driver = { 677 679 .name = "pm8xxx-keypad", 678 - .pm = &pm8xxx_kp_pm_ops, 680 + .pm = pm_sleep_ptr(&pm8xxx_kp_pm_ops), 679 681 .of_match_table = pm8xxx_match_table, 680 682 }, 681 683 };
+3 -5
drivers/input/keyboard/pxa27x_keypad.c
··· 660 660 clk_disable_unprepare(keypad->clk); 661 661 } 662 662 663 - #ifdef CONFIG_PM_SLEEP 664 663 static int pxa27x_keypad_suspend(struct device *dev) 665 664 { 666 665 struct platform_device *pdev = to_platform_device(dev); ··· 705 706 706 707 return ret; 707 708 } 708 - #endif 709 709 710 - static SIMPLE_DEV_PM_OPS(pxa27x_keypad_pm_ops, 711 - pxa27x_keypad_suspend, pxa27x_keypad_resume); 710 + static DEFINE_SIMPLE_DEV_PM_OPS(pxa27x_keypad_pm_ops, 711 + pxa27x_keypad_suspend, pxa27x_keypad_resume); 712 712 713 713 714 714 static int pxa27x_keypad_probe(struct platform_device *pdev) ··· 828 830 .driver = { 829 831 .name = "pxa27x-keypad", 830 832 .of_match_table = of_match_ptr(pxa27x_keypad_dt_match), 831 - .pm = &pxa27x_keypad_pm_ops, 833 + .pm = pm_sleep_ptr(&pxa27x_keypad_pm_ops), 832 834 }, 833 835 }; 834 836 module_platform_driver(pxa27x_keypad_driver);
+4 -4
drivers/input/keyboard/qt1050.c
··· 547 547 return 0; 548 548 } 549 549 550 - static int __maybe_unused qt1050_suspend(struct device *dev) 550 + static int qt1050_suspend(struct device *dev) 551 551 { 552 552 struct i2c_client *client = to_i2c_client(dev); 553 553 struct qt1050_priv *ts = i2c_get_clientdata(client); ··· 563 563 device_may_wakeup(dev) ? 125 : 0); 564 564 } 565 565 566 - static int __maybe_unused qt1050_resume(struct device *dev) 566 + static int qt1050_resume(struct device *dev) 567 567 { 568 568 struct i2c_client *client = to_i2c_client(dev); 569 569 struct qt1050_priv *ts = i2c_get_clientdata(client); ··· 574 574 return regmap_write(ts->regmap, QT1050_LPMODE, 2); 575 575 } 576 576 577 - static SIMPLE_DEV_PM_OPS(qt1050_pm_ops, qt1050_suspend, qt1050_resume); 577 + static DEFINE_SIMPLE_DEV_PM_OPS(qt1050_pm_ops, qt1050_suspend, qt1050_resume); 578 578 579 579 static const struct of_device_id __maybe_unused qt1050_of_match[] = { 580 580 { .compatible = "microchip,qt1050", }, ··· 586 586 .driver = { 587 587 .name = "qt1050", 588 588 .of_match_table = of_match_ptr(qt1050_of_match), 589 - .pm = &qt1050_pm_ops, 589 + .pm = pm_sleep_ptr(&qt1050_pm_ops), 590 590 }, 591 591 .probe_new = qt1050_probe, 592 592 };
+4 -7
drivers/input/keyboard/qt1070.c
··· 126 126 return IRQ_HANDLED; 127 127 } 128 128 129 - static int qt1070_probe(struct i2c_client *client, 130 - const struct i2c_device_id *id) 129 + static int qt1070_probe(struct i2c_client *client) 131 130 { 132 131 struct qt1070_data *data; 133 132 struct input_dev *input; ··· 226 227 kfree(data); 227 228 } 228 229 229 - #ifdef CONFIG_PM_SLEEP 230 230 static int qt1070_suspend(struct device *dev) 231 231 { 232 232 struct i2c_client *client = to_i2c_client(dev); ··· 247 249 248 250 return 0; 249 251 } 250 - #endif 251 252 252 - static SIMPLE_DEV_PM_OPS(qt1070_pm_ops, qt1070_suspend, qt1070_resume); 253 + static DEFINE_SIMPLE_DEV_PM_OPS(qt1070_pm_ops, qt1070_suspend, qt1070_resume); 253 254 254 255 static const struct i2c_device_id qt1070_id[] = { 255 256 { "qt1070", 0 }, ··· 268 271 .driver = { 269 272 .name = "qt1070", 270 273 .of_match_table = of_match_ptr(qt1070_of_match), 271 - .pm = &qt1070_pm_ops, 274 + .pm = pm_sleep_ptr(&qt1070_pm_ops), 272 275 }, 273 276 .id_table = qt1070_id, 274 - .probe = qt1070_probe, 277 + .probe_new = qt1070_probe, 275 278 .remove = qt1070_remove, 276 279 }; 277 280
+2 -3
drivers/input/keyboard/qt2160.c
··· 338 338 return true; 339 339 } 340 340 341 - static int qt2160_probe(struct i2c_client *client, 342 - const struct i2c_device_id *id) 341 + static int qt2160_probe(struct i2c_client *client) 343 342 { 344 343 struct qt2160_data *qt2160; 345 344 struct input_dev *input; ··· 460 461 }, 461 462 462 463 .id_table = qt2160_idtable, 463 - .probe = qt2160_probe, 464 + .probe_new = qt2160_probe, 464 465 .remove = qt2160_remove, 465 466 }; 466 467
+3 -5
drivers/input/keyboard/sh_keysc.c
··· 283 283 return 0; 284 284 } 285 285 286 - #ifdef CONFIG_PM_SLEEP 287 286 static int sh_keysc_suspend(struct device *dev) 288 287 { 289 288 struct platform_device *pdev = to_platform_device(dev); ··· 315 316 316 317 return 0; 317 318 } 318 - #endif 319 319 320 - static SIMPLE_DEV_PM_OPS(sh_keysc_dev_pm_ops, 321 - sh_keysc_suspend, sh_keysc_resume); 320 + static DEFINE_SIMPLE_DEV_PM_OPS(sh_keysc_dev_pm_ops, 321 + sh_keysc_suspend, sh_keysc_resume); 322 322 323 323 static struct platform_driver sh_keysc_device_driver = { 324 324 .probe = sh_keysc_probe, 325 325 .remove = sh_keysc_remove, 326 326 .driver = { 327 327 .name = "sh_keysc", 328 - .pm = &sh_keysc_dev_pm_ops, 328 + .pm = pm_sleep_ptr(&sh_keysc_dev_pm_ops), 329 329 } 330 330 }; 331 331 module_platform_driver(sh_keysc_device_driver);
+5 -4
drivers/input/keyboard/spear-keyboard.c
··· 284 284 return 0; 285 285 } 286 286 287 - static int __maybe_unused spear_kbd_suspend(struct device *dev) 287 + static int spear_kbd_suspend(struct device *dev) 288 288 { 289 289 struct platform_device *pdev = to_platform_device(dev); 290 290 struct spear_kbd *kbd = platform_get_drvdata(pdev); ··· 337 337 return 0; 338 338 } 339 339 340 - static int __maybe_unused spear_kbd_resume(struct device *dev) 340 + static int spear_kbd_resume(struct device *dev) 341 341 { 342 342 struct platform_device *pdev = to_platform_device(dev); 343 343 struct spear_kbd *kbd = platform_get_drvdata(pdev); ··· 364 364 return 0; 365 365 } 366 366 367 - static SIMPLE_DEV_PM_OPS(spear_kbd_pm_ops, spear_kbd_suspend, spear_kbd_resume); 367 + static DEFINE_SIMPLE_DEV_PM_OPS(spear_kbd_pm_ops, 368 + spear_kbd_suspend, spear_kbd_resume); 368 369 369 370 #ifdef CONFIG_OF 370 371 static const struct of_device_id spear_kbd_id_table[] = { ··· 380 379 .remove = spear_kbd_remove, 381 380 .driver = { 382 381 .name = "keyboard", 383 - .pm = &spear_kbd_pm_ops, 382 + .pm = pm_sleep_ptr(&spear_kbd_pm_ops), 384 383 .of_match_table = of_match_ptr(spear_kbd_id_table), 385 384 }, 386 385 };
+3 -4
drivers/input/keyboard/st-keyscan.c
··· 212 212 return 0; 213 213 } 214 214 215 - #ifdef CONFIG_PM_SLEEP 216 215 static int keyscan_suspend(struct device *dev) 217 216 { 218 217 struct platform_device *pdev = to_platform_device(dev); ··· 246 247 mutex_unlock(&input->mutex); 247 248 return retval; 248 249 } 249 - #endif 250 250 251 - static SIMPLE_DEV_PM_OPS(keyscan_dev_pm_ops, keyscan_suspend, keyscan_resume); 251 + static DEFINE_SIMPLE_DEV_PM_OPS(keyscan_dev_pm_ops, 252 + keyscan_suspend, keyscan_resume); 252 253 253 254 static const struct of_device_id keyscan_of_match[] = { 254 255 { .compatible = "st,sti-keyscan" }, ··· 260 261 .probe = keyscan_probe, 261 262 .driver = { 262 263 .name = "st-keyscan", 263 - .pm = &keyscan_dev_pm_ops, 264 + .pm = pm_sleep_ptr(&keyscan_dev_pm_ops), 264 265 .of_match_table = of_match_ptr(keyscan_of_match), 265 266 } 266 267 };
+1
drivers/input/keyboard/stmpe-keypad.c
··· 9 9 #include <linux/slab.h> 10 10 #include <linux/input.h> 11 11 #include <linux/interrupt.h> 12 + #include <linux/of.h> 12 13 #include <linux/platform_device.h> 13 14 #include <linux/input/matrix_keypad.h> 14 15 #include <linux/mfd/stmpe.h>
+3 -5
drivers/input/keyboard/tc3589x-keypad.c
··· 455 455 return 0; 456 456 } 457 457 458 - #ifdef CONFIG_PM_SLEEP 459 458 static int tc3589x_keypad_suspend(struct device *dev) 460 459 { 461 460 struct platform_device *pdev = to_platform_device(dev); ··· 491 492 492 493 return 0; 493 494 } 494 - #endif 495 495 496 - static SIMPLE_DEV_PM_OPS(tc3589x_keypad_dev_pm_ops, 497 - tc3589x_keypad_suspend, tc3589x_keypad_resume); 496 + static DEFINE_SIMPLE_DEV_PM_OPS(tc3589x_keypad_dev_pm_ops, 497 + tc3589x_keypad_suspend, tc3589x_keypad_resume); 498 498 499 499 static struct platform_driver tc3589x_keypad_driver = { 500 500 .driver = { 501 501 .name = "tc3589x-keypad", 502 - .pm = &tc3589x_keypad_dev_pm_ops, 502 + .pm = pm_sleep_ptr(&tc3589x_keypad_dev_pm_ops), 503 503 }, 504 504 .probe = tc3589x_keypad_probe, 505 505 };
+6 -8
drivers/input/keyboard/tca6416-keypad.c
··· 194 194 return 0; 195 195 } 196 196 197 - static int tca6416_keypad_probe(struct i2c_client *client, 198 - const struct i2c_device_id *id) 197 + static int tca6416_keypad_probe(struct i2c_client *client) 199 198 { 199 + const struct i2c_device_id *id = i2c_client_get_device_id(client); 200 200 struct tca6416_keys_platform_data *pdata; 201 201 struct tca6416_keypad_chip *chip; 202 202 struct input_dev *input; ··· 320 320 kfree(chip); 321 321 } 322 322 323 - #ifdef CONFIG_PM_SLEEP 324 323 static int tca6416_keypad_suspend(struct device *dev) 325 324 { 326 325 struct i2c_client *client = to_i2c_client(dev); ··· 341 342 342 343 return 0; 343 344 } 344 - #endif 345 345 346 - static SIMPLE_DEV_PM_OPS(tca6416_keypad_dev_pm_ops, 347 - tca6416_keypad_suspend, tca6416_keypad_resume); 346 + static DEFINE_SIMPLE_DEV_PM_OPS(tca6416_keypad_dev_pm_ops, 347 + tca6416_keypad_suspend, tca6416_keypad_resume); 348 348 349 349 static struct i2c_driver tca6416_keypad_driver = { 350 350 .driver = { 351 351 .name = "tca6416-keypad", 352 - .pm = &tca6416_keypad_dev_pm_ops, 352 + .pm = pm_sleep_ptr(&tca6416_keypad_dev_pm_ops), 353 353 }, 354 - .probe = tca6416_keypad_probe, 354 + .probe_new = tca6416_keypad_probe, 355 355 .remove = tca6416_keypad_remove, 356 356 .id_table = tca6416_id, 357 357 };
+2 -3
drivers/input/keyboard/tca8418_keypad.c
··· 259 259 return error; 260 260 } 261 261 262 - static int tca8418_keypad_probe(struct i2c_client *client, 263 - const struct i2c_device_id *id) 262 + static int tca8418_keypad_probe(struct i2c_client *client) 264 263 { 265 264 struct device *dev = &client->dev; 266 265 struct tca8418_keypad *keypad_data; ··· 370 371 .name = "tca8418_keypad", 371 372 .of_match_table = tca8418_dt_ids, 372 373 }, 373 - .probe = tca8418_keypad_probe, 374 + .probe_new = tca8418_keypad_probe, 374 375 .id_table = tca8418_id, 375 376 }; 376 377
+3 -4
drivers/input/keyboard/tegra-kbc.c
··· 713 713 return 0; 714 714 } 715 715 716 - #ifdef CONFIG_PM_SLEEP 717 716 static void tegra_kbc_set_keypress_interrupt(struct tegra_kbc *kbc, bool enable) 718 717 { 719 718 u32 val; ··· 801 802 802 803 return err; 803 804 } 804 - #endif 805 805 806 - static SIMPLE_DEV_PM_OPS(tegra_kbc_pm_ops, tegra_kbc_suspend, tegra_kbc_resume); 806 + static DEFINE_SIMPLE_DEV_PM_OPS(tegra_kbc_pm_ops, 807 + tegra_kbc_suspend, tegra_kbc_resume); 807 808 808 809 static struct platform_driver tegra_kbc_driver = { 809 810 .probe = tegra_kbc_probe, 810 811 .driver = { 811 812 .name = "tegra-kbc", 812 - .pm = &tegra_kbc_pm_ops, 813 + .pm = pm_sleep_ptr(&tegra_kbc_pm_ops), 813 814 .of_match_table = tegra_kbc_of_match, 814 815 }, 815 816 };
+7 -8
drivers/input/keyboard/tm2-touchkey.c
··· 181 181 return IRQ_HANDLED; 182 182 } 183 183 184 - static int tm2_touchkey_probe(struct i2c_client *client, 185 - const struct i2c_device_id *id) 184 + static int tm2_touchkey_probe(struct i2c_client *client) 186 185 { 187 186 struct device_node *np = client->dev.of_node; 188 187 struct tm2_touchkey_data *touchkey; ··· 297 298 return 0; 298 299 } 299 300 300 - static int __maybe_unused tm2_touchkey_suspend(struct device *dev) 301 + static int tm2_touchkey_suspend(struct device *dev) 301 302 { 302 303 struct i2c_client *client = to_i2c_client(dev); 303 304 struct tm2_touchkey_data *touchkey = i2c_get_clientdata(client); ··· 308 309 return 0; 309 310 } 310 311 311 - static int __maybe_unused tm2_touchkey_resume(struct device *dev) 312 + static int tm2_touchkey_resume(struct device *dev) 312 313 { 313 314 struct i2c_client *client = to_i2c_client(dev); 314 315 struct tm2_touchkey_data *touchkey = i2c_get_clientdata(client); ··· 323 324 return ret; 324 325 } 325 326 326 - static SIMPLE_DEV_PM_OPS(tm2_touchkey_pm_ops, 327 - tm2_touchkey_suspend, tm2_touchkey_resume); 327 + static DEFINE_SIMPLE_DEV_PM_OPS(tm2_touchkey_pm_ops, 328 + tm2_touchkey_suspend, tm2_touchkey_resume); 328 329 329 330 static const struct i2c_device_id tm2_touchkey_id_table[] = { 330 331 { TM2_TOUCHKEY_DEV_NAME, 0 }, ··· 353 354 static struct i2c_driver tm2_touchkey_driver = { 354 355 .driver = { 355 356 .name = TM2_TOUCHKEY_DEV_NAME, 356 - .pm = &tm2_touchkey_pm_ops, 357 + .pm = pm_sleep_ptr(&tm2_touchkey_pm_ops), 357 358 .of_match_table = of_match_ptr(tm2_touchkey_of_match), 358 359 }, 359 - .probe = tm2_touchkey_probe, 360 + .probe_new = tm2_touchkey_probe, 360 361 .id_table = tm2_touchkey_id_table, 361 362 }; 362 363 module_i2c_driver(tm2_touchkey_driver);
+2 -2
drivers/input/misc/Kconfig
··· 107 107 108 108 config INPUT_ATMEL_CAPTOUCH 109 109 tristate "Atmel Capacitive Touch Button Driver" 110 - depends on OF || COMPILE_TEST 110 + depends on OF 111 111 depends on I2C 112 112 help 113 113 Say Y here if an Atmel Capacitive Touch Button device which ··· 330 330 331 331 config INPUT_WISTRON_BTNS 332 332 tristate "x86 Wistron laptop button interface" 333 - depends on X86_32 333 + depends on X86_32 && !UML 334 334 select INPUT_SPARSEKMAP 335 335 select NEW_LEDS 336 336 select LEDS_CLASS
+2 -3
drivers/input/misc/ad714x-i2c.c
··· 69 69 return 0; 70 70 } 71 71 72 - static int ad714x_i2c_probe(struct i2c_client *client, 73 - const struct i2c_device_id *id) 72 + static int ad714x_i2c_probe(struct i2c_client *client) 74 73 { 75 74 struct ad714x_chip *chip; 76 75 ··· 98 99 .name = "ad714x_captouch", 99 100 .pm = &ad714x_i2c_pm, 100 101 }, 101 - .probe = ad714x_i2c_probe, 102 + .probe_new = ad714x_i2c_probe, 102 103 .id_table = ad714x_id, 103 104 }; 104 105
+2 -3
drivers/input/misc/adxl34x-i2c.c
··· 74 74 .read_block = adxl34x_i2c_read_block, 75 75 }; 76 76 77 - static int adxl34x_i2c_probe(struct i2c_client *client, 78 - const struct i2c_device_id *id) 77 + static int adxl34x_i2c_probe(struct i2c_client *client) 79 78 { 80 79 struct adxl34x *ac; 81 80 int error; ··· 158 159 .pm = &adxl34x_i2c_pm, 159 160 .of_match_table = adxl34x_of_id, 160 161 }, 161 - .probe = adxl34x_i2c_probe, 162 + .probe_new = adxl34x_i2c_probe, 162 163 .remove = adxl34x_i2c_remove, 163 164 .id_table = adxl34x_id, 164 165 };
+2 -3
drivers/input/misc/apanel.c
··· 120 120 return i2c_smbus_write_word_data(ap->client, 0x10, led_bits); 121 121 } 122 122 123 - static int apanel_probe(struct i2c_client *client, 124 - const struct i2c_device_id *id) 123 + static int apanel_probe(struct i2c_client *client) 125 124 { 126 125 struct apanel *ap; 127 126 struct input_dev *idev; ··· 201 202 .driver = { 202 203 .name = APANEL, 203 204 }, 204 - .probe = apanel_probe, 205 + .probe_new = apanel_probe, 205 206 .shutdown = apanel_shutdown, 206 207 .id_table = apanel_id, 207 208 };
+3 -6
drivers/input/misc/atmel_captouch.c
··· 161 161 /* 162 162 * Probe function to setup the device, input system and interrupt 163 163 */ 164 - static int atmel_captouch_probe(struct i2c_client *client, 165 - const struct i2c_device_id *id) 164 + static int atmel_captouch_probe(struct i2c_client *client) 166 165 { 167 166 struct atmel_captouch_device *capdev; 168 167 struct device *dev = &client->dev; ··· 248 249 return 0; 249 250 } 250 251 251 - #ifdef CONFIG_OF 252 252 static const struct of_device_id atmel_captouch_of_id[] = { 253 253 { 254 254 .compatible = "atmel,captouch", ··· 255 257 { /* sentinel */ } 256 258 }; 257 259 MODULE_DEVICE_TABLE(of, atmel_captouch_of_id); 258 - #endif 259 260 260 261 static const struct i2c_device_id atmel_captouch_id[] = { 261 262 { "atmel_captouch", 0 }, ··· 263 266 MODULE_DEVICE_TABLE(i2c, atmel_captouch_id); 264 267 265 268 static struct i2c_driver atmel_captouch_driver = { 266 - .probe = atmel_captouch_probe, 269 + .probe_new = atmel_captouch_probe, 267 270 .id_table = atmel_captouch_id, 268 271 .driver = { 269 272 .name = "atmel_captouch", 270 - .of_match_table = of_match_ptr(atmel_captouch_of_id), 273 + .of_match_table = atmel_captouch_of_id, 271 274 }, 272 275 }; 273 276 module_i2c_driver(atmel_captouch_driver);
+2 -3
drivers/input/misc/bma150.c
··· 414 414 return bma150_set_mode(bma150, BMA150_MODE_SLEEP); 415 415 } 416 416 417 - static int bma150_probe(struct i2c_client *client, 418 - const struct i2c_device_id *id) 417 + static int bma150_probe(struct i2c_client *client) 419 418 { 420 419 const struct bma150_platform_data *pdata = 421 420 dev_get_platdata(&client->dev); ··· 551 552 }, 552 553 .class = I2C_CLASS_HWMON, 553 554 .id_table = bma150_id, 554 - .probe = bma150_probe, 555 + .probe_new = bma150_probe, 555 556 .remove = bma150_remove, 556 557 }; 557 558
+2 -3
drivers/input/misc/cma3000_d0x_i2c.c
··· 44 44 .write = cma3000_i2c_set, 45 45 }; 46 46 47 - static int cma3000_i2c_probe(struct i2c_client *client, 48 - const struct i2c_device_id *id) 47 + static int cma3000_i2c_probe(struct i2c_client *client) 49 48 { 50 49 struct cma3000_accl_data *data; 51 50 ··· 99 100 MODULE_DEVICE_TABLE(i2c, cma3000_i2c_id); 100 101 101 102 static struct i2c_driver cma3000_i2c_driver = { 102 - .probe = cma3000_i2c_probe, 103 + .probe_new = cma3000_i2c_probe, 103 104 .remove = cma3000_i2c_remove, 104 105 .id_table = cma3000_i2c_id, 105 106 .driver = {
+2 -3
drivers/input/misc/da7280.c
··· 1140 1140 return error; 1141 1141 } 1142 1142 1143 - static int da7280_probe(struct i2c_client *client, 1144 - const struct i2c_device_id *id) 1143 + static int da7280_probe(struct i2c_client *client) 1145 1144 { 1146 1145 struct device *dev = &client->dev; 1147 1146 struct da7280_haptic *haptics; ··· 1321 1322 .of_match_table = of_match_ptr(da7280_of_match), 1322 1323 .pm = &da7280_pm_ops, 1323 1324 }, 1324 - .probe = da7280_probe, 1325 + .probe_new = da7280_probe, 1325 1326 .id_table = da7280_i2c_id, 1326 1327 }; 1327 1328 module_i2c_driver(da7280_driver);
+2 -3
drivers/input/misc/drv260x.c
··· 457 457 .cache_type = REGCACHE_NONE, 458 458 }; 459 459 460 - static int drv260x_probe(struct i2c_client *client, 461 - const struct i2c_device_id *id) 460 + static int drv260x_probe(struct i2c_client *client) 462 461 { 463 462 struct device *dev = &client->dev; 464 463 struct drv260x_data *haptics; ··· 653 654 MODULE_DEVICE_TABLE(of, drv260x_of_match); 654 655 655 656 static struct i2c_driver drv260x_driver = { 656 - .probe = drv260x_probe, 657 + .probe_new = drv260x_probe, 657 658 .driver = { 658 659 .name = "drv260x-haptics", 659 660 .of_match_table = drv260x_of_match,
+2 -3
drivers/input/misc/drv2665.c
··· 156 156 .cache_type = REGCACHE_NONE, 157 157 }; 158 158 159 - static int drv2665_probe(struct i2c_client *client, 160 - const struct i2c_device_id *id) 159 + static int drv2665_probe(struct i2c_client *client) 161 160 { 162 161 struct drv2665_data *haptics; 163 162 int error; ··· 297 298 #endif 298 299 299 300 static struct i2c_driver drv2665_driver = { 300 - .probe = drv2665_probe, 301 + .probe_new = drv2665_probe, 301 302 .driver = { 302 303 .name = "drv2665-haptics", 303 304 .of_match_table = of_match_ptr(drv2665_of_match),
+2 -3
drivers/input/misc/drv2667.c
··· 333 333 .cache_type = REGCACHE_NONE, 334 334 }; 335 335 336 - static int drv2667_probe(struct i2c_client *client, 337 - const struct i2c_device_id *id) 336 + static int drv2667_probe(struct i2c_client *client) 338 337 { 339 338 struct drv2667_data *haptics; 340 339 int error; ··· 474 475 #endif 475 476 476 477 static struct i2c_driver drv2667_driver = { 477 - .probe = drv2667_probe, 478 + .probe_new = drv2667_probe, 478 479 .driver = { 479 480 .name = "drv2667-haptics", 480 481 .of_match_table = of_match_ptr(drv2667_of_match),
+2 -3
drivers/input/misc/ibm-panel.c
··· 119 119 return 0; 120 120 } 121 121 122 - static int ibm_panel_probe(struct i2c_client *client, 123 - const struct i2c_device_id *id) 122 + static int ibm_panel_probe(struct i2c_client *client) 124 123 { 125 124 struct ibm_panel *panel; 126 125 int i; ··· 189 190 .name = DEVICE_NAME, 190 191 .of_match_table = ibm_panel_match, 191 192 }, 192 - .probe = ibm_panel_probe, 193 + .probe_new = ibm_panel_probe, 193 194 .remove = ibm_panel_remove, 194 195 }; 195 196 module_i2c_driver(ibm_panel_driver);
+302 -204
drivers/input/misc/iqs7222.c
··· 86 86 IQS7222_REG_KEY_TOUCH, 87 87 IQS7222_REG_KEY_DEBOUNCE, 88 88 IQS7222_REG_KEY_TAP, 89 + IQS7222_REG_KEY_TAP_LEGACY, 89 90 IQS7222_REG_KEY_AXIAL, 91 + IQS7222_REG_KEY_AXIAL_LEGACY, 90 92 IQS7222_REG_KEY_WHEEL, 91 93 IQS7222_REG_KEY_NO_WHEEL, 92 94 IQS7222_REG_KEY_RESERVED ··· 107 105 IQS7222_NUM_REG_GRPS 108 106 }; 109 107 110 - static const char * const iqs7222_reg_grp_names[] = { 108 + static const char * const iqs7222_reg_grp_names[IQS7222_NUM_REG_GRPS] = { 111 109 [IQS7222_REG_GRP_CYCLE] = "cycle", 112 110 [IQS7222_REG_GRP_CHAN] = "channel", 113 111 [IQS7222_REG_GRP_SLDR] = "slider", 114 112 [IQS7222_REG_GRP_GPIO] = "gpio", 115 113 }; 116 114 117 - static const unsigned int iqs7222_max_cols[] = { 115 + static const unsigned int iqs7222_max_cols[IQS7222_NUM_REG_GRPS] = { 118 116 [IQS7222_REG_GRP_STAT] = IQS7222_MAX_COLS_STAT, 119 117 [IQS7222_REG_GRP_CYCLE] = IQS7222_MAX_COLS_CYCLE, 120 118 [IQS7222_REG_GRP_GLBL] = IQS7222_MAX_COLS_GLBL, ··· 204 202 int allow_offset; 205 203 int event_offset; 206 204 int comms_offset; 205 + bool legacy_gesture; 207 206 struct iqs7222_reg_grp_desc reg_grps[IQS7222_NUM_REG_GRPS]; 208 207 }; 209 208 210 209 static const struct iqs7222_dev_desc iqs7222_devs[] = { 210 + { 211 + .prod_num = IQS7222_PROD_NUM_A, 212 + .fw_major = 1, 213 + .fw_minor = 13, 214 + .sldr_res = U8_MAX * 16, 215 + .touch_link = 1768, 216 + .allow_offset = 9, 217 + .event_offset = 10, 218 + .comms_offset = 12, 219 + .reg_grps = { 220 + [IQS7222_REG_GRP_STAT] = { 221 + .base = IQS7222_SYS_STATUS, 222 + .num_row = 1, 223 + .num_col = 8, 224 + }, 225 + [IQS7222_REG_GRP_CYCLE] = { 226 + .base = 0x8000, 227 + .num_row = 7, 228 + .num_col = 3, 229 + }, 230 + [IQS7222_REG_GRP_GLBL] = { 231 + .base = 0x8700, 232 + .num_row = 1, 233 + .num_col = 3, 234 + }, 235 + [IQS7222_REG_GRP_BTN] = { 236 + .base = 0x9000, 237 + .num_row = 12, 238 + .num_col = 3, 239 + }, 240 + [IQS7222_REG_GRP_CHAN] = { 241 + .base = 0xA000, 242 + .num_row = 12, 243 + .num_col = 6, 244 + }, 245 + [IQS7222_REG_GRP_FILT] = { 246 + .base = 0xAC00, 247 + .num_row = 1, 248 + .num_col = 2, 249 + }, 250 + [IQS7222_REG_GRP_SLDR] = { 251 + .base = 0xB000, 252 + .num_row = 2, 253 + .num_col = 11, 254 + }, 255 + [IQS7222_REG_GRP_GPIO] = { 256 + .base = 0xC000, 257 + .num_row = 1, 258 + .num_col = 3, 259 + }, 260 + [IQS7222_REG_GRP_SYS] = { 261 + .base = IQS7222_SYS_SETUP, 262 + .num_row = 1, 263 + .num_col = 13, 264 + }, 265 + }, 266 + }, 211 267 { 212 268 .prod_num = IQS7222_PROD_NUM_A, 213 269 .fw_major = 1, ··· 275 215 .allow_offset = 9, 276 216 .event_offset = 10, 277 217 .comms_offset = 12, 218 + .legacy_gesture = true, 278 219 .reg_grps = { 279 220 [IQS7222_REG_GRP_STAT] = { 280 221 .base = IQS7222_SYS_STATUS, ··· 935 874 .reg_offset = 9, 936 875 .reg_shift = 8, 937 876 .reg_width = 8, 877 + .val_pitch = 16, 878 + .label = "maximum gesture time", 879 + }, 880 + { 881 + .name = "azoteq,gesture-max-ms", 882 + .reg_grp = IQS7222_REG_GRP_SLDR, 883 + .reg_key = IQS7222_REG_KEY_TAP_LEGACY, 884 + .reg_offset = 9, 885 + .reg_shift = 8, 886 + .reg_width = 8, 938 887 .val_pitch = 4, 939 888 .label = "maximum gesture time", 940 889 }, ··· 952 881 .name = "azoteq,gesture-min-ms", 953 882 .reg_grp = IQS7222_REG_GRP_SLDR, 954 883 .reg_key = IQS7222_REG_KEY_TAP, 884 + .reg_offset = 9, 885 + .reg_shift = 3, 886 + .reg_width = 5, 887 + .val_pitch = 16, 888 + .label = "minimum gesture time", 889 + }, 890 + { 891 + .name = "azoteq,gesture-min-ms", 892 + .reg_grp = IQS7222_REG_GRP_SLDR, 893 + .reg_key = IQS7222_REG_KEY_TAP_LEGACY, 955 894 .reg_offset = 9, 956 895 .reg_shift = 3, 957 896 .reg_width = 5, ··· 979 898 .label = "gesture distance", 980 899 }, 981 900 { 901 + .name = "azoteq,gesture-dist", 902 + .reg_grp = IQS7222_REG_GRP_SLDR, 903 + .reg_key = IQS7222_REG_KEY_AXIAL_LEGACY, 904 + .reg_offset = 10, 905 + .reg_shift = 8, 906 + .reg_width = 8, 907 + .val_pitch = 16, 908 + .label = "gesture distance", 909 + }, 910 + { 982 911 .name = "azoteq,gesture-max-ms", 983 912 .reg_grp = IQS7222_REG_GRP_SLDR, 984 913 .reg_key = IQS7222_REG_KEY_AXIAL, 914 + .reg_offset = 10, 915 + .reg_shift = 0, 916 + .reg_width = 8, 917 + .val_pitch = 16, 918 + .label = "maximum gesture time", 919 + }, 920 + { 921 + .name = "azoteq,gesture-max-ms", 922 + .reg_grp = IQS7222_REG_GRP_SLDR, 923 + .reg_key = IQS7222_REG_KEY_AXIAL_LEGACY, 985 924 .reg_offset = 10, 986 925 .reg_shift = 0, 987 926 .reg_width = 8, ··· 1668 1567 } 1669 1568 1670 1569 static int iqs7222_parse_props(struct iqs7222_private *iqs7222, 1671 - struct fwnode_handle **child_node, 1672 - int child_index, 1570 + struct fwnode_handle *reg_grp_node, 1571 + int reg_grp_index, 1673 1572 enum iqs7222_reg_grp_id reg_grp, 1674 1573 enum iqs7222_reg_key_id reg_key) 1675 1574 { 1676 - u16 *setup = iqs7222_setup(iqs7222, reg_grp, child_index); 1575 + u16 *setup = iqs7222_setup(iqs7222, reg_grp, reg_grp_index); 1677 1576 struct i2c_client *client = iqs7222->client; 1678 - struct fwnode_handle *reg_grp_node; 1679 - char reg_grp_name[16]; 1680 1577 int i; 1681 1578 1682 - switch (reg_grp) { 1683 - case IQS7222_REG_GRP_CYCLE: 1684 - case IQS7222_REG_GRP_CHAN: 1685 - case IQS7222_REG_GRP_SLDR: 1686 - case IQS7222_REG_GRP_GPIO: 1687 - case IQS7222_REG_GRP_BTN: 1688 - /* 1689 - * These groups derive a child node and return it to the caller 1690 - * for additional group-specific processing. In some cases, the 1691 - * child node may have already been derived. 1692 - */ 1693 - reg_grp_node = *child_node; 1694 - if (reg_grp_node) 1695 - break; 1696 - 1697 - snprintf(reg_grp_name, sizeof(reg_grp_name), "%s-%d", 1698 - iqs7222_reg_grp_names[reg_grp], child_index); 1699 - 1700 - reg_grp_node = device_get_named_child_node(&client->dev, 1701 - reg_grp_name); 1702 - if (!reg_grp_node) 1703 - return 0; 1704 - 1705 - *child_node = reg_grp_node; 1706 - break; 1707 - 1708 - case IQS7222_REG_GRP_GLBL: 1709 - case IQS7222_REG_GRP_FILT: 1710 - case IQS7222_REG_GRP_SYS: 1711 - /* 1712 - * These groups are not organized beneath a child node, nor are 1713 - * they subject to any additional processing by the caller. 1714 - */ 1715 - reg_grp_node = dev_fwnode(&client->dev); 1716 - break; 1717 - 1718 - default: 1719 - return -EINVAL; 1720 - } 1579 + if (!setup) 1580 + return 0; 1721 1581 1722 1582 for (i = 0; i < ARRAY_SIZE(iqs7222_props); i++) { 1723 1583 const char *name = iqs7222_props[i].name; ··· 1748 1686 return 0; 1749 1687 } 1750 1688 1751 - static int iqs7222_parse_cycle(struct iqs7222_private *iqs7222, int cycle_index) 1689 + static int iqs7222_parse_event(struct iqs7222_private *iqs7222, 1690 + struct fwnode_handle *event_node, 1691 + int reg_grp_index, 1692 + enum iqs7222_reg_grp_id reg_grp, 1693 + enum iqs7222_reg_key_id reg_key, 1694 + u16 event_enable, u16 event_link, 1695 + unsigned int *event_type, 1696 + unsigned int *event_code) 1697 + { 1698 + struct i2c_client *client = iqs7222->client; 1699 + int error; 1700 + 1701 + error = iqs7222_parse_props(iqs7222, event_node, reg_grp_index, 1702 + reg_grp, reg_key); 1703 + if (error) 1704 + return error; 1705 + 1706 + error = iqs7222_gpio_select(iqs7222, event_node, event_enable, 1707 + event_link); 1708 + if (error) 1709 + return error; 1710 + 1711 + error = fwnode_property_read_u32(event_node, "linux,code", event_code); 1712 + if (error == -EINVAL) { 1713 + return 0; 1714 + } else if (error) { 1715 + dev_err(&client->dev, "Failed to read %s code: %d\n", 1716 + fwnode_get_name(event_node), error); 1717 + return error; 1718 + } 1719 + 1720 + if (!event_type) { 1721 + input_set_capability(iqs7222->keypad, EV_KEY, *event_code); 1722 + return 0; 1723 + } 1724 + 1725 + error = fwnode_property_read_u32(event_node, "linux,input-type", 1726 + event_type); 1727 + if (error == -EINVAL) { 1728 + *event_type = EV_KEY; 1729 + } else if (error) { 1730 + dev_err(&client->dev, "Failed to read %s input type: %d\n", 1731 + fwnode_get_name(event_node), error); 1732 + return error; 1733 + } else if (*event_type != EV_KEY && *event_type != EV_SW) { 1734 + dev_err(&client->dev, "Invalid %s input type: %d\n", 1735 + fwnode_get_name(event_node), *event_type); 1736 + return -EINVAL; 1737 + } 1738 + 1739 + input_set_capability(iqs7222->keypad, *event_type, *event_code); 1740 + 1741 + return 0; 1742 + } 1743 + 1744 + static int iqs7222_parse_cycle(struct iqs7222_private *iqs7222, 1745 + struct fwnode_handle *cycle_node, int cycle_index) 1752 1746 { 1753 1747 u16 *cycle_setup = iqs7222->cycle_setup[cycle_index]; 1754 1748 struct i2c_client *client = iqs7222->client; 1755 - struct fwnode_handle *cycle_node = NULL; 1756 1749 unsigned int pins[9]; 1757 1750 int error, count, i; 1758 1751 ··· 1815 1698 * Each channel shares a cycle with one other channel; the mapping of 1816 1699 * channels to cycles is fixed. Properties defined for a cycle impact 1817 1700 * both channels tied to the cycle. 1818 - */ 1819 - error = iqs7222_parse_props(iqs7222, &cycle_node, cycle_index, 1820 - IQS7222_REG_GRP_CYCLE, 1821 - IQS7222_REG_KEY_NONE); 1822 - if (error) 1823 - return error; 1824 - 1825 - if (!cycle_node) 1826 - return 0; 1827 - 1828 - /* 1701 + * 1829 1702 * Unlike channels which are restricted to a select range of CRx pins 1830 1703 * based on channel number, any cycle can claim any of the device's 9 1831 1704 * CTx pins (CTx0-8). ··· 1857 1750 return 0; 1858 1751 } 1859 1752 1860 - static int iqs7222_parse_chan(struct iqs7222_private *iqs7222, int chan_index) 1753 + static int iqs7222_parse_chan(struct iqs7222_private *iqs7222, 1754 + struct fwnode_handle *chan_node, int chan_index) 1861 1755 { 1862 1756 const struct iqs7222_dev_desc *dev_desc = iqs7222->dev_desc; 1863 1757 struct i2c_client *client = iqs7222->client; 1864 - struct fwnode_handle *chan_node = NULL; 1865 1758 int num_chan = dev_desc->reg_grps[IQS7222_REG_GRP_CHAN].num_row; 1866 1759 int ext_chan = rounddown(num_chan, 10); 1867 1760 int error, i; 1868 1761 u16 *chan_setup = iqs7222->chan_setup[chan_index]; 1869 1762 u16 *sys_setup = iqs7222->sys_setup; 1870 1763 unsigned int val; 1871 - 1872 - error = iqs7222_parse_props(iqs7222, &chan_node, chan_index, 1873 - IQS7222_REG_GRP_CHAN, 1874 - IQS7222_REG_KEY_NONE); 1875 - if (error) 1876 - return error; 1877 - 1878 - if (!chan_node) 1879 - return 0; 1880 1764 1881 1765 if (dev_desc->allow_offset && 1882 1766 fwnode_property_present(chan_node, "azoteq,ulp-allow")) ··· 1908 1810 chan_setup[0] |= IQS7222_CHAN_SETUP_0_REF_MODE_FOLLOW; 1909 1811 chan_setup[4] = val * 42 + 1048; 1910 1812 1911 - if (!fwnode_property_read_u32(chan_node, "azoteq,ref-weight", 1912 - &val)) { 1813 + error = fwnode_property_read_u32(chan_node, "azoteq,ref-weight", 1814 + &val); 1815 + if (!error) { 1913 1816 if (val > U16_MAX) { 1914 1817 dev_err(&client->dev, 1915 1818 "Invalid %s reference weight: %u\n", ··· 1919 1820 } 1920 1821 1921 1822 chan_setup[5] = val; 1823 + } else if (error != -EINVAL) { 1824 + dev_err(&client->dev, 1825 + "Failed to read %s reference weight: %d\n", 1826 + fwnode_get_name(chan_node), error); 1827 + return error; 1922 1828 } 1923 1829 1924 1830 /* ··· 1996 1892 if (!event_node) 1997 1893 continue; 1998 1894 1999 - error = iqs7222_parse_props(iqs7222, &event_node, chan_index, 2000 - IQS7222_REG_GRP_BTN, 2001 - iqs7222_kp_events[i].reg_key); 2002 - if (error) 2003 - return error; 2004 - 2005 - error = iqs7222_gpio_select(iqs7222, event_node, 2006 - BIT(chan_index), 2007 - dev_desc->touch_link - (i ? 0 : 2)); 2008 - if (error) 2009 - return error; 2010 - 2011 - if (!fwnode_property_read_u32(event_node, 2012 - "azoteq,timeout-press-ms", 2013 - &val)) { 1895 + error = fwnode_property_read_u32(event_node, 1896 + "azoteq,timeout-press-ms", 1897 + &val); 1898 + if (!error) { 2014 1899 /* 2015 1900 * The IQS7222B employs a global pair of press timeout 2016 1901 * registers as opposed to channel-specific registers. ··· 2012 1919 if (val > U8_MAX * 500) { 2013 1920 dev_err(&client->dev, 2014 1921 "Invalid %s press timeout: %u\n", 2015 - fwnode_get_name(chan_node), val); 1922 + fwnode_get_name(event_node), val); 1923 + fwnode_handle_put(event_node); 2016 1924 return -EINVAL; 2017 1925 } 2018 1926 2019 1927 *setup &= ~(U8_MAX << i * 8); 2020 1928 *setup |= (val / 500 << i * 8); 2021 - } 2022 - 2023 - error = fwnode_property_read_u32(event_node, "linux,code", 2024 - &val); 2025 - if (error) { 2026 - dev_err(&client->dev, "Failed to read %s code: %d\n", 2027 - fwnode_get_name(chan_node), error); 1929 + } else if (error != -EINVAL) { 1930 + dev_err(&client->dev, 1931 + "Failed to read %s press timeout: %d\n", 1932 + fwnode_get_name(event_node), error); 1933 + fwnode_handle_put(event_node); 2028 1934 return error; 2029 1935 } 2030 1936 2031 - iqs7222->kp_code[chan_index][i] = val; 2032 - iqs7222->kp_type[chan_index][i] = EV_KEY; 2033 - 2034 - if (fwnode_property_present(event_node, "linux,input-type")) { 2035 - error = fwnode_property_read_u32(event_node, 2036 - "linux,input-type", 2037 - &val); 2038 - if (error) { 2039 - dev_err(&client->dev, 2040 - "Failed to read %s input type: %d\n", 2041 - fwnode_get_name(chan_node), error); 2042 - return error; 2043 - } 2044 - 2045 - if (val != EV_KEY && val != EV_SW) { 2046 - dev_err(&client->dev, 2047 - "Invalid %s input type: %u\n", 2048 - fwnode_get_name(chan_node), val); 2049 - return -EINVAL; 2050 - } 2051 - 2052 - iqs7222->kp_type[chan_index][i] = val; 2053 - } 2054 - 2055 - /* 2056 - * Reference channels can opt out of event reporting by using 2057 - * KEY_RESERVED in place of a true key or switch code. 2058 - */ 2059 - if (iqs7222->kp_type[chan_index][i] == EV_KEY && 2060 - iqs7222->kp_code[chan_index][i] == KEY_RESERVED) 2061 - continue; 2062 - 2063 - input_set_capability(iqs7222->keypad, 2064 - iqs7222->kp_type[chan_index][i], 2065 - iqs7222->kp_code[chan_index][i]); 1937 + error = iqs7222_parse_event(iqs7222, event_node, chan_index, 1938 + IQS7222_REG_GRP_BTN, 1939 + iqs7222_kp_events[i].reg_key, 1940 + BIT(chan_index), 1941 + dev_desc->touch_link - (i ? 0 : 2), 1942 + &iqs7222->kp_type[chan_index][i], 1943 + &iqs7222->kp_code[chan_index][i]); 1944 + fwnode_handle_put(event_node); 1945 + if (error) 1946 + return error; 2066 1947 2067 1948 if (!dev_desc->event_offset) 2068 1949 continue; ··· 2048 1981 * The following call handles a special pair of properties that apply 2049 1982 * to a channel node, but reside within the button (event) group. 2050 1983 */ 2051 - return iqs7222_parse_props(iqs7222, &chan_node, chan_index, 1984 + return iqs7222_parse_props(iqs7222, chan_node, chan_index, 2052 1985 IQS7222_REG_GRP_BTN, 2053 1986 IQS7222_REG_KEY_DEBOUNCE); 2054 1987 } 2055 1988 2056 - static int iqs7222_parse_sldr(struct iqs7222_private *iqs7222, int sldr_index) 1989 + static int iqs7222_parse_sldr(struct iqs7222_private *iqs7222, 1990 + struct fwnode_handle *sldr_node, int sldr_index) 2057 1991 { 2058 1992 const struct iqs7222_dev_desc *dev_desc = iqs7222->dev_desc; 2059 1993 struct i2c_client *client = iqs7222->client; 2060 - struct fwnode_handle *sldr_node = NULL; 2061 1994 int num_chan = dev_desc->reg_grps[IQS7222_REG_GRP_CHAN].num_row; 2062 1995 int ext_chan = rounddown(num_chan, 10); 2063 1996 int count, error, reg_offset, i; 2064 1997 u16 *event_mask = &iqs7222->sys_setup[dev_desc->event_offset]; 2065 1998 u16 *sldr_setup = iqs7222->sldr_setup[sldr_index]; 2066 1999 unsigned int chan_sel[4], val; 2067 - 2068 - error = iqs7222_parse_props(iqs7222, &sldr_node, sldr_index, 2069 - IQS7222_REG_GRP_SLDR, 2070 - IQS7222_REG_KEY_NONE); 2071 - if (error) 2072 - return error; 2073 - 2074 - if (!sldr_node) 2075 - return 0; 2076 2000 2077 2001 /* 2078 2002 * Each slider can be spread across 3 to 4 channels. It is possible to ··· 2123 2065 if (fwnode_property_present(sldr_node, "azoteq,use-prox")) 2124 2066 sldr_setup[4 + reg_offset] -= 2; 2125 2067 2126 - if (!fwnode_property_read_u32(sldr_node, "azoteq,slider-size", &val)) { 2127 - if (!val || val > dev_desc->sldr_res) { 2068 + error = fwnode_property_read_u32(sldr_node, "azoteq,slider-size", &val); 2069 + if (!error) { 2070 + if (val > dev_desc->sldr_res) { 2128 2071 dev_err(&client->dev, "Invalid %s size: %u\n", 2129 2072 fwnode_get_name(sldr_node), val); 2130 2073 return -EINVAL; ··· 2138 2079 sldr_setup[2] |= (val / 16 << 2139 2080 IQS7222_SLDR_SETUP_2_RES_SHIFT); 2140 2081 } 2082 + } else if (error != -EINVAL) { 2083 + dev_err(&client->dev, "Failed to read %s size: %d\n", 2084 + fwnode_get_name(sldr_node), error); 2085 + return error; 2141 2086 } 2142 2087 2143 - if (!fwnode_property_read_u32(sldr_node, "azoteq,top-speed", &val)) { 2088 + if (!(reg_offset ? sldr_setup[3] 2089 + : sldr_setup[2] & IQS7222_SLDR_SETUP_2_RES_MASK)) { 2090 + dev_err(&client->dev, "Undefined %s size\n", 2091 + fwnode_get_name(sldr_node)); 2092 + return -EINVAL; 2093 + } 2094 + 2095 + error = fwnode_property_read_u32(sldr_node, "azoteq,top-speed", &val); 2096 + if (!error) { 2144 2097 if (val > (reg_offset ? U16_MAX : U8_MAX * 4)) { 2145 2098 dev_err(&client->dev, "Invalid %s top speed: %u\n", 2146 2099 fwnode_get_name(sldr_node), val); ··· 2165 2094 sldr_setup[2] &= ~IQS7222_SLDR_SETUP_2_TOP_SPEED_MASK; 2166 2095 sldr_setup[2] |= (val / 4); 2167 2096 } 2097 + } else if (error != -EINVAL) { 2098 + dev_err(&client->dev, "Failed to read %s top speed: %d\n", 2099 + fwnode_get_name(sldr_node), error); 2100 + return error; 2168 2101 } 2169 2102 2170 - if (!fwnode_property_read_u32(sldr_node, "linux,axis", &val)) { 2103 + error = fwnode_property_read_u32(sldr_node, "linux,axis", &val); 2104 + if (!error) { 2171 2105 u16 sldr_max = sldr_setup[3] - 1; 2172 2106 2173 2107 if (!reg_offset) { ··· 2186 2110 2187 2111 input_set_abs_params(iqs7222->keypad, val, 0, sldr_max, 0, 0); 2188 2112 iqs7222->sl_axis[sldr_index] = val; 2113 + } else if (error != -EINVAL) { 2114 + dev_err(&client->dev, "Failed to read %s axis: %d\n", 2115 + fwnode_get_name(sldr_node), error); 2116 + return error; 2189 2117 } 2190 2118 2191 2119 if (dev_desc->wheel_enable) { ··· 2210 2130 for (i = 0; i < ARRAY_SIZE(iqs7222_sl_events); i++) { 2211 2131 const char *event_name = iqs7222_sl_events[i].name; 2212 2132 struct fwnode_handle *event_node; 2133 + enum iqs7222_reg_key_id reg_key; 2213 2134 2214 2135 event_node = fwnode_get_named_child_node(sldr_node, event_name); 2215 2136 if (!event_node) 2216 2137 continue; 2217 2138 2218 - error = iqs7222_parse_props(iqs7222, &event_node, sldr_index, 2219 - IQS7222_REG_GRP_SLDR, 2220 - reg_offset ? 2221 - IQS7222_REG_KEY_RESERVED : 2222 - iqs7222_sl_events[i].reg_key); 2223 - if (error) 2224 - return error; 2139 + /* 2140 + * Depending on the device, gestures are either offered using 2141 + * one of two timing resolutions, or are not supported at all. 2142 + */ 2143 + if (reg_offset) 2144 + reg_key = IQS7222_REG_KEY_RESERVED; 2145 + else if (dev_desc->legacy_gesture && 2146 + iqs7222_sl_events[i].reg_key == IQS7222_REG_KEY_TAP) 2147 + reg_key = IQS7222_REG_KEY_TAP_LEGACY; 2148 + else if (dev_desc->legacy_gesture && 2149 + iqs7222_sl_events[i].reg_key == IQS7222_REG_KEY_AXIAL) 2150 + reg_key = IQS7222_REG_KEY_AXIAL_LEGACY; 2151 + else 2152 + reg_key = iqs7222_sl_events[i].reg_key; 2225 2153 2226 2154 /* 2227 2155 * The press/release event does not expose a direct GPIO link, 2228 2156 * but one can be emulated by tying each of the participating 2229 2157 * channels to the same GPIO. 2230 2158 */ 2231 - error = iqs7222_gpio_select(iqs7222, event_node, 2159 + error = iqs7222_parse_event(iqs7222, event_node, sldr_index, 2160 + IQS7222_REG_GRP_SLDR, reg_key, 2232 2161 i ? iqs7222_sl_events[i].enable 2233 2162 : sldr_setup[3 + reg_offset], 2234 2163 i ? 1568 + sldr_index * 30 2235 - : sldr_setup[4 + reg_offset]); 2164 + : sldr_setup[4 + reg_offset], 2165 + NULL, 2166 + &iqs7222->sl_code[sldr_index][i]); 2167 + fwnode_handle_put(event_node); 2236 2168 if (error) 2237 2169 return error; 2238 2170 2239 2171 if (!reg_offset) 2240 2172 sldr_setup[9] |= iqs7222_sl_events[i].enable; 2241 - 2242 - error = fwnode_property_read_u32(event_node, "linux,code", 2243 - &val); 2244 - if (error) { 2245 - dev_err(&client->dev, "Failed to read %s code: %d\n", 2246 - fwnode_get_name(sldr_node), error); 2247 - return error; 2248 - } 2249 - 2250 - iqs7222->sl_code[sldr_index][i] = val; 2251 - input_set_capability(iqs7222->keypad, EV_KEY, val); 2252 2173 2253 2174 if (!dev_desc->event_offset) 2254 2175 continue; ··· 2271 2190 * The following call handles a special pair of properties that shift 2272 2191 * to make room for a wheel enable control in the case of IQS7222C. 2273 2192 */ 2274 - return iqs7222_parse_props(iqs7222, &sldr_node, sldr_index, 2193 + return iqs7222_parse_props(iqs7222, sldr_node, sldr_index, 2275 2194 IQS7222_REG_GRP_SLDR, 2276 2195 dev_desc->wheel_enable ? 2277 2196 IQS7222_REG_KEY_WHEEL : 2278 2197 IQS7222_REG_KEY_NO_WHEEL); 2198 + } 2199 + 2200 + static int (*iqs7222_parse_extra[IQS7222_NUM_REG_GRPS]) 2201 + (struct iqs7222_private *iqs7222, 2202 + struct fwnode_handle *reg_grp_node, 2203 + int reg_grp_index) = { 2204 + [IQS7222_REG_GRP_CYCLE] = iqs7222_parse_cycle, 2205 + [IQS7222_REG_GRP_CHAN] = iqs7222_parse_chan, 2206 + [IQS7222_REG_GRP_SLDR] = iqs7222_parse_sldr, 2207 + }; 2208 + 2209 + static int iqs7222_parse_reg_grp(struct iqs7222_private *iqs7222, 2210 + enum iqs7222_reg_grp_id reg_grp, 2211 + int reg_grp_index) 2212 + { 2213 + struct i2c_client *client = iqs7222->client; 2214 + struct fwnode_handle *reg_grp_node; 2215 + int error; 2216 + 2217 + if (iqs7222_reg_grp_names[reg_grp]) { 2218 + char reg_grp_name[16]; 2219 + 2220 + snprintf(reg_grp_name, sizeof(reg_grp_name), "%s-%d", 2221 + iqs7222_reg_grp_names[reg_grp], reg_grp_index); 2222 + 2223 + reg_grp_node = device_get_named_child_node(&client->dev, 2224 + reg_grp_name); 2225 + } else { 2226 + reg_grp_node = fwnode_handle_get(dev_fwnode(&client->dev)); 2227 + } 2228 + 2229 + if (!reg_grp_node) 2230 + return 0; 2231 + 2232 + error = iqs7222_parse_props(iqs7222, reg_grp_node, reg_grp_index, 2233 + reg_grp, IQS7222_REG_KEY_NONE); 2234 + 2235 + if (!error && iqs7222_parse_extra[reg_grp]) 2236 + error = iqs7222_parse_extra[reg_grp](iqs7222, reg_grp_node, 2237 + reg_grp_index); 2238 + 2239 + fwnode_handle_put(reg_grp_node); 2240 + 2241 + return error; 2279 2242 } 2280 2243 2281 2244 static int iqs7222_parse_all(struct iqs7222_private *iqs7222) ··· 2327 2202 const struct iqs7222_dev_desc *dev_desc = iqs7222->dev_desc; 2328 2203 const struct iqs7222_reg_grp_desc *reg_grps = dev_desc->reg_grps; 2329 2204 u16 *sys_setup = iqs7222->sys_setup; 2330 - int error, i; 2205 + int error, i, j; 2331 2206 2332 2207 if (dev_desc->allow_offset) 2333 2208 sys_setup[dev_desc->allow_offset] = U16_MAX; ··· 2335 2210 if (dev_desc->event_offset) 2336 2211 sys_setup[dev_desc->event_offset] = IQS7222_EVENT_MASK_ATI; 2337 2212 2338 - for (i = 0; i < reg_grps[IQS7222_REG_GRP_CYCLE].num_row; i++) { 2339 - error = iqs7222_parse_cycle(iqs7222, i); 2340 - if (error) 2341 - return error; 2342 - } 2343 - 2344 - error = iqs7222_parse_props(iqs7222, NULL, 0, IQS7222_REG_GRP_GLBL, 2345 - IQS7222_REG_KEY_NONE); 2346 - if (error) 2347 - return error; 2348 - 2349 2213 for (i = 0; i < reg_grps[IQS7222_REG_GRP_GPIO].num_row; i++) { 2350 - struct fwnode_handle *gpio_node = NULL; 2351 2214 u16 *gpio_setup = iqs7222->gpio_setup[i]; 2352 - int j; 2353 2215 2354 2216 gpio_setup[0] &= ~IQS7222_GPIO_SETUP_0_GPIO_EN; 2355 2217 gpio_setup[1] = 0; 2356 2218 gpio_setup[2] = 0; 2357 - 2358 - error = iqs7222_parse_props(iqs7222, &gpio_node, i, 2359 - IQS7222_REG_GRP_GPIO, 2360 - IQS7222_REG_KEY_NONE); 2361 - if (error) 2362 - return error; 2363 2219 2364 2220 if (reg_grps[IQS7222_REG_GRP_GPIO].num_row == 1) 2365 2221 continue; ··· 2364 2258 chan_setup[5] = 0; 2365 2259 } 2366 2260 2367 - for (i = 0; i < reg_grps[IQS7222_REG_GRP_CHAN].num_row; i++) { 2368 - error = iqs7222_parse_chan(iqs7222, i); 2369 - if (error) 2370 - return error; 2371 - } 2372 - 2373 - error = iqs7222_parse_props(iqs7222, NULL, 0, IQS7222_REG_GRP_FILT, 2374 - IQS7222_REG_KEY_NONE); 2375 - if (error) 2376 - return error; 2377 - 2378 2261 for (i = 0; i < reg_grps[IQS7222_REG_GRP_SLDR].num_row; i++) { 2379 2262 u16 *sldr_setup = iqs7222->sldr_setup[i]; 2380 2263 2381 2264 sldr_setup[0] &= ~IQS7222_SLDR_SETUP_0_CHAN_CNT_MASK; 2382 - 2383 - error = iqs7222_parse_sldr(iqs7222, i); 2384 - if (error) 2385 - return error; 2386 2265 } 2387 2266 2388 - return iqs7222_parse_props(iqs7222, NULL, 0, IQS7222_REG_GRP_SYS, 2389 - IQS7222_REG_KEY_NONE); 2267 + for (i = 0; i < IQS7222_NUM_REG_GRPS; i++) { 2268 + for (j = 0; j < reg_grps[i].num_row; j++) { 2269 + error = iqs7222_parse_reg_grp(iqs7222, i, j); 2270 + if (error) 2271 + return error; 2272 + } 2273 + } 2274 + 2275 + return 0; 2390 2276 } 2391 2277 2392 2278 static int iqs7222_report(struct iqs7222_private *iqs7222)
+2 -3
drivers/input/misc/kxtj9.c
··· 385 385 return retval; 386 386 } 387 387 388 - static int kxtj9_probe(struct i2c_client *client, 389 - const struct i2c_device_id *id) 388 + static int kxtj9_probe(struct i2c_client *client) 390 389 { 391 390 const struct kxtj9_platform_data *pdata = 392 391 dev_get_platdata(&client->dev); ··· 538 539 .name = NAME, 539 540 .pm = &kxtj9_pm_ops, 540 541 }, 541 - .probe = kxtj9_probe, 542 + .probe_new = kxtj9_probe, 542 543 .id_table = kxtj9_id, 543 544 }; 544 545
+3 -4
drivers/input/misc/max8997_haptic.c
··· 278 278 break; 279 279 280 280 case MAX8997_EXTERNAL_MODE: 281 - chip->pwm = pwm_request(haptic_pdata->pwm_channel_id, 282 - "max8997-haptic"); 281 + chip->pwm = pwm_get(&pdev->dev, NULL); 283 282 if (IS_ERR(chip->pwm)) { 284 283 error = PTR_ERR(chip->pwm); 285 284 dev_err(&pdev->dev, ··· 343 344 regulator_put(chip->regulator); 344 345 err_free_pwm: 345 346 if (chip->mode == MAX8997_EXTERNAL_MODE) 346 - pwm_free(chip->pwm); 347 + pwm_put(chip->pwm); 347 348 err_free_mem: 348 349 input_free_device(input_dev); 349 350 kfree(chip); ··· 359 360 regulator_put(chip->regulator); 360 361 361 362 if (chip->mode == MAX8997_EXTERNAL_MODE) 362 - pwm_free(chip->pwm); 363 + pwm_put(chip->pwm); 363 364 364 365 kfree(chip); 365 366
+2 -3
drivers/input/misc/mma8450.c
··· 146 146 /* 147 147 * I2C init/probing/exit functions 148 148 */ 149 - static int mma8450_probe(struct i2c_client *c, 150 - const struct i2c_device_id *id) 149 + static int mma8450_probe(struct i2c_client *c) 151 150 { 152 151 struct input_dev *input; 153 152 int err; ··· 202 203 .name = MMA8450_DRV_NAME, 203 204 .of_match_table = mma8450_dt_ids, 204 205 }, 205 - .probe = mma8450_probe, 206 + .probe_new = mma8450_probe, 206 207 .id_table = mma8450_id, 207 208 }; 208 209
+2 -2
drivers/input/misc/pcf8574_keypad.c
··· 80 80 return IRQ_HANDLED; 81 81 } 82 82 83 - static int pcf8574_kp_probe(struct i2c_client *client, const struct i2c_device_id *id) 83 + static int pcf8574_kp_probe(struct i2c_client *client) 84 84 { 85 85 int i, ret; 86 86 struct input_dev *idev; ··· 209 209 .pm = &pcf8574_kp_pm_ops, 210 210 #endif 211 211 }, 212 - .probe = pcf8574_kp_probe, 212 + .probe_new = pcf8574_kp_probe, 213 213 .remove = pcf8574_kp_remove, 214 214 .id_table = pcf8574_kp_id, 215 215 };
+2 -3
drivers/input/mouse/cyapa.c
··· 1244 1244 regulator_disable(cyapa->vcc); 1245 1245 } 1246 1246 1247 - static int cyapa_probe(struct i2c_client *client, 1248 - const struct i2c_device_id *dev_id) 1247 + static int cyapa_probe(struct i2c_client *client) 1249 1248 { 1250 1249 struct device *dev = &client->dev; 1251 1250 struct cyapa *cyapa; ··· 1489 1490 .of_match_table = of_match_ptr(cyapa_of_match), 1490 1491 }, 1491 1492 1492 - .probe = cyapa_probe, 1493 + .probe_new = cyapa_probe, 1493 1494 .id_table = cyapa_id_table, 1494 1495 }; 1495 1496
+3 -17
drivers/input/mouse/elan_i2c_core.c
··· 33 33 #include <linux/jiffies.h> 34 34 #include <linux/completion.h> 35 35 #include <linux/of.h> 36 + #include <linux/pm_wakeirq.h> 36 37 #include <linux/property.h> 37 38 #include <linux/regulator/consumer.h> 38 39 #include <asm/unaligned.h> ··· 86 85 u16 fw_validpage_count; 87 86 u16 fw_page_size; 88 87 u32 fw_signature_address; 89 - 90 - bool irq_wake; 91 88 92 89 u8 min_baseline; 93 90 u8 max_baseline; ··· 1187 1188 regulator_disable(data->vcc); 1188 1189 } 1189 1190 1190 - static int elan_probe(struct i2c_client *client, 1191 - const struct i2c_device_id *dev_id) 1191 + static int elan_probe(struct i2c_client *client) 1192 1192 { 1193 1193 const struct elan_transport_ops *transport_ops; 1194 1194 struct device *dev = &client->dev; ··· 1325 1327 } 1326 1328 } 1327 1329 1328 - /* 1329 - * Systems using device tree should set up wakeup via DTS, 1330 - * the rest will configure device as wakeup source by default. 1331 - */ 1332 - if (!dev->of_node) 1333 - device_init_wakeup(dev, true); 1334 - 1335 1330 return 0; 1336 1331 } 1337 1332 ··· 1347 1356 1348 1357 if (device_may_wakeup(dev)) { 1349 1358 ret = elan_sleep(data); 1350 - /* Enable wake from IRQ */ 1351 - data->irq_wake = (enable_irq_wake(client->irq) == 0); 1352 1359 } else { 1353 1360 ret = elan_set_power(data, false); 1354 1361 if (ret) ··· 1377 1388 dev_err(dev, "error %d enabling regulator\n", error); 1378 1389 goto err; 1379 1390 } 1380 - } else if (data->irq_wake) { 1381 - disable_irq_wake(client->irq); 1382 - data->irq_wake = false; 1383 1391 } 1384 1392 1385 1393 error = elan_set_power(data, true); ··· 1424 1438 .probe_type = PROBE_PREFER_ASYNCHRONOUS, 1425 1439 .dev_groups = elan_sysfs_groups, 1426 1440 }, 1427 - .probe = elan_probe, 1441 + .probe_new = elan_probe, 1428 1442 .id_table = elan_id, 1429 1443 }; 1430 1444
+2 -3
drivers/input/mouse/synaptics_i2c.c
··· 521 521 return touch; 522 522 } 523 523 524 - static int synaptics_i2c_probe(struct i2c_client *client, 525 - const struct i2c_device_id *dev_id) 524 + static int synaptics_i2c_probe(struct i2c_client *client) 526 525 { 527 526 int ret; 528 527 struct synaptics_i2c *touch; ··· 650 651 .pm = &synaptics_i2c_pm, 651 652 }, 652 653 653 - .probe = synaptics_i2c_probe, 654 + .probe_new = synaptics_i2c_probe, 654 655 .remove = synaptics_i2c_remove, 655 656 656 657 .id_table = synaptics_i2c_id_table,
+2 -3
drivers/input/rmi4/rmi_i2c.c
··· 198 198 rmi_unregister_transport_device(&rmi_i2c->xport); 199 199 } 200 200 201 - static int rmi_i2c_probe(struct i2c_client *client, 202 - const struct i2c_device_id *id) 201 + static int rmi_i2c_probe(struct i2c_client *client) 203 202 { 204 203 struct rmi_device_platform_data *pdata; 205 204 struct rmi_device_platform_data *client_pdata = ··· 382 383 .of_match_table = of_match_ptr(rmi_i2c_of_match), 383 384 }, 384 385 .id_table = rmi_id, 385 - .probe = rmi_i2c_probe, 386 + .probe_new = rmi_i2c_probe, 386 387 }; 387 388 388 389 module_i2c_driver(rmi_i2c_driver);
+2 -3
drivers/input/rmi4/rmi_smbus.c
··· 268 268 .reset = rmi_smb_reset, 269 269 }; 270 270 271 - static int rmi_smb_probe(struct i2c_client *client, 272 - const struct i2c_device_id *id) 271 + static int rmi_smb_probe(struct i2c_client *client) 273 272 { 274 273 struct rmi_device_platform_data *pdata = dev_get_platdata(&client->dev); 275 274 struct rmi_smb_xport *rmi_smb; ··· 419 420 .pm = &rmi_smb_pm, 420 421 }, 421 422 .id_table = rmi_id, 422 - .probe = rmi_smb_probe, 423 + .probe_new = rmi_smb_probe, 423 424 .remove = rmi_smb_remove, 424 425 }; 425 426
+41 -1
drivers/input/touchscreen/Kconfig
··· 284 284 To compile this driver as a module, choose M here: the 285 285 module will be called cyttsp4_spi. 286 286 287 + config TOUCHSCREEN_CYTTSP5 288 + tristate "Cypress TrueTouch Gen5 Touchscreen Driver" 289 + depends on I2C 290 + select REGMAP_I2C 291 + select CRC_ITU_T 292 + help 293 + Driver for Parade TrueTouch Standard Product Generation 5 294 + touchscreen controllers. I2C bus interface support only. 295 + 296 + Say Y here if you have a Cypress Gen5 touchscreen. 297 + 298 + If unsure, say N. 299 + 300 + To compile this driver as a module, choose M here: the 301 + module will be called cyttsp5. 302 + 287 303 config TOUCHSCREEN_DA9034 288 304 tristate "Touchscreen support for Dialog Semiconductor DA9034" 289 305 depends on PMIC_DA903X ··· 437 421 438 422 To compile this driver as a module, choose M here: the 439 423 module will be called hycon-hy46xx. 424 + 425 + config TOUCHSCREEN_HYNITRON_CSTXXX 426 + tristate "Hynitron touchscreen support" 427 + depends on I2C 428 + help 429 + Say Y here if you have a touchscreen using a Hynitron 430 + touchscreen controller. 431 + 432 + If unsure, say N. 433 + 434 + To compile this driver as a module, choose M here: the 435 + module will be called hynitron-cstxxx. 440 436 441 437 config TOUCHSCREEN_ILI210X 442 438 tristate "Ilitek ILI210X based touchscreen" ··· 1269 1241 config TOUCHSCREEN_STMPE 1270 1242 tristate "STMicroelectronics STMPE touchscreens" 1271 1243 depends on MFD_STMPE 1272 - depends on (OF || COMPILE_TEST) 1244 + depends on OF 1273 1245 help 1274 1246 Say Y here if you want support for STMicroelectronics 1275 1247 STMPE touchscreen controllers. ··· 1406 1378 1407 1379 To compile this driver as a module, choose M here: the 1408 1380 module will be called zinitix. 1381 + 1382 + config TOUCHSCREEN_HIMAX_HX83112B 1383 + tristate "Himax hx83112b touchscreen driver" 1384 + depends on I2C 1385 + select REGMAP_I2C 1386 + help 1387 + Say Y here to enable support for Himax hx83112b touchscreens. 1388 + 1389 + If unsure, say N. 1390 + 1391 + To compile this driver as a module, choose M here: the 1392 + module will be called himax_hx83112b. 1409 1393 1410 1394 endif
+3
drivers/input/touchscreen/Makefile
··· 30 30 obj-$(CONFIG_TOUCHSCREEN_CYTTSP4_CORE) += cyttsp4_core.o 31 31 obj-$(CONFIG_TOUCHSCREEN_CYTTSP4_I2C) += cyttsp4_i2c.o cyttsp_i2c_common.o 32 32 obj-$(CONFIG_TOUCHSCREEN_CYTTSP4_SPI) += cyttsp4_spi.o 33 + obj-$(CONFIG_TOUCHSCREEN_CYTTSP5) += cyttsp5.o 33 34 obj-$(CONFIG_TOUCHSCREEN_DA9034) += da9034-ts.o 34 35 obj-$(CONFIG_TOUCHSCREEN_DA9052) += da9052_tsi.o 35 36 obj-$(CONFIG_TOUCHSCREEN_DYNAPRO) += dynapro.o ··· 48 47 obj-$(CONFIG_TOUCHSCREEN_FUJITSU) += fujitsu_ts.o 49 48 obj-$(CONFIG_TOUCHSCREEN_GOODIX) += goodix_ts.o 50 49 obj-$(CONFIG_TOUCHSCREEN_HIDEEP) += hideep.o 50 + obj-$(CONFIG_TOUCHSCREEN_HYNITRON_CSTXXX) += hynitron_cstxxx.o 51 51 obj-$(CONFIG_TOUCHSCREEN_ILI210X) += ili210x.o 52 52 obj-$(CONFIG_TOUCHSCREEN_ILITEK) += ilitek_ts_i2c.o 53 53 obj-$(CONFIG_TOUCHSCREEN_IMAGIS) += imagis.o ··· 118 116 obj-$(CONFIG_TOUCHSCREEN_RASPBERRYPI_FW) += raspberrypi-ts.o 119 117 obj-$(CONFIG_TOUCHSCREEN_IQS5XX) += iqs5xx.o 120 118 obj-$(CONFIG_TOUCHSCREEN_ZINITIX) += zinitix.o 119 + obj-$(CONFIG_TOUCHSCREEN_HIMAX_HX83112B) += himax_hx83112b.o
+2 -3
drivers/input/touchscreen/ad7879-i2c.c
··· 23 23 .max_register = 15, 24 24 }; 25 25 26 - static int ad7879_i2c_probe(struct i2c_client *client, 27 - const struct i2c_device_id *id) 26 + static int ad7879_i2c_probe(struct i2c_client *client) 28 27 { 29 28 struct regmap *regmap; 30 29 ··· 62 63 .pm = &ad7879_pm_ops, 63 64 .of_match_table = of_match_ptr(ad7879_i2c_dt_ids), 64 65 }, 65 - .probe = ad7879_i2c_probe, 66 + .probe_new = ad7879_i2c_probe, 66 67 .id_table = ad7879_id, 67 68 }; 68 69
+2 -3
drivers/input/touchscreen/ar1021_i2c.c
··· 87 87 disable_irq(client->irq); 88 88 } 89 89 90 - static int ar1021_i2c_probe(struct i2c_client *client, 91 - const struct i2c_device_id *id) 90 + static int ar1021_i2c_probe(struct i2c_client *client) 92 91 { 93 92 struct ar1021_i2c *ar1021; 94 93 struct input_dev *input; ··· 181 182 .of_match_table = ar1021_i2c_of_match, 182 183 }, 183 184 184 - .probe = ar1021_i2c_probe, 185 + .probe_new = ar1021_i2c_probe, 185 186 .id_table = ar1021_i2c_id, 186 187 }; 187 188 module_i2c_driver(ar1021_i2c_driver);
+2 -2
drivers/input/touchscreen/atmel_mxt_ts.c
··· 3129 3129 { } 3130 3130 }; 3131 3131 3132 - static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id) 3132 + static int mxt_probe(struct i2c_client *client) 3133 3133 { 3134 3134 struct mxt_data *data; 3135 3135 int error; ··· 3377 3377 .acpi_match_table = ACPI_PTR(mxt_acpi_id), 3378 3378 .pm = &mxt_pm_ops, 3379 3379 }, 3380 - .probe = mxt_probe, 3380 + .probe_new = mxt_probe, 3381 3381 .remove = mxt_remove, 3382 3382 .id_table = mxt_id, 3383 3383 };
+2 -3
drivers/input/touchscreen/auo-pixcir-ts.c
··· 482 482 gpiod_set_value_cansleep(ts->gpio_rst, 1); 483 483 } 484 484 485 - static int auo_pixcir_probe(struct i2c_client *client, 486 - const struct i2c_device_id *id) 485 + static int auo_pixcir_probe(struct i2c_client *client) 487 486 { 488 487 struct auo_pixcir_ts *ts; 489 488 struct input_dev *input_dev; ··· 636 637 .pm = &auo_pixcir_pm_ops, 637 638 .of_match_table = of_match_ptr(auo_pixcir_ts_dt_idtable), 638 639 }, 639 - .probe = auo_pixcir_probe, 640 + .probe_new = auo_pixcir_probe, 640 641 .id_table = auo_pixcir_idtable, 641 642 }; 642 643
+2 -3
drivers/input/touchscreen/bu21013_ts.c
··· 404 404 gpiod_set_value(ts->cs_gpiod, 0); 405 405 } 406 406 407 - static int bu21013_probe(struct i2c_client *client, 408 - const struct i2c_device_id *id) 407 + static int bu21013_probe(struct i2c_client *client) 409 408 { 410 409 struct bu21013_ts *ts; 411 410 struct input_dev *in_dev; ··· 617 618 .name = DRIVER_TP, 618 619 .pm = &bu21013_dev_pm_ops, 619 620 }, 620 - .probe = bu21013_probe, 621 + .probe_new = bu21013_probe, 621 622 .remove = bu21013_remove, 622 623 .id_table = bu21013_id, 623 624 };
+2 -3
drivers/input/touchscreen/bu21029_ts.c
··· 331 331 regulator_disable(bu21029->vdd); 332 332 } 333 333 334 - static int bu21029_probe(struct i2c_client *client, 335 - const struct i2c_device_id *id) 334 + static int bu21029_probe(struct i2c_client *client) 336 335 { 337 336 struct bu21029_ts_data *bu21029; 338 337 struct input_dev *in_dev; ··· 474 475 .pm = &bu21029_pm_ops, 475 476 }, 476 477 .id_table = bu21029_ids, 477 - .probe = bu21029_probe, 478 + .probe_new = bu21029_probe, 478 479 }; 479 480 module_i2c_driver(bu21029_driver); 480 481
+2 -3
drivers/input/touchscreen/chipone_icn8318.c
··· 176 176 177 177 static SIMPLE_DEV_PM_OPS(icn8318_pm_ops, icn8318_suspend, icn8318_resume); 178 178 179 - static int icn8318_probe(struct i2c_client *client, 180 - const struct i2c_device_id *id) 179 + static int icn8318_probe(struct i2c_client *client) 181 180 { 182 181 struct device *dev = &client->dev; 183 182 struct icn8318_data *data; ··· 266 267 .pm = &icn8318_pm_ops, 267 268 .of_match_table = icn8318_of_match, 268 269 }, 269 - .probe = icn8318_probe, 270 + .probe_new = icn8318_probe, 270 271 .id_table = icn8318_i2c_id, 271 272 }; 272 273
+2 -3
drivers/input/touchscreen/cy8ctma140.c
··· 198 198 cy8ctma140_power_down(ts); 199 199 } 200 200 201 - static int cy8ctma140_probe(struct i2c_client *client, 202 - const struct i2c_device_id *id) 201 + static int cy8ctma140_probe(struct i2c_client *client) 203 202 { 204 203 struct cy8ctma140 *ts; 205 204 struct input_dev *input; ··· 343 344 .of_match_table = cy8ctma140_of_match, 344 345 }, 345 346 .id_table = cy8ctma140_idtable, 346 - .probe = cy8ctma140_probe, 347 + .probe_new = cy8ctma140_probe, 347 348 }; 348 349 module_i2c_driver(cy8ctma140_driver); 349 350
+2 -3
drivers/input/touchscreen/cy8ctmg110_ts.c
··· 168 168 cy8ctmg110_power(ts, false); 169 169 } 170 170 171 - static int cy8ctmg110_probe(struct i2c_client *client, 172 - const struct i2c_device_id *id) 171 + static int cy8ctmg110_probe(struct i2c_client *client) 173 172 { 174 173 struct cy8ctmg110 *ts; 175 174 struct input_dev *input_dev; ··· 278 279 .pm = &cy8ctmg110_pm, 279 280 }, 280 281 .id_table = cy8ctmg110_idtable, 281 - .probe = cy8ctmg110_probe, 282 + .probe_new = cy8ctmg110_probe, 282 283 }; 283 284 284 285 module_i2c_driver(cy8ctmg110_driver);
+2 -3
drivers/input/touchscreen/cyttsp4_i2c.c
··· 27 27 .read = cyttsp_i2c_read_block_data, 28 28 }; 29 29 30 - static int cyttsp4_i2c_probe(struct i2c_client *client, 31 - const struct i2c_device_id *id) 30 + static int cyttsp4_i2c_probe(struct i2c_client *client) 32 31 { 33 32 struct cyttsp4 *ts; 34 33 ··· 60 61 .name = CYTTSP4_I2C_NAME, 61 62 .pm = &cyttsp4_pm_ops, 62 63 }, 63 - .probe = cyttsp4_i2c_probe, 64 + .probe_new = cyttsp4_i2c_probe, 64 65 .remove = cyttsp4_i2c_remove, 65 66 .id_table = cyttsp4_i2c_id, 66 67 };
+900
drivers/input/touchscreen/cyttsp5.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* 3 + * Parade TrueTouch(TM) Standard Product V5 Module. 4 + * 5 + * Copyright (C) 2015 Parade Technologies 6 + * Copyright (C) 2012-2015 Cypress Semiconductor 7 + * Copyright (C) 2018 Bootlin 8 + * 9 + * Authors: Mylène Josserand <mylene.josserand@bootlin.com> 10 + * Alistair Francis <alistair@alistair23.me> 11 + */ 12 + 13 + #include <linux/crc-itu-t.h> 14 + #include <linux/delay.h> 15 + #include <linux/device.h> 16 + #include <linux/gpio/consumer.h> 17 + #include <linux/input/mt.h> 18 + #include <linux/input/touchscreen.h> 19 + #include <linux/interrupt.h> 20 + #include <linux/i2c.h> 21 + #include <linux/module.h> 22 + #include <linux/of_device.h> 23 + #include <linux/regmap.h> 24 + #include <asm/unaligned.h> 25 + 26 + #define CYTTSP5_NAME "cyttsp5" 27 + #define CY_I2C_DATA_SIZE (2 * 256) 28 + #define HID_VERSION 0x0100 29 + #define CY_MAX_INPUT 512 30 + #define CYTTSP5_PREALLOCATED_CMD_BUFFER 32 31 + #define CY_BITS_PER_BTN 1 32 + #define CY_NUM_BTN_EVENT_ID GENMASK(CY_BITS_PER_BTN, 0) 33 + 34 + #define MAX_AREA 255 35 + #define HID_OUTPUT_BL_SOP 0x1 36 + #define HID_OUTPUT_BL_EOP 0x17 37 + #define HID_OUTPUT_BL_LAUNCH_APP 0x3B 38 + #define HID_OUTPUT_BL_LAUNCH_APP_SIZE 11 39 + #define HID_OUTPUT_GET_SYSINFO 0x2 40 + #define HID_OUTPUT_GET_SYSINFO_SIZE 5 41 + #define HID_OUTPUT_MAX_CMD_SIZE 12 42 + 43 + #define HID_DESC_REG 0x1 44 + #define HID_INPUT_REG 0x3 45 + #define HID_OUTPUT_REG 0x4 46 + 47 + #define REPORT_ID_TOUCH 0x1 48 + #define REPORT_ID_BTN 0x3 49 + #define REPORT_SIZE_5 5 50 + #define REPORT_SIZE_8 8 51 + #define REPORT_SIZE_16 16 52 + 53 + /* Touch reports offsets */ 54 + /* Header offsets */ 55 + #define TOUCH_REPORT_DESC_HDR_CONTACTCOUNT 16 56 + /* Record offsets */ 57 + #define TOUCH_REPORT_DESC_CONTACTID 8 58 + #define TOUCH_REPORT_DESC_X 16 59 + #define TOUCH_REPORT_DESC_Y 32 60 + #define TOUCH_REPORT_DESC_P 48 61 + #define TOUCH_REPORT_DESC_MAJ 56 62 + #define TOUCH_REPORT_DESC_MIN 64 63 + 64 + /* HID */ 65 + #define HID_TOUCH_REPORT_ID 0x1 66 + #define HID_BTN_REPORT_ID 0x3 67 + #define HID_APP_RESPONSE_REPORT_ID 0x1F 68 + #define HID_APP_OUTPUT_REPORT_ID 0x2F 69 + #define HID_BL_RESPONSE_REPORT_ID 0x30 70 + #define HID_BL_OUTPUT_REPORT_ID 0x40 71 + 72 + #define HID_OUTPUT_RESPONSE_REPORT_OFFSET 2 73 + #define HID_OUTPUT_RESPONSE_CMD_OFFSET 4 74 + #define HID_OUTPUT_RESPONSE_CMD_MASK GENMASK(6, 0) 75 + 76 + #define HID_SYSINFO_SENSING_OFFSET 33 77 + #define HID_SYSINFO_BTN_OFFSET 48 78 + #define HID_SYSINFO_BTN_MASK GENMASK(7, 0) 79 + #define HID_SYSINFO_MAX_BTN 8 80 + 81 + #define CY_HID_OUTPUT_TIMEOUT_MS 200 82 + #define CY_HID_OUTPUT_GET_SYSINFO_TIMEOUT_MS 3000 83 + #define CY_HID_GET_HID_DESCRIPTOR_TIMEOUT_MS 4000 84 + 85 + /* maximum number of concurrent tracks */ 86 + #define TOUCH_REPORT_SIZE 10 87 + #define TOUCH_INPUT_HEADER_SIZE 7 88 + #define BTN_REPORT_SIZE 9 89 + #define BTN_INPUT_HEADER_SIZE 5 90 + 91 + #define MAX_CY_TCH_T_IDS 32 92 + 93 + /* All usage pages for Touch Report */ 94 + #define TOUCH_REPORT_USAGE_PG_X 0x00010030 95 + #define TOUCH_REPORT_USAGE_PG_Y 0x00010031 96 + #define TOUCH_REPORT_USAGE_PG_P 0x000D0030 97 + #define TOUCH_REPORT_USAGE_PG_CONTACTID 0x000D0051 98 + #define TOUCH_REPORT_USAGE_PG_CONTACTCOUNT 0x000D0054 99 + #define TOUCH_REPORT_USAGE_PG_MAJ 0xFF010062 100 + #define TOUCH_REPORT_USAGE_PG_MIN 0xFF010063 101 + #define TOUCH_COL_USAGE_PG 0x000D0022 102 + 103 + /* System Information interface definitions */ 104 + struct cyttsp5_sensing_conf_data_dev { 105 + u8 electrodes_x; 106 + u8 electrodes_y; 107 + __le16 len_x; 108 + __le16 len_y; 109 + __le16 res_x; 110 + __le16 res_y; 111 + __le16 max_z; 112 + u8 origin_x; 113 + u8 origin_y; 114 + u8 btn; 115 + u8 scan_mode; 116 + u8 max_num_of_tch_per_refresh_cycle; 117 + } __packed; 118 + 119 + struct cyttsp5_sensing_conf_data { 120 + u16 res_x; 121 + u16 res_y; 122 + u16 max_z; 123 + u16 len_x; 124 + u16 len_y; 125 + u8 origin_x; 126 + u8 origin_y; 127 + u8 max_tch; 128 + }; 129 + 130 + enum cyttsp5_tch_abs { /* for ordering within the extracted touch data array */ 131 + CY_TCH_X, /* X */ 132 + CY_TCH_Y, /* Y */ 133 + CY_TCH_P, /* P (Z) */ 134 + CY_TCH_T, /* TOUCH ID */ 135 + CY_TCH_MAJ, /* TOUCH_MAJOR */ 136 + CY_TCH_MIN, /* TOUCH_MINOR */ 137 + CY_TCH_NUM_ABS 138 + }; 139 + 140 + struct cyttsp5_tch_abs_params { 141 + size_t ofs; /* abs byte offset */ 142 + size_t size; /* size in bits */ 143 + size_t min; /* min value */ 144 + size_t max; /* max value */ 145 + size_t bofs; /* bit offset */ 146 + }; 147 + 148 + struct cyttsp5_touch { 149 + int abs[CY_TCH_NUM_ABS]; 150 + }; 151 + 152 + struct cyttsp5_sysinfo { 153 + struct cyttsp5_sensing_conf_data sensing_conf_data; 154 + int num_btns; 155 + struct cyttsp5_tch_abs_params tch_hdr; 156 + struct cyttsp5_tch_abs_params tch_abs[CY_TCH_NUM_ABS]; 157 + u32 key_code[HID_SYSINFO_MAX_BTN]; 158 + }; 159 + 160 + struct cyttsp5_hid_desc { 161 + __le16 hid_desc_len; 162 + u8 packet_id; 163 + u8 reserved_byte; 164 + __le16 bcd_version; 165 + __le16 report_desc_len; 166 + __le16 report_desc_register; 167 + __le16 input_register; 168 + __le16 max_input_len; 169 + __le16 output_register; 170 + __le16 max_output_len; 171 + __le16 command_register; 172 + __le16 data_register; 173 + __le16 vendor_id; 174 + __le16 product_id; 175 + __le16 version_id; 176 + u8 reserved[4]; 177 + } __packed; 178 + 179 + struct cyttsp5 { 180 + struct device *dev; 181 + struct completion cmd_done; 182 + struct cyttsp5_sysinfo sysinfo; 183 + struct cyttsp5_hid_desc hid_desc; 184 + u8 cmd_buf[CYTTSP5_PREALLOCATED_CMD_BUFFER]; 185 + u8 input_buf[CY_MAX_INPUT]; 186 + u8 response_buf[CY_MAX_INPUT]; 187 + struct gpio_desc *reset_gpio; 188 + struct input_dev *input; 189 + char phys[NAME_MAX]; 190 + int num_prv_rec; 191 + struct regmap *regmap; 192 + struct touchscreen_properties prop; 193 + struct regulator *vdd; 194 + }; 195 + 196 + /* 197 + * For what is understood in the datasheet, the register does not 198 + * matter. For consistency, use the Input Register address 199 + * but it does mean anything to the device. The important data 200 + * to send is the I2C address 201 + */ 202 + static int cyttsp5_read(struct cyttsp5 *ts, u8 *buf, u32 max) 203 + { 204 + int error; 205 + u32 size; 206 + u8 temp[2]; 207 + 208 + /* Read the frame to retrieve the size */ 209 + error = regmap_bulk_read(ts->regmap, HID_INPUT_REG, temp, sizeof(temp)); 210 + if (error) 211 + return error; 212 + 213 + size = get_unaligned_le16(temp); 214 + if (!size || size == 2) 215 + return 0; 216 + 217 + if (size > max) 218 + return -EINVAL; 219 + 220 + /* Get the real value */ 221 + return regmap_bulk_read(ts->regmap, HID_INPUT_REG, buf, size); 222 + } 223 + 224 + static int cyttsp5_write(struct cyttsp5 *ts, unsigned int reg, u8 *data, 225 + size_t size) 226 + { 227 + u8 cmd[HID_OUTPUT_MAX_CMD_SIZE]; 228 + 229 + if (size + 1 > HID_OUTPUT_MAX_CMD_SIZE) 230 + return -E2BIG; 231 + 232 + /* High bytes of register address needed as first byte of cmd */ 233 + cmd[0] = (reg >> 8) & 0xFF; 234 + 235 + /* Copy the rest of the data */ 236 + if (data) 237 + memcpy(&cmd[1], data, size); 238 + 239 + /* 240 + * The hardware wants to receive a frame with the address register 241 + * contained in the first two bytes. As the regmap_write function 242 + * add the register adresse in the frame, we use the low byte as 243 + * first frame byte for the address register and the first 244 + * data byte is the high register + left of the cmd to send 245 + */ 246 + return regmap_bulk_write(ts->regmap, reg & 0xFF, cmd, size + 1); 247 + } 248 + 249 + static void cyttsp5_get_touch_axis(int *axis, int size, int max, u8 *xy_data, 250 + int bofs) 251 + { 252 + int nbyte; 253 + 254 + for (nbyte = 0, *axis = 0; nbyte < size; nbyte++) 255 + *axis += ((xy_data[nbyte] >> bofs) << (nbyte * 8)); 256 + 257 + *axis &= max - 1; 258 + } 259 + 260 + static void cyttsp5_get_touch_record(struct cyttsp5 *ts, 261 + struct cyttsp5_touch *touch, u8 *xy_data) 262 + { 263 + struct cyttsp5_sysinfo *si = &ts->sysinfo; 264 + enum cyttsp5_tch_abs abs; 265 + 266 + for (abs = CY_TCH_X; abs < CY_TCH_NUM_ABS; abs++) 267 + cyttsp5_get_touch_axis(&touch->abs[abs], 268 + si->tch_abs[abs].size, 269 + si->tch_abs[abs].max, 270 + xy_data + si->tch_abs[abs].ofs, 271 + si->tch_abs[abs].bofs); 272 + } 273 + 274 + static void cyttsp5_get_mt_touches(struct cyttsp5 *ts, 275 + struct cyttsp5_touch *tch, int num_cur_tch) 276 + { 277 + struct cyttsp5_sysinfo *si = &ts->sysinfo; 278 + int i, t = 0, offset = 0; 279 + DECLARE_BITMAP(ids, MAX_CY_TCH_T_IDS); 280 + u8 *tch_addr; 281 + int tmp; 282 + 283 + bitmap_zero(ids, MAX_CY_TCH_T_IDS); 284 + memset(tch->abs, 0, sizeof(tch->abs)); 285 + 286 + switch (ts->input_buf[2]) { 287 + case HID_TOUCH_REPORT_ID: 288 + offset = TOUCH_INPUT_HEADER_SIZE; 289 + break; 290 + case HID_BTN_REPORT_ID: 291 + offset = BTN_INPUT_HEADER_SIZE; 292 + break; 293 + } 294 + 295 + for (i = 0; i < num_cur_tch; i++) { 296 + tch_addr = ts->input_buf + offset + (i * TOUCH_REPORT_SIZE); 297 + cyttsp5_get_touch_record(ts, tch, tch_addr); 298 + 299 + /* Convert MAJOR/MINOR from mm to resolution */ 300 + tmp = tch->abs[CY_TCH_MAJ] * 100 * si->sensing_conf_data.res_x; 301 + tch->abs[CY_TCH_MAJ] = tmp / si->sensing_conf_data.len_x; 302 + tmp = tch->abs[CY_TCH_MIN] * 100 * si->sensing_conf_data.res_x; 303 + tch->abs[CY_TCH_MIN] = tmp / si->sensing_conf_data.len_x; 304 + 305 + t = tch->abs[CY_TCH_T]; 306 + input_mt_slot(ts->input, t); 307 + input_mt_report_slot_state(ts->input, MT_TOOL_FINGER, true); 308 + __set_bit(t, ids); 309 + 310 + /* position and pressure fields */ 311 + touchscreen_report_pos(ts->input, &ts->prop, 312 + tch->abs[CY_TCH_X], tch->abs[CY_TCH_Y], 313 + true); 314 + input_report_abs(ts->input, ABS_MT_PRESSURE, 315 + tch->abs[CY_TCH_P]); 316 + 317 + /* Get the extended touch fields */ 318 + input_report_abs(ts->input, ABS_MT_TOUCH_MAJOR, 319 + tch->abs[CY_TCH_MAJ]); 320 + input_report_abs(ts->input, ABS_MT_TOUCH_MINOR, 321 + tch->abs[CY_TCH_MIN]); 322 + } 323 + 324 + ts->num_prv_rec = num_cur_tch; 325 + } 326 + 327 + static int cyttsp5_mt_attention(struct device *dev) 328 + { 329 + struct cyttsp5 *ts = dev_get_drvdata(dev); 330 + struct cyttsp5_sysinfo *si = &ts->sysinfo; 331 + int max_tch = si->sensing_conf_data.max_tch; 332 + struct cyttsp5_touch tch; 333 + int num_cur_tch; 334 + 335 + cyttsp5_get_touch_axis(&num_cur_tch, si->tch_hdr.size, 336 + si->tch_hdr.max, 337 + ts->input_buf + 3 + si->tch_hdr.ofs, 338 + si->tch_hdr.bofs); 339 + 340 + if (num_cur_tch > max_tch) { 341 + dev_err(dev, "Num touch err detected (n=%d)\n", num_cur_tch); 342 + num_cur_tch = max_tch; 343 + } 344 + 345 + if (num_cur_tch == 0 && ts->num_prv_rec == 0) 346 + return 0; 347 + 348 + /* extract xy_data for all currently reported touches */ 349 + if (num_cur_tch) 350 + cyttsp5_get_mt_touches(ts, &tch, num_cur_tch); 351 + 352 + input_mt_sync_frame(ts->input); 353 + input_sync(ts->input); 354 + 355 + return 0; 356 + } 357 + 358 + static int cyttsp5_setup_input_device(struct device *dev) 359 + { 360 + struct cyttsp5 *ts = dev_get_drvdata(dev); 361 + struct cyttsp5_sysinfo *si = &ts->sysinfo; 362 + int max_x, max_y, max_p; 363 + int max_x_tmp, max_y_tmp; 364 + int error; 365 + 366 + max_x_tmp = si->sensing_conf_data.res_x; 367 + max_y_tmp = si->sensing_conf_data.res_y; 368 + max_x = max_x_tmp - 1; 369 + max_y = max_y_tmp - 1; 370 + max_p = si->sensing_conf_data.max_z; 371 + 372 + input_set_abs_params(ts->input, ABS_MT_POSITION_X, 0, max_x, 0, 0); 373 + input_set_abs_params(ts->input, ABS_MT_POSITION_Y, 0, max_y, 0, 0); 374 + input_set_abs_params(ts->input, ABS_MT_PRESSURE, 0, max_p, 0, 0); 375 + 376 + input_set_abs_params(ts->input, ABS_MT_TOUCH_MAJOR, 0, MAX_AREA, 0, 0); 377 + input_set_abs_params(ts->input, ABS_MT_TOUCH_MINOR, 0, MAX_AREA, 0, 0); 378 + 379 + error = input_mt_init_slots(ts->input, si->tch_abs[CY_TCH_T].max, 380 + INPUT_MT_DROP_UNUSED | INPUT_MT_DIRECT); 381 + if (error) 382 + return error; 383 + 384 + error = input_register_device(ts->input); 385 + if (error) { 386 + dev_err(dev, "failed to register input device: %d\n", error); 387 + return error; 388 + } 389 + 390 + return error; 391 + } 392 + 393 + static int cyttsp5_parse_dt_key_code(struct device *dev) 394 + { 395 + struct cyttsp5 *ts = dev_get_drvdata(dev); 396 + struct cyttsp5_sysinfo *si = &ts->sysinfo; 397 + 398 + if (!si->num_btns) 399 + return 0; 400 + 401 + /* Initialize the button to RESERVED */ 402 + memset32(si->key_code, KEY_RESERVED, si->num_btns); 403 + 404 + return device_property_read_u32_array(dev, "linux,keycodes", 405 + si->key_code, si->num_btns); 406 + } 407 + 408 + static int cyttsp5_btn_attention(struct device *dev) 409 + { 410 + struct cyttsp5 *ts = dev_get_drvdata(dev); 411 + struct cyttsp5_sysinfo *si = &ts->sysinfo; 412 + int cur_btn, offset = 0; 413 + int cur_btn_state; 414 + 415 + switch (ts->input_buf[2]) { 416 + case HID_TOUCH_REPORT_ID: 417 + offset = TOUCH_INPUT_HEADER_SIZE; 418 + break; 419 + case HID_BTN_REPORT_ID: 420 + offset = BTN_INPUT_HEADER_SIZE; 421 + break; 422 + } 423 + 424 + if (ts->input_buf[2] != HID_BTN_REPORT_ID) 425 + return 0; 426 + 427 + /* extract button press/release touch information */ 428 + for (cur_btn = 0; cur_btn < si->num_btns; cur_btn++) { 429 + /* Get current button state */ 430 + cur_btn_state = (ts->input_buf[offset] >> (cur_btn * CY_BITS_PER_BTN)) 431 + & CY_NUM_BTN_EVENT_ID; 432 + 433 + input_report_key(ts->input, si->key_code[cur_btn], 434 + cur_btn_state); 435 + input_sync(ts->input); 436 + } 437 + 438 + return 0; 439 + } 440 + 441 + static int cyttsp5_validate_cmd_response(struct cyttsp5 *ts, u8 code) 442 + { 443 + u16 size, crc; 444 + u8 status, report_id; 445 + int command_code; 446 + 447 + size = get_unaligned_le16(&ts->response_buf[0]); 448 + if (!size) 449 + return 0; 450 + 451 + report_id = ts->response_buf[HID_OUTPUT_RESPONSE_REPORT_OFFSET]; 452 + 453 + switch (report_id) { 454 + case HID_BL_RESPONSE_REPORT_ID: 455 + if (ts->response_buf[4] != HID_OUTPUT_BL_SOP) { 456 + dev_err(ts->dev, "HID output response, wrong SOP\n"); 457 + return -EPROTO; 458 + } 459 + 460 + if (ts->response_buf[size - 1] != HID_OUTPUT_BL_EOP) { 461 + dev_err(ts->dev, "HID output response, wrong EOP\n"); 462 + return -EPROTO; 463 + } 464 + 465 + crc = crc_itu_t(0xFFFF, &ts->response_buf[4], size - 7); 466 + if (get_unaligned_le16(&ts->response_buf[size - 3]) != crc) { 467 + dev_err(ts->dev, 468 + "HID output response, wrong CRC 0x%X\n", 469 + crc); 470 + return -EPROTO; 471 + } 472 + 473 + status = ts->response_buf[5]; 474 + if (status) { 475 + dev_err(ts->dev, "HID output response, ERROR:%d\n", 476 + status); 477 + return -EPROTO; 478 + } 479 + break; 480 + 481 + case HID_APP_RESPONSE_REPORT_ID: 482 + command_code = ts->response_buf[HID_OUTPUT_RESPONSE_CMD_OFFSET] 483 + & HID_OUTPUT_RESPONSE_CMD_MASK; 484 + if (command_code != code) { 485 + dev_err(ts->dev, 486 + "HID output response, wrong command_code:%X\n", 487 + command_code); 488 + return -EPROTO; 489 + } 490 + break; 491 + } 492 + 493 + return 0; 494 + } 495 + 496 + static void cyttsp5_si_get_btn_data(struct cyttsp5 *ts) 497 + { 498 + struct cyttsp5_sysinfo *si = &ts->sysinfo; 499 + unsigned int btns = ts->response_buf[HID_SYSINFO_BTN_OFFSET] & 500 + HID_SYSINFO_BTN_MASK; 501 + 502 + si->num_btns = hweight8(btns); 503 + } 504 + 505 + static int cyttsp5_get_sysinfo_regs(struct cyttsp5 *ts) 506 + { 507 + struct cyttsp5_sensing_conf_data *scd = &ts->sysinfo.sensing_conf_data; 508 + struct cyttsp5_sensing_conf_data_dev *scd_dev = 509 + (struct cyttsp5_sensing_conf_data_dev *) 510 + &ts->response_buf[HID_SYSINFO_SENSING_OFFSET]; 511 + 512 + cyttsp5_si_get_btn_data(ts); 513 + 514 + scd->max_tch = scd_dev->max_num_of_tch_per_refresh_cycle; 515 + scd->res_x = get_unaligned_le16(&scd_dev->res_x); 516 + scd->res_y = get_unaligned_le16(&scd_dev->res_y); 517 + scd->max_z = get_unaligned_le16(&scd_dev->max_z); 518 + scd->len_x = get_unaligned_le16(&scd_dev->len_x); 519 + scd->len_y = get_unaligned_le16(&scd_dev->len_y); 520 + 521 + return 0; 522 + } 523 + 524 + static int cyttsp5_hid_output_get_sysinfo(struct cyttsp5 *ts) 525 + { 526 + int rc; 527 + u8 cmd[HID_OUTPUT_GET_SYSINFO_SIZE]; 528 + 529 + /* HI bytes of Output register address */ 530 + put_unaligned_le16(HID_OUTPUT_GET_SYSINFO_SIZE, cmd); 531 + cmd[2] = HID_APP_OUTPUT_REPORT_ID; 532 + cmd[3] = 0x0; /* Reserved */ 533 + cmd[4] = HID_OUTPUT_GET_SYSINFO; 534 + 535 + rc = cyttsp5_write(ts, HID_OUTPUT_REG, cmd, 536 + HID_OUTPUT_GET_SYSINFO_SIZE); 537 + if (rc) { 538 + dev_err(ts->dev, "Failed to write command %d", rc); 539 + return rc; 540 + } 541 + 542 + rc = wait_for_completion_interruptible_timeout(&ts->cmd_done, 543 + msecs_to_jiffies(CY_HID_OUTPUT_GET_SYSINFO_TIMEOUT_MS)); 544 + if (rc <= 0) { 545 + dev_err(ts->dev, "HID output cmd execution timed out\n"); 546 + rc = -ETIMEDOUT; 547 + return rc; 548 + } 549 + 550 + rc = cyttsp5_validate_cmd_response(ts, HID_OUTPUT_GET_SYSINFO); 551 + if (rc) { 552 + dev_err(ts->dev, "Validation of the response failed\n"); 553 + return rc; 554 + } 555 + 556 + return cyttsp5_get_sysinfo_regs(ts); 557 + } 558 + 559 + static int cyttsp5_hid_output_bl_launch_app(struct cyttsp5 *ts) 560 + { 561 + int rc; 562 + u8 cmd[HID_OUTPUT_BL_LAUNCH_APP]; 563 + u16 crc; 564 + 565 + put_unaligned_le16(HID_OUTPUT_BL_LAUNCH_APP_SIZE, cmd); 566 + cmd[2] = HID_BL_OUTPUT_REPORT_ID; 567 + cmd[3] = 0x0; /* Reserved */ 568 + cmd[4] = HID_OUTPUT_BL_SOP; 569 + cmd[5] = HID_OUTPUT_BL_LAUNCH_APP; 570 + put_unaligned_le16(0x00, &cmd[6]); 571 + crc = crc_itu_t(0xFFFF, &cmd[4], 4); 572 + put_unaligned_le16(crc, &cmd[8]); 573 + cmd[10] = HID_OUTPUT_BL_EOP; 574 + 575 + rc = cyttsp5_write(ts, HID_OUTPUT_REG, cmd, 576 + HID_OUTPUT_BL_LAUNCH_APP_SIZE); 577 + if (rc) { 578 + dev_err(ts->dev, "Failed to write command %d", rc); 579 + return rc; 580 + } 581 + 582 + rc = wait_for_completion_interruptible_timeout(&ts->cmd_done, 583 + msecs_to_jiffies(CY_HID_OUTPUT_TIMEOUT_MS)); 584 + if (rc <= 0) { 585 + dev_err(ts->dev, "HID output cmd execution timed out\n"); 586 + rc = -ETIMEDOUT; 587 + return rc; 588 + } 589 + 590 + rc = cyttsp5_validate_cmd_response(ts, HID_OUTPUT_BL_LAUNCH_APP); 591 + if (rc) { 592 + dev_err(ts->dev, "Validation of the response failed\n"); 593 + return rc; 594 + } 595 + 596 + return 0; 597 + } 598 + 599 + static int cyttsp5_get_hid_descriptor(struct cyttsp5 *ts, 600 + struct cyttsp5_hid_desc *desc) 601 + { 602 + struct device *dev = ts->dev; 603 + __le16 hid_desc_register = cpu_to_le16(HID_DESC_REG); 604 + int rc; 605 + u8 cmd[2]; 606 + 607 + /* Set HID descriptor register */ 608 + memcpy(cmd, &hid_desc_register, sizeof(hid_desc_register)); 609 + 610 + rc = cyttsp5_write(ts, HID_DESC_REG, NULL, 0); 611 + if (rc) { 612 + dev_err(dev, "Failed to get HID descriptor, rc=%d\n", rc); 613 + return rc; 614 + } 615 + 616 + rc = wait_for_completion_interruptible_timeout(&ts->cmd_done, 617 + msecs_to_jiffies(CY_HID_GET_HID_DESCRIPTOR_TIMEOUT_MS)); 618 + if (rc <= 0) { 619 + dev_err(ts->dev, "HID get descriptor timed out\n"); 620 + rc = -ETIMEDOUT; 621 + return rc; 622 + } 623 + 624 + memcpy(desc, ts->response_buf, sizeof(*desc)); 625 + 626 + /* Check HID descriptor length and version */ 627 + if (le16_to_cpu(desc->hid_desc_len) != sizeof(*desc) || 628 + le16_to_cpu(desc->bcd_version) != HID_VERSION) { 629 + dev_err(dev, "Unsupported HID version\n"); 630 + return -ENODEV; 631 + } 632 + 633 + return 0; 634 + } 635 + 636 + static int fill_tch_abs(struct cyttsp5_tch_abs_params *tch_abs, int report_size, 637 + int offset) 638 + { 639 + tch_abs->ofs = offset / 8; 640 + tch_abs->size = report_size / 8; 641 + if (report_size % 8) 642 + tch_abs->size += 1; 643 + tch_abs->min = 0; 644 + tch_abs->max = 1 << report_size; 645 + tch_abs->bofs = offset - (tch_abs->ofs << 3); 646 + 647 + return 0; 648 + } 649 + 650 + static irqreturn_t cyttsp5_handle_irq(int irq, void *handle) 651 + { 652 + struct cyttsp5 *ts = handle; 653 + int report_id; 654 + int size; 655 + int error; 656 + 657 + error = cyttsp5_read(ts, ts->input_buf, CY_MAX_INPUT); 658 + if (error) 659 + return IRQ_HANDLED; 660 + 661 + size = get_unaligned_le16(&ts->input_buf[0]); 662 + if (size == 0) { 663 + /* reset */ 664 + report_id = 0; 665 + size = 2; 666 + } else { 667 + report_id = ts->input_buf[2]; 668 + } 669 + 670 + switch (report_id) { 671 + case HID_TOUCH_REPORT_ID: 672 + cyttsp5_mt_attention(ts->dev); 673 + break; 674 + case HID_BTN_REPORT_ID: 675 + cyttsp5_btn_attention(ts->dev); 676 + break; 677 + default: 678 + /* It is not an input but a command response */ 679 + memcpy(ts->response_buf, ts->input_buf, size); 680 + complete(&ts->cmd_done); 681 + } 682 + 683 + return IRQ_HANDLED; 684 + } 685 + 686 + static int cyttsp5_deassert_int(struct cyttsp5 *ts) 687 + { 688 + u16 size; 689 + u8 buf[2]; 690 + int error; 691 + 692 + error = regmap_bulk_read(ts->regmap, HID_INPUT_REG, buf, sizeof(buf)); 693 + if (error < 0) 694 + return error; 695 + 696 + size = get_unaligned_le16(&buf[0]); 697 + if (size == 2 || size == 0) 698 + return 0; 699 + 700 + return -EINVAL; 701 + } 702 + 703 + static int cyttsp5_fill_all_touch(struct cyttsp5 *ts) 704 + { 705 + struct cyttsp5_sysinfo *si = &ts->sysinfo; 706 + 707 + fill_tch_abs(&si->tch_abs[CY_TCH_X], REPORT_SIZE_16, 708 + TOUCH_REPORT_DESC_X); 709 + fill_tch_abs(&si->tch_abs[CY_TCH_Y], REPORT_SIZE_16, 710 + TOUCH_REPORT_DESC_Y); 711 + fill_tch_abs(&si->tch_abs[CY_TCH_P], REPORT_SIZE_8, 712 + TOUCH_REPORT_DESC_P); 713 + fill_tch_abs(&si->tch_abs[CY_TCH_T], REPORT_SIZE_5, 714 + TOUCH_REPORT_DESC_CONTACTID); 715 + fill_tch_abs(&si->tch_hdr, REPORT_SIZE_5, 716 + TOUCH_REPORT_DESC_HDR_CONTACTCOUNT); 717 + fill_tch_abs(&si->tch_abs[CY_TCH_MAJ], REPORT_SIZE_8, 718 + TOUCH_REPORT_DESC_MAJ); 719 + fill_tch_abs(&si->tch_abs[CY_TCH_MIN], REPORT_SIZE_8, 720 + TOUCH_REPORT_DESC_MIN); 721 + 722 + return 0; 723 + } 724 + 725 + static int cyttsp5_startup(struct cyttsp5 *ts) 726 + { 727 + int error; 728 + 729 + error = cyttsp5_deassert_int(ts); 730 + if (error) { 731 + dev_err(ts->dev, "Error on deassert int r=%d\n", error); 732 + return -ENODEV; 733 + } 734 + 735 + /* 736 + * Launch the application as the device starts in bootloader mode 737 + * because of a power-on-reset 738 + */ 739 + error = cyttsp5_hid_output_bl_launch_app(ts); 740 + if (error < 0) { 741 + dev_err(ts->dev, "Error on launch app r=%d\n", error); 742 + return error; 743 + } 744 + 745 + error = cyttsp5_get_hid_descriptor(ts, &ts->hid_desc); 746 + if (error < 0) { 747 + dev_err(ts->dev, "Error on getting HID descriptor r=%d\n", error); 748 + return error; 749 + } 750 + 751 + error = cyttsp5_fill_all_touch(ts); 752 + if (error < 0) { 753 + dev_err(ts->dev, "Error on report descriptor r=%d\n", error); 754 + return error; 755 + } 756 + 757 + error = cyttsp5_hid_output_get_sysinfo(ts); 758 + if (error) { 759 + dev_err(ts->dev, "Error on getting sysinfo r=%d\n", error); 760 + return error; 761 + } 762 + 763 + return error; 764 + } 765 + 766 + static void cyttsp5_cleanup(void *data) 767 + { 768 + struct cyttsp5 *ts = data; 769 + 770 + regulator_disable(ts->vdd); 771 + } 772 + 773 + static int cyttsp5_probe(struct device *dev, struct regmap *regmap, int irq, 774 + const char *name) 775 + { 776 + struct cyttsp5 *ts; 777 + struct cyttsp5_sysinfo *si; 778 + int error, i; 779 + 780 + ts = devm_kzalloc(dev, sizeof(*ts), GFP_KERNEL); 781 + if (!ts) 782 + return -ENOMEM; 783 + 784 + /* Initialize device info */ 785 + ts->regmap = regmap; 786 + ts->dev = dev; 787 + si = &ts->sysinfo; 788 + dev_set_drvdata(dev, ts); 789 + 790 + init_completion(&ts->cmd_done); 791 + 792 + /* Power up the device */ 793 + ts->vdd = devm_regulator_get(dev, "vdd"); 794 + if (IS_ERR(ts->vdd)) { 795 + error = PTR_ERR(ts->vdd); 796 + return error; 797 + } 798 + 799 + error = devm_add_action_or_reset(dev, cyttsp5_cleanup, ts); 800 + if (error) 801 + return error; 802 + 803 + error = regulator_enable(ts->vdd); 804 + if (error) 805 + return error; 806 + 807 + ts->input = devm_input_allocate_device(dev); 808 + if (!ts->input) { 809 + dev_err(dev, "Error, failed to allocate input device\n"); 810 + return -ENODEV; 811 + } 812 + 813 + ts->input->name = "cyttsp5"; 814 + scnprintf(ts->phys, sizeof(ts->phys), "%s/input0", dev_name(dev)); 815 + ts->input->phys = ts->phys; 816 + input_set_drvdata(ts->input, ts); 817 + 818 + /* Reset the gpio to be in a reset state */ 819 + ts->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); 820 + if (IS_ERR(ts->reset_gpio)) { 821 + error = PTR_ERR(ts->reset_gpio); 822 + dev_err(dev, "Failed to request reset gpio, error %d\n", error); 823 + return error; 824 + } 825 + gpiod_set_value_cansleep(ts->reset_gpio, 0); 826 + 827 + /* Need a delay to have device up */ 828 + msleep(20); 829 + 830 + error = devm_request_threaded_irq(dev, irq, NULL, cyttsp5_handle_irq, 831 + IRQF_ONESHOT, name, ts); 832 + if (error) { 833 + dev_err(dev, "unable to request IRQ\n"); 834 + return error; 835 + } 836 + 837 + error = cyttsp5_startup(ts); 838 + if (error) { 839 + dev_err(ts->dev, "Fail initial startup r=%d\n", error); 840 + return error; 841 + } 842 + 843 + error = cyttsp5_parse_dt_key_code(dev); 844 + if (error < 0) { 845 + dev_err(ts->dev, "Error while parsing dts %d\n", error); 846 + return error; 847 + } 848 + 849 + touchscreen_parse_properties(ts->input, true, &ts->prop); 850 + 851 + __set_bit(EV_KEY, ts->input->evbit); 852 + for (i = 0; i < si->num_btns; i++) 853 + __set_bit(si->key_code[i], ts->input->keybit); 854 + 855 + return cyttsp5_setup_input_device(dev); 856 + } 857 + 858 + static int cyttsp5_i2c_probe(struct i2c_client *client) 859 + { 860 + struct regmap *regmap; 861 + static const struct regmap_config config = { 862 + .reg_bits = 8, 863 + .val_bits = 8, 864 + }; 865 + 866 + regmap = devm_regmap_init_i2c(client, &config); 867 + if (IS_ERR(regmap)) { 868 + dev_err(&client->dev, "regmap allocation failed: %ld\n", 869 + PTR_ERR(regmap)); 870 + return PTR_ERR(regmap); 871 + } 872 + 873 + return cyttsp5_probe(&client->dev, regmap, client->irq, client->name); 874 + } 875 + 876 + static const struct of_device_id cyttsp5_of_match[] = { 877 + { .compatible = "cypress,tt21000", }, 878 + { } 879 + }; 880 + MODULE_DEVICE_TABLE(of, cyttsp5_of_match); 881 + 882 + static const struct i2c_device_id cyttsp5_i2c_id[] = { 883 + { CYTTSP5_NAME, 0, }, 884 + { } 885 + }; 886 + MODULE_DEVICE_TABLE(i2c, cyttsp5_i2c_id); 887 + 888 + static struct i2c_driver cyttsp5_i2c_driver = { 889 + .driver = { 890 + .name = CYTTSP5_NAME, 891 + .of_match_table = cyttsp5_of_match, 892 + }, 893 + .probe_new = cyttsp5_i2c_probe, 894 + .id_table = cyttsp5_i2c_id, 895 + }; 896 + module_i2c_driver(cyttsp5_i2c_driver); 897 + 898 + MODULE_LICENSE("GPL"); 899 + MODULE_DESCRIPTION("Touchscreen driver for Cypress TrueTouch Gen 5 Product"); 900 + MODULE_AUTHOR("Mylène Josserand <mylene.josserand@bootlin.com>");
+2 -3
drivers/input/touchscreen/cyttsp_i2c.c
··· 28 28 .read = cyttsp_i2c_read_block_data, 29 29 }; 30 30 31 - static int cyttsp_i2c_probe(struct i2c_client *client, 32 - const struct i2c_device_id *id) 31 + static int cyttsp_i2c_probe(struct i2c_client *client) 33 32 { 34 33 struct cyttsp *ts; 35 34 ··· 66 67 .pm = &cyttsp_pm_ops, 67 68 .of_match_table = cyttsp_of_i2c_match, 68 69 }, 69 - .probe = cyttsp_i2c_probe, 70 + .probe_new = cyttsp_i2c_probe, 70 71 .id_table = cyttsp_i2c_id, 71 72 }; 72 73
+3 -3
drivers/input/touchscreen/edt-ft5x06.c
··· 1131 1131 regulator_disable(data->iovcc); 1132 1132 } 1133 1133 1134 - static int edt_ft5x06_ts_probe(struct i2c_client *client, 1135 - const struct i2c_device_id *id) 1134 + static int edt_ft5x06_ts_probe(struct i2c_client *client) 1136 1135 { 1136 + const struct i2c_device_id *id = i2c_client_get_device_id(client); 1137 1137 const struct edt_i2c_chip_data *chip_data; 1138 1138 struct edt_ft5x06_ts_data *tsdata; 1139 1139 u8 buf[2] = { 0xfc, 0x00 }; ··· 1504 1504 .probe_type = PROBE_PREFER_ASYNCHRONOUS, 1505 1505 }, 1506 1506 .id_table = edt_ft5x06_ts_id, 1507 - .probe = edt_ft5x06_ts_probe, 1507 + .probe_new = edt_ft5x06_ts_probe, 1508 1508 .remove = edt_ft5x06_ts_remove, 1509 1509 }; 1510 1510
+2 -3
drivers/input/touchscreen/eeti_ts.c
··· 158 158 eeti_ts_stop(eeti); 159 159 } 160 160 161 - static int eeti_ts_probe(struct i2c_client *client, 162 - const struct i2c_device_id *idp) 161 + static int eeti_ts_probe(struct i2c_client *client) 163 162 { 164 163 struct device *dev = &client->dev; 165 164 struct eeti_ts *eeti; ··· 291 292 .pm = &eeti_ts_pm, 292 293 .of_match_table = of_match_ptr(of_eeti_ts_match), 293 294 }, 294 - .probe = eeti_ts_probe, 295 + .probe_new = eeti_ts_probe, 295 296 .id_table = eeti_ts_id, 296 297 }; 297 298
+22 -32
drivers/input/touchscreen/egalax_ts.c
··· 14 14 - auto idle mode support 15 15 */ 16 16 17 + #include <linux/err.h> 17 18 #include <linux/module.h> 18 19 #include <linux/i2c.h> 19 20 #include <linux/interrupt.h> 20 21 #include <linux/input.h> 21 22 #include <linux/irq.h> 22 - #include <linux/gpio.h> 23 + #include <linux/gpio/consumer.h> 23 24 #include <linux/delay.h> 24 25 #include <linux/slab.h> 25 26 #include <linux/bitops.h> 26 27 #include <linux/input/mt.h> 27 - #include <linux/of_gpio.h> 28 28 29 29 /* 30 30 * Mouse Mode: some panel may configure the controller to mouse mode, ··· 119 119 /* wake up controller by an falling edge of interrupt gpio. */ 120 120 static int egalax_wake_up_device(struct i2c_client *client) 121 121 { 122 - struct device_node *np = client->dev.of_node; 123 - int gpio; 122 + struct gpio_desc *gpio; 124 123 int ret; 125 124 126 - if (!np) 127 - return -ENODEV; 128 - 129 - gpio = of_get_named_gpio(np, "wakeup-gpios", 0); 130 - if (!gpio_is_valid(gpio)) 131 - return -ENODEV; 132 - 133 - ret = gpio_request(gpio, "egalax_irq"); 134 - if (ret < 0) { 135 - dev_err(&client->dev, 136 - "request gpio failed, cannot wake up controller: %d\n", 137 - ret); 125 + /* wake up controller via an falling edge on IRQ gpio. */ 126 + gpio = gpiod_get(&client->dev, "wakeup", GPIOD_OUT_HIGH); 127 + ret = PTR_ERR_OR_ZERO(gpio); 128 + if (ret) { 129 + if (ret != -EPROBE_DEFER) 130 + dev_err(&client->dev, 131 + "failed to request wakeup gpio, cannot wake up controller: %d\n", 132 + ret); 138 133 return ret; 139 134 } 140 135 141 - /* wake up controller via an falling edge on IRQ gpio. */ 142 - gpio_direction_output(gpio, 0); 143 - gpio_set_value(gpio, 1); 136 + /* release the line */ 137 + gpiod_set_value_cansleep(gpio, 0); 144 138 145 - /* controller should be waken up, return irq. */ 146 - gpio_direction_input(gpio); 147 - gpio_free(gpio); 139 + /* controller should be woken up, return irq. */ 140 + gpiod_direction_input(gpio); 141 + gpiod_put(gpio); 148 142 149 143 return 0; 150 144 } ··· 155 161 return 0; 156 162 } 157 163 158 - static int egalax_ts_probe(struct i2c_client *client, 159 - const struct i2c_device_id *id) 164 + static int egalax_ts_probe(struct i2c_client *client) 160 165 { 161 166 struct egalax_ts *ts; 162 167 struct input_dev *input_dev; ··· 178 185 179 186 /* controller may be in sleep, wake it up. */ 180 187 error = egalax_wake_up_device(client); 181 - if (error) { 182 - dev_err(&client->dev, "Failed to wake up the controller\n"); 188 + if (error) 183 189 return error; 184 - } 185 190 186 191 error = egalax_firmware_version(client); 187 192 if (error < 0) { ··· 202 211 ABS_MT_POSITION_Y, 0, EGALAX_MAX_Y, 0, 0); 203 212 input_mt_init_slots(input_dev, MAX_SUPPORT_POINTS, 0); 204 213 205 - error = devm_request_threaded_irq(&client->dev, client->irq, NULL, 206 - egalax_ts_interrupt, 207 - IRQF_TRIGGER_LOW | IRQF_ONESHOT, 208 - "egalax_ts", ts); 214 + error = devm_request_threaded_irq(&client->dev, client->irq, 215 + NULL, egalax_ts_interrupt, 216 + IRQF_ONESHOT, "egalax_ts", ts); 209 217 if (error < 0) { 210 218 dev_err(&client->dev, "Failed to register interrupt\n"); 211 219 return error; ··· 263 273 .of_match_table = egalax_ts_dt_ids, 264 274 }, 265 275 .id_table = egalax_ts_id, 266 - .probe = egalax_ts_probe, 276 + .probe_new = egalax_ts_probe, 267 277 }; 268 278 269 279 module_i2c_driver(egalax_ts_driver);
+2 -3
drivers/input/touchscreen/ektf2127.c
··· 244 244 return (((buf[3] & 0xf0) << 4) | buf[2]) - 1; 245 245 } 246 246 247 - static int ektf2127_probe(struct i2c_client *client, 248 - const struct i2c_device_id *id) 247 + static int ektf2127_probe(struct i2c_client *client) 249 248 { 250 249 struct device *dev = &client->dev; 251 250 struct ektf2127_ts *ts; ··· 351 352 .pm = &ektf2127_pm_ops, 352 353 .of_match_table = of_match_ptr(ektf2127_of_match), 353 354 }, 354 - .probe = ektf2127_probe, 355 + .probe_new = ektf2127_probe, 355 356 .id_table = ektf2127_i2c_id, 356 357 }; 357 358 module_i2c_driver(ektf2127_driver);
+7 -21
drivers/input/touchscreen/elants_i2c.c
··· 36 36 #include <linux/input/touchscreen.h> 37 37 #include <linux/acpi.h> 38 38 #include <linux/of.h> 39 + #include <linux/pm_wakeirq.h> 39 40 #include <linux/gpio/consumer.h> 40 41 #include <linux/regulator/consumer.h> 41 42 #include <linux/uuid.h> ··· 115 114 /* calibration timeout definition */ 116 115 #define ELAN_CALI_TIMEOUT_MSEC 12000 117 116 118 - #define ELAN_POWERON_DELAY_USEC 500 117 + #define ELAN_POWERON_DELAY_USEC 5000 119 118 #define ELAN_RESET_DELAY_MSEC 20 120 119 121 120 /* FW boot code version */ ··· 181 180 u8 cmd_resp[HEADER_SIZE]; 182 181 struct completion cmd_done; 183 182 184 - bool wake_irq_enabled; 185 183 bool keep_power_in_suspend; 186 184 187 185 /* Must be last to be used for DMA operations */ ··· 1329 1329 if (IS_ERR_OR_NULL(ts->reset_gpio)) 1330 1330 return 0; 1331 1331 1332 - gpiod_set_value_cansleep(ts->reset_gpio, 1); 1333 - 1334 1332 error = regulator_enable(ts->vcc33); 1335 1333 if (error) { 1336 1334 dev_err(&ts->client->dev, 1337 1335 "failed to enable vcc33 regulator: %d\n", 1338 1336 error); 1339 - goto release_reset_gpio; 1337 + return error; 1340 1338 } 1341 1339 1342 1340 error = regulator_enable(ts->vccio); ··· 1343 1345 "failed to enable vccio regulator: %d\n", 1344 1346 error); 1345 1347 regulator_disable(ts->vcc33); 1346 - goto release_reset_gpio; 1348 + return error; 1347 1349 } 1348 1350 1349 1351 /* 1350 1352 * We need to wait a bit after powering on controller before 1351 1353 * we are allowed to release reset GPIO. 1352 1354 */ 1353 - udelay(ELAN_POWERON_DELAY_USEC); 1355 + usleep_range(ELAN_POWERON_DELAY_USEC, ELAN_POWERON_DELAY_USEC + 100); 1354 1356 1355 - release_reset_gpio: 1356 1357 gpiod_set_value_cansleep(ts->reset_gpio, 0); 1357 - if (error) 1358 - return error; 1359 1358 1360 1359 msleep(ELAN_RESET_DELAY_MSEC); 1361 1360 ··· 1457 1462 return error; 1458 1463 } 1459 1464 1460 - ts->reset_gpio = devm_gpiod_get(&client->dev, "reset", GPIOD_OUT_LOW); 1465 + ts->reset_gpio = devm_gpiod_get(&client->dev, "reset", GPIOD_OUT_HIGH); 1461 1466 if (IS_ERR(ts->reset_gpio)) { 1462 1467 error = PTR_ERR(ts->reset_gpio); 1463 1468 ··· 1562 1567 return error; 1563 1568 } 1564 1569 1565 - /* 1566 - * Systems using device tree should set up wakeup via DTS, 1567 - * the rest will configure device as wakeup source by default. 1568 - */ 1569 - if (!client->dev.of_node) 1570 - device_init_wakeup(&client->dev, true); 1571 - 1572 1570 error = devm_device_add_group(&client->dev, &elants_attribute_group); 1573 1571 if (error) { 1574 1572 dev_err(&client->dev, "failed to create sysfs attributes: %d\n", ··· 1593 1605 * The device will automatically enter idle mode 1594 1606 * that has reduced power consumption. 1595 1607 */ 1596 - ts->wake_irq_enabled = (enable_irq_wake(client->irq) == 0); 1608 + return 0; 1597 1609 } else if (ts->keep_power_in_suspend) { 1598 1610 for (retry_cnt = 0; retry_cnt < MAX_RETRIES; retry_cnt++) { 1599 1611 error = elants_i2c_send(client, set_sleep_cmd, ··· 1622 1634 int error; 1623 1635 1624 1636 if (device_may_wakeup(dev)) { 1625 - if (ts->wake_irq_enabled) 1626 - disable_irq_wake(client->irq); 1627 1637 elants_i2c_sw_reset(client); 1628 1638 } else if (ts->keep_power_in_suspend) { 1629 1639 for (retry_cnt = 0; retry_cnt < MAX_RETRIES; retry_cnt++) {
+2 -3
drivers/input/touchscreen/goodix.c
··· 1282 1282 regulator_disable(ts->avdd28); 1283 1283 } 1284 1284 1285 - static int goodix_ts_probe(struct i2c_client *client, 1286 - const struct i2c_device_id *id) 1285 + static int goodix_ts_probe(struct i2c_client *client) 1287 1286 { 1288 1287 struct goodix_ts_data *ts; 1289 1288 const char *cfg_name; ··· 1536 1537 #endif 1537 1538 1538 1539 static struct i2c_driver goodix_ts_driver = { 1539 - .probe = goodix_ts_probe, 1540 + .probe_new = goodix_ts_probe, 1540 1541 .remove = goodix_ts_remove, 1541 1542 .id_table = goodix_ts_id, 1542 1543 .driver = {
+2 -3
drivers/input/touchscreen/hideep.c
··· 997 997 .max_register = 0xffff, 998 998 }; 999 999 1000 - static int hideep_probe(struct i2c_client *client, 1001 - const struct i2c_device_id *id) 1000 + static int hideep_probe(struct i2c_client *client) 1002 1001 { 1003 1002 struct hideep_ts *ts; 1004 1003 int error; ··· 1111 1112 .pm = &hideep_pm_ops, 1112 1113 }, 1113 1114 .id_table = hideep_i2c_id, 1114 - .probe = hideep_probe, 1115 + .probe_new = hideep_probe, 1115 1116 }; 1116 1117 1117 1118 module_i2c_driver(hideep_driver);
+364
drivers/input/touchscreen/himax_hx83112b.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-only 2 + /* 3 + * Driver for Himax hx83112b touchscreens 4 + * 5 + * Copyright (C) 2022 Job Noorman <job@noorman.info> 6 + * 7 + * This code is based on "Himax Android Driver Sample Code for QCT platform": 8 + * 9 + * Copyright (C) 2017 Himax Corporation. 10 + */ 11 + 12 + #include <linux/delay.h> 13 + #include <linux/err.h> 14 + #include <linux/gpio/consumer.h> 15 + #include <linux/i2c.h> 16 + #include <linux/input.h> 17 + #include <linux/input/mt.h> 18 + #include <linux/input/touchscreen.h> 19 + #include <linux/interrupt.h> 20 + #include <linux/kernel.h> 21 + #include <linux/regmap.h> 22 + 23 + #define HIMAX_ID_83112B 0x83112b 24 + 25 + #define HIMAX_MAX_POINTS 10 26 + 27 + #define HIMAX_REG_CFG_SET_ADDR 0x00 28 + #define HIMAX_REG_CFG_INIT_READ 0x0c 29 + #define HIMAX_REG_CFG_READ_VALUE 0x08 30 + #define HIMAX_REG_READ_EVENT 0x30 31 + 32 + #define HIMAX_CFG_PRODUCT_ID 0x900000d0 33 + 34 + #define HIMAX_INVALID_COORD 0xffff 35 + 36 + struct himax_event_point { 37 + __be16 x; 38 + __be16 y; 39 + } __packed; 40 + 41 + struct himax_event { 42 + struct himax_event_point points[HIMAX_MAX_POINTS]; 43 + u8 majors[HIMAX_MAX_POINTS]; 44 + u8 pad0[2]; 45 + u8 num_points; 46 + u8 pad1[2]; 47 + u8 checksum_fix; 48 + } __packed; 49 + 50 + static_assert(sizeof(struct himax_event) == 56); 51 + 52 + struct himax_ts_data { 53 + struct gpio_desc *gpiod_rst; 54 + struct input_dev *input_dev; 55 + struct i2c_client *client; 56 + struct regmap *regmap; 57 + struct touchscreen_properties props; 58 + }; 59 + 60 + static const struct regmap_config himax_regmap_config = { 61 + .reg_bits = 8, 62 + .val_bits = 32, 63 + .val_format_endian = REGMAP_ENDIAN_LITTLE, 64 + }; 65 + 66 + static int himax_read_config(struct himax_ts_data *ts, u32 address, u32 *dst) 67 + { 68 + int error; 69 + 70 + error = regmap_write(ts->regmap, HIMAX_REG_CFG_SET_ADDR, address); 71 + if (error) 72 + return error; 73 + 74 + error = regmap_write(ts->regmap, HIMAX_REG_CFG_INIT_READ, 0x0); 75 + if (error) 76 + return error; 77 + 78 + error = regmap_read(ts->regmap, HIMAX_REG_CFG_READ_VALUE, dst); 79 + if (error) 80 + return error; 81 + 82 + return 0; 83 + } 84 + 85 + static void himax_reset(struct himax_ts_data *ts) 86 + { 87 + gpiod_set_value_cansleep(ts->gpiod_rst, 1); 88 + 89 + /* Delay copied from downstream driver */ 90 + msleep(20); 91 + gpiod_set_value_cansleep(ts->gpiod_rst, 0); 92 + 93 + /* 94 + * The downstream driver doesn't contain this delay but is seems safer 95 + * to include it. The range is just a guess that seems to work well. 96 + */ 97 + usleep_range(1000, 1100); 98 + } 99 + 100 + static int himax_read_product_id(struct himax_ts_data *ts, u32 *product_id) 101 + { 102 + int error; 103 + 104 + error = himax_read_config(ts, HIMAX_CFG_PRODUCT_ID, product_id); 105 + if (error) 106 + return error; 107 + 108 + *product_id >>= 8; 109 + return 0; 110 + } 111 + 112 + static int himax_check_product_id(struct himax_ts_data *ts) 113 + { 114 + int error; 115 + u32 product_id; 116 + 117 + error = himax_read_product_id(ts, &product_id); 118 + if (error) 119 + return error; 120 + 121 + dev_dbg(&ts->client->dev, "Product id: %x\n", product_id); 122 + 123 + switch (product_id) { 124 + case HIMAX_ID_83112B: 125 + return 0; 126 + 127 + default: 128 + dev_err(&ts->client->dev, 129 + "Unknown product id: %x\n", product_id); 130 + return -EINVAL; 131 + } 132 + } 133 + 134 + static int himax_input_register(struct himax_ts_data *ts) 135 + { 136 + int error; 137 + 138 + ts->input_dev = devm_input_allocate_device(&ts->client->dev); 139 + if (!ts->input_dev) { 140 + dev_err(&ts->client->dev, "Failed to allocate input device\n"); 141 + return -ENOMEM; 142 + } 143 + 144 + ts->input_dev->name = "Himax Touchscreen"; 145 + 146 + input_set_capability(ts->input_dev, EV_ABS, ABS_MT_POSITION_X); 147 + input_set_capability(ts->input_dev, EV_ABS, ABS_MT_POSITION_Y); 148 + input_set_abs_params(ts->input_dev, ABS_MT_WIDTH_MAJOR, 0, 200, 0, 0); 149 + input_set_abs_params(ts->input_dev, ABS_MT_TOUCH_MAJOR, 0, 200, 0, 0); 150 + 151 + touchscreen_parse_properties(ts->input_dev, true, &ts->props); 152 + 153 + error = input_mt_init_slots(ts->input_dev, HIMAX_MAX_POINTS, 154 + INPUT_MT_DIRECT | INPUT_MT_DROP_UNUSED); 155 + if (error) { 156 + dev_err(&ts->client->dev, 157 + "Failed to initialize MT slots: %d\n", error); 158 + return error; 159 + } 160 + 161 + error = input_register_device(ts->input_dev); 162 + if (error) { 163 + dev_err(&ts->client->dev, 164 + "Failed to register input device: %d\n", error); 165 + return error; 166 + } 167 + 168 + return 0; 169 + } 170 + 171 + static u8 himax_event_get_num_points(const struct himax_event *event) 172 + { 173 + if (event->num_points == 0xff) 174 + return 0; 175 + else 176 + return event->num_points & 0x0f; 177 + } 178 + 179 + static bool himax_process_event_point(struct himax_ts_data *ts, 180 + const struct himax_event *event, 181 + int point_index) 182 + { 183 + const struct himax_event_point *point = &event->points[point_index]; 184 + u16 x = be16_to_cpu(point->x); 185 + u16 y = be16_to_cpu(point->y); 186 + u8 w = event->majors[point_index]; 187 + 188 + if (x == HIMAX_INVALID_COORD || y == HIMAX_INVALID_COORD) 189 + return false; 190 + 191 + input_mt_slot(ts->input_dev, point_index); 192 + input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, true); 193 + touchscreen_report_pos(ts->input_dev, &ts->props, x, y, true); 194 + input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR, w); 195 + input_report_abs(ts->input_dev, ABS_MT_WIDTH_MAJOR, w); 196 + return true; 197 + } 198 + 199 + static void himax_process_event(struct himax_ts_data *ts, 200 + const struct himax_event *event) 201 + { 202 + int i; 203 + int num_points_left = himax_event_get_num_points(event); 204 + 205 + for (i = 0; i < HIMAX_MAX_POINTS && num_points_left > 0; i++) { 206 + if (himax_process_event_point(ts, event, i)) 207 + num_points_left--; 208 + } 209 + 210 + input_mt_sync_frame(ts->input_dev); 211 + input_sync(ts->input_dev); 212 + } 213 + 214 + static bool himax_verify_checksum(struct himax_ts_data *ts, 215 + const struct himax_event *event) 216 + { 217 + u8 *data = (u8 *)event; 218 + int i; 219 + u16 checksum = 0; 220 + 221 + for (i = 0; i < sizeof(*event); i++) 222 + checksum += data[i]; 223 + 224 + if ((checksum & 0x00ff) != 0) { 225 + dev_err(&ts->client->dev, "Wrong event checksum: %04x\n", 226 + checksum); 227 + return false; 228 + } 229 + 230 + return true; 231 + } 232 + 233 + static int himax_handle_input(struct himax_ts_data *ts) 234 + { 235 + int error; 236 + struct himax_event event; 237 + 238 + error = regmap_raw_read(ts->regmap, HIMAX_REG_READ_EVENT, &event, 239 + sizeof(event)); 240 + if (error) { 241 + dev_err(&ts->client->dev, "Failed to read input event: %d\n", 242 + error); 243 + return error; 244 + } 245 + 246 + /* 247 + * Only process the current event when it has a valid checksum but 248 + * don't consider it a fatal error when it doesn't. 249 + */ 250 + if (himax_verify_checksum(ts, &event)) 251 + himax_process_event(ts, &event); 252 + 253 + return 0; 254 + } 255 + 256 + static irqreturn_t himax_irq_handler(int irq, void *dev_id) 257 + { 258 + int error; 259 + struct himax_ts_data *ts = dev_id; 260 + 261 + error = himax_handle_input(ts); 262 + if (error) 263 + return IRQ_NONE; 264 + 265 + return IRQ_HANDLED; 266 + } 267 + 268 + static int himax_probe(struct i2c_client *client) 269 + { 270 + int error; 271 + struct device *dev = &client->dev; 272 + struct himax_ts_data *ts; 273 + 274 + if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { 275 + dev_err(dev, "I2C check functionality failed\n"); 276 + return -ENXIO; 277 + } 278 + 279 + ts = devm_kzalloc(dev, sizeof(*ts), GFP_KERNEL); 280 + if (!ts) 281 + return -ENOMEM; 282 + 283 + i2c_set_clientdata(client, ts); 284 + ts->client = client; 285 + 286 + ts->regmap = devm_regmap_init_i2c(client, &himax_regmap_config); 287 + error = PTR_ERR_OR_ZERO(ts->regmap); 288 + if (error) { 289 + dev_err(dev, "Failed to initialize regmap: %d\n", error); 290 + return error; 291 + } 292 + 293 + ts->gpiod_rst = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH); 294 + error = PTR_ERR_OR_ZERO(ts->gpiod_rst); 295 + if (error) { 296 + dev_err(dev, "Failed to get reset GPIO: %d\n", error); 297 + return error; 298 + } 299 + 300 + himax_reset(ts); 301 + 302 + error = himax_check_product_id(ts); 303 + if (error) 304 + return error; 305 + 306 + error = himax_input_register(ts); 307 + if (error) 308 + return error; 309 + 310 + error = devm_request_threaded_irq(dev, client->irq, NULL, 311 + himax_irq_handler, IRQF_ONESHOT, 312 + client->name, ts); 313 + if (error) 314 + return error; 315 + 316 + return 0; 317 + } 318 + 319 + static int himax_suspend(struct device *dev) 320 + { 321 + struct himax_ts_data *ts = dev_get_drvdata(dev); 322 + 323 + disable_irq(ts->client->irq); 324 + return 0; 325 + } 326 + 327 + static int himax_resume(struct device *dev) 328 + { 329 + struct himax_ts_data *ts = dev_get_drvdata(dev); 330 + 331 + enable_irq(ts->client->irq); 332 + return 0; 333 + } 334 + 335 + static DEFINE_SIMPLE_DEV_PM_OPS(himax_pm_ops, himax_suspend, himax_resume); 336 + 337 + static const struct i2c_device_id himax_ts_id[] = { 338 + { "hx83112b", 0 }, 339 + { /* sentinel */ } 340 + }; 341 + MODULE_DEVICE_TABLE(i2c, himax_ts_id); 342 + 343 + #ifdef CONFIG_OF 344 + static const struct of_device_id himax_of_match[] = { 345 + { .compatible = "himax,hx83112b" }, 346 + { /* sentinel */ } 347 + }; 348 + MODULE_DEVICE_TABLE(of, himax_of_match); 349 + #endif 350 + 351 + static struct i2c_driver himax_ts_driver = { 352 + .probe_new = himax_probe, 353 + .id_table = himax_ts_id, 354 + .driver = { 355 + .name = "Himax-hx83112b-TS", 356 + .of_match_table = of_match_ptr(himax_of_match), 357 + .pm = pm_sleep_ptr(&himax_pm_ops), 358 + }, 359 + }; 360 + module_i2c_driver(himax_ts_driver); 361 + 362 + MODULE_AUTHOR("Job Noorman <job@noorman.info>"); 363 + MODULE_DESCRIPTION("Himax hx83112b touchscreen driver"); 364 + MODULE_LICENSE("GPL");
+2 -3
drivers/input/touchscreen/hycon-hy46xx.c
··· 439 439 regulator_disable(data->vcc); 440 440 } 441 441 442 - static int hycon_hy46xx_probe(struct i2c_client *client, 443 - const struct i2c_device_id *id) 442 + static int hycon_hy46xx_probe(struct i2c_client *client) 444 443 { 445 444 struct hycon_hy46xx_data *tsdata; 446 445 struct input_dev *input; ··· 580 581 .probe_type = PROBE_PREFER_ASYNCHRONOUS, 581 582 }, 582 583 .id_table = hycon_hy46xx_id, 583 - .probe = hycon_hy46xx_probe, 584 + .probe_new = hycon_hy46xx_probe, 584 585 }; 585 586 586 587 module_i2c_driver(hycon_hy46xx_driver);
+498
drivers/input/touchscreen/hynitron_cstxxx.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-only 2 + /* 3 + * Driver for Hynitron cstxxx Touchscreen 4 + * 5 + * Copyright (c) 2022 Chris Morgan <macromorgan@hotmail.com> 6 + * 7 + * This code is based on hynitron_core.c authored by Hynitron. 8 + * Note that no datasheet was available, so much of these registers 9 + * are undocumented. This is essentially a cleaned-up version of the 10 + * vendor driver with support removed for hardware I cannot test and 11 + * device-specific functions replated with generic functions wherever 12 + * possible. 13 + */ 14 + 15 + #include <linux/delay.h> 16 + #include <linux/err.h> 17 + #include <linux/gpio/consumer.h> 18 + #include <linux/i2c.h> 19 + #include <linux/input.h> 20 + #include <linux/input/mt.h> 21 + #include <linux/input/touchscreen.h> 22 + #include <linux/mod_devicetable.h> 23 + #include <linux/module.h> 24 + #include <linux/property.h> 25 + #include <asm/unaligned.h> 26 + 27 + /* Per chip data */ 28 + struct hynitron_ts_chip_data { 29 + unsigned int max_touch_num; 30 + u32 ic_chkcode; 31 + int (*firmware_info)(struct i2c_client *client); 32 + int (*bootloader_enter)(struct i2c_client *client); 33 + int (*init_input)(struct i2c_client *client); 34 + void (*report_touch)(struct i2c_client *client); 35 + }; 36 + 37 + /* Data generic to all (supported and non-supported) controllers. */ 38 + struct hynitron_ts_data { 39 + const struct hynitron_ts_chip_data *chip; 40 + struct i2c_client *client; 41 + struct input_dev *input_dev; 42 + struct touchscreen_properties prop; 43 + struct gpio_desc *reset_gpio; 44 + }; 45 + 46 + /* 47 + * Since I have no datasheet, these values are guessed and/or assumed 48 + * based on observation and testing. 49 + */ 50 + #define CST3XX_FIRMWARE_INFO_START_CMD 0x01d1 51 + #define CST3XX_FIRMWARE_INFO_END_CMD 0x09d1 52 + #define CST3XX_FIRMWARE_CHK_CODE_REG 0xfcd1 53 + #define CST3XX_FIRMWARE_VERSION_REG 0x08d2 54 + #define CST3XX_FIRMWARE_VER_INVALID_VAL 0xa5a5a5a5 55 + 56 + #define CST3XX_BOOTLDR_PROG_CMD 0xaa01a0 57 + #define CST3XX_BOOTLDR_PROG_CHK_REG 0x02a0 58 + #define CST3XX_BOOTLDR_CHK_VAL 0xac 59 + 60 + #define CST3XX_TOUCH_DATA_PART_REG 0x00d0 61 + #define CST3XX_TOUCH_DATA_FULL_REG 0x07d0 62 + #define CST3XX_TOUCH_DATA_CHK_VAL 0xab 63 + #define CST3XX_TOUCH_DATA_TOUCH_VAL 0x03 64 + #define CST3XX_TOUCH_DATA_STOP_CMD 0xab00d0 65 + #define CST3XX_TOUCH_COUNT_MASK GENMASK(6, 0) 66 + 67 + 68 + /* 69 + * Hard coded reset delay value of 20ms not IC dependent in 70 + * vendor driver. 71 + */ 72 + static void hyn_reset_proc(struct i2c_client *client, int delay) 73 + { 74 + struct hynitron_ts_data *ts_data = i2c_get_clientdata(client); 75 + 76 + gpiod_set_value_cansleep(ts_data->reset_gpio, 1); 77 + msleep(20); 78 + gpiod_set_value_cansleep(ts_data->reset_gpio, 0); 79 + if (delay) 80 + fsleep(delay * 1000); 81 + } 82 + 83 + static irqreturn_t hyn_interrupt_handler(int irq, void *dev_id) 84 + { 85 + struct i2c_client *client = dev_id; 86 + struct hynitron_ts_data *ts_data = i2c_get_clientdata(client); 87 + 88 + ts_data->chip->report_touch(client); 89 + 90 + return IRQ_HANDLED; 91 + } 92 + 93 + /* 94 + * The vendor driver would retry twice before failing to read or write 95 + * to the i2c device. 96 + */ 97 + 98 + static int cst3xx_i2c_write(struct i2c_client *client, 99 + unsigned char *buf, int len) 100 + { 101 + int ret; 102 + int retries = 0; 103 + 104 + while (retries < 2) { 105 + ret = i2c_master_send(client, buf, len); 106 + if (ret == len) 107 + return 0; 108 + if (ret <= 0) 109 + retries++; 110 + else 111 + break; 112 + } 113 + 114 + return ret < 0 ? ret : -EIO; 115 + } 116 + 117 + static int cst3xx_i2c_read_register(struct i2c_client *client, u16 reg, 118 + u8 *val, u16 len) 119 + { 120 + __le16 buf = cpu_to_le16(reg); 121 + struct i2c_msg msgs[] = { 122 + { 123 + .addr = client->addr, 124 + .flags = 0, 125 + .len = 2, 126 + .buf = (u8 *)&buf, 127 + }, 128 + { 129 + .addr = client->addr, 130 + .flags = I2C_M_RD, 131 + .len = len, 132 + .buf = val, 133 + } 134 + }; 135 + int err; 136 + int ret; 137 + 138 + ret = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs)); 139 + if (ret == ARRAY_SIZE(msgs)) 140 + return 0; 141 + 142 + err = ret < 0 ? ret : -EIO; 143 + dev_err(&client->dev, "Error reading %d bytes from 0x%04x: %d (%d)\n", 144 + len, reg, err, ret); 145 + 146 + return err; 147 + } 148 + 149 + static int cst3xx_firmware_info(struct i2c_client *client) 150 + { 151 + struct hynitron_ts_data *ts_data = i2c_get_clientdata(client); 152 + int err; 153 + u32 tmp; 154 + unsigned char buf[4]; 155 + 156 + /* 157 + * Tests suggest this command needed to read firmware regs. 158 + */ 159 + put_unaligned_le16(CST3XX_FIRMWARE_INFO_START_CMD, buf); 160 + err = cst3xx_i2c_write(client, buf, 2); 161 + if (err) 162 + return err; 163 + 164 + usleep_range(10000, 11000); 165 + 166 + /* 167 + * Read register for check-code to determine if device detected 168 + * correctly. 169 + */ 170 + err = cst3xx_i2c_read_register(client, CST3XX_FIRMWARE_CHK_CODE_REG, 171 + buf, 4); 172 + if (err) 173 + return err; 174 + 175 + tmp = get_unaligned_le32(buf); 176 + if ((tmp & 0xffff0000) != ts_data->chip->ic_chkcode) { 177 + dev_err(&client->dev, "%s ic mismatch, chkcode is %u\n", 178 + __func__, tmp); 179 + return -ENODEV; 180 + } 181 + 182 + usleep_range(10000, 11000); 183 + 184 + /* Read firmware version and test if firmware missing. */ 185 + err = cst3xx_i2c_read_register(client, CST3XX_FIRMWARE_VERSION_REG, 186 + buf, 4); 187 + if (err) 188 + return err; 189 + 190 + tmp = get_unaligned_le32(buf); 191 + if (tmp == CST3XX_FIRMWARE_VER_INVALID_VAL) { 192 + dev_err(&client->dev, "Device firmware missing\n"); 193 + return -ENODEV; 194 + } 195 + 196 + /* 197 + * Tests suggest cmd required to exit reading firmware regs. 198 + */ 199 + put_unaligned_le16(CST3XX_FIRMWARE_INFO_END_CMD, buf); 200 + err = cst3xx_i2c_write(client, buf, 2); 201 + if (err) 202 + return err; 203 + 204 + usleep_range(5000, 6000); 205 + 206 + return 0; 207 + } 208 + 209 + static int cst3xx_bootloader_enter(struct i2c_client *client) 210 + { 211 + int err; 212 + u8 retry; 213 + u32 tmp = 0; 214 + unsigned char buf[3]; 215 + 216 + for (retry = 0; retry < 5; retry++) { 217 + hyn_reset_proc(client, (7 + retry)); 218 + /* set cmd to enter program mode */ 219 + put_unaligned_le24(CST3XX_BOOTLDR_PROG_CMD, buf); 220 + err = cst3xx_i2c_write(client, buf, 3); 221 + if (err) 222 + continue; 223 + 224 + usleep_range(2000, 2500); 225 + 226 + /* check whether in program mode */ 227 + err = cst3xx_i2c_read_register(client, 228 + CST3XX_BOOTLDR_PROG_CHK_REG, 229 + buf, 1); 230 + if (err) 231 + continue; 232 + 233 + tmp = get_unaligned(buf); 234 + if (tmp == CST3XX_BOOTLDR_CHK_VAL) 235 + break; 236 + } 237 + 238 + if (tmp != CST3XX_BOOTLDR_CHK_VAL) { 239 + dev_err(&client->dev, "%s unable to enter bootloader mode\n", 240 + __func__); 241 + return -ENODEV; 242 + } 243 + 244 + hyn_reset_proc(client, 40); 245 + 246 + return 0; 247 + } 248 + 249 + static void cst3xx_report_contact(struct hynitron_ts_data *ts_data, 250 + u8 id, unsigned int x, unsigned int y, u8 w) 251 + { 252 + input_mt_slot(ts_data->input_dev, id); 253 + input_mt_report_slot_state(ts_data->input_dev, MT_TOOL_FINGER, 1); 254 + touchscreen_report_pos(ts_data->input_dev, &ts_data->prop, x, y, true); 255 + input_report_abs(ts_data->input_dev, ABS_MT_TOUCH_MAJOR, w); 256 + } 257 + 258 + static int cst3xx_finish_touch_read(struct i2c_client *client) 259 + { 260 + unsigned char buf[3]; 261 + int err; 262 + 263 + put_unaligned_le24(CST3XX_TOUCH_DATA_STOP_CMD, buf); 264 + err = cst3xx_i2c_write(client, buf, 3); 265 + if (err) { 266 + dev_err(&client->dev, 267 + "send read touch info ending failed: %d\n", err); 268 + return err; 269 + } 270 + 271 + return 0; 272 + } 273 + 274 + /* 275 + * Handle events from IRQ. Note that for cst3xx it appears that IRQ 276 + * fires continuously while touched, otherwise once every 1500ms 277 + * when not touched (assume touchscreen waking up periodically). 278 + * Note buffer is sized for 5 fingers, if more needed buffer must 279 + * be increased. The buffer contains 5 bytes for each touch point, 280 + * a touch count byte, a check byte, and then a second check byte after 281 + * all other touch points. 282 + * 283 + * For example 1 touch would look like this: 284 + * touch1[5]:touch_count[1]:chk_byte[1] 285 + * 286 + * 3 touches would look like this: 287 + * touch1[5]:touch_count[1]:chk_byte[1]:touch2[5]:touch3[5]:chk_byte[1] 288 + */ 289 + static void cst3xx_touch_report(struct i2c_client *client) 290 + { 291 + struct hynitron_ts_data *ts_data = i2c_get_clientdata(client); 292 + u8 buf[28]; 293 + u8 finger_id, sw, w; 294 + unsigned int x, y; 295 + unsigned int touch_cnt, end_byte; 296 + unsigned int idx = 0; 297 + unsigned int i; 298 + int err; 299 + 300 + /* Read and validate the first bits of input data. */ 301 + err = cst3xx_i2c_read_register(client, CST3XX_TOUCH_DATA_PART_REG, 302 + buf, 28); 303 + if (err || 304 + buf[6] != CST3XX_TOUCH_DATA_CHK_VAL || 305 + buf[0] == CST3XX_TOUCH_DATA_CHK_VAL) { 306 + dev_err(&client->dev, "cst3xx touch read failure\n"); 307 + return; 308 + } 309 + 310 + /* Report to the device we're done reading the touch data. */ 311 + err = cst3xx_finish_touch_read(client); 312 + if (err) 313 + return; 314 + 315 + touch_cnt = buf[5] & CST3XX_TOUCH_COUNT_MASK; 316 + /* 317 + * Check the check bit of the last touch slot. The check bit is 318 + * always present after touch point 1 for valid data, and then 319 + * appears as the last byte after all other touch data. 320 + */ 321 + if (touch_cnt > 1) { 322 + end_byte = touch_cnt * 5 + 2; 323 + if (buf[end_byte] != CST3XX_TOUCH_DATA_CHK_VAL) { 324 + dev_err(&client->dev, "cst3xx touch read failure\n"); 325 + return; 326 + } 327 + } 328 + 329 + /* Parse through the buffer to capture touch data. */ 330 + for (i = 0; i < touch_cnt; i++) { 331 + x = ((buf[idx + 1] << 4) | ((buf[idx + 3] >> 4) & 0x0f)); 332 + y = ((buf[idx + 2] << 4) | (buf[idx + 3] & 0x0f)); 333 + w = (buf[idx + 4] >> 3); 334 + sw = (buf[idx] & 0x0f) >> 1; 335 + finger_id = (buf[idx] >> 4) & 0x0f; 336 + 337 + /* Sanity check we don't have more fingers than we expect */ 338 + if (ts_data->chip->max_touch_num < finger_id) { 339 + dev_err(&client->dev, "cst3xx touch read failure\n"); 340 + break; 341 + } 342 + 343 + /* sw value of 0 means no touch, 0x03 means touch */ 344 + if (sw == CST3XX_TOUCH_DATA_TOUCH_VAL) 345 + cst3xx_report_contact(ts_data, finger_id, x, y, w); 346 + 347 + idx += 5; 348 + 349 + /* Skip the 2 bytes between point 1 and point 2 */ 350 + if (i == 0) 351 + idx += 2; 352 + } 353 + 354 + input_mt_sync_frame(ts_data->input_dev); 355 + input_sync(ts_data->input_dev); 356 + } 357 + 358 + static int cst3xx_input_dev_int(struct i2c_client *client) 359 + { 360 + struct hynitron_ts_data *ts_data = i2c_get_clientdata(client); 361 + int err; 362 + 363 + ts_data->input_dev = devm_input_allocate_device(&client->dev); 364 + if (!ts_data->input_dev) { 365 + dev_err(&client->dev, "Failed to allocate input device\n"); 366 + return -ENOMEM; 367 + } 368 + 369 + ts_data->input_dev->name = "Hynitron cst3xx Touchscreen"; 370 + ts_data->input_dev->phys = "input/ts"; 371 + ts_data->input_dev->id.bustype = BUS_I2C; 372 + 373 + input_set_drvdata(ts_data->input_dev, ts_data); 374 + 375 + input_set_capability(ts_data->input_dev, EV_ABS, ABS_MT_POSITION_X); 376 + input_set_capability(ts_data->input_dev, EV_ABS, ABS_MT_POSITION_Y); 377 + input_set_abs_params(ts_data->input_dev, ABS_MT_TOUCH_MAJOR, 378 + 0, 255, 0, 0); 379 + 380 + touchscreen_parse_properties(ts_data->input_dev, true, &ts_data->prop); 381 + 382 + if (!ts_data->prop.max_x || !ts_data->prop.max_y) { 383 + dev_err(&client->dev, 384 + "Invalid x/y (%d, %d), using defaults\n", 385 + ts_data->prop.max_x, ts_data->prop.max_y); 386 + ts_data->prop.max_x = 1152; 387 + ts_data->prop.max_y = 1920; 388 + input_abs_set_max(ts_data->input_dev, 389 + ABS_MT_POSITION_X, ts_data->prop.max_x); 390 + input_abs_set_max(ts_data->input_dev, 391 + ABS_MT_POSITION_Y, ts_data->prop.max_y); 392 + } 393 + 394 + err = input_mt_init_slots(ts_data->input_dev, 395 + ts_data->chip->max_touch_num, 396 + INPUT_MT_DIRECT | INPUT_MT_DROP_UNUSED); 397 + if (err) { 398 + dev_err(&client->dev, 399 + "Failed to initialize input slots: %d\n", err); 400 + return err; 401 + } 402 + 403 + err = input_register_device(ts_data->input_dev); 404 + if (err) { 405 + dev_err(&client->dev, 406 + "Input device registration failed: %d\n", err); 407 + return err; 408 + } 409 + 410 + return 0; 411 + } 412 + 413 + static int hyn_probe(struct i2c_client *client) 414 + { 415 + struct hynitron_ts_data *ts_data; 416 + int err; 417 + 418 + ts_data = devm_kzalloc(&client->dev, sizeof(*ts_data), GFP_KERNEL); 419 + if (!ts_data) 420 + return -ENOMEM; 421 + 422 + ts_data->client = client; 423 + i2c_set_clientdata(client, ts_data); 424 + 425 + ts_data->chip = device_get_match_data(&client->dev); 426 + if (!ts_data->chip) 427 + return -EINVAL; 428 + 429 + ts_data->reset_gpio = devm_gpiod_get(&client->dev, 430 + "reset", GPIOD_OUT_LOW); 431 + err = PTR_ERR_OR_ZERO(ts_data->reset_gpio); 432 + if (err) { 433 + dev_err(&client->dev, "request reset gpio failed: %d\n", err); 434 + return err; 435 + } 436 + 437 + hyn_reset_proc(client, 60); 438 + 439 + err = ts_data->chip->bootloader_enter(client); 440 + if (err < 0) 441 + return err; 442 + 443 + err = ts_data->chip->init_input(client); 444 + if (err < 0) 445 + return err; 446 + 447 + err = ts_data->chip->firmware_info(client); 448 + if (err < 0) 449 + return err; 450 + 451 + err = devm_request_threaded_irq(&client->dev, client->irq, 452 + NULL, hyn_interrupt_handler, 453 + IRQF_ONESHOT, 454 + "Hynitron Touch Int", client); 455 + if (err) { 456 + dev_err(&client->dev, "failed to request IRQ: %d\n", err); 457 + return err; 458 + } 459 + 460 + return 0; 461 + } 462 + 463 + static const struct hynitron_ts_chip_data cst3xx_data = { 464 + .max_touch_num = 5, 465 + .ic_chkcode = 0xcaca0000, 466 + .firmware_info = &cst3xx_firmware_info, 467 + .bootloader_enter = &cst3xx_bootloader_enter, 468 + .init_input = &cst3xx_input_dev_int, 469 + .report_touch = &cst3xx_touch_report, 470 + }; 471 + 472 + static const struct i2c_device_id hyn_tpd_id[] = { 473 + { .name = "hynitron_ts", 0 }, 474 + { /* sentinel */ }, 475 + }; 476 + MODULE_DEVICE_TABLE(i2c, hyn_tpd_id); 477 + 478 + static const struct of_device_id hyn_dt_match[] = { 479 + { .compatible = "hynitron,cst340", .data = &cst3xx_data }, 480 + { /* sentinel */ }, 481 + }; 482 + MODULE_DEVICE_TABLE(of, hyn_dt_match); 483 + 484 + static struct i2c_driver hynitron_i2c_driver = { 485 + .driver = { 486 + .name = "Hynitron-TS", 487 + .of_match_table = hyn_dt_match, 488 + .probe_type = PROBE_PREFER_ASYNCHRONOUS, 489 + }, 490 + .id_table = hyn_tpd_id, 491 + .probe_new = hyn_probe, 492 + }; 493 + 494 + module_i2c_driver(hynitron_i2c_driver); 495 + 496 + MODULE_AUTHOR("Chris Morgan"); 497 + MODULE_DESCRIPTION("Hynitron Touchscreen Driver"); 498 + MODULE_LICENSE("GPL");
+3 -3
drivers/input/touchscreen/ili210x.c
··· 913 913 priv->stop = true; 914 914 } 915 915 916 - static int ili210x_i2c_probe(struct i2c_client *client, 917 - const struct i2c_device_id *id) 916 + static int ili210x_i2c_probe(struct i2c_client *client) 918 917 { 918 + const struct i2c_device_id *id = i2c_client_get_device_id(client); 919 919 struct device *dev = &client->dev; 920 920 const struct ili2xxx_chip *chip; 921 921 struct ili210x *priv; ··· 1043 1043 .of_match_table = ili210x_dt_ids, 1044 1044 }, 1045 1045 .id_table = ili210x_i2c_id, 1046 - .probe = ili210x_i2c_probe, 1046 + .probe_new = ili210x_i2c_probe, 1047 1047 }; 1048 1048 1049 1049 module_i2c_driver(ili210x_ts_driver);
+2 -3
drivers/input/touchscreen/ilitek_ts_i2c.c
··· 542 542 .attrs = ilitek_sysfs_attrs, 543 543 }; 544 544 545 - static int ilitek_ts_i2c_probe(struct i2c_client *client, 546 - const struct i2c_device_id *id) 545 + static int ilitek_ts_i2c_probe(struct i2c_client *client) 547 546 { 548 547 struct ilitek_ts_data *ts; 549 548 struct device *dev = &client->dev; ··· 679 680 .of_match_table = of_match_ptr(ilitek_ts_i2c_match), 680 681 .acpi_match_table = ACPI_PTR(ilitekts_acpi_id), 681 682 }, 682 - .probe = ilitek_ts_i2c_probe, 683 + .probe_new = ilitek_ts_i2c_probe, 683 684 .id_table = ilitek_ts_i2c_id, 684 685 }; 685 686 module_i2c_driver(ilitek_ts_i2c_driver);
+2 -3
drivers/input/touchscreen/iqs5xx.c
··· 1019 1019 1020 1020 static SIMPLE_DEV_PM_OPS(iqs5xx_pm, iqs5xx_suspend, iqs5xx_resume); 1021 1021 1022 - static int iqs5xx_probe(struct i2c_client *client, 1023 - const struct i2c_device_id *id) 1022 + static int iqs5xx_probe(struct i2c_client *client) 1024 1023 { 1025 1024 struct iqs5xx_private *iqs5xx; 1026 1025 int error; ··· 1093 1094 .pm = &iqs5xx_pm, 1094 1095 }, 1095 1096 .id_table = iqs5xx_id, 1096 - .probe = iqs5xx_probe, 1097 + .probe_new = iqs5xx_probe, 1097 1098 }; 1098 1099 module_i2c_driver(iqs5xx_i2c_driver); 1099 1100
+2 -3
drivers/input/touchscreen/max11801_ts.c
··· 168 168 max11801_write_reg(client, OP_MODE_CONF_REG, 0x36); 169 169 } 170 170 171 - static int max11801_ts_probe(struct i2c_client *client, 172 - const struct i2c_device_id *id) 171 + static int max11801_ts_probe(struct i2c_client *client) 173 172 { 174 173 struct max11801_data *data; 175 174 struct input_dev *input_dev; ··· 230 231 .of_match_table = max11801_ts_dt_ids, 231 232 }, 232 233 .id_table = max11801_ts_id, 233 - .probe = max11801_ts_probe, 234 + .probe_new = max11801_ts_probe, 234 235 }; 235 236 236 237 module_i2c_driver(max11801_ts_driver);
+2 -3
drivers/input/touchscreen/mcs5000_ts.c
··· 180 180 OP_MODE_ACTIVE | REPORT_RATE_80); 181 181 } 182 182 183 - static int mcs5000_ts_probe(struct i2c_client *client, 184 - const struct i2c_device_id *id) 183 + static int mcs5000_ts_probe(struct i2c_client *client) 185 184 { 186 185 const struct mcs_platform_data *pdata; 187 186 struct mcs5000_ts_data *data; ··· 271 272 MODULE_DEVICE_TABLE(i2c, mcs5000_ts_id); 272 273 273 274 static struct i2c_driver mcs5000_ts_driver = { 274 - .probe = mcs5000_ts_probe, 275 + .probe_new = mcs5000_ts_probe, 275 276 .driver = { 276 277 .name = "mcs5000_ts", 277 278 .pm = &mcs5000_ts_pm,
+2 -2
drivers/input/touchscreen/melfas_mip4.c
··· 1424 1424 .attrs = mip4_attrs, 1425 1425 }; 1426 1426 1427 - static int mip4_probe(struct i2c_client *client, const struct i2c_device_id *id) 1427 + static int mip4_probe(struct i2c_client *client) 1428 1428 { 1429 1429 struct mip4_ts *ts; 1430 1430 struct input_dev *input; ··· 1590 1590 1591 1591 static struct i2c_driver mip4_driver = { 1592 1592 .id_table = mip4_i2c_ids, 1593 - .probe = mip4_probe, 1593 + .probe_new = mip4_probe, 1594 1594 .driver = { 1595 1595 .name = MIP4_DEVICE_NAME, 1596 1596 .of_match_table = of_match_ptr(mip4_of_match),
+2 -3
drivers/input/touchscreen/migor_ts.c
··· 116 116 enable_irq(priv->irq); 117 117 } 118 118 119 - static int migor_ts_probe(struct i2c_client *client, 120 - const struct i2c_device_id *idp) 119 + static int migor_ts_probe(struct i2c_client *client) 121 120 { 122 121 struct migor_ts_priv *priv; 123 122 struct input_dev *input; ··· 221 222 .name = "migor_ts", 222 223 .pm = &migor_ts_pm, 223 224 }, 224 - .probe = migor_ts_probe, 225 + .probe_new = migor_ts_probe, 225 226 .remove = migor_ts_remove, 226 227 .id_table = migor_ts_id, 227 228 };
+2 -3
drivers/input/touchscreen/mms114.c
··· 440 440 return 0; 441 441 } 442 442 443 - static int mms114_probe(struct i2c_client *client, 444 - const struct i2c_device_id *id) 443 + static int mms114_probe(struct i2c_client *client) 445 444 { 446 445 struct mms114_data *data; 447 446 struct input_dev *input_dev; ··· 638 639 .pm = &mms114_pm_ops, 639 640 .of_match_table = of_match_ptr(mms114_dt_match), 640 641 }, 641 - .probe = mms114_probe, 642 + .probe_new = mms114_probe, 642 643 .id_table = mms114_id, 643 644 }; 644 645
+184 -15
drivers/input/touchscreen/msg2638.c
··· 21 21 #include <linux/kernel.h> 22 22 #include <linux/mod_devicetable.h> 23 23 #include <linux/module.h> 24 + #include <linux/property.h> 24 25 #include <linux/regulator/consumer.h> 25 26 #include <linux/slab.h> 26 27 27 28 #define MODE_DATA_RAW 0x5A 28 29 29 - #define MAX_SUPPORTED_FINGER_NUM 5 30 + #define MSG2138_MAX_FINGERS 2 31 + #define MSG2638_MAX_FINGERS 5 32 + 33 + #define MAX_BUTTONS 4 30 34 31 35 #define CHIP_ON_DELAY_MS 15 32 36 #define FIRMWARE_ON_DELAY_MS 50 33 37 #define RESET_DELAY_MIN_US 10000 34 38 #define RESET_DELAY_MAX_US 11000 35 39 36 - struct packet { 40 + struct msg_chip_data { 41 + irq_handler_t irq_handler; 42 + unsigned int max_fingers; 43 + }; 44 + 45 + struct msg2138_packet { 46 + u8 xy_hi; /* higher bits of x and y coordinates */ 47 + u8 x_low; 48 + u8 y_low; 49 + }; 50 + 51 + struct msg2138_touch_event { 52 + u8 magic; 53 + struct msg2138_packet pkt[MSG2138_MAX_FINGERS]; 54 + u8 checksum; 55 + }; 56 + 57 + struct msg2638_packet { 37 58 u8 xy_hi; /* higher bits of x and y coordinates */ 38 59 u8 x_low; 39 60 u8 y_low; 40 61 u8 pressure; 41 62 }; 42 63 43 - struct touch_event { 64 + struct msg2638_touch_event { 44 65 u8 mode; 45 - struct packet pkt[MAX_SUPPORTED_FINGER_NUM]; 66 + struct msg2638_packet pkt[MSG2638_MAX_FINGERS]; 46 67 u8 proximity; 47 68 u8 checksum; 48 69 }; ··· 74 53 struct touchscreen_properties prop; 75 54 struct regulator_bulk_data supplies[2]; 76 55 struct gpio_desc *reset_gpiod; 56 + int max_fingers; 57 + u32 keycodes[MAX_BUTTONS]; 58 + int num_keycodes; 77 59 }; 78 60 79 61 static u8 msg2638_checksum(u8 *data, u32 length) ··· 90 66 return (u8)((-sum) & 0xFF); 91 67 } 92 68 93 - static irqreturn_t msg2638_ts_irq_handler(int irq, void *msg2638_handler) 69 + static void msg2138_report_keys(struct msg2638_ts_data *msg2638, u8 keys) 70 + { 71 + int i; 72 + 73 + /* keys can be 0x00 or 0xff when all keys have been released */ 74 + if (keys == 0xff) 75 + keys = 0; 76 + 77 + for (i = 0; i < msg2638->num_keycodes; ++i) 78 + input_report_key(msg2638->input_dev, msg2638->keycodes[i], 79 + keys & BIT(i)); 80 + } 81 + 82 + static irqreturn_t msg2138_ts_irq_handler(int irq, void *msg2638_handler) 94 83 { 95 84 struct msg2638_ts_data *msg2638 = msg2638_handler; 96 85 struct i2c_client *client = msg2638->client; 97 86 struct input_dev *input = msg2638->input_dev; 98 - struct touch_event touch_event; 87 + struct msg2138_touch_event touch_event; 99 88 u32 len = sizeof(touch_event); 100 89 struct i2c_msg msg[] = { 101 90 { ··· 118 81 .buf = (u8 *)&touch_event, 119 82 }, 120 83 }; 121 - struct packet *p; 84 + struct msg2138_packet *p0, *p1; 85 + u16 x, y, delta_x, delta_y; 86 + int ret; 87 + 88 + ret = i2c_transfer(client->adapter, msg, ARRAY_SIZE(msg)); 89 + if (ret != ARRAY_SIZE(msg)) { 90 + dev_err(&client->dev, 91 + "Failed I2C transfer in irq handler: %d\n", 92 + ret < 0 ? ret : -EIO); 93 + goto out; 94 + } 95 + 96 + if (msg2638_checksum((u8 *)&touch_event, len - 1) != 97 + touch_event.checksum) { 98 + dev_err(&client->dev, "Failed checksum!\n"); 99 + goto out; 100 + } 101 + 102 + p0 = &touch_event.pkt[0]; 103 + p1 = &touch_event.pkt[1]; 104 + 105 + /* Ignore non-pressed finger data, but check for key code */ 106 + if (p0->xy_hi == 0xFF && p0->x_low == 0xFF && p0->y_low == 0xFF) { 107 + if (p1->xy_hi == 0xFF && p1->y_low == 0xFF) 108 + msg2138_report_keys(msg2638, p1->x_low); 109 + goto report; 110 + } 111 + 112 + x = ((p0->xy_hi & 0xF0) << 4) | p0->x_low; 113 + y = ((p0->xy_hi & 0x0F) << 8) | p0->y_low; 114 + 115 + input_mt_slot(input, 0); 116 + input_mt_report_slot_state(input, MT_TOOL_FINGER, true); 117 + touchscreen_report_pos(input, &msg2638->prop, x, y, true); 118 + 119 + /* Ignore non-pressed finger data */ 120 + if (p1->xy_hi == 0xFF && p1->x_low == 0xFF && p1->y_low == 0xFF) 121 + goto report; 122 + 123 + /* Second finger is reported as a delta position */ 124 + delta_x = ((p1->xy_hi & 0xF0) << 4) | p1->x_low; 125 + delta_y = ((p1->xy_hi & 0x0F) << 8) | p1->y_low; 126 + 127 + /* Ignore second finger if both deltas equal 0 */ 128 + if (delta_x == 0 && delta_y == 0) 129 + goto report; 130 + 131 + x += delta_x; 132 + y += delta_y; 133 + 134 + input_mt_slot(input, 1); 135 + input_mt_report_slot_state(input, MT_TOOL_FINGER, true); 136 + touchscreen_report_pos(input, &msg2638->prop, x, y, true); 137 + 138 + report: 139 + input_mt_sync_frame(msg2638->input_dev); 140 + input_sync(msg2638->input_dev); 141 + 142 + out: 143 + return IRQ_HANDLED; 144 + } 145 + 146 + static irqreturn_t msg2638_ts_irq_handler(int irq, void *msg2638_handler) 147 + { 148 + struct msg2638_ts_data *msg2638 = msg2638_handler; 149 + struct i2c_client *client = msg2638->client; 150 + struct input_dev *input = msg2638->input_dev; 151 + struct msg2638_touch_event touch_event; 152 + u32 len = sizeof(touch_event); 153 + struct i2c_msg msg[] = { 154 + { 155 + .addr = client->addr, 156 + .flags = I2C_M_RD, 157 + .len = sizeof(touch_event), 158 + .buf = (u8 *)&touch_event, 159 + }, 160 + }; 161 + struct msg2638_packet *p; 122 162 u16 x, y; 123 163 int ret; 124 164 int i; ··· 217 103 goto out; 218 104 } 219 105 220 - for (i = 0; i < MAX_SUPPORTED_FINGER_NUM; i++) { 106 + for (i = 0; i < msg2638->max_fingers; i++) { 221 107 p = &touch_event.pkt[i]; 222 108 223 109 /* Ignore non-pressed finger data */ ··· 304 190 struct device *dev = &msg2638->client->dev; 305 191 struct input_dev *input_dev; 306 192 int error; 193 + int i; 307 194 308 195 input_dev = devm_input_allocate_device(dev); 309 196 if (!input_dev) { ··· 321 206 input_dev->open = msg2638_input_open; 322 207 input_dev->close = msg2638_input_close; 323 208 209 + if (msg2638->num_keycodes) { 210 + input_dev->keycode = msg2638->keycodes; 211 + input_dev->keycodemax = msg2638->num_keycodes; 212 + input_dev->keycodesize = sizeof(msg2638->keycodes[0]); 213 + for (i = 0; i < msg2638->num_keycodes; i++) 214 + input_set_capability(input_dev, 215 + EV_KEY, msg2638->keycodes[i]); 216 + } 217 + 324 218 input_set_capability(input_dev, EV_ABS, ABS_MT_POSITION_X); 325 219 input_set_capability(input_dev, EV_ABS, ABS_MT_POSITION_Y); 326 220 ··· 339 215 return -EINVAL; 340 216 } 341 217 342 - error = input_mt_init_slots(input_dev, MAX_SUPPORTED_FINGER_NUM, 218 + error = input_mt_init_slots(input_dev, msg2638->max_fingers, 343 219 INPUT_MT_DIRECT | INPUT_MT_DROP_UNUSED); 344 220 if (error) { 345 221 dev_err(dev, "Failed to initialize MT slots: %d\n", error); ··· 357 233 358 234 static int msg2638_ts_probe(struct i2c_client *client) 359 235 { 236 + const struct msg_chip_data *chip_data; 360 237 struct device *dev = &client->dev; 361 238 struct msg2638_ts_data *msg2638; 362 239 int error; ··· 373 248 374 249 msg2638->client = client; 375 250 i2c_set_clientdata(client, msg2638); 251 + 252 + chip_data = device_get_match_data(&client->dev); 253 + if (!chip_data || !chip_data->max_fingers) { 254 + dev_err(dev, "Invalid or missing chip data\n"); 255 + return -EINVAL; 256 + } 257 + 258 + msg2638->max_fingers = chip_data->max_fingers; 376 259 377 260 msg2638->supplies[0].supply = "vdd"; 378 261 msg2638->supplies[1].supply = "vddio"; ··· 398 265 return error; 399 266 } 400 267 401 - error = msg2638_init_input_dev(msg2638); 402 - if (error) { 403 - dev_err(dev, "Failed to initialize input device: %d\n", error); 404 - return error; 268 + msg2638->num_keycodes = device_property_count_u32(dev, 269 + "linux,keycodes"); 270 + if (msg2638->num_keycodes == -EINVAL) { 271 + msg2638->num_keycodes = 0; 272 + } else if (msg2638->num_keycodes < 0) { 273 + dev_err(dev, "Unable to parse linux,keycodes property: %d\n", 274 + msg2638->num_keycodes); 275 + return msg2638->num_keycodes; 276 + } else if (msg2638->num_keycodes > ARRAY_SIZE(msg2638->keycodes)) { 277 + dev_warn(dev, "Found %d linux,keycodes but max is %zd, ignoring the rest\n", 278 + msg2638->num_keycodes, ARRAY_SIZE(msg2638->keycodes)); 279 + msg2638->num_keycodes = ARRAY_SIZE(msg2638->keycodes); 280 + } 281 + 282 + if (msg2638->num_keycodes > 0) { 283 + error = device_property_read_u32_array(dev, "linux,keycodes", 284 + msg2638->keycodes, 285 + msg2638->num_keycodes); 286 + if (error) { 287 + dev_err(dev, "Unable to read linux,keycodes values: %d\n", 288 + error); 289 + return error; 290 + } 405 291 } 406 292 407 293 error = devm_request_threaded_irq(dev, client->irq, 408 - NULL, msg2638_ts_irq_handler, 294 + NULL, chip_data->irq_handler, 409 295 IRQF_ONESHOT | IRQF_NO_AUTOEN, 410 296 client->name, msg2638); 411 297 if (error) { 412 298 dev_err(dev, "Failed to request IRQ: %d\n", error); 299 + return error; 300 + } 301 + 302 + error = msg2638_init_input_dev(msg2638); 303 + if (error) { 304 + dev_err(dev, "Failed to initialize input device: %d\n", error); 413 305 return error; 414 306 } 415 307 ··· 474 316 475 317 static SIMPLE_DEV_PM_OPS(msg2638_pm_ops, msg2638_suspend, msg2638_resume); 476 318 319 + static const struct msg_chip_data msg2138_data = { 320 + .irq_handler = msg2138_ts_irq_handler, 321 + .max_fingers = MSG2138_MAX_FINGERS, 322 + }; 323 + 324 + static const struct msg_chip_data msg2638_data = { 325 + .irq_handler = msg2638_ts_irq_handler, 326 + .max_fingers = MSG2638_MAX_FINGERS, 327 + }; 328 + 477 329 static const struct of_device_id msg2638_of_match[] = { 478 - { .compatible = "mstar,msg2638" }, 330 + { .compatible = "mstar,msg2138", .data = &msg2138_data }, 331 + { .compatible = "mstar,msg2638", .data = &msg2638_data }, 479 332 { } 480 333 }; 481 334 MODULE_DEVICE_TABLE(of, msg2638_of_match);
+3 -3
drivers/input/touchscreen/pixcir_i2c_ts.c
··· 462 462 static SIMPLE_DEV_PM_OPS(pixcir_dev_pm_ops, 463 463 pixcir_i2c_ts_suspend, pixcir_i2c_ts_resume); 464 464 465 - static int pixcir_i2c_ts_probe(struct i2c_client *client, 466 - const struct i2c_device_id *id) 465 + static int pixcir_i2c_ts_probe(struct i2c_client *client) 467 466 { 467 + const struct i2c_device_id *id = i2c_client_get_device_id(client); 468 468 struct device *dev = &client->dev; 469 469 struct pixcir_i2c_ts_data *tsdata; 470 470 struct input_dev *input; ··· 617 617 .pm = &pixcir_dev_pm_ops, 618 618 .of_match_table = of_match_ptr(pixcir_of_match), 619 619 }, 620 - .probe = pixcir_i2c_ts_probe, 620 + .probe_new = pixcir_i2c_ts_probe, 621 621 .id_table = pixcir_i2c_ts_id, 622 622 }; 623 623
+3 -9
drivers/input/touchscreen/raydium_i2c_ts.c
··· 21 21 #include <linux/interrupt.h> 22 22 #include <linux/module.h> 23 23 #include <linux/of.h> 24 + #include <linux/pm_wakeirq.h> 24 25 #include <linux/regulator/consumer.h> 25 26 #include <linux/slab.h> 26 27 #include <asm/unaligned.h> ··· 135 134 u8 pkg_size; 136 135 137 136 enum raydium_boot_mode boot_mode; 138 - 139 - bool wake_irq_enabled; 140 137 }; 141 138 142 139 /* ··· 1065 1066 } 1066 1067 } 1067 1068 1068 - static int raydium_i2c_probe(struct i2c_client *client, 1069 - const struct i2c_device_id *id) 1069 + static int raydium_i2c_probe(struct i2c_client *client) 1070 1070 { 1071 1071 union i2c_smbus_data dummy; 1072 1072 struct raydium_data *ts; ··· 1222 1224 1223 1225 if (device_may_wakeup(dev)) { 1224 1226 raydium_enter_sleep(client); 1225 - 1226 - ts->wake_irq_enabled = (enable_irq_wake(client->irq) == 0); 1227 1227 } else { 1228 1228 raydium_i2c_power_off(ts); 1229 1229 } ··· 1235 1239 struct raydium_data *ts = i2c_get_clientdata(client); 1236 1240 1237 1241 if (device_may_wakeup(dev)) { 1238 - if (ts->wake_irq_enabled) 1239 - disable_irq_wake(client->irq); 1240 1242 raydium_i2c_sw_reset(client); 1241 1243 } else { 1242 1244 raydium_i2c_power_on(ts); ··· 1273 1279 #endif 1274 1280 1275 1281 static struct i2c_driver raydium_i2c_driver = { 1276 - .probe = raydium_i2c_probe, 1282 + .probe_new = raydium_i2c_probe, 1277 1283 .id_table = raydium_i2c_id, 1278 1284 .driver = { 1279 1285 .name = "raydium_ts",
+2 -3
drivers/input/touchscreen/rohm_bu21023.c
··· 1095 1095 ts->initialized = false; 1096 1096 } 1097 1097 1098 - static int rohm_bu21023_i2c_probe(struct i2c_client *client, 1099 - const struct i2c_device_id *id) 1098 + static int rohm_bu21023_i2c_probe(struct i2c_client *client) 1100 1099 { 1101 1100 struct device *dev = &client->dev; 1102 1101 struct rohm_ts_data *ts; ··· 1183 1184 .driver = { 1184 1185 .name = BU21023_NAME, 1185 1186 }, 1186 - .probe = rohm_bu21023_i2c_probe, 1187 + .probe_new = rohm_bu21023_i2c_probe, 1187 1188 .id_table = rohm_bu21023_i2c_id, 1188 1189 }; 1189 1190 module_i2c_driver(rohm_bu21023_i2c_driver);
+2 -3
drivers/input/touchscreen/s6sy761.c
··· 389 389 sdata->regulators); 390 390 } 391 391 392 - static int s6sy761_probe(struct i2c_client *client, 393 - const struct i2c_device_id *id) 392 + static int s6sy761_probe(struct i2c_client *client) 394 393 { 395 394 struct s6sy761_data *sdata; 396 395 unsigned int max_x, max_y; ··· 539 540 .of_match_table = of_match_ptr(s6sy761_of_match), 540 541 .pm = &s6sy761_pm_ops, 541 542 }, 542 - .probe = s6sy761_probe, 543 + .probe_new = s6sy761_probe, 543 544 .remove = s6sy761_remove, 544 545 .id_table = s6sy761_id, 545 546 };
+3 -3
drivers/input/touchscreen/silead.c
··· 652 652 regulator_bulk_disable(ARRAY_SIZE(data->regulators), data->regulators); 653 653 } 654 654 655 - static int silead_ts_probe(struct i2c_client *client, 656 - const struct i2c_device_id *id) 655 + static int silead_ts_probe(struct i2c_client *client) 657 656 { 657 + const struct i2c_device_id *id = i2c_client_get_device_id(client); 658 658 struct silead_ts_data *data; 659 659 struct device *dev = &client->dev; 660 660 int error; ··· 826 826 #endif 827 827 828 828 static struct i2c_driver silead_ts_driver = { 829 - .probe = silead_ts_probe, 829 + .probe_new = silead_ts_probe, 830 830 .id_table = silead_ts_id, 831 831 .driver = { 832 832 .name = SILEAD_TS_NAME,
+2 -3
drivers/input/touchscreen/sis_i2c.c
··· 296 296 } 297 297 } 298 298 299 - static int sis_ts_probe(struct i2c_client *client, 300 - const struct i2c_device_id *id) 299 + static int sis_ts_probe(struct i2c_client *client) 301 300 { 302 301 struct sis_ts_data *ts; 303 302 struct input_dev *input; ··· 393 394 .name = SIS_I2C_NAME, 394 395 .of_match_table = of_match_ptr(sis_ts_dt_ids), 395 396 }, 396 - .probe = sis_ts_probe, 397 + .probe_new = sis_ts_probe, 397 398 .id_table = sis_ts_id, 398 399 }; 399 400 module_i2c_driver(sis_ts_driver);
+3 -3
drivers/input/touchscreen/st1232.c
··· 220 220 .max_fingers = 5, 221 221 }; 222 222 223 - static int st1232_ts_probe(struct i2c_client *client, 224 - const struct i2c_device_id *id) 223 + static int st1232_ts_probe(struct i2c_client *client) 225 224 { 225 + const struct i2c_device_id *id = i2c_client_get_device_id(client); 226 226 const struct st_chip_info *match; 227 227 struct st1232_ts_data *ts; 228 228 struct input_dev *input_dev; ··· 384 384 MODULE_DEVICE_TABLE(of, st1232_ts_dt_ids); 385 385 386 386 static struct i2c_driver st1232_ts_driver = { 387 - .probe = st1232_ts_probe, 387 + .probe_new = st1232_ts_probe, 388 388 .id_table = st1232_ts_id, 389 389 .driver = { 390 390 .name = ST1232_TS_NAME,
+2 -3
drivers/input/touchscreen/stmfts.c
··· 624 624 return 0; 625 625 } 626 626 627 - static int stmfts_probe(struct i2c_client *client, 628 - const struct i2c_device_id *id) 627 + static int stmfts_probe(struct i2c_client *client) 629 628 { 630 629 int err; 631 630 struct stmfts_data *sdata; ··· 808 809 .pm = &stmfts_pm_ops, 809 810 .probe_type = PROBE_PREFER_ASYNCHRONOUS, 810 811 }, 811 - .probe = stmfts_probe, 812 + .probe_new = stmfts_probe, 812 813 .remove = stmfts_remove, 813 814 .id_table = stmfts_id, 814 815 };
+3 -3
drivers/input/touchscreen/sx8654.c
··· 306 306 } 307 307 } 308 308 309 - static int sx8654_probe(struct i2c_client *client, 310 - const struct i2c_device_id *id) 309 + static int sx8654_probe(struct i2c_client *client) 311 310 { 311 + const struct i2c_device_id *id = i2c_client_get_device_id(client); 312 312 struct sx8654 *sx8654; 313 313 struct input_dev *input; 314 314 int error; ··· 470 470 .of_match_table = of_match_ptr(sx8654_of_match), 471 471 }, 472 472 .id_table = sx8654_id_table, 473 - .probe = sx8654_probe, 473 + .probe_new = sx8654_probe, 474 474 }; 475 475 module_i2c_driver(sx8654_driver); 476 476
-2
drivers/input/touchscreen/tps6507x-ts.c
··· 119 119 static s32 tps6507x_adc_standby(struct tps6507x_ts *tsc) 120 120 { 121 121 s32 ret; 122 - s32 loops = 0; 123 122 u8 val; 124 123 125 124 ret = tps6507x_write_u8(tsc, TPS6507X_REG_ADCONFIG, ··· 140 141 ret = tps6507x_read_u8(tsc, TPS6507X_REG_INT, &val); 141 142 if (ret) 142 143 return ret; 143 - loops++; 144 144 } 145 145 146 146 return ret;
+2 -3
drivers/input/touchscreen/tsc2004.c
··· 34 34 return 0; 35 35 } 36 36 37 - static int tsc2004_probe(struct i2c_client *i2c, 38 - const struct i2c_device_id *id) 37 + static int tsc2004_probe(struct i2c_client *i2c) 39 38 40 39 { 41 40 return tsc200x_probe(&i2c->dev, i2c->irq, &tsc2004_input_id, ··· 68 69 .pm = &tsc200x_pm_ops, 69 70 }, 70 71 .id_table = tsc2004_idtable, 71 - .probe = tsc2004_probe, 72 + .probe_new = tsc2004_probe, 72 73 .remove = tsc2004_remove, 73 74 }; 74 75 module_i2c_driver(tsc2004_driver);
+3 -3
drivers/input/touchscreen/tsc2007_core.c
··· 302 302 pdata->exit_platform_hw(); 303 303 } 304 304 305 - static int tsc2007_probe(struct i2c_client *client, 306 - const struct i2c_device_id *id) 305 + static int tsc2007_probe(struct i2c_client *client) 307 306 { 307 + const struct i2c_device_id *id = i2c_client_get_device_id(client); 308 308 const struct tsc2007_platform_data *pdata = 309 309 dev_get_platdata(&client->dev); 310 310 struct tsc2007 *ts; ··· 431 431 .of_match_table = tsc2007_of_match, 432 432 }, 433 433 .id_table = tsc2007_idtable, 434 - .probe = tsc2007_probe, 434 + .probe_new = tsc2007_probe, 435 435 }; 436 436 437 437 module_i2c_driver(tsc2007_driver);
+2 -3
drivers/input/touchscreen/wacom_i2c.c
··· 162 162 disable_irq(client->irq); 163 163 } 164 164 165 - static int wacom_i2c_probe(struct i2c_client *client, 166 - const struct i2c_device_id *id) 165 + static int wacom_i2c_probe(struct i2c_client *client) 167 166 { 168 167 struct device *dev = &client->dev; 169 168 struct wacom_i2c *wac_i2c; ··· 264 265 .pm = &wacom_i2c_pm, 265 266 }, 266 267 267 - .probe = wacom_i2c_probe, 268 + .probe_new = wacom_i2c_probe, 268 269 .id_table = wacom_i2c_id, 269 270 }; 270 271 module_i2c_driver(wacom_i2c_driver);
+2 -3
drivers/input/touchscreen/wdt87xx_i2c.c
··· 1064 1064 return 0; 1065 1065 } 1066 1066 1067 - static int wdt87xx_ts_probe(struct i2c_client *client, 1068 - const struct i2c_device_id *id) 1067 + static int wdt87xx_ts_probe(struct i2c_client *client) 1069 1068 { 1070 1069 struct wdt87xx_data *wdt; 1071 1070 int error; ··· 1169 1170 MODULE_DEVICE_TABLE(acpi, wdt87xx_acpi_id); 1170 1171 1171 1172 static struct i2c_driver wdt87xx_driver = { 1172 - .probe = wdt87xx_ts_probe, 1173 + .probe_new = wdt87xx_ts_probe, 1173 1174 .id_table = wdt87xx_dev_id, 1174 1175 .driver = { 1175 1176 .name = WDT87XX_NAME,
+2 -3
drivers/input/touchscreen/zet6223.c
··· 167 167 return 0; 168 168 } 169 169 170 - static int zet6223_probe(struct i2c_client *client, 171 - const struct i2c_device_id *id) 170 + static int zet6223_probe(struct i2c_client *client) 172 171 { 173 172 struct device *dev = &client->dev; 174 173 struct zet6223_ts *ts; ··· 248 249 .name = "zet6223", 249 250 .of_match_table = zet6223_of_match, 250 251 }, 251 - .probe = zet6223_probe, 252 + .probe_new = zet6223_probe, 252 253 .id_table = zet6223_id 253 254 }; 254 255 module_i2c_driver(zet6223_driver);
+2 -3
drivers/input/touchscreen/zforce_ts.c
··· 732 732 return pdata; 733 733 } 734 734 735 - static int zforce_probe(struct i2c_client *client, 736 - const struct i2c_device_id *id) 735 + static int zforce_probe(struct i2c_client *client) 737 736 { 738 737 const struct zforce_ts_platdata *pdata = dev_get_platdata(&client->dev); 739 738 struct zforce_ts *ts; ··· 944 945 .pm = &zforce_pm_ops, 945 946 .of_match_table = of_match_ptr(zforce_dt_idtable), 946 947 }, 947 - .probe = zforce_probe, 948 + .probe_new = zforce_probe, 948 949 .id_table = zforce_idtable, 949 950 }; 950 951
+1
include/linux/fixp-arith.h
··· 2 2 #ifndef _FIXP_ARITH_H 3 3 #define _FIXP_ARITH_H 4 4 5 + #include <linux/bug.h> 5 6 #include <linux/math64.h> 6 7 7 8 /*
-3
include/linux/mfd/max8997.h
··· 110 110 111 111 /** 112 112 * max8997_haptic_platform_data 113 - * @pwm_channel_id: channel number of PWM device 114 - * valid for MAX8997_EXTERNAL_MODE 115 113 * @pwm_period: period in nano second for PWM device 116 114 * valid for MAX8997_EXTERNAL_MODE 117 115 * @type: motor type ··· 126 128 * [0 - 255]: available period 127 129 */ 128 130 struct max8997_haptic_platform_data { 129 - unsigned int pwm_channel_id; 130 131 unsigned int pwm_period; 131 132 132 133 enum max8997_haptic_motor_type type;
+3
include/uapi/linux/input-event-codes.h
··· 614 614 #define KEY_KBD_LAYOUT_NEXT 0x248 /* AC Next Keyboard Layout Select */ 615 615 #define KEY_EMOJI_PICKER 0x249 /* Show/hide emoji picker (HUTRR101) */ 616 616 #define KEY_DICTATE 0x24a /* Start or Stop Voice Dictation Session (HUTRR99) */ 617 + #define KEY_CAMERA_ACCESS_ENABLE 0x24b /* Enables programmatic access to camera devices. (HUTRR72) */ 618 + #define KEY_CAMERA_ACCESS_DISABLE 0x24c /* Disables programmatic access to camera devices. (HUTRR72) */ 619 + #define KEY_CAMERA_ACCESS_TOGGLE 0x24d /* Toggles the current state of the camera access control. (HUTRR72) */ 617 620 618 621 #define KEY_BRIGHTNESS_MIN 0x250 /* Set Brightness to Minimum */ 619 622 #define KEY_BRIGHTNESS_MAX 0x251 /* Set Brightness to Maximum */