Skip to content

Commit 14738e0

Browse files
committed
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Pull input subsystem updates from Dmitry Torokhov: "Thanks to Samuel Thibault input device (keyboard) LEDs are no longer hardwired within the input core but use LED subsystem and so allow use of different triggers; Hans de Goede did a large update for the ALPS touchpad driver; we have new TI drv2665 haptics driver and DA9063 OnKey driver, and host of other drivers got various fixes" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (55 commits) Input: pixcir_i2c_ts - fix receive error MAINTAINERS: remove non existent input mt git tree Input: improve usage of gpiod API tty/vt/keyboard: define LED triggers for VT keyboard lock states tty/vt/keyboard: define LED triggers for VT LED states Input: export LEDs as class devices in sysfs Input: cyttsp4 - use swap() in cyttsp4_get_touch() Input: goodix - do not explicitly set evbits in input device Input: goodix - export id and version read from device Input: goodix - fix variable length array warning Input: goodix - fix alignment issues Input: add OnKey driver for DA9063 MFD part Input: elan_i2c - add product IDs FW names Input: elan_i2c - add support for multi IC type and iap format Input: focaltech - report finger width to userspace tty: remove platform_sysrq_reset_seq Input: synaptics_i2c - use proper boolean values Input: psmouse - use true instead of 1 for boolean values Input: cyapa - fix a few typos in comments Input: stmpe-ts - enforce device tree only mode ...
2 parents 45471cd + f7ebc4d commit 14738e0

54 files changed

Lines changed: 1278 additions & 375 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Documentation/devicetree/bindings/i2c/trivial-devices.txt‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ adi,adt7475 +/-1C TDM Extended Temp Range I.C
1919
adi,adt7476 +/-1C TDM Extended Temp Range I.C
2020
adi,adt7490 +/-1C TDM Extended Temp Range I.C
2121
adi,adxl345 Three-Axis Digital Accelerometer
22-
adi,adxl346 Three-Axis Digital Accelerometer
23-
adi,adxl34x Three-Axis Digital Accelerometer
22+
adi,adxl346 Three-Axis Digital Accelerometer (backward-compatibility value "adi,adxl345" must be listed too)
2423
at,24c08 i2c serial eeprom (24cxx)
2524
atmel,24c00 i2c serial eeprom (24cxx)
2625
atmel,24c01 i2c serial eeprom (24cxx)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
* Texas Instruments - drv2665 Haptics driver
2+
3+
Required properties:
4+
- compatible - "ti,drv2665" - DRV2665
5+
- reg - I2C slave address
6+
- vbat-supply - Required supply regulator
7+
8+
Example:
9+
10+
haptics: haptics@59 {
11+
compatible = "ti,drv2665";
12+
reg = <0x59>;
13+
vbat-supply = <&vbat>;
14+
};
15+
16+
For more product information please see the link below:
17+
http://www.ti.com/product/drv2665

‎Documentation/leds/leds-class.txt‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
LED handling under Linux
33
========================
44

5-
If you're reading this and thinking about keyboard leds, these are
6-
handled by the input subsystem and the led class is *not* needed.
7-
85
In its simplest form, the LED class just allows control of LEDs from
96
userspace. LEDs appear in /sys/class/leds/. The maximum brightness of the
107
LED is defined in max_brightness file. The brightness file will set the brightness

‎MAINTAINERS‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5171,7 +5171,6 @@ F: include/linux/input/
51715171
INPUT MULTITOUCH (MT) PROTOCOL
51725172
M: Henrik Rydberg <rydberg@bitmath.org>
51735173
L: linux-input@vger.kernel.org
5174-
T: git git://git.kernel.org/pub/scm/linux/kernel/git/rydberg/input-mt.git
51755174
S: Odd fixes
51765175
F: Documentation/input/multi-touch-protocol.txt
51775176
F: drivers/input/input-mt.c

‎drivers/input/Kconfig‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,19 @@ config INPUT
2525

2626
if INPUT
2727

28+
config INPUT_LEDS
29+
tristate "Export input device LEDs in sysfs"
30+
depends on LEDS_CLASS
31+
default INPUT
32+
help
33+
Say Y here if you would like to export LEDs on input devices
34+
as standard LED class devices in sysfs.
35+
36+
If unsure, say Y.
37+
38+
To compile this driver as a module, choose M here: the
39+
module will be called input-leds.
40+
2841
config INPUT_FF_MEMLESS
2942
tristate "Support for memoryless force-feedback devices"
3043
help

‎drivers/input/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ obj-$(CONFIG_INPUT_POLLDEV) += input-polldev.o
1212
obj-$(CONFIG_INPUT_SPARSEKMAP) += sparse-keymap.o
1313
obj-$(CONFIG_INPUT_MATRIXKMAP) += matrix-keymap.o
1414

