From 9d9d50bb2efb50594abfc3941a5504b62c514ebd Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Thu, 28 Jun 2007 00:44:27 -0400 Subject: Input: i8042 - add HP Pavilion ZT1000 to the MUX blacklist This should get rid of "atkbd.c: Suprious NAK on isa0060/serio0" messages caused by broken MUX implementation. The box does not have external PS/2 ports and, according to documentation, automatically disables touchpad when an external mouse is plugged into a port replicator, so MUX mode would not work anyway. Signed-off-by: Dmitry Torokhov --- drivers/input/serio/i8042-x86ia64io.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'drivers') diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h index f4a2517925e4..4fca1e7f2678 100644 --- a/drivers/input/serio/i8042-x86ia64io.h +++ b/drivers/input/serio/i8042-x86ia64io.h @@ -199,6 +199,17 @@ static struct dmi_system_id __initdata i8042_dmi_nomux_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "Pavilion dv4000 (EA032EA#ABF)"), }, }, + { + /* + * Like DV4017EA does not raise AUXERR for errors on MUX ports. + */ + .ident = "HP Pavilion ZT1000", + .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"), + }, + }, { .ident = "Toshiba P10", .matches = { -- cgit v1.2.2 From da4249c99fd59c4e224e4f9acaf07669d205bb1d Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Thu, 28 Jun 2007 00:46:56 -0400 Subject: Input: atkbd - throttle LED switching On some boxes keyboard controllers are too slow to withstand continuous flow of requests to turn keyboard LEDs on and off and start losing some keypresses or even all of them. Delay executing of LED switching request if we had another one within 50 ms thus easing load on the controller. Signed-off-by: Dmitry Torokhov --- drivers/input/keyboard/atkbd.c | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) (limited to 'drivers') diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c index be1fe46cd308..9e80012d0d0c 100644 --- a/drivers/input/keyboard/atkbd.c +++ b/drivers/input/keyboard/atkbd.c @@ -219,7 +219,8 @@ struct atkbd { unsigned long time; unsigned long err_count; - struct work_struct event_work; + struct delayed_work event_work; + unsigned long event_jiffies; struct mutex event_mutex; unsigned long event_mask; }; @@ -565,7 +566,7 @@ static int atkbd_set_leds(struct atkbd *atkbd) static void atkbd_event_work(struct work_struct *work) { - struct atkbd *atkbd = container_of(work, struct atkbd, event_work); + struct atkbd *atkbd = container_of(work, struct atkbd, event_work.work); mutex_lock(&atkbd->event_mutex); @@ -578,13 +579,31 @@ static void atkbd_event_work(struct work_struct *work) mutex_unlock(&atkbd->event_mutex); } +/* + * Schedule switch for execution. We need to throttle requests, + * otherwise keyboard may become unresponsive. + */ +static void atkbd_schedule_event_work(struct atkbd *atkbd, int event_bit) +{ + unsigned long delay = msecs_to_jiffies(50); + + if (time_after(jiffies, atkbd->event_jiffies + delay)) + delay = 0; + + atkbd->event_jiffies = jiffies; + set_bit(event_bit, &atkbd->event_mask); + wmb(); + schedule_delayed_work(&atkbd->event_work, delay); +} + /* * Event callback from the input module. Events that change the state of * the hardware are processed here. If action can not be performed in * interrupt context it is offloaded to atkbd_event_work. */ -static int atkbd_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) +static int atkbd_event(struct input_dev *dev, + unsigned int type, unsigned int code, int value) { struct atkbd *atkbd = input_get_drvdata(dev); @@ -594,19 +613,12 @@ static int atkbd_event(struct input_dev *dev, unsigned int type, unsigned int co switch (type) { case EV_LED: - set_bit(ATKBD_LED_EVENT_BIT, &atkbd->event_mask); - wmb(); - schedule_work(&atkbd->event_work); + atkbd_schedule_event_work(atkbd, ATKBD_LED_EVENT_BIT); return 0; case EV_REP: - - if (!atkbd->softrepeat) { - set_bit(ATKBD_REP_EVENT_BIT, &atkbd->event_mask); - wmb(); - schedule_work(&atkbd->event_work); - } - + if (!atkbd->softrepeat) + atkbd_schedule_event_work(atkbd, ATKBD_REP_EVENT_BIT); return 0; } @@ -940,7 +952,7 @@ static int atkbd_connect(struct serio *serio, struct serio_driver *drv) atkbd->dev = dev; ps2_init(&atkbd->ps2dev, serio); - INIT_WORK(&atkbd->event_work, atkbd_event_work); + INIT_DELAYED_WORK(&atkbd->event_work, atkbd_event_work); mutex_init(&atkbd->event_mutex); switch (serio->id.type) { -- cgit v1.2.2 From 9f7a60d6e47a70957e5f6676cfe8c83956b08aa6 Mon Sep 17 00:00:00 2001 From: Qi Yong Date: Thu, 28 Jun 2007 00:47:10 -0400 Subject: Input: atkbd - use printk_ratelimit for spurious ACK messages Signed-off-by: Qi Yong Signed-off-by: Dmitry Torokhov --- drivers/input/keyboard/atkbd.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'drivers') diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c index 9e80012d0d0c..9950fcb33650 100644 --- a/drivers/input/keyboard/atkbd.c +++ b/drivers/input/keyboard/atkbd.c @@ -409,9 +409,10 @@ static irqreturn_t atkbd_interrupt(struct serio *serio, unsigned char data, goto out; case ATKBD_RET_ACK: case ATKBD_RET_NAK: - printk(KERN_WARNING "atkbd.c: Spurious %s on %s. " - "Some program might be trying access hardware directly.\n", - data == ATKBD_RET_ACK ? "ACK" : "NAK", serio->phys); + if (printk_ratelimit()) + printk(KERN_WARNING "atkbd.c: Spurious %s on %s. " + "Some program might be trying access hardware directly.\n", + data == ATKBD_RET_ACK ? "ACK" : "NAK", serio->phys); goto out; case ATKBD_RET_HANGEUL: case ATKBD_RET_HANJA: -- cgit v1.2.2 From 33143ea1a34d12699e6aa222ba124498abcfe4d1 Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Fri, 29 Jun 2007 01:06:35 -0400 Subject: Input: serio - take drv_mutex in serio_cleanup() We need to take serio->drv_mutex in serio_cleanup() to prevent the function from being called while driver is in the middle of attaching to a serio port. Such situation can happen with i8042 and atkbd drivers if user rapidly presses Ctrl-Alt-Del during system startup, and leads to kernel oops. Reported-by: Dave Young Signed-off-by: Dmitry Torokhov --- drivers/input/serio/serio.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers') diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c index 5895202b972c..a8f3bc1dff22 100644 --- a/drivers/input/serio/serio.c +++ b/drivers/input/serio/serio.c @@ -769,8 +769,10 @@ static int serio_driver_remove(struct device *dev) static void serio_cleanup(struct serio *serio) { + mutex_lock(&serio->drv_mutex); if (serio->drv && serio->drv->cleanup) serio->drv->cleanup(serio); + mutex_unlock(&serio->drv_mutex); } static void serio_shutdown(struct device *dev) -- cgit v1.2.2