aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-05-14 13:39:08 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-05-14 13:39:08 -0400
commitebcf5bb28241fe3ddc9e786e3816848a10f688b8 (patch)
tree28c8ce0f20c690b0ac2492e034fab34ad89aa9d1 /drivers/input
parent414147d99b928c574ed76e9374a5d2cb77866a29 (diff)
parented835136ee679dc528333c454ca4d1543c5aab76 (diff)
Merge tag 'mfd-next-5.2' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd
Pull MFD updates from Lee Jones: "Core Framework: - Document (kerneldoc) core mfd_add_devices() API New Drivers: - Altera SOCFPGA System Manager - Maxim MAX77650/77651 PMIC - Maxim MAX77663 PMIC - ST Multi-Function eXpander (STMFX) New Device Support: - LEDs support in Intel Cherry Trail Whiskey Cove PMIC - RTC support in SAMSUNG Electronics S2MPA01 PMIC - SAM9X60 support in Atmel HLCDC (High-end LCD Controller) - USB X-Powers AXP 8xx PMICs - Integrated Sensor Hub (ISH) in ChromeOS EC - USB PD Logger in ChromeOS EC - AXP223 in X-Powers AXP series PMICs - Power Supply in X-Powers AXP 803 PMICs - Comet Lake in Intel Low Power Subsystem - Fingerprint MCU in ChromeOS EC - Touchpad MCU in ChromeOS EC - Move TI LM3532 support to LED New Functionality: - max77650, max77620: Add/extend DT support - max77620 power-off - syscon clocking - croc_ec host sleep event Fix-ups: - Trivial; Formatting, spelling, etc; Kconfig, sec-core, ab8500-debugfs - Remove unused functionality; rk808, da9063-* - SPDX conversion; da9063-*, atmel-*, - Adapt/add new register definitions; cs47l35-tables, cs47l90-tables, imx6q-iomuxc-gpr - Fix-up DT bindings; ti-lmu, cirrus,lochnagar - Simply obtaining driver data; ssbi, t7l66xb, tc6387xb, tc6393xb Bug Fixes: - Fix incorrect defined values; max77620, da9063 - Fix device initialisation; twl6040 - Reset device on init; intel-lpss - Fix build warnings when !OF; sun6i-prcm - Register OF match tables; tps65912-spi - Fix DMI matching; intel_quark_i2c_gpio" * tag 'mfd-next-5.2' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (65 commits) mfd: Use dev_get_drvdata() directly mfd: cros_ec: Instantiate properly CrOS Touchpad MCU device mfd: cros_ec: Instantiate properly CrOS FP MCU device mfd: cros_ec: Update the EC feature codes mfd: intel-lpss: Add Intel Comet Lake PCI IDs mfd: lochnagar: Add links to binding docs for sound and hwmon mfd: ab8500-debugfs: Fix a typo ("deubgfs") mfd: imx6sx: Add MQS register definition for iomuxc gpr dt-bindings: mfd: LMU: Fix lm3632 dt binding example mfd: intel_quark_i2c_gpio: Adjust IOT2000 matching mfd: da9063: Fix OTP control register names to match datasheets for DA9063/63L mfd: tps65912-spi: Add missing of table registration mfd: axp20x: Add USB power supply mfd cell to AXP803 mfd: sun6i-prcm: Fix build warning for non-OF configurations mfd: intel-lpss: Set the device in reset state when init platform/chrome: Add support for v1 of host sleep event mfd: cros_ec: Add host_sleep_event_v1 command mfd: cros_ec: Instantiate the CrOS USB PD logger driver mfd: cs47l90: Make DAC_AEC_CONTROL_2 readable mfd: cs47l35: Make DAC_AEC_CONTROL_2 readable ...
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/misc/Kconfig9
-rw-r--r--drivers/input/misc/Makefile1
-rw-r--r--drivers/input/misc/max77650-onkey.c121
3 files changed, 131 insertions, 0 deletions
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index 6dfe9e2fe5b1..54d36f98b426 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -190,6 +190,15 @@ config INPUT_M68K_BEEP
190 tristate "M68k Beeper support" 190 tristate "M68k Beeper support"
191 depends on M68K 191 depends on M68K
192 192
193config INPUT_MAX77650_ONKEY
194 tristate "Maxim MAX77650 ONKEY support"
195 depends on MFD_MAX77650
196 help
197 Support the ONKEY of the MAX77650 PMIC as an input device.
198
199 To compile this driver as a module, choose M here: the module
200 will be called max77650-onkey.
201
193config INPUT_MAX77693_HAPTIC 202config INPUT_MAX77693_HAPTIC
194 tristate "MAXIM MAX77693/MAX77843 haptic controller support" 203 tristate "MAXIM MAX77693/MAX77843 haptic controller support"
195 depends on (MFD_MAX77693 || MFD_MAX77843) && PWM 204 depends on (MFD_MAX77693 || MFD_MAX77843) && PWM
diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
index f38ebbdb05e2..8fd187f314bd 100644
--- a/drivers/input/misc/Makefile
+++ b/drivers/input/misc/Makefile
@@ -44,6 +44,7 @@ obj-$(CONFIG_INPUT_IXP4XX_BEEPER) += ixp4xx-beeper.o
44obj-$(CONFIG_INPUT_KEYSPAN_REMOTE) += keyspan_remote.o 44obj-$(CONFIG_INPUT_KEYSPAN_REMOTE) += keyspan_remote.o
45obj-$(CONFIG_INPUT_KXTJ9) += kxtj9.o 45obj-$(CONFIG_INPUT_KXTJ9) += kxtj9.o
46obj-$(CONFIG_INPUT_M68K_BEEP) += m68kspkr.o 46obj-$(CONFIG_INPUT_M68K_BEEP) += m68kspkr.o
47obj-$(CONFIG_INPUT_MAX77650_ONKEY) += max77650-onkey.o
47obj-$(CONFIG_INPUT_MAX77693_HAPTIC) += max77693-haptic.o 48obj-$(CONFIG_INPUT_MAX77693_HAPTIC) += max77693-haptic.o
48obj-$(CONFIG_INPUT_MAX8925_ONKEY) += max8925_onkey.o 49obj-$(CONFIG_INPUT_MAX8925_ONKEY) += max8925_onkey.o
49obj-$(CONFIG_INPUT_MAX8997_HAPTIC) += max8997_haptic.o 50obj-$(CONFIG_INPUT_MAX8997_HAPTIC) += max8997_haptic.o
diff --git a/drivers/input/misc/max77650-onkey.c b/drivers/input/misc/max77650-onkey.c
new file mode 100644
index 000000000000..fbf6caab7217
--- /dev/null
+++ b/drivers/input/misc/max77650-onkey.c
@@ -0,0 +1,121 @@
1// SPDX-License-Identifier: GPL-2.0
2//
3// Copyright (C) 2018 BayLibre SAS
4// Author: Bartosz Golaszewski <bgolaszewski@baylibre.com>
5//
6// ONKEY driver for MAXIM 77650/77651 charger/power-supply.
7
8#include <linux/i2c.h>
9#include <linux/input.h>
10#include <linux/interrupt.h>
11#include <linux/mfd/max77650.h>
12#include <linux/module.h>
13#include <linux/platform_device.h>
14#include <linux/regmap.h>
15
16#define MAX77650_ONKEY_MODE_MASK BIT(3)
17#define MAX77650_ONKEY_MODE_PUSH 0x00
18#define MAX77650_ONKEY_MODE_SLIDE BIT(3)
19
20struct max77650_onkey {
21 struct input_dev *input;
22 unsigned int code;
23};
24
25static irqreturn_t max77650_onkey_falling(int irq, void *data)
26{
27 struct max77650_onkey *onkey = data;
28
29 input_report_key(onkey->input, onkey->code, 0);
30 input_sync(onkey->input);
31
32 return IRQ_HANDLED;
33}
34
35static irqreturn_t max77650_onkey_rising(int irq, void *data)
36{
37 struct max77650_onkey *onkey = data;
38
39 input_report_key(onkey->input, onkey->code, 1);
40 input_sync(onkey->input);
41
42 return IRQ_HANDLED;
43}
44
45static int max77650_onkey_probe(struct platform_device *pdev)
46{
47 int irq_r, irq_f, error, mode;
48 struct max77650_onkey *onkey;
49 struct device *dev, *parent;
50 struct regmap *map;
51 unsigned int type;
52
53 dev = &pdev->dev;
54 parent = dev->parent;
55
56 map = dev_get_regmap(parent, NULL);
57 if (!map)
58 return -ENODEV;
59
60 onkey = devm_kzalloc(dev, sizeof(*onkey), GFP_KERNEL);
61 if (!onkey)
62 return -ENOMEM;
63
64 error = device_property_read_u32(dev, "linux,code", &onkey->code);
65 if (error)
66 onkey->code = KEY_POWER;
67
68 if (device_property_read_bool(dev, "maxim,onkey-slide")) {
69 mode = MAX77650_ONKEY_MODE_SLIDE;
70 type = EV_SW;
71 } else {
72 mode = MAX77650_ONKEY_MODE_PUSH;
73 type = EV_KEY;
74 }
75
76 error = regmap_update_bits(map, MAX77650_REG_CNFG_GLBL,
77 MAX77650_ONKEY_MODE_MASK, mode);
78 if (error)
79 return error;
80
81 irq_f = platform_get_irq_byname(pdev, "nEN_F");
82 if (irq_f < 0)
83 return irq_f;
84
85 irq_r = platform_get_irq_byname(pdev, "nEN_R");
86 if (irq_r < 0)
87 return irq_r;
88
89 onkey->input = devm_input_allocate_device(dev);
90 if (!onkey->input)
91 return -ENOMEM;
92
93 onkey->input->name = "max77650_onkey";
94 onkey->input->phys = "max77650_onkey/input0";
95 onkey->input->id.bustype = BUS_I2C;
96 input_set_capability(onkey->input, type, onkey->code);
97
98 error = devm_request_any_context_irq(dev, irq_f, max77650_onkey_falling,
99 IRQF_ONESHOT, "onkey-down", onkey);
100 if (error < 0)
101 return error;
102
103 error = devm_request_any_context_irq(dev, irq_r, max77650_onkey_rising,
104 IRQF_ONESHOT, "onkey-up", onkey);
105 if (error < 0)
106 return error;
107
108 return input_register_device(onkey->input);
109}
110
111static struct platform_driver max77650_onkey_driver = {
112 .driver = {
113 .name = "max77650-onkey",
114 },
115 .probe = max77650_onkey_probe,
116};
117module_platform_driver(max77650_onkey_driver);
118
119MODULE_DESCRIPTION("MAXIM 77650/77651 ONKEY driver");
120MODULE_AUTHOR("Bartosz Golaszewski <bgolaszewski@baylibre.com>");
121MODULE_LICENSE("GPL v2");