diff options
| author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2015-06-22 12:26:29 -0400 |
|---|---|---|
| committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2015-06-22 12:26:29 -0400 |
| commit | f7ebc4dcdeb1be7209d94a8c0dc602ab24e36ae1 (patch) | |
| tree | 650c1748df35728e2bce1b8c26c064bfea272f63 /drivers/input | |
| parent | 469d7d22cea146e40efe8c330e5164b4d8f13934 (diff) | |
| parent | 84c88ef9affb34f10cb5b66b07e2d496845d1c28 (diff) | |
Merge branch 'next' into for-linus
Prepare first round of input updates for 4.2 merge window.
Diffstat (limited to 'drivers/input')
43 files changed, 1126 insertions, 276 deletions
diff --git a/drivers/input/Kconfig b/drivers/input/Kconfig index a11ff74a5127..a35532ec00e4 100644 --- a/drivers/input/Kconfig +++ b/drivers/input/Kconfig | |||
| @@ -25,6 +25,19 @@ config INPUT | |||
| 25 | 25 | ||
| 26 | if INPUT | 26 | if INPUT |
| 27 | 27 | ||
| 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 | |||
| 28 | config INPUT_FF_MEMLESS | 41 | config INPUT_FF_MEMLESS |
| 29 | tristate "Support for memoryless force-feedback devices" | 42 | tristate "Support for memoryless force-feedback devices" |
| 30 | help | 43 | help |
diff --git a/drivers/input/Makefile b/drivers/input/Makefile index 5ca3f631497f..0c9302ca9954 100644 --- a/drivers/input/Makefile +++ b/drivers/input/Makefile | |||
| @@ -12,6 +12,7 @@ obj-$(CONFIG_INPUT_POLLDEV) += input-polldev.o | |||
| 12 | obj-$(CONFIG_INPUT_SPARSEKMAP) += sparse-keymap.o | 12 | obj-$(CONFIG_INPUT_SPARSEKMAP) += sparse-keymap.o |
| 13 | obj-$(CONFIG_INPUT_MATRIXKMAP) += matrix-keymap.o | 13 | obj-$(CONFIG_INPUT_MATRIXKMAP) += matrix-keymap.o |
| 14 | 14 | ||
| 15 | obj-$(CONFIG_INPUT_LEDS) += input-leds.o | ||
| 15 | obj-$(CONFIG_INPUT_MOUSEDEV) += mousedev.o | 16 | obj-$(CONFIG_INPUT_MOUSEDEV) += mousedev.o |
| 16 | obj-$(CONFIG_INPUT_JOYDEV) += joydev.o | 17 | obj-$(CONFIG_INPUT_JOYDEV) += joydev.o |
| 17 | obj-$(CONFIG_INPUT_EVDEV) += evdev.o | 18 | obj-$(CONFIG_INPUT_EVDEV) += evdev.o |
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c index a18f41b89b6a..9d35499faca4 100644 --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c | |||
| @@ -422,10 +422,7 @@ static int evdev_release(struct inode *inode, struct file *file) | |||
| 422 | 422 | ||
| 423 | evdev_detach_client(evdev, client); | 423 | evdev_detach_client(evdev, client); |
| 424 | 424 | ||
| 425 | if (is_vmalloc_addr(client)) | 425 | kvfree(client); |
| 426 | vfree(client); | ||
| 427 | else | ||
| 428 | kfree(client); | ||
| 429 | 426 | ||
| 430 | evdev_close_device(evdev); | 427 | evdev_close_device(evdev); |
| 431 | 428 | ||
diff --git a/drivers/input/ff-core.c b/drivers/input/ff-core.c index b81c88c43452..8f4a30fccbb6 100644 --- a/drivers/input/ff-core.c +++ b/drivers/input/ff-core.c | |||
| @@ -70,7 +70,7 @@ static int compat_effect(struct ff_device *ff, struct ff_effect *effect) | |||
| 70 | return -EINVAL; | 70 | return -EINVAL; |
| 71 | 71 | ||
| 72 | /* | 72 | /* |
| 73 | * calculate manginude of sine wave as average of rumble's | 73 | * calculate magnitude of sine wave as average of rumble's |
| 74 | * 2/3 of strong magnitude and 1/3 of weak magnitude | 74 | * 2/3 of strong magnitude and 1/3 of weak magnitude |
| 75 | */ | 75 | */ |
| 76 | magnitude = effect->u.rumble.strong_magnitude / 3 + | 76 | magnitude = effect->u.rumble.strong_magnitude / 3 + |
| @@ -213,7 +213,7 @@ static int erase_effect(struct input_dev *dev, int effect_id, | |||
| 213 | /** | 213 | /** |
| 214 | * input_ff_erase - erase a force-feedback effect from device | 214 | * input_ff_erase - erase a force-feedback effect from device |
| 215 | * @dev: input device to erase effect from | 215 | * @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 |
| 217 | * @file: purported owner of the request | 217 | * @file: purported owner of the request |
| 218 | * | 218 | * |
| 219 | * This function erases a force-feedback effect from specified device. | 219 | * This function erases a force-feedback effect from specified device. |
diff --git a/drivers/input/input-leds.c b/drivers/input/input-leds.c new file mode 100644 index 000000000000..074a65ed17bb --- /dev/null +++ b/drivers/input/input-leds.c | |||
| @@ -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) | ||
