Commit 978ab6a0 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 layer fixes from Dmitry Torokhov:
 "Fixes for two recent regressions (in Synaptics PS/2 and uinput
  drivers) and some more driver fixups"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
  Revert "Input: synaptics - fix handling of disabling gesture mode"
  Input: psmouse - fix data race in __ps2_command
  Input: elan_i2c - add all valid ic type for i2c/smbus
  Input: zhenhua - ensure we have BITREVERSE
  Input: omap4-keypad - fix memory leak
  Input: serio - fix blocking of parport
  Input: uinput - fix crash when using ABS events
  Input: elan_i2c - expand maximum product_id form 0xFF to 0xFFFF
  Input: elan_i2c - add ic type 0x03
  Input: elan_i2c - don't require known iap version
  Input: imx6ul_tsc - fix controller name
  Input: imx6ul_tsc - use the preferred method for kzalloc()
  Input: imx6ul_tsc - check for negative return value
  Input: imx6ul_tsc - propagate the errors
  Input: walkera0701 - fix abs() calculations on 64 bit values
  Input: mms114 - remove unneded semicolons
  Input: pm8941-pwrkey - remove unneded semicolon
  Input: fix typo in MT documentation
  Input: cyapa - fix address of Gen3 devices in device tree documentation
parents 5634347d 62d78461
...@@ -25,7 +25,7 @@ Example: ...@@ -25,7 +25,7 @@ Example:
/* Cypress Gen3 touchpad */ /* Cypress Gen3 touchpad */
touchpad@67 { touchpad@67 {
compatible = "cypress,cyapa"; compatible = "cypress,cyapa";
reg = <0x24>; reg = <0x67>;
interrupt-parent = <&gpio>; interrupt-parent = <&gpio>;
interrupts = <2 IRQ_TYPE_EDGE_FALLING>; /* GPIO 2 */ interrupts = <2 IRQ_TYPE_EDGE_FALLING>; /* GPIO 2 */
wakeup-source; wakeup-source;
......
...@@ -361,7 +361,7 @@ For win8 devices with both T and C coordinates, the position mapping is ...@@ -361,7 +361,7 @@ For win8 devices with both T and C coordinates, the position mapping is
ABS_MT_POSITION_X := T_X ABS_MT_POSITION_X := T_X
ABS_MT_POSITION_Y := T_Y ABS_MT_POSITION_Y := T_Y
ABS_MT_TOOL_X := C_X ABS_MT_TOOL_X := C_X
ABS_MT_TOOL_X := C_Y ABS_MT_TOOL_Y := C_Y
Unfortunately, there is not enough information to specify both the touching Unfortunately, there is not enough information to specify both the touching
ellipse and the tool ellipse, so one has to resort to approximations. One ellipse and the tool ellipse, so one has to resort to approximations. One
......
...@@ -150,7 +150,7 @@ static void walkera0701_irq_handler(void *handler_data) ...@@ -150,7 +150,7 @@ static void walkera0701_irq_handler(void *handler_data)
if (w->counter == 24) { /* full frame */ if (w->counter == 24) { /* full frame */
walkera0701_parse_frame(w); walkera0701_parse_frame(w);
w->counter = NO_SYNC; w->counter = NO_SYNC;
if (abs(pulse_time - SYNC_PULSE) < RESERVE) /* new frame sync */ if (abs64(pulse_time - SYNC_PULSE) < RESERVE) /* new frame sync */
w->counter = 0; w->counter = 0;
} else { } else {
if ((pulse_time > (ANALOG_MIN_PULSE - RESERVE) if ((pulse_time > (ANALOG_MIN_PULSE - RESERVE)
...@@ -161,7 +161,7 @@ static void walkera0701_irq_handler(void *handler_data) ...@@ -161,7 +161,7 @@ static void walkera0701_irq_handler(void *handler_data)
} else } else
w->counter = NO_SYNC; w->counter = NO_SYNC;
} }
} else if (abs(pulse_time - SYNC_PULSE - BIN0_PULSE) < } else if (abs64(pulse_time - SYNC_PULSE - BIN0_PULSE) <
RESERVE + BIN1_PULSE - BIN0_PULSE) /* frame sync .. */ RESERVE + BIN1_PULSE - BIN0_PULSE) /* frame sync .. */
w->counter = 0; w->counter = 0;
......
...@@ -266,7 +266,7 @@ static int omap4_keypad_probe(struct platform_device *pdev) ...@@ -266,7 +266,7 @@ static int omap4_keypad_probe(struct platform_device *pdev)
error = omap4_keypad_parse_dt(&pdev->dev, keypad_data); error = omap4_keypad_parse_dt(&pdev->dev, keypad_data);
if (error) if (error)
return error; goto err_free_keypad;
res = request_mem_region(res->start, resource_size(res), pdev->name); res = request_mem_region(res->start, resource_size(res), pdev->name);
if (!res) { if (!res) {
......
...@@ -93,7 +93,7 @@ static int pm8941_reboot_notify(struct notifier_block *nb, ...@@ -93,7 +93,7 @@ static int pm8941_reboot_notify(struct notifier_block *nb,
default: default:
reset_type = PON_PS_HOLD_TYPE_HARD_RESET; reset_type = PON_PS_HOLD_TYPE_HARD_RESET;
break; break;
}; }
error = regmap_update_bits(pwrkey->regmap, error = regmap_update_bits(pwrkey->regmap,
pwrkey->baseaddr + PON_PS_HOLD_RST_CTL, pwrkey->baseaddr + PON_PS_HOLD_RST_CTL,
......
...@@ -414,7 +414,7 @@ static int uinput_setup_device(struct uinput_device *udev, ...@@ -414,7 +414,7 @@ static int uinput_setup_device(struct uinput_device *udev,
dev->id.product = user_dev->id.product; dev->id.product = user_dev->id.product;
dev->id.version = user_dev->id.version; dev->id.version = user_dev->id.version;
for_each_set_bit(i, dev->absbit, ABS_CNT) { for (i = 0; i < ABS_CNT; i++) {
input_abs_set_max(dev, i, user_dev->absmax[i]); input_abs_set_max(dev, i, user_dev->absmax[i]);
input_abs_set_min(dev, i, user_dev->absmin[i]); input_abs_set_min(dev, i, user_dev->absmin[i]);
input_abs_set_fuzz(dev, i, user_dev->absfuzz[i]); input_abs_set_fuzz(dev, i, user_dev->absfuzz[i]);
......
...@@ -60,7 +60,7 @@ struct elan_transport_ops { ...@@ -60,7 +60,7 @@ struct elan_transport_ops {
int (*get_sm_version)(struct i2c_client *client, int (*get_sm_version)(struct i2c_client *client,
u8* ic_type, u8 *version); u8* ic_type, u8 *version);
int (*get_checksum)(struct i2c_client *client, bool iap, u16 *csum); int (*get_checksum)(struct i2c_client *client, bool iap, u16 *csum);
int (*get_product_id)(struct i2c_client *client, u8 *id); int (*get_product_id)(struct i2c_client *client, u16 *id);
int (*get_max)(struct i2c_client *client, int (*get_max)(struct i2c_client *client,
unsigned int *max_x, unsigned int *max_y); unsigned int *max_x, unsigned int *max_y);
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
#include "elan_i2c.h" #include "elan_i2c.h"
#define DRIVER_NAME "elan_i2c" #define DRIVER_NAME "elan_i2c"
#define ELAN_DRIVER_VERSION "1.6.0" #define ELAN_DRIVER_VERSION "1.6.1"
#define ETP_MAX_PRESSURE 255 #define ETP_MAX_PRESSURE 255
#define ETP_FWIDTH_REDUCE 90 #define ETP_FWIDTH_REDUCE 90
#define ETP_FINGER_WIDTH 15 #define ETP_FINGER_WIDTH 15
...@@ -76,7 +76,7 @@ struct elan_tp_data { ...@@ -76,7 +76,7 @@ struct elan_tp_data {
unsigned int x_res; unsigned int x_res;
unsigned int y_res; unsigned int y_res;
u8 product_id; u16 product_id;
u8 fw_version; u8 fw_version;
u8 sm_version; u8 sm_version;
u8 iap_version; u8 iap_version;
...@@ -98,15 +98,25 @@ static int elan_get_fwinfo(u8 iap_version, u16 *validpage_count, ...@@ -98,15 +98,25 @@ static int elan_get_fwinfo(u8 iap_version, u16 *validpage_count,
u16 *signature_address) u16 *signature_address)
{ {
switch (iap_version) { switch (iap_version) {
case 0x00:
case 0x06:
case 0x08: case 0x08:
*validpage_count = 512; *validpage_count = 512;
break; break;
case 0x03:
case 0x07:
case 0x09: case 0x09:
case 0x0A:
case 0x0B:
case 0x0C:
*validpage_count = 768; *validpage_count = 768;
break; break;
case 0x0D: case 0x0D:
*validpage_count = 896; *validpage_count = 896;
break; break;
case 0x0E:
*validpage_count = 640;
break;
default: default:
/* unknown ic type clear value */ /* unknown ic type clear value */
*validpage_count = 0; *validpage_count = 0;
...@@ -266,11 +276,10 @@ static int elan_query_device_info(struct elan_tp_data *data) ...@@ -266,11 +276,10 @@ static int elan_query_device_info(struct elan_tp_data *data)
error = elan_get_fwinfo(data->iap_version, &data->fw_validpage_count, error = elan_get_fwinfo(data->iap_version, &data->fw_validpage_count,
&data->fw_signature_address); &data->fw_signature_address);
if (error) { if (error)
dev_err(&data->client->dev, dev_warn(&data->client->dev,
"unknown iap version %d\n", data->iap_version); "unexpected iap version %#04x (ic type: %#04x), firmware update will not work\n",
return error; data->iap_version, data->ic_type);
}
return 0; return 0;
} }
...@@ -486,6 +495,9 @@ static ssize_t elan_sysfs_update_fw(struct device *dev, ...@@ -486,6 +495,9 @@ static ssize_t elan_sysfs_update_fw(struct device *dev,
const u8 *fw_signature; const u8 *fw_signature;
static const u8 signature[] = {0xAA, 0x55, 0xCC, 0x33, 0xFF, 0xFF}; static const u8 signature[] = {0xAA, 0x55, 0xCC, 0x33, 0xFF, 0xFF};
if (data->fw_validpage_count == 0)
return -EINVAL;
/* Look for a firmware with the product id appended. */ /* Look for a firmware with the product id appended. */
fw_name = kasprintf(GFP_KERNEL, ETP_FW_NAME, data->product_id); fw_name = kasprintf(GFP_KERNEL, ETP_FW_NAME, data->product_id);
if (!fw_name) { if (!fw_name) {
......
...@@ -276,7 +276,7 @@ static int elan_i2c_get_sm_version(struct i2c_client *client, ...@@ -276,7 +276,7 @@ static int elan_i2c_get_sm_version(struct i2c_client *client,
return 0; return 0;
} }
static int elan_i2c_get_product_id(struct i2c_client *client, u8 *id) static int elan_i2c_get_product_id(struct i2c_client *client, u16 *id)
{ {
int error; int error;
u8 val[3]; u8 val[3];
...@@ -287,7 +287,7 @@ static int elan_i2c_get_product_id(struct i2c_client *client, u8 *id) ...@@ -287,7 +287,7 @@ static int elan_i2c_get_product_id(struct i2c_client *client, u8 *id)
return error; return error;
} }
*id = val[0]; *id = le16_to_cpup((__le16 *)val);
return 0; return 0;
} }
......
...@@ -183,7 +183,7 @@ static int elan_smbus_get_sm_version(struct i2c_client *client, ...@@ -183,7 +183,7 @@ static int elan_smbus_get_sm_version(struct i2c_client *client,
return 0; return 0;
} }
static int elan_smbus_get_product_id(struct i2c_client *client, u8 *id) static int elan_smbus_get_product_id(struct i2c_client *client, u16 *id)
{ {
int error; int error;
u8 val[3]; u8 val[3];
...@@ -195,7 +195,7 @@ static int elan_smbus_get_product_id(struct i2c_client *client, u8 *id) ...@@ -195,7 +195,7 @@ static int elan_smbus_get_product_id(struct i2c_client *client, u8 *id)
return error; return error;
} }
*id = val[1]; *id = be16_to_cpup((__be16 *)val);
return 0; return 0;
} }
......
...@@ -519,18 +519,14 @@ static int synaptics_set_mode(struct psmouse *psmouse) ...@@ -519,18 +519,14 @@ static int synaptics_set_mode(struct psmouse *psmouse)
struct synaptics_data *priv = psmouse->private; struct synaptics_data *priv = psmouse->private;
priv->mode = 0; priv->mode = 0;
if (priv->absolute_mode)
if (priv->absolute_mode) {
priv->mode |= SYN_BIT_ABSOLUTE_MODE; priv->mode |= SYN_BIT_ABSOLUTE_MODE;
if (SYN_CAP_EXTENDED(priv->capabilities)) if (priv->disable_gesture)
priv->mode |= SYN_BIT_W_MODE;
}
if (!SYN_MODE_WMODE(priv->mode) && priv->disable_gesture)
priv->mode |= SYN_BIT_DISABLE_GESTURE; priv->mode |= SYN_BIT_DISABLE_GESTURE;
if (psmouse->rate >= 80) if (psmouse->rate >= 80)
priv->mode |= SYN_BIT_HIGH_RATE; priv->mode |= SYN_BIT_HIGH_RATE;
if (SYN_CAP_EXTENDED(priv->capabilities))
priv->mode |= SYN_BIT_W_MODE;
if (synaptics_mode_cmd(psmouse, priv->mode)) if (synaptics_mode_cmd(psmouse, priv->mode))
return -1; return -1;
......
...@@ -212,12 +212,17 @@ int __ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command) ...@@ -212,12 +212,17 @@ int __ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command)
* time before the ACK arrives. * time before the ACK arrives.
*/ */
if (ps2_sendbyte(ps2dev, command & 0xff, if (ps2_sendbyte(ps2dev, command & 0xff,
command == PS2_CMD_RESET_BAT ? 1000 : 200)) command == PS2_CMD_RESET_BAT ? 1000 : 200)) {
goto out; serio_pause_rx(ps2dev->serio);
goto out_reset_flags;
}
for (i = 0; i < send; i++) for (i = 0; i < send; i++) {
if (ps2_sendbyte(ps2dev, param[i], 200)) if (ps2_sendbyte(ps2dev, param[i], 200)) {
goto out; serio_pause_rx(ps2dev->serio);
goto out_reset_flags;
}
}
/* /*
* The reset command takes a long time to execute. * The reset command takes a long time to execute.
...@@ -234,17 +239,18 @@ int __ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command) ...@@ -234,17 +239,18 @@ int __ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command)
!(ps2dev->flags & PS2_FLAG_CMD), timeout); !(ps2dev->flags & PS2_FLAG_CMD), timeout);
} }
serio_pause_rx(ps2dev->serio);
if (param) if (param)
for (i = 0; i < receive; i++) for (i = 0; i < receive; i++)
param[i] = ps2dev->cmdbuf[(receive - 1) - i]; param[i] = ps2dev->cmdbuf[(receive - 1) - i];
if (ps2dev->cmdcnt && (command != PS2_CMD_RESET_BAT || ps2dev->cmdcnt != 1)) if (ps2dev->cmdcnt && (command != PS2_CMD_RESET_BAT || ps2dev->cmdcnt != 1))
goto out; goto out_reset_flags;
rc = 0; rc = 0;
out: out_reset_flags:
serio_pause_rx(ps2dev->serio);
ps2dev->flags = 0; ps2dev->flags = 0;
serio_continue_rx(ps2dev->serio); serio_continue_rx(ps2dev->serio);
......
...@@ -194,6 +194,7 @@ static int __init parkbd_init(void) ...@@ -194,6 +194,7 @@ static int __init parkbd_init(void)
parkbd_port = parkbd_allocate_serio(); parkbd_port = parkbd_allocate_serio();
if (!parkbd_port) { if (!parkbd_port) {
parport_release(parkbd_dev); parport_release(parkbd_dev);
parport_unregister_device(parkbd_dev);
return -ENOMEM; return -ENOMEM;
} }
......
...@@ -94,7 +94,7 @@ struct imx6ul_tsc { ...@@ -94,7 +94,7 @@ struct imx6ul_tsc {
* TSC module need ADC to get the measure value. So * TSC module need ADC to get the measure value. So
* before config TSC, we should initialize ADC module. * before config TSC, we should initialize ADC module.
*/ */
static void imx6ul_adc_init(struct imx6ul_tsc *tsc) static int imx6ul_adc_init(struct imx6ul_tsc *tsc)
{ {
int adc_hc = 0; int adc_hc = 0;
int adc_gc; int adc_gc;
...@@ -122,17 +122,23 @@ static void imx6ul_adc_init(struct imx6ul_tsc *tsc) ...@@ -122,17 +122,23 @@ static void imx6ul_adc_init(struct imx6ul_tsc *tsc)
timeout = wait_for_completion_timeout timeout = wait_for_completion_timeout
(&tsc->completion, ADC_TIMEOUT); (&tsc->completion, ADC_TIMEOUT);
if (timeout == 0) if (timeout == 0) {
dev_err(tsc->dev, "Timeout for adc calibration\n"); dev_err(tsc->dev, "Timeout for adc calibration\n");
return -ETIMEDOUT;
}
adc_gs = readl(tsc->adc_regs + REG_ADC_GS); adc_gs = readl(tsc->adc_regs + REG_ADC_GS);
if (adc_gs & ADC_CALF) if (adc_gs & ADC_CALF) {
dev_err(tsc->dev, "ADC calibration failed\n"); dev_err(tsc->dev, "ADC calibration failed\n");
return -EINVAL;
}
/* TSC need the ADC work in hardware trigger */ /* TSC need the ADC work in hardware trigger */
adc_cfg = readl(tsc->adc_regs + REG_ADC_CFG); adc_cfg = readl(tsc->adc_regs + REG_ADC_CFG);
adc_cfg |= ADC_HARDWARE_TRIGGER; adc_cfg |= ADC_HARDWARE_TRIGGER;
writel(adc_cfg, tsc->adc_regs + REG_ADC_CFG); writel(adc_cfg, tsc->adc_regs + REG_ADC_CFG);
return 0;
} }
/* /*
...@@ -188,11 +194,17 @@ static void imx6ul_tsc_set(struct imx6ul_tsc *tsc) ...@@ -188,11 +194,17 @@ static void imx6ul_tsc_set(struct imx6ul_tsc *tsc)
writel(start, tsc->tsc_regs + REG_TSC_FLOW_CONTROL); writel(start, tsc->tsc_regs + REG_TSC_FLOW_CONTROL);
} }
static void imx6ul_tsc_init(struct imx6ul_tsc *tsc) static int imx6ul_tsc_init(struct imx6ul_tsc *tsc)
{ {
imx6ul_adc_init(tsc); int err;
err = imx6ul_adc_init(tsc);
if (err)
return err;
imx6ul_tsc_channel_config(tsc); imx6ul_tsc_channel_config(tsc);
imx6ul_tsc_set(tsc); imx6ul_tsc_set(tsc);
return 0;
} }
static void imx6ul_tsc_disable(struct imx6ul_tsc *tsc) static void imx6ul_tsc_disable(struct imx6ul_tsc *tsc)
...@@ -311,9 +323,7 @@ static int imx6ul_tsc_open(struct input_dev *input_dev) ...@@ -311,9 +323,7 @@ static int imx6ul_tsc_open(struct input_dev *input_dev)
return err; return err;
} }
imx6ul_tsc_init(tsc); return imx6ul_tsc_init(tsc);
return 0;
} }
static void imx6ul_tsc_close(struct input_dev *input_dev) static void imx6ul_tsc_close(struct input_dev *input_dev)
...@@ -337,7 +347,7 @@ static int imx6ul_tsc_probe(struct platform_device *pdev) ...@@ -337,7 +347,7 @@ static int imx6ul_tsc_probe(struct platform_device *pdev)
int tsc_irq; int tsc_irq;
int adc_irq; int adc_irq;
tsc = devm_kzalloc(&pdev->dev, sizeof(struct imx6ul_tsc), GFP_KERNEL); tsc = devm_kzalloc(&pdev->dev, sizeof(*tsc), GFP_KERNEL);
if (!tsc) if (!tsc)
return -ENOMEM; return -ENOMEM;
...@@ -345,7 +355,7 @@ static int imx6ul_tsc_probe(struct platform_device *pdev) ...@@ -345,7 +355,7 @@ static int imx6ul_tsc_probe(struct platform_device *pdev)
if (!input_dev) if (!input_dev)
return -ENOMEM; return -ENOMEM;
input_dev->name = "iMX6UL TouchScreen Controller"; input_dev->name = "iMX6UL Touchscreen Controller";
input_dev->id.bustype = BUS_HOST; input_dev->id.bustype = BUS_HOST;
input_dev->open = imx6ul_tsc_open; input_dev->open = imx6ul_tsc_open;
...@@ -406,7 +416,7 @@ static int imx6ul_tsc_probe(struct platform_device *pdev) ...@@ -406,7 +416,7 @@ static int imx6ul_tsc_probe(struct platform_device *pdev)
} }
adc_irq = platform_get_irq(pdev, 1); adc_irq = platform_get_irq(pdev, 1);
if (adc_irq <= 0) { if (adc_irq < 0) {
dev_err(&pdev->dev, "no adc irq resource?\n"); dev_err(&pdev->dev, "no adc irq resource?\n");
return adc_irq; return adc_irq;
} }
...@@ -491,7 +501,7 @@ static int __maybe_unused imx6ul_tsc_resume(struct device *dev) ...@@ -491,7 +501,7 @@ static int __maybe_unused imx6ul_tsc_resume(struct device *dev)
goto out; goto out;
} }
imx6ul_tsc_init(tsc); retval = imx6ul_tsc_init(tsc);
} }
out: out:
......
...@@ -394,12 +394,12 @@ static struct mms114_platform_data *mms114_parse_dt(struct device *dev) ...@@ -394,12 +394,12 @@ static struct mms114_platform_data *mms114_parse_dt(struct device *dev)
if (of_property_read_u32(np, "x-size", &pdata->x_size)) { if (of_property_read_u32(np, "x-size", &pdata->x_size)) {
dev_err(dev, "failed to get x-size property\n"); dev_err(dev, "failed to get x-size property\n");
return NULL; return NULL;
}; }
if (of_property_read_u32(np, "y-size", &pdata->y_size)) { if (of_property_read_u32(np, "y-size", &pdata->y_size)) {
dev_err(dev, "failed to get y-size property\n"); dev_err(dev, "failed to get y-size property\n");
return NULL; return NULL;
}; }
of_property_read_u32(np, "contact-threshold", of_property_read_u32(np, "contact-threshold",
&pdata->contact_threshold); &pdata->contact_threshold);
......
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