From patchwork Wed Mar 8 08:54:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 9610609 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 5E0276046A for ; Wed, 8 Mar 2017 09:02:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5A4912026B for ; Wed, 8 Mar 2017 09:02:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4EDCB26224; Wed, 8 Mar 2017 09:02:14 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 E784A2026B for ; Wed, 8 Mar 2017 09:02:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751910AbdCHJCN (ORCPT ); Wed, 8 Mar 2017 04:02:13 -0500 Received: from mx1.redhat.com ([209.132.183.28]:36874 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751585AbdCHJCN (ORCPT ); Wed, 8 Mar 2017 04:02:13 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 419BFC0586BC; Wed, 8 Mar 2017 08:54:21 +0000 (UTC) Received: from shalem.localdomain.com (ovpn-116-110.ams2.redhat.com [10.36.116.110]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v288sFGP001390; Wed, 8 Mar 2017 03:54:19 -0500 From: Hans de Goede To: Dmitry Torokhov Cc: Hans de Goede , linux-input@vger.kernel.org Subject: [PATCH resend 3/4] Input: axp20x-pek - Do not register input device on some systems Date: Wed, 8 Mar 2017 09:54:12 +0100 Message-Id: <20170308085413.5185-4-hdegoede@redhat.com> In-Reply-To: <20170308085413.5185-1-hdegoede@redhat.com> References: <20170308085413.5185-1-hdegoede@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 08 Mar 2017 08:54:21 +0000 (UTC) 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 some systems (Intel tablets with axp288 pmic) the powerbutton is also connected to a gpio pin of the SoC, advertised through the "INTCFD9" / "PNP0C40" acpi device. This leads to double reporting of powerbutton events, which is undesirable, so one driver needs to not report input events in this case. Since the soc_button_array driver for the "PNP0C40" acpi device also handles wake from suspend on these tablets and since the axp20x-pel driver requires relative expensive i2c accrsses, it is best for the axp20x-pek driver to not register an input device in this case. Note that this commit leaves the axp20x-driver bound to the device, rather then returning -ENODEV, this is done so that the sysfs attributes it offers are kept around. Signed-off-by: Hans de Goede --- drivers/input/misc/axp20x-pek.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/input/misc/axp20x-pek.c b/drivers/input/misc/axp20x-pek.c index b7258ec..dbd2c89 100644 --- a/drivers/input/misc/axp20x-pek.c +++ b/drivers/input/misc/axp20x-pek.c @@ -13,6 +13,7 @@ * GNU General Public License for more details. */ +#include #include #include #include @@ -267,9 +268,16 @@ static int axp20x_pek_probe(struct platform_device *pdev) axp20x_pek->axp20x = dev_get_drvdata(pdev->dev.parent); - error = axp20x_pek_probe_input_device(axp20x_pek, pdev); - if (error) - return error; + /* + * Do not register the input device if there is an "INTCFD9" + * gpio button ACPI device, that handles the power button too, + * and otherwise we end up reporting all presses twice. + */ + if (!acpi_dev_found("INTCFD9")) { + error = axp20x_pek_probe_input_device(axp20x_pek, pdev); + if (error) + return error; + } error = sysfs_create_group(&pdev->dev.kobj, &axp20x_attribute_group); if (error) {