Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/dtor/input

Pull second round of input updates from Dmitry Torokhov:
 "Mostly simple bug fixes, although we do have one brand new driver for
  Microchip AR1021 i2c touchscreen.

  Also there is the change to stop trying to use i8042 active
  multiplexing by default (it is still possible to activate it via
  i8042.nomux=0 on boxes that implement it)"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
  Input: xpad - add Thrustmaster as Xbox 360 controller vendor
  Input: xpad - add USB ID for Thrustmaster Ferrari 458 Racing Wheel
  Input: max77693-haptic - fix state check in imax77693_haptic_disable()
  Input: xen-kbdfront - free grant table entry in xenkbd_disconnect_backend
  Input: alps - fix v4 button press recognition
  Input: i8042 - disable active multiplexing by default
  Input: i8042 - add noloop quirk for Asus X750LN
  Input: synaptics - gate forcepad support by DMI check
  Input: Add Microchip AR1021 i2c touchscreen
  Input: cros_ec_keyb - add of match table
  Input: serio - avoid negative serio device numbers
  Input: avoid negative input device numbers
  Input: automatically set EV_ABS bit in input_set_abs_params
  Input: adp5588-keys - cancel workqueue in failure path
  Input: opencores-kbd - switch to using managed resources
  Input: evdev - fix EVIOCG{type} ioctl
  • Loading branch information
