Skip to content

Commit 2969869

Browse files
committed
Merge branch 'for-linus' into next
Merge for-linus branch to sync Elan touchscreen driver code.
2 parents 04e4986 + d34fced commit 2969869

File tree

12 files changed

+87
-72
lines changed

12 files changed

+87
-72
lines changed

drivers/input/evdev.c

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -327,20 +327,6 @@ static int evdev_fasync(int fd, struct file *file, int on)
327327
return fasync_helper(fd, file, on, &client->fasync);
328328
}
329329

330-
static int evdev_flush(struct file *file, fl_owner_t id)
331-
{
332-
struct evdev_client *client = file->private_data;
333-
struct evdev *evdev = client->evdev;
334-
335-
mutex_lock(&evdev->mutex);
336-
337-
if (evdev->exist && !client->revoked)
338-
input_flush_device(&evdev->handle, file);
339-
340-
mutex_unlock(&evdev->mutex);
341-
return 0;
342-
}
343-
344330
static void evdev_free(struct device *dev)
345331
{
346332
struct evdev *evdev = container_of(dev, struct evdev, dev);
@@ -454,6 +440,10 @@ static int evdev_release(struct inode *inode, struct file *file)
454440
unsigned int i;
455441

456442
mutex_lock(&evdev->mutex);
443+
444+
if (evdev->exist && !client->revoked)
445+
input_flush_device(&evdev->handle, file);
446+
457447
evdev_ungrab(evdev, client);
458448
mutex_unlock(&evdev->mutex);
459449

@@ -1311,7 +1301,6 @@ static const struct file_operations evdev_fops = {
13111301
.compat_ioctl = evdev_ioctl_compat,
13121302
#endif
13131303
.fasync = evdev_fasync,
1314-
.flush = evdev_flush,
13151304
.llseek = no_llseek,
13161305
};
13171306

drivers/input/joystick/xpad.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,16 @@ static const u8 xboxone_fw2015_init[] = {
458458
0x05, 0x20, 0x00, 0x01, 0x00
459459
};
460460

461+
/*
462+
* This packet is required for Xbox One S (0x045e:0x02ea)
463+
* and Xbox One Elite Series 2 (0x045e:0x0b00) pads to
464+
* initialize the controller that was previously used in
465+
* Bluetooth mode.
466+
*/
467+
static const u8 xboxone_s_init[] = {
468+
0x05, 0x20, 0x00, 0x0f, 0x06
469+
};
470+
461471
/*
462472
* This packet is required for the Titanfall 2 Xbox One pads
463473
* (0x0e6f:0x0165) to finish initialization and for Hori pads
@@ -516,6 +526,8 @@ static const struct xboxone_init_packet xboxone_init_packets[] = {
516526
XBOXONE_INIT_PKT(0x0e6f, 0x0165, xboxone_hori_init),
517527
XBOXONE_INIT_PKT(0x0f0d, 0x0067, xboxone_hori_init),
518528
XBOXONE_INIT_PKT(0x0000, 0x0000, xboxone_fw2015_init),
529+
XBOXONE_INIT_PKT(0x045e, 0x02ea, xboxone_s_init),
530+
XBOXONE_INIT_PKT(0x045e, 0x0b00, xboxone_s_init),
519531
XBOXONE_INIT_PKT(0x0e6f, 0x0000, xboxone_pdp_init1),
520532
XBOXONE_INIT_PKT(0x0e6f, 0x0000, xboxone_pdp_init2),
521533
XBOXONE_INIT_PKT(0x24c6, 0x541a, xboxone_rumblebegin_init),

drivers/input/keyboard/applespi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ struct touchpad_protocol {
186186
u8 number_of_fingers;
187187
u8 clicked2;
188188
u8 unknown3[16];
189-
struct tp_finger fingers[0];
189+
struct tp_finger fingers[];
190190
};
191191

192192
/**

drivers/input/keyboard/cros_ec_keyb.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -347,18 +347,14 @@ static int cros_ec_keyb_info(struct cros_ec_device *ec_dev,
347347
params->info_type = info_type;
348348
params->event_type = event_type;
349349

350-
ret = cros_ec_cmd_xfer(ec_dev, msg);
351-
if (ret < 0) {
352-
dev_warn(ec_dev->dev, "Transfer error %d/%d: %d\n",
353-
(int)info_type, (int)event_type, ret);
354-
} else if (msg->result == EC_RES_INVALID_VERSION) {
350+
ret = cros_ec_cmd_xfer_status(ec_dev, msg);
351+
if (ret == -ENOTSUPP) {
355352
/* With older ECs we just return 0 for everything */
356353
memset(result, 0, result_size);
357354
ret = 0;
358-
} else if (msg->result != EC_RES_SUCCESS) {
359-
dev_warn(ec_dev->dev, "Error getting info %d/%d: %d\n",
360-
(int)info_type, (int)event_type, msg->result);
361-
ret = -EPROTO;
355+
} else if (ret < 0) {
356+
dev_warn(ec_dev->dev, "Transfer error %d/%d: %d\n",
357+
(int)info_type, (int)event_type, ret);
362358
} else if (ret != result_size) {
363359
dev_warn(ec_dev->dev, "Wrong size %d/%d: %d != %zu\n",
364360
(int)info_type, (int)event_type,

drivers/input/keyboard/dlink-dir685-touchkeys.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ MODULE_DEVICE_TABLE(of, dir685_tk_of_match);
143143

144144
static struct i2c_driver dir685_tk_i2c_driver = {
145145
.driver = {
146-
.name = "dlin-dir685-touchkeys",
146+
.name = "dlink-dir685-touchkeys",
147147
.of_match_table = of_match_ptr(dir685_tk_of_match),
148148
},
149149
.probe = dir685_tk_probe,

drivers/input/misc/axp20x-pek.c

Lines changed: 37 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,11 @@ ATTRIBUTE_GROUPS(axp20x);
205205

206206
static irqreturn_t axp20x_pek_irq(int irq, void *pwr)
207207
{
208-
struct input_dev *idev = pwr;
209-
struct axp20x_pek *axp20x_pek = input_get_drvdata(idev);
208+
struct axp20x_pek *axp20x_pek = pwr;
209+
struct input_dev *idev = axp20x_pek->input;
210+
211+
if (!idev)
212+
return IRQ_HANDLED;
210213

211214
/*
212215
* The power-button is connected to ground so a falling edge (dbf)
@@ -225,22 +228,9 @@ static irqreturn_t axp20x_pek_irq(int irq, void *pwr)
225228
static int axp20x_pek_probe_input_device(struct axp20x_pek *axp20x_pek,
226229
struct platform_device *pdev)
227230
{
228-
struct axp20x_dev *axp20x = axp20x_pek->axp20x;
229231
struct input_dev *idev;
230232
int error;
231233

232-
axp20x_pek->irq_dbr = platform_get_irq_byname(pdev, "PEK_DBR");
233-
if (axp20x_pek->irq_dbr < 0)
234-
return axp20x_pek->irq_dbr;
235-
axp20x_pek->irq_dbr = regmap_irq_get_virq(axp20x->regmap_irqc,
236-
axp20x_pek->irq_dbr);
237-
238-
axp20x_pek->irq_dbf = platform_get_irq_byname(pdev, "PEK_DBF");
239-
if (axp20x_pek->irq_dbf < 0)
240-
return axp20x_pek->irq_dbf;
241-
axp20x_pek->irq_dbf = regmap_irq_get_virq(axp20x->regmap_irqc,
242-
axp20x_pek->irq_dbf);
243-
244234
axp20x_pek->input = devm_input_allocate_device(&pdev->dev);
245235
if (!axp20x_pek->input)
246236
return -ENOMEM;
@@ -255,33 +245,13 @@ static int axp20x_pek_probe_input_device(struct axp20x_pek *axp20x_pek,
255245

256246
input_set_drvdata(idev, axp20x_pek);
257247

258-
error = devm_request_any_context_irq(&pdev->dev, axp20x_pek->irq_dbr,
259-
axp20x_pek_irq, 0,
260-
"axp20x-pek-dbr", idev);
261-
if (error < 0) {
262-
dev_err(&pdev->dev, "Failed to request dbr IRQ#%d: %d\n",
263-
axp20x_pek->irq_dbr, error);
264-
return error;
265-
}
266-
267-
error = devm_request_any_context_irq(&pdev->dev, axp20x_pek->irq_dbf,
268-
axp20x_pek_irq, 0,
269-
"axp20x-pek-dbf", idev);
270-
if (error < 0) {
271-
dev_err(&pdev->dev, "Failed to request dbf IRQ#%d: %d\n",
272-
axp20x_pek->irq_dbf, error);
273-
return error;
274-
}
275-
276248
error = input_register_device(idev);
277249
if (error) {
278250
dev_err(&pdev->dev, "Can't register input device: %d\n",
279251
error);
280252
return error;
281253
}
282254

283-
device_init_wakeup(&pdev->dev, true);
284-
285255
return 0;
286256
}
287257

@@ -339,6 +309,18 @@ static int axp20x_pek_probe(struct platform_device *pdev)
339309

340310
axp20x_pek->axp20x = dev_get_drvdata(pdev->dev.parent);
341311

312+
axp20x_pek->irq_dbr = platform_get_irq_byname(pdev, "PEK_DBR");
313+
if (axp20x_pek->irq_dbr < 0)
314+
return axp20x_pek->irq_dbr;
315+
axp20x_pek->irq_dbr = regmap_irq_get_virq(
316+
axp20x_pek->axp20x->regmap_irqc, axp20x_pek->irq_dbr);
317+
318+
axp20x_pek->irq_dbf = platform_get_irq_byname(pdev, "PEK_DBF");
319+
if (axp20x_pek->irq_dbf < 0)
320+
return axp20x_pek->irq_dbf;
321+
axp20x_pek->irq_dbf = regmap_irq_get_virq(
322+
axp20x_pek->axp20x->regmap_irqc, axp20x_pek->irq_dbf);
323+
342324
if (axp20x_pek_should_register_input(axp20x_pek, pdev)) {
343325
error = axp20x_pek_probe_input_device(axp20x_pek, pdev);
344326
if (error)
@@ -347,6 +329,26 @@ static int axp20x_pek_probe(struct platform_device *pdev)
347329

348330
axp20x_pek->info = (struct axp20x_info *)match->driver_data;
349331

332+
error = devm_request_any_context_irq(&pdev->dev, axp20x_pek->irq_dbr,
333+
axp20x_pek_irq, 0,
334+
"axp20x-pek-dbr", axp20x_pek);
335+
if (error < 0) {
336+
dev_err(&pdev->dev, "Failed to request dbr IRQ#%d: %d\n",
337+
axp20x_pek->irq_dbr, error);
338+
return error;
339+
}
340+
341+
error = devm_request_any_context_irq(&pdev->dev, axp20x_pek->irq_dbf,
342+
axp20x_pek_irq, 0,
343+
"axp20x-pek-dbf", axp20x_pek);
344+
if (error < 0) {
345+
dev_err(&pdev->dev, "Failed to request dbf IRQ#%d: %d\n",
346+
axp20x_pek->irq_dbf, error);
347+
return error;
348+
}
349+
350+
device_init_wakeup(&pdev->dev, true);
351+
350352
platform_set_drvdata(pdev, axp20x_pek);
351353

352354
return 0;

drivers/input/rmi4/rmi_driver.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ static irqreturn_t rmi_irq_fn(int irq, void *dev_id)
205205

206206
if (count) {
207207
kfree(attn_data.data);
208-
attn_data.data = NULL;
208+
drvdata->attn_data.data = NULL;
209209
}
210210

211211
if (!kfifo_is_empty(&drvdata->attn_fifo))
@@ -1210,7 +1210,8 @@ static int rmi_driver_probe(struct device *dev)
12101210
if (data->input) {
12111211
rmi_driver_set_input_name(rmi_dev, data->input);
12121212
if (!rmi_dev->xport->input) {
1213-
if (input_register_device(data->input)) {
1213+
retval = input_register_device(data->input);
1214+
if (retval) {
12141215
dev_err(dev, "%s: Failed to register input device.\n",
12151216
__func__);
12161217
goto err_destroy_functions;

drivers/input/serio/i8042-x86ia64io.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,13 @@ static const struct dmi_system_id __initconst i8042_dmi_reset_table[] = {
662662
DMI_MATCH(DMI_PRODUCT_NAME, "P65xRP"),
663663
},
664664
},
665+
{
666+
/* Lenovo ThinkPad Twist S230u */
667+
.matches = {
668+
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
669+
DMI_MATCH(DMI_PRODUCT_NAME, "33474HU"),
670+
},
671+
},
665672
{ }
666673
};
667674

drivers/input/touchscreen/elants_i2c.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
*/
2020

2121

22+
#include <linux/bits.h>
2223
#include <linux/module.h>
2324
#include <linux/input.h>
2425
#include <linux/interrupt.h>
@@ -73,6 +74,7 @@
7374
#define FW_POS_STATE 1
7475
#define FW_POS_TOTAL 2
7576
#define FW_POS_XY 3
77+
#define FW_POS_TOOL_TYPE 33
7678
#define FW_POS_CHECKSUM 34
7779
#define FW_POS_WIDTH 35
7880
#define FW_POS_PRESSURE 45
@@ -843,6 +845,7 @@ static void elants_i2c_mt_event(struct elants_data *ts, u8 *buf)
843845
{
844846
struct input_dev *input = ts->input;
845847
unsigned int n_fingers;
848+
unsigned int tool_type;
846849
u16 finger_state;
847850
int i;
848851

@@ -853,6 +856,10 @@ static void elants_i2c_mt_event(struct elants_data *ts, u8 *buf)
853856
dev_dbg(&ts->client->dev,
854857
"n_fingers: %u, state: %04x\n", n_fingers, finger_state);
855858

859+
/* Note: all fingers have the same tool type */
860+
tool_type = buf[FW_POS_TOOL_TYPE] & BIT(0) ?
861+
MT_TOOL_FINGER : MT_TOOL_PALM;
862+
856863
for (i = 0; i < MAX_CONTACT_NUM && n_fingers; i++) {
857864
if (finger_state & 1) {
858865
unsigned int x, y, p, w;
@@ -868,7 +875,7 @@ static void elants_i2c_mt_event(struct elants_data *ts, u8 *buf)
868875
i, x, y, p, w);
869876

870877
input_mt_slot(input, i);
871-
input_mt_report_slot_state(input, MT_TOOL_FINGER, true);
878+
input_mt_report_slot_state(input, tool_type, true);
872879
input_event(input, EV_ABS, ABS_MT_POSITION_X, x);
873880
input_event(input, EV_ABS, ABS_MT_POSITION_Y, y);
874881
input_event(input, EV_ABS, ABS_MT_PRESSURE, p);
@@ -1333,6 +1340,8 @@ static int elants_i2c_probe(struct i2c_client *client,
13331340
input_set_abs_params(ts->input, ABS_MT_POSITION_Y, 0, ts->y_max, 0, 0);
13341341
input_set_abs_params(ts->input, ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0);
13351342
input_set_abs_params(ts->input, ABS_MT_PRESSURE, 0, 255, 0, 0);
1343+
input_set_abs_params(ts->input, ABS_MT_TOOL_TYPE,
1344+
0, MT_TOOL_PALM, 0, 0);
13361345
input_abs_set_res(ts->input, ABS_MT_POSITION_X, ts->x_res);
13371346
input_abs_set_res(ts->input, ABS_MT_POSITION_Y, ts->y_res);
13381347
input_abs_set_res(ts->input, ABS_MT_TOUCH_MAJOR, 1);

drivers/input/touchscreen/mms114.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,15 @@ static int __mms114_read_reg(struct mms114_data *data, unsigned int reg,
9292
if (reg <= MMS114_MODE_CONTROL && reg + len > MMS114_MODE_CONTROL)
9393
BUG();
9494

95-
/* Write register: use repeated start */
95+
/* Write register */
9696
xfer[0].addr = client->addr;
97-
xfer[0].flags = I2C_M_TEN | I2C_M_NOSTART;
97+
xfer[0].flags = client->flags & I2C_M_TEN;
9898
xfer[0].len = 1;
9999
xfer[0].buf = &buf;
100100

101101
/* Read data */
102102
xfer[1].addr = client->addr;
103-
xfer[1].flags = I2C_M_RD;
103+
xfer[1].flags = (client->flags & I2C_M_TEN) | I2C_M_RD;
104104
xfer[1].len = len;
105105
xfer[1].buf = val;
106106

@@ -438,10 +438,8 @@ static int mms114_probe(struct i2c_client *client,
438438
const void *match_data;
439439
int error;
440440

441-
if (!i2c_check_functionality(client->adapter,
442-
I2C_FUNC_PROTOCOL_MANGLING)) {
443-
dev_err(&client->dev,
444-
"Need i2c bus that supports protocol mangling\n");
441+
if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
442+
dev_err(&client->dev, "Not supported I2C adapter\n");
445443
return -ENODEV;
446444
}
447445

0 commit comments

Comments
 (0)