From patchwork Tue Sep 20 04:26:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 12981346 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C3EFCECAAD8 for ; Tue, 20 Sep 2022 04:27:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=KvW3eIQ4j9PLCeki328JKQKTSzwH4sCVs18cTaf0UdE=; b=RmpqpjaYDvLXcX GgQjOG7wz2UvxxBaQKYbZclC3+cKKQVxwAKoCZ2e4niGTHW8Zqn+c4TglC6OzN8C9BCzvYCUdTcFB L8D1FQBZxitEdm7IpxutjFtYpj2AGdrNej0vrOiaqEnMLUBGmVf4y2mM2+TLiW9mABkvxjOvbVV+E wDxvJGH+tVnA1ODLTnltkbovHYDsmQFtO5JBtNIyuYZsC06sRQ2IBJL6W2m/OMYUVX4pzK2nYbxMC 14pi7OsHimF+6dM2swp6qukgA6Xm6Q6nvdRBvSLlcNywtrsmLYxk6fzWLO6cxePavKPhqWQdujSsr ee0mE+mEnsbino9zJS7w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oaUqL-000NIm-HN; Tue, 20 Sep 2022 04:26:45 +0000 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oaUpu-000N8c-3b for linux-arm-kernel@lists.infradead.org; Tue, 20 Sep 2022 04:26:19 +0000 Received: by mail-pl1-x633.google.com with SMTP id iw17so1241068plb.0 for ; Mon, 19 Sep 2022 21:26:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=pIGkYbf9yJq729wkfcXhqGqwyONGFWTL2PsMGXYGRvA=; b=b1A/UY/etRaIToqRoaqAcmDdOu0iH5cXbcOhn+YhlJosnosC1rD7s7QfxhFGiRikNE /zYKEgqwFVesX6Qcky1cciscr/9ZSZXXlVlQCSdy/oFiJfPpSDUrSkSSGegMYdyM9rS/ ubmH2jI8lBtJ0qjtYexMwjJKAFRorbONbNTqS0vIQvhsnoqPxQXQ4NWGdZ9rkA/oARy6 /6rsAK6w/rIKrVamDDJa/WNYOdhEROcdUebOcI+6MFNZ2k/N0OYt45cxfQ07aQqKu12W I7+csj1oIBRGJYKbVwt8hgAak8Da7iXHXlyCFhG3c8A2rn6ZkcuJW81OzJoSr1BtORKb ORvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=pIGkYbf9yJq729wkfcXhqGqwyONGFWTL2PsMGXYGRvA=; b=G6C5PW7rtZDJxLLy5ZQmkr/PJ3HQ69KcoYj15UjbJZDTfRysZGX7xJ7UPVhqPSM1hu k8mYHGLJFA7liQ4RLhdtmUB5XpFENjWifDIrDFEzjyv4WwHTZ94nvj0ZfItyU01SqrXj 6mtdnDRVZFavWUbpOwCEOB5ENQwuc6VWYMZXG6hQFGuE1I7CO+1DjaFRniHqcbh/qV+D 85CL9rkimJ3JyE30KmWlNyS1Wfja6btPtNENEDsjFGLGcat2i/mu5GsUyqQJrA6QElCu lWRxFhpuEbxUeZkPZCjwXrsug9EHaP4VQ1fbCLRqhdCUcO98bfQQ4UprVWfcFv+6N3+6 q7QQ== X-Gm-Message-State: ACrzQf2ObJq5QhOMz9GWqxJ2VCM28FBz/IE1iBsGeZVwc3hE73cVYfzL lX9T4qAZwKpJ6E0PC6cTQZE9GBgcOcI= X-Google-Smtp-Source: AMsMyM57I0D9KIVw5AL4bdyaT/GSXFo5QhBvAjAk5tjNPB7zD3KhkddmqgVNM5gMV4mJBMN9PV5OmQ== X-Received: by 2002:a17:902:c941:b0:177:e69a:a517 with SMTP id i1-20020a170902c94100b00177e69aa517mr3090266pla.144.1663647975125; Mon, 19 Sep 2022 21:26:15 -0700 (PDT) Received: from dtor-ws.mtv.corp.google.com ([2620:15c:202:201:b095:5d5d:4c28:8088]) by smtp.gmail.com with ESMTPSA id t15-20020a17090a024f00b001fab208523esm337518pje.3.2022.09.19.21.26.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Sep 2022 21:26:14 -0700 (PDT) From: Dmitry Torokhov To: Shawn Guo , Sascha Hauer , linux-input@vger.kernel.org Cc: Krzysztof Kozlowski , Fabio Estevam , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/4] Input: egalax_ts - switch to using gpiod API Date: Mon, 19 Sep 2022 21:26:07 -0700 Message-Id: <20220920042608.1865560-3-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.37.3.968.ga6b4b080e4-goog In-Reply-To: <20220920042608.1865560-1-dmitry.torokhov@gmail.com> References: <20220920042608.1865560-1-dmitry.torokhov@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220919_212618_176219_86FF4044 X-CRM114-Status: GOOD ( 18.92 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This updates the driver to gpiod API, and removes yet another use of of_get_named_gpio(). Signed-off-by: Dmitry Torokhov --- drivers/input/touchscreen/egalax_ts.c | 42 +++++++++++---------------- 1 file changed, 17 insertions(+), 25 deletions(-) diff --git a/drivers/input/touchscreen/egalax_ts.c b/drivers/input/touchscreen/egalax_ts.c index 83ac8c128192..9e9b1c52720d 100644 --- a/drivers/input/touchscreen/egalax_ts.c +++ b/drivers/input/touchscreen/egalax_ts.c @@ -14,17 +14,17 @@ - auto idle mode support */ +#include #include #include #include #include #include -#include +#include #include #include #include #include -#include /* * Mouse Mode: some panel may configure the controller to mouse mode, @@ -119,32 +119,26 @@ static irqreturn_t egalax_ts_interrupt(int irq, void *dev_id) /* wake up controller by an falling edge of interrupt gpio. */ static int egalax_wake_up_device(struct i2c_client *client) { - struct device_node *np = client->dev.of_node; - int gpio; + struct gpio_desc *gpio; int ret; - if (!np) - return -ENODEV; - - gpio = of_get_named_gpio(np, "wakeup-gpios", 0); - if (!gpio_is_valid(gpio)) - return -ENODEV; - - ret = gpio_request(gpio, "egalax_irq"); - if (ret < 0) { - dev_err(&client->dev, - "request gpio failed, cannot wake up controller: %d\n", - ret); + /* wake up controller via an falling edge on IRQ gpio. */ + gpio = gpiod_get(&client->dev, "wakeup", GPIOD_OUT_HIGH); + ret = PTR_ERR_OR_ZERO(gpio); + if (ret) { + if (ret != -EPROBE_DEFER) + dev_err(&client->dev, + "failed to request wakeup gpio, cannot wake up controller: %d\n", + ret); return ret; } - /* wake up controller via an falling edge on IRQ gpio. */ - gpio_direction_output(gpio, 0); - gpio_set_value(gpio, 1); + /* release the line */ + gpiod_set_value_cansleep(gpio, 0); - /* controller should be waken up, return irq. */ - gpio_direction_input(gpio); - gpio_free(gpio); + /* controller should be woken up, return irq. */ + gpiod_direction_input(gpio); + gpiod_put(gpio); return 0; } @@ -185,10 +179,8 @@ static int egalax_ts_probe(struct i2c_client *client, /* controller may be in sleep, wake it up. */ error = egalax_wake_up_device(client); - if (error) { - dev_err(&client->dev, "Failed to wake up the controller\n"); + if (error) return error; - } error = egalax_firmware_version(client); if (error < 0) {