15+
obj-$(CONFIG_INPUT_LEDS) += input-leds.o
1516
obj-$(CONFIG_INPUT_MOUSEDEV) += mousedev.o
1617
obj-$(CONFIG_INPUT_JOYDEV) += joydev.o
1718
obj-$(CONFIG_INPUT_EVDEV) += evdev.o

‎drivers/input/evdev.c‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -422,10 +422,7 @@ static int evdev_release(struct inode *inode, struct file *file)
422422

423423
evdev_detach_client(evdev, client);
424424

425-
if (is_vmalloc_addr(client))
426-
vfree(client);
427-
else
428-
kfree(client);
425+
kvfree(client);
429426

430427
evdev_close_device(evdev);
431428

‎drivers/input/ff-core.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ static int compat_effect(struct ff_device *ff, struct ff_effect *effect)
7070
return -EINVAL;
7171

7272
/*
73-
* calculate manginude of sine wave as average of rumble's
73+
* calculate magnitude of sine wave as average of rumble's
7474
* 2/3 of strong magnitude and 1/3 of weak magnitude
7575
*/
7676
magnitude = effect->u.rumble.strong_magnitude / 3 +
@@ -213,7 +213,7 @@ static int erase_effect(struct input_dev *dev, int effect_id,
213213
/**
214214
* input_ff_erase - erase a force-feedback effect from device
215215
* @dev: input device to erase effect from
216-
* @effect_id: id of the ffect to be erased
216+
* @effect_id: id of the effect to be erased
217217
* @file: purported owner of the request
218218
*
219219
* This function erases a force-feedback effect from specified device.

‎drivers/input/input-leds.c‎

Lines changed: 212 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,212 @@
1+
/*
2+
* LED support for the input layer
3+
*
4+
* Copyright 2010-2015 Samuel Thibault <samuel.thibault@ens-lyon.org>
5+
*
6+
* This program is free software; you can redistribute it and/or modify
7+
* it under the terms of the GNU General Public License version 2 as
8+
* published by the Free Software Foundation.
9+
*/
10+
11+
#include <linux/kernel.h>
12+
#include <linux/slab.h>
13+
#include <linux/module.h>
14+
#include <linux/init.h>
15+
#include <linux/leds.h>
16+
#include <linux/input.h>
17+
18+
#if IS_ENABLED(CONFIG_VT)
19+
#define VT_TRIGGER(_name) .trigger = _name
20+
#else
21+
#define VT_TRIGGER(_name) .trigger = NULL
22+
#endif
23+
24+
static const struct {
25+
const char *name;
26+
const char *trigger;
27+
} input_led_info[LED_CNT] = {
28+
[LED_NUML] = { "numlock", VT_TRIGGER("kbd-numlock") },
29+
[LED_CAPSL] = { "capslock", VT_TRIGGER("kbd-capslock") },
30+
[LED_SCROLLL] = { "scrolllock", VT_TRIGGER("kbd-scrolllock") },
31+
[LED_COMPOSE] = { "compose" },
32+
[LED_KANA] = { "kana", VT_TRIGGER("kbd-kanalock") },
33+
[LED_SLEEP] = { "sleep" } ,
34+
[LED_SUSPEND] = { "suspend" },
35+
[LED_MUTE] = { "mute" },
36+
[LED_MISC] = { "misc" },
37+
[LED_MAIL] = { "mail" },
38+
[LED_CHARGING] = { "charging" },
39+
};
40+
41+
struct input_led {
42+
struct led_classdev cdev;
43+
struct input_handle *handle;
44+
unsigned int code; /* One of LED_* constants */
45+
};
46+
47+
struct input_leds {
48+
struct input_handle handle;
49+
unsigned int num_leds;
50+
struct input_led leds[];
51+
};
52+
53+
static enum led_brightness input_leds_brightness_get(struct led_classdev *cdev)
54+
{
55+
struct input_led *led = container_of(cdev, struct input_led, cdev);
56+
struct input_dev *input = led->handle->dev;
57+
58+
return test_bit(led->code, input->led) ? cdev->max_brightness : 0;
59+
}
60+
61+
static void input_leds_brightness_set(struct led_classdev *cdev,
62+
enum led_brightness brightness)
63+
{
64+
struct input_led *led = container_of(cdev, struct input_led, cdev);
65+
66+
input_inject_event(led->handle, EV_LED, led->code, !!brightness);
67+
}
68+
69+
static void input_leds_event(struct input_handle *handle, unsigned int type,
70+
unsigned int code, int value)
71+
{
72+
}
73+
74+
static int input_leds_connect(struct input_handler *handler,
75+
struct input_dev *dev,
76+
const struct input_device_id *id)
77+
{
78+
struct input_leds *leds;
79+
unsigned int num_leds;
80+
unsigned int led_code;
81+
int led_no;
82+
int error;
83+
84+
num_leds = bitmap_weight(dev->ledbit, LED_CNT);
85+
if (!num_leds)
86+
return -ENXIO;
87+
88+
leds = kzalloc(sizeof(*leds) + num_leds * sizeof(*leds->leds),
89+
GFP_KERNEL);
90+
if (!leds)
91+
return -ENOMEM;
92+
93+
leds->num_leds = num_leds;
94+
95+
leds->handle.dev = dev;
96+
leds->handle.handler = handler;
97+
leds->handle.name = "leds";
98+
leds->handle.private = leds;
99+
100+
error = input_register_handle(&leds->handle);
101+
if (error)
102+
goto err_free_mem;
103+
104+
error = input_open_device(&leds->handle);
105+
if (error)
106+
goto err_unregister_handle;
107+
108+
led_no = 0;
109+
for_each_set_bit(led_code, dev->ledbit, LED_CNT) {
110+
struct input_led *led = &leds->leds[led_no];
111+
112+
led->handle = &leds->handle;
113+
led->code = led_code;
114+
115+
if (WARN_ON(!input_led_info[led_code].name))
116+
continue;
117+
118+
led->cdev.name = kasprintf(GFP_KERNEL, "%s::%s",
119+
dev_name(&dev->dev),
120+
input_led_info[led_code].name);
121+
if (!led->cdev.name) {
122+
error = -ENOMEM;
123+
goto err_unregister_leds;
124+
}
125+
126+
led->cdev.max_brightness = 1;
127+
led->cdev.brightness_get = input_leds_brightness_get;
128+
led->cdev.brightness_set = input_leds_brightness_set;
129+
led->cdev.default_trigger = input_led_info[led_code].trigger;
130+
131+
error = led_classdev_register(&dev->dev, &led->cdev);
132+
if (error) {
133+
dev_err(&dev->dev, "failed to register LED %s: %d\n",
134+
led->cdev.name, error);
135+
kfree(led->cdev.name);
136+
goto err_unregister_leds;
137+
}
138+
139+
led_no++;
140+
}
141+
142+
return 0;
143+
144+
err_unregister_leds:
145+
while (--led_no >= 0) {
146+
struct input_led *led = &leds->leds[led_no];
147+
148+
led_classdev_unregister(&led->cdev);
149+
kfree(led->cdev.name);
150+
}
151+
152+
input_close_device(&leds->handle);
153+
154+
err_unregister_handle:
155+
input_unregister_handle(&leds->handle);
156+
157+
err_free_mem:
158+
kfree(leds);
159+
return error;
160+
}
161+
162+
static void input_leds_disconnect(struct input_handle *handle)
163+
{
164+
struct input_leds *leds = handle->private;
165+
int i;
166+
167+
for (i = 0; i < leds->num_leds; i++) {
168+
struct input_led *led = &leds->leds[i];
169+
170+
led_classdev_unregister(&led->cdev);
171+
kfree(led->cdev.name);
172+
}
173+
174+
input_close_device(handle);
175+
input_unregister_handle(handle);
176+
177+
kfree(leds);
178+
}
179+
180+
static const struct input_device_id input_leds_ids[] = {
181+
{
182+
.flags = INPUT_DEVICE_ID_MATCH_EVBIT,
183+
.evbit = { BIT_MASK(EV_LED) },
184+
},
185+
{ },
186+
};
187+
MODULE_DEVICE_TABLE(input, input_leds_ids);
188+
189+
static struct input_handler input_leds_handler = {
190+
.event = input_leds_event,
191+
.connect = input_leds_connect,
192+
.disconnect = input_leds_disconnect,
193+
.name = "leds",
194+
.id_table = input_leds_ids,
195+
};
196+
197+
static int __init input_leds_init(void)
198+
{
199+
return input_register_handler(&input_leds_handler);
200+
}
201+
module_init(input_leds_init);
202+
203+
static void __exit input_leds_exit(void)
204+
{
205+
input_unregister_handler(&input_leds_handler);
206+
}
207+
module_exit(input_leds_exit);
208+
209+
MODULE_AUTHOR("Samuel Thibault <samuel.thibault@ens-lyon.org>");
210+
MODULE_AUTHOR("Dmitry Torokhov <dmitry.torokhov@gmail.com>");
211+
MODULE_DESCRIPTION("Input -> LEDs Bridge");
212+
MODULE_LICENSE("GPL v2");

‎drivers/input/input.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2262,7 +2262,7 @@ EXPORT_SYMBOL(input_unregister_handler);
22622262
*
22632263
* Iterate over @bus's list of devices, and call @fn for each, passing
22642264
* it @data and stop when @fn returns a non-zero value. The function is
2265-
* using RCU to traverse the list and therefore may be usind in atonic
2265+
* using RCU to traverse the list and therefore may be using in atomic
22662266
* contexts. The @fn callback is invoked from RCU critical section and
22672267
* thus must not sleep.
22682268
*/

0 commit comments

Comments
 (0)