From patchwork Sun Mar 22 14:43:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gabriele Mazzotta X-Patchwork-Id: 6066811 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id AE72BBF90F for ; Sun, 22 Mar 2015 14:44:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A7C912026D for ; Sun, 22 Mar 2015 14:44:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CD05A20270 for ; Sun, 22 Mar 2015 14:44:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751791AbbCVOog (ORCPT ); Sun, 22 Mar 2015 10:44:36 -0400 Received: from mail-we0-f177.google.com ([74.125.82.177]:35887 "EHLO mail-we0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751776AbbCVOo2 (ORCPT ); Sun, 22 Mar 2015 10:44:28 -0400 Received: by wetk59 with SMTP id k59so118498527wet.3; Sun, 22 Mar 2015 07:44:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=h8jP5AlDrnknmuQxCHgB4yVKcEFImyEEisCshIUX7YY=; b=X+9ip7mid1Jpp5OhJ1oUh5z2JjaznCFId9WoXdkFDCCSumPfsKlrSx9/t7AIVSDYor j7pzf9s4JdxmlCv/+cEi4PucoL4hcvgwiZN2hg5wD09VWRfocac9h9PNzTEWRA6C3b2B d1b/TLtte2VxlUQ8ycner19/bNA4YOv1jJE3BE9YH5foheyofBtYiN7UJqDv94F2MlLc m16tJVl+OyTZ8REVpLEmDZDhn6a2/pRqZRDKDwS4NmuZXLPBmUL15LerEkhxy06Mg+kY kZDGKwVFIe3kldt7BpboNN1sMDRZ9kChCHqx5g0tBG+0vWLP1boQiRwEEvXVRSjun7Lg wazQ== X-Received: by 10.194.171.136 with SMTP id au8mr180143233wjc.6.1427035466626; Sun, 22 Mar 2015 07:44:26 -0700 (PDT) Received: from xps13.homenet (2-235-140-64.ip228.fastwebnet.it. [2.235.140.64]) by mx.google.com with ESMTPSA id pa4sm15134038wjb.11.2015.03.22.07.44.25 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 22 Mar 2015 07:44:26 -0700 (PDT) From: Gabriele Mazzotta To: linux-input@vger.kernel.org Cc: linux-kernel@vger.kernel.org, dmitry.torokhov@gmail.com, rydberg@bitmath.org, silverhammermba@gmail.com, peter.hutterer@who-t.net, hdegoede@redhat.com, benjamin.tissoires@gmail.com, grafi@grafi.jp, oneukum@suse.de, Gabriele Mazzotta Subject: [PATCH v3 3/5] input: synaptics - setup devices depending on their capabilities Date: Sun, 22 Mar 2015 15:43:54 +0100 Message-Id: <1427035436-2168-4-git-send-email-gabriele.mzt@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1427035436-2168-1-git-send-email-gabriele.mzt@gmail.com> References: <1427035436-2168-1-git-send-email-gabriele.mzt@gmail.com> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP ABS_X, ABS_Y and ABS_PRESSURE were defined for all the devices, even if not needed. Fix this by configuring each device depending on its capabilities. Signed-off-by: Gabriele Mazzotta --- drivers/input/mouse/synaptics.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index a7a0e73..ff47084 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c @@ -1188,11 +1188,6 @@ static void set_input_params(struct psmouse *psmouse, /* Absolute mode */ __set_bit(EV_ABS, dev->evbit); - set_abs_position_params(dev, priv, ABS_X, ABS_Y); - input_set_abs_params(dev, ABS_PRESSURE, 0, 255, 0, 0); - - if (cr48_profile_sensor) - input_set_abs_params(dev, ABS_MT_PRESSURE, 0, 255, 0, 0); if (SYN_CAP_IMAGE_SENSOR(priv->ext_cap_0c)) { set_abs_position_params(dev, priv, ABS_MT_POSITION_X, @@ -1200,26 +1195,32 @@ static void set_input_params(struct psmouse *psmouse, /* Image sensors can report per-contact pressure */ input_set_abs_params(dev, ABS_MT_PRESSURE, 0, 255, 0, 0); input_mt_init_slots(dev, 2, INPUT_MT_POINTER | INPUT_MT_TRACK); - /* Image sensors can signal 4 and 5 finger clicks */ __set_bit(BTN_TOOL_QUADTAP, dev->keybit); __set_bit(BTN_TOOL_QUINTTAP, dev->keybit); - } else if (SYN_CAP_ADV_GESTURE(priv->ext_cap_0c)) { + } else if (cr48_profile_sensor) { set_abs_position_params(dev, priv, ABS_MT_POSITION_X, ABS_MT_POSITION_Y); + input_set_abs_params(dev, ABS_MT_PRESSURE, 0, 255, 0, 0); /* * Profile sensor in CR-48 tracks contacts reasonably well, * other non-image sensors with AGM use semi-mt. */ + input_mt_init_slots(dev, 2, INPUT_MT_POINTER | INPUT_MT_TRACK); + } else if (SYN_CAP_ADV_GESTURE(priv->ext_cap_0c)) { + set_abs_position_params(dev, priv, ABS_MT_POSITION_X, + ABS_MT_POSITION_Y); + input_set_abs_params(dev, ABS_PRESSURE, 0, 255, 0, 0); + input_set_abs_params(dev, ABS_TOOL_WIDTH, 0, 15, 0, 0); input_mt_init_slots(dev, 2, - INPUT_MT_POINTER | - (cr48_profile_sensor ? - INPUT_MT_TRACK : INPUT_MT_SEMI_MT)); + INPUT_MT_POINTER | INPUT_MT_SEMI_MT); + } else { + set_abs_position_params(dev, priv, ABS_X, ABS_Y); + input_set_abs_params(dev, ABS_PRESSURE, 0, 255, 0, 0); + if (SYN_CAP_PALMDETECT(priv->capabilities)) + input_set_abs_params(dev, ABS_TOOL_WIDTH, 0, 15, 0, 0); } - if (SYN_CAP_PALMDETECT(priv->capabilities)) - input_set_abs_params(dev, ABS_TOOL_WIDTH, 0, 15, 0, 0); - __set_bit(BTN_TOUCH, dev->keybit); __set_bit(BTN_TOOL_FINGER, dev->keybit);