Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3409722rwb; Mon, 19 Sep 2022 21:55:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5CFpUTFfWjCMDxVC2PQMv6nJAAMdgRIEcvUVzjHJDod9qL5L7beBRI2MNrhVjeQVCOpKCD X-Received: by 2002:a17:907:b03:b0:770:872d:d7e9 with SMTP id h3-20020a1709070b0300b00770872dd7e9mr15606979ejl.272.1663649706723; Mon, 19 Sep 2022 21:55:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663649706; cv=none; d=google.com; s=arc-20160816; b=Retbi/aLI8ssZK8YKLA7rXazwzce7iHx2x0tGG+aDOh8W76JeVyQGVkqhT0tyPTG6N sc0Gcst/bSRq5pubiBE/+Qg1PMV5/rEKg0Wws9MhmiFSnzvWNUCKVRPGfxem9EiKV3It n11Q2Vn7tmlW2XVyEC7g3mf5ay7+PN0dVmDpfUEdhXk3zthp/AsaWm9CgOOV1U3ou6LF hb0ZdFU7nhwCCEjrBhllQ5k7WMLHYI2e+ylzKXYVo/DmtWjO61Nn5bJXviIovUg4zv2S tojsoWjboTkOZW5y9uNXVBcDxT75t0089nEtzxRvP09Jfx9C6VhoHDzjT8JiSF/PwQti xaHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=pIGkYbf9yJq729wkfcXhqGqwyONGFWTL2PsMGXYGRvA=; b=la3io/jA21p4BBKEV2CSCI4qJSkLA0XgrH5cN8Fc5+89Q9O69+6cGdRAwwxeWOnYS6 fDSS6KVpZn8su5SRN5ZKpE3MPXch0ybKgS/9DcsDdrPbD5ylZnkmJcilCrA/VtX7vdXh q8O6d/zGJVv2nsDzCePP4h9A5RdzfJwpvfr/opdEm7/MYyHakVmUEzOeDEMsV24hIkj8 DuA8a0bDol/bCUS/3ew5JP+d1HWdiIpt2+5GB8RLuBKPXJrDgGidqZ8G6PjZRQLbfguo Luz5LSqr9xwDYRIarWT5idRN6mKL2O7weyKSAaRHPgZVbWR66KbEH4WFJQgaqMyECJOw H+SA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="b1A/UY/e"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r21-20020aa7c155000000b0044d4a87aed7si500404edp.461.2022.09.19.21.54.41; Mon, 19 Sep 2022 21:55:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="b1A/UY/e"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230054AbiITE0j (ORCPT + 99 others); Tue, 20 Sep 2022 00:26:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229733AbiITE0Y (ORCPT ); Tue, 20 Sep 2022 00:26:24 -0400 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A04C56B94; Mon, 19 Sep 2022 21:26:16 -0700 (PDT) Received: by mail-pj1-x102f.google.com with SMTP id fv3so1804415pjb.0; 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=BQWhnk8z9Xf19sKwRd+Q1AiYs1xYl5tYHULpodrSCeMjv/OES58T5nt/FqpPE/gUet ZFt6eyvI2HwXy4hZtCtgpKF3/GvyuiNLO2UlVD8xisvq5FdYCWZos3/79oCGwX12ogjP DqZhIDw8EgHln+NAXtzRURAyWHYmXG362lkAirv0xhVNjSzXePH87fWDxJlhqLRWw9gy ObdAs2oMLC/RBaw4KhVLWlH54QiJxOofYqz5zlJNGubq9IS/LWnlakKkR87Tdstxmd/l qaZS9R73k0hcA07PIzsZEMDW2C3lAgPQvMMGYNzXXER7kbBHdqjPyBW+70jjJzaGEY/6 nZ3w== X-Gm-Message-State: ACrzQf2ogjS+vRmlpySOh5P8veCl3pemEsKapbhE8hG6cN58vZL+iJl5 3FtMyJsOdXeGiFFpbeVHtH4= 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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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) { -- 2.37.3.968.ga6b4b080e4-goog