From patchwork Tue Feb 28 22:46:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 9597327 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 18BF060414 for ; Wed, 1 Mar 2017 02:04:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 08B0028428 for ; Wed, 1 Mar 2017 02:04:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F04BE28497; Wed, 1 Mar 2017 02:04:19 +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.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=unavailable 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 877B828428 for ; Wed, 1 Mar 2017 02:04:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751511AbdCACDf (ORCPT ); Tue, 28 Feb 2017 21:03:35 -0500 Received: from mail-pg0-f68.google.com ([74.125.83.68]:33146 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751558AbdCACDd (ORCPT ); Tue, 28 Feb 2017 21:03:33 -0500 Received: by mail-pg0-f68.google.com with SMTP id x17so3863973pgi.0; Tue, 28 Feb 2017 18:03:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=y1/Q4Sd4r1nTFHD9hLfLuvyypBvDbaU4m4MCv+RrIvY=; b=VhCVsJeKWIfzGjubtxlxRU8p151EmAziye5FfsFc3flmFWPkUu29OkslHkToOvDVyh 4SvtZmYA/7rpErSg2lLbR31Fw4rrLch8unVL/UzQncAlTrT80pRzc1FHGdHqR5N+HMBq UY/8YHbUr3yiK3X4eg2PT16GzR4BcLrBLPxwNQbbivGhB2iAUkCK0Fu4JO16F3lRT3VY RXzf8UD/mkT7ZAHAWSnbMGKlgCNF/6Y8ax7StNiqzSidz65Zp2InLJg0EZG2UaCrAqDz TMIPFVbsvZxWRxcAdTz+5anDL3VraQpLUd0HHRsVoOB+Cy3rJ59RPE15oNs2b+Byuieh ytjA== 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:in-reply-to :references; bh=y1/Q4Sd4r1nTFHD9hLfLuvyypBvDbaU4m4MCv+RrIvY=; b=Uheslc1vhHfgu6Q01FRBmjh6DXaf0PK+CEnHY/ozrzaNP0LQX2Fej/MAZm4/GYsgWL eDc9NNHf7QMUEAr3UUIGc8GVvayNzUNA3iVCRP4KfRQyhEmJ2xoeWnOUDV0DmmuAIJ9w sN2BIzp/WvFUlQlDfJu0JvdYBPWD7+hLW5L6jDSbJcjw5kMtgzfuucKeLWABH+c5D0m1 y6kHiT7lPcoD/zNDUITh7I1ac0CcQhmjanUS8JWOphrkh8c8etvdLxARMwKmQBZ9dz8x rgsESsWJLtxyFMs7/cE5yPWkjNL1lfNFAiKDfcUCyr0Rq8SmN8dO/nauD4+swHuKxWOn Rouw== X-Gm-Message-State: AMke39nj2zqwM41m4NB/HbD91NV+pJ4r8d1x3nKh6Youe/wei0OzXI27RVIJiTU0YNi6ow== X-Received: by 10.84.232.5 with SMTP id h5mr6068624plk.134.1488322002681; Tue, 28 Feb 2017 14:46:42 -0800 (PST) Received: from dtor-ws.mtv.corp.google.com ([172.22.152.34]) by smtp.gmail.com with ESMTPSA id u80sm6155359pgb.32.2017.02.28.14.46.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 28 Feb 2017 14:46:42 -0800 (PST) From: Dmitry Torokhov To: Daniel Mack Cc: Haojian Zhuang , Robert Jarzmik , linux-kernel@vger.kernel.org, linux-input@vger.kernel.org Subject: [PATCH 10/10] Input: eeti_ts - switch to gpiod API Date: Tue, 28 Feb 2017 14:46:32 -0800 Message-Id: <20170228224632.3401-10-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.11.0.483.g087da7b7c-goog In-Reply-To: <20170228224632.3401-1-dmitry.torokhov@gmail.com> References: <20170228224632.3401-1-dmitry.torokhov@gmail.com> 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 gpiod API allows standard way of specifying GPIO polarity and takes it into account when reading or setting GPIO state. It also allows us to switch to common way of obtaining GPIO descriptor and away form legacy platform data. Signed-off-by: Dmitry Torokhov --- arch/arm/mach-pxa/raumfeld.c | 14 +++++++++----- drivers/input/touchscreen/eeti_ts.c | 24 +++++++----------------- include/linux/input/eeti_ts.h | 10 ---------- 3 files changed, 16 insertions(+), 32 deletions(-) delete mode 100644 include/linux/input/eeti_ts.h diff --git a/arch/arm/mach-pxa/raumfeld.c b/arch/arm/mach-pxa/raumfeld.c index 80b03193799d..b0886ef92d8c 100644 --- a/arch/arm/mach-pxa/raumfeld.c +++ b/arch/arm/mach-pxa/raumfeld.c @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include @@ -966,16 +965,19 @@ static struct i2c_board_info raumfeld_connector_i2c_board_info __initdata = { .addr = 0x48, }; -static struct eeti_ts_platform_data eeti_ts_pdata = { - .irq_active_high = 1, - .irq_gpio = GPIO_TOUCH_IRQ, +static struct gpiod_lookup_table raumfeld_controller_gpios_table = { + .dev_id = "0-000a", + .table = { + GPIO_LOOKUP("gpio-pxa", + GPIO_TOUCH_IRQ, "attn", GPIO_ACTIVE_HIGH), + { }, + }, }; static struct i2c_board_info raumfeld_controller_i2c_board_info __initdata = { .type = "eeti_ts", .addr = 0x0a, .irq = PXA_GPIO_TO_IRQ(GPIO_TOUCH_IRQ), - .platform_data = &eeti_ts_pdata, }; static struct platform_device *raumfeld_common_devices[] = { @@ -1073,6 +1075,8 @@ static void __init __maybe_unused raumfeld_controller_init(void) if (irqd) irqd_set_trigger_type(irqd, IRQ_TYPE_LEVEL_HIGH); + gpiod_add_lookup_table(&raumfeld_controller_gpios_table); + i2c_register_board_info(0, &raumfeld_controller_i2c_board_info, 1); ret = gpio_request(GPIO_SHUTDOWN_BATT, "battery shutdown"); diff --git a/drivers/input/touchscreen/eeti_ts.c b/drivers/input/touchscreen/eeti_ts.c index 3627c7b5f5ec..2facad75eb6d 100644 --- a/drivers/input/touchscreen/eeti_ts.c +++ b/drivers/input/touchscreen/eeti_ts.c @@ -31,8 +31,7 @@ #include #include #include -#include -#include +#include #include #include @@ -47,7 +46,7 @@ MODULE_PARM_DESC(flip_y, "flip y coordinate"); struct eeti_ts { struct i2c_client *client; struct input_dev *input; - int irq_gpio, irq_active_high; + struct gpio_desc *attn_gpio; bool running; }; @@ -60,11 +59,6 @@ struct eeti_ts { #define REPORT_BIT_HAS_PRESSURE BIT(6) #define REPORT_RES_BITS(v) (((v) >> 1) + EETI_TS_BITDEPTH) -static inline int eeti_ts_irq_active(struct eeti_ts *eeti) -{ - return gpio_get_value_cansleep(eeti->irq_gpio) == eeti->irq_active_high; -} - static void eeti_ts_report_event(struct eeti_ts *eeti, u8 *buf) { unsigned int res; @@ -115,7 +109,8 @@ static irqreturn_t eeti_ts_isr(int irq, void *dev_id) /* Motion packet */ eeti_ts_report_event(eeti, buf); } - } while (eeti->running && eeti_ts_irq_active(eeti)); + } while (eeti->running && + eeti->attn_gpio && gpiod_get_value_cansleep(eeti->attn_gpio)); return IRQ_HANDLED; } @@ -154,7 +149,6 @@ static int eeti_ts_probe(struct i2c_client *client, const struct i2c_device_id *idp) { struct device *dev = &client->dev; - struct eeti_ts_platform_data *pdata = dev_get_platdata(dev); struct eeti_ts *eeti; struct input_dev *input; int error; @@ -191,14 +185,10 @@ static int eeti_ts_probe(struct i2c_client *client, eeti->client = client; eeti->input = input; - eeti->irq_gpio = pdata->irq_gpio; - - error = devm_gpio_request_one(dev, pdata->irq_gpio, GPIOF_IN, - client->name); - if (error) - return error; - eeti->irq_active_high = pdata->irq_active_high; + eeti->attn_gpio = devm_gpiod_get_optional(dev, "attn", GPIOD_IN); + if (IS_ERR(eeti->attn_gpio)) + return PTR_ERR(eeti->attn_gpio); i2c_set_clientdata(client, eeti); input_set_drvdata(input, eeti); diff --git a/include/linux/input/eeti_ts.h b/include/linux/input/eeti_ts.h deleted file mode 100644 index 16625d799b6f..000000000000 --- a/include/linux/input/eeti_ts.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef LINUX_INPUT_EETI_TS_H -#define LINUX_INPUT_EETI_TS_H - -struct eeti_ts_platform_data { - int irq_gpio; - unsigned int irq_active_high; -}; - -#endif /* LINUX_INPUT_EETI_TS_H */ -