From patchwork Wed Jul 15 12:13:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Reichel X-Patchwork-Id: 6797441 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id AAB47C05AC for ; Wed, 15 Jul 2015 12:14:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B6F842052F for ; Wed, 15 Jul 2015 12:14:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CD65020531 for ; Wed, 15 Jul 2015 12:14:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752232AbbGOMNy (ORCPT ); Wed, 15 Jul 2015 08:13:54 -0400 Received: from ring0.de ([5.45.105.125]:49104 "EHLO ring0.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752304AbbGOMNx (ORCPT ); Wed, 15 Jul 2015 08:13:53 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 From: Sebastian Reichel To: Dmitry Torokhov , linux-input@vger.kernel.org Cc: Michael Welling , Tony Lindgren , linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, Sebastian Reichel Subject: [PATCH 4/4] Input: tsc2005 - convert to gpiod Date: Wed, 15 Jul 2015 14:13:28 +0200 Message-Id: <1436962408-5206-5-git-send-email-sre@kernel.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1436962408-5206-1-git-send-email-sre@kernel.org> References: <1436962408-5206-1-git-send-email-sre@kernel.org> 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 Convert driver to descriptor based GPIO API. Also fix the after-probe reset GPIO state, so that the device is not kept in reset state. Signed-off-by: Sebastian Reichel --- drivers/input/touchscreen/tsc2005.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/drivers/input/touchscreen/tsc2005.c b/drivers/input/touchscreen/tsc2005.c index 83508d8..cb08dc8 100644 --- a/drivers/input/touchscreen/tsc2005.c +++ b/drivers/input/touchscreen/tsc2005.c @@ -30,11 +30,11 @@ #include #include #include -#include #include #include #include #include +#include /* * The touchscreen interface operates as follows: @@ -179,7 +179,7 @@ struct tsc2005 { struct regulator *vio; - int reset_gpio; + struct gpio_desc *reset_gpio; void (*set_reset)(bool enable); }; @@ -317,8 +317,8 @@ static void tsc2005_stop_scan(struct tsc2005 *ts) static void tsc2005_set_reset(struct tsc2005 *ts, bool enable) { - if (ts->reset_gpio >= 0) - gpio_set_value(ts->reset_gpio, enable); + if (ts->reset_gpio) + gpiod_set_value_cansleep(ts->reset_gpio, enable); else if (ts->set_reset) ts->set_reset(enable); } @@ -611,19 +611,11 @@ static int tsc2005_probe(struct spi_device *spi) ts->esd_timeout = esd_timeout; if (np) { - ts->reset_gpio = of_get_named_gpio(np, "reset-gpios", 0); - if (ts->reset_gpio == -EPROBE_DEFER) - return ts->reset_gpio; - if (ts->reset_gpio < 0) { + ts->reset_gpio = devm_gpiod_get(&spi->dev, "reset", + GPIOD_OUT_HIGH); + if (IS_ERR(ts->reset_gpio)) { + error = PTR_ERR(ts->reset_gpio); dev_err(&spi->dev, "error acquiring reset gpio: %d\n", - ts->reset_gpio); - return ts->reset_gpio; - } - - error = devm_gpio_request_one(&spi->dev, ts->reset_gpio, 0, - "reset-gpios"); - if (error) { - dev_err(&spi->dev, "error requesting reset gpio: %d\n", error); return error; } @@ -635,7 +627,6 @@ static int tsc2005_probe(struct spi_device *spi) return error; } } else { - ts->reset_gpio = -1; ts->set_reset = pdata->set_reset; }