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

Pull input updates from Dmitry Torokhov:

 - changes to input core to properly queue synthetic events (such as
   autorepeat) and to release multitouch contacts when an input device
   is inhibited or suspended

 - reworked quirk handling in i8042 driver that consolidates multiple
   DMI tables into one and adds several quirks for TUXEDO line of
   laptops

 - update to mt6779 keypad to better reflect organization of the
   hardware

 - changes to mtk-pmic-keys driver preparing it to handle more variants

 - facelift of adp5588-keys driver

 - improvements to iqs7222 driver

 - adjustments to various DT binding documents for input devices

 - other assorted driver fixes.

* tag 'input-for-v5.20-rc0' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (54 commits)
  Input: adc-joystick - fix ordering in adc_joystick_probe()
  dt-bindings: input: ariel-pwrbutton: use spi-peripheral-props.yaml
  Input: deactivate MT slots when inhibiting or suspending devices
  Input: properly queue synthetic events
  dt-bindings: input: iqs7222: Use central 'linux,code' definition
  Input: i8042 - add dritek quirk for Acer Aspire One AO532
  dt-bindings: input: gpio-keys: accept also interrupt-extended
  dt-bindings: input: gpio-keys: reference input.yaml and document properties
  dt-bindings: input: gpio-keys: enforce node names to match all properties
  dt-bindings: input: Convert adc-keys to DT schema
  dt-bindings: input: Centralize 'linux,input-type' definition
  dt-bindings: input: Use common 'linux,keycodes' definition
  dt-bindings: input: Centralize 'linux,code' definition
  dt-bindings: input: Increase maximum keycode value to 0x2ff
  Input: mt6779-keypad - implement row/column selection
  Input: mt6779-keypad - match hardware matrix organization
  Input: i8042 - add additional TUXEDO devices to i8042 quirk tables
  Input: goodix - switch use of acpi_gpio_get_*_resource() APIs
  Input: i8042 - add TUXEDO devices to i8042 quirk tables
  Input: i8042 - add debug output for quirks
  ...
This commit is contained in:
Linus Torvalds
2022-08-11 09:23:08 -07:00
34 changed files with 2064 additions and 1489 deletions

View File

@@ -45,6 +45,7 @@ additionalProperties: false
patternProperties:
"^axis@[0-9a-f]+$":
type: object
$ref: input.yaml#
description: >
Represents a joystick axis bound to the given ADC channel.
For each entry in the io-channels list, one axis subnode with a matching
@@ -57,7 +58,6 @@ patternProperties:
description: Index of an io-channels list entry bound to this axis.
linux,code:
$ref: /schemas/types.yaml#/definitions/uint32
description: EV_ABS specific event code generated by the axis.
abs-range:

View File

@@ -1,67 +0,0 @@
ADC attached resistor ladder buttons
------------------------------------
Required properties:
- compatible: "adc-keys"
- io-channels: Phandle to an ADC channel
- io-channel-names = "buttons";
- keyup-threshold-microvolt: Voltage above or equal to which all the keys are
considered up.
Optional properties:
- poll-interval: Poll interval time in milliseconds
- autorepeat: Boolean, Enable auto repeat feature of Linux input
subsystem.
Each button (key) is represented as a sub-node of "adc-keys":
Required subnode-properties:
- label: Descriptive name of the key.
- linux,code: Keycode to emit.
- press-threshold-microvolt: voltage above or equal to which this key is
considered pressed.
No two values of press-threshold-microvolt may be the same.
All values of press-threshold-microvolt must be less than
keyup-threshold-microvolt.
Example:
#include <dt-bindings/input/input.h>
adc-keys {
compatible = "adc-keys";
io-channels = <&lradc 0>;
io-channel-names = "buttons";
keyup-threshold-microvolt = <2000000>;
button-up {
label = "Volume Up";
linux,code = <KEY_VOLUMEUP>;
press-threshold-microvolt = <1500000>;
};
button-down {
label = "Volume Down";
linux,code = <KEY_VOLUMEDOWN>;
press-threshold-microvolt = <1000000>;
};
button-enter {
label = "Enter";
linux,code = <KEY_ENTER>;
press-threshold-microvolt = <500000>;
};
};
+--------------------------------+------------------------+
| 2.000.000 <= value | no key pressed |
+--------------------------------+------------------------+
| 1.500.000 <= value < 2.000.000 | KEY_VOLUMEUP pressed |
+--------------------------------+------------------------+
| 1.000.000 <= value < 1.500.000 | KEY_VOLUMEDOWN pressed |
+--------------------------------+------------------------+
| 500.000 <= value < 1.000.000 | KEY_ENTER pressed |
+--------------------------------+------------------------+
| value < 500.000 | no key pressed |
+--------------------------------+------------------------+

