From patchwork Tue Jan 9 22:19:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 10153569 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D9217603ED for ; Tue, 9 Jan 2018 22:19:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D0F6026222 for ; Tue, 9 Jan 2018 22:19:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C5B6D26224; Tue, 9 Jan 2018 22:19:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D2FB826223 for ; Tue, 9 Jan 2018 22:19:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755157AbeAIWTh (ORCPT ); Tue, 9 Jan 2018 17:19:37 -0500 Received: from mail-pf0-f196.google.com ([209.85.192.196]:42870 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753453AbeAIWTh (ORCPT ); Tue, 9 Jan 2018 17:19:37 -0500 Received: by mail-pf0-f196.google.com with SMTP id d23so9577557pfe.9 for ; Tue, 09 Jan 2018 14:19:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=OMK/GuZfHkGe8wI5QqgMfUBsjHXHDct5aRJxS7yPv2M=; b=Vb271vhzYJAfgtueLCpMPMHXTWdd2r9Kz1g7iYzKbPuWU8P2gyY9KygjT/okq12Yud 6tU4i1aGGRa5/NBJ0tc+q+recSLPx/7BcRiJ7M0PvN74ZpPgrRMYNE02/SDVQ/d8yYIO mHTHP3x//RDzPSe7weEe4Nn5Xp0KiQKbbbr7sX46Z3eevyqFUHkI+uBfNqWxh+S55Bnm nRQ7zTv6F/StA5JAreRuwcdi+hKNuU0xAfQsVtXPATrGOug2q5yAuqiZm0svbDoSs4eX 70ehXyaWR5hk2O3y+P4ezvEkqCoRxYnTBZMem5NmgNbermuAe+P0LWIO8HJ73lxlCU2d 4Tuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=OMK/GuZfHkGe8wI5QqgMfUBsjHXHDct5aRJxS7yPv2M=; b=boSEjVw0SmDALM2latDK3KtrlBtKYOUdxhGmi7s4mB77cLK7GR+/rbhgaCaA0RdHK7 unnRIfC+2iokSPqoHGGrsBxFUOboclXTlzL8RhG7mPK8z7KgJho6sFleXC2wxH90LgA+ FIrufL0kvKu7n7KDCNLB+Vd70HQAXf+x4gdP+x8fgtsxej21xDMoim76sbwm47E6Q5fR YSb9m0x//5nbs4SHwGhdYoSK6jH3Z0iJoUx9VU4v4EPVjlFNO0gca3L17k49oMCUKEFB UHO7LjRNMnmDi3pBW4ucd4gJIBFCCgIac5PJ+y5k2gvny3vk/gXbpMTthitV3po+fjPc btSQ== X-Gm-Message-State: AKGB3mL2CSRkZs1/NMzZlCwfYufplayNTCIJJe0y/h4Q+X64yRJnnPwD n99uRGvHD5j+dQcu/lh/GGU= X-Google-Smtp-Source: ACJfBotEQBcgQ8z1co3A0XfC+V7V1Jp8jCQHoGZj6H5YZRuEAT3zoxyH8cFJWKlcg0KeqdqQsEwmtw== X-Received: by 10.99.116.20 with SMTP id p20mr6896583pgc.340.1515536376173; Tue, 09 Jan 2018 14:19:36 -0800 (PST) Received: from dtor-ws ([2620:0:1000:1611:da80:8749:c06f:9515]) by smtp.gmail.com with ESMTPSA id a15sm33634401pfe.91.2018.01.09.14.19.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 09 Jan 2018 14:19:35 -0800 (PST) Date: Tue, 9 Jan 2018 14:19:33 -0800 From: Dmitry Torokhov To: Andrew Duggan Cc: Matteo Croce , linux-input@vger.kernel.org Subject: Re: [PATCH] synaptics: fix rmi4 bus dependencies Message-ID: <20180109221933.nexohjl75g4uu2nl@dtor-ws> References: <20180102191609.21460-1-mcroce@redhat.com> <20180102192143.egooy4onto73qd3y@dtor-ws> <204b8c3f-ec33-4400-33ff-fe39e9ca5702@synaptics.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <204b8c3f-ec33-4400-33ff-fe39e9ca5702@synaptics.com> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Tue, Jan 02, 2018 at 11:37:07AM -0800, Andrew Duggan wrote: > On 01/02/2018 11:21 AM, Dmitry Torokhov wrote: > > On Tue, Jan 02, 2018 at 08:16:09PM +0100, Matteo Croce wrote: > > > Make MOUSE_PS2_SYNAPTICS_SMBUS select MOUSE_PS2_SYNAPTICS because if > > > the latter is disabled the detection and switching code isn't being run. > > Hmm, it should. In synaptics.c: > > > > #if defined(CONFIG_MOUSE_PS2_SYNAPTICS) || \ > > defined(CONFIG_MOUSE_PS2_SYNAPTICS_SMBUS) > > > > int synaptics_init(struct psmouse *psmouse) > > { > > struct synaptics_device_info info; > > int error; > > int retval; > > > > psmouse_reset(psmouse); > > ... > > } > > > > The intent was to allow disabling the PS/2 portion of Synaptics driver > > while retaining the switching to SMbus capability. > > Oh, I suggested to Matteo that this patch might be needed off list. I > clearly didn't look closely enough to see that MOUSE_PS2_SYNAPTICS_SMBUS is > intended to be able to be used independently of MOUSE_PS2_SYNAPTICS. > > However, he did seem to see behavior where the mode switch did not occur > when MOUSE_PS2_SYNAPTICS was disabled, but MOUSE_PS2_SYNAPTICS_SMBUS was > enabled. That will need to be investigated further. OK, I see what the problem is. Could you please try the version below? Thanks. diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c index f3eb407a3b7d..cbe12671f784 100644 --- a/drivers/input/mouse/psmouse-base.c +++ b/drivers/input/mouse/psmouse-base.c @@ -984,6 +984,21 @@ static void psmouse_apply_defaults(struct psmouse *psmouse) psmouse->pt_deactivate = NULL; } +static bool psmouse_do_detect(int (*detect)(struct psmouse *, bool), + struct psmouse *psmouse, bool allow_passthrough, + bool set_properties) +{ + if (psmouse->ps2dev.serio->id.type == SERIO_PS_PSTHRU && + !allow_passthrough) { + return false; + } + + if (set_properties) + psmouse_apply_defaults(psmouse); + + return detect(psmouse, set_properties) == 0; +} + static bool psmouse_try_protocol(struct psmouse *psmouse, enum psmouse_type type, unsigned int *max_proto, @@ -995,15 +1010,8 @@ static bool psmouse_try_protocol(struct psmouse *psmouse, if (!proto) return false; - if (psmouse->ps2dev.serio->id.type == SERIO_PS_PSTHRU && - !proto->try_passthru) { - return false; - } - - if (set_properties) - psmouse_apply_defaults(psmouse); - - if (proto->detect(psmouse, set_properties) != 0) + if (!psmouse_do_detect(proto->detect, psmouse, proto->try_passthru, + set_properties)) return false; if (set_properties && proto->init && init_allowed) { @@ -1036,8 +1044,8 @@ static int psmouse_extensions(struct psmouse *psmouse, * Always check for focaltech, this is safe as it uses pnp-id * matching. */ - if (psmouse_try_protocol(psmouse, PSMOUSE_FOCALTECH, - &max_proto, set_properties, false)) { + if (psmouse_do_detect(focaltech_detect, + psmouse, false, set_properties)) { if (max_proto > PSMOUSE_IMEX && IS_ENABLED(CONFIG_MOUSE_PS2_FOCALTECH) && (!set_properties || focaltech_init(psmouse) == 0)) { @@ -1083,8 +1091,8 @@ static int psmouse_extensions(struct psmouse *psmouse, * probing for IntelliMouse. */ if (max_proto > PSMOUSE_PS2 && - psmouse_try_protocol(psmouse, PSMOUSE_SYNAPTICS, &max_proto, - set_properties, false)) { + psmouse_do_detect(synaptics_detect, + psmouse, false, set_properties)) { synaptics_hardware = true; if (max_proto > PSMOUSE_IMEX) {