Skip to content

Commit

Permalink
Merge branch 'next' into for-linus
Browse files Browse the repository at this point in the history
Prepare first round of input updates for 4.2 merge window.
  • Loading branch information
Dmitry Torokhov committed Jun 22, 2015
2 parents 469d7d2 + 84c88ef commit f7ebc4d
Show file tree
Hide file tree
Showing 53 changed files with 1,277 additions and 374 deletions.
3 changes: 1 addition & 2 deletions Documentation/devicetree/bindings/i2c/trivial-devices.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ adi,adt7475 +/-1C TDM Extended Temp Range I.C
adi,adt7476 +/-1C TDM Extended Temp Range I.C
adi,adt7490 +/-1C TDM Extended Temp Range I.C
adi,adxl345 Three-Axis Digital Accelerometer
adi,adxl346 Three-Axis Digital Accelerometer
adi,adxl34x Three-Axis Digital Accelerometer
adi,adxl346 Three-Axis Digital Accelerometer (backward-compatibility value "adi,adxl345" must be listed too)
at,24c08 i2c serial eeprom (24cxx)
atmel,24c00 i2c serial eeprom (24cxx)
atmel,24c01 i2c serial eeprom (24cxx)
Expand Down
17 changes: 17 additions & 0 deletions Documentation/devicetree/bindings/input/ti,drv2665.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
* Texas Instruments - drv2665 Haptics driver

Required properties:
- compatible - "ti,drv2665" - DRV2665
- reg - I2C slave address
- vbat-supply - Required supply regulator

Example:

haptics: haptics@59 {
compatible = "ti,drv2665";
reg = <0x59>;
vbat-supply = <&vbat>;
};

For more product information please see the link below:
http://www.ti.com/product/drv2665
3 changes: 0 additions & 3 deletions Documentation/leds/leds-class.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
LED handling under Linux
========================

If you're reading this and thinking about keyboard leds, these are
handled by the input subsystem and the led class is *not* needed.

In its simplest form, the LED class just allows control of LEDs from
userspace. LEDs appear in /sys/class/leds/. The maximum brightness of the
LED is defined in max_brightness file. The brightness file will set the brightness
Expand Down
1 change: 0 additions & 1 deletion MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -5043,7 +5043,6 @@ F: include/linux/input/
INPUT MULTITOUCH (MT) PROTOCOL
M: Henrik Rydberg <rydberg@bitmath.org>
L: linux-input@vger.kernel.org
T: git git://git.kernel.org/pub/scm/linux/kernel/git/rydberg/input-mt.git
S: Odd fixes
F: Documentation/input/multi-touch-protocol.txt
F: drivers/input/input-mt.c
Expand Down
13 changes: 13 additions & 0 deletions drivers/input/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,19 @@ config INPUT

if INPUT

config INPUT_LEDS
tristate "Export input device LEDs in sysfs"
depends on LEDS_CLASS
default INPUT
help
Say Y here if you would like to export LEDs on input devices
as standard LED class devices in sysfs.

If unsure, say Y.

To compile this driver as a module, choose M here: the
module will be called input-leds.

config INPUT_FF_MEMLESS
tristate "Support for memoryless force-feedback devices"
help
Expand Down
1 change: 1 addition & 0 deletions drivers/input/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ obj-$(CONFIG_INPUT_POLLDEV) += input-polldev.o
obj-$(CONFIG_INPUT_SPARSEKMAP) += sparse-keymap.o
obj-$(CONFIG_INPUT_MATRIXKMAP) += matrix-keymap.o

obj-$(CONFIG_INPUT_LEDS) += input-leds.o
obj-$(CONFIG_INPUT_MOUSEDEV) += mousedev.o
obj-$(CONFIG_INPUT_JOYDEV) += joydev.o
obj-$(CONFIG_INPUT_EVDEV) += evdev.o
Expand Down
5 changes: 1 addition & 4 deletions drivers/input/evdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -422,10 +422,7 @@ static int evdev_release(struct inode *inode, struct file *file)

evdev_detach_client(evdev, client);

if (is_vmalloc_addr(client))
vfree(client);
else
kfree(client);
kvfree(client);

evdev_close_device(evdev);

Expand Down
4 changes: 2 additions & 2 deletions drivers/input/ff-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ static int compat_effect(struct ff_device *ff, struct ff_effect *effect)
return -EINVAL;

