From patchwork Sun Jan 22 20:00:08 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: 9531463 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 52881601D4 for ; Sun, 22 Jan 2017 20:00:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 37A0527F93 for ; Sun, 22 Jan 2017 20:00:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 187CA27FA8; Sun, 22 Jan 2017 20:00:13 +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 AE48A27F93 for ; Sun, 22 Jan 2017 20:00:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751421AbdAVUAM (ORCPT ); Sun, 22 Jan 2017 15:00:12 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59360 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751047AbdAVUAL (ORCPT ); Sun, 22 Jan 2017 15:00:11 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (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 28F8285542; Sun, 22 Jan 2017 20:00:12 +0000 (UTC) Received: from shalem.localdomain.com (ovpn-116-34.ams2.redhat.com [10.36.116.34]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v0MK0Avm012368; Sun, 22 Jan 2017 15:00:10 -0500 From: Hans de Goede To: Dmitry Torokhov Cc: Hans de Goede , "russianneuromancer @ ya . ru" , Gregor Riepl , linux-input@vger.kernel.org Subject: [PATCH v2] Input: silead - Do not try to directly access the GPIO when using ACPI pm Date: Sun, 22 Jan 2017 21:00:08 +0100 Message-Id: <20170122200008.27027-1-hdegoede@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Sun, 22 Jan 2017 20:00:12 +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 x86 tablets we cannot directly access the GPIOs as they are claimed by the ACPI tables, so check it the i2c client is not being power-managed by ACPI before trying to get the power pin GPIO. Signed-off-by: Hans de Goede --- Changes in v2: -Check acpi_bus_power_manageable() instead of trying to directly control the acpi power level ourselves --- drivers/input/touchscreen/silead.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/drivers/input/touchscreen/silead.c b/drivers/input/touchscreen/silead.c index 404830a..2fbcd7f 100644 --- a/drivers/input/touchscreen/silead.c +++ b/drivers/input/touchscreen/silead.c @@ -31,6 +31,7 @@ #include #include +#include #include #define SILEAD_TS_NAME "silead_ts" @@ -494,12 +495,21 @@ static int silead_ts_probe(struct i2c_client *client, if (error) return error; - /* Power GPIO pin */ - data->gpio_power = devm_gpiod_get_optional(dev, "power", GPIOD_OUT_LOW); - if (IS_ERR(data->gpio_power)) { - if (PTR_ERR(data->gpio_power) != -EPROBE_DEFER) - dev_err(dev, "Shutdown GPIO request failed\n"); - return PTR_ERR(data->gpio_power); + /* + * If device power is not managed by ACPI, get the power_gpio + * and manage it ourselves. + */ +#ifdef CONFIG_ACPI + if (!acpi_bus_power_manageable(ACPI_HANDLE(dev))) +#endif + { + data->gpio_power = devm_gpiod_get_optional(dev, "power", + GPIOD_OUT_LOW); + if (IS_ERR(data->gpio_power)) { + if (PTR_ERR(data->gpio_power) != -EPROBE_DEFER) + dev_err(dev, "Power GPIO request failed\n"); + return PTR_ERR(data->gpio_power); + } } error = silead_ts_setup(client);