Skip to content

Commit

Permalink
Merge branch 'next' into for-linus
Browse files Browse the repository at this point in the history
Prepare second round of updates for 4.1 merge window.
  • Loading branch information
dtor committed Apr 21, 2015
2 parents 85a3685 + c9eeb50 commit 4885338
Show file tree
Hide file tree
Showing 18 changed files with 806 additions and 42 deletions.
9 changes: 7 additions & 2 deletions Documentation/input/alps.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ PS/2 packet format

Note that the device never signals overflow condition.

For protocol version 2 devices when the trackpoint is used, and no fingers
are on the touchpad, the M R L bits signal the combined status of both the
pointingstick and touchpad buttons.

ALPS Absolute Mode - Protocol Version 1
--------------------------------------

Expand All @@ -107,15 +111,16 @@ ALPS Absolute Mode - Protocol Version 1
ALPS Absolute Mode - Protocol Version 2
---------------------------------------

byte 0: 1 ? ? ? 1 ? ? ?
byte 0: 1 ? ? ? 1 PSM PSR PSL
byte 1: 0 x6 x5 x4 x3 x2 x1 x0
byte 2: 0 x10 x9 x8 x7 ? fin ges
byte 3: 0 y9 y8 y7 1 M R L
byte 4: 0 y6 y5 y4 y3 y2 y1 y0
byte 5: 0 z6 z5 z4 z3 z2 z1 z0

Protocol Version 2 DualPoint devices send standard PS/2 mouse packets for
the DualPoint Stick.
the DualPoint Stick. For non interleaved dualpoint devices the pointingstick
buttons get reported separately in the PSM, PSR and PSL bits.

Dualpoint device -- interleaved packet format
---------------------------------------------
Expand Down
8 changes: 8 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -10530,6 +10530,14 @@ L: [email protected]
S: Maintained
F: drivers/misc/vmw_balloon.c

VMWARE VMMOUSE SUBDRIVER
M: "VMware Graphics" <[email protected]>
M: "VMware, Inc." <[email protected]>
L: [email protected]
S: Maintained
F: drivers/input/mouse/vmmouse.c
F: drivers/input/mouse/vmmouse.h

VMWARE VMXNET3 ETHERNET DRIVER
M: Shreyas Bhatewara <[email protected]>
M: "VMware, Inc." <[email protected]>
Expand Down
10 changes: 4 additions & 6 deletions drivers/input/ff-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@

/* #define DEBUG */

#define pr_fmt(fmt) KBUILD_BASENAME ": " fmt

