Commit e93df634 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 input subsystem fixes from Dmitry Torokhov:
 "Miscellaneous driver fixes"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
  Input: psmouse - disable "palm detection" in the focaltech driver
  Input: psmouse - disable changing resolution/rate/scale for FocalTech
  Input: psmouse - ensure that focaltech reports consistent coordinates
  Input: psmouse - remove hardcoded touchpad size from the focaltech driver
  Input: tc3589x-keypad - set IRQF_ONESHOT flag to ensure IRQ request
  Input: ALPS - fix memory leak when detection fails
  Input: sun4i-ts - add thermal driver dependency
  Input: cyapa - remove superfluous type check in cyapa_gen5_read_idac_data()
  Input: cyapa - fix unaligned functions redefinition error
  Input: mma8450 - add parent device
parents 068c65c5 4eb8d6e7
......@@ -411,8 +411,8 @@ static int tc3589x_keypad_probe(struct platform_device *pdev)
input_set_drvdata(input, keypad);
error = request_threaded_irq(irq, NULL,
tc3589x_keypad_irq, plat->irqtype,
error = request_threaded_irq(irq, NULL, tc3589x_keypad_irq,
plat->irqtype | IRQF_ONESHOT,
"tc3589x-keypad", keypad);
if (error < 0) {
dev_err(&pdev->dev,
......
......@@ -187,6 +187,7 @@ static int mma8450_probe(struct i2c_client *c,
idev->private = m;
idev->input->name = MMA8450_DRV_NAME;
idev->input->id.bustype = BUS_I2C;
idev->input->dev.parent = &c->dev;
idev->poll = mma8450_poll;
idev->poll_interval = POLL_INTERVAL;
idev->poll_interval_max = POLL_INTERVAL_MAX;
......
......@@ -2605,8 +2605,10 @@ int alps_detect(struct psmouse *psmouse, bool set_properties)
return -ENOMEM;
error = alps_identify(psmouse, priv);
if (error)
if (error) {
kfree(priv);
return error;
}
if (set_properties) {
psmouse->vendor = "ALPS";
......
......@@ -20,7 +20,7 @@
#include <linux/input/mt.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/unaligned/access_ok.h>
#include <asm/unaligned.h>
#include "cyapa.h"
......
......@@ -17,7 +17,7 @@
#include <linux/mutex.h>
#include <linux/completion.h>
#include <linux/slab.h>
#include <linux/unaligned/access_ok.h>
#include <asm/unaligned.h>
#include <linux/crc-itu-t.h>
#include "cyapa.h"
......@@ -1926,7 +1926,7 @@ static int cyapa_gen5_read_idac_data(struct cyapa *cyapa,
electrodes_tx = cyapa->electrodes_x;
max_element_cnt = ((cyapa->aligned_electrodes_rx + 7) &
~7u) * electrodes_tx;
} else if (idac_data_type == GEN5_RETRIEVE_SELF_CAP_PWC_DATA) {
} else {
offset = 2;
max_element_cnt = cyapa->electrodes_x +
cyapa->electrodes_y;
......
......@@ -67,9 +67,6 @@ static void focaltech_reset(struct psmouse *psmouse)
#define FOC_MAX_FINGERS 5
#define FOC_MAX_X 2431
#define FOC_MAX_Y 1663
/*
* Current state of a single finger on the touchpad.
*/
......@@ -129,9 +126,17 @@ static void focaltech_report_state(struct psmouse *psmouse)
input_mt_slot(dev, i);
input_mt_report_slot_state(dev, MT_TOOL_FINGER, active);
if (active) {
input_report_abs(dev, ABS_MT_POSITION_X, finger->x);
unsigned int clamped_x, clamped_y;
/*
* The touchpad might report invalid data, so we clamp
* the resulting values so that we do not confuse
* userspace.
*/
clamped_x = clamp(finger->x, 0U, priv->x_max);
clamped_y = clamp(finger->y, 0U, priv->y_max);
input_report_abs(dev, ABS_MT_POSITION_X, clamped_x);
input_report_abs(dev, ABS_MT_POSITION_Y,
FOC_MAX_Y - finger->y);
priv->y_max - clamped_y);
}
}
input_mt_report_pointer_emulation(dev, true);
......@@ -180,16 +185,6 @@ static void focaltech_process_abs_packet(struct psmouse *psmouse,
state->pressed = (packet[0] >> 4) & 1;
/*
* packet[5] contains some kind of tool size in the most
* significant nibble. 0xff is a special value (latching) that
* signals a large contact area.
*/
if (packet[5] == 0xff) {
state->fingers[finger].valid = false;
return;
}
state->fingers[finger].x = ((packet[1] & 0xf) << 8) | packet[2];
state->fingers[finger].y = (packet[3] << 8) | packet[4];
state->fingers[finger].valid = true;
......@@ -381,6 +376,23 @@ static int focaltech_read_size(struct psmouse *psmouse)
return 0;
}
void focaltech_set_resolution(struct psmouse *psmouse, unsigned int resolution)
{
/* not supported yet */
}
static void focaltech_set_rate(struct psmouse *psmouse, unsigned int rate)
{
/* not supported yet */
}
static void focaltech_set_scale(struct psmouse *psmouse,
enum psmouse_scale scale)
{
/* not supported yet */
}
int focaltech_init(struct psmouse *psmouse)
{
struct focaltech_data *priv;
......@@ -415,6 +427,14 @@ int focaltech_init(struct psmouse *psmouse)
psmouse->cleanup = focaltech_reset;
/* resync is not supported yet */
psmouse->resync_time = 0;
/*
* rate/resolution/scale changes are not supported yet, and
* the generic implementations of these functions seem to
* confuse some touchpads
*/
psmouse->set_resolution = focaltech_set_resolution;
psmouse->set_rate = focaltech_set_rate;
psmouse->set_scale = focaltech_set_scale;
return 0;
......
......@@ -453,6 +453,17 @@ static void psmouse_set_rate(struct psmouse *psmouse, unsigned int rate)
psmouse->rate = r;
}
/*
* Here we set the mouse scaling.
*/
static void psmouse_set_scale(struct psmouse *psmouse, enum psmouse_scale scale)
{
ps2_command(&psmouse->ps2dev, NULL,
scale == PSMOUSE_SCALE21 ? PSMOUSE_CMD_SETSCALE21 :
PSMOUSE_CMD_SETSCALE11);
}
/*
* psmouse_poll() - default poll handler. Everyone except for ALPS uses it.
*/
......@@ -689,6 +700,7 @@ static void psmouse_apply_defaults(struct psmouse *psmouse)
psmouse->set_rate = psmouse_set_rate;
psmouse->set_resolution = psmouse_set_resolution;
psmouse->set_scale = psmouse_set_scale;
psmouse->poll = psmouse_poll;
psmouse->protocol_handler = psmouse_process_byte;
psmouse->pktsize = 3;
......@@ -1160,7 +1172,7 @@ static void psmouse_initialize(struct psmouse *psmouse)
if (psmouse_max_proto != PSMOUSE_PS2) {
psmouse->set_rate(psmouse, psmouse->rate);
psmouse->set_resolution(psmouse, psmouse->resolution);
ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_SETSCALE11);
psmouse->set_scale(psmouse, PSMOUSE_SCALE11);
}
}
......
......@@ -36,6 +36,11 @@ typedef enum {
PSMOUSE_FULL_PACKET
} psmouse_ret_t;
enum psmouse_scale {
PSMOUSE_SCALE11,
PSMOUSE_SCALE21
};
struct psmouse {
void *private;
struct input_dev *dev;
......@@ -67,6 +72,7 @@ struct psmouse {
psmouse_ret_t (*protocol_handler)(struct psmouse *psmouse);
void (*set_rate)(struct psmouse *psmouse, unsigned int rate);
void (*set_resolution)(struct psmouse *psmouse, unsigned int resolution);
void (*set_scale)(struct psmouse *psmouse, enum psmouse_scale scale);
int (*reconnect)(struct psmouse *psmouse);
void (*disconnect)(struct psmouse *psmouse);
......
......@@ -943,6 +943,7 @@ config TOUCHSCREEN_SUN4I
tristate "Allwinner sun4i resistive touchscreen controller support"
depends on ARCH_SUNXI || COMPILE_TEST
depends on HWMON
depends on THERMAL || !THERMAL_OF
help
This selects support for the resistive touchscreen controller
found on Allwinner sunxi SoCs.
......
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