From patchwork Tue Jul 7 00:30:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 6729291 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5D1609F38C for ; Tue, 7 Jul 2015 00:31:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6AF9C20798 for ; Tue, 7 Jul 2015 00:31:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6FD9E206D8 for ; Tue, 7 Jul 2015 00:31:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756595AbbGGAbT (ORCPT ); Mon, 6 Jul 2015 20:31:19 -0400 Received: from mail-ig0-f174.google.com ([209.85.213.174]:36320 "EHLO mail-ig0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756114AbbGGAaW (ORCPT ); Mon, 6 Jul 2015 20:30:22 -0400 Received: by igrv9 with SMTP id v9so165813740igr.1; Mon, 06 Jul 2015 17:30:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=DA8eOOwyRuhFknEGzbFMaJu+Yuao7NKOclU51vAClbY=; b=KMmRq1zwetde+t3jzFZ/vtPjOQn4y5ukabMJHzZGPqugSijfbtRnU8pugEwAA6MuP3 NLvIO1aGI8QoF+my44S0S9GzgNuga/PmNGLSX3KiBUelkt0oqWuHcaWMZueXwgUpvX3Z pFDwWQsA/beh+YuCEZTVA2Xx7OmmK3mdXX8vCnNbdjf0i1aPt1eBjdEPHsWdCJ6E6kQO seXa+/xJZoqYYRWRA4IyiXyDfduQxOnj9GKPXG5vJxMTVhVge2Y0jQ1Q81wV3cDhP92z EBM4ubYALMxZZvq27r3746qkeeFs6rCHqCBEmgtHZPTlwnZ6EXhK4JY40WJ7SRCIVT2j Kmdg== X-Received: by 10.43.0.67 with SMTP id nl3mr36820529icb.59.1436229021071; Mon, 06 Jul 2015 17:30:21 -0700 (PDT) Received: from dtor-ws.mtv.corp.google.com ([172.22.64.149]) by mx.google.com with ESMTPSA id kl8sm10772195igb.15.2015.07.06.17.30.19 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 06 Jul 2015 17:30:20 -0700 (PDT) From: Dmitry Torokhov To: linux-input@vger.kernel.org, Roger Quadros Cc: Jianchun Bian , linux-kernel@vger.kernel.org Subject: [PATCH 2/6] Input: pixcir_i2c_ts - switch the device over to gpiod Date: Mon, 6 Jul 2015 17:30:07 -0700 Message-Id: <1436229011-29655-2-git-send-email-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.4.3.573.g4eafbef In-Reply-To: <1436229011-29655-1-git-send-email-dmitry.torokhov@gmail.com> References: <1436229011-29655-1-git-send-email-dmitry.torokhov@gmail.com> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This allows uniform parsing on legacy, DT and ACPI systems. Signed-off-by: Dmitry Torokhov Acked-by: Roger Quadros --- drivers/input/touchscreen/pixcir_i2c_ts.c | 26 +++++++++----------------- include/linux/platform_data/pixcir_i2c_ts.h | 1 - 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/drivers/input/touchscreen/pixcir_i2c_ts.c b/drivers/input/touchscreen/pixcir_i2c_ts.c index ccafa75..9093aa9 100644 --- a/drivers/input/touchscreen/pixcir_i2c_ts.c +++ b/drivers/input/touchscreen/pixcir_i2c_ts.c @@ -25,8 +25,8 @@ #include #include #include +#include #include -#include #include #include @@ -35,6 +35,7 @@ struct pixcir_i2c_ts_data { struct i2c_client *client; struct input_dev *input; + struct gpio_desc *gpio_attb; const struct pixcir_ts_platform_data *pdata; bool running; int max_fingers; /* Max fingers supported in this instance */ @@ -161,7 +162,6 @@ static void pixcir_ts_report(struct pixcir_i2c_ts_data *ts, static irqreturn_t pixcir_ts_isr(int irq, void *dev_id) { struct pixcir_i2c_ts_data *tsdata = dev_id; - const struct pixcir_ts_platform_data *pdata = tsdata->pdata; struct pixcir_report_data report; while (tsdata->running) { @@ -171,7 +171,7 @@ static irqreturn_t pixcir_ts_isr(int irq, void *dev_id) /* report it */ pixcir_ts_report(tsdata, &report); - if (gpio_get_value(pdata->gpio_attb)) { + if (gpiod_get_value(tsdata->gpio_attb)) { if (report.num_touches) { /* * Last report with no finger up? @@ -427,9 +427,6 @@ static struct pixcir_ts_platform_data *pixcir_parse_dt(struct device *dev) pdata->chip = *(const struct pixcir_i2c_chip_data *)match->data; - pdata->gpio_attb = of_get_named_gpio(np, "attb-gpio", 0); - /* gpio_attb validity is checked in probe */ - if (of_property_read_u32(np, "touchscreen-size-x", &pdata->x_max)) { dev_err(dev, "Failed to get touchscreen-size-x property\n"); return ERR_PTR(-EINVAL); @@ -442,8 +439,8 @@ static struct pixcir_ts_platform_data *pixcir_parse_dt(struct device *dev) } pdata->y_max -= 1; - dev_dbg(dev, "%s: x %d, y %d, gpio %d\n", __func__, - pdata->x_max + 1, pdata->y_max + 1, pdata->gpio_attb); + dev_dbg(dev, "%s: x %d, y %d\n", __func__, + pdata->x_max + 1, pdata->y_max + 1); return pdata; } @@ -476,11 +473,6 @@ static int pixcir_i2c_ts_probe(struct i2c_client *client, return -EINVAL; } - if (!gpio_is_valid(pdata->gpio_attb)) { - dev_err(dev, "Invalid gpio_attb in pdata\n"); - return -EINVAL; - } - if (!pdata->chip.max_fingers) { dev_err(dev, "Invalid max_fingers in pdata\n"); return -EINVAL; @@ -530,10 +522,10 @@ static int pixcir_i2c_ts_probe(struct i2c_client *client, input_set_drvdata(input, tsdata); - error = devm_gpio_request_one(dev, pdata->gpio_attb, - GPIOF_DIR_IN, "pixcir_i2c_attb"); - if (error) { - dev_err(dev, "Failed to request ATTB gpio\n"); + tsdata->gpio_attb = devm_gpiod_get(dev, "attb", GPIOD_IN); + if (IS_ERR(tsdata->gpio_attb)) { + error = PTR_ERR(tsdata->gpio_attb); + dev_err(dev, "Failed to request ATTB gpio: %d\n", error); return error; } diff --git a/include/linux/platform_data/pixcir_i2c_ts.h b/include/linux/platform_data/pixcir_i2c_ts.h index 7bae83b..646af6f 100644 --- a/include/linux/platform_data/pixcir_i2c_ts.h +++ b/include/linux/platform_data/pixcir_i2c_ts.h @@ -57,7 +57,6 @@ struct pixcir_i2c_chip_data { struct pixcir_ts_platform_data { int x_max; int y_max; - int gpio_attb; /* GPIO connected to ATTB line */ struct pixcir_i2c_chip_data chip; };