#include <linux/input.h>
#include <linux/module.h>
#include <linux/mutex.h>
Expand Down Expand Up @@ -116,15 +114,15 @@ int input_ff_upload(struct input_dev *dev, struct ff_effect *effect,

if (effect->type < FF_EFFECT_MIN || effect->type > FF_EFFECT_MAX ||
!test_bit(effect->type, dev->ffbit)) {
pr_debug("invalid or not supported effect type in upload\n");
dev_dbg(&dev->dev, "invalid or not supported effect type in upload\n");
return -EINVAL;
}

if (effect->type == FF_PERIODIC &&
(effect->u.periodic.waveform < FF_WAVEFORM_MIN ||
effect->u.periodic.waveform > FF_WAVEFORM_MAX ||
!test_bit(effect->u.periodic.waveform, dev->ffbit))) {
pr_debug("invalid or not supported wave form in upload\n");
dev_dbg(&dev->dev, "invalid or not supported wave form in upload\n");
return -EINVAL;
}

Expand Down Expand Up @@ -246,7 +244,7 @@ static int flush_effects(struct input_dev *dev, struct file *file)
struct ff_device *ff = dev->ff;
int i;

pr_debug("flushing now\n");
dev_dbg(&dev->dev, "flushing now\n");

mutex_lock(&ff->mutex);

Expand Down Expand Up @@ -316,7 +314,7 @@ int input_ff_create(struct input_dev *dev, unsigned int max_effects)
int i;

if (!max_effects) {
pr_err("cannot allocate device without any effects\n");
dev_err(&dev->dev, "cannot allocate device without any effects\n");
return -EINVAL;
}

Expand Down
21 changes: 20 additions & 1 deletion drivers/input/joystick/xpad.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,14 @@
* - the iForce driver drivers/char/joystick/iforce.c
* - the skeleton-driver drivers/usb/usb-skeleton.c
* - Xbox 360 information http://www.free60.org/wiki/Gamepad
* - Xbox One information https://github.com/quantus/xbox-one-controller-protocol
*
* Thanks to:
* - ITO Takayuki for providing essential xpad information on his website
* - Vojtech Pavlik - iforce driver / input subsystem
* - Greg Kroah-Hartman - usb-skeleton driver
* - XBOX Linux project - extra USB id's
* - Pekka Pöyry (quantus) - Xbox One controller reverse engineering
*
* TODO:
* - fine tune axes (especially trigger axes)
Expand Down Expand Up @@ -828,6 +830,23 @@ static int xpad_play_effect(struct input_dev *dev, void *data, struct ff_effect

return usb_submit_urb(xpad->irq_out, GFP_ATOMIC);

case XTYPE_XBOXONE:
xpad->odata[0] = 0x09; /* activate rumble */
xpad->odata[1] = 0x08;
xpad->odata[2] = 0x00;
xpad->odata[3] = 0x08; /* continuous effect */
xpad->odata[4] = 0x00; /* simple rumble mode */
xpad->odata[5] = 0x03; /* L and R actuator only */
xpad->odata[6] = 0x00; /* TODO: LT actuator */
xpad->odata[7] = 0x00; /* TODO: RT actuator */
xpad->odata[8] = strong / 256; /* left actuator */
xpad->odata[9] = weak / 256; /* right actuator */
xpad->odata[10] = 0x80; /* length of pulse */
xpad->odata[11] = 0x00; /* stop period of pulse */
xpad->irq_out->transfer_buffer_length = 12;

return usb_submit_urb(xpad->irq_out, GFP_ATOMIC);

default:
dev_dbg(&xpad->dev->dev,
"%s - rumble command sent to unsupported xpad type: %d\n",
Expand All @@ -841,7 +860,7 @@ static int xpad_play_effect(struct input_dev *dev, void *data, struct ff_effect

static int xpad_init_ff(struct usb_xpad *xpad)
{
if (xpad->xtype == XTYPE_UNKNOWN || xpad->xtype == XTYPE_XBOXONE)
if (xpad->xtype == XTYPE_UNKNOWN)
return 0;

input_set_capability(xpad->dev, EV_FF, FF_RUMBLE);
Expand Down
4 changes: 2 additions & 2 deletions drivers/input/keyboard/lm8333.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* LM8333 keypad driver
* Copyright (C) 2012 Wolfram Sang, Pengutronix <w.sang@pengutronix.de>
* Copyright (C) 2012 Wolfram Sang, Pengutronix <kernel@pengutronix.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -231,6 +231,6 @@ static struct i2c_driver lm8333_driver = {
};
module_i2c_driver(lm8333_driver);

MODULE_AUTHOR("Wolfram Sang <w.sang@pengutronix.de>");
MODULE_AUTHOR("Wolfram Sang <kernel@pengutronix.de>");
MODULE_DESCRIPTION("LM8333 keyboard driver");
MODULE_LICENSE("GPL v2");
12 changes: 12 additions & 0 deletions drivers/input/mouse/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,18 @@ config MOUSE_PS2_FOCALTECH

If unsure, say Y.

config MOUSE_PS2_VMMOUSE
bool "Virtual mouse (vmmouse)"
depends on MOUSE_PS2 && X86 && HYPERVISOR_GUEST
help
Say Y here if you are running under control of VMware hypervisor
(ESXi, Workstation or Fusion). Also make sure that when you enable
this option, you remove the xf86-input-vmmouse user-space driver
or upgrade it to at least xf86-input-vmmouse 13.0.1, which doesn't
load in the presence of an in-kernel vmmouse driver.

If unsure, say N.

config MOUSE_SERIAL
tristate "Serial mouse"
select SERIO
Expand Down
1 change: 1 addition & 0 deletions drivers/input/mouse/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ psmouse-$(CONFIG_MOUSE_PS2_SENTELIC) += sentelic.o
psmouse-$(CONFIG_MOUSE_PS2_TRACKPOINT) += trackpoint.o
psmouse-$(CONFIG_MOUSE_PS2_TOUCHKIT) += touchkit_ps2.o
psmouse-$(CONFIG_MOUSE_PS2_CYPRESS) += cypress_ps2.o
psmouse-$(CONFIG_MOUSE_PS2_VMMOUSE) += vmmouse.o

elan_i2c-objs := elan_i2c_core.o
elan_i2c-$(CONFIG_MOUSE_ELAN_I2C_I2C) += elan_i2c_i2c.o
Expand Down
4 changes: 2 additions & 2 deletions drivers/input/mouse/cyapa.c
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ static ssize_t cyapa_update_suspend_scanrate(struct device *dev,
} else if (sysfs_streq(buf, OFF_MODE_NAME)) {
cyapa->suspend_power_mode = PWR_MODE_OFF;
} else if (!kstrtou16(buf, 10, &sleep_time)) {
cyapa->suspend_sleep_time = max_t(u16, sleep_time, 1000);
cyapa->suspend_sleep_time = min_t(u16, sleep_time, 1000);
cyapa->suspend_power_mode =
cyapa_sleep_time_to_pwr_cmd(cyapa->suspend_sleep_time);
} else {
Expand Down Expand Up @@ -840,7 +840,7 @@ static ssize_t cyapa_update_rt_suspend_scanrate(struct device *dev,
if (error)
return error;

cyapa->runtime_suspend_sleep_time = max_t(u16, time, 1000);
cyapa->runtime_suspend_sleep_time = min_t(u16, time, 1000);
cyapa->runtime_suspend_power_mode =
cyapa_sleep_time_to_pwr_cmd(cyapa->runtime_suspend_sleep_time);

Expand Down
3 changes: 3 additions & 0 deletions drivers/input/mouse/elan_i2c.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#define ETP_ENABLE_CALIBRATE 0x0002
#define ETP_DISABLE_CALIBRATE 0x0000
#define ETP_DISABLE_POWER 0x0001
#define ETP_PRESSURE_OFFSET 25

/* IAP Firmware handling */
#define ETP_FW_NAME "elan_i2c.bin"
Expand Down Expand Up @@ -79,6 +80,8 @@ struct elan_transport_ops {
struct completion *reset_done);

int (*get_report)(struct i2c_client *client, u8 *report);
int (*get_pressure_adjustment)(struct i2c_client *client,
int *adjustment);
};

extern const struct elan_transport_ops elan_smbus_ops, elan_i2c_ops;
Expand Down
38 changes: 25 additions & 13 deletions drivers/input/mouse/elan_i2c_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Copyright (c) 2013 ELAN Microelectronics Corp.
*
* Author: 林政維 (Duson Lin) <[email protected]>
* Version: 1.5.6
* Version: 1.5.7
*
* Based on cyapa driver:
* copyright (c) 2011-2012 Cypress Semiconductor, Inc.
Expand Down Expand Up @@ -40,8 +40,7 @@
#include "elan_i2c.h"

#define DRIVER_NAME "elan_i2c"
#define ELAN_DRIVER_VERSION "1.5.6"
#define ETP_PRESSURE_OFFSET 25
#define ELAN_DRIVER_VERSION "1.5.7"
#define ETP_MAX_PRESSURE 255
#define ETP_FWIDTH_REDUCE 90
#define ETP_FINGER_WIDTH 15
Expand All @@ -53,6 +52,7 @@
#define ETP_REPORT_ID_OFFSET 2
#define ETP_TOUCH_INFO_OFFSET 3
#define ETP_FINGER_DATA_OFFSET 4
#define ETP_HOVER_INFO_OFFSET 30
#define ETP_MAX_REPORT_LEN 34

/* The main device structure */
Expand Down Expand Up @@ -81,7 +81,7 @@ struct elan_tp_data {
u8 sm_version;
u8 iap_version;
u16 fw_checksum;

int pressure_adjustment;
u8 mode;

bool irq_wake;
Expand Down Expand Up @@ -229,6 +229,11 @@ static int elan_query_device_info(struct elan_tp_data *data)
if (error)
return error;

error = data->ops->get_pressure_adjustment(data->client,
&data->pressure_adjustment);
if (error)
return error;

return 0;
}

Expand Down Expand Up @@ -721,13 +726,13 @@ static const struct attribute_group *elan_sysfs_groups[] = {
*/
static void elan_report_contact(struct elan_tp_data *data,
int contact_num, bool contact_valid,
u8 *finger_data)
bool hover_event, u8 *finger_data)
{
struct input_dev *input = data->input;
unsigned int pos_x, pos_y;
unsigned int pressure, mk_x, mk_y;
unsigned int area_x, area_y, major, minor, new_pressure;

unsigned int area_x, area_y, major, minor;
unsigned int scaled_pressure;

if (contact_valid) {
pos_x = ((finger_data[0] & 0xf0) << 4) |
Expand Down Expand Up @@ -756,15 +761,18 @@ static void elan_report_contact(struct elan_tp_data *data,
major = max(area_x, area_y);
minor = min(area_x, area_y);

new_pressure = pressure + ETP_PRESSURE_OFFSET;
if (new_pressure > ETP_MAX_PRESSURE)
new_pressure = ETP_MAX_PRESSURE;
scaled_pressure = pressure + data->pressure_adjustment;

if (scaled_pressure > ETP_MAX_PRESSURE)
scaled_pressure = ETP_MAX_PRESSURE;

input_mt_slot(input, contact_num);
input_mt_report_slot_state(input, MT_TOOL_FINGER, true);
input_report_abs(input, ABS_MT_POSITION_X, pos_x);
input_report_abs(input, ABS_MT_POSITION_Y, data->max_y - pos_y);
input_report_abs(input, ABS_MT_PRESSURE, new_pressure);
input_report_abs(input, ABS_MT_DISTANCE, hover_event);
input_report_abs(input, ABS_MT_PRESSURE,
hover_event ? 0 : scaled_pressure);
input_report_abs(input, ABS_TOOL_WIDTH, mk_x);
input_report_abs(input, ABS_MT_TOUCH_MAJOR, major);
input_report_abs(input, ABS_MT_TOUCH_MINOR, minor);
Expand All @@ -780,11 +788,14 @@ static void elan_report_absolute(struct elan_tp_data *data, u8 *packet)
u8 *finger_data = &packet[ETP_FINGER_DATA_OFFSET];
int i;
u8 tp_info = packet[ETP_TOUCH_INFO_OFFSET];
bool contact_valid;
u8 hover_info = packet[ETP_HOVER_INFO_OFFSET];
bool contact_valid, hover_event;

hover_event = hover_info & 0x40;
for (i = 0; i < ETP_MAX_FINGERS; i++) {
contact_valid = tp_info & (1U << (3 + i));
elan_report_contact(data, i, contact_valid, finger_data);
elan_report_contact(data, i, contact_valid, hover_event,
finger_data);

if (contact_valid)
finger_data += ETP_FINGER_DATA_LEN;
Expand Down Expand Up @@ -878,6 +889,7 @@ static int elan_setup_input_device(struct elan_tp_data *data)
ETP_FINGER_WIDTH * max_width, 0, 0);
input_set_abs_params(input, ABS_MT_TOUCH_MINOR, 0,
ETP_FINGER_WIDTH * min_width, 0, 0);
input_set_abs_params(input, ABS_MT_DISTANCE, 0, 1, 0, 0);

data->input = input;

Expand Down
27 changes: 25 additions & 2 deletions drivers/input/mouse/elan_i2c_i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#define ETP_I2C_MAX_X_AXIS_CMD 0x0106
#define ETP_I2C_MAX_Y_AXIS_CMD 0x0107
#define ETP_I2C_RESOLUTION_CMD 0x0108
#define ETP_I2C_PRESSURE_CMD 0x010A
#define ETP_I2C_IAP_VERSION_CMD 0x0110
#define ETP_I2C_SET_CMD 0x0300
#define ETP_I2C_POWER_CMD 0x0307
Expand Down Expand Up @@ -364,8 +365,29 @@ static int elan_i2c_get_num_traces(struct i2c_client *client,
return error;
}

*x_traces = val[0] - 1;
*y_traces = val[1] - 1;
*x_traces = val[0];
*y_traces = val[1];

return 0;
}

static int elan_i2c_get_pressure_adjustment(struct i2c_client *client,
int *adjustment)
{
int error;
u8 val[3];

error = elan_i2c_read_cmd(client, ETP_I2C_PRESSURE_CMD, val);
if (error) {
dev_err(&client->dev, "failed to get pressure format: %d\n",
error);
return error;
}

if ((val[0] >> 4) & 0x1)
*adjustment = 0;
else
*adjustment = ETP_PRESSURE_OFFSET;

return 0;
}
Expand Down Expand Up @@ -602,6 +624,7 @@ const struct elan_transport_ops elan_i2c_ops = {
.get_sm_version = elan_i2c_get_sm_version,
.get_product_id = elan_i2c_get_product_id,
.get_checksum = elan_i2c_get_checksum,
.get_pressure_adjustment = elan_i2c_get_pressure_adjustment,

.get_max = elan_i2c_get_max,
.get_resolution = elan_i2c_get_resolution,
Expand Down
Loading

0 comments on commit 4885338

Please sign in to comment.