torvalds committed Oct 19, 2014
2 parents 2eb7f91 + 4dfb15c commit fb378df
Show file tree
Hide file tree
Showing 18 changed files with 280 additions and 351 deletions.
2 changes: 1 addition & 1 deletion Documentation/kernel-parameters.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1260,7 +1260,7 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
i8042.noloop [HW] Disable the AUX Loopback command while probing
for the AUX port
i8042.nomux [HW] Don't check presence of an active multiplexing
controller
controller. Default: true.
i8042.nopnp [HW] Don't use ACPIPnP / PnPBIOS to discover KBD/AUX
controllers
i8042.notimeout [HW] Ignore timeout condition signalled by controller
Expand Down
13 changes: 8 additions & 5 deletions drivers/input/evdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -738,28 +738,31 @@ static int evdev_handle_set_keycode_v2(struct input_dev *dev, void __user *p)
*/
static int evdev_handle_get_val(struct evdev_client *client,
struct input_dev *dev, unsigned int type,
unsigned long *bits, unsigned int max,
unsigned int size, void __user *p, int compat)
unsigned long *bits, unsigned int maxbit,
unsigned int maxlen, void __user *p,
int compat)
{
int ret;
unsigned long *mem;
size_t len;

mem = kmalloc(sizeof(unsigned long) * max, GFP_KERNEL);
len = BITS_TO_LONGS(maxbit) * sizeof(unsigned long);
mem = kmalloc(len, GFP_KERNEL);
if (!mem)
return -ENOMEM;

spin_lock_irq(&dev->event_lock);
spin_lock(&client->buffer_lock);

memcpy(mem, bits, sizeof(unsigned long) * max);
memcpy(mem, bits, len);

spin_unlock(&dev->event_lock);

__evdev_flush_queue(client, type);

spin_unlock_irq(&client->buffer_lock);

ret = bits_to_user(mem, max, size, p, compat);
ret = bits_to_user(mem, maxbit, maxlen, p, compat);
if (ret < 0)
evdev_queue_syn_dropped(client);

Expand Down
5 changes: 3 additions & 2 deletions drivers/input/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,8 @@ void input_set_abs_params(struct input_dev *dev, unsigned int axis,
absinfo->fuzz = fuzz;
absinfo->flat = flat;

dev->absbit[BIT_WORD(axis)] |= BIT_MASK(axis);
__set_bit(EV_ABS, dev->evbit);
__set_bit(axis, dev->absbit);
}
EXPORT_SYMBOL(input_set_abs_params);

Expand Down Expand Up @@ -1788,7 +1789,7 @@ struct input_dev *input_allocate_device(void)
INIT_LIST_HEAD(&dev->h_list);
INIT_LIST_HEAD(&dev->node);

dev_set_name(&dev->dev, "input%ld",
dev_set_name(&dev->dev, "input%lu",
(unsigned long) atomic_inc_return(&input_no) - 1);

__module_get(THIS_MODULE);
Expand Down
2 changes: 2 additions & 0 deletions drivers/input/joystick/xpad.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ static const struct xpad_device {
{ 0x24c6, 0x5501, "Hori Real Arcade Pro VX-SA", 0, XTYPE_XBOX360 },
{ 0x24c6, 0x5506, "Hori SOULCALIBUR V Stick", 0, XTYPE_XBOX360 },
{ 0x24c6, 0x5b02, "Thrustmaster, Inc. GPX Controller", 0, XTYPE_XBOX360 },
{ 0x24c6, 0x5b03, "Thrustmaster Ferrari 458 Racing Wheel", 0, XTYPE_XBOX360 },
{ 0xffff, 0xffff, "Chinese-made Xbox Controller", 0, XTYPE_XBOX },
{ 0x0000, 0x0000, "Generic X-Box pad", 0, XTYPE_UNKNOWN }
};
Expand Down Expand Up @@ -292,6 +293,7 @@ static const signed short xpad_abs_triggers[] = {

static struct usb_device_id xpad_table[] = {
{ USB_INTERFACE_INFO('X', 'B', 0) }, /* X-Box USB-IF not approved class */
XPAD_XBOX360_VENDOR(0x044f), /* Thrustmaster X-Box 360 controllers */
XPAD_XBOX360_VENDOR(0x045e), /* Microsoft X-Box 360 controllers */
XPAD_XBOXONE_VENDOR(0x045e), /* Microsoft X-Box One controllers */
XPAD_XBOX360_VENDOR(0x046d), /* Logitech X-Box 360 style controllers */
Expand Down
1 change: 1 addition & 0 deletions drivers/input/keyboard/adp5588-keys.c
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,7 @@ static int adp5588_probe(struct i2c_client *client,

err_free_irq:
free_irq(client->irq, kpad);
cancel_delayed_work_sync(&kpad->work);
err_unreg_dev:
input_unregister_device(input);
input = NULL;
Expand Down
9 changes: 9 additions & 0 deletions drivers/input/keyboard/cros_ec_keyb.c
Original file line number Diff line number Diff line change
Expand Up @@ -348,10 +348,19 @@ static int cros_ec_keyb_resume(struct device *dev)

static SIMPLE_DEV_PM_OPS(cros_ec_keyb_pm_ops, NULL, cros_ec_keyb_resume);

#ifdef CONFIG_OF
static const struct of_device_id cros_ec_keyb_of_match[] = {
{ .compatible = "google,cros-ec-keyb" },
{},
};
MODULE_DEVICE_TABLE(of, cros_ec_keyb_of_match);
#endif

static struct platform_driver cros_ec_keyb_driver = {
.probe = cros_ec_keyb_probe,
.driver = {
.name = "cros-ec-keyb",
.of_match_table = of_match_ptr(cros_ec_keyb_of_match),
.pm = &cros_ec_keyb_pm_ops,
},
};
Expand Down
72 changes: 17 additions & 55 deletions drivers/input/keyboard/opencores-kbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

struct opencores_kbd {
struct input_dev *input;
struct resource *addr_res;
void __iomem *addr;
int irq;
unsigned short keycodes[128];
Expand Down Expand Up @@ -56,35 +55,25 @@ static int opencores_kbd_probe(struct platform_device *pdev)
return -EINVAL;
}

opencores_kbd = kzalloc(sizeof(*opencores_kbd), GFP_KERNEL);
input = input_allocate_device();
if (!opencores_kbd || !input) {
dev_err(&pdev->dev, "failed to allocate device structures\n");
error = -ENOMEM;
goto err_free_mem;
}

opencores_kbd->addr_res = res;
res = request_mem_region(res->start, resource_size(res), pdev->name);
if (!res) {
dev_err(&pdev->dev, "failed to request I/O memory\n");
error = -EBUSY;
goto err_free_mem;
}
opencores_kbd = devm_kzalloc(&pdev->dev, sizeof(*opencores_kbd),
GFP_KERNEL);
if (!opencores_kbd)
return -ENOMEM;

opencores_kbd->addr = ioremap(res->start, resource_size(res));
if (!opencores_kbd->addr) {
dev_err(&pdev->dev, "failed to remap I/O memory\n");
error = -ENXIO;
goto err_rel_mem;
input = devm_input_allocate_device(&pdev->dev);
if (!input) {
dev_err(&pdev->dev, "failed to allocate input device\n");
return -ENOMEM;
}

opencores_kbd->input = input;
opencores_kbd->irq = irq;

opencores_kbd->addr = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(opencores_kbd->addr))
error = PTR_ERR(opencores_kbd->addr);

input->name = pdev->name;
input->phys = "opencores-kbd/input0";
input->dev.parent = &pdev->dev;

input_set_drvdata(input, opencores_kbd);

Expand All @@ -109,54 +98,27 @@ static int opencores_kbd_probe(struct platform_device *pdev)
}
__clear_bit(KEY_RESERVED, input->keybit);

error = request_irq(irq, &opencores_kbd_isr,
IRQF_TRIGGER_RISING, pdev->name, opencores_kbd);
error = devm_request_irq(&pdev->dev, irq, &opencores_kbd_isr,
IRQF_TRIGGER_RISING,
pdev->name, opencores_kbd);
if (error) {
dev_err(&pdev->dev, "unable to claim irq %d\n", irq);
goto err_unmap_mem;
return error;
}

error = input_register_device(input);
if (error) {
dev_err(&pdev->dev, "unable to register input device\n");
goto err_free_irq;
return error;
}

platform_set_drvdata(pdev, opencores_kbd);

return 0;

err_free_irq:
free_irq(irq, opencores_kbd);
err_unmap_mem:
iounmap(opencores_kbd->addr);
err_rel_mem:
release_mem_region(res->start, resource_size(res));
err_free_mem:
input_free_device(input);
kfree(opencores_kbd);

return error;
}

static int opencores_kbd_remove(struct platform_device *pdev)
{
struct opencores_kbd *opencores_kbd = platform_get_drvdata(pdev);

free_irq(opencores_kbd->irq, opencores_kbd);

iounmap(opencores_kbd->addr);
release_mem_region(opencores_kbd->addr_res->start,
resource_size(opencores_kbd->addr_res));
input_unregister_device(opencores_kbd->input);
kfree(opencores_kbd);

return 0;
}

static struct platform_driver opencores_kbd_device_driver = {
.probe = opencores_kbd_probe,
.remove = opencores_kbd_remove,
.driver = {
.name = "opencores-kbd",
},
Expand Down
2 changes: 1 addition & 1 deletion drivers/input/misc/max77693-haptic.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ static void max77693_haptic_disable(struct max77693_haptic *haptic)
{
int error;

if (haptic->enabled)
if (!haptic->enabled)
return;

error = max77693_haptic_configure(haptic, false);
Expand Down
4 changes: 2 additions & 2 deletions drivers/input/misc/xen-kbdfront.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ static int xenkbd_connect_backend(struct xenbus_device *dev,
error_evtchan:
xenbus_free_evtchn(dev, evtchn);
error_grant:
gnttab_end_foreign_access_ref(info->gref, 0);
gnttab_end_foreign_access(info->gref, 0, 0UL);
info->gref = -1;
return ret;
}
Expand All @@ -296,7 +296,7 @@ static void xenkbd_disconnect_backend(struct xenkbd_info *info)
unbind_from_irqhandler(info->irq, info);
info->irq = -1;
if (info->gref >= 0)
gnttab_end_foreign_access_ref(info->gref, 0);
gnttab_end_foreign_access(info->gref, 0, 0UL);
info->gref = -1;
}

Expand Down
4 changes: 2 additions & 2 deletions drivers/input/mouse/alps.c
Original file line number Diff line number Diff line change
Expand Up @@ -835,8 +835,8 @@ static void alps_process_packet_v4(struct psmouse *psmouse)
f->fingers = alps_process_bitmap(priv, f);
}

f->left = packet[4] & 0x01;
f->right = packet[4] & 0x02;
f->left = !!(packet[4] & 0x01);
f->right = !!(packet[4] & 0x02);

f->st.x = ((packet[1] & 0x7f) << 4) | ((packet[3] & 0x30) >> 2) |
((packet[0] & 0x30) >> 4);
Expand Down
22 changes: 21 additions & 1 deletion drivers/input/mouse/synaptics.c
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,8 @@ static void synaptics_parse_agm(const unsigned char buf[],
priv->agm_pending = true;
}

static bool is_forcepad;

static int synaptics_parse_hw_state(const unsigned char buf[],
struct synaptics_data *priv,
struct synaptics_hw_state *hw)
Expand Down Expand Up @@ -636,7 +638,7 @@ static int synaptics_parse_hw_state(const unsigned char buf[],
hw->left = (buf[0] & 0x01) ? 1 : 0;
hw->right = (buf[0] & 0x02) ? 1 : 0;

if (SYN_CAP_FORCEPAD(priv->ext_cap_0c)) {
if (is_forcepad) {
/*
* ForcePads, like Clickpads, use middle button
* bits to report primary button clicks.
Expand Down Expand Up @@ -1667,11 +1669,29 @@ static const struct dmi_system_id __initconst cr48_dmi_table[] = {
{ }
};

static const struct dmi_system_id forcepad_dmi_table[] __initconst = {
#if defined(CONFIG_DMI) && defined(CONFIG_X86)
{
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
DMI_MATCH(DMI_PRODUCT_NAME, "HP EliteBook Folio 1040 G1"),
},
},
#endif
{ }
};

void __init synaptics_module_init(void)
{
impaired_toshiba_kbc = dmi_check_system(toshiba_dmi_table);
broken_olpc_ec = dmi_check_system(olpc_dmi_table);
cr48_profile_sensor = dmi_check_system(cr48_dmi_table);

/*
* Unfortunately ForcePad capability is not exported over PS/2,
* so we have to resort to checking DMI.
*/
is_forcepad = dmi_check_system(forcepad_dmi_table);
}

static int __synaptics_init(struct psmouse *psmouse, bool absolute_mode)
Expand Down
8 changes: 2 additions & 6 deletions drivers/input/mouse/synaptics.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,9 @@
* for noise.
* 2 0x08 image sensor image sensor tracks 5 fingers, but only
* reports 2.
* 2 0x01 uniform clickpad whole clickpad moves instead of being
* hinged at the top.
* 2 0x20 report min query 0x0f gives min coord reported
* 2 0x80 forcepad forcepad is a variant of clickpad that
* does not have physical buttons but rather
* uses pressure above certain threshold to
* report primary clicks. Forcepads also have
* clickpad bit set.
*/
#define SYN_CAP_CLICKPAD(ex0c) ((ex0c) & 0x100000) /* 1-button ClickPad */
#define SYN_CAP_CLICKPAD2BTN(ex0c) ((ex0c) & 0x000100) /* 2-button ClickPad */
Expand All @@ -91,7 +88,6 @@
#define SYN_CAP_ADV_GESTURE(ex0c) ((ex0c) & 0x080000)
#define SYN_CAP_REDUCED_FILTERING(ex0c) ((ex0c) & 0x000400)
#define SYN_CAP_IMAGE_SENSOR(ex0c) ((ex0c) & 0x000800)
#define SYN_CAP_FORCEPAD(ex0c) ((ex0c) & 0x008000)

/* synaptics modes query bits */
#define SYN_MODE_ABSOLUTE(m) ((m) & (1 << 7))
Expand Down
Loading

0 comments on commit fb378df

Please sign in to comment.