Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Pull more input updates from Dmitry Torokhov: - Apple SPI keyboard and trackpad driver for newer Macs - ALPS driver will ignore trackpoint-only devices to give the trackpoint driver a chance to handle them properly - another Lenovo is switched over to SMbus from PS/2 - assorted driver fixups. * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: Input: alps - fix a mismatch between a condition check and its comment Input: psmouse - fix build error of multiple definition Input: applespi - remove set but not used variables 'sts' Input: add Apple SPI keyboard and trackpad driver Input: alps - don't handle ALPS cs19 trackpoint-only device Input: hyperv-keyboard - remove dependencies on PAGE_SIZE for ring buffer Input: adp5589 - initialize GPIO controller parent device Input: iforce - remove empty multiline comments Input: synaptics - fix misuse of strlcpy Input: auo-pixcir-ts - switch to using devm_add_action_or_reset() Input: gtco - bounds check collection indent level Input: mtk-pmic-keys - add of_node_put() before return Input: sun4i-lradc-keys - add of_node_put() before return Input: synaptics - whitelist Lenovo T580 SMBus intertouch
This commit is contained in:
@@ -71,6 +71,22 @@ config KEYBOARD_AMIGA
|
||||
config ATARI_KBD_CORE
|
||||
bool
|
||||
|
||||
config KEYBOARD_APPLESPI
|
||||
tristate "Apple SPI keyboard and trackpad"
|
||||
depends on ACPI && EFI
|
||||
depends on SPI
|
||||
depends on X86 || COMPILE_TEST
|
||||
help
|
||||
Say Y here if you are running Linux on any Apple MacBook8,1 or later,
|
||||
or any MacBookPro13,* or MacBookPro14,*.
|
||||
|
||||
You will also need to enable appropriate SPI master controllers:
|
||||
spi_pxa2xx_platform and spi_pxa2xx_pci for MacBook8,1, and
|
||||
spi_pxa2xx_platform and intel_lpss_pci for the rest.
|
||||
|
||||
To compile this driver as a module, choose M here: the
|
||||
module will be called applespi.
|
||||
|
||||
config KEYBOARD_ATARI
|
||||
tristate "Atari keyboard"
|
||||
depends on ATARI
|
||||
|
@@ -10,6 +10,7 @@ obj-$(CONFIG_KEYBOARD_ADP5520) += adp5520-keys.o
|
||||
obj-$(CONFIG_KEYBOARD_ADP5588) += adp5588-keys.o
|
||||
obj-$(CONFIG_KEYBOARD_ADP5589) += adp5589-keys.o
|
||||
obj-$(CONFIG_KEYBOARD_AMIGA) += amikbd.o
|
||||
obj-$(CONFIG_KEYBOARD_APPLESPI) += applespi.o
|
||||
obj-$(CONFIG_KEYBOARD_ATARI) += atakbd.o
|
||||
obj-$(CONFIG_KEYBOARD_ATKBD) += atkbd.o
|
||||
obj-$(CONFIG_KEYBOARD_BCM) += bcm-keypad.o
|
||||
|
@@ -505,6 +505,7 @@ static int adp5589_gpio_add(struct adp5589_kpad *kpad)
|
||||
if (!gpio_data)
|
||||
return 0;
|
||||
|
||||
kpad->gc.parent = dev;
|
||||
kpad->gc.ngpio = adp5589_build_gpiomap(kpad, pdata);
|
||||
if (kpad->gc.ngpio == 0) {
|
||||
dev_info(dev, "No unused gpios left to export\n");
|
||||
|
1977
drivers/input/keyboard/applespi.c
Normal file
1977
drivers/input/keyboard/applespi.c
Normal file
File diff suppressed because it is too large
Load Diff
29
drivers/input/keyboard/applespi.h
Normal file
29
drivers/input/keyboard/applespi.h
Normal file
@@ -0,0 +1,29 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* MacBook (Pro) SPI keyboard and touchpad driver
|
||||
*
|
||||
* Copyright (c) 2015-2019 Federico Lorenzi
|
||||
* Copyright (c) 2017-2019 Ronald Tschalär
|
||||
*/
|
||||
|
||||
#ifndef _APPLESPI_H_
|
||||
#define _APPLESPI_H_
|
||||
|
||||
enum applespi_evt_type {
|
||||
ET_CMD_TP_INI = BIT(0),
|
||||
ET_CMD_BL = BIT(1),
|
||||
ET_CMD_CL = BIT(2),
|
||||
ET_RD_KEYB = BIT(8),
|
||||
ET_RD_TPAD = BIT(9),
|
||||
ET_RD_UNKN = BIT(10),
|
||||
ET_RD_IRQ = BIT(11),
|
||||
ET_RD_CRC = BIT(12),
|
||||
};
|
||||
|
||||
enum applespi_pkt_type {
|
||||
PT_READ,
|
||||
PT_WRITE,
|
||||
PT_STATUS,
|
||||
};
|
||||
|
||||
#endif /* _APPLESPI_H_ */
|
93
drivers/input/keyboard/applespi_trace.h
Normal file
93
drivers/input/keyboard/applespi_trace.h
Normal file
@@ -0,0 +1,93 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* MacBook (Pro) SPI keyboard and touchpad driver
|
||||
*
|
||||
* Copyright (c) 2015-2019 Federico Lorenzi
|
||||
* Copyright (c) 2017-2019 Ronald Tschalär
|
||||
*/
|
||||
|
||||
#undef TRACE_SYSTEM
|
||||
#define TRACE_SYSTEM applespi
|
||||
|
||||
#if !defined(_APPLESPI_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ)
|
||||
#define _APPLESPI_TRACE_H_
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/tracepoint.h>
|
||||
|
||||
#include "applespi.h"
|
||||
|
||||
DECLARE_EVENT_CLASS(dump_message_template,
|
||||
TP_PROTO(enum applespi_evt_type evt_type,
|
||||
enum applespi_pkt_type pkt_type,
|
||||
u8 *buf,
|
||||
size_t len),
|
||||
|
||||
TP_ARGS(evt_type, pkt_type, buf, len),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__field(enum applespi_evt_type, evt_type)
|
||||
__field(enum applespi_pkt_type, pkt_type)
|
||||
__field(size_t, len)
|
||||
__dynamic_array(u8, buf, len)
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
__entry->evt_type = evt_type;
|
||||
__entry->pkt_type = pkt_type;
|
||||
__entry->len = len;
|
||||
memcpy(__get_dynamic_array(buf), buf, len);
|
||||
),
|
||||
|
||||
TP_printk("%-6s: %s",
|
||||
__print_symbolic(__entry->pkt_type,
|
||||
{ PT_READ, "read" },
|
||||
{ PT_WRITE, "write" },
|
||||
{ PT_STATUS, "status" }
|
||||
),
|
||||
__print_hex(__get_dynamic_array(buf), __entry->len))
|
||||
);
|
||||
|
||||
#define DEFINE_DUMP_MESSAGE_EVENT(name) \
|
||||
DEFINE_EVENT(dump_message_template, name, \
|
||||
TP_PROTO(enum applespi_evt_type evt_type, \
|
||||
enum applespi_pkt_type pkt_type, \
|
||||
u8 *buf, \
|
||||
size_t len), \
|
||||
TP_ARGS(evt_type, pkt_type, buf, len) \
|
||||
)
|
||||
|
||||
DEFINE_DUMP_MESSAGE_EVENT(applespi_tp_ini_cmd);
|
||||
DEFINE_DUMP_MESSAGE_EVENT(applespi_backlight_cmd);
|
||||
DEFINE_DUMP_MESSAGE_EVENT(applespi_caps_lock_cmd);
|
||||
DEFINE_DUMP_MESSAGE_EVENT(applespi_keyboard_data);
|
||||
DEFINE_DUMP_MESSAGE_EVENT(applespi_touchpad_data);
|
||||
DEFINE_DUMP_MESSAGE_EVENT(applespi_unknown_data);
|
||||
DEFINE_DUMP_MESSAGE_EVENT(applespi_bad_crc);
|
||||
|
||||
TRACE_EVENT(applespi_irq_received,
|
||||
TP_PROTO(enum applespi_evt_type evt_type,
|
||||
enum applespi_pkt_type pkt_type),
|
||||
|
||||
TP_ARGS(evt_type, pkt_type),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__field(enum applespi_evt_type, evt_type)
|
||||
__field(enum applespi_pkt_type, pkt_type)
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
__entry->evt_type = evt_type;
|
||||
__entry->pkt_type = pkt_type;
|
||||
),
|
||||
|
||||
"\n"
|
||||
);
|
||||
|
||||
#endif /* _APPLESPI_TRACE_H_ */
|
||||
|
||||
/* This part must be outside protection */
|
||||
#undef TRACE_INCLUDE_PATH
|
||||
#define TRACE_INCLUDE_PATH ../../drivers/input/keyboard
|
||||
#define TRACE_INCLUDE_FILE applespi_trace
|
||||
#include <trace/define_trace.h>
|
@@ -277,8 +277,10 @@ static int mtk_pmic_keys_probe(struct platform_device *pdev)
|
||||
keys->keys[index].regs = &mtk_pmic_regs->keys_regs[index];
|
||||
|
||||
keys->keys[index].irq = platform_get_irq(pdev, index);
|
||||
if (keys->keys[index].irq < 0)
|
||||
if (keys->keys[index].irq < 0) {
|
||||
of_node_put(child);
|
||||
return keys->keys[index].irq;
|
||||
}
|
||||
|
||||
error = of_property_read_u32(child,
|
||||
"linux,keycodes", &keys->keys[index].keycode);
|
||||
@@ -286,6 +288,7 @@ static int mtk_pmic_keys_probe(struct platform_device *pdev)
|
||||
dev_err(keys->dev,
|
||||
"failed to read key:%d linux,keycode property: %d\n",
|
||||
index, error);
|
||||
of_node_put(child);
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -293,8 +296,10 @@ static int mtk_pmic_keys_probe(struct platform_device *pdev)
|
||||
keys->keys[index].wakeup = true;
|
||||
|
||||
error = mtk_pmic_key_setup(keys, &keys->keys[index]);
|
||||
if (error)
|
||||
if (error) {
|
||||
of_node_put(child);
|
||||
return error;
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
@@ -198,18 +198,21 @@ static int sun4i_lradc_load_dt_keymap(struct device *dev,
|
||||
error = of_property_read_u32(pp, "channel", &channel);
|
||||
if (error || channel != 0) {
|
||||
dev_err(dev, "%pOFn: Inval channel prop\n", pp);
|
||||
of_node_put(pp);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
error = of_property_read_u32(pp, "voltage", &map->voltage);
|
||||
if (error) {
|
||||
dev_err(dev, "%pOFn: Inval voltage prop\n", pp);
|
||||
of_node_put(pp);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
error = of_property_read_u32(pp, "linux,code", &map->keycode);
|
||||
if (error) {
|
||||
dev_err(dev, "%pOFn: Inval linux,code prop\n", pp);
|
||||
of_node_put(pp);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user