Merge branch 'next' into for-linus
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Mon, 14 Sep 2009 04:16:56 +0000 (21:16 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Mon, 14 Sep 2009 04:16:56 +0000 (21:16 -0700)
1  2 
drivers/input/keyboard/atkbd.c
drivers/input/serio/i8042-x86ia64io.h

@@@ -68,7 -68,9 +68,9 @@@ MODULE_PARM_DESC(extra, "Enable extra L
   * are loadable via a userland utility.
   */
  
- static const unsigned short atkbd_set2_keycode[512] = {
+ #define ATKBD_KEYMAP_SIZE     512
+ static const unsigned short atkbd_set2_keycode[ATKBD_KEYMAP_SIZE] = {
  
  #ifdef CONFIG_KEYBOARD_ATKBD_HP_KEYCODES
  
  #endif
  };
  
- static const unsigned short atkbd_set3_keycode[512] = {
+ static const unsigned short atkbd_set3_keycode[ATKBD_KEYMAP_SIZE] = {
  
          0,  0,  0,  0,  0,  0,  0, 59,  1,138,128,129,130, 15, 41, 60,
        131, 29, 42, 86, 58, 16,  2, 61,133, 56, 44, 31, 30, 17,  3, 62,
@@@ -200,8 -202,8 +202,8 @@@ struct atkbd 
        char phys[32];
  
        unsigned short id;
-       unsigned short keycode[512];
-       DECLARE_BITMAP(force_release_mask, 512);
+       unsigned short keycode[ATKBD_KEYMAP_SIZE];
+       DECLARE_BITMAP(force_release_mask, ATKBD_KEYMAP_SIZE);
        unsigned char set;
        unsigned char translated;
        unsigned char extra;
@@@ -253,6 -255,7 +255,7 @@@ static struct device_attribute atkbd_at
        __ATTR(_name, S_IWUSR | S_IRUGO, atkbd_do_show_##_name, atkbd_do_set_##_name);
  
  ATKBD_DEFINE_ATTR(extra);
+ ATKBD_DEFINE_ATTR(force_release);
  ATKBD_DEFINE_ATTR(scroll);
  ATKBD_DEFINE_ATTR(set);
  ATKBD_DEFINE_ATTR(softrepeat);
@@@ -272,6 -275,7 +275,7 @@@ ATKBD_DEFINE_RO_ATTR(err_count)
  
  static struct attribute *atkbd_attributes[] = {
        &atkbd_attr_extra.attr,
+       &atkbd_attr_force_release.attr,
        &atkbd_attr_scroll.attr,
        &atkbd_attr_set.attr,
        &atkbd_attr_softrepeat.attr,
@@@ -879,14 -883,6 +883,14 @@@ static unsigned int atkbd_hp_zv6100_for
        0xae, 0xb0, -1U
  };
  
 +/*
 + * Perform fixup for HP (Compaq) Presario R4000 R4100 R4200 that don't generate
 + * release for their volume buttons
 + */
 +static unsigned int atkbd_hp_r4000_forced_release_keys[] = {
 +      0xae, 0xb0, -1U
 +};
 +
  /*
   * Samsung NC10,NC20 with Fn+F? key release not working
   */
@@@ -934,7 -930,7 +938,7 @@@ static void atkbd_set_keycode_table(str
        int i, j;
  
        memset(atkbd->keycode, 0, sizeof(atkbd->keycode));
-       bitmap_zero(atkbd->force_release_mask, 512);
+       bitmap_zero(atkbd->force_release_mask, ATKBD_KEYMAP_SIZE);
  
        if (atkbd->translated) {
                for (i = 0; i < 128; i++) {
@@@ -1041,7 -1037,7 +1045,7 @@@ static void atkbd_set_device_attrs(stru
        input_dev->keycodesize = sizeof(unsigned short);
        input_dev->keycodemax = ARRAY_SIZE(atkbd_set2_keycode);
  
-       for (i = 0; i < 512; i++)
+       for (i = 0; i < ATKBD_KEYMAP_SIZE; i++)
                if (atkbd->keycode[i] && atkbd->keycode[i] < ATKBD_SPECIAL)
                        __set_bit(atkbd->keycode[i], input_dev->keybit);
  }
@@@ -1309,6 -1305,33 +1313,33 @@@ static ssize_t atkbd_set_extra(struct a
        return count;
  }
  
+ static ssize_t atkbd_show_force_release(struct atkbd *atkbd, char *buf)
+ {
+       size_t len = bitmap_scnlistprintf(buf, PAGE_SIZE - 2,
+                       atkbd->force_release_mask, ATKBD_KEYMAP_SIZE);
+       buf[len++] = '\n';
+       buf[len] = '\0';
+       return len;
+ }
+ static ssize_t atkbd_set_force_release(struct atkbd *atkbd,
+                                       const char *buf, size_t count)
+ {
+       /* 64 bytes on stack should be acceptable */
+       DECLARE_BITMAP(new_mask, ATKBD_KEYMAP_SIZE);
+       int err;
+       err = bitmap_parselist(buf, new_mask, ATKBD_KEYMAP_SIZE);
+       if (err)
+               return err;
+       memcpy(atkbd->force_release_mask, new_mask, sizeof(atkbd->force_release_mask));
+       return count;
+ }
  static ssize_t atkbd_show_scroll(struct atkbd *atkbd, char *buf)
  {
        return sprintf(buf, "%d\n", atkbd->scroll ? 1 : 0);
@@@ -1544,33 -1567,6 +1575,33 @@@ static struct dmi_system_id atkbd_dmi_q
                .callback = atkbd_setup_forced_release,
                .driver_data = atkbd_hp_zv6100_forced_release_keys,
        },
 +      {
 +              .ident = "HP Presario R4000",
 +              .matches = {
 +                      DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
 +                      DMI_MATCH(DMI_PRODUCT_NAME, "Presario R4000"),
 +              },
 +              .callback = atkbd_setup_forced_release,
 +              .driver_data = atkbd_hp_r4000_forced_release_keys,
 +      },
 +      {
 +              .ident = "HP Presario R4100",
 +              .matches = {
 +                      DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
 +                      DMI_MATCH(DMI_PRODUCT_NAME, "Presario R4100"),
 +              },
 +              .callback = atkbd_setup_forced_release,
 +              .driver_data = atkbd_hp_r4000_forced_release_keys,
 +      },
 +      {
 +              .ident = "HP Presario R4200",
 +              .matches = {
 +                      DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
 +                      DMI_MATCH(DMI_PRODUCT_NAME, "Presario R4200"),
 +              },
 +              .callback = atkbd_setup_forced_release,
 +              .driver_data = atkbd_hp_r4000_forced_release_keys,
 +      },
        {
                .ident = "Inventec Symphony",
                .matches = {
@@@ -382,14 -382,6 +382,14 @@@ static struct dmi_system_id __initdata 
                        DMI_MATCH(DMI_PRODUCT_NAME, "Vostro1510"),
                },
        },
 +      {
 +              .ident = "Acer Aspire 5536",
 +              .matches = {
 +                      DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
 +                      DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5536"),
 +                      DMI_MATCH(DMI_PRODUCT_VERSION, "0100"),
 +              },
 +      },
        { }
  };
  
@@@ -457,6 -449,34 +457,34 @@@ static struct dmi_system_id __initdata 
        },
        { }
  };
+ 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
  
  /*
@@@ -530,9 -550,9 +558,9 @@@ static struct dmi_system_id __initdata 
  #ifdef CONFIG_PNP
  #include <linux/pnp.h>
  
- static int i8042_pnp_kbd_registered;
+ static bool i8042_pnp_kbd_registered;
  static unsigned int i8042_pnp_kbd_devices;
- static int i8042_pnp_aux_registered;
+ static bool i8042_pnp_aux_registered;
  static unsigned int i8042_pnp_aux_devices;
  
  static int i8042_pnp_command_reg;
@@@ -620,12 -640,12 +648,12 @@@ static struct pnp_driver i8042_pnp_aux_
  static void i8042_pnp_exit(void)
  {
        if (i8042_pnp_kbd_registered) {
-               i8042_pnp_kbd_registered = 0;
+               i8042_pnp_kbd_registered = false;
                pnp_unregister_driver(&i8042_pnp_kbd_driver);
        }
  
        if (i8042_pnp_aux_registered) {
-               i8042_pnp_aux_registered = 0;
+               i8042_pnp_aux_registered = false;
                pnp_unregister_driver(&i8042_pnp_aux_driver);
        }
  }
  static int __init i8042_pnp_init(void)
  {
        char kbd_irq_str[4] = { 0 }, aux_irq_str[4] = { 0 };
-       int pnp_data_busted = 0;
+       int pnp_data_busted = false;
        int err;
  
  #ifdef CONFIG_X86
        if (dmi_check_system(i8042_dmi_nopnp_table))
-               i8042_nopnp = 1;
+               i8042_nopnp = true;
  #endif
  
        if (i8042_nopnp) {
  
        err = pnp_register_driver(&i8042_pnp_kbd_driver);
        if (!err)
-               i8042_pnp_kbd_registered = 1;
+               i8042_pnp_kbd_registered = true;
  
        err = pnp_register_driver(&i8042_pnp_aux_driver);
        if (!err)
-               i8042_pnp_aux_registered = 1;
+               i8042_pnp_aux_registered = true;
  
        if (!i8042_pnp_kbd_devices && !i8042_pnp_aux_devices) {
                i8042_pnp_exit();
  
  #if defined(__ia64__)
        if (!i8042_pnp_kbd_devices)
-               i8042_nokbd = 1;
+               i8042_nokbd = true;
        if (!i8042_pnp_aux_devices)
-               i8042_noaux = 1;
+               i8042_noaux = true;
  #endif
  
        if (((i8042_pnp_data_reg & ~0xf) == (i8042_data_reg & ~0xf) &&
                        "using default %#x\n",
                        i8042_pnp_data_reg, i8042_data_reg);
                i8042_pnp_data_reg = i8042_data_reg;
-               pnp_data_busted = 1;
+               pnp_data_busted = true;
        }
  
        if (((i8042_pnp_command_reg & ~0xf) == (i8042_command_reg & ~0xf) &&
                        "using default %#x\n",
                        i8042_pnp_command_reg, i8042_command_reg);
                i8042_pnp_command_reg = i8042_command_reg;
-               pnp_data_busted = 1;
+               pnp_data_busted = true;
        }
  
        if (!i8042_nokbd && !i8042_pnp_kbd_irq) {
                        "PNP: PS/2 controller doesn't have KBD irq; "
                        "using default %d\n", i8042_kbd_irq);
                i8042_pnp_kbd_irq = i8042_kbd_irq;
-               pnp_data_busted = 1;
+               pnp_data_busted = true;
        }
  
        if (!i8042_noaux && !i8042_pnp_aux_irq) {
                                "PNP: PS/2 appears to have AUX port disabled, "
                                "if this is incorrect please boot with "
                                "i8042.nopnp\n");
-                       i8042_noaux = 1;
+                       i8042_noaux = true;
                } else {
                        printk(KERN_WARNING
                                "PNP: PS/2 controller doesn't have AUX irq; "
        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;
  }
  
@@@ -763,21 -788,21 +796,21 @@@ static int __init i8042_platform_init(v
                return retval;
  
  #if defined(__ia64__)
-         i8042_reset = 1;
+         i8042_reset = true;
  #endif
  
  #ifdef CONFIG_X86
        if (dmi_check_system(i8042_dmi_reset_table))
-               i8042_reset = 1;
+               i8042_reset = true;
  
        if (dmi_check_system(i8042_dmi_noloop_table))
-               i8042_noloop = 1;
+               i8042_noloop = true;
  
        if (dmi_check_system(i8042_dmi_nomux_table))
-               i8042_nomux = 1;
+               i8042_nomux = true;
  
        if (dmi_check_system(i8042_dmi_dritek_table))
-               i8042_dritek = 1;
+               i8042_dritek = true;
  #endif /* CONFIG_X86 */
  
        return retval;