/*
* calculate manginude of sine wave as average of rumble's
* calculate magnitude of sine wave as average of rumble's
* 2/3 of strong magnitude and 1/3 of weak magnitude
*/
magnitude = effect->u.rumble.strong_magnitude / 3 +
Expand Down Expand Up @@ -213,7 +213,7 @@ static int erase_effect(struct input_dev *dev, int effect_id,
/**
* input_ff_erase - erase a force-feedback effect from device
* @dev: input device to erase effect from
* @effect_id: id of the ffect to be erased
* @effect_id: id of the effect to be erased
* @file: purported owner of the request
*
* This function erases a force-feedback effect from specified device.
Expand Down
212 changes: 212 additions & 0 deletions drivers/input/input-leds.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
/*
* LED support for the input layer
*
* Copyright 2010-2015 Samuel Thibault <samuel.thibault@ens-lyon.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/

#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/leds.h>
#include <linux/input.h>

#if IS_ENABLED(CONFIG_VT)
#define VT_TRIGGER(_name) .trigger = _name
#else
#define VT_TRIGGER(_name) .trigger = NULL
#endif

static const struct {
const char *name;
const char *trigger;
} input_led_info[LED_CNT] = {
[LED_NUML] = { "numlock", VT_TRIGGER("kbd-numlock") },
[LED_CAPSL] = { "capslock", VT_TRIGGER("kbd-capslock") },
[LED_SCROLLL] = { "scrolllock", VT_TRIGGER("kbd-scrolllock") },
[LED_COMPOSE] = { "compose" },
[LED_KANA] = { "kana", VT_TRIGGER("kbd-kanalock") },
[LED_SLEEP] = { "sleep" } ,
[LED_SUSPEND] = { "suspend" },
[LED_MUTE] = { "mute" },
[LED_MISC] = { "misc" },
[LED_MAIL] = { "mail" },
[LED_CHARGING] = { "charging" },
};

struct input_led {
struct led_classdev cdev;
struct input_handle *handle;
unsigned int code; /* One of LED_* constants */
};

struct input_leds {
struct input_handle handle;
unsigned int num_leds;
struct input_led leds[];
};

static enum led_brightness input_leds_brightness_get(struct led_classdev *cdev)
{
struct input_led *led = container_of(cdev, struct input_led, cdev);
struct input_dev *input = led->handle->dev;

return test_bit(led->code, input->led) ? cdev->max_brightness : 0;
}

static void input_leds_brightness_set(struct led_classdev *cdev,
enum led_brightness brightness)
{
struct input_led *led = container_of(cdev, struct input_led, cdev);

input_inject_event(led->handle, EV_LED, led->code, !!brightness);
}

static void input_leds_event(struct input_handle *handle, unsigned int type,
unsigned int code, int value)
{
}

static int input_leds_connect(struct input_handler *handler,
struct input_dev *dev,
const struct input_device_id *id)
{
struct input_leds *leds;
unsigned int num_leds;
unsigned int led_code;
int led_no;
int error;

num_leds = bitmap_weight(dev->ledbit, LED_CNT);
if (!num_leds)
return -ENXIO;

leds = kzalloc(sizeof(*leds) + num_leds * sizeof(*leds->leds),
GFP_KERNEL);
if (!leds)
return -ENOMEM;

leds->num_leds = num_leds;

leds->handle.dev = dev;
leds->handle.handler = handler;
leds->handle.name = "leds";
leds->handle.private = leds;

error = input_register_handle(&leds->handle);
if (error)
goto err_free_mem;

error = input_open_device(&leds->handle);
if (error)
goto err_unregister_handle;

led_no = 0;
for_each_set_bit(led_code, dev->ledbit, LED_CNT) {
struct input_led *led = &leds->leds[led_no];

led->handle = &leds->handle;
led->code = led_code;

if (WARN_ON(!input_led_info[led_code].name))
continue;

led->cdev.name = kasprintf(GFP_KERNEL, "%s::%s",
dev_name(&dev->dev),
input_led_info[led_code].name);
if (!led->cdev.name) {
error = -ENOMEM;
goto err_unregister_leds;
}

led->cdev.max_brightness = 1;
led->cdev.brightness_get = input_leds_brightness_get;
led->cdev.brightness_set = input_leds_brightness_set;
led->cdev.default_trigger = input_led_info[led_code].trigger;

error = led_classdev_register(&dev->dev, &led->cdev);
if (error) {
dev_err(&dev->dev, "failed to register LED %s: %d\n",
led->cdev.name, error);
kfree(led->cdev.name);
goto err_unregister_leds;
}

led_no++;
}

return 0;

err_unregister_leds:
while (--led_no >= 0) {
struct input_led *led = &leds->leds[led_no];

led_classdev_unregister(&led->cdev);
kfree(led->cdev.name);
}

input_close_device(&leds->handle);

err_unregister_handle:
input_unregister_handle(&leds->handle);

err_free_mem:
kfree(leds);
return error;
}

