From patchwork Sat Feb 14 19:01:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathias Gottschlag X-Patchwork-Id: 5828811 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 E8452BF440 for ; Sat, 14 Feb 2015 19:02:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BBD08201C8 for ; Sat, 14 Feb 2015 19:02:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9C4FF201EF for ; Sat, 14 Feb 2015 19:02:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754111AbbBNTCY (ORCPT ); Sat, 14 Feb 2015 14:02:24 -0500 Received: from mail-qa0-f41.google.com ([209.85.216.41]:38236 "EHLO mail-qa0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753890AbbBNTCY (ORCPT ); Sat, 14 Feb 2015 14:02:24 -0500 Received: by mail-qa0-f41.google.com with SMTP id x12so17065390qac.0 for ; Sat, 14 Feb 2015 11:02:23 -0800 (PST) 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=NqPIZpGfM92JGkrHiuVXSWd0vK+mh7HhQW59qmBTzMI=; b=UFvrlboRsYbwFbwiTqCdxwGYREi2I0FLg2Fa9ZJDhlFaGfVZsVfI6DcmrGZkHCPtgY hwBrRL6wImqRbJudAK9oPxwReT3TYFIndEeMXcfPVFElkhPuMNzNjCoAAyTO5fncfMZm IpJBSdXxEWzaoi8iFaRtp4Gkg/Ma7TRNd/JaRWPlIsc4jOrrYsqrFY9ImKXMT3C9fzUL m0Sf+7TEbqn8DnGyL8BBC/B0rTlKjMqwWx1EKVJOtolDhZbyfc6mWyxfmXIVikgMI3Ne dd9GyluRv5b9lG+nR6Z/mGeyuB6YJd6L7qiT5k00dipDOd8b+57k0Lv/9XZWahe/visH bDoQ== X-Received: by 10.140.83.69 with SMTP id i63mr37208639qgd.97.1423940543272; Sat, 14 Feb 2015 11:02:23 -0800 (PST) Received: from mathias-laptop.lan (HSI-KBW-37-209-111-36.hsi15.kabel-badenwuerttemberg.de. [37.209.111.36]) by mx.google.com with ESMTPSA id j6sm10011065qae.21.2015.02.14.11.02.21 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 14 Feb 2015 11:02:22 -0800 (PST) From: Mathias Gottschlag To: Dmitry Torokhov Cc: Hans de Goede , linux-input@vger.kernel.org, Mathias Gottschlag Subject: [PATCH 2/3] psmouse: Skip psmouse_initialize for FocalTech touchpads. Date: Sat, 14 Feb 2015 20:01:41 +0100 Message-Id: <1423940502-12353-3-git-send-email-mgottschlag@gmail.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1423940502-12353-1-git-send-email-mgottschlag@gmail.com> References: <1423940502-12353-1-git-send-email-mgottschlag@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 The driver used to skip all initialization code for FocalTech touchpads because they stop responding when certain commands are sent. The new driver failed reproduce this behaviour and psmouse_reconnect would still cause standard initialization code to be executed. This patch introduces a field "skip_standard_init" to struct psmouse. If this field is set to true, psmouse_initialize will not do anything. This solution is somewhat ugly, but I believe it is the least ugly way to introduce this apparently required special case. Also, the code is modified to not send PSMOUSE_CMD_ENABLE twice (once in focaltech.c, once in the generic code in psmouse-base.c). Signed-off-by: Mathias Gottschlag --- drivers/input/mouse/focaltech.c | 5 ++--- drivers/input/mouse/psmouse-base.c | 4 +++- drivers/input/mouse/psmouse.h | 5 +++++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/input/mouse/focaltech.c b/drivers/input/mouse/focaltech.c index 5d8cf98..05919cc 100644 --- a/drivers/input/mouse/focaltech.c +++ b/drivers/input/mouse/focaltech.c @@ -284,9 +284,6 @@ static int focaltech_switch_protocol(struct psmouse *psmouse) if (ps2_command(ps2dev, param, PSMOUSE_CMD_SETSCALE11)) return -EIO; - if (ps2_command(ps2dev, param, PSMOUSE_CMD_ENABLE)) - return -EIO; - return 0; } @@ -413,6 +410,8 @@ int focaltech_init(struct psmouse *psmouse) /* resync is not supported yet */ psmouse->resync_time = 0; + psmouse->skip_standard_init = true; + return 0; fail: diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c index 68469fe..b55a116 100644 --- a/drivers/input/mouse/psmouse-base.c +++ b/drivers/input/mouse/psmouse-base.c @@ -697,6 +697,8 @@ static void psmouse_apply_defaults(struct psmouse *psmouse) psmouse->cleanup = NULL; psmouse->pt_activate = NULL; psmouse->pt_deactivate = NULL; + + psmouse->skip_standard_init = false; } /* @@ -1157,7 +1159,7 @@ static void psmouse_initialize(struct psmouse *psmouse) * We set the mouse report rate, resolution and scaling. */ - if (psmouse_max_proto != PSMOUSE_PS2) { + if (psmouse_max_proto != PSMOUSE_PS2 && !psmouse->skip_standard_init) { psmouse->set_rate(psmouse, psmouse->rate); psmouse->set_resolution(psmouse, psmouse->resolution); ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_SETSCALE11); diff --git a/drivers/input/mouse/psmouse.h b/drivers/input/mouse/psmouse.h index c2ff137..d1412ac 100644 --- a/drivers/input/mouse/psmouse.h +++ b/drivers/input/mouse/psmouse.h @@ -64,6 +64,11 @@ struct psmouse { unsigned int resync_time; bool smartscroll; /* Logitech only */ + /* FocalTech touchpads sometimes stop responding when standard commands + * are sent after the custom protocol has been selected, so this flag + * makes the code skip psmouse_initialize */ + bool skip_standard_init; + psmouse_ret_t (*protocol_handler)(struct psmouse *psmouse); void (*set_rate)(struct psmouse *psmouse, unsigned int rate); void (*set_resolution)(struct psmouse *psmouse, unsigned int resolution);