From patchwork Wed May 4 15:04:55 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Grinberg X-Patchwork-Id: 754022 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p44F57OT020987 for ; Wed, 4 May 2011 15:05:07 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754529Ab1EDPFA (ORCPT ); Wed, 4 May 2011 11:05:00 -0400 Received: from 50.23.254.54-static.reverse.softlayer.com ([50.23.254.54]:33769 "EHLO softlayer.compulab.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754440Ab1EDPE7 (ORCPT ); Wed, 4 May 2011 11:04:59 -0400 Received: from [62.90.235.247] (port=53620 helo=zimbra-mta.compulab.co.il) by softlayer.compulab.co.il with esmtp (Exim 4.69) (envelope-from ) id 1QHddK-0008RD-Aj; Wed, 04 May 2011 18:04:58 +0300 Received: from localhost (localhost.localdomain [127.0.0.1]) by zimbra-mta.compulab.co.il (Postfix) with ESMTP id B416B7E9C5B; Wed, 4 May 2011 18:04:57 +0300 (IDT) X-Virus-Scanned: amavisd-new at compulab.co.il Received: from zimbra-mta.compulab.co.il ([127.0.0.1]) by localhost (zimbra-mta.compulab.co.il [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gPe4K1edRrB3; Wed, 4 May 2011 18:04:57 +0300 (IDT) Received: from grinberg-linux (grinberg-pc.compulab.local [10.1.1.13]) by zimbra-mta.compulab.co.il (Postfix) with SMTP id 213C27E9C50; Wed, 4 May 2011 18:04:56 +0300 (IDT) Received: by grinberg-linux (sSMTP sendmail emulation); Wed, 04 May 2011 18:04:58 +0300 From: Igor Grinberg To: Tony Lindgren Cc: Mike Rapoport , linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Igor Grinberg Subject: [PATCH] arm: omap2plus: fix ads7846 pendown gpio request Date: Wed, 4 May 2011 18:04:55 +0300 Message-Id: <1304521495-20578-1-git-send-email-grinberg@compulab.co.il> X-Mailer: git-send-email 1.7.3.4 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - softlayer.compulab.co.il X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - compulab.co.il Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Wed, 04 May 2011 15:05:07 +0000 (UTC) introduced by: 96974a24 (omap: consolidate touch screen initialization among different boards) ads7846 driver can use either gpio_pendown or get_pendown_state() callback. In case of gpio_pendown, it requests the provided gpio_pendown thus resulting in double requesting that gpio: ads7846 spi1.0: failed to request pendown GPIO57 ads7846: probe of spi1.0 failed with error -16 Fix this by restricting the gpio request to the case of get_pendown_state() callback is used. Signed-off-by: Igor Grinberg Tested-by: Thomas Weber --- arch/arm/mach-omap2/common-board-devices.c | 20 ++++++++++---------- 1 files changed, 10 insertions(+), 10 deletions(-) diff --git a/arch/arm/mach-omap2/common-board-devices.c b/arch/arm/mach-omap2/common-board-devices.c index d57c71d..61fee80 100644 --- a/arch/arm/mach-omap2/common-board-devices.c +++ b/arch/arm/mach-omap2/common-board-devices.c @@ -83,17 +83,17 @@ void __init omap_ads7846_init(int bus_num, int gpio_pendown, int gpio_debounce, struct spi_board_info *spi_bi = &ads7846_spi_board_info; int err; - err = gpio_request(gpio_pendown, "TS PenDown"); - if (err) { - pr_err("Could not obtain gpio for TS PenDown: %d\n", err); - return; - } - - gpio_direction_input(gpio_pendown); - gpio_export(gpio_pendown, 0); + if (board_pdata && board_pdata->get_pendown_state) { + err = gpio_request_one(gpio_pendown, GPIOF_IN, "TSPenDown"); + if (err) { + pr_err("Couldn't obtain gpio for TSPenDown: %d\n", err); + return; + } + gpio_export(gpio_pendown, 0); - if (gpio_debounce) - gpio_set_debounce(gpio_pendown, gpio_debounce); + if (gpio_debounce) + gpio_set_debounce(gpio_pendown, gpio_debounce); + } ads7846_config.gpio_pendown = gpio_pendown;