static void input_leds_disconnect(struct input_handle *handle)
{
struct input_leds *leds = handle->private;
int i;

for (i = 0; i < leds->num_leds; i++) {
struct input_led *led = &leds->leds[i];

led_classdev_unregister(&led->cdev);
kfree(led->cdev.name);
}

input_close_device(handle);
input_unregister_handle(handle);

kfree(leds);
}

static const struct input_device_id input_leds_ids[] = {
{
.flags = INPUT_DEVICE_ID_MATCH_EVBIT,
.evbit = { BIT_MASK(EV_LED) },
},
{ },
};
MODULE_DEVICE_TABLE(input, input_leds_ids);

static struct input_handler input_leds_handler = {
.event = input_leds_event,
.connect = input_leds_connect,
.disconnect = input_leds_disconnect,
.name = "leds",
.id_table = input_leds_ids,
};

static int __init input_leds_init(void)
{
return input_register_handler(&input_leds_handler);
}
module_init(input_leds_init);

static void __exit input_leds_exit(void)
{
input_unregister_handler(&input_leds_handler);
}
module_exit(input_leds_exit);

MODULE_AUTHOR("Samuel Thibault <samuel.thibault@ens-lyon.org>");
MODULE_AUTHOR("Dmitry Torokhov <dmitry.torokhov@gmail.com>");
MODULE_DESCRIPTION("Input -> LEDs Bridge");
MODULE_LICENSE("GPL v2");
2 changes: 1 addition & 1 deletion drivers/input/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -2262,7 +2262,7 @@ EXPORT_SYMBOL(input_unregister_handler);
*
* Iterate over @bus's list of devices, and call @fn for each, passing
* it @data and stop when @fn returns a non-zero value. The function is
* using RCU to traverse the list and therefore may be usind in atonic
* using RCU to traverse the list and therefore may be using in atomic
* contexts. The @fn callback is invoked from RCU critical section and
* thus must not sleep.
*/
Expand Down
1 change: 1 addition & 0 deletions drivers/input/keyboard/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@ config KEYBOARD_MAPLE

config KEYBOARD_MAX7359
tristate "Maxim MAX7359 Key Switch Controller"
select INPUT_MATRIXKMAP
depends on I2C
help
If you say yes here you get support for the Maxim MAX7359 Key
Expand Down
6 changes: 3 additions & 3 deletions drivers/input/keyboard/adp5589-keys.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@
#define LOGIC2_STAT (1 << 7) /* ADP5589 only */
#define LOGIC1_STAT (1 << 6)
#define LOCK_STAT (1 << 5) /* ADP5589 only */
#define KEC 0xF
#define KEC 0x1F

/* PIN_CONFIG_D Register */
#define C4_EXTEND_CFG (1 << 6) /* RESET2 */
Expand Down Expand Up @@ -726,7 +726,7 @@ static int adp5589_setup(struct adp5589_kpad *kpad)

pull_mask |= val << (2 * (i & 0x3));

if (i == 3 || i == kpad->var->max_row_num) {
if (i % 4 == 3 || i == kpad->var->max_row_num) {
ret |= adp5589_write(client, reg(ADP5585_RPULL_CONFIG_A)
+ (i >> 2), pull_mask);
pull_mask = 0;
Expand All @@ -746,7 +746,7 @@ static int adp5589_setup(struct adp5589_kpad *kpad)

pull_mask |= val << (2 * (i & 0x3));

if (i == 3 || i == kpad->var->max_col_num) {
if (i % 4 == 3 || i == kpad->var->max_col_num) {
ret |= adp5589_write(client,
reg(ADP5585_RPULL_CONFIG_C) +
(i >> 2), pull_mask);
Expand Down
7 changes: 1 addition & 6 deletions drivers/input/keyboard/clps711x-keypad.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,9 @@ static int clps711x_keypad_probe(struct platform_device *pdev)
for (i = 0; i < priv->row_count; i++) {
struct clps711x_gpio_data *data = &priv->gpio_data[i];

data->desc = devm_gpiod_get_index(dev, "row", i);
if (!data->desc)
return -EINVAL;

data->desc = devm_gpiod_get_index(dev, "row", i, GPIOD_IN);
if (IS_ERR(data->desc))
return PTR_ERR(data->desc);

gpiod_direction_input(data->desc);
}

err = of_property_read_u32(np, "poll-interval", &poll_interval);
Expand Down
Loading

0 comments on commit f7ebc4d

Please sign in to comment.