提交 fb378df5 编写于 作者: L Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/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
......@@ -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
......
......@@ -738,20 +738,23 @@ 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);
......@@ -759,7 +762,7 @@ static int evdev_handle_get_val(struct evdev_client *client,
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);
......
......@@ -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);
......@@ -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);
......
......@@ -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 }
};
......@@ -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 */
......
......@@ -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;
......
......@@ -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,
},
};
......
......@@ -18,7 +18,6 @@
struct opencores_kbd {
struct input_dev *input;
struct resource *addr_res;
void __iomem *addr;
int irq;
unsigned short keycodes[128];
......@@ -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);
......@@ -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",
},
......
......@@ -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);
......
......@@ -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;
}
......@@ -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;
}
......
......@@ -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);
......
......@@ -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)
......@@ -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.
......@@ -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)
......
......@@ -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 */
......@@ -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))
......
......@@ -99,6 +99,12 @@ static const struct dmi_system_id __initconst i8042_dmi_noloop_table[] = {
DMI_MATCH(DMI_BOARD_VERSION, "REV 2.X"),
},
},
{
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
DMI_MATCH(DMI_PRODUCT_NAME, "X750LN"),
},
},
{
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Compaq"),
......@@ -201,282 +207,17 @@ static const struct dmi_system_id __initconst i8042_dmi_noloop_table[] = {
};
/*
* Some Fujitsu notebooks are having trouble with touchpads if
* active multiplexing mode is activated. Luckily they don't have
* external PS/2 ports so we can safely disable it.
* ... apparently some Toshibas don't like MUX mode either and
* die horrible death on reboot.
* Some laptops do implement active multiplexing mode correctly;
* unfortunately they are in minority.
*/
static const struct dmi_system_id __initconst i8042_dmi_nomux_table[] = {
{
/* Fujitsu Lifebook P7010/P7010D */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
DMI_MATCH(DMI_PRODUCT_NAME, "P7010"),
},
},
{
/* Fujitsu Lifebook P7010 */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
DMI_MATCH(DMI_PRODUCT_NAME, "0000000000"),
},
},
{
/* Fujitsu Lifebook P5020D */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook P Series"),
},
},
{
/* Fujitsu Lifebook S2000 */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook S Series"),
},
},
{
/* Fujitsu Lifebook S6230 */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook S6230"),
},
},
{
/* Fujitsu T70H */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
DMI_MATCH(DMI_PRODUCT_NAME, "FMVLT70H"),
},
},
{
/* Fujitsu-Siemens Lifebook T3010 */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK T3010"),
},
},
{
/* Fujitsu-Siemens Lifebook E4010 */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK E4010"),
},
},
{
/* Fujitsu-Siemens Amilo Pro 2010 */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Pro V2010"),
},
},
{
/* Fujitsu-Siemens Amilo Pro 2030 */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
DMI_MATCH(DMI_PRODUCT_NAME, "AMILO PRO V2030"),
},
},
{
/*
* No data is coming from the touchscreen unless KBC
* is in legacy mode.
*/
/* Panasonic CF-29 */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Matsushita"),
DMI_MATCH(DMI_PRODUCT_NAME, "CF-29"),
},
},
{
/*
* HP Pavilion DV4017EA -
* errors on MUX ports are reported without raising AUXDATA
* causing "spurious NAK" messages.
*/
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
DMI_MATCH(DMI_PRODUCT_NAME, "Pavilion dv4000 (EA032EA#ABF)"),
},
},
{
/*
* HP Pavilion ZT1000 -
* like DV4017EA does not raise AUXERR for errors on MUX ports.
*/
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion Notebook PC"),
DMI_MATCH(DMI_PRODUCT_VERSION, "HP Pavilion Notebook ZT1000"),
},
},
{
/*
* HP Pavilion DV4270ca -
* like DV4017EA does not raise AUXERR for errors on MUX ports.
*/
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
DMI_MATCH(DMI_PRODUCT_NAME, "Pavilion dv4000 (EH476UA#ABL)"),
},
},
{
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
DMI_MATCH(DMI_PRODUCT_NAME, "Satellite P10"),
},
},
{
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
DMI_MATCH(DMI_PRODUCT_NAME, "EQUIUM A110"),
},
},
{
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
DMI_MATCH(DMI_PRODUCT_NAME, "SATELLITE C850D"),
},
},
{
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "ALIENWARE"),
DMI_MATCH(DMI_PRODUCT_NAME, "Sentia"),
},
},
{
/* Sharp Actius MM20 */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "SHARP"),
DMI_MATCH(DMI_PRODUCT_NAME, "PC-MM20 Series"),
},
},
{
/* Sony Vaio FS-115b */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FS115B"),
},
},
static const struct dmi_system_id __initconst i8042_dmi_mux_table[] = {
{
/*
* Sony Vaio FZ-240E -
* reset and GET ID commands issued via KBD port are
* sometimes being delivered to AUX3.
* Panasonic CF-18 needs to be in MUX mode since the
* touchscreen is on serio3 and it also has touchpad.
*/
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FZ240E"),
},
},
{
/*
* Most (all?) VAIOs do not have external PS/2 ports nor
* they implement active multiplexing properly, and
* MUX discovery usually messes up keyboard/touchpad.
*/
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
DMI_MATCH(DMI_BOARD_NAME, "VAIO"),
},
},
{
/* Amoi M636/A737 */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Amoi Electronics CO.,LTD."),
DMI_MATCH(DMI_PRODUCT_NAME, "M636/A737 platform"),
},
},
{
/* Lenovo 3000 n100 */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_PRODUCT_NAME, "076804U"),
},
},
{
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 1360"),
},
},
{
/* Acer Aspire 5710 */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5710"),
},
},
{
/* Gericom Bellagio */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Gericom"),
DMI_MATCH(DMI_PRODUCT_NAME, "N34AS6"),
},
},
{
/* IBM 2656 */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "IBM"),
DMI_MATCH(DMI_PRODUCT_NAME, "2656"),
},
},
{
/* Dell XPS M1530 */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
DMI_MATCH(DMI_PRODUCT_NAME, "XPS M1530"),
},
},
{
/* Compal HEL80I */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "COMPAL"),
DMI_MATCH(DMI_PRODUCT_NAME, "HEL80I"),
},
},
{
/* Dell Vostro 1510 */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
DMI_MATCH(DMI_PRODUCT_NAME, "Vostro1510"),
},
},
{
/* Acer Aspire 5536 */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5536"),
DMI_MATCH(DMI_PRODUCT_VERSION, "0100"),
},
},
{
/* Dell Vostro V13 */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
DMI_MATCH(DMI_PRODUCT_NAME, "Vostro V13"),
},
},
{
/* Newer HP Pavilion dv4 models */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv4 Notebook PC"),
},
},
{
/* Asus X450LCP */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
DMI_MATCH(DMI_PRODUCT_NAME, "X450LCP"),
},
},
{
/* Avatar AVIU-145A6 */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Intel"),
DMI_MATCH(DMI_PRODUCT_NAME, "IC4I"),
DMI_MATCH(DMI_PRODUCT_NAME, "CF-18"),
},
},
{ }
......@@ -999,8 +740,8 @@ static int __init i8042_platform_init(void)
if (dmi_check_system(i8042_dmi_noloop_table))
i8042_noloop = true;
if (dmi_check_system(i8042_dmi_nomux_table))
i8042_nomux = true;
if (dmi_check_system(i8042_dmi_mux_table))
i8042_nomux = false;
if (dmi_check_system(i8042_dmi_notimeout_table))
i8042_notimeout = true;
......
......@@ -39,7 +39,7 @@ static bool i8042_noaux;
module_param_named(noaux, i8042_noaux, bool, 0);
MODULE_PARM_DESC(noaux, "Do not probe or use AUX (mouse) port.");
static bool i8042_nomux;
static bool i8042_nomux = true;
module_param_named(nomux, i8042_nomux, bool, 0);
MODULE_PARM_DESC(nomux, "Do not check whether an active multiplexing controller is present.");
......
......@@ -524,8 +524,8 @@ static void serio_init_port(struct serio *serio)
spin_lock_init(&serio->lock);
mutex_init(&serio->drv_mutex);
device_initialize(&serio->dev);
dev_set_name(&serio->dev, "serio%ld",
(long)atomic_inc_return(&serio_no) - 1);
dev_set_name(&serio->dev, "serio%lu",
(unsigned long)atomic_inc_return(&serio_no) - 1);
serio->dev.bus = &serio_bus;
serio->dev.release = serio_release_port;
serio->dev.groups = serio_device_attr_groups;
......
......@@ -90,6 +90,18 @@ config TOUCHSCREEN_AD7879_SPI
To compile this driver as a module, choose M here: the
module will be called ad7879-spi.
config TOUCHSCREEN_AR1021_I2C
tristate "Microchip AR1021 i2c touchscreen"
depends on I2C && OF
help
Say Y here if you have the Microchip AR1021 touchscreen controller
chip in your system.
If unsure, say N.
To compile this driver as a module, choose M here: the
module will be called ar1021_i2c.
config TOUCHSCREEN_ATMEL_MXT
tristate "Atmel mXT I2C Touchscreen"
depends on I2C
......
......@@ -13,6 +13,7 @@ obj-$(CONFIG_TOUCHSCREEN_AD7879) += ad7879.o
obj-$(CONFIG_TOUCHSCREEN_AD7879_I2C) += ad7879-i2c.o
obj-$(CONFIG_TOUCHSCREEN_AD7879_SPI) += ad7879-spi.o
obj-$(CONFIG_TOUCHSCREEN_ADS7846) += ads7846.o
obj-$(CONFIG_TOUCHSCREEN_AR1021_I2C) += ar1021_i2c.o
obj-$(CONFIG_TOUCHSCREEN_ATMEL_MXT) += atmel_mxt_ts.o
obj-$(CONFIG_TOUCHSCREEN_AUO_PIXCIR) += auo-pixcir-ts.o
obj-$(CONFIG_TOUCHSCREEN_BU21013) += bu21013_ts.o
......
/*
* Microchip AR1021 driver for I2C
*
* Author: Christian Gmeiner <christian.gmeiner@gmail.com>
*
* License: GPLv2 as published by the FSF.
*/
#include <linux/module.h>
#include <linux/input.h>
#include <linux/of.h>
#include <linux/i2c.h>
#include <linux/irq.h>
#include <linux/interrupt.h>
#define AR1021_TOCUH_PKG_SIZE 5
#define AR1021_MAX_X 4095
#define AR1021_MAX_Y 4095
struct ar1021_i2c {
struct i2c_client *client;
struct input_dev *input;
u8 data[AR1021_TOCUH_PKG_SIZE];
};
static irqreturn_t ar1021_i2c_irq(int irq, void *dev_id)
{
struct ar1021_i2c *ar1021 = dev_id;
struct input_dev *input = ar1021->input;
u8 *data = ar1021->data;
unsigned int x, y, button;
int retval;
retval = i2c_master_recv(ar1021->client,
ar1021->data, sizeof(ar1021->data));
if (retval != sizeof(ar1021->data))
goto out;
/* sync bit set ? */
if ((data[0] & 0x80) == 0)
goto out;
button = data[0] & BIT(0);
x = ((data[2] & 0x1f) << 7) | (data[1] & 0x7f);
y = ((data[4] & 0x1f) << 7) | (data[3] & 0x7f);
input_report_abs(input, ABS_X, x);
input_report_abs(input, ABS_Y, y);
input_report_key(input, BTN_TOUCH, button);
input_sync(input);
out:
return IRQ_HANDLED;
}
static int ar1021_i2c_open(struct input_dev *dev)
{
struct ar1021_i2c *ar1021 = input_get_drvdata(dev);
struct i2c_client *client = ar1021->client;
enable_irq(client->irq);
return 0;
}
static void ar1021_i2c_close(struct input_dev *dev)
{
struct ar1021_i2c *ar1021 = input_get_drvdata(dev);
struct i2c_client *client = ar1021->client;
disable_irq(client->irq);
}
static int ar1021_i2c_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
struct ar1021_i2c *ar1021;
struct input_dev *input;
int error;
if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
dev_err(&client->dev, "i2c_check_functionality error\n");
return -ENXIO;
}
ar1021 = devm_kzalloc(&client->dev, sizeof(*ar1021), GFP_KERNEL);
if (!ar1021)
return -ENOMEM;
input = devm_input_allocate_device(&client->dev);
if (!input)
return -ENOMEM;
ar1021->client = client;
ar1021->input = input;
input->name = "ar1021 I2C Touchscreen";
input->id.bustype = BUS_I2C;
input->dev.parent = &client->dev;
input->open = ar1021_i2c_open;
input->close = ar1021_i2c_close;
input_set_capability(input, EV_KEY, BTN_TOUCH);
input_set_abs_params(input, ABS_X, 0, AR1021_MAX_X, 0, 0);
input_set_abs_params(input, ABS_Y, 0, AR1021_MAX_Y, 0, 0);
input_set_drvdata(input, ar1021);
error = devm_request_threaded_irq(&client->dev, client->irq,
NULL, ar1021_i2c_irq,
IRQF_TRIGGER_RISING | IRQF_ONESHOT,
"ar1021_i2c", ar1021);
if (error) {
dev_err(&client->dev,
"Failed to enable IRQ, error: %d\n", error);
return error;
}
/* Disable the IRQ, we'll enable it in ar1021_i2c_open() */
disable_irq(client->irq);
error = input_register_device(ar1021->input);
if (error) {
dev_err(&client->dev,
"Failed to register input device, error: %d\n", error);
return error;
}
i2c_set_clientdata(client, ar1021);
return 0;
}
static int __maybe_unused ar1021_i2c_suspend(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
disable_irq(client->irq);
return 0;
}
static int __maybe_unused ar1021_i2c_resume(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
enable_irq(client->irq);
return 0;
}
static SIMPLE_DEV_PM_OPS(ar1021_i2c_pm, ar1021_i2c_suspend, ar1021_i2c_resume);
static const struct i2c_device_id ar1021_i2c_id[] = {
{ "MICROCHIP_AR1021_I2C", 0 },
{ },
};
MODULE_DEVICE_TABLE(i2c, ar1021_i2c_id);
static struct of_device_id ar1021_i2c_of_match[] = {
{ .compatible = "microchip,ar1021-i2c", },
{ }
};
MODULE_DEVICE_TABLE(of, ar1021_i2c_of_match);
static struct i2c_driver ar1021_i2c_driver = {
.driver = {
.name = "ar1021_i2c",
.owner = THIS_MODULE,
.pm = &ar1021_i2c_pm,
.of_match_table = ar1021_i2c_of_match,
},
.probe = ar1021_i2c_probe,
.id_table = ar1021_i2c_id,
};
module_i2c_driver(ar1021_i2c_driver);
MODULE_AUTHOR("Christian Gmeiner <christian.gmeiner@gmail.com>");
MODULE_DESCRIPTION("Microchip AR1021 I2C Driver");
MODULE_LICENSE("GPL");
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册