From patchwork Wed Aug 21 08:55:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 171935 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp678468ily; Wed, 21 Aug 2019 01:55:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqzzebTlXjdiRkIpakl17bzQ1X/HoArm2jLA0ORL688V8Ni5NMD5jilc8dB6zXl0zjblMj93 X-Received: by 2002:a63:5807:: with SMTP id m7mr28100416pgb.371.1566377709246; Wed, 21 Aug 2019 01:55:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566377709; cv=none; d=google.com; s=arc-20160816; b=Mkx60yhXAaz9W90iynA2gXFn0SV0/Y03Mokmdzr2K7oVybDIxDLKuTd1c2ldAVrw+h c2v9S+9WNj6v9KOjC2LvmnAP2TTaXajZoap9O7ksT89eh7ONr+TYhecFzEBA7rZq4aPL DzDlOJJRsiHstJ62sr6C+78thPio1vNUjItXQ6iS8IGZb5eYi7a5yWwN2rxbTy0/Y6RY d2cZtkC0CRlwmULLUjs+zAllerTcv+sesDonl/iDHk8H8LpOWNWlSpPlUYbgjaIegVtJ vhXPnBQEf1+F7SjuaAEQ32D0oqt2Im3tFgs+CLK4ffmPf9aM7x+V2Dymrq4htT7cAgHD sVMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=13vFYsKZqbPCH3/HgxJlsrt96ycJv8bPLdusJ/ixmDc=; b=xCcOt83xzMloa54UmdNRJRzDeM05nI6SlwezWsvXHy2tF9z7lElFpMPoF5rI2QE9yN l+wysqudDdhn+hztmQ+eqYggydXpBt1hxXO0Ugt0U/n1bkWSyT85UXD1Dm8tE/erlqD2 vNY7YTxHmjRI/T1u7j2agiwKq0D35ZHmMNeALrjnVk+mHTKw2K+qRkhYEI0T82kddM2l bexpWMGwJ1+QTAuKyFPDaQRj7XkU8RcLqrqgOC22poQjsfs4dcfIdXttXqiMH2UVq7jK /7ux5lLSsseEz+jeg+2q/zuCPqq8Q+0QO/HV1nRBf1B1zV3fNxARbBccV3qFbkKHHcW9 UP5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ai2rGuF7; spf=pass (google.com: best guess record for domain of linux-input-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-input-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d19si1786338pjw.36.2019.08.21.01.55.09 for ; Wed, 21 Aug 2019 01:55:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-input-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ai2rGuF7; spf=pass (google.com: best guess record for domain of linux-input-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-input-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726680AbfHUIzI (ORCPT ); Wed, 21 Aug 2019 04:55:08 -0400 Received: from mail-lj1-f195.google.com ([209.85.208.195]:42014 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726648AbfHUIzI (ORCPT ); Wed, 21 Aug 2019 04:55:08 -0400 Received: by mail-lj1-f195.google.com with SMTP id l14so1375093ljj.9 for ; Wed, 21 Aug 2019 01:55:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=13vFYsKZqbPCH3/HgxJlsrt96ycJv8bPLdusJ/ixmDc=; b=Ai2rGuF745mco9BWVx6IXAWpy7RzAV3nqNpkaTZ3NhA2J9Qh5OBjyOXAnJpyUfI17w X8snu1lOog6lyxBe8Ra/RAZTNlrc+qOtJ8RY+NvagnaqssrwuLT+KlxbzId+VCX23cZu h0mrD0AhIMp58TdbTdQyGCUtM3lzxTUDJB+5ZMrhw7iKcZE036+mK8AED1+R0ntFciID tncS/VpclJqRFiRoegUo1p+iqbYlYN4yC59NHTHS3GIj52eLdy5cKkSnFM2RcrzFW2yz ZkpbyE52Y53FOeSLIMaVm3LFGRZZkLTlPkgiFpxTqfX7pV3RaAMSInCUhn2hBlUHq1AT wU0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=13vFYsKZqbPCH3/HgxJlsrt96ycJv8bPLdusJ/ixmDc=; b=DsLhQ+ZL5zv4ZL9ZY6ddiGvG5wyzx0ILAu7yUT1MzSyJBAVqdGBwrL1XXTjWMJmeeL bNZWG1RNHxhyV9nmVR1LxD6mWglI8T3obn2ch9fYGVphHJttfDoL1gArFiUTPETp9vZV SjCdqB6hcA+MMltg/J8vaDxDlnvUG5e56Fw5CeHKe8uxRPH8zGO5z6zWzH0fE/2zqKH0 L5/buqNHM8YB4q3OIqDnfAlbVLCZGQ0KDOc5/mGAoihJs+ZQJkpF5XocA8HdLAYg5pov Bjz5X2A+U8GUICkotfeGZ76mg2e9zvkNcNyg2Hx7tPKnxLw+AA4LNOccnVkUy945sIlH 9B+A== X-Gm-Message-State: APjAAAUgCVHPi0ZMEsIy4hhxQN6br1RCY3Er+Clz0c+84t1Q5JXi6agY 4ZWXUWSh4Zob4Qn3uFZD0mSzR9M0jdg= X-Received: by 2002:a2e:2b0a:: with SMTP id q10mr12813916lje.203.1566377706441; Wed, 21 Aug 2019 01:55:06 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id 69sm3154699ljj.101.2019.08.21.01.55.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Aug 2019 01:55:05 -0700 (PDT) From: Linus Walleij To: Dmitry Torokhov , linux-input@vger.kernel.org Cc: Linus Walleij , "H . Nikolaus Schaller" Subject: [PATCH] Input: tsc2007 - use GPIO descriptor Date: Wed, 21 Aug 2019 10:55:03 +0200 Message-Id: <20190821085503.8062-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org This switches the TSC2007 to use a GPIO descriptor to read the pendown GPIO line. Cc: H. Nikolaus Schaller Signed-off-by: Linus Walleij --- drivers/input/touchscreen/tsc2007.h | 4 +++- drivers/input/touchscreen/tsc2007_core.c | 14 +++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) -- 2.21.0 diff --git a/drivers/input/touchscreen/tsc2007.h b/drivers/input/touchscreen/tsc2007.h index 91c60bf6dcaf..0306c38b56c7 100644 --- a/drivers/input/touchscreen/tsc2007.h +++ b/drivers/input/touchscreen/tsc2007.h @@ -49,6 +49,8 @@ #define READ_X (ADC_ON_12BIT | TSC2007_MEASURE_X) #define PWRDOWN (TSC2007_12BIT | TSC2007_POWER_OFF_IRQ_EN) +struct gpio_desc; + struct ts_event { u16 x; u16 y; @@ -69,7 +71,7 @@ struct tsc2007 { int fuzzy; int fuzzz; - unsigned int gpio; + struct gpio_desc *gpiod; int irq; wait_queue_head_t wait; diff --git a/drivers/input/touchscreen/tsc2007_core.c b/drivers/input/touchscreen/tsc2007_core.c index 3b80abfc1eca..5d9c6128622e 100644 --- a/drivers/input/touchscreen/tsc2007_core.c +++ b/drivers/input/touchscreen/tsc2007_core.c @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include "tsc2007.h" @@ -226,7 +226,7 @@ static int tsc2007_get_pendown_state_gpio(struct device *dev) struct i2c_client *client = to_i2c_client(dev); struct tsc2007 *ts = i2c_get_clientdata(client); - return !gpio_get_value(ts->gpio); + return !gpiod_get_value(ts->gpiod); } static int tsc2007_probe_dt(struct i2c_client *client, struct tsc2007 *ts) @@ -266,13 +266,13 @@ static int tsc2007_probe_dt(struct i2c_client *client, struct tsc2007 *ts) return -EINVAL; } - ts->gpio = of_get_gpio(np, 0); - if (gpio_is_valid(ts->gpio)) + ts->gpiod = devm_gpiod_get_optional(&client->dev, NULL, GPIOD_IN); + if (IS_ERR(ts->gpiod)) + return PTR_ERR(ts->gpiod); + if (ts->gpiod) ts->get_pendown_state = tsc2007_get_pendown_state_gpio; else - dev_warn(&client->dev, - "GPIO not specified in DT (of_get_gpio returned %d)\n", - ts->gpio); + dev_warn(&client->dev, "GPIO not specified in DT\n"); return 0; }