From patchwork Wed Jul 4 09:07:16 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Kurtz X-Patchwork-Id: 1155261 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 75F4E40ABE for ; Wed, 4 Jul 2012 09:07:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932069Ab2GDJHe (ORCPT ); Wed, 4 Jul 2012 05:07:34 -0400 Received: from mail-bk0-f74.google.com ([209.85.214.74]:51500 "EHLO mail-bk0-f74.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754306Ab2GDJHX (ORCPT ); Wed, 4 Jul 2012 05:07:23 -0400 Received: by bkcjc3 with SMTP id jc3so167405bkc.1 for ; Wed, 04 Jul 2012 02:07:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:x-gm-message-state; bh=YkWAECa3lSd+W4waQzl4DDt3TWxFdAOJ0w/7CAwoXlA=; b=j8017lqj7KQh0uevNMmWYKlHjDptnOK4vOXIQib1EhWnM6bN9jNTcbRE4j6JCV31iZ M9lshT6j0hPbyHXfA+S+dafqookZpxr3xEvSsvc3jfwY3HgIjQWSFgffM1YyEqkOzlQw eDPxb3pSmo2tVNbTx4iz5IRkdf/ni6xjAOdBuJqEwckwSCKi7jMP5rLWie4eTP7lOvbz /V/d4bmcrSvoKEP94FjeQFMm/JWpadekxge7oIIvVOgROmTiS6IsnGIwzKny74DCR9ZC 01x8JNyFKp+vGSwhjZmjY1h1ToONfPDA/UxEBWFRdaI1YqwOUw78TL5zJdSTB/6HiagY i81g== Received: by 10.14.101.2 with SMTP id a2mr6417556eeg.6.1341392841488; Wed, 04 Jul 2012 02:07:21 -0700 (PDT) Received: by 10.14.101.2 with SMTP id a2mr6417538eeg.6.1341392841363; Wed, 04 Jul 2012 02:07:21 -0700 (PDT) Received: from hpza10.eem.corp.google.com ([74.125.121.33]) by gmr-mx.google.com with ESMTPS id b15si12361860een.0.2012.07.04.02.07.21 (version=TLSv1/SSLv3 cipher=AES128-SHA); Wed, 04 Jul 2012 02:07:21 -0700 (PDT) Received: from puck.tpe.corp.google.com (puck.tpe.corp.google.com [172.30.210.35]) by hpza10.eem.corp.google.com (Postfix) with ESMTP id AEAB220004E; Wed, 4 Jul 2012 02:07:20 -0700 (PDT) Received: by puck.tpe.corp.google.com (Postfix, from userid 116377) id 5C4EB8055A; Wed, 4 Jul 2012 17:07:19 +0800 (CST) From: Daniel Kurtz To: Alessandro Rubini , Dmitry Torokhov , Henrik Rydberg Cc: Olof Johansson , Benson Leung , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Daniel Kurtz Subject: [PATCH 1/2 v2] Input: synaptics - print firmware ID and board number at init Date: Wed, 4 Jul 2012 17:07:16 +0800 Message-Id: <1341392837-19115-1-git-send-email-djkurtz@chromium.org> X-Mailer: git-send-email 1.7.7.3 X-Gm-Message-State: ALoCoQkJ/MFnVFg0qI3/vaCRKbdnEY2pqFGjY31xgOKTj+DnP/8CWaImNfscDOgaXSAY2SjRgZdi4wf313tha1wgyEjBwwiDRptyi2TIrTXsW46jxfiEfV6aGTGfKKOrMWk+2FrUiO2Ga2jl+w1Dp0qcDBsl603yVSnijkXLPZr8XO9IMU1FPPBxnmA/h5QjZatePBzm7Ve5 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org 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 --- drivers/input/mouse/synaptics.c | 38 ++++++++++++++++++++++++++++++++++++-- drivers/input/mouse/synaptics.h | 3 +++ 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index c778f27..7e0eca7 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c @@ -139,6 +139,35 @@ static int synaptics_model_id(struct psmouse *psmouse) } /* + * 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)) @@ -1434,11 +1467,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); diff --git a/drivers/input/mouse/synaptics.h b/drivers/input/mouse/synaptics.h index fd26ccc..e594af0 100644 --- a/drivers/input/mouse/synaptics.h +++ b/drivers/input/mouse/synaptics.h @@ -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 */