Commit f1a3b43c authored by Linus Torvalds's avatar Linus Torvalds

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
parents ac60602a c39f2d9d
...@@ -6,9 +6,6 @@ ...@@ -6,9 +6,6 @@
* USB/RS232 I-Force joysticks and wheels. * USB/RS232 I-Force joysticks and wheels.
*/ */
/*
*/
#include "iforce.h" #include "iforce.h"
/* /*
......
...@@ -6,9 +6,6 @@ ...@@ -6,9 +6,6 @@
* USB/RS232 I-Force joysticks and wheels. * USB/RS232 I-Force joysticks and wheels.
*/ */
/*
*/
#include <asm/unaligned.h> #include <asm/unaligned.h>
#include "iforce.h" #include "iforce.h"
......
...@@ -6,9 +6,6 @@ ...@@ -6,9 +6,6 @@
* USB/RS232 I-Force joysticks and wheels. * USB/RS232 I-Force joysticks and wheels.
*/ */
/*
*/
#include <asm/unaligned.h> #include <asm/unaligned.h>
#include "iforce.h" #include "iforce.h"
......
...@@ -6,9 +6,6 @@ ...@@ -6,9 +6,6 @@
* USB/RS232 I-Force joysticks and wheels. * USB/RS232 I-Force joysticks and wheels.
*/ */
/*
*/
#include <linux/serio.h> #include <linux/serio.h>
#include "iforce.h" #include "iforce.h"
......
...@@ -6,9 +6,6 @@ ...@@ -6,9 +6,6 @@
* USB/RS232 I-Force joysticks and wheels. * USB/RS232 I-Force joysticks and wheels.
*/ */
/*
*/
#include <linux/usb.h> #include <linux/usb.h>
#include "iforce.h" #include "iforce.h"
......
...@@ -6,9 +6,6 @@ ...@@ -6,9 +6,6 @@
* USB/RS232 I-Force joysticks and wheels. * USB/RS232 I-Force joysticks and wheels.
*/ */
/*
*/
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/input.h> #include <linux/input.h>
......
...@@ -71,6 +71,22 @@ config KEYBOARD_AMIGA ...@@ -71,6 +71,22 @@ config KEYBOARD_AMIGA
config ATARI_KBD_CORE config ATARI_KBD_CORE
bool 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 config KEYBOARD_ATARI
tristate "Atari keyboard" tristate "Atari keyboard"
depends on ATARI depends on ATARI
......
...@@ -10,6 +10,7 @@ obj-$(CONFIG_KEYBOARD_ADP5520) += adp5520-keys.o ...@@ -10,6 +10,7 @@ obj-$(CONFIG_KEYBOARD_ADP5520) += adp5520-keys.o
obj-$(CONFIG_KEYBOARD_ADP5588) += adp5588-keys.o obj-$(CONFIG_KEYBOARD_ADP5588) += adp5588-keys.o
obj-$(CONFIG_KEYBOARD_ADP5589) += adp5589-keys.o obj-$(CONFIG_KEYBOARD_ADP5589) += adp5589-keys.o
obj-$(CONFIG_KEYBOARD_AMIGA) += amikbd.o obj-$(CONFIG_KEYBOARD_AMIGA) += amikbd.o
obj-$(CONFIG_KEYBOARD_APPLESPI) += applespi.o
obj-$(CONFIG_KEYBOARD_ATARI) += atakbd.o obj-$(CONFIG_KEYBOARD_ATARI) += atakbd.o
obj-$(CONFIG_KEYBOARD_ATKBD) += atkbd.o obj-$(CONFIG_KEYBOARD_ATKBD) += atkbd.o
obj-$(CONFIG_KEYBOARD_BCM) += bcm-keypad.o obj-$(CONFIG_KEYBOARD_BCM) += bcm-keypad.o
......
...@@ -505,6 +505,7 @@ static int adp5589_gpio_add(struct adp5589_kpad *kpad) ...@@ -505,6 +505,7 @@ static int adp5589_gpio_add(struct adp5589_kpad *kpad)
if (!gpio_data) if (!gpio_data)
return 0; return 0;
kpad->gc.parent = dev;
kpad->gc.ngpio = adp5589_build_gpiomap(kpad, pdata); kpad->gc.ngpio = adp5589_build_gpiomap(kpad, pdata);
if (kpad->gc.ngpio == 0) { if (kpad->gc.ngpio == 0) {
dev_info(dev, "No unused gpios left to export\n"); dev_info(dev, "No unused gpios left to export\n");
......
This diff is collapsed.
/* 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_ */
/* 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) ...@@ -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].regs = &mtk_pmic_regs->keys_regs[index];
keys->keys[index].irq = platform_get_irq(pdev, 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; return keys->keys[index].irq;
}
error = of_property_read_u32(child, error = of_property_read_u32(child,
"linux,keycodes", &keys->keys[index].keycode); "linux,keycodes", &keys->keys[index].keycode);
...@@ -286,6 +288,7 @@ static int mtk_pmic_keys_probe(struct platform_device *pdev) ...@@ -286,6 +288,7 @@ static int mtk_pmic_keys_probe(struct platform_device *pdev)
dev_err(keys->dev, dev_err(keys->dev,
"failed to read key:%d linux,keycode property: %d\n", "failed to read key:%d linux,keycode property: %d\n",
index, error); index, error);
of_node_put(child);
return error; return error;
} }
...@@ -293,8 +296,10 @@ static int mtk_pmic_keys_probe(struct platform_device *pdev) ...@@ -293,8 +296,10 @@ static int mtk_pmic_keys_probe(struct platform_device *pdev)
keys->keys[index].wakeup = true; keys->keys[index].wakeup = true;
error = mtk_pmic_key_setup(keys, &keys->keys[index]); error = mtk_pmic_key_setup(keys, &keys->keys[index]);
if (error) if (error) {
of_node_put(child);
return error; return error;
}
index++; index++;
} }
......
...@@ -198,18 +198,21 @@ static int sun4i_lradc_load_dt_keymap(struct device *dev, ...@@ -198,18 +198,21 @@ static int sun4i_lradc_load_dt_keymap(struct device *dev,
error = of_property_read_u32(pp, "channel", &channel); error = of_property_read_u32(pp, "channel", &channel);
if (error || channel != 0) { if (error || channel != 0) {
dev_err(dev, "%pOFn: Inval channel prop\n", pp); dev_err(dev, "%pOFn: Inval channel prop\n", pp);
of_node_put(pp);
return -EINVAL; return -EINVAL;
} }
error = of_property_read_u32(pp, "voltage", &map->voltage); error = of_property_read_u32(pp, "voltage", &map->voltage);
if (error) { if (error) {
dev_err(dev, "%pOFn: Inval voltage prop\n", pp); dev_err(dev, "%pOFn: Inval voltage prop\n", pp);
of_node_put(pp);
return -EINVAL; return -EINVAL;
} }
error = of_property_read_u32(pp, "linux,code", &map->keycode); error = of_property_read_u32(pp, "linux,code", &map->keycode);
if (error) { if (error) {
dev_err(dev, "%pOFn: Inval linux,code prop\n", pp); dev_err(dev, "%pOFn: Inval linux,code prop\n", pp);
of_node_put(pp);
return -EINVAL; return -EINVAL;
} }
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "psmouse.h" #include "psmouse.h"
#include "alps.h" #include "alps.h"
#include "trackpoint.h"
/* /*
* Definitions for ALPS version 3 and 4 command mode protocol * Definitions for ALPS version 3 and 4 command mode protocol
...@@ -2861,6 +2862,23 @@ static const struct alps_protocol_info *alps_match_table(unsigned char *e7, ...@@ -2861,6 +2862,23 @@ static const struct alps_protocol_info *alps_match_table(unsigned char *e7,
return NULL; return NULL;
} }
static bool alps_is_cs19_trackpoint(struct psmouse *psmouse)
{
u8 param[2] = { 0 };
if (ps2_command(&psmouse->ps2dev,
param, MAKE_PS2_CMD(0, 2, TP_READ_ID)))
return false;
/*
* param[0] contains the trackpoint device variant_id while
* param[1] contains the firmware_id. So far all alps
* trackpoint-only devices have their variant_ids equal
* TP_VARIANT_ALPS and their firmware_ids are in 0x20~0x2f range.
*/
return param[0] == TP_VARIANT_ALPS && ((param[1] & 0xf0) == 0x20);
}
static int alps_identify(struct psmouse *psmouse, struct alps_data *priv) static int alps_identify(struct psmouse *psmouse, struct alps_data *priv)
{ {
const struct alps_protocol_info *protocol; const struct alps_protocol_info *protocol;
...@@ -3161,6 +3179,20 @@ int alps_detect(struct psmouse *psmouse, bool set_properties) ...@@ -3161,6 +3179,20 @@ int alps_detect(struct psmouse *psmouse, bool set_properties)
if (error) if (error)
return error; return error;
/*
* ALPS cs19 is a trackpoint-only device, and uses different
* protocol than DualPoint ones, so we return -EINVAL here and let
* trackpoint.c drive this device. If the trackpoint driver is not
* enabled, the device will fall back to a bare PS/2 mouse.
* If ps2_command() fails here, we depend on the immediately
* followed psmouse_reset() to reset the device to normal state.
*/
if (alps_is_cs19_trackpoint(psmouse)) {
psmouse_dbg(psmouse,
"ALPS CS19 trackpoint-only device detected, ignoring\n");
return -EINVAL;
}
/* /*
* Reset the device to make sure it is fully operational: * Reset the device to make sure it is fully operational:
* on some laptops, like certain Dell Latitudes, we may * on some laptops, like certain Dell Latitudes, we may
......
...@@ -176,6 +176,7 @@ static const char * const smbus_pnp_ids[] = { ...@@ -176,6 +176,7 @@ static const char * const smbus_pnp_ids[] = {
"LEN0093", /* T480 */ "LEN0093", /* T480 */
"LEN0096", /* X280 */ "LEN0096", /* X280 */
"LEN0097", /* X280 -> ALPS trackpoint */ "LEN0097", /* X280 -> ALPS trackpoint */
"LEN009b", /* T580 */
"LEN200f", /* T450s */ "LEN200f", /* T450s */
"LEN2054", /* E480 */ "LEN2054", /* E480 */
"LEN2055", /* E580 */ "LEN2055", /* E580 */
...@@ -705,7 +706,7 @@ static void synaptics_pt_create(struct psmouse *psmouse) ...@@ -705,7 +706,7 @@ static void synaptics_pt_create(struct psmouse *psmouse)
serio->id.type = SERIO_PS_PSTHRU; serio->id.type = SERIO_PS_PSTHRU;
strlcpy(serio->name, "Synaptics pass-through", sizeof(serio->name)); strlcpy(serio->name, "Synaptics pass-through", sizeof(serio->name));
strlcpy(serio->phys, "synaptics-pt/serio0", sizeof(serio->name)); strlcpy(serio->phys, "synaptics-pt/serio0", sizeof(serio->phys));
serio->write = synaptics_pt_write; serio->write = synaptics_pt_write;
serio->start = synaptics_pt_start; serio->start = synaptics_pt_start;
serio->stop = synaptics_pt_stop; serio->stop = synaptics_pt_stop;
......
...@@ -158,7 +158,8 @@ struct trackpoint_data { ...@@ -158,7 +158,8 @@ struct trackpoint_data {
#ifdef CONFIG_MOUSE_PS2_TRACKPOINT #ifdef CONFIG_MOUSE_PS2_TRACKPOINT
int trackpoint_detect(struct psmouse *psmouse, bool set_properties); int trackpoint_detect(struct psmouse *psmouse, bool set_properties);
#else #else
inline int trackpoint_detect(struct psmouse *psmouse, bool set_properties) static inline int trackpoint_detect(struct psmouse *psmouse,
bool set_properties)
{ {
return -ENOSYS; return -ENOSYS;
} }
......
...@@ -75,8 +75,8 @@ struct synth_kbd_keystroke { ...@@ -75,8 +75,8 @@ struct synth_kbd_keystroke {
#define HK_MAXIMUM_MESSAGE_SIZE 256 #define HK_MAXIMUM_MESSAGE_SIZE 256
#define KBD_VSC_SEND_RING_BUFFER_SIZE (10 * PAGE_SIZE) #define KBD_VSC_SEND_RING_BUFFER_SIZE (40 * 1024)
#define KBD_VSC_RECV_RING_BUFFER_SIZE (10 * PAGE_SIZE) #define KBD_VSC_RECV_RING_BUFFER_SIZE (40 * 1024)
#define XTKBD_EMUL0 0xe0 #define XTKBD_EMUL0 0xe0
#define XTKBD_EMUL1 0xe1 #define XTKBD_EMUL1 0xe1
......
...@@ -78,6 +78,7 @@ Scott Hill shill@gtcocalcomp.com ...@@ -78,6 +78,7 @@ Scott Hill shill@gtcocalcomp.com
/* Max size of a single report */ /* Max size of a single report */
#define REPORT_MAX_SIZE 10 #define REPORT_MAX_SIZE 10
#define MAX_COLLECTION_LEVELS 10
/* Bitmask whether pen is in range */ /* Bitmask whether pen is in range */
...@@ -223,8 +224,7 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report, ...@@ -223,8 +224,7 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report,
char maintype = 'x'; char maintype = 'x';
char globtype[12]; char globtype[12];
int indent = 0; int indent = 0;
char indentstr[10] = ""; char indentstr[MAX_COLLECTION_LEVELS + 1] = { 0 };
dev_dbg(ddev, "======>>>>>>PARSE<<<<<<======\n"); dev_dbg(ddev, "======>>>>>>PARSE<<<<<<======\n");
...@@ -350,6 +350,13 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report, ...@@ -350,6 +350,13 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report,
case TAG_MAIN_COL_START: case TAG_MAIN_COL_START:
maintype = 'S'; maintype = 'S';
if (indent == MAX_COLLECTION_LEVELS) {
dev_err(ddev, "Collection level %d would exceed limit of %d\n",
indent + 1,
MAX_COLLECTION_LEVELS);
break;
}
if (data == 0) { if (data == 0) {
dev_dbg(ddev, "======>>>>>> Physical\n"); dev_dbg(ddev, "======>>>>>> Physical\n");
strcpy(globtype, "Physical"); strcpy(globtype, "Physical");
...@@ -369,8 +376,15 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report, ...@@ -369,8 +376,15 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report,
break; break;
case TAG_MAIN_COL_END: case TAG_MAIN_COL_END:
dev_dbg(ddev, "<<<<<<======\n");
maintype = 'E'; maintype = 'E';
if (indent == 0) {
dev_err(ddev, "Collection level already at zero\n");
break;
}
dev_dbg(ddev, "<<<<<<======\n");
indent--; indent--;
for (x = 0; x < indent; x++) for (x = 0; x < indent; x++)
indentstr[x] = '-'; indentstr[x] = '-';
......
...@@ -602,9 +602,8 @@ static int auo_pixcir_probe(struct i2c_client *client, ...@@ -602,9 +602,8 @@ static int auo_pixcir_probe(struct i2c_client *client,
return error; return error;
} }
error = devm_add_action(&client->dev, auo_pixcir_reset, ts); error = devm_add_action_or_reset(&client->dev, auo_pixcir_reset, ts);
if (error) { if (error) {
auo_pixcir_reset(ts);
dev_err(&client->dev, "failed to register reset action, %d\n", dev_err(&client->dev, "failed to register reset action, %d\n",
error); error);
return error; return error;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment