diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-04-05 13:21:57 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-04-05 13:21:57 -0700 |
commit | 5414ab31b1e8dec34800201cb5211abf3436129e (patch) | |
tree | 1abb330d904362742b1eb88e62b1e95e60a83f71 /drivers/input/misc | |
parent | 672a9c106966f8d418478830975288b8096bb058 (diff) | |
parent | 664b0bae0b87f69bc9deb098f5e0158b9cf18e04 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Pull input updates from Dmitry Torokhov:
- new driver for PhoenixRC Flight Controller Adapter
- new driver for RAVE SP Power button
- fixes for autosuspend-related deadlocks in a few unput USB dirvers
- support for 2nd wheel in ATech PS/2 mouse
- fix for ALPS trackpoint detection on Thinkpad L570 and Latitude 7370
- bunch of cleanups in various in PS/2 protocols
- other assorted changes and fixes
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (35 commits)
Input: i8042 - enable MUX on Sony VAIO VGN-CS series to fix touchpad
Input: stmfts, s6sy761 - update my e-mail
Input: stmfts - use async probe & suspend/resume to avoid 2s delay
Input: ALPS - fix TrackStick detection on Thinkpad L570 and Latitude 7370
Input: xpad - add PDP device id 0x02a4
Input: alps - report pressure of v3 and v7 trackstick
Input: pxrc - new driver for PhoenixRC Flight Controller Adapter
Input: usbtouchscreen - do not rely on input_dev->users
Input: usbtouchscreen - fix deadlock in autosuspend
Input: pegasus_notetaker - do not rely on input_dev->users
Input: pagasus_notetaker - fix deadlock in autosuspend
Input: synaptics_usb - do not rely on input_dev->users
Input: synaptics_usb - fix deadlock in autosuspend
Input: gpio-keys - add support for wakeup event action
Input: appletouch - use true and false for boolean values
Input: silead - add Chuwi Hi8 support
Input: analog - use get_cycles() on PPC
Input: stmpe-keypad - remove VLA usage
Input: i8042 - add Lenovo ThinkPad L460 to i8042 reset list
Input: add RAVE SP Powerbutton driver
...
Diffstat (limited to 'drivers/input/misc')
-rw-r--r-- | drivers/input/misc/Kconfig | 9 | ||||
-rw-r--r-- | drivers/input/misc/Makefile | 1 | ||||
-rw-r--r-- | drivers/input/misc/rave-sp-pwrbutton.c | 94 |
3 files changed, 104 insertions, 0 deletions
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig index e9770f5e3f77..572b15fa18c2 100644 --- a/drivers/input/misc/Kconfig +++ b/drivers/input/misc/Kconfig @@ -832,4 +832,13 @@ config INPUT_HISI_POWERKEY To compile this driver as a module, choose M here: the module will be called hisi_powerkey. +config INPUT_RAVE_SP_PWRBUTTON + tristate "RAVE SP Power button Driver" + depends on RAVE_SP_CORE + help + Say Y here if you want to enable power key reporting from RAVE SP + + To compile this driver as a module, choose M here: the + module will be called rave-sp-pwrbutton. + endif diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile index eb9c6c3ec530..72cde28649e2 100644 --- a/drivers/input/misc/Makefile +++ b/drivers/input/misc/Makefile @@ -59,6 +59,7 @@ obj-$(CONFIG_INPUT_PMIC8XXX_PWRKEY) += pmic8xxx-pwrkey.o obj-$(CONFIG_INPUT_POWERMATE) += powermate.o obj-$(CONFIG_INPUT_PWM_BEEPER) += pwm-beeper.o obj-$(CONFIG_INPUT_PWM_VIBRA) += pwm-vibra.o +obj-$(CONFIG_INPUT_RAVE_SP_PWRBUTTON) += rave-sp-pwrbutton.o obj-$(CONFIG_INPUT_RB532_BUTTON) += rb532_button.o obj-$(CONFIG_INPUT_REGULATOR_HAPTIC) += regulator-haptic.o obj-$(CONFIG_INPUT_RETU_PWRBUTTON) += retu-pwrbutton.o diff --git a/drivers/input/misc/rave-sp-pwrbutton.c b/drivers/input/misc/rave-sp-pwrbutton.c new file mode 100644 index 000000000000..bcab3cdb7ebd --- /dev/null +++ b/drivers/input/misc/rave-sp-pwrbutton.c @@ -0,0 +1,94 @@ +// SPDX-License-Identifier: GPL-2.0+ +// +// Power Button driver for RAVE SP +// +// Copyright (C) 2017 Zodiac Inflight Innovations +// +// + +#include <linux/input.h> +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/mfd/rave-sp.h> +#include <linux/platform_device.h> + +#define RAVE_SP_EVNT_BUTTON_PRESS (RAVE_SP_EVNT_BASE + 0x00) + +struct rave_sp_power_button { + struct input_dev *idev; + struct notifier_block nb; +}; + +static int rave_sp_power_button_event(struct notifier_block *nb, + unsigned long action, void *data) +{ + struct rave_sp_power_button *pb = + container_of(nb, struct rave_sp_power_button, nb); + const u8 event = rave_sp_action_unpack_event(action); + const u8 value = rave_sp_action_unpack_value(action); + struct input_dev *idev = pb->idev; + + if (event == RAVE_SP_EVNT_BUTTON_PRESS) { + input_report_key(idev, KEY_POWER, value); + input_sync(idev); + + return NOTIFY_STOP; + } + + return NOTIFY_DONE; +} + +static int rave_sp_pwrbutton_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct rave_sp_power_button *pb; + struct input_dev *idev; + int error; + + pb = devm_kzalloc(dev, sizeof(*pb), GFP_KERNEL); + if (!pb) + return -ENOMEM; + + idev = devm_input_allocate_device(dev); + if (!idev) + return -ENOMEM; + + idev->name = pdev->name; + + input_set_capability(idev, EV_KEY, KEY_POWER); + + error = input_register_device(idev); + if (error) + return error; + + pb->idev = idev; + pb->nb.notifier_call = rave_sp_power_button_event; + pb->nb.priority = 128; + + error = devm_rave_sp_register_event_notifier(dev, &pb->nb); + if (error) + return error; + + return 0; +} + +static const struct of_device_id rave_sp_pwrbutton_of_match[] = { + { .compatible = "zii,rave-sp-pwrbutton" }, + {} +}; + +static struct platform_driver rave_sp_pwrbutton_driver = { + .probe = rave_sp_pwrbutton_probe, + .driver = { + .name = KBUILD_MODNAME, + .of_match_table = rave_sp_pwrbutton_of_match, + }, +}; +module_platform_driver(rave_sp_pwrbutton_driver); + +MODULE_DEVICE_TABLE(of, rave_sp_pwrbutton_of_match); +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Andrey Vostrikov <andrey.vostrikov@cogentembedded.com>"); +MODULE_AUTHOR("Nikita Yushchenko <nikita.yoush@cogentembedded.com>"); +MODULE_AUTHOR("Andrey Smirnov <andrew.smirnov@gmail.com>"); +MODULE_DESCRIPTION("RAVE SP Power Button driver"); |