Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp7990385rwn; Wed, 14 Sep 2022 07:25:59 -0700 (PDT) X-Google-Smtp-Source: AA6agR7bgjZRT9Ccbct0bwCd4GGEdgwa04B3wlSdTEEREygyCmXVLdBzxznAVNj0sazVbtFpkhul X-Received: by 2002:a17:907:7244:b0:780:28df:b985 with SMTP id ds4-20020a170907724400b0078028dfb985mr3097605ejc.549.1663165558921; Wed, 14 Sep 2022 07:25:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663165558; cv=none; d=google.com; s=arc-20160816; b=t/FvxDWcHsO2LBCDfmboGEljBVXto/DRR1O8UQhDVYEkz9hBgBLML2rnwm/dJeSReS 9tiB83nJMW6QkvgV/q5MLUOFJnEUykuSSzzigk+UhltjNmmQ0wEq+bdL+FGIx//kfbic jqs3jDzKRMKW8+Te25HNRmV8votbSBYH7B0oEvn4c92IPvdiXYEG9Z7xF5boxbK+oFcL t4IsnZG1JBatGFZMrM3Y7tT1CjnU6vSwGrGCQzSRtBO9HKNzHIlvKLAxYCzlGAFd3W6o 5VWMkOss9+mvEiWD5bPAwEeWuNfOftoiRvopx1KwVfrsF9TSp4zf/k0LNpkQjHpDkAeM PSsA== 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=bAdGrYEmkmvhtXoA2Nr4gmu6DhEMvOCOQQto+Y0rKro=; b=RPEKjqXi3sA65Mq+LWhJQznI5ZNakQ1B0snMpITSnzFLM+oGvoSjg/E87mwVPmuLfR I7ozQFIe+eIfuB7vP3aept+irMD+teXRwtvAjrNDegphtgHJIXFWw1LxGclhuOZ+KRhK lWqk/lPqiAnlzR5o4qQc8vFAfjm1Fh7tsN2X6cIl28cMOt6mZon7UQIq7yqEQjVsHXQy yjK8Rkij5XbHxjQdbr9w0s8V90PzMD335zYophKIJvXKrEcr5NduSEcezi3HucFA+BPL gZ7G5UnUwKZ6WMKTfedWnEGNtrtqOvDGdtK19W1yRwXZ/pXjdIx7C6pts/srnkueGbfb BfCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=RQqHlOsb; 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 qb26-20020a1709077e9a00b007315a1c65b8si13029850ejc.329.2022.09.14.07.25.32; Wed, 14 Sep 2022 07:25:58 -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=RQqHlOsb; 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 S229970AbiINOOw (ORCPT + 99 others); Wed, 14 Sep 2022 10:14:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229803AbiINOOi (ORCPT ); Wed, 14 Sep 2022 10:14:38 -0400 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E960F5F8D; Wed, 14 Sep 2022 07:14:34 -0700 (PDT) Received: by mail-pf1-x42e.google.com with SMTP id a80so6481275pfa.4; Wed, 14 Sep 2022 07:14:34 -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=bAdGrYEmkmvhtXoA2Nr4gmu6DhEMvOCOQQto+Y0rKro=; b=RQqHlOsbOD+e1GokuAbBhPA2En2nAB4l8+ioE1KNw6tmPFUf7IdYNKILmcF8+kUjF4 npb+6aSPSGO3wf+jOZMRyOCuBUfDujUA1uck/5mzJsTXEvsslCbyVkYH1u+U4GW3l6Pc G5r+BIfK23wDn8fosrvUMRC1KA4Zkqfjt9UaTguVS0fDQOl9zpjk+lnbJ2AfrtK1/MoA j7rglwTl4WuB2sK73adZwyCBeMcJ5cDKCXBzcI56yDxyz/RTQWTwbKezfF+Ii3mcWU29 EKiEWmctE7rZwC4qza1PX4cZ9hT2kk98PIUfyZxyAAS9LxnAljW/J8Lv9fnWpvFOxMUe Q1Ew== 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=bAdGrYEmkmvhtXoA2Nr4gmu6DhEMvOCOQQto+Y0rKro=; b=DfJdgrgreuT/iuXxCXxlmqLkDeFelQKxCfi+/Bn83T+3nmGIcqowCTnDNK9p4+IZCE 0duKiXyyDNPQzSHbG+Tpgv/ukw7JtmNIFWe3BtBs1Hz9btXUo6kEm6j56nR9C5zwZnpr 5SoKF2ZISV1ytnctjxXgCWQBj3r2NjFFQPFaXo2EeMyh+IH+bRoW1JAlX07EEnqPa8PZ W5s9efwVO2QHhCcuPwD+Fk8ZwX6MLucMKbtXanc/68GKytshdrjWFhZwjjGxdv7jNBzA WZ9BZvmDyW5YWOr2qIb1ClVXpP7PdDkvOn14+ol1UOtFfxMf9cdApLX0o/6F4pqPj74q xP4g== X-Gm-Message-State: ACgBeo1E3xBLhrVfJJitLFbx5P1uJg6l2PREoopyK6N7JAvQ5OSWpQhy eOw9v0dL1oHaSCpyQOCjz0QNoqU4idfEEA== X-Received: by 2002:a05:6a00:2446:b0:528:5da9:cc7 with SMTP id d6-20020a056a00244600b005285da90cc7mr38622170pfj.51.1663164874098; Wed, 14 Sep 2022 07:14:34 -0700 (PDT) Received: from dtor-ws.mtv.corp.google.com ([2620:15c:202:201:2f68:fe7:a2e6:7595]) by smtp.gmail.com with ESMTPSA id a9-20020a170902ecc900b0017839e5abfasm6480624plh.263.2022.09.14.07.14.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Sep 2022 07:14:33 -0700 (PDT) From: Dmitry Torokhov To: Heiko Stuebner Cc: Linus Walleij , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/5] Input: auo-pixcir-ts - switch to using gpiod API Date: Wed, 14 Sep 2022 07:14:25 -0700 Message-Id: <20220914141428.2201784-2-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.37.2.789.g6183377224-goog In-Reply-To: <20220914141428.2201784-1-dmitry.torokhov@gmail.com> References: <20220914141428.2201784-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,T_SCC_BODY_TEXT_LINE 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 switches the driver to gpiod API and drops uses of of_get_gpio() API. Signed-off-by: Dmitry Torokhov --- drivers/input/touchscreen/auo-pixcir-ts.c | 47 ++++++++++------------- 1 file changed, 20 insertions(+), 27 deletions(-) diff --git a/drivers/input/touchscreen/auo-pixcir-ts.c b/drivers/input/touchscreen/auo-pixcir-ts.c index a51d66ebff2b..c3bce9fb2c94 100644 --- a/drivers/input/touchscreen/auo-pixcir-ts.c +++ b/drivers/input/touchscreen/auo-pixcir-ts.c @@ -10,6 +10,7 @@ * Copyright (c) 2008 QUALCOMM USA, INC. */ +#include #include #include #include @@ -19,9 +20,8 @@ #include #include #include -#include +#include #include -#include /* * Coordinate calculation: @@ -112,8 +112,8 @@ struct auo_pixcir_ts { struct i2c_client *client; struct input_dev *input; - int gpio_int; - int gpio_rst; + struct gpio_desc *gpio_int; + struct gpio_desc *gpio_rst; char phys[32]; unsigned int x_max; @@ -193,7 +193,7 @@ static irqreturn_t auo_pixcir_interrupt(int irq, void *dev_id) /* check for up event in touch touch_ind_mode */ if (ts->touch_ind_mode) { - if (gpio_get_value(ts->gpio_int) == 0) { + if (gpiod_get_value_cansleep(ts->gpio_int) == 0) { input_mt_sync(ts->input); input_report_key(ts->input, BTN_TOUCH, 0); input_sync(ts->input); @@ -482,18 +482,6 @@ static int auo_pixcir_parse_dt(struct device *dev, struct auo_pixcir_ts *ts) if (!np) return -ENOENT; - ts->gpio_int = of_get_gpio(np, 0); - if (!gpio_is_valid(ts->gpio_int)) { - dev_err(dev, "failed to get interrupt gpio\n"); - return -EINVAL; - } - - ts->gpio_rst = of_get_gpio(np, 1); - if (!gpio_is_valid(ts->gpio_rst)) { - dev_err(dev, "failed to get reset gpio\n"); - return -EINVAL; - } - if (of_property_read_u32(np, "x-size", &ts->x_max)) { dev_err(dev, "failed to get x-size property\n"); return -EINVAL; @@ -517,7 +505,7 @@ static void auo_pixcir_reset(void *data) { struct auo_pixcir_ts *ts = data; - gpio_set_value(ts->gpio_rst, 0); + gpiod_set_value_cansleep(ts->gpio_rst, 1); } static int auo_pixcir_probe(struct i2c_client *client, @@ -578,23 +566,28 @@ static int auo_pixcir_probe(struct i2c_client *client, input_set_drvdata(ts->input, ts); - error = devm_gpio_request_one(&client->dev, ts->gpio_int, - GPIOF_DIR_IN, "auo_pixcir_ts_int"); + ts->gpio_int = devm_gpiod_get_index(&client->dev, NULL, 0, GPIOD_IN); + error = PTR_ERR_OR_ZERO(ts->gpio_int); if (error) { - dev_err(&client->dev, "request of gpio %d failed, %d\n", - ts->gpio_int, error); + dev_err(&client->dev, + "request of int gpio failed: %d\n", error); return error; } - error = devm_gpio_request_one(&client->dev, ts->gpio_rst, - GPIOF_DIR_OUT | GPIOF_INIT_HIGH, - "auo_pixcir_ts_rst"); + gpiod_set_consumer_name(ts->gpio_int, "auo_pixcir_ts_int"); + + /* Take the chip out of reset */ + ts->gpio_rst = devm_gpiod_get_index(&client->dev, NULL, 1, + GPIOD_OUT_LOW); + error = PTR_ERR_OR_ZERO(ts->gpio_rst); if (error) { - dev_err(&client->dev, "request of gpio %d failed, %d\n", - ts->gpio_rst, error); + dev_err(&client->dev, + "request of reset gpio failed: %d\n", error); return error; } + gpiod_set_consumer_name(ts->gpio_rst, "auo_pixcir_ts_rst"); + error = devm_add_action_or_reset(&client->dev, auo_pixcir_reset, ts); if (error) { dev_err(&client->dev, "failed to register reset action, %d\n", -- 2.37.2.789.g6183377224-goog