Received: by 10.213.65.68 with SMTP id h4csp1939584imn; Thu, 5 Apr 2018 06:27:33 -0700 (PDT) X-Google-Smtp-Source: AIpwx49UpNUkGe33sEns9wVvaikKs8ixmZecd9HeUAoMieDKafVn8E8DV2xJIeKaRhZRw/O+eIaW X-Received: by 2002:a17:902:24c:: with SMTP id 70-v6mr22894917plc.384.1522934853770; Thu, 05 Apr 2018 06:27:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522934853; cv=none; d=google.com; s=arc-20160816; b=rpGYAj1FRvU2rumTDhdynoJXFgfGoYcjUnuhmOst+uCstn5gV+7EFvtYF2Anox08xJ FGhMmzNdIBkPpsbU6S4Y26CdgumpMORuZLcsz3PnMTfm+QotiHxlKgw12+nc3LGFyeJE IsewRvScVYOZLUaDcW1uTLJlQdpXUdlbKuWi0xlocZJS8ln7xjWGvTf0f6CdL1BPurMm NTis3JjgWh1hJsB7adH2J8oXgwyjiSaOImJnw7xlg7ZOk/UApf89175AftBpGAZjwo8I bw+a6toHA1rtn+HgbCr1N3HsGudca1oycNXP+zcdwMP3Ia/5ND2JqFgNHhlgrLqtaImK /Opw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=2XaMjwX7pQYiiPb0fmJJIBh7atlptuH2UUP994t6fJQ=; b=My0Kyez38CAUSMl3QbgePQMSt3/n6ajqmw6Q5Ru3DDIHYwU/xuo9aiEZwLZQdUDbp2 XGs0kjLY1nhKzcQQusWXZdIyNVvp/0F+hiCjG9qQ23pkdxvVQa4+fKzIunhiHPWDrFv0 yj23hW7QwN4d/WBTCfeksEtCefKGXfmrzg/KP41WWMcDHHMjaskpDvjlgkgDnVdfrK/h xEZ16L923eseC19Ol0h4GcVqfgOiG043I6QL/HT9YeYgY5x+8Cd0q09u7/VeZMQrbeRD sWhT2BoGz8uPTFx0QsAa8/GUHw+RRdp8I4N9ljaY4vlum/KXSWViWt2lA66dVfj9W+P+ vleg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m1si5328792pgq.211.2018.04.05.06.27.19; Thu, 05 Apr 2018 06:27:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751678AbeDEN0A (ORCPT + 99 others); Thu, 5 Apr 2018 09:26:00 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:58624 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751466AbeDENZy (ORCPT ); Thu, 5 Apr 2018 09:25:54 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D5B27406E968; Thu, 5 Apr 2018 13:25:53 +0000 (UTC) Received: from plouf.banquise.eu.com (ovpn-117-43.ams2.redhat.com [10.36.117.43]) by smtp.corp.redhat.com (Postfix) with ESMTP id 98F7E2023235; Thu, 5 Apr 2018 13:25:52 +0000 (UTC) From: Benjamin Tissoires To: Dmitry Torokhov Cc: kt.liao@emc.com.tw, Oliver Haessler , Benjamin Berg , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Benjamin Tissoires Subject: [PATCH 5/8] Input: elantech - query the resolution in query_info Date: Thu, 5 Apr 2018 15:25:34 +0200 Message-Id: <20180405132537.3218-6-benjamin.tissoires@redhat.com> In-Reply-To: <20180405132537.3218-1-benjamin.tissoires@redhat.com> References: <20180405132537.3218-1-benjamin.tissoires@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Thu, 05 Apr 2018 13:25:53 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Thu, 05 Apr 2018 13:25:53 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'benjamin.tissoires@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The command ETP_RESOLUTION_QUERY also contains the bus information. It is better to fetch it once, while we are querying for device information. Signed-off-by: Benjamin Tissoires --- drivers/input/mouse/elantech.c | 27 +++++++++++++++------------ drivers/input/mouse/elantech.h | 2 ++ 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c index d485664f1563..41af0c9098af 100644 --- a/drivers/input/mouse/elantech.c +++ b/drivers/input/mouse/elantech.c @@ -1179,7 +1179,6 @@ static int elantech_set_input_params(struct psmouse *psmouse) struct elantech_data *etd = psmouse->private; struct elantech_device_info *info = &etd->info; unsigned int x_min = 0, y_min = 0, x_max = 0, y_max = 0, width = 0; - unsigned int x_res = 31, y_res = 31; if (elantech_set_range(psmouse, &x_min, &y_min, &x_max, &y_max, &width)) return -1; @@ -1232,13 +1231,6 @@ static int elantech_set_input_params(struct psmouse *psmouse) break; case 4: - if (elantech_get_resolution_v4(psmouse, &x_res, &y_res)) { - /* - * if query failed, print a warning and leave the values - * zero to resemble synaptics.c behavior. - */ - psmouse_warn(psmouse, "couldn't query resolution data.\n"); - } elantech_set_buttonpad_prop(psmouse); __set_bit(BTN_TOOL_QUADTAP, dev->keybit); /* For X to recognize me as touchpad. */ @@ -1267,11 +1259,11 @@ static int elantech_set_input_params(struct psmouse *psmouse) break; } - input_abs_set_res(dev, ABS_X, x_res); - input_abs_set_res(dev, ABS_Y, y_res); + input_abs_set_res(dev, ABS_X, info->x_res); + input_abs_set_res(dev, ABS_Y, info->y_res); if (info->hw_version > 1) { - input_abs_set_res(dev, ABS_MT_POSITION_X, x_res); - input_abs_set_res(dev, ABS_MT_POSITION_Y, y_res); + input_abs_set_res(dev, ABS_MT_POSITION_X, info->x_res); + input_abs_set_res(dev, ABS_MT_POSITION_Y, info->y_res); } etd->y_max = y_max; @@ -1720,6 +1712,17 @@ int elantech_query_info(struct psmouse *psmouse, /* The MSB indicates the presence of the trackpoint */ info->has_trackpoint = (info->capabilities[0] & 0x80) == 0x80; + info->x_res = 31; + info->y_res = 31; + if (info->hw_version == 4) { + if (elantech_get_resolution_v4(psmouse, + &info->x_res, + &info->y_res)) { + psmouse_warn(psmouse, + "failed to query resolution data.\n"); + } + } + return 0; } diff --git a/drivers/input/mouse/elantech.h b/drivers/input/mouse/elantech.h index d8ac27fe4597..851df4ce6232 100644 --- a/drivers/input/mouse/elantech.h +++ b/drivers/input/mouse/elantech.h @@ -120,6 +120,8 @@ struct elantech_device_info { unsigned char debug; unsigned char hw_version; unsigned int fw_version; + unsigned int x_res; + unsigned int y_res; bool paritycheck; bool jumpy_cursor; bool reports_pressure; -- 2.14.3