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

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input

Pull input updates from Dmitry Torokhov:

- a new driver for SparkFun Qwiic Joystick

- pm8941-pwrkey driver now supports PMK8350

- a bunch of assorted driver fixes

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (44 commits)
Input: joydev - prevent use of not validated data in JSIOCSBTNMAP ioctl
Input: hideep - fix the uninitialized use in hideep_nvm_unlock()
Input: trackpoint - use kobj_to_dev()
Input: atkbd - use kobj_to_dev()
Input: tsc200x-core - use kobj_to_dev()
Input: ims-pcu - use kobj_to_dev()
Input: cros_ec_keyb - use kobj_to_dev() API
dt-bindings: input: touchscreen: st1232: Convert to json-schema
Input: i8042 - fix typos in comments
Input: add SparkFun Qwiic Joystick driver
dt-bindings: Add vendor prefix and bindings for Qwiic Joystick
Input: cy8ctmg110_ts - switch to using gpiod API
Input: cy8ctmg110_ts - switch to using managed resources
Input: cy8ctmg110_ts - use endian helpers when converting data on wire
Input: cy8ctmg110_ts - let I2C core configure wake interrupt
Input: cy8ctmg110_ts - do not hardcode as wakeup source
Input: cy8ctmg110_ts - do not hard code interrupt trigger
Input: cy8ctmg110_ts - rely on platform code to supply interrupt
Input: resistive-adc-touch - fix uninitialized variable 'press'
Input: pm8941-pwrkey - add support for PMK8350 PON_HLOS PMIC peripheral
...

