Merge branch 'synaptics' into for-linus
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Mon, 16 Mar 2015 16:12:56 +0000 (09:12 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Mon, 16 Mar 2015 16:12:56 +0000 (09:12 -0700)
Bring in changes needed to properly handle Lenovo 2015 lineup.

1  2 
drivers/input/mouse/synaptics.c
drivers/input/mouse/synaptics.h

index f2cceb6493a0aea304c838043735ac3889041438,ca7ca8d4eb335ea70ca2b28266d7e00ddcf2fbdd..c74bfa1c05e307c9a0da6f7405904938dd9e3455
@@@ -603,8 -676,23 +671,20 @@@ static void synaptics_parse_agm(const u
        default:
                break;
        }
 -
 -      /* Record that at least one AGM has been received since last SGM */
 -      priv->agm_pending = true;
  }
  
+ static void synaptics_parse_ext_buttons(const unsigned char buf[],
+                                       struct synaptics_data *priv,
+                                       struct synaptics_hw_state *hw)
+ {
+       unsigned int ext_bits =
+               (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) + 1) >> 1;
+       unsigned int ext_mask = GENMASK(ext_bits - 1, 0);
+       hw->ext_buttons = buf[4] & ext_mask;
+       hw->ext_buttons |= (buf[5] & ext_mask) << ext_bits;
+ }
  static bool is_forcepad;
  
  static int synaptics_parse_hw_state(const unsigned char buf[],
@@@ -792,13 -903,25 +895,12 @@@ static void synaptics_report_buttons(st
                input_report_key(dev, BTN_BACK, hw->down);
        }
  
-       for (i = 0; i < SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap); i++)
-               input_report_key(dev, BTN_0 + i, hw->ext_buttons & (1 << i));
+       synaptics_report_ext_buttons(psmouse, hw);
  }
  
 -static void synaptics_report_slot(struct input_dev *dev, int slot,
 -                                const struct synaptics_hw_state *hw)
 -{
 -      input_mt_slot(dev, slot);
 -      input_mt_report_slot_state(dev, MT_TOOL_FINGER, (hw != NULL));
 -      if (!hw)
 -              return;
 -
 -      input_report_abs(dev, ABS_MT_POSITION_X, hw->x);
 -      input_report_abs(dev, ABS_MT_POSITION_Y, synaptics_invert_y(hw->y));
 -      input_report_abs(dev, ABS_MT_PRESSURE, hw->z);
 -}
 -
  static void synaptics_report_mt_data(struct psmouse *psmouse,
 -                                   struct synaptics_mt_state *mt_state,
 -                                   const struct synaptics_hw_state *sgm)
 +                                   const struct synaptics_hw_state *sgm,
 +                                   int num_fingers)
  {
        struct input_dev *dev = psmouse->dev;
        struct synaptics_data *priv = psmouse->private;
index aedc3299b14e2b753c1e9d51da95b0953ea081cb,f39539c702193c156210fce8cb99fca875233a15..ee4bd0d12b26fa2770445a381134b62124be6741
@@@ -156,7 -196,11 +183,8 @@@ struct synaptics_data 
        bool disable_gesture;                   /* disable gestures */
  
        struct serio *pt_port;                  /* Pass-through serio port */
+       unsigned char pt_buttons;               /* Pass-through buttons */
  
 -      struct synaptics_mt_state mt_state;     /* Current mt finger state */
 -      bool mt_state_lost;                     /* mt_state may be incorrect */
 -
        /*
         * Last received Advanced Gesture Mode (AGM) packet. An AGM packet
         * contains position data for a second contact, at half resolution.