View File

@@ -0,0 +1,103 @@
# SPDX-License-Identifier: GPL-2.0
%YAML 1.2
---
$id: http://devicetree.org/schemas/input/adc-keys.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: ADC attached resistor ladder buttons
maintainers:
- Alexandre Belloni <alexandre.belloni@bootlin.com>
allOf:
- $ref: input.yaml#
properties:
compatible:
const: adc-keys
io-channels:
maxItems: 1
io-channel-names:
const: buttons
keyup-threshold-microvolt:
description:
Voltage above or equal to which all the keys are considered up.
poll-interval: true
autorepeat: true
patternProperties:
'^button-':
type: object
$ref: input.yaml#
additionalProperties: false
description:
Each button (key) is represented as a sub-node.
properties:
label: true
linux,code: true
press-threshold-microvolt:
description:
Voltage above or equal to which this key is considered pressed. No
two values of press-threshold-microvolt may be the same. All values
of press-threshold-microvolt must be less than
keyup-threshold-microvolt.
required:
- linux,code
- press-threshold-microvolt
required:
- compatible
- io-channels
- io-channel-names
- keyup-threshold-microvolt
additionalProperties: false
examples:
- |
#include <dt-bindings/input/input.h>
// +--------------------------------+------------------------+
// | 2.000.000 <= value | no key pressed |
// +--------------------------------+------------------------+
// | 1.500.000 <= value < 2.000.000 | KEY_VOLUMEUP pressed |
// +--------------------------------+------------------------+
// | 1.000.000 <= value < 1.500.000 | KEY_VOLUMEDOWN pressed |
// +--------------------------------+------------------------+
// | 500.000 <= value < 1.000.000 | KEY_ENTER pressed |
// +--------------------------------+------------------------+
// | value < 500.000 | no key pressed |
// +--------------------------------+------------------------+
adc-keys {
compatible = "adc-keys";
io-channels = <&lradc 0>;
io-channel-names = "buttons";
keyup-threshold-microvolt = <2000000>;
button-up {
label = "Volume Up";
linux,code = <KEY_VOLUMEUP>;
press-threshold-microvolt = <1500000>;
};
button-down {
label = "Volume Down";
linux,code = <KEY_VOLUMEDOWN>;
press-threshold-microvolt = <1000000>;
};
button-enter {
label = "Enter";
linux,code = <KEY_ENTER>;
press-threshold-microvolt = <500000>;
};
};
...

View File

@@ -44,14 +44,13 @@ properties:
patternProperties:
"^button-[0-9]+$":
type: object
$ref: input.yaml#
properties:
label:
$ref: /schemas/types.yaml#/definitions/string
description: Descriptive name of the key
linux,code:
$ref: /schemas/types.yaml#/definitions/uint32
description: Keycode to emit
linux,code: true
channel:
$ref: /schemas/types.yaml#/definitions/uint32

View File

@@ -17,6 +17,7 @@ description: |
allOf:
- $ref: input.yaml#
- $ref: /schemas/spi/spi-peripheral-props.yaml#
properties:
compatible:

View File

