Input: synaptics - print firmware ID and board number at init
authorDaniel Kurtz <djkurtz@chromium.org>
Sun, 8 Jul 2012 01:08:51 +0000 (18:08 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Sun, 8 Jul 2012 01:20:08 +0000 (18:20 -0700)
Read the Firmware ID and Board Number from a synaptics device at init
and display them in the system log.

Device behavior is very board and firmware dependent.
It may prove useful for users to include this information when providing
bug reports or other feedback.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Acked-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/mouse/synaptics.c
drivers/input/mouse/synaptics.h

index c703d53be3a00e768882cf9e313a3a2e84712aaf..d5b390f75c9a97f38e147bb0a7a111cf7a9e15b3 100644 (file)
@@ -138,6 +138,35 @@ static int synaptics_model_id(struct psmouse *psmouse)
        return 0;
 }
 
+/*
+ * Read the board id from the touchpad
+ * The board id is encoded in the "QUERY MODES" response
+ */
+static int synaptics_board_id(struct psmouse *psmouse)
+{
+       struct synaptics_data *priv = psmouse->private;
+       unsigned char bid[3];
+
+       if (synaptics_send_cmd(psmouse, SYN_QUE_MODES, bid))
+               return -1;
+       priv->board_id = ((bid[0] & 0xfc) << 6) | bid[1];
+       return 0;
+}
+
+/*
+ * Read the firmware id from the touchpad
+ */
+static int synaptics_firmware_id(struct psmouse *psmouse)
+{
+       struct synaptics_data *priv = psmouse->private;
+       unsigned char fwid[3];
+
+       if (synaptics_send_cmd(psmouse, SYN_QUE_FIRMWARE_ID, fwid))
+               return -1;
+       priv->firmware_id = (fwid[0] << 16) | (fwid[1] << 8) | fwid[2];
+       return 0;
+}
+
 /*
  * Read the capability-bits from the touchpad
  * see also the SYN_CAP_* macros
@@ -261,6 +290,10 @@ static int synaptics_query_hardware(struct psmouse *psmouse)
                return -1;
        if (synaptics_model_id(psmouse))
                return -1;
+       if (synaptics_firmware_id(psmouse))
+               return -1;
+       if (synaptics_board_id(psmouse))
+               return -1;
        if (synaptics_capability(psmouse))
                return -1;
        if (synaptics_resolution(psmouse))
@@ -1435,11 +1468,12 @@ static int __synaptics_init(struct psmouse *psmouse, bool absolute_mode)
        priv->pkt_type = SYN_MODEL_NEWABS(priv->model_id) ? SYN_NEWABS : SYN_OLDABS;
 
        psmouse_info(psmouse,
-                    "Touchpad model: %ld, fw: %ld.%ld, id: %#lx, caps: %#lx/%#lx/%#lx\n",
+                    "Touchpad model: %ld, fw: %ld.%ld, id: %#lx, caps: %#lx/%#lx/%#lx, board id: %lu, fw id: %lu\n",
                     SYN_ID_MODEL(priv->identity),
                     SYN_ID_MAJOR(priv->identity), SYN_ID_MINOR(priv->identity),
                     priv->model_id,
-                    priv->capabilities, priv->ext_cap, priv->ext_cap_0c);
+                    priv->capabilities, priv->ext_cap, priv->ext_cap_0c,
+                    priv->board_id, priv->firmware_id);
 
        set_input_params(psmouse->dev, priv);
 
index fd26ccca13d793b225654b21de12a21f6a306ad5..e594af0b264b7f147569d77fe5a1d84825ed1a9e 100644 (file)
@@ -18,6 +18,7 @@
 #define SYN_QUE_SERIAL_NUMBER_SUFFIX   0x07
 #define SYN_QUE_RESOLUTION             0x08
 #define SYN_QUE_EXT_CAPAB              0x09
+#define SYN_QUE_FIRMWARE_ID            0x0a
 #define SYN_QUE_EXT_CAPAB_0C           0x0c
 #define SYN_QUE_EXT_MAX_COORDS         0x0d
 #define SYN_QUE_EXT_MIN_COORDS         0x0f
@@ -148,6 +149,8 @@ struct synaptics_hw_state {
 struct synaptics_data {
        /* Data read from the touchpad */
        unsigned long int model_id;             /* Model-ID */
+       unsigned long int firmware_id;          /* Firmware-ID */
+       unsigned long int board_id;             /* Board-ID */
        unsigned long int capabilities;         /* Capabilities */
        unsigned long int ext_cap;              /* Extended Capabilities */
        unsigned long int ext_cap_0c;           /* Ext Caps from 0x0c query */