Received: by 10.213.65.68 with SMTP id h4csp1939859imn; Thu, 5 Apr 2018 06:27:48 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+unpFckrYuDbVH5G0bGiBXiu1M+GfWnJCF8LRlkWWU9jDjLVmG5NE1xjTG7vUmHxRqAPjn X-Received: by 2002:a17:902:9a86:: with SMTP id w6-v6mr22748623plp.168.1522934868026; Thu, 05 Apr 2018 06:27:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522934867; cv=none; d=google.com; s=arc-20160816; b=XApQy5c04swegW2jm2trRD3HxWhVJl1VCDUeM1d/9ZsyqaXRYOtmp5A5vkFuaO6+Xh t1ByDgBb0w/9ZRIq7uJbG3nmSfb5QzzhwXhsnTXsgAwyYHy58CumO8RaOUj0+JKLJeGk x3sr2QWrGtQwhezbbyaItDDZNn7cM6+kK3PHFKd2/tvZKlnxsne/LKDUpxhgY4IMepMw S0husK+ZN9aV85LCC/QY3FTb+g2bNknjdhfv/mAo4u7sG78pz119I8nWtCcBYvldmiWN 25KIZ5lHXFTRxYaH94HiJfoXFtS//FG+6RXNrY8KTW+AbC59BJzyD9vlH4+vWUKlTsLh y5zw== 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=+EGq/1PXlBxxCh/mrLZsLQytg+/dUAobVDZgGl6CQFY=; b=vbabtmdLOPvtwYVpkRiRwdS0KGdIjmgjT4/T3snZuiv+0DCbcfc23zVGvzZeQI86aj dUO9sY/OXfxGgdOfnYqirubbdhXmTSccmuNW5IWEOfqRnAqgQ2MpUXb42SDazlm/yC5s pSjAqpjqHC9cVXqtlnExRpU5AA6KCm23TPj3lcfSg58yRlDBOrzd3cPbgl+U+fX6C181 7ejb7tKg8IcwBsCKuyO4vjZneAwG7ZU+MgT8ZJ15fRC1FgiDeyFtEga2DAoGwMs1/KVd JMHJnoZ8So0o1/YaxOW7OXkK9fr4dwp20MX1Soh2zpBYBSkE0QdLphcA5F0GfJBmQsAH PJkQ== 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 197si5461251pge.78.2018.04.05.06.27.33; Thu, 05 Apr 2018 06:27:47 -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 S1751808AbeDEN0M (ORCPT + 99 others); Thu, 5 Apr 2018 09:26:12 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:54194 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751359AbeDENZ7 (ORCPT ); Thu, 5 Apr 2018 09:25:59 -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 B0A234068031; Thu, 5 Apr 2018 13:25:58 +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 207D12023235; Thu, 5 Apr 2018 13:25:56 +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 8/8] input: psmouse-smbus: allow to control psmouse_deactivate Date: Thu, 5 Apr 2018 15:25:37 +0200 Message-Id: <20180405132537.3218-9-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.5]); Thu, 05 Apr 2018 13:25:58 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Thu, 05 Apr 2018 13:25:58 +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 This seems to be Synaptics specific, as some Elan touchpads are not correctly switching to SMBus if we call deactivate before switching to SMBus on cold boot and on resume. Tested with the T480s Signed-off-by: Benjamin Tissoires --- drivers/input/mouse/elantech.c | 2 +- drivers/input/mouse/psmouse-smbus.c | 13 ++++++++++--- drivers/input/mouse/psmouse.h | 1 + drivers/input/mouse/synaptics.c | 2 +- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c index 29f55e8e07e9..6009fb7d0d31 100644 --- a/drivers/input/mouse/elantech.c +++ b/drivers/input/mouse/elantech.c @@ -1771,7 +1771,7 @@ static int elantech_create_smbus(struct psmouse *psmouse, }; return psmouse_smbus_init(psmouse, &smbus_board, &pdata, - sizeof(pdata), leave_breadcrumbs); + sizeof(pdata), false, leave_breadcrumbs); } /** diff --git a/drivers/input/mouse/psmouse-smbus.c b/drivers/input/mouse/psmouse-smbus.c index c7ac24d119c1..facfe902b073 100644 --- a/drivers/input/mouse/psmouse-smbus.c +++ b/drivers/input/mouse/psmouse-smbus.c @@ -23,6 +23,7 @@ struct psmouse_smbus_dev { struct i2c_client *client; struct list_head node; bool dead; + bool need_deactivate; }; static LIST_HEAD(psmouse_smbus_list); @@ -118,7 +119,10 @@ static psmouse_ret_t psmouse_smbus_process_byte(struct psmouse *psmouse) static int psmouse_smbus_reconnect(struct psmouse *psmouse) { - psmouse_deactivate(psmouse); + struct psmouse_smbus_dev *smbdev = psmouse->private; + + if (smbdev->need_deactivate) + psmouse_deactivate(psmouse); return 0; } @@ -225,6 +229,7 @@ void psmouse_smbus_cleanup(struct psmouse *psmouse) int psmouse_smbus_init(struct psmouse *psmouse, const struct i2c_board_info *board, const void *pdata, size_t pdata_size, + bool need_deactivate, bool leave_breadcrumbs) { struct psmouse_smbus_dev *smbdev; @@ -236,6 +241,7 @@ int psmouse_smbus_init(struct psmouse *psmouse, smbdev->psmouse = psmouse; smbdev->board = *board; + smbdev->need_deactivate = need_deactivate; smbdev->board.platform_data = kmemdup(pdata, pdata_size, GFP_KERNEL); if (!smbdev->board.platform_data) { @@ -243,6 +249,9 @@ int psmouse_smbus_init(struct psmouse *psmouse, return -ENOMEM; } + if (need_deactivate) + psmouse_deactivate(psmouse); + psmouse->private = smbdev; psmouse->protocol_handler = psmouse_smbus_process_byte; psmouse->reconnect = psmouse_smbus_reconnect; @@ -250,8 +259,6 @@ int psmouse_smbus_init(struct psmouse *psmouse, psmouse->disconnect = psmouse_smbus_disconnect; psmouse->resync_time = 0; - psmouse_deactivate(psmouse); - mutex_lock(&psmouse_smbus_mutex); list_add_tail(&smbdev->node, &psmouse_smbus_list); mutex_unlock(&psmouse_smbus_mutex); diff --git a/drivers/input/mouse/psmouse.h b/drivers/input/mouse/psmouse.h index dd4ec1f602d7..64c3a5d3fb3e 100644 --- a/drivers/input/mouse/psmouse.h +++ b/drivers/input/mouse/psmouse.h @@ -225,6 +225,7 @@ struct i2c_board_info; int psmouse_smbus_init(struct psmouse *psmouse, const struct i2c_board_info *board, const void *pdata, size_t pdata_size, + bool need_deactivate, bool leave_breadcrumbs); void psmouse_smbus_cleanup(struct psmouse *psmouse); diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index 14a1188561aa..6b1ed53a8b03 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c @@ -1751,7 +1751,7 @@ static int synaptics_create_intertouch(struct psmouse *psmouse, }; return psmouse_smbus_init(psmouse, &intertouch_board, - &pdata, sizeof(pdata), + &pdata, sizeof(pdata), true, leave_breadcrumbs); } -- 2.14.3