@@ -37,10 +37,6 @@ properties:
device is temporarily held in hardware reset prior to initialization if
this property is present.
azoteq,rf-filt-enable:
type: boolean
description: Enables the device's internal RF filter.
azoteq,max-counts:
$ref: /schemas/types.yaml#/definitions/uint32
enum: [0, 1, 2, 3]
@@ -421,6 +417,7 @@ patternProperties:
patternProperties:
"^event-(prox|touch)$":
type: object
$ref: input.yaml#
description:
Represents a proximity or touch event reported by the channel.
@@ -467,14 +464,9 @@ patternProperties:
The IQS7222B does not feature channel-specific timeouts; the time-
out specified for any one channel applies to all channels.
linux,code:
$ref: /schemas/types.yaml#/definitions/uint32
description:
Numeric key or switch code associated with the event. Specify
KEY_RESERVED (0) to opt out of event reporting.
linux,code: true
linux,input-type:
$ref: /schemas/types.yaml#/definitions/uint32
enum: [1, 5]
default: 1
description:
@@ -537,9 +529,8 @@ patternProperties:
azoteq,bottom-speed:
$ref: /schemas/types.yaml#/definitions/uint32
multipleOf: 4
minimum: 0
maximum: 1020
maximum: 255
description:
Specifies the speed of movement after which coordinate filtering is
linearly reduced.
@@ -575,14 +566,13 @@ patternProperties:
patternProperties:
"^event-(press|tap|(swipe|flick)-(pos|neg))$":
type: object
$ref: input.yaml#
description:
Represents a press or gesture (IQS7222A only) event reported by
the slider.
properties:
linux,code:
$ref: /schemas/types.yaml#/definitions/uint32
description: Numeric key code associated with the event.
linux,code: true
azoteq,gesture-max-ms:
multipleOf: 4
@@ -616,16 +606,15 @@ patternProperties:
azoteq,gpio-select:
$ref: /schemas/types.yaml#/definitions/uint32-array
minItems: 1
maxItems: 1
maxItems: 3
items:
minimum: 0
maximum: 0
maximum: 2
description: |
Specifies an individual GPIO mapped to a tap, swipe or flick
gesture as follows:
Specifies one or more GPIO mapped to the event as follows:
0: GPIO0
1: GPIO3 (reserved)
2: GPIO4 (reserved)
1: GPIO3 (IQS7222C only)
2: GPIO4 (IQS7222C only)
Note that although multiple events can be mapped to a single
GPIO, they must all be of the same type (proximity, touch or
@@ -710,6 +699,14 @@ allOf:
multipleOf: 4
maximum: 1020
patternProperties:
"^event-(press|tap|(swipe|flick)-(pos|neg))$":
properties:
azoteq,gpio-select:
maxItems: 1
items:
maximum: 0
else:
patternProperties:
"^channel-([0-9]|1[0-9])$":
@@ -726,8 +723,6 @@ allOf:
azoteq,gesture-dist: false
azoteq,gpio-select: false
required:
- compatible
- reg

View File

@@ -57,7 +57,7 @@ examples:
#address-cells = <1>;
#size-cells = <0>;
mpr121@5a {
touchkey@5a {
compatible = "fsl,mpr121-touchkey";
reg = <0x5a>;
interrupt-parent = <&gpio1>;
@@ -77,7 +77,7 @@ examples:
#address-cells = <1>;
#size-cells = <0>;
mpr121@5a {
touchkey@5a {
compatible = "fsl,mpr121-touchkey";
reg = <0x5a>;
poll-interval = <20>;

View File

@@ -15,107 +15,106 @@ properties:
- gpio-keys
- gpio-keys-polled
autorepeat: true
label:
description: Name of entire device
poll-interval: true
patternProperties:
".*":
if:
type: object
then:
$ref: input.yaml#
"^(button|event|key|switch|(button|event|key|switch)-[a-z0-9-]+|[a-z0-9-]+-(button|event|key|switch))$":
$ref: input.yaml#
properties:
gpios:
maxItems: 1
interrupts:
maxItems: 1
label:
description: Descriptive name of the key.
linux,code:
description: Key / Axis code to emit.
linux,input-type:
default: 1 # EV_KEY
linux,input-value:
description: |
If linux,input-type is EV_ABS or EV_REL then this
value is sent for events this button generates when pressed.
EV_ABS/EV_REL axis will generate an event with a value of 0
when all buttons with linux,input-type == type and
linux,code == axis are released. This value is interpreted
as a signed 32 bit value, e.g. to make a button generate a
value of -1 use:
linux,input-value = <0xffffffff>; /* -1 */
$ref: /schemas/types.yaml#/definitions/uint32
debounce-interval:
description:
Debouncing interval time in milliseconds. If not specified defaults to 5.
$ref: /schemas/types.yaml#/definitions/uint32
default: 5
wakeup-source:
description: Button can wake-up the system.
wakeup-event-action:
description: |
Specifies whether the key should wake the system when asserted, when
deasserted, or both. This property is only valid for keys that wake up the
system (e.g., when the "wakeup-source" property is also provided).
Supported values are defined in linux-event-codes.h:
EV_ACT_ANY - both asserted and deasserted
EV_ACT_ASSERTED - asserted
EV_ACT_DEASSERTED - deasserted
$ref: /schemas/types.yaml#/definitions/uint32
enum: [0, 1, 2]
linux,can-disable:
description:
Indicates that button is connected to dedicated (not shared) interrupt
which can be disabled to suppress events from the button.
type: boolean
required:
- linux,code
anyOf:
- required:
- interrupts
- required:
- interrupts-extended
- required:
- gpios
dependencies:
wakeup-event-action: [ wakeup-source ]
linux,input-value: [ gpios ]
unevaluatedProperties: false
allOf:
- $ref: input.yaml#
- if:
properties:
gpios:
maxItems: 1
interrupts:
maxItems: 1
label:
description: Descriptive name of the key.
linux,code:
description: Key / Axis code to emit.
$ref: /schemas/types.yaml#/definitions/uint32
linux,input-type:
description:
Specify event type this button/key generates. If not specified defaults to
<1> == EV_KEY.
$ref: /schemas/types.yaml#/definitions/uint32
default: 1
linux,input-value:
description: |
If linux,input-type is EV_ABS or EV_REL then this
value is sent for events this button generates when pressed.
EV_ABS/EV_REL axis will generate an event with a value of 0
when all buttons with linux,input-type == type and
linux,code == axis are released. This value is interpreted
as a signed 32 bit value, e.g. to make a button generate a
value of -1 use:
linux,input-value = <0xffffffff>; /* -1 */
$ref: /schemas/types.yaml#/definitions/uint32
debounce-interval:
description:
Debouncing interval time in milliseconds. If not specified defaults to 5.
$ref: /schemas/types.yaml#/definitions/uint32
default: 5
wakeup-source:
description: Button can wake-up the system.
wakeup-event-action:
description: |
Specifies whether the key should wake the system when asserted, when
deasserted, or both. This property is only valid for keys that wake up the
system (e.g., when the "wakeup-source" property is also provided).
Supported values are defined in linux-event-codes.h:
EV_ACT_ANY - both asserted and deasserted
EV_ACT_ASSERTED - asserted
EV_ACT_DEASSERTED - deasserted
$ref: /schemas/types.yaml#/definitions/uint32
enum: [0, 1, 2]
linux,can-disable:
description:
Indicates that button is connected to dedicated (not shared) interrupt
which can be disabled to suppress events from the button.
type: boolean
compatible:
const: gpio-keys-polled
then:
required:
- linux,code
anyOf:
- required:
- interrupts
- required:
- gpios
dependencies:
wakeup-event-action: [ wakeup-source ]
linux,input-value: [ gpios ]
unevaluatedProperties: false
if:
properties:
compatible:
const: gpio-keys-polled
then:
properties:
poll-interval:
description:
Poll interval time in milliseconds
$ref: /schemas/types.yaml#/definitions/uint32
required:
- poll-interval
- poll-interval
else:
properties:
poll-interval: false
additionalProperties: false
@@ -127,13 +126,13 @@ examples:
compatible = "gpio-keys";
autorepeat;
up {
key-up {
label = "GPIO Key UP";
linux,code = <103>;
gpios = <&gpio1 0 1>;
};
down {
key-down {
label = "GPIO Key DOWN";
linux,code = <108>;
interrupts = <1 IRQ_TYPE_EDGE_FALLING>;

View File

@@ -21,7 +21,26 @@ properties:
$ref: /schemas/types.yaml#/definitions/uint32-array
items:
minimum: 0
maximum: 0xff
maximum: 0x2ff
linux,code:
description:
Specifies a single numeric keycode value to be used for reporting
button/switch events. Specify KEY_RESERVED (0) to opt out of event
reporting.
$ref: /schemas/types.yaml#/definitions/uint32
maximum: 0x2ff
linux,input-type:
$ref: /schemas/types.yaml#/definitions/uint32
enum:
- 1 # EV_KEY
- 2 # EV_REL
- 3 # EV_ABS
- 5 # EV_SW
description:
Specifies whether the event is to be interpreted as a key, relative,
absolute, or switch.
poll-interval:
description: Poll interval time in milliseconds.
@@ -39,4 +58,7 @@ properties:
reset automatically. Device with key pressed reset feature can specify
this property.
dependencies:
linux,input-type: [ "linux,code" ]
additionalProperties: true

View File

@@ -370,6 +370,7 @@ patternProperties:
patternProperties:
"^event-prox(-alt)?$":
type: object
$ref: input.yaml#
description:
Represents a proximity event reported by the channel in response to
a decrease in counts. Node names suffixed with '-alt' instead corre-
@@ -396,14 +397,13 @@ patternProperties:
default: 10
description: Specifies the threshold for the event.
linux,code:
$ref: /schemas/types.yaml#/definitions/uint32
description: Numeric key or switch code associated with the event.
linux,code: true
additionalProperties: false
"^event-touch(-alt)?$":
type: object
$ref: input.yaml#
description: Represents a touch event reported by the channel.
properties:
@@ -421,14 +421,13 @@ patternProperties:
default: 4
description: Specifies the hysteresis for the event.
linux,code:
$ref: /schemas/types.yaml#/definitions/uint32
description: Numeric key or switch code associated with the event.
linux,code: true
additionalProperties: false
"^event-deep(-alt)?$":
type: object
$ref: input.yaml#
description: Represents a deep-touch event reported by the channel.
properties:
@@ -446,9 +445,7 @@ patternProperties:
default: 0
description: Specifies the hysteresis for the event.
linux,code:
$ref: /schemas/types.yaml#/definitions/uint32
description: Numeric key or switch code associated with the event.
linux,code: true
additionalProperties: false
@@ -475,7 +472,7 @@ examples:
#address-cells = <1>;
#size-cells = <0>;
iqs269a@44 {
touch@44 {
#address-cells = <1>;
#size-cells = <0>;

View File

@@ -449,6 +449,7 @@ patternProperties:
patternProperties:
"^event-(prox|touch|deep)(-alt)?$":
type: object
$ref: input.yaml#
description:
Represents a proximity, touch or deep-touch event reported by the
channel in response to a decrease in counts. Node names suffixed with
@@ -487,21 +488,15 @@ patternProperties:
Specifies the hysteresis for the event (touch and deep-touch
events only).
linux,code:
$ref: /schemas/types.yaml#/definitions/uint32
description: Numeric key or switch code associated with the event.
linux,code: true
linux,input-type:
$ref: /schemas/types.yaml#/definitions/uint32
enum: [1, 5]
description:
Specifies whether the event is to be interpreted as a key (1) or
a switch (5). By default, Hall-channel events are interpreted as
switches and all others are interpreted as keys.
dependencies:
linux,input-type: ["linux,code"]
additionalProperties: false
dependencies:
@@ -511,6 +506,7 @@ patternProperties:
"^trackpad-3x[2-3]$":
type: object
$ref: input.yaml#
description:
Represents all channels associated with the trackpad. The channels are
collectively active if the trackpad is defined and inactive otherwise.
@@ -679,7 +675,6 @@ patternProperties:
Specifies the raw count filter strength during low-power mode.
linux,keycodes:
$ref: /schemas/types.yaml#/definitions/uint32-array
minItems: 1
maxItems: 6
description: |
@@ -751,7 +746,7 @@ examples:
#address-cells = <1>;
#size-cells = <0>;
iqs626a@44 {
touch@44 {
#address-cells = <1>;
#size-cells = <0>;

View File

@@ -9,6 +9,9 @@ title: Azoteq IQS620A/621/622/624/625 Keys and Switches
maintainers:
- Jeff LaBundy <jeff@labundy.com>
allOf:
- $ref: input.yaml#
description: |
The Azoteq IQS620A, IQS621, IQS622, IQS624 and IQS625 multi-function sensors
feature a variety of self-capacitive, mutual-inductive and Hall-effect sens-
@@ -30,7 +33,6 @@ properties:
- azoteq,iqs625-keys
linux,keycodes:
$ref: /schemas/types.yaml#/definitions/uint32-array
minItems: 1
maxItems: 16
description: |
@@ -89,15 +91,14 @@ properties:
patternProperties:
"^hall-switch-(north|south)$":
type: object
$ref: input.yaml#
description:
Represents north/south-field Hall-effect sensor touch or proximity
events. Note that north/south-field orientation is reversed on the
IQS620AXzCSR device due to its flip-chip package.
properties:
linux,code:
$ref: /schemas/types.yaml#/definitions/uint32
description: Numeric switch code associated with the event.
linux,code: true
azoteq,use-prox:
$ref: /schemas/types.yaml#/definitions/flag

View File

@@ -16,15 +16,15 @@ description: |
The onkey controller is represented as a sub-node of the PMIC node on
the device tree.
allOf:
- $ref: input.yaml#
properties:
compatible:
const: maxim,max77650-onkey
linux,code:
$ref: /schemas/types.yaml#/definitions/uint32
description:
The key-code to be reported when the key is pressed. Defaults
to KEY_POWER.
default: 116 # KEY_POWER
maxim,onkey-slide:
$ref: /schemas/types.yaml#/definitions/flag

View File

@@ -112,7 +112,7 @@ examples:
#address-cells = <1>;
#size-cells = <0>;
cap1188@28 {
touch@28 {
compatible = "microchip,cap1188";
interrupt-parent = <&gpio1>;
interrupts = <0 0>;

View File

@@ -85,6 +85,14 @@ properties:
minimum: 0
maximum: 80
report-rate-hz:
description: |
Allows setting the scan rate in Hertz.
M06 supports range from 30 to 140 Hz.
M12 supports range from 1 to 255 Hz.
minimum: 1
maximum: 255
touchscreen-size-x: true
touchscreen-size-y: true
touchscreen-fuzz-x: true

View File

@@ -0,0 +1,16 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef _INPUT_CORE_PRIVATE_H
#define _INPUT_CORE_PRIVATE_H
/*
* Functions and definitions that are private to input core,
* should not be used by input drivers or handlers.
*/
struct input_dev;
void input_mt_release_slots(struct input_dev *dev);
void input_handle_event(struct input_dev *dev,
unsigned int type, unsigned int code, int value);
#endif /* _INPUT_CORE_PRIVATE_H */

View File

@@ -8,6 +8,7 @@
#include <linux/input/mt.h>
#include <linux/export.h>
#include <linux/slab.h>
#include "input-core-private.h"
#define TRKID_SGN ((TRKID_MAX + 1) >> 1)
@@ -259,10 +260,13 @@ static void __input_mt_drop_unused(struct input_dev *dev, struct input_mt *mt)
{
int i;
lockdep_assert_held(&dev->event_lock);
for (i = 0; i < mt->num_slots; i++) {
if (!input_mt_is_used(mt, &mt->slots[i])) {
input_mt_slot(dev, i);
input_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1);
if (input_mt_is_active(&mt->slots[i]) &&
!input_mt_is_used(mt, &mt->slots[i])) {
input_handle_event(dev, EV_ABS, ABS_MT_SLOT, i);
input_handle_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1);
}
}
}
@@ -278,12 +282,43 @@ void input_mt_drop_unused(struct input_dev *dev)
struct input_mt *mt = dev->mt;
if (mt) {
unsigned long flags;
spin_lock_irqsave(&dev->event_lock, flags);
__input_mt_drop_unused(dev, mt);
mt->frame++;
spin_unlock_irqrestore(&dev->event_lock, flags);
}
}
EXPORT_SYMBOL(input_mt_drop_unused);
/**
* input_mt_release_slots() - Deactivate all slots
* @dev: input device with allocated MT slots
*
* Lift all active slots.
*/
void input_mt_release_slots(struct input_dev *dev)
{
struct input_mt *mt = dev->mt;
lockdep_assert_held(&dev->event_lock);
if (mt) {
/* This will effectively mark all slots unused. */
mt->frame++;
__input_mt_drop_unused(dev, mt);
if (test_bit(ABS_PRESSURE, dev->absbit))
input_handle_event(dev, EV_ABS, ABS_PRESSURE, 0);
mt->frame++;
}
}
/**
* input_mt_sync_frame() - synchronize mt frame
* @dev: input device with allocated MT slots
@@ -300,8 +335,13 @@ void input_mt_sync_frame(struct input_dev *dev)
if (!mt)
return;
if (mt->flags & INPUT_MT_DROP_UNUSED)
if (mt->flags & INPUT_MT_DROP_UNUSED) {
unsigned long flags;
spin_lock_irqsave(&dev->event_lock, flags);
__input_mt_drop_unused(dev, mt);
spin_unlock_irqrestore(&dev->event_lock, flags);
}
if ((mt->flags & INPUT_MT_POINTER) && !(mt->flags & INPUT_MT_SEMI_MT))
use_count = true;

View File

@@ -24,6 +24,7 @@
#include <linux/mutex.h>
#include <linux/rcupdate.h>
#include "input-compat.h"
#include "input-core-private.h"
#include "input-poller.h"
MODULE_AUTHOR("Vojtech Pavlik <vojtech@suse.cz>");
@@ -142,6 +143,8 @@ static void input_pass_values(struct input_dev *dev,
struct input_handle *handle;
struct input_value *v;
lockdep_assert_held(&dev->event_lock);
if (!count)
return;
@@ -174,44 +177,6 @@ static void input_pass_values(struct input_dev *dev,
}
}
static void input_pass_event(struct input_dev *dev,
unsigned int type, unsigned int code, int value)
{
struct input_value vals[] = { { type, code, value } };
input_pass_values(dev, vals, ARRAY_SIZE(vals));
}
/*
* Generate software autorepeat event. Note that we take
* dev->event_lock here to avoid racing with input_event
* which may cause keys get "stuck".
*/
static void input_repeat_key(struct timer_list *t)
{
struct input_dev *dev = from_timer(dev, t, timer);
unsigned long flags;
spin_lock_irqsave(&dev->event_lock, flags);
if (test_bit(dev->repeat_key, dev->key) &&
is_event_supported(dev->repeat_key, dev->keybit, KEY_MAX)) {
struct input_value vals[] = {
{ EV_KEY, dev->repeat_key, 2 },
input_value_sync
};
input_set_timestamp(dev, ktime_get());
input_pass_values(dev, vals, ARRAY_SIZE(vals));
if (dev->rep[REP_PERIOD])
mod_timer(&dev->timer, jiffies +
msecs_to_jiffies(dev->rep[REP_PERIOD]));
}
spin_unlock_irqrestore(&dev->event_lock, flags);
}
#define INPUT_IGNORE_EVENT 0
#define INPUT_PASS_TO_HANDLERS 1
#define INPUT_PASS_TO_DEVICE 2
@@ -275,6 +240,10 @@ static int input_get_disposition(struct input_dev *dev,
int disposition = INPUT_IGNORE_EVENT;
int value = *pval;
/* filter-out events from inhibited devices */
if (dev->inhibited)
return INPUT_IGNORE_EVENT;
switch (type) {
case EV_SYN:
@@ -375,19 +344,9 @@ static int input_get_disposition(struct input_dev *dev,
return disposition;
}
static void input_handle_event(struct input_dev *dev,
unsigned int type, unsigned int code, int value)
static void input_event_dispose(struct input_dev *dev, int disposition,
unsigned int type, unsigned int code, int value)
{
int disposition;
/* filter-out events from inhibited devices */
if (dev->inhibited)
return;
disposition = input_get_disposition(dev, type, code, &value);
if (disposition != INPUT_IGNORE_EVENT && type != EV_SYN)
add_input_randomness(type, code, value);
if ((disposition & INPUT_PASS_TO_DEVICE) && dev->event)
dev->event(dev, type, code, value);
@@ -426,7 +385,22 @@ static void input_handle_event(struct input_dev *dev,
input_pass_values(dev, dev->vals, dev->num_vals);
dev->num_vals = 0;
}
}
void input_handle_event(struct input_dev *dev,
unsigned int type, unsigned int code, int value)
{
int disposition;
lockdep_assert_held(&dev->event_lock);
disposition = input_get_disposition(dev, type, code, &value);
if (disposition != INPUT_IGNORE_EVENT) {
if (type != EV_SYN)
add_input_randomness(type, code, value);
input_event_dispose(dev, disposition, type, code, value);
}
}
/**
@@ -613,7 +587,7 @@ static void __input_release_device(struct input_handle *handle)
lockdep_is_held(&dev->mutex));
if (grabber == handle) {
rcu_assign_pointer(dev->grab, NULL);
/* Make sure input_pass_event() notices that grab is gone */
/* Make sure input_pass_values() notices that grab is gone */
synchronize_rcu();
list_for_each_entry(handle, &dev->h_list, d_node)
@@ -736,7 +710,7 @@ void input_close_device(struct input_handle *handle)
if (!--handle->open) {
/*
* synchronize_rcu() makes sure that input_pass_event()
* synchronize_rcu() makes sure that input_pass_values()
* completed and that no more input events are delivered
* through this handle
*/
@@ -751,22 +725,21 @@ EXPORT_SYMBOL(input_close_device);
* Simulate keyup events for all keys that are marked as pressed.
* The function must be called with dev->event_lock held.
*/
static void input_dev_release_keys(struct input_dev *dev)
static bool input_dev_release_keys(struct input_dev *dev)
{
bool need_sync = false;
int code;
lockdep_assert_held(&dev->event_lock);
if (is_event_supported(EV_KEY, dev->evbit, EV_MAX)) {
for_each_set_bit(code, dev->key, KEY_CNT) {
input_pass_event(dev, EV_KEY, code, 0);
input_handle_event(dev, EV_KEY, code, 0);
need_sync = true;
}
if (need_sync)
input_pass_event(dev, EV_SYN, SYN_REPORT, 1);
memset(dev->key, 0, sizeof(dev->key));
}
return need_sync;
}
/*
@@ -793,7 +766,8 @@ static void input_disconnect_device(struct input_dev *dev)
* generate events even after we done here but they will not
* reach any handlers.
*/
input_dev_release_keys(dev);
if (input_dev_release_keys(dev))
input_handle_event(dev, EV_SYN, SYN_REPORT, 1);
list_for_each_entry(handle, &dev->h_list, d_node)
handle->open = 0;
@@ -1004,12 +978,16 @@ int input_set_keycode(struct input_dev *dev,
} else if (test_bit(EV_KEY, dev->evbit) &&
!is_event_supported(old_keycode, dev->keybit, KEY_MAX) &&
__test_and_clear_bit(old_keycode, dev->key)) {
struct input_value vals[] = {
{ EV_KEY, old_keycode, 0 },
input_value_sync
};
input_pass_values(dev, vals, ARRAY_SIZE(vals));
/*
* We have to use input_event_dispose() here directly instead
* of input_handle_event() because the key we want to release
* here is considered no longer supported by the device and
* input_handle_event() will ignore it.
*/
input_event_dispose(dev, INPUT_PASS_TO_HANDLERS,
EV_KEY, old_keycode, 0);
input_event_dispose(dev, INPUT_PASS_TO_HANDLERS | INPUT_FLUSH,
EV_SYN, SYN_REPORT, 1);
}
out:
@@ -1784,7 +1762,8 @@ void input_reset_device(struct input_dev *dev)
spin_lock_irqsave(&dev->event_lock, flags);
input_dev_toggle(dev, true);
input_dev_release_keys(dev);
if (input_dev_release_keys(dev))
input_handle_event(dev, EV_SYN, SYN_REPORT, 1);
spin_unlock_irqrestore(&dev->event_lock, flags);
mutex_unlock(&dev->mutex);
@@ -1806,7 +1785,9 @@ static int input_inhibit_device(struct input_dev *dev)
}
spin_lock_irq(&dev->event_lock);
input_mt_release_slots(dev);
input_dev_release_keys(dev);
input_handle_event(dev, EV_SYN, SYN_REPORT, 1);
input_dev_toggle(dev, false);
spin_unlock_irq(&dev->event_lock);
@@ -1857,7 +1838,8 @@ static int input_dev_suspend(struct device *dev)
* Keys that are pressed now are unlikely to be
* still pressed when we resume.
*/
input_dev_release_keys(input_dev);
if (input_dev_release_keys(input_dev))
input_handle_event(input_dev, EV_SYN, SYN_REPORT, 1);
/* Turn off LEDs and sounds, if any are active. */
input_dev_toggle(input_dev, false);
@@ -1891,7 +1873,8 @@ static int input_dev_freeze(struct device *dev)
* Keys that are pressed now are unlikely to be
* still pressed when we resume.
*/
input_dev_release_keys(input_dev);
if (input_dev_release_keys(input_dev))
input_handle_event(input_dev, EV_SYN, SYN_REPORT, 1);
spin_unlock_irq(&input_dev->event_lock);
@@ -2259,6 +2242,34 @@ static void devm_input_device_unregister(struct device *dev, void *res)
__input_unregister_device(input);
}
/*
* Generate software autorepeat event. Note that we take
* dev->event_lock here to avoid racing with input_event
* which may cause keys get "stuck".
*/
static void input_repeat_key(struct timer_list *t)
{
struct input_dev *dev = from_timer(dev, t, timer);
unsigned long flags;
spin_lock_irqsave(&dev->event_lock, flags);
if (!dev->inhibited &&
test_bit(dev->repeat_key, dev->key) &&
is_event_supported(dev->repeat_key, dev->keybit, KEY_MAX)) {
input_set_timestamp(dev, ktime_get());
input_handle_event(dev, EV_KEY, dev->repeat_key, 2);
input_handle_event(dev, EV_SYN, SYN_REPORT, 1);
if (dev->rep[REP_PERIOD])
mod_timer(&dev->timer, jiffies +
msecs_to_jiffies(dev->rep[REP_PERIOD]));
}
spin_unlock_irqrestore(&dev->event_lock, flags);
}
/**
* input_enable_softrepeat - enable software autorepeat
* @dev: input device

View File

@@ -222,13 +222,6 @@ static int adc_joystick_probe(struct platform_device *pdev)
if (error)
return error;
input_set_drvdata(input, joy);
error = input_register_device(input);
if (error) {
dev_err(dev, "Unable to register input device\n");
return error;
}
joy->buffer = iio_channel_get_all_cb(dev, adc_joystick_handle, joy);
if (IS_ERR(joy->buffer)) {
dev_err(dev, "Unable to allocate callback buffer\n");
@@ -241,6 +234,14 @@ static int adc_joystick_probe(struct platform_device *pdev)
return error;
}
input_set_drvdata(input, joy);
error = input_register_device(input);
if (error) {
dev_err(dev, "Unable to register input device\n");
return error;
}
return 0;
}

View File

@@ -98,10 +98,8 @@ static int sensehat_joystick_probe(struct platform_device *pdev)
}
irq = platform_get_irq(pdev, 0);
if (irq < 0) {
dev_err(&pdev->dev, "Could not retrieve interrupt request");
if (irq < 0)
return irq;
}
error = devm_request_threaded_irq(&pdev->dev, irq,
NULL, sensehat_joystick_report,

Some files were not shown because too many files have changed in this diff Show More