summaryrefslogtreecommitdiff
path: root/drivers/input/serio/i8042.c
AgeCommit message (Collapse)Author
2010-09-20Input: i8042 - fix device removal on unloadDmitry Torokhov
commit af045b86662f17bf130239a65995c61a34f00a6b upstream. We need to call platform_device_unregister(i8042_platform_device) before calling platform_driver_unregister() because i8042_remove() resets i8042_platform_device to NULL. This leaves the platform device instance behind and prevents driver reload. Fixes https://bugzilla.kernel.org/show_bug.cgi?id=16613 Reported-by: Seryodkin Victor <vvscore@gmail.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-11-02Input: i8042 - try to get stable CTR value when initializingDmitry Torokhov
If user presses keys while i8042 is being initialized there is a chance that keyboard data will be mistaken for results of Read Control Register command causing futher troubles. Work around this issue by reading CTR several times and stop when we get matching results. Reported-and-tested-by: Dave Young <hidave.darkstar@gmail.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2009-10-08Input: i8042 - print debug data when testing AUX IRQ deliveryDmitry Torokhov
Sometimes it is not clear why IRQ delivery test failed so let's add some debug printks so we know the exact reason. Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2009-09-17Input: libps2 - additional locking for i8042 portsDmitry Torokhov
The serio ports on i8042 are not completely isolated; while we provide enough locking to ensure proper serialization when accessing control and data registers AUX and KBD ports can still have an effect on each other on PS/2 protocol level. The most prominent effect is that issuing a command for the device connected to one port may cause abort of the command currently executing by the device connected to another port. Since i8042 nor serio subsystem are not aware of the details of the PS/2 protocol (length of the commands and their replies and so on) the locking should be done on libps2 level by adding special handling when we see that we are dealing with serio port on i8042. Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2009-09-10Input: i8042 - use platform_driver_probeDmitry Torokhov
i8042 is not hot-pluggable and we create the device when we register the driver, so let's save some memory by using platform_device_probe and using __init instead of __devinit. Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2009-09-10Input: i8042 - use boolean type where it makes senseDmitry Torokhov
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2009-09-10Input: i8042 - try disabling and re-enabling AUX port at closeDmitry Torokhov
Ever since we switched from having a polling timer to registering IRQ handlers for both keyboard and AUX ports at the driver registration time, on certain boxes probing for a mouse results in keyboard stopping working. The only real difference between old and new way is that before we disabled ports after unsuccessful probe whereas now we leave them as is. Try to emulate the old behavior by disabling and immediately re-enabling AUX and KBD ports when corresponding serio port is being closed. Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2009-09-10Input: i8042 - bypass AUX IRQ delivery test on laptopsDmitry Torokhov
It seems that many laptops do not fully implement AUX LOOP command in their keyboard controllers, causing issues with touchpad detection. We know however that almost every laptop/portable uses a PS/2 pointing device and, even if user disables it in favor of an external mouse, the system will not use IRQ 12 for anything else. Therefore we may bypass AUX IRQ delivery test when running on a laptop and assume that it is routed properly. Just to be safe we require the box to have good PNP data in order to bypass the test. [Jin Dongming <jin.dongming@np.css.fujitsu.com>: fix crash caused by missing terminator in the DMI table] Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2009-07-26Input: i8042 - switch to using dev_pm_opsDmitry Torokhov
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2009-07-07Input: mark serio and i8042 as suspended when hibernating tooThadeu Lima de Souza Cascardo
Serio ports are not being restarted any longer because resume operations after hibernate do nothing, since the device has not been marked as suspended. This happens because suspend is only considering the SUSPEND event but not the FREEZE event. Note that this driver has still to migrate to dev_pm_ops, but this fixes this particular bug now. Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2009-05-09Input: serio - do not use deprecated dev.power.power_stateDmitry Torokhov
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2009-04-11Input: i8042 - introduce a tougher resetArjan van de Ven
Some touchpads don't reset right the first time (MSI Wind U-100 for example). This patch will retry the reset up to 5 times. In addition, on x86, we don't fail entire i8042 initialization if controller reset fails in hope that keyboard port will still be functional and user will still get a working keyboard. This is especially important on netbooks. Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2008-06-17Input: i8042 - retry failed CTR writes when resumingJiri Kosina
There are systems that fail in i8042_resume() with i8042: Can't write CTR to resume as i8042_command(&i8042_ctr, I8042_CMD_CTL_WCTR) fails even though the controller claimed itself to be ready before. One retry after failing write fixes the problems on the failing systems. Reported-by: Helmut Schaa <hschaa@novell.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2008-05-27Input: i8042 - make sure Dritek quirk is invoked at resumeBruno Prémont
Also do not fail i8042 entire initialization if enabling dritek extension fails. Signed-off-by: Bruno Prémont <bonbons@linux-vserver.org> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2008-03-14Input: i8042 - fix warning on non-x86 buildsRoland Dreier
Commit c18bab80 ("Input: i8042 - non-x86 build fix") introduced the following warning on non-x86 builds: drivers/input/serio/i8042.c: In function 'i8042_probe': drivers/input/serio/i8042.c:1154: warning: unused variable 'param' Fix this by moving the parameter variable declaration into the #ifdef too. Signed-off-by: Roland Dreier <rolandd@cisco.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2008-02-06Input: i8042 - non-x86 build fixAndrew Morton
Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2008-01-21Input: i8042 - add Dritek keyboard extension quirkCarlos Corbacho
Some Wistron based laptops need us to explicitly enable the 'Dritek keyboard extension' to make their extra keys start generating scancodes. Originally, this was just confined to older laptops, but a few Acer laptops have turned up in 2007 that also need this again. Signed-off-by: Carlos Corbacho <carlos@strangeworlds.co.uk> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2008-01-21Input: drop redundant includes of moduleparam.hJulia Lawall
Drop #include <linux/moduleparam.h> in files that also include linux/module.h, since module.h includes moduleparam.h already. Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2008-01-21Input: i8042 - use synchronize_irq() instead of synchronize_sched()Dmitry Torokhov
RT guys advised me that in their kernels synchronize_sched() will not work to ensure that all IRQ handlers run to their completion and that synchronize_irq() should be used instead. Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2007-10-22Input: i8042 - export i8042_command()Márton Németh
Export the i8042_command() function which manages the mutual exclusion with the help of the i8042_lock spinlock. This allows to access i8042 safely from other parts of the kernel. Signed-off-by: Márton Németh <nm127@freemail.hu> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2007-10-12Merge master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6Dmitry Torokhov
Conflicts: drivers/macintosh/adbhid.c
2007-09-04Input: i8042 - fix modpost warningRalf Baechle
i8042_unregister_ports's only caller i8042_remove is a __devexit function so make it __devexit too. Signed-off-by: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2007-08-30Input: i8042 - fix retrun value of i8042_aux_test_irqFernando Luis Vázquez Cao
We should not return IRQ_HANDLED if we didn't handle the interrupt. Signed-off-by: Fernando Luis Vazquez Cao <fernando@oss.ntt.co.jp> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2007-07-18Input: i8042 - restore control register when enabling port failsMarkus Armbruster
When enabling interrupts for a port fails, the interrupt enable and port enable bits remain set in i8042_ctr. Later writes of i8042_ctr to the hardware could accidentally retry enabling interrupts. Clear the bits on failure. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2007-05-08Input: i8042 - fix AUX port detection with some chipsRoland Scheidegger
The i8042 driver fails detection of the AUX port with some chips, because they apparently do not change the I8042_CTR_AUXDIS bit immediately. This is known to affect at least HP500/HP510 notebooks, consequently the built-in touchpad will not work. The patch will simply reread the value until it gets the expected value or a retry limit is hit, without touching other workaround code in the same area. Signed-off-by: Roland Scheidegger <sroland@tungstengraphics.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2007-05-01Merge master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6Dmitry Torokhov
Conflicts: drivers/usb/input/Makefile drivers/usb/input/gtco.c
2007-04-12Input: i8042 - disable interfaces when switching to legacy modeDmitry Torokhov
Disable both keyboard and auxiliary interfaces before switching to legacy mode to prevent atkbd from getting "empty" interrupts. Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2007-03-07Input: i8042 - another attempt to fix AUX delivery checksDmitry Torokhov
Do not assume that AUX_LOOP command is broken unless it completes successfully but returns wrong (unexpected) data. Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2007-02-18Input: remove obsolete setup parameters from input driversDmitry Torokhov
They have been marked as __obsolete_setup() for several years, it is time for them to go. Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2007-02-18Input: i8042 - let serio bus suspend portsDmitry Torokhov
Let serio subsystem take care of suspending the ports; concentrate on suspending/resuming the controller itself. Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2007-02-10Input: i8042 - fix AUX IRQ delivery checkDmitry Torokhov
On boxes that do not implement AUX LOOP command we can not verify AUX IRQ delivery and must assume that it is wired properly. Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2007-01-18Input: i8042 - really suppress ACK/NAK during panic blinkDmitry Torokhov
On some boxes panic blink procedure manages to send both bytes to keyboard contoller before getting first ACK so we need to make i8042_suppress_kbd_ack a counter instead of boolean. Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2006-11-17Input: i8042 - fix shutdown issue on some boxes with active MUXesDmitry Torokhov
MUX error handling has a workaround for KBCs that get confused which port data came from and signal MUXERR while data is actually good. Unfortunately this workaround hurts with KBCs that signal timeouts as 0xfc (spec says that only 0xfd, 0xfe and 0xff are alowed with MUXERR) since it causes endless attempts to rescan i8042 serio ports. The solution is to treat 0xfc as timeout (0xfe). Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2006-11-02Input: i8042 - remove unneeded call to i8042_interrupt()Dmitry Torokhov
Remove call to i8042_interrupt() from i8042_aux_write(). According to Vojtech it may cause problems with older controllers if it is called right after real interrupt. Also it is not needed anymore since we register IRQs early and not waiting for serio ports to be opened. Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2006-10-11Input: i8042 - supress ACK/NAKs when blinking during panicDmitry Torokhov
This allows using SysRq and not fill logs with complaints from atkbd. Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2006-10-05IRQ: Maintain regs pointer globally rather than passing to IRQ handlersDavid Howells
Maintain a per-CPU global "struct pt_regs *" variable which can be used instead of passing regs around manually through all ~1800 interrupt handlers in the Linux kernel. The regs pointer is used in few places, but it potentially costs both stack space and code to pass it around. On the FRV arch, removing the regs parameter from all the genirq function results in a 20% speed up of the IRQ exit path (ie: from leaving timer_interrupt() to leaving do_IRQ()). Where appropriate, an arch may override the generic storage facility and do something different with the variable. On FRV, for instance, the address is maintained in GR28 at all times inside the kernel as part of general exception handling. Having looked over the code, it appears that the parameter may be handed down through up to twenty or so layers of functions. Consider a USB character device attached to a USB hub, attached to a USB controller that posts its interrupts through a cascaded auxiliary interrupt controller. A character device driver may want to pass regs to the sysrq handler through the input layer which adds another few layers of parameter passing. I've build this code with allyesconfig for x86_64 and i386. I've runtested the main part of the code on FRV and i386, though I can't test most of the drivers. I've also done partial conversion for powerpc and MIPS - these at least compile with minimal configurations. This will affect all archs. Mostly the changes should be relatively easy. Take do_IRQ(), store the regs pointer at the beginning, saving the old one: struct pt_regs *old_regs = set_irq_regs(regs); And put the old one back at the end: set_irq_regs(old_regs); Don't pass regs through to generic_handle_irq() or __do_IRQ(). In timer_interrupt(), this sort of change will be necessary: - update_process_times(user_mode(regs)); - profile_tick(CPU_PROFILING, regs); + update_process_times(user_mode(get_irq_regs())); + profile_tick(CPU_PROFILING); I'd like to move update_process_times()'s use of get_irq_regs() into itself, except that i386, alone of the archs, uses something other than user_mode(). Some notes on the interrupt handling in the drivers: (*) input_dev() is now gone entirely. The regs pointer is no longer stored in the input_dev struct. (*) finish_unlinks() in drivers/usb/host/ohci-q.c needs checking. It does something different depending on whether it's been supplied with a regs pointer or not. (*) Various IRQ handler function pointers have been moved to type irq_handler_t. Signed-Off-By: David Howells <dhowells@redhat.com> (cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)
2006-09-10Input: i8042 - get rid of polling timerDmitry Torokhov
Remove polling timer that was used to detect keybord/mice hotplug and register both IRQs right away instead of waiting for a driver to attach to a port. Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2006-07-02[PATCH] irq-flags: misc drivers: Use the new IRQF_ constantsThomas Gleixner
Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@elte.hu> Cc: "David S. Miller" <davem@davemloft.net> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-30Remove obsolete #include <linux/config.h>Jörn Engel
Signed-off-by: Jörn Engel <joern@wohnheim.fh-wedel.de> Signed-off-by: Adrian Bunk <bunk@stusta.de>
2005-12-28Input: i8042 - convert to the new platform device interfaceDmitry Torokhov
Do not use platform_device_register_simple() as it is going away, implement ->probe() and ->remove() functions so manual binding and unbinding will work with this driver. Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2005-11-09[DRIVER MODEL] Convert platform drivers to use struct platform_driverRussell King
This allows us to eliminate the casts in the drivers, and eventually remove the use of the device_driver function pointer methods for platform device drivers. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-10-29Create platform_device.h to contain all the platform device details.Russell King
Convert everyone who uses platform_bus_type to include linux/platform_device.h. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-10-28[PATCH] DRIVER MODEL: Get rid of the obsolete tri-level suspend/resume callbacksRussell King
In PM v1, all devices were called at SUSPEND_DISABLE level. Then all devices were called at SUSPEND_SAVE_STATE level, and finally SUSPEND_POWER_DOWN level. However, with PM v2, to maintain compatibility for platform devices, I arranged for the PM v2 suspend/resume callbacks to call the old PM v1 suspend/resume callbacks three times with each level in order so that existing drivers continued to work. Since this is obsolete infrastructure which is no longer necessary, we can remove it. Here's an (untested) patch to do exactly that. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-09-10Input: i8042 - use kzalloc instead of kcallocDmitry Torokhov
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2005-09-04Input: i8042 - add i8042.nokbd module option to allow supressingDmitry Torokhov
creation of keyboard port. Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2005-09-04Input: make i8042_platform_init return 'real' error codeDmitry Torokhov
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2005-09-04Input: i8042 - clean up initialization code; abort if weDmitry Torokhov
can't create all ports. Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2005-07-15Input: i8042 - don't use negation to mark AUX dataDmitry Torokhov
Currently i8042_command() negates data coming from the AUX port of keyboard controller; this is not a very reliable indicator. Change i8042_command() to fail if response to I8042_CMD_AUX_LOOP is not coming from AUX channel and get rid of negation. Based on patch by Vojtech Pavlik. Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2005-06-25[PATCH] RCU: clean up a few remaining synchronize_kernel() callsPaul E. McKenney
2.6.12-rc6-mm1 has a few remaining synchronize_kernel()s, some (but not all) in comments. This patch changes these synchronize_kernel() calls (and comments) to synchronize_rcu() or synchronize_sched() as follows: - arch/x86_64/kernel/mce.c mce_read(): change to synchronize_sched() to handle races with machine-check exceptions (synchronize_rcu() would not cut it given RCU implementations intended for hardcore realtime use. - drivers/input/serio/i8042.c i8042_stop(): change to synchronize_sched() to handle races with i8042_interrupt() interrupt handler. Again, synchronize_rcu() would not cut it given RCU implementations intended for hardcore realtime use. - include/*/kdebug.h comments: change to synchronize_sched() to handle races with NMIs. As before, synchronize_rcu() would not cut it... - include/linux/list.h comment: change to synchronize_rcu(), since this comment is for list_del_rcu(). - security/keys/key.c unregister_key_type(): change to synchronize_rcu(), since this is interacting with RCU read side. - security/keys/process_keys.c install_session_keyring(): change to synchronize_rcu(), since this is interacting with RCU read side. Signed-off-by: "Paul E. McKenney" <paulmck@us.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-28Input: Only write the CTR in i8042 resume function. Reading it isVojtech Pavlik
wrong, since it may (will) contain nonsensical data. Signed-off-by: Vojtech Pavlik <vojtech@suse.cz> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>