+834 -392
-12
Documentation/devicetree/bindings/input/fsl-mma8450.txt
··· 1 - * Freescale MMA8450 3-Axis Accelerometer 2 - 3 - Required properties: 4 - - compatible : "fsl,mma8450". 5 - - reg: the I2C address of MMA8450 6 - 7 - Example: 8 - 9 - accelerometer: mma8450@1c { 10 - compatible = "fsl,mma8450"; 11 - reg = <0x1c>; 12 - };
+2
Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt
··· 8 8 Definition: must be one of: 9 9 "qcom,pm8941-pwrkey" 10 10 "qcom,pm8941-resin" 11 + "qcom,pmk8350-pwrkey" 12 + "qcom,pmk8350-resin" 11 13 12 14 - reg: 13 15 Usage: required
+148
Documentation/devicetree/bindings/input/touchscreen/cypress,cy8ctma340.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,cy8ctma340.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Cypress CY8CTMA340 series touchscreen controller bindings 8 + 9 + description: The Cypress CY8CTMA340 series (also known as "CYTTSP" after 10 + the marketing name Cypress TrueTouch Standard Product) touchscreens can 11 + be connected to either I2C or SPI buses. 12 + 13 + maintainers: 14 + - Javier Martinez Canillas <javier@dowhile0.org> 15 + - Linus Walleij <linus.walleij@linaro.org> 16 + 17 + allOf: 18 + - $ref: touchscreen.yaml# 19 + 20 + properties: 21 + $nodename: 22 + pattern: "^touchscreen(@.*)?$" 23 + 24 + compatible: 25 + oneOf: 26 + - const: cypress,cy8ctma340 27 + - const: cypress,cy8ctst341 28 + - const: cypress,cyttsp-spi 29 + description: Legacy compatible for SPI connected CY8CTMA340 30 + deprecated: true 31 + - const: cypress,cyttsp-i2c 32 + description: Legacy compatible for I2C connected CY8CTMA340 33 + deprecated: true 34 + 35 + reg: 36 + description: I2C address when used on the I2C bus, or the SPI chip 37 + select index when used on the SPI bus 38 + 39 + clock-frequency: 40 + description: I2C client clock frequency, defined for host when using 41 + the device on the I2C bus 42 + minimum: 0 43 + maximum: 400000 44 + 45 + spi-max-frequency: 46 + description: SPI clock frequency, defined for host, defined when using 47 + the device on the SPI bus. The throughput is maximum 2 Mbps so the 48 + typical value is 2000000, if higher rates are used the total throughput 49 + needs to be restricted to 2 Mbps. 50 + minimum: 0 51 + maximum: 6000000 52 + 53 + interrupts: 54 + description: Interrupt to host 55 + maxItems: 1 56 + 57 + vcpin-supply: 58 + description: Analog power supply regulator on VCPIN pin 59 + 60 + vdd-supply: 61 + description: Digital power supply regulator on VDD pin 62 + 63 + reset-gpios: 64 + description: Reset line for the touchscreen, should be tagged 65 + as GPIO_ACTIVE_LOW 66 + 67 + bootloader-key: 68 + description: the 8-byte bootloader key that is required to switch 69 + the chip from bootloader mode (default mode) to application mode 70 + $ref: /schemas/types.yaml#/definitions/uint8-array 71 + minItems: 8 72 + maxItems: 8 73 + 74 + touchscreen-size-x: true 75 + touchscreen-size-y: true 76 + touchscreen-fuzz-x: true 77 + touchscreen-fuzz-y: true 78 + 79 + active-distance: 80 + description: the distance in pixels beyond which a touch must move 81 + before movement is detected and reported by the device 82 + $ref: /schemas/types.yaml#/definitions/uint32 83 + minimum: 0 84 + maximum: 15 85 + 86 + active-interval-ms: 87 + description: the minimum period in ms between consecutive 88 + scanning/processing cycles when the chip is in active mode 89 + minimum: 0 90 + maximum: 255 91 + 92 + lowpower-interval-ms: 93 + description: the minimum period in ms between consecutive 94 + scanning/processing cycles when the chip is in low-power mode 95 + minimum: 0 96 + maximum: 2550 97 + 98 + touch-timeout-ms: 99 + description: minimum time in ms spent in the active power state while no 100 + touches are detected before entering low-power mode 101 + minimum: 0 102 + maximum: 2550 103 + 104 + use-handshake: 105 + description: enable register-based handshake (boolean). This should only 106 + be used if the chip is configured to use 'blocking communication with 107 + timeout' (in this case the device generates an interrupt at the end of 108 + every scanning/processing cycle) 109 + $ref: /schemas/types.yaml#/definitions/flag 110 + 111 + additionalProperties: false 112 + 113 + required: 114 + - compatible 115 + - reg 116 + - interrupts 117 + - bootloader-key 118 + - touchscreen-size-x 119 + - touchscreen-size-y 120 + 121 + examples: 122 + - | 123 + #include <dt-bindings/interrupt-controller/irq.h> 124 + #include <dt-bindings/gpio/gpio.h> 125 + spi { 126 + #address-cells = <1>; 127 + #size-cells = <0>; 128 + num-cs = <1>; 129 + cs-gpios = <&gpio 2 GPIO_ACTIVE_HIGH>; 130 + 131 + touchscreen@0 { 132 + compatible = "cypress,cy8ctma340"; 133 + reg = <0>; 134 + interrupt-parent = <&gpio>; 135 + interrupts = <20 IRQ_TYPE_EDGE_FALLING>; 136 + reset-gpios = <&gpio 21 GPIO_ACTIVE_LOW>; 137 + vdd-supply = <&ldo_aux1_reg>; 138 + vcpin-supply = <&ldo_aux2_reg>; 139 + bootloader-key = /bits/ 8 <0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07>; 140 + touchscreen-size-x = <480>; 141 + touchscreen-size-y = <800>; 142 + active-interval-ms = <0>; 143 + touch-timeout-ms = <255>; 144 + lowpower-interval-ms = <10>; 145 + }; 146 + }; 147 + 148 + ...
-93
Documentation/devicetree/bindings/input/touchscreen/cyttsp.txt
··· 1 - * Cypress cyttsp touchscreen controller 2 - 3 - Required properties: 4 - - compatible : must be "cypress,cyttsp-i2c" or "cypress,cyttsp-spi" 5 - - reg : Device I2C address or SPI chip select number 6 - - spi-max-frequency : Maximum SPI clocking speed of the device (for cyttsp-spi) 7 - - interrupts : (gpio) interrupt to which the chip is connected 8 - (see interrupt binding[0]). 9 - - bootloader-key : the 8-byte bootloader key that is required to switch 10 - the chip from bootloader mode (default mode) to 11 - application mode. 12 - This property has to be specified as an array of 8 13 - '/bits/ 8' values. 14 - 15 - Optional properties: 16 - - reset-gpios : the reset gpio the chip is connected to 17 - (see GPIO binding[1] for more details). 18 - - touchscreen-size-x : horizontal resolution of touchscreen (in pixels) 19 - - touchscreen-size-y : vertical resolution of touchscreen (in pixels) 20 - - touchscreen-fuzz-x : horizontal noise value of the absolute input device 21 - (in pixels) 22 - - touchscreen-fuzz-y : vertical noise value of the absolute input device 23 - (in pixels) 24 - - active-distance : the distance in pixels beyond which a touch must move 25 - before movement is detected and reported by the device. 26 - Valid values: 0-15. 27 - - active-interval-ms : the minimum period in ms between consecutive 28 - scanning/processing cycles when the chip is in active mode. 29 - Valid values: 0-255. 30 - - lowpower-interval-ms : the minimum period in ms between consecutive 31 - scanning/processing cycles when the chip is in low-power mode. 32 - Valid values: 0-2550 33 - - touch-timeout-ms : minimum time in ms spent in the active power state while no 34 - touches are detected before entering low-power mode. 35 - Valid values: 0-2550 36 - - use-handshake : enable register-based handshake (boolean). This should 37 - only be used if the chip is configured to use 'blocking 38 - communication with timeout' (in this case the device 39 - generates an interrupt at the end of every 40 - scanning/processing cycle). 41 - 42 - [0]: Documentation/devicetree/bindings/interrupt-controller/interrupts.txt 43 - [1]: Documentation/devicetree/bindings/gpio/gpio.txt 44 - 45 - Example: 46 - &i2c1 { 47 - /* ... */ 48 - cyttsp@a { 49 - compatible = "cypress,cyttsp-i2c"; 50 - reg = <0xa>; 51 - interrupt-parent = <&gpio0>; 52 - interrupts = <28 0>; 53 - reset-gpios = <&gpio3 4 GPIO_ACTIVE_LOW>; 54 - 55 - touchscreen-size-x = <800>; 56 - touchscreen-size-y = <480>; 57 - touchscreen-fuzz-x = <4>; 58 - touchscreen-fuzz-y = <7>; 59 - 60 - bootloader-key = /bits/ 8 <0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08>; 61 - active-distance = <8>; 62 - active-interval-ms = <0>; 63 - lowpower-interval-ms = <200>; 64 - touch-timeout-ms = <100>; 65 - }; 66 - 67 - /* ... */ 68 - }; 69 - 70 - &mcspi1 { 71 - /* ... */ 72 - cyttsp@0 { 73 - compatible = "cypress,cyttsp-spi"; 74 - spi-max-frequency = <6000000>; 75 - reg = <0>; 76 - interrupt-parent = <&gpio0>; 77 - interrupts = <28 0>; 78 - reset-gpios = <&gpio3 4 GPIO_ACTIVE_LOW>; 79 - 80 - touchscreen-size-x = <800>; 81 - touchscreen-size-y = <480>; 82 - touchscreen-fuzz-x = <4>; 83 - touchscreen-fuzz-y = <7>; 84 - 85 - bootloader-key = /bits/ 8 <0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08>; 86 - active-distance = <8>; 87 - active-interval-ms = <0>; 88 - lowpower-interval-ms = <200>; 89 - touch-timeout-ms = <100>; 90 - }; 91 - 92 - /* ... */ 93 - };
+1
Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.yaml
··· 56 56 wakeup-source: true 57 57 58 58 vcc-supply: true 59 + iovcc-supply: true 59 60 60 61 gain: 61 62 description: Allows setting the sensitivity in the range from 0 to 31.
-33
Documentation/devicetree/bindings/input/touchscreen/resistive-adc-touch.txt
··· 1 - Generic resistive touchscreen ADC 2 - 3 - Required properties: 4 - 5 - - compatible: must be "resistive-adc-touch" 6 - The device must be connected to an ADC device that provides channels for 7 - position measurement and optional pressure. 8 - Refer to 9 - https://github.com/devicetree-org/dt-schema/blob/master/schemas/iio/iio-consumer.yaml 10 - for details 11 - 12 - - iio-channels: must have at least two channels connected to an ADC device. 13 - These should correspond to the channels exposed by the ADC device and should 14 - have the right index as the ADC device registers them. These channels 15 - represent the relative position on the "x" and "y" axes. 16 - - iio-channel-names: must have all the channels' names. Mandatory channels 17 - are "x" and "y". 18 - 19 - Optional properties: 20 - - iio-channels: The third channel named "pressure" is optional and can be 21 - used if the ADC device also measures pressure besides position. 22 - If this channel is missing, pressure will be ignored and the touchscreen 23 - will only report position. 24 - - iio-channel-names: optional channel named "pressure". 25 - 26 - Example: 27 - 28 - resistive_touch: resistive_touch { 29 - compatible = "resistive-adc-touch"; 30 - touchscreen-min-pressure = <50000>; 31 - io-channels = <&adc 24>, <&adc 25>, <&adc 26>; 32 - io-channel-names = "x", "y", "pressure"; 33 - };
+86
Documentation/devicetree/bindings/input/touchscreen/resistive-adc-touch.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/input/touchscreen/resistive-adc-touch.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Generic resistive touchscreen ADC 8 + 9 + maintainers: 10 + - Oleksij Rempel <o.rempel@pengutronix.de> 11 + 12 + description: | 13 + Generic ADC based resistive touchscreen controller 14 + The device must be connected to an ADC device that provides channels for 15 + position measurement and optional pressure. 16 + 17 + allOf: 18 + - $ref: touchscreen.yaml# 19 + 20 + properties: 21 + compatible: 22 + const: resistive-adc-touch 23 + 24 + io-channels: 25 + minItems: 2 26 + items: 27 + - description: x 28 + - description: y 29 + - description: pressure (optional) 30 + - description: z1 (optional) 31 + - description: z2 (optional) 32 + 33 + io-channel-names: 34 + oneOf: 35 + - items: 36 + - enum: [x, y] 37 + - enum: [x, y] 38 + - items: 39 + - enum: [x, y, pressure] 40 + - enum: [x, y, pressure] 41 + - enum: [x, y, pressure] 42 + - items: 43 + - enum: [x, y, z1, z2] 44 + - enum: [x, y, z1, z2] 45 + - enum: [x, y, z1, z2] 46 + - enum: [x, y, z1, z2] 47 + 48 + touchscreen-size-x: true 49 + touchscreen-size-y: true 50 + touchscreen-fuzz-x: true 51 + touchscreen-fuzz-y: true 52 + touchscreen-inverted-x: true 53 + touchscreen-inverted-y: true 54 + touchscreen-swapped-x-y: true 55 + touchscreen-min-pressure: true 56 + touchscreen-x-plate-ohms: true 57 + 58 + additionalProperties: false 59 + 60 + required: 61 + - compatible 62 + - io-channels 63 + - io-channel-names 64 + 65 + examples: 66 + - | 67 + touchscreen { 68 + compatible = "resistive-adc-touch"; 69 + io-channels = <&adc 24>, <&adc 25>; 70 + io-channel-names = "y", "x"; 71 + }; 72 + - | 73 + touchscreen { 74 + compatible = "resistive-adc-touch"; 75 + touchscreen-min-pressure = <50000>; 76 + io-channels = <&adc 24>, <&adc 25>, <&adc 26>; 77 + io-channel-names = "y", "pressure", "x"; 78 + }; 79 + - | 80 + touchscreen { 81 + compatible = "resistive-adc-touch"; 82 + touchscreen-min-pressure = <50000>; 83 + io-channels = <&adc 1>, <&adc 2>, <&adc 3>, <&adc 4>; 84 + io-channel-names = "x", "z1", "z2", "y"; 85 + touchscreen-x-plate-ohms = <800>; 86 + };
+50
Documentation/devicetree/bindings/input/touchscreen/sitronix,st1232.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/sitronix,st1232.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Sitronix st1232 or st1633 touchscreen controller 8 + 9 + maintainers: 10 + - Bastian Hecht <hechtb@gmail.com> 11 + 12 + allOf: 13 + - $ref: touchscreen.yaml# 14 + 15 + properties: 16 + compatible: 17 + enum: 18 + - sitronix,st1232 19 + - sitronix,st1633 20 + 21 + reg: 22 + maxItems: 1 23 + 24 + interrupts: 25 + maxItems: 1 26 + 27 + gpios: 28 + description: A phandle to the reset GPIO 29 + maxItems: 1 30 + 31 + required: 32 + - compatible 33 + - reg 34 + - interrupts 35 + 36 + unevaluatedProperties: false 37 + 38 + examples: 39 + - | 40 + i2c { 41 + #address-cells = <1>; 42 + #size-cells = <0>; 43 + 44 + touchscreen@55 { 45 + compatible = "sitronix,st1232"; 46 + reg = <0x55>; 47 + interrupts = <2 0>; 48 + gpios = <&gpio1 166 0>; 49 + }; 50 + };
-28
Documentation/devicetree/bindings/input/touchscreen/sitronix-st1232.txt
··· 1 - * Sitronix st1232 or st1633 touchscreen controller 2 - 3 - Required properties: 4 - - compatible: must contain one of 5 - * "sitronix,st1232" 6 - * "sitronix,st1633" 7 - - reg: I2C address of the chip 8 - - interrupts: interrupt to which the chip is connected 9 - 10 - Optional properties: 11 - - gpios: a phandle to the reset GPIO 12 - 13 - For additional optional properties see: touchscreen.txt 14 - 15 - Example: 16 - 17 - i2c@00000000 { 18 - /* ... */ 19 - 20 - touchscreen@55 { 21 - compatible = "sitronix,st1232"; 22 - reg = <0x55>; 23 - interrupts = <2 0>; 24 - gpios = <&gpio1 166 0>; 25 - }; 26 - 27 - /* ... */ 28 - };
+6
Documentation/devicetree/bindings/input/touchscreen/touchscreen.yaml
··· 74 74 touchscreen-y-mm: 75 75 description: vertical length in mm of the touchscreen 76 76 77 + touchscreen-x-plate-ohms: 78 + description: Resistance of the X-plate in Ohms 79 + 80 + touchscreen-y-plate-ohms: 81 + description: Resistance of the Y-plate in Ohms 82 + 77 83 dependencies: 78 84 touchscreen-size-x: [ touchscreen-size-y ] 79 85 touchscreen-size-y: [ touchscreen-size-x ]
+2
Documentation/devicetree/bindings/trivial-devices.yaml
··· 272 272 # Socionext SynQuacer TPM MMIO module 273 273 - socionext,synquacer-tpm-mmio 274 274 # i2c serial eeprom (24cxx) 275 + - sparkfun,qwiic-joystick 276 + # SparkFun Qwiic Joystick (COM-15168) with i2c interface 275 277 - st,24c256 276 278 # Ambient Light Sensor with SMBUS/Two Wire Serial Interface 277 279 - taos,tsl2550
+2
Documentation/devicetree/bindings/vendor-prefixes.yaml
··· 1080 1080 description: Sony Corporation 1081 1081 "^spansion,.*": 1082 1082 description: Spansion Inc. 1083 + "^sparkfun,.*": 1084 + description: SparkFun Electronics 1083 1085 "^sprd,.*": 1084 1086 description: Spreadtrum Communications Inc. 1085 1087 "^sst,.*":
+2 -3
MAINTAINERS
··· 5051 5051 F: drivers/input/touchscreen/cy8ctma140.c 5052 5052 5053 5053 CYTTSP TOUCHSCREEN DRIVER 5054 - M: Ferruh Yigit <fery@cypress.com> 5054 + M: Linus Walleij <linus.walleij@linaro.org> 5055 5055 L: linux-input@vger.kernel.org 5056 - S: Supported 5056 + S: Maintained 5057 5057 F: drivers/input/touchscreen/cyttsp* 5058 - F: include/linux/input/cyttsp.h 5059 5058 5060 5059 D-LINK DIR-685 TOUCHKEYS DRIVER 5061 5060 M: Linus Walleij <linus.walleij@linaro.org>
-3
drivers/input/evbug.c
··· 7 7 * Input driver event debug module - dumps all events into syslog 8 8 */ 9 9 10 - /* 11 - */ 12 - 13 10 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 14 11 15 12 #include <linux/slab.h>
+1 -1
drivers/input/joydev.c
··· 499 499 memcpy(joydev->keypam, keypam, len); 500 500 501 501 for (i = 0; i < joydev->nkey; i++) 502 - joydev->keymap[keypam[i] - BTN_MISC] = i; 502 + joydev->keymap[joydev->keypam[i] - BTN_MISC] = i; 503 503 504 504 out: 505 505 kfree(keypam);
+9
drivers/input/joystick/Kconfig
··· 372 372 To compile this driver as a module, choose M here: the 373 373 module will be called pxrc. 374 374 375 + config JOYSTICK_QWIIC 376 + tristate "SparkFun Qwiic Joystick" 377 + depends on I2C 378 + help 379 + Say Y here if you want to use the SparkFun Qwiic Joystick. 380 + 381 + To compile this driver as a module, choose M here: the 382 + module will be called qwiic-joystick. 383 + 375 384 config JOYSTICK_FSIA6B 376 385 tristate "FlySky FS-iA6B RC Receiver" 377 386 select SERIO
+1
drivers/input/joystick/Makefile
··· 27 27 obj-$(CONFIG_JOYSTICK_N64) += n64joy.o 28 28 obj-$(CONFIG_JOYSTICK_PSXPAD_SPI) += psxpad-spi.o 29 29 obj-$(CONFIG_JOYSTICK_PXRC) += pxrc.o 30 + obj-$(CONFIG_JOYSTICK_QWIIC) += qwiic-joystick.o 30 31 obj-$(CONFIG_JOYSTICK_SIDEWINDER) += sidewinder.o 31 32 obj-$(CONFIG_JOYSTICK_SPACEBALL) += spaceball.o 32 33 obj-$(CONFIG_JOYSTICK_SPACEORB) += spaceorb.o
+146
drivers/input/joystick/qwiic-joystick.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* 3 + * Copyright (C) 2021 Oleh Kravchenko <oleg@kaa.org.ua> 4 + * 5 + * SparkFun Qwiic Joystick 6 + * Product page:https://www.sparkfun.com/products/15168 7 + * Firmware and hardware sources:https://github.com/sparkfun/Qwiic_Joystick 8 + */ 9 + 10 + #include <linux/bits.h> 11 + #include <linux/i2c.h> 12 + #include <linux/input.h> 13 + #include <linux/kernel.h> 14 + #include <linux/module.h> 15 + 16 + #define DRV_NAME "qwiic-joystick" 17 + 18 + #define QWIIC_JSK_REG_VERS 1 19 + #define QWIIC_JSK_REG_DATA 3 20 + 21 + #define QWIIC_JSK_MAX_AXIS GENMASK(9, 0) 22 + #define QWIIC_JSK_FUZZ 2 23 + #define QWIIC_JSK_FLAT 2 24 + #define QWIIC_JSK_POLL_INTERVAL 16 25 + #define QWIIC_JSK_POLL_MIN 8 26 + #define QWIIC_JSK_POLL_MAX 32 27 + 28 + struct qwiic_jsk { 29 + char phys[32]; 30 + struct input_dev *dev; 31 + struct i2c_client *client; 32 + }; 33 + 34 + struct qwiic_ver { 35 + u8 major; 36 + u8 minor; 37 + }; 38 + 39 + struct qwiic_data { 40 + __be16 x; 41 + __be16 y; 42 + u8 thumb; 43 + }; 44 + 45 + static void qwiic_poll(struct input_dev *input) 46 + { 47 + struct qwiic_jsk *priv = input_get_drvdata(input); 48 + struct qwiic_data data; 49 + int err; 50 + 51 + err = i2c_smbus_read_i2c_block_data(priv->client, QWIIC_JSK_REG_DATA, 52 + sizeof(data), (u8 *)&data); 53 + if (err != sizeof(data)) 54 + return; 55 + 56 + input_report_abs(input, ABS_X, be16_to_cpu(data.x) >> 6); 57 + input_report_abs(input, ABS_Y, be16_to_cpu(data.y) >> 6); 58 + input_report_key(input, BTN_THUMBL, !data.thumb); 59 + input_sync(input); 60 + } 61 + 62 + static int qwiic_probe(struct i2c_client *client) 63 + { 64 + struct qwiic_jsk *priv; 65 + struct qwiic_ver vers; 66 + int err; 67 + 68 + err = i2c_smbus_read_i2c_block_data(client, QWIIC_JSK_REG_VERS, 69 + sizeof(vers), (u8 *)&vers); 70 + if (err < 0) 71 + return err; 72 + if (err != sizeof(vers)) 73 + return -EIO; 74 + 75 + dev_dbg(&client->dev, "SparkFun Qwiic Joystick, FW: %u.%u\n", 76 + vers.major, vers.minor); 77 + 78 + priv = devm_kzalloc(&client->dev, sizeof(*priv), GFP_KERNEL); 79 + if (!priv) 80 + return -ENOMEM; 81 + 82 + priv->client = client; 83 + snprintf(priv->phys, sizeof(priv->phys), 84 + "i2c/%s", dev_name(&client->dev)); 85 + i2c_set_clientdata(client, priv); 86 + 87 + priv->dev = devm_input_allocate_device(&client->dev); 88 + if (!priv->dev) 89 + return -ENOMEM; 90 + 91 + priv->dev->id.bustype = BUS_I2C; 92 + priv->dev->name = "SparkFun Qwiic Joystick"; 93 + priv->dev->phys = priv->phys; 94 + input_set_drvdata(priv->dev, priv); 95 + 96 + input_set_abs_params(priv->dev, ABS_X, 0, QWIIC_JSK_MAX_AXIS, 97 + QWIIC_JSK_FUZZ, QWIIC_JSK_FLAT); 98 + input_set_abs_params(priv->dev, ABS_Y, 0, QWIIC_JSK_MAX_AXIS, 99 + QWIIC_JSK_FUZZ, QWIIC_JSK_FLAT); 100 + input_set_capability(priv->dev, EV_KEY, BTN_THUMBL); 101 + 102 + err = input_setup_polling(priv->dev, qwiic_poll); 103 + if (err) { 104 + dev_err(&client->dev, "failed to set up polling: %d\n", err); 105 + return err; 106 + } 107 + input_set_poll_interval(priv->dev, QWIIC_JSK_POLL_INTERVAL); 108 + input_set_min_poll_interval(priv->dev, QWIIC_JSK_POLL_MIN); 109 + input_set_max_poll_interval(priv->dev, QWIIC_JSK_POLL_MAX); 110 + 111 + err = input_register_device(priv->dev); 112 + if (err) { 113 + dev_err(&client->dev, "failed to register joystick: %d\n", err); 114 + return err; 115 + } 116 + 117 + return 0; 118 + } 119 + 120 + #ifdef CONFIG_OF 121 + static const struct of_device_id of_qwiic_match[] = { 122 + { .compatible = "sparkfun,qwiic-joystick", }, 123 + { }, 124 + }; 125 + MODULE_DEVICE_TABLE(of, of_qwiic_match); 126 + #endif /* CONFIG_OF */ 127 + 128 + static const struct i2c_device_id qwiic_id_table[] = { 129 + { KBUILD_MODNAME, 0 }, 130 + { }, 131 + }; 132 + MODULE_DEVICE_TABLE(i2c, qwiic_id_table); 133 + 134 + static struct i2c_driver qwiic_driver = { 135 + .driver = { 136 + .name = DRV_NAME, 137 + .of_match_table = of_match_ptr(of_qwiic_match), 138 + }, 139 + .id_table = qwiic_id_table, 140 + .probe_new = qwiic_probe, 141 + }; 142 + module_i2c_driver(qwiic_driver); 143 + 144 + MODULE_AUTHOR("Oleh Kravchenko <oleg@kaa.org.ua>"); 145 + MODULE_DESCRIPTION("SparkFun Qwiic Joystick driver"); 146 + MODULE_LICENSE("GPL v2");
+6
drivers/input/joystick/xpad.c
··· 79 79 #define MAP_DPAD_TO_BUTTONS (1 << 0) 80 80 #define MAP_TRIGGERS_TO_BUTTONS (1 << 1) 81 81 #define MAP_STICKS_TO_NULL (1 << 2) 82 + #define MAP_SELECT_BUTTON (1 << 3) 82 83 #define DANCEPAD_MAP_CONFIG (MAP_DPAD_TO_BUTTONS | \ 83 84 MAP_TRIGGERS_TO_BUTTONS | MAP_STICKS_TO_NULL) 84 85 ··· 131 130 { 0x045e, 0x02e3, "Microsoft X-Box One Elite pad", 0, XTYPE_XBOXONE }, 132 131 { 0x045e, 0x02ea, "Microsoft X-Box One S pad", 0, XTYPE_XBOXONE }, 133 132 { 0x045e, 0x0719, "Xbox 360 Wireless Receiver", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360W }, 133 + { 0x045e, 0x0b12, "Microsoft Xbox One X pad", MAP_SELECT_BUTTON, XTYPE_XBOXONE }, 134 134 { 0x046d, 0xc21d, "Logitech Gamepad F310", 0, XTYPE_XBOX360 }, 135 135 { 0x046d, 0xc21e, "Logitech Gamepad F510", 0, XTYPE_XBOX360 }, 136 136 { 0x046d, 0xc21f, "Logitech Gamepad F710", 0, XTYPE_XBOX360 }, ··· 866 864 /* menu/view buttons */ 867 865 input_report_key(dev, BTN_START, data[4] & 0x04); 868 866 input_report_key(dev, BTN_SELECT, data[4] & 0x08); 867 + if (xpad->mapping & MAP_SELECT_BUTTON) 868 + input_report_key(dev, KEY_RECORD, data[22] & 0x01); 869 869 870 870 /* buttons A,B,X,Y */ 871 871 input_report_key(dev, BTN_A, data[4] & 0x10); ··· 1678 1674 xpad->xtype == XTYPE_XBOXONE) { 1679 1675 for (i = 0; xpad360_btn[i] >= 0; i++) 1680 1676 input_set_capability(input_dev, EV_KEY, xpad360_btn[i]); 1677 + if (xpad->mapping & MAP_SELECT_BUTTON) 1678 + input_set_capability(input_dev, EV_KEY, KEY_RECORD); 1681 1679 } else { 1682 1680 for (i = 0; xpad_btn[i] >= 0; i++) 1683 1681 input_set_capability(input_dev, EV_KEY, xpad_btn[i]);
+1 -1
drivers/input/keyboard/atkbd.c
··· 324 324 static umode_t atkbd_attr_is_visible(struct kobject *kobj, 325 325 struct attribute *attr, int i) 326 326 { 327 - struct device *dev = container_of(kobj, struct device, kobj); 327 + struct device *dev = kobj_to_dev(kobj); 328 328 struct serio *serio = to_serio_port(dev); 329 329 struct atkbd *atkbd = serio_get_drvdata(serio); 330 330
+1 -1
drivers/input/keyboard/cros_ec_keyb.c
··· 644 644 struct attribute *attr, 645 645 int n) 646 646 { 647 - struct device *dev = container_of(kobj, struct device, kobj); 647 + struct device *dev = kobj_to_dev(kobj); 648 648 struct cros_ec_keyb *ckdev = dev_get_drvdata(dev); 649 649 650 650 if (attr == &dev_attr_function_row_physmap.attr &&
+1
drivers/input/keyboard/hil_kbd.c
··· 512 512 HIL_IDD_NUM_AXES_PER_SET(*idd)) { 513 513 printk(KERN_INFO PREFIX 514 514 "combo devices are not supported.\n"); 515 + error = -EINVAL; 515 516 goto bail1; 516 517 } 517 518
+3 -3
drivers/input/misc/ims-pcu.c
··· 647 647 #define IMS_PCU_BL_DATA_OFFSET 3 648 648 649 649 static int __ims_pcu_execute_bl_command(struct ims_pcu *pcu, 650 - u8 command, const void *data, size_t len, 651 - u8 expected_response, int response_time) 650 + u8 command, const void *data, size_t len, 651 + u8 expected_response, int response_time) 652 652 { 653 653 int error; 654 654 ··· 1228 1228 static umode_t ims_pcu_is_attr_visible(struct kobject *kobj, 1229 1229 struct attribute *attr, int n) 1230 1230 { 1231 - struct device *dev = container_of(kobj, struct device, kobj); 1231 + struct device *dev = kobj_to_dev(kobj); 1232 1232 struct usb_interface *intf = to_usb_interface(dev); 1233 1233 struct ims_pcu *pcu = usb_get_intfdata(intf); 1234 1234 umode_t mode = attr->mode;
+70 -29
drivers/input/misc/pm8941-pwrkey.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0-only 2 2 /* 3 - * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 3 + * Copyright (c) 2010-2011, 2020-2021, The Linux Foundation. All rights reserved. 4 4 * Copyright (c) 2014, Sony Mobile Communications Inc. 5 5 */ 6 6 ··· 22 22 #define PON_RT_STS 0x10 23 23 #define PON_KPDPWR_N_SET BIT(0) 24 24 #define PON_RESIN_N_SET BIT(1) 25 + #define PON_GEN3_RESIN_N_SET BIT(6) 26 + #define PON_GEN3_KPDPWR_N_SET BIT(7) 25 27 26 28 #define PON_PS_HOLD_RST_CTL 0x5a 27 29 #define PON_PS_HOLD_RST_CTL2 0x5b ··· 40 38 #define PON_DBC_DELAY_MASK 0x7 41 39 42 40 struct pm8941_data { 43 - unsigned int pull_up_bit; 44 - unsigned int status_bit; 41 + unsigned int pull_up_bit; 42 + unsigned int status_bit; 43 + bool supports_ps_hold_poff_config; 44 + bool supports_debounce_config; 45 + const char *name; 46 + const char *phys; 45 47 }; 46 48 47 49 struct pm8941_pwrkey { ··· 237 231 238 232 input_set_capability(pwrkey->input, EV_KEY, pwrkey->code); 239 233 240 - pwrkey->input->name = "pm8941_pwrkey"; 241 - pwrkey->input->phys = "pm8941_pwrkey/input0"; 234 + pwrkey->input->name = pwrkey->data->name; 235 + pwrkey->input->phys = pwrkey->data->phys; 242 236 243 - req_delay = (req_delay << 6) / USEC_PER_SEC; 244 - req_delay = ilog2(req_delay); 237 + if (pwrkey->data->supports_debounce_config) { 238 + req_delay = (req_delay << 6) / USEC_PER_SEC; 239 + req_delay = ilog2(req_delay); 245 240 246 - error = regmap_update_bits(pwrkey->regmap, 247 - pwrkey->baseaddr + PON_DBC_CTL, 248 - PON_DBC_DELAY_MASK, 249 - req_delay); 250 - if (error) { 251 - dev_err(&pdev->dev, "failed to set debounce: %d\n", error); 252 - return error; 241 + error = regmap_update_bits(pwrkey->regmap, 242 + pwrkey->baseaddr + PON_DBC_CTL, 243 + PON_DBC_DELAY_MASK, 244 + req_delay); 245 + if (error) { 246 + dev_err(&pdev->dev, "failed to set debounce: %d\n", 247 + error); 248 + return error; 249 + } 253 250 } 254 251 255 - error = regmap_update_bits(pwrkey->regmap, 256 - pwrkey->baseaddr + PON_PULL_CTL, 257 - pwrkey->data->pull_up_bit, 258 - pull_up ? pwrkey->data->pull_up_bit : 0); 259 - if (error) { 260 - dev_err(&pdev->dev, "failed to set pull: %d\n", error); 261 - return error; 252 + if (pwrkey->data->pull_up_bit) { 253 + error = regmap_update_bits(pwrkey->regmap, 254 + pwrkey->baseaddr + PON_PULL_CTL, 255 + pwrkey->data->pull_up_bit, 256 + pull_up ? pwrkey->data->pull_up_bit : 257 + 0); 258 + if (error) { 259 + dev_err(&pdev->dev, "failed to set pull: %d\n", error); 260 + return error; 261 + } 262 262 } 263 263 264 264 error = devm_request_threaded_irq(&pdev->dev, pwrkey->irq, 265 265 NULL, pm8941_pwrkey_irq, 266 266 IRQF_ONESHOT, 267 - "pm8941_pwrkey", pwrkey); 267 + pwrkey->data->name, pwrkey); 268 268 if (error) { 269 269 dev_err(&pdev->dev, "failed requesting IRQ: %d\n", error); 270 270 return error; ··· 283 271 return error; 284 272 } 285 273 286 - pwrkey->reboot_notifier.notifier_call = pm8941_reboot_notify, 287 - error = register_reboot_notifier(&pwrkey->reboot_notifier); 288 - if (error) { 289 - dev_err(&pdev->dev, "failed to register reboot notifier: %d\n", 290 - error); 291 - return error; 274 + if (pwrkey->data->supports_ps_hold_poff_config) { 275 + pwrkey->reboot_notifier.notifier_call = pm8941_reboot_notify, 276 + error = register_reboot_notifier(&pwrkey->reboot_notifier); 277 + if (error) { 278 + dev_err(&pdev->dev, "failed to register reboot notifier: %d\n", 279 + error); 280 + return error; 281 + } 292 282 } 293 283 294 284 platform_set_drvdata(pdev, pwrkey); ··· 303 289 { 304 290 struct pm8941_pwrkey *pwrkey = platform_get_drvdata(pdev); 305 291 306 - unregister_reboot_notifier(&pwrkey->reboot_notifier); 292 + if (pwrkey->data->supports_ps_hold_poff_config) 293 + unregister_reboot_notifier(&pwrkey->reboot_notifier); 307 294 308 295 return 0; 309 296 } ··· 312 297 static const struct pm8941_data pwrkey_data = { 313 298 .pull_up_bit = PON_KPDPWR_PULL_UP, 314 299 .status_bit = PON_KPDPWR_N_SET, 300 + .name = "pm8941_pwrkey", 301 + .phys = "pm8941_pwrkey/input0", 302 + .supports_ps_hold_poff_config = true, 303 + .supports_debounce_config = true, 315 304 }; 316 305 317 306 static const struct pm8941_data resin_data = { 318 307 .pull_up_bit = PON_RESIN_PULL_UP, 319 308 .status_bit = PON_RESIN_N_SET, 309 + .name = "pm8941_resin", 310 + .phys = "pm8941_resin/input0", 311 + .supports_ps_hold_poff_config = true, 312 + .supports_debounce_config = true, 313 + }; 314 + 315 + static const struct pm8941_data pon_gen3_pwrkey_data = { 316 + .status_bit = PON_GEN3_KPDPWR_N_SET, 317 + .name = "pmic_pwrkey", 318 + .phys = "pmic_pwrkey/input0", 319 + .supports_ps_hold_poff_config = false, 320 + .supports_debounce_config = false, 321 + }; 322 + 323 + static const struct pm8941_data pon_gen3_resin_data = { 324 + .status_bit = PON_GEN3_RESIN_N_SET, 325 + .name = "pmic_resin", 326 + .phys = "pmic_resin/input0", 327 + .supports_ps_hold_poff_config = false, 328 + .supports_debounce_config = false, 320 329 }; 321 330 322 331 static const struct of_device_id pm8941_pwr_key_id_table[] = { 323 332 { .compatible = "qcom,pm8941-pwrkey", .data = &pwrkey_data }, 324 333 { .compatible = "qcom,pm8941-resin", .data = &resin_data }, 334 + { .compatible = "qcom,pmk8350-pwrkey", .data = &pon_gen3_pwrkey_data }, 335 + { .compatible = "qcom,pmk8350-resin", .data = &pon_gen3_resin_data }, 325 336 { } 326 337 }; 327 338 MODULE_DEVICE_TABLE(of, pm8941_pwr_key_id_table);
+1 -1
drivers/input/mouse/trackpoint.c
··· 214 214 static umode_t trackpoint_is_attr_visible(struct kobject *kobj, 215 215 struct attribute *attr, int n) 216 216 { 217 - struct device *dev = container_of(kobj, struct device, kobj); 217 + struct device *dev = kobj_to_dev(kobj); 218 218 struct serio *serio = to_serio_port(dev); 219 219 struct psmouse *psmouse = serio_get_drvdata(serio); 220 220
+2 -2
drivers/input/serio/i8042.c
··· 139 139 /* 140 140 * Writers to AUX and KBD ports as well as users issuing i8042_command 141 141 * directly should acquire i8042_mutex (by means of calling 142 - * i8042_lock_chip() and i8042_unlock_ship() helpers) to ensure that 142 + * i8042_lock_chip() and i8042_unlock_chip() helpers) to ensure that 143 143 * they do not disturb each other (unfortunately in many i8042 144 144 * implementations write to one of the ports will immediately abort 145 145 * command that is being processed by another port). ··· 979 979 } 980 980 981 981 /* 982 - * i8042_controller init initializes the i8042 controller, and, 982 + * i8042_controller_init initializes the i8042 controller, and, 983 983 * most importantly, sets it into non-xlated mode if that's 984 984 * desired. 985 985 */
+54 -115
drivers/input/touchscreen/cy8ctmg110_ts.c
··· 7 7 * Some cleanups by Alan Cox <alan@linux.intel.com> 8 8 */ 9 9 10 - #include <linux/module.h> 11 - #include <linux/kernel.h> 12 - #include <linux/input.h> 13 - #include <linux/slab.h> 14 - #include <linux/interrupt.h> 15 - #include <linux/io.h> 16 10 #include <linux/i2c.h> 17 - #include <linux/gpio.h> 18 - #include <linux/input/cy8ctmg110_pdata.h> 11 + #include <linux/input.h> 12 + #include <linux/interrupt.h> 13 + #include <linux/gpio/consumer.h> 14 + #include <linux/kernel.h> 15 + #include <linux/module.h> 16 + #include <linux/slab.h> 17 + #include <asm/byteorder.h> 19 18 20 19 #define CY8CTMG110_DRIVER_NAME "cy8ctmg110" 21 20 ··· 44 45 struct input_dev *input; 45 46 char phys[32]; 46 47 struct i2c_client *client; 47 - int reset_pin; 48 - int irq_pin; 48 + struct gpio_desc *reset_gpio; 49 49 }; 50 50 51 51 /* 52 52 * cy8ctmg110_power is the routine that is called when touch hardware 53 - * will powered off or on. 53 + * is being powered off or on. When powering on this routine de-asserts 54 + * the RESET line, when powering off reset line is asserted. 54 55 */ 55 56 static void cy8ctmg110_power(struct cy8ctmg110 *ts, bool poweron) 56 57 { 57 - if (ts->reset_pin) 58 - gpio_direction_output(ts->reset_pin, 1 - poweron); 58 + if (ts->reset_gpio) 59 + gpiod_set_value_cansleep(ts->reset_gpio, !poweron); 59 60 } 60 61 61 62 static int cy8ctmg110_write_regs(struct cy8ctmg110 *tsc, unsigned char reg, ··· 111 112 { 112 113 struct input_dev *input = tsc->input; 113 114 unsigned char reg_p[CY8CTMG110_REG_MAX]; 114 - int x, y; 115 115 116 116 memset(reg_p, 0, CY8CTMG110_REG_MAX); 117 117 ··· 118 120 if (cy8ctmg110_read_regs(tsc, reg_p, 9, CY8CTMG110_TOUCH_X1) != 0) 119 121 return -EIO; 120 122 121 - y = reg_p[2] << 8 | reg_p[3]; 122 - x = reg_p[0] << 8 | reg_p[1]; 123 - 124 123 /* Number of touch */ 125 124 if (reg_p[8] == 0) { 126 125 input_report_key(input, BTN_TOUCH, 0); 127 126 } else { 128 127 input_report_key(input, BTN_TOUCH, 1); 129 - input_report_abs(input, ABS_X, x); 130 - input_report_abs(input, ABS_Y, y); 128 + input_report_abs(input, ABS_X, 129 + be16_to_cpup((__be16 *)(reg_p + 0))); 130 + input_report_abs(input, ABS_Y, 131 + be16_to_cpup((__be16 *)(reg_p + 2))); 131 132 } 132 133 133 134 input_sync(input); ··· 160 163 return IRQ_HANDLED; 161 164 } 162 165 166 + static void cy8ctmg110_shut_off(void *_ts) 167 + { 168 + struct cy8ctmg110 *ts = _ts; 169 + 170 + cy8ctmg110_set_sleepmode(ts, true); 171 + cy8ctmg110_power(ts, false); 172 + } 173 + 163 174 static int cy8ctmg110_probe(struct i2c_client *client, 164 175 const struct i2c_device_id *id) 165 176 { 166 - const struct cy8ctmg110_pdata *pdata = dev_get_platdata(&client->dev); 167 177 struct cy8ctmg110 *ts; 168 178 struct input_dev *input_dev; 169 179 int err; 170 - 171 - /* No pdata no way forward */ 172 - if (pdata == NULL) { 173 - dev_err(&client->dev, "no pdata\n"); 174 - return -ENODEV; 175 - } 176 180 177 181 if (!i2c_check_functionality(client->adapter, 178 182 I2C_FUNC_SMBUS_READ_WORD_DATA)) 179 183 return -EIO; 180 184 181 - ts = kzalloc(sizeof(struct cy8ctmg110), GFP_KERNEL); 182 - input_dev = input_allocate_device(); 183 - if (!ts || !input_dev) { 184 - err = -ENOMEM; 185 - goto err_free_mem; 186 - } 185 + ts = devm_kzalloc(&client->dev, sizeof(*ts), GFP_KERNEL); 186 + if (!ts) 187 + return -ENOMEM; 188 + 189 + input_dev = devm_input_allocate_device(&client->dev); 190 + if (!input_dev) 191 + return -ENOMEM; 187 192 188 193 ts->client = client; 189 194 ts->input = input_dev; 190 - ts->reset_pin = pdata->reset_pin; 191 - ts->irq_pin = pdata->irq_pin; 192 195 193 196 snprintf(ts->phys, sizeof(ts->phys), 194 197 "%s/input0", dev_name(&client->dev)); ··· 196 199 input_dev->name = CY8CTMG110_DRIVER_NAME " Touchscreen"; 197 200 input_dev->phys = ts->phys; 198 201 input_dev->id.bustype = BUS_I2C; 199 - input_dev->dev.parent = &client->dev; 200 202 201 - input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); 202 - input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH); 203 - 203 + input_set_capability(input_dev, EV_KEY, BTN_TOUCH); 204 204 input_set_abs_params(input_dev, ABS_X, 205 205 CY8CTMG110_X_MIN, CY8CTMG110_X_MAX, 4, 0); 206 206 input_set_abs_params(input_dev, ABS_Y, 207 207 CY8CTMG110_Y_MIN, CY8CTMG110_Y_MAX, 4, 0); 208 208 209 - if (ts->reset_pin) { 210 - err = gpio_request(ts->reset_pin, NULL); 211 - if (err) { 212 - dev_err(&client->dev, 213 - "Unable to request GPIO pin %d.\n", 214 - ts->reset_pin); 215 - goto err_free_mem; 216 - } 209 + /* Request and assert reset line */ 210 + ts->reset_gpio = devm_gpiod_get_optional(&client->dev, NULL, 211 + GPIOD_OUT_HIGH); 212 + if (IS_ERR(ts->reset_gpio)) { 213 + err = PTR_ERR(ts->reset_gpio); 214 + dev_err(&client->dev, 215 + "Unable to request reset GPIO: %d\n", err); 216 + return err; 217 217 } 218 218 219 219 cy8ctmg110_power(ts, true); 220 220 cy8ctmg110_set_sleepmode(ts, false); 221 221 222 - err = gpio_request(ts->irq_pin, "touch_irq_key"); 223 - if (err < 0) { 224 - dev_err(&client->dev, 225 - "Failed to request GPIO %d, error %d\n", 226 - ts->irq_pin, err); 227 - goto err_shutoff_device; 228 - } 222 + err = devm_add_action_or_reset(&client->dev, cy8ctmg110_shut_off, ts); 223 + if (err) 224 + return err; 229 225 230 - err = gpio_direction_input(ts->irq_pin); 231 - if (err < 0) { 232 - dev_err(&client->dev, 233 - "Failed to configure input direction for GPIO %d, error %d\n", 234 - ts->irq_pin, err); 235 - goto err_free_irq_gpio; 236 - } 237 - 238 - client->irq = gpio_to_irq(ts->irq_pin); 239 - if (client->irq < 0) { 240 - err = client->irq; 241 - dev_err(&client->dev, 242 - "Unable to get irq number for GPIO %d, error %d\n", 243 - ts->irq_pin, err); 244 - goto err_free_irq_gpio; 245 - } 246 - 247 - err = request_threaded_irq(client->irq, NULL, cy8ctmg110_irq_thread, 248 - IRQF_TRIGGER_RISING | IRQF_ONESHOT, 249 - "touch_reset_key", ts); 250 - if (err < 0) { 226 + err = devm_request_threaded_irq(&client->dev, client->irq, 227 + NULL, cy8ctmg110_irq_thread, 228 + IRQF_ONESHOT, "touch_reset_key", ts); 229 + if (err) { 251 230 dev_err(&client->dev, 252 231 "irq %d busy? error %d\n", client->irq, err); 253 - goto err_free_irq_gpio; 232 + return err; 254 233 } 255 234 256 235 err = input_register_device(input_dev); 257 236 if (err) 258 - goto err_free_irq; 237 + return err; 259 238 260 239 i2c_set_clientdata(client, ts); 261 - device_init_wakeup(&client->dev, 1); 262 - return 0; 263 240 264 - err_free_irq: 265 - free_irq(client->irq, ts); 266 - err_free_irq_gpio: 267 - gpio_free(ts->irq_pin); 268 - err_shutoff_device: 269 - cy8ctmg110_set_sleepmode(ts, true); 270 - cy8ctmg110_power(ts, false); 271 - if (ts->reset_pin) 272 - gpio_free(ts->reset_pin); 273 - err_free_mem: 274 - input_free_device(input_dev); 275 - kfree(ts); 276 - return err; 241 + return 0; 277 242 } 278 243 279 244 static int __maybe_unused cy8ctmg110_suspend(struct device *dev) ··· 243 284 struct i2c_client *client = to_i2c_client(dev); 244 285 struct cy8ctmg110 *ts = i2c_get_clientdata(client); 245 286 246 - if (device_may_wakeup(&client->dev)) 247 - enable_irq_wake(client->irq); 248 - else { 287 + if (!device_may_wakeup(&client->dev)) { 249 288 cy8ctmg110_set_sleepmode(ts, true); 250 289 cy8ctmg110_power(ts, false); 251 290 } 291 + 252 292 return 0; 253 293 } 254 294 ··· 256 298 struct i2c_client *client = to_i2c_client(dev); 257 299 struct cy8ctmg110 *ts = i2c_get_clientdata(client); 258 300 259 - if (device_may_wakeup(&client->dev)) 260 - disable_irq_wake(client->irq); 261 - else { 301 + if (!device_may_wakeup(&client->dev)) { 262 302 cy8ctmg110_power(ts, true); 263 303 cy8ctmg110_set_sleepmode(ts, false); 264 304 } 305 + 265 306 return 0; 266 307 } 267 308 268 309 static SIMPLE_DEV_PM_OPS(cy8ctmg110_pm, cy8ctmg110_suspend, cy8ctmg110_resume); 269 - 270 - static int cy8ctmg110_remove(struct i2c_client *client) 271 - { 272 - struct cy8ctmg110 *ts = i2c_get_clientdata(client); 273 - 274 - cy8ctmg110_set_sleepmode(ts, true); 275 - cy8ctmg110_power(ts, false); 276 - 277 - free_irq(client->irq, ts); 278 - input_unregister_device(ts->input); 279 - gpio_free(ts->irq_pin); 280 - if (ts->reset_pin) 281 - gpio_free(ts->reset_pin); 282 - kfree(ts); 283 - 284 - return 0; 285 - } 286 310 287 311 static const struct i2c_device_id cy8ctmg110_idtable[] = { 288 312 { CY8CTMG110_DRIVER_NAME, 1 }, ··· 280 340 }, 281 341 .id_table = cy8ctmg110_idtable, 282 342 .probe = cy8ctmg110_probe, 283 - .remove = cy8ctmg110_remove, 284 343 }; 285 344 286 345 module_i2c_driver(cy8ctmg110_driver);
+44 -3
drivers/input/touchscreen/cyttsp_core.c
··· 22 22 #include <linux/slab.h> 23 23 #include <linux/property.h> 24 24 #include <linux/gpio/consumer.h> 25 + #include <linux/regulator/consumer.h> 25 26 26 27 #include "cyttsp_core.h" 27 28 ··· 46 45 #define CY_MAXZ 255 47 46 #define CY_DELAY_DFLT 20 /* ms */ 48 47 #define CY_DELAY_MAX 500 49 - #define CY_ACT_DIST_DFLT 0xF8 48 + /* Active distance in pixels for a gesture to be reported */ 49 + #define CY_ACT_DIST_DFLT 0xF8 /* pixels */ 50 50 #define CY_ACT_DIST_MASK 0x0F 51 + /* Active Power state scanning/processing refresh interval */ 52 + #define CY_ACT_INTRVL_DFLT 0x00 /* ms */ 53 + /* Low Power state scanning/processing refresh interval */ 54 + #define CY_LP_INTRVL_DFLT 0x0A /* ms */ 55 + /* touch timeout for the Active power */ 56 + #define CY_TCH_TMOUT_DFLT 0xFF /* ms */ 51 57 #define CY_HNDSHK_BIT 0x80 52 58 /* device mode bits */ 53 59 #define CY_OPERATE_MODE 0x00 ··· 616 608 return 0; 617 609 } 618 610 611 + static void cyttsp_disable_regulators(void *_ts) 612 + { 613 + struct cyttsp *ts = _ts; 614 + 615 + regulator_bulk_disable(ARRAY_SIZE(ts->regulators), 616 + ts->regulators); 617 + } 618 + 619 619 struct cyttsp *cyttsp_probe(const struct cyttsp_bus_ops *bus_ops, 620 620 struct device *dev, int irq, size_t xfer_buf_size) 621 621 { ··· 643 627 ts->input = input_dev; 644 628 ts->bus_ops = bus_ops; 645 629 ts->irq = irq; 630 + 631 + /* 632 + * VCPIN is the analog voltage supply 633 + * VDD is the digital voltage supply 634 + */ 635 + ts->regulators[0].supply = "vcpin"; 636 + ts->regulators[1].supply = "vdd"; 637 + error = devm_regulator_bulk_get(dev, ARRAY_SIZE(ts->regulators), 638 + ts->regulators); 639 + if (error) { 640 + dev_err(dev, "Failed to get regulators: %d\n", error); 641 + return ERR_PTR(error); 642 + } 643 + 644 + error = regulator_bulk_enable(ARRAY_SIZE(ts->regulators), 645 + ts->regulators); 646 + if (error) { 647 + dev_err(dev, "Cannot enable regulators: %d\n", error); 648 + return ERR_PTR(error); 649 + } 650 + 651 + error = devm_add_action_or_reset(dev, cyttsp_disable_regulators, ts); 652 + if (error) { 653 + dev_err(dev, "failed to install chip disable handler\n"); 654 + return ERR_PTR(error); 655 + } 646 656 647 657 ts->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW); 648 658 if (IS_ERR(ts->reset_gpio)) { ··· 706 664 } 707 665 708 666 error = devm_request_threaded_irq(dev, ts->irq, NULL, cyttsp_irq, 709 - IRQF_TRIGGER_FALLING | IRQF_ONESHOT | 710 - IRQF_NO_AUTOEN, 667 + IRQF_ONESHOT | IRQF_NO_AUTOEN, 711 668 "cyttsp", ts); 712 669 if (error) { 713 670 dev_err(ts->dev, "failed to request IRQ %d, err: %d\n",
+2 -1
drivers/input/touchscreen/cyttsp_core.h
··· 22 22 #include <linux/module.h> 23 23 #include <linux/types.h> 24 24 #include <linux/device.h> 25 - #include <linux/input/cyttsp.h> 25 + #include <linux/regulator/consumer.h> 26 26 27 27 #define CY_NUM_RETRY 16 /* max number of retries for read ops */ 28 28 ··· 122 122 enum cyttsp_state state; 123 123 bool suspended; 124 124 125 + struct regulator_bulk_data regulators[2]; 125 126 struct gpio_desc *reset_gpio; 126 127 bool use_hndshk; 127 128 u8 act_dist;
+10
drivers/input/touchscreen/cyttsp_i2c.c
··· 18 18 #include <linux/i2c.h> 19 19 #include <linux/input.h> 20 20 21 + #define CY_I2C_NAME "cyttsp-i2c" 22 + 21 23 #define CY_I2C_DATA_SIZE 128 22 24 23 25 static const struct cyttsp_bus_ops cyttsp_i2c_bus_ops = { ··· 54 52 }; 55 53 MODULE_DEVICE_TABLE(i2c, cyttsp_i2c_id); 56 54 55 + static const struct of_device_id cyttsp_of_i2c_match[] = { 56 + { .compatible = "cypress,cy8ctma340", }, 57 + { .compatible = "cypress,cy8ctst341", }, 58 + { /* sentinel */ } 59 + }; 60 + MODULE_DEVICE_TABLE(of, cyttsp_of_i2c_match); 61 + 57 62 static struct i2c_driver cyttsp_i2c_driver = { 58 63 .driver = { 59 64 .name = CY_I2C_NAME, 60 65 .pm = &cyttsp_pm_ops, 66 + .of_match_table = cyttsp_of_i2c_match, 61 67 }, 62 68 .probe = cyttsp_i2c_probe, 63 69 .id_table = cyttsp_i2c_id,
+10
drivers/input/touchscreen/cyttsp_spi.c
··· 20 20 #include <linux/input.h> 21 21 #include <linux/spi/spi.h> 22 22 23 + #define CY_SPI_NAME "cyttsp-spi" 24 + 23 25 #define CY_SPI_WR_OP 0x00 /* r/~w */ 24 26 #define CY_SPI_RD_OP 0x01 25 27 #define CY_SPI_CMD_BYTES 4 ··· 162 160 return 0; 163 161 } 164 162 163 + static const struct of_device_id cyttsp_of_spi_match[] = { 164 + { .compatible = "cypress,cy8ctma340", }, 165 + { .compatible = "cypress,cy8ctst341", }, 166 + { /* sentinel */ } 167 + }; 168 + MODULE_DEVICE_TABLE(of, cyttsp_of_spi_match); 169 + 165 170 static struct spi_driver cyttsp_spi_driver = { 166 171 .driver = { 167 172 .name = CY_SPI_NAME, 168 173 .pm = &cyttsp_pm_ops, 174 + .of_match_table = cyttsp_of_spi_match, 169 175 }, 170 176 .probe = cyttsp_spi_probe, 171 177 };
+36 -2
drivers/input/touchscreen/edt-ft5x06.c
··· 104 104 u16 num_x; 105 105 u16 num_y; 106 106 struct regulator *vcc; 107 + struct regulator *iovcc; 107 108 108 109 struct gpio_desc *reset_gpio; 109 110 struct gpio_desc *wake_gpio; ··· 1063 1062 } 1064 1063 } 1065 1064 1066 - static void edt_ft5x06_disable_regulator(void *arg) 1065 + static void edt_ft5x06_disable_regulators(void *arg) 1067 1066 { 1068 1067 struct edt_ft5x06_ts_data *data = arg; 1069 1068 1070 1069 regulator_disable(data->vcc); 1070 + regulator_disable(data->iovcc); 1071 1071 } 1072 1072 1073 1073 static int edt_ft5x06_ts_probe(struct i2c_client *client, ··· 1109 1107 return error; 1110 1108 } 1111 1109 1110 + tsdata->iovcc = devm_regulator_get(&client->dev, "iovcc"); 1111 + if (IS_ERR(tsdata->iovcc)) { 1112 + error = PTR_ERR(tsdata->iovcc); 1113 + if (error != -EPROBE_DEFER) 1114 + dev_err(&client->dev, 1115 + "failed to request iovcc regulator: %d\n", error); 1116 + return error; 1117 + } 1118 + 1119 + error = regulator_enable(tsdata->iovcc); 1120 + if (error < 0) { 1121 + dev_err(&client->dev, "failed to enable iovcc: %d\n", error); 1122 + return error; 1123 + } 1124 + 1125 + /* Delay enabling VCC for > 10us (T_ivd) after IOVCC */ 1126 + usleep_range(10, 100); 1127 + 1112 1128 error = regulator_enable(tsdata->vcc); 1113 1129 if (error < 0) { 1114 1130 dev_err(&client->dev, "failed to enable vcc: %d\n", error); 1131 + regulator_disable(tsdata->iovcc); 1115 1132 return error; 1116 1133 } 1117 1134 1118 1135 error = devm_add_action_or_reset(&client->dev, 1119 - edt_ft5x06_disable_regulator, 1136 + edt_ft5x06_disable_regulators, 1120 1137 tsdata); 1121 1138 if (error) 1122 1139 return error; ··· 1310 1289 ret = regulator_disable(tsdata->vcc); 1311 1290 if (ret) 1312 1291 dev_warn(dev, "Failed to disable vcc\n"); 1292 + ret = regulator_disable(tsdata->iovcc); 1293 + if (ret) 1294 + dev_warn(dev, "Failed to disable iovcc\n"); 1313 1295 1314 1296 return 0; 1315 1297 } ··· 1343 1319 gpiod_set_value_cansleep(reset_gpio, 1); 1344 1320 usleep_range(5000, 6000); 1345 1321 1322 + ret = regulator_enable(tsdata->iovcc); 1323 + if (ret) { 1324 + dev_err(dev, "Failed to enable iovcc\n"); 1325 + return ret; 1326 + } 1327 + 1328 + /* Delay enabling VCC for > 10us (T_ivd) after IOVCC */ 1329 + usleep_range(10, 100); 1330 + 1346 1331 ret = regulator_enable(tsdata->vcc); 1347 1332 if (ret) { 1348 1333 dev_err(dev, "Failed to enable vcc\n"); 1334 + regulator_disable(tsdata->iovcc); 1349 1335 return ret; 1350 1336 } 1351 1337
+5 -6
drivers/input/touchscreen/elants_i2c.c
··· 1369 1369 } 1370 1370 #endif 1371 1371 1372 - static int elants_i2c_probe(struct i2c_client *client, 1373 - const struct i2c_device_id *id) 1372 + static int elants_i2c_probe(struct i2c_client *client) 1374 1373 { 1375 1374 union i2c_smbus_data dummy; 1376 1375 struct elants_data *ts; ··· 1395 1396 init_completion(&ts->cmd_done); 1396 1397 1397 1398 ts->client = client; 1398 - ts->chip_id = (enum elants_chip_id)id->driver_data; 1399 + ts->chip_id = (enum elants_chip_id)(uintptr_t)device_get_match_data(&client->dev); 1399 1400 i2c_set_clientdata(client, ts); 1400 1401 1401 1402 ts->vcc33 = devm_regulator_get(&client->dev, "vcc33"); ··· 1635 1636 1636 1637 #ifdef CONFIG_OF 1637 1638 static const struct of_device_id elants_of_match[] = { 1638 - { .compatible = "elan,ekth3500" }, 1639 - { .compatible = "elan,ektf3624" }, 1639 + { .compatible = "elan,ekth3500", .data = (void *)EKTH3500 }, 1640 + { .compatible = "elan,ektf3624", .data = (void *)EKTF3624 }, 1640 1641 { /* sentinel */ } 1641 1642 }; 1642 1643 MODULE_DEVICE_TABLE(of, elants_of_match); 1643 1644 #endif 1644 1645 1645 1646 static struct i2c_driver elants_i2c_driver = { 1646 - .probe = elants_i2c_probe, 1647 + .probe_new = elants_i2c_probe, 1647 1648 .id_table = elants_i2c_id, 1648 1649 .driver = { 1649 1650 .name = DEVICE_NAME,
+10 -3
drivers/input/touchscreen/hideep.c
··· 361 361 return -EIO; 362 362 } 363 363 364 - static void hideep_nvm_unlock(struct hideep_ts *ts) 364 + static int hideep_nvm_unlock(struct hideep_ts *ts) 365 365 { 366 366 u32 unmask_code; 367 + int error; 367 368 368 369 hideep_pgm_w_reg(ts, HIDEEP_FLASH_CFG, HIDEEP_NVM_SFR_RPAGE); 369 - hideep_pgm_r_reg(ts, 0x0000000C, &unmask_code); 370 + error = hideep_pgm_r_reg(ts, 0x0000000C, &unmask_code); 370 371 hideep_pgm_w_reg(ts, HIDEEP_FLASH_CFG, HIDEEP_NVM_DEFAULT_PAGE); 372 + if (error) 373 + return error; 371 374 372 375 /* make it unprotected code */ 373 376 unmask_code &= ~HIDEEP_PROT_MODE; ··· 387 384 NVM_W_SFR(HIDEEP_NVM_MASK_OFS, ts->nvm_mask); 388 385 SET_FLASH_HWCONTROL(); 389 386 hideep_pgm_w_reg(ts, HIDEEP_FLASH_CFG, HIDEEP_NVM_DEFAULT_PAGE); 387 + 388 + return 0; 390 389 } 391 390 392 391 static int hideep_check_status(struct hideep_ts *ts) ··· 467 462 u32 addr = 0; 468 463 int error; 469 464 470 - hideep_nvm_unlock(ts); 465 + error = hideep_nvm_unlock(ts); 466 + if (error) 467 + return error; 471 468 472 469 while (ucode_len > 0) { 473 470 xfer_len = min_t(size_t, ucode_len, HIDEEP_NVM_PAGE_SIZE);
+117 -17
drivers/input/touchscreen/resistive-adc-touch.c
··· 13 13 #include <linux/input/touchscreen.h> 14 14 #include <linux/iio/consumer.h> 15 15 #include <linux/iio/iio.h> 16 + #include <linux/mod_devicetable.h> 16 17 #include <linux/module.h> 17 - #include <linux/of.h> 18 - #include <linux/of_device.h> 19 18 #include <linux/platform_device.h> 19 + #include <linux/property.h> 20 20 21 21 #define DRIVER_NAME "resistive-adc-touch" 22 22 #define GRTS_DEFAULT_PRESSURE_MIN 50000 23 + #define GRTS_DEFAULT_PRESSURE_MAX 65535 23 24 #define GRTS_MAX_POS_MASK GENMASK(11, 0) 25 + #define GRTS_MAX_CHANNELS 4 26 + 27 + enum grts_ch_type { 28 + GRTS_CH_X, 29 + GRTS_CH_Y, 30 + GRTS_CH_PRESSURE, 31 + GRTS_CH_Z1, 32 + GRTS_CH_Z2, 33 + GRTS_CH_MAX = GRTS_CH_Z2 + 1 34 + }; 24 35 25 36 /** 26 37 * struct grts_state - generic resistive touch screen information struct 38 + * @x_plate_ohms: resistance of the X plate 27 39 * @pressure_min: number representing the minimum for the pressure 28 40 * @pressure: are we getting pressure info or not 29 41 * @iio_chans: list of channels acquired 30 42 * @iio_cb: iio_callback buffer for the data 31 43 * @input: the input device structure that we register 32 44 * @prop: touchscreen properties struct 45 + * @ch_map: map of channels that are defined for the touchscreen 33 46 */ 34 47 struct grts_state { 48 + u32 x_plate_ohms; 35 49 u32 pressure_min; 36 50 bool pressure; 37 51 struct iio_channel *iio_chans; 38 52 struct iio_cb_buffer *iio_cb; 39 53 struct input_dev *input; 40 54 struct touchscreen_properties prop; 55 + u8 ch_map[GRTS_CH_MAX]; 41 56 }; 42 57 43 58 static int grts_cb(const void *data, void *private) 44 59 { 45 60 const u16 *touch_info = data; 46 61 struct grts_state *st = private; 47 - unsigned int x, y, press = 0x0; 62 + unsigned int x, y, press = 0; 48 63 49 - /* channel data coming in buffer in the order below */ 50 - x = touch_info[0]; 51 - y = touch_info[1]; 52 - if (st->pressure) 53 - press = touch_info[2]; 64 + x = touch_info[st->ch_map[GRTS_CH_X]]; 65 + y = touch_info[st->ch_map[GRTS_CH_Y]]; 66 + 67 + if (st->ch_map[GRTS_CH_PRESSURE] < GRTS_MAX_CHANNELS) { 68 + press = touch_info[st->ch_map[GRTS_CH_PRESSURE]]; 69 + } else if (st->ch_map[GRTS_CH_Z1] < GRTS_MAX_CHANNELS) { 70 + unsigned int z1 = touch_info[st->ch_map[GRTS_CH_Z1]]; 71 + unsigned int z2 = touch_info[st->ch_map[GRTS_CH_Z2]]; 72 + unsigned int Rt; 73 + 74 + Rt = z2; 75 + Rt -= z1; 76 + Rt *= st->x_plate_ohms; 77 + Rt = DIV_ROUND_CLOSEST(Rt, 16); 78 + Rt *= x; 79 + Rt /= z1; 80 + Rt = DIV_ROUND_CLOSEST(Rt, 256); 81 + /* 82 + * On increased pressure the resistance (Rt) is decreasing 83 + * so, convert values to make it looks as real pressure. 84 + */ 85 + if (Rt < GRTS_DEFAULT_PRESSURE_MAX) 86 + press = GRTS_DEFAULT_PRESSURE_MAX - Rt; 87 + } 54 88 55 89 if ((!x && !y) || (st->pressure && (press < st->pressure_min))) { 56 90 /* report end of touch */ ··· 128 94 iio_channel_release_all_cb(data); 129 95 } 130 96 97 + static int grts_map_channel(struct grts_state *st, struct device *dev, 98 + enum grts_ch_type type, const char *name, 99 + bool optional) 100 + { 101 + int idx; 102 + 103 + idx = device_property_match_string(dev, "io-channel-names", name); 104 + if (idx < 0) { 105 + if (!optional) 106 + return idx; 107 + idx = GRTS_MAX_CHANNELS; 108 + } else if (idx >= GRTS_MAX_CHANNELS) { 109 + return -EOVERFLOW; 110 + } 111 + 112 + st->ch_map[type] = idx; 113 + return 0; 114 + } 115 + 116 + static int grts_get_properties(struct grts_state *st, struct device *dev) 117 + { 118 + int error; 119 + 120 + error = grts_map_channel(st, dev, GRTS_CH_X, "x", false); 121 + if (error) 122 + return error; 123 + 124 + error = grts_map_channel(st, dev, GRTS_CH_Y, "y", false); 125 + if (error) 126 + return error; 127 + 128 + /* pressure is optional */ 129 + error = grts_map_channel(st, dev, GRTS_CH_PRESSURE, "pressure", true); 130 + if (error) 131 + return error; 132 + 133 + if (st->ch_map[GRTS_CH_PRESSURE] < GRTS_MAX_CHANNELS) { 134 + st->pressure = true; 135 + return 0; 136 + } 137 + 138 + /* if no pressure is defined, try optional z1 + z2 */ 139 + error = grts_map_channel(st, dev, GRTS_CH_Z1, "z1", true); 140 + if (error) 141 + return error; 142 + 143 + if (st->ch_map[GRTS_CH_Z1] >= GRTS_MAX_CHANNELS) 144 + return 0; 145 + 146 + /* if z1 is provided z2 is not optional */ 147 + error = grts_map_channel(st, dev, GRTS_CH_Z2, "z2", true); 148 + if (error) 149 + return error; 150 + 151 + error = device_property_read_u32(dev, 152 + "touchscreen-x-plate-ohms", 153 + &st->x_plate_ohms); 154 + if (error) { 155 + dev_err(dev, "can't get touchscreen-x-plate-ohms property\n"); 156 + return error; 157 + } 158 + 159 + st->pressure = true; 160 + return 0; 161 + } 162 + 131 163 static int grts_probe(struct platform_device *pdev) 132 164 { 133 165 struct grts_state *st; 134 166 struct input_dev *input; 135 167 struct device *dev = &pdev->dev; 136 - struct iio_channel *chan; 137 168 int error; 138 169 139 170 st = devm_kzalloc(dev, sizeof(struct grts_state), GFP_KERNEL); ··· 214 115 return error; 215 116 } 216 117 217 - chan = &st->iio_chans[0]; 218 - st->pressure = false; 219 - while (chan && chan->indio_dev) { 220 - if (!strcmp(chan->channel->datasheet_name, "pressure")) 221 - st->pressure = true; 222 - chan++; 118 + if (!device_property_present(dev, "io-channel-names")) 119 + return -ENODEV; 120 + 121 + error = grts_get_properties(st, dev); 122 + if (error) { 123 + dev_err(dev, "Failed to parse properties\n"); 124 + return error; 223 125 } 224 126 225 127 if (st->pressure) { ··· 248 148 input_set_abs_params(input, ABS_Y, 0, GRTS_MAX_POS_MASK - 1, 0, 0); 249 149 if (st->pressure) 250 150 input_set_abs_params(input, ABS_PRESSURE, st->pressure_min, 251 - 0xffff, 0, 0); 151 + GRTS_DEFAULT_PRESSURE_MAX, 0, 0); 252 152 253 153 input_set_capability(input, EV_KEY, BTN_TOUCH); 254 154 ··· 293 193 .probe = grts_probe, 294 194 .driver = { 295 195 .name = DRIVER_NAME, 296 - .of_match_table = of_match_ptr(grts_of_match), 196 + .of_match_table = grts_of_match, 297 197 }, 298 198 }; 299 199
+1 -1
drivers/input/touchscreen/tsc200x-core.c
··· 338 338 static umode_t tsc200x_attr_is_visible(struct kobject *kobj, 339 339 struct attribute *attr, int n) 340 340 { 341 - struct device *dev = container_of(kobj, struct device, kobj); 341 + struct device *dev = kobj_to_dev(kobj); 342 342 struct tsc200x *ts = dev_get_drvdata(dev); 343 343 umode_t mode = attr->mode; 344 344
+4 -4
drivers/input/touchscreen/usbtouchscreen.c
··· 251 251 int ret; 252 252 struct usb_device *udev = interface_to_usbdev(usbtouch->interface); 253 253 254 - ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 254 + ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 255 255 0x01, 0x02, 0x0000, 0x0081, 256 256 NULL, 0, USB_CTRL_SET_TIMEOUT); 257 257 ··· 531 531 if (ret) 532 532 return ret; 533 533 534 - ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 534 + ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 535 535 MTOUCHUSB_RESET, 536 536 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 537 537 1, 0, NULL, 0, USB_CTRL_SET_TIMEOUT); ··· 543 543 msleep(150); 544 544 545 545 for (i = 0; i < 3; i++) { 546 - ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 546 + ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 547 547 MTOUCHUSB_ASYNC_REPORT, 548 548 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 549 549 1, 1, NULL, 0, USB_CTRL_SET_TIMEOUT); ··· 722 722 } 723 723 724 724 /* start sending data */ 725 - ret = usb_control_msg(dev, usb_rcvctrlpipe (dev, 0), 725 + ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), 726 726 TSC10_CMD_DATA1, 727 727 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 728 728 0, 0, NULL, 0, USB_CTRL_SET_TIMEOUT);
-1
include/linux/input/cy8ctmg110_pdata.h
··· 5 5 struct cy8ctmg110_pdata 6 6 { 7 7 int reset_pin; /* Reset pin is wired to this GPIO (optional) */ 8 - int irq_pin; /* IRQ pin is wired to this GPIO */ 9 8 }; 10 9 11 10 #endif
-29
include/linux/input/cyttsp.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0-only */ 2 - /* 3 - * Header file for: 4 - * Cypress TrueTouch(TM) Standard Product (TTSP) touchscreen drivers. 5 - * For use with Cypress Txx3xx parts. 6 - * Supported parts include: 7 - * CY8CTST341 8 - * CY8CTMA340 9 - * 10 - * Copyright (C) 2009, 2010, 2011 Cypress Semiconductor, Inc. 11 - * Copyright (C) 2012 Javier Martinez Canillas <javier@dowhile0.org> 12 - * 13 - * Contact Cypress Semiconductor at www.cypress.com (kev@cypress.com) 14 - */ 15 - #ifndef _CYTTSP_H_ 16 - #define _CYTTSP_H_ 17 - 18 - #define CY_SPI_NAME "cyttsp-spi" 19 - #define CY_I2C_NAME "cyttsp-i2c" 20 - /* Active Power state scanning/processing refresh interval */ 21 - #define CY_ACT_INTRVL_DFLT 0x00 /* ms */ 22 - /* touch timeout for the Active power */ 23 - #define CY_TCH_TMOUT_DFLT 0xFF /* ms */ 24 - /* Low Power state scanning/processing refresh interval */ 25 - #define CY_LP_INTRVL_DFLT 0x0A /* ms */ 26 - /* Active distance in pixels for a gesture to be reported */ 27 - #define CY_ACT_DIST_DFLT 0xF8 /* pixels */ 28 - 29 - #endif /* _CYTTSP_H_ */