diff mbox

[1/1] UBUNTU: Input: i8042 - bypass AUX IRQ delivery test on laptops

Message ID 1268062889-28592-2-git-send-email-colin.king@canonical.com
State Accepted
Delegated to: Stefan Bader
Headers show

Commit Message

Colin Ian King March 8, 2010, 3:41 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

BugLink: http://bugs.launchpad.net/bugs/534448

Touchpad detection fails for a bunch of laptops because of faulty
AUX LOOP command implementation. This backport patch of commit
upstream commit 1c7827ae70e7c8456e08f7bb9ef2238d27814cbe fixes this.

Quoting the original posting:

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.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/input/serio/i8042-x86ia64io.h |   33 +++++++++++++++++++++++++++++++++
 drivers/input/serio/i8042.c           |    4 +++-
 2 files changed, 36 insertions(+), 1 deletions(-)

Comments

Stefan Bader March 8, 2010, 4:17 p.m. UTC | #1
Urgh, what a (hardware) mess. I guess IRQ12 widely (even for desktops) should
have always been used by the ps2 controller and so the assumption seems safe.
And we probably could assume that using the touchpad _is_ a critical part of the
system usage. So I would say ok with many sighs.

Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> BugLink: http://bugs.launchpad.net/bugs/534448
> 
> Touchpad detection fails for a bunch of laptops because of faulty
> AUX LOOP command implementation. This backport patch of commit
> upstream commit 1c7827ae70e7c8456e08f7bb9ef2238d27814cbe fixes this.
> 
> Quoting the original posting:
> 
> 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.
> 
> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
> ---
>  drivers/input/serio/i8042-x86ia64io.h |   33 +++++++++++++++++++++++++++++++++
>  drivers/input/serio/i8042.c           |    4 +++-
>  2 files changed, 36 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h
> index ccbf23e..6e244a0 100644
> --- a/drivers/input/serio/i8042-x86ia64io.h
> +++ b/drivers/input/serio/i8042-x86ia64io.h
> @@ -457,6 +457,34 @@ static struct dmi_system_id __initdata i8042_dmi_nopnp_table[] = {
>  	},
>  	{ }
>  };
> +
> +static struct dmi_system_id __initdata i8042_dmi_laptop_table[] = {
> +	{
> +		.ident = "Portable",
> +		.matches = {
> +			DMI_MATCH(DMI_CHASSIS_TYPE, "8"), /* Portable */
> +		},
> +	},
> +	{
> +		.ident = "Laptop",
> +		.matches = {
> +			DMI_MATCH(DMI_CHASSIS_TYPE, "9"), /* Laptop */
> +		},
> +	},
> +	{
> +		.ident = "Notebook",
> +		.matches = {
> +			DMI_MATCH(DMI_CHASSIS_TYPE, "10"), /* Notebook */
> +		},
> +	},
> +	{
> +		.ident = "Sub-Notebook",
> +		.matches = {
> +			DMI_MATCH(DMI_CHASSIS_TYPE, "14"), /* Sub-Notebook */
> +		},
> +	},
> +	{ }
> +};
>  #endif
>  
>  /*
> @@ -735,6 +763,11 @@ static int __init i8042_pnp_init(void)
>  	i8042_kbd_irq = i8042_pnp_kbd_irq;
>  	i8042_aux_irq = i8042_pnp_aux_irq;
>  
> +#ifdef CONFIG_X86
> +	i8042_bypass_aux_irq_test = !pnp_data_busted &&
> +				    dmi_check_system(i8042_dmi_laptop_table);
> +#endif
> +
>  	return 0;
>  }
>  
> diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
> index 582245c..e8705fe 100644
> --- a/drivers/input/serio/i8042.c
> +++ b/drivers/input/serio/i8042.c
> @@ -83,6 +83,8 @@ module_param_named(debug, i8042_debug, bool, 0600);
>  MODULE_PARM_DESC(debug, "Turn i8042 debugging mode on and off");
>  #endif
>  
> +static bool i8042_bypass_aux_irq_test;
> +
>  #include "i8042.h"
>  
>  static DEFINE_SPINLOCK(i8042_lock);
> @@ -641,7 +643,7 @@ static int __devinit i8042_check_aux(void)
>   * used it for a PCI card or somethig else.
>   */
>  
> -	if (i8042_noloop || aux_loop_broken) {
> +	if (i8042_noloop || i8042_bypass_aux_irq_test || aux_loop_broken) {
>  /*
>   * Without LOOP command we can't test AUX IRQ delivery. Assume the port
>   * is working and hope we are right.
Stefan Bader March 9, 2010, 10:09 a.m. UTC | #2
Applied to Karmic master
diff mbox

Patch

diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h
index ccbf23e..6e244a0 100644
--- a/drivers/input/serio/i8042-x86ia64io.h
+++ b/drivers/input/serio/i8042-x86ia64io.h
@@ -457,6 +457,34 @@  static struct dmi_system_id __initdata i8042_dmi_nopnp_table[] = {
 	},
 	{ }
 };
+
+static struct dmi_system_id __initdata i8042_dmi_laptop_table[] = {
+	{
+		.ident = "Portable",
+		.matches = {
+			DMI_MATCH(DMI_CHASSIS_TYPE, "8"), /* Portable */
+		},
+	},
+	{
+		.ident = "Laptop",
+		.matches = {
+			DMI_MATCH(DMI_CHASSIS_TYPE, "9"), /* Laptop */
+		},
+	},
+	{
+		.ident = "Notebook",
+		.matches = {
+			DMI_MATCH(DMI_CHASSIS_TYPE, "10"), /* Notebook */
+		},
+	},
+	{
+		.ident = "Sub-Notebook",
+		.matches = {
+			DMI_MATCH(DMI_CHASSIS_TYPE, "14"), /* Sub-Notebook */
+		},
+	},
+	{ }
+};
 #endif
 
 /*
@@ -735,6 +763,11 @@  static int __init i8042_pnp_init(void)
 	i8042_kbd_irq = i8042_pnp_kbd_irq;
 	i8042_aux_irq = i8042_pnp_aux_irq;
 
+#ifdef CONFIG_X86
+	i8042_bypass_aux_irq_test = !pnp_data_busted &&
+				    dmi_check_system(i8042_dmi_laptop_table);
+#endif
+
 	return 0;
 }
 
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
index 582245c..e8705fe 100644
--- a/drivers/input/serio/i8042.c
+++ b/drivers/input/serio/i8042.c
@@ -83,6 +83,8 @@  module_param_named(debug, i8042_debug, bool, 0600);
 MODULE_PARM_DESC(debug, "Turn i8042 debugging mode on and off");
 #endif
 
+static bool i8042_bypass_aux_irq_test;
+
 #include "i8042.h"
 
 static DEFINE_SPINLOCK(i8042_lock);
@@ -641,7 +643,7 @@  static int __devinit i8042_check_aux(void)
  * used it for a PCI card or somethig else.
  */
 
-	if (i8042_noloop || aux_loop_broken) {
+	if (i8042_noloop || i8042_bypass_aux_irq_test || aux_loop_broken) {
 /*
  * Without LOOP command we can't test AUX IRQ delivery. Assume the port
  * is working and hope we are right.