From patchwork Thu Jul 26 19:30:49 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Hilman X-Patchwork-Id: 1244411 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 91671DFFCE for ; Thu, 26 Jul 2012 19:35:43 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1SuTmC-0001un-Az; Thu, 26 Jul 2012 19:31:12 +0000 Received: from na3sys009aog117.obsmtp.com ([74.125.149.242]) by merlin.infradead.org with smtps (Exim 4.76 #1 (Red Hat Linux)) id 1SuTlz-0001qb-R5 for linux-arm-kernel@lists.infradead.org; Thu, 26 Jul 2012 19:31:04 +0000 Received: from mail-pb0-f44.google.com ([209.85.160.44]) (using TLSv1) by na3sys009aob117.postini.com ([74.125.148.12]) with SMTP ID DSNKUBGa6p8wbmeWrNleXRE4q78hrP4QInAq@postini.com; Thu, 26 Jul 2012 12:30:59 PDT Received: by pbcwy7 with SMTP id wy7so3747502pbc.31 for ; Thu, 26 Jul 2012 12:30:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:organization:references:date:in-reply-to :message-id:user-agent:mime-version:content-type:x-gm-message-state; bh=vnvURF7KOI2N7t69pt7jT9UdQJ4upZWeA4FVQhqHfVg=; b=AZYKhcYWI2+5HinxV64TJIofBmQZpdAQNnXstShe2vGR0uOl3xxE7FuYMPvgCyb3ai UQTgFRXEAQjTKnThbmcOtinvYQlujwZexsJMnWAkGMewSMN3+1yTdTXBoHH7Vzd6Dqdb JowOq8U3jcvCi4oHC8vx8fieowasnImhmTD1AFeTmN8lOhOSzn2dG8RJbNllgT5bC+X6 8BsPEBodYeHaAR9CjiVrwBG6x6U0+BdUU/IA73BhJOhYyM867TKgUXJZ6GIlITrRSEiO FWkfBnZcV9cKCE/UZxWSxdv+GlkW507SrKEA9CE4tIIVNwAA1HrQGWhNBtYX1bfiGP+5 CAtA== Received: by 10.68.235.68 with SMTP id uk4mr6986846pbc.52.1343331050300; Thu, 26 Jul 2012 12:30:50 -0700 (PDT) Received: from localhost (c-24-19-7-36.hsd1.wa.comcast.net. [24.19.7.36]) by mx.google.com with ESMTPS id pa6sm268537pbc.47.2012.07.26.12.30.47 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 26 Jul 2012 12:30:49 -0700 (PDT) From: Kevin Hilman To: Igor Grinberg Subject: Re: [PATCH] ARM: OMAP2+: ads7846 init: fix fault caused by freeing pen-down GPIO Organization: Texas Instruments, Inc. References: <1342048700-15040-1-git-send-email-khilman@ti.com> <500D494D.8020606@compulab.co.il> <500D4F2A.9090706@compulab.co.il> Date: Thu, 26 Jul 2012 12:30:49 -0700 In-Reply-To: <500D4F2A.9090706@compulab.co.il> (Igor Grinberg's message of "Mon, 23 Jul 2012 16:18:34 +0300") Message-ID: <87zk6mpbfa.fsf@ti.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) MIME-Version: 1.0 X-Gm-Message-State: ALoCoQkDaur1a9vZWPn/A4N9TEpkgxI/O72V3dIQ4TSID7nqxpKahaCxoXqTTHC72Zj9DBCzfnxl X-Spam-Note: CRM114 invocation failed X-Spam-Note: SpamAssassin invocation failed Cc: Tony Lindgren , Zumeng Chen , linux-omap@vger.kernel.org, Arnd Bergmann , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org + Zumeng Chen Igor Grinberg writes: > Hi Kevin, > > I've just noticed that the patch has been modified by Arnd in a way > that of course will trigger GPIO use without being requested. > I'm sorry, I was not available by that time Arnd changed the patch. Your right, your original patch isn't the problem. I found the root cause. The real problem is actually introduced by the merge of your patch from the arm-soc/cleanup branch, and this one from Zumeng Chen: commit 16aced80f6 (ARM: OMAP3530evm: set pendown_state and debounce time for ads7846) from the arm-soc/boards branch. However, looking closer at the one from Zumeng, that one is clearly not right. It unconditionally adds a *board-specific* ->get_pendown_state function to the pdata that is common to *all* boards. That's just wrong and has the side-effect of making ->get_pendown_state() wrong on every board except the OMAP3EVM. Oops. So, IMO, in addition to $SUBJECT patch, in order to get the touchscreen GPIO working on non OMAP3EVM boards, we also need something like this as well. Igor, Zumeng, could you try this out on your boards anc confirm if it's working? I currently don't have a board setup with a touchscreen in my board farm. Kevin From 85516c6a3354967caf4cff434d28c3001cd411eb Mon Sep 17 00:00:00 2001 From: Kevin Hilman Date: Thu, 26 Jul 2012 12:15:38 -0700 Subject: [PATCH 2/2] ARM: OMAP2+: ads7846: fix ->get_pendown_state() to work on all boards commit 16aced80f6 (ARM: OMAP3530evm: set pendown_state and debounce time for ads7846) introduced a common ->get_pendown_state() function into the generic code, but that function was board-specific for the OMAP3EVM. Fix this up to work for all boards that pass in a pendown GPIO. Cc: Zumeng Chen Cc: Igor Grinberg Signed-off-by: Kevin Hilman Tested-by: Igor Grinberg --- arch/arm/mach-omap2/board-omap3evm.c | 1 + arch/arm/mach-omap2/common-board-devices.c | 4 +++- arch/arm/mach-omap2/common-board-devices.h | 1 - 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c index ef230a0..0d362e9 100644 --- a/arch/arm/mach-omap2/board-omap3evm.c +++ b/arch/arm/mach-omap2/board-omap3evm.c @@ -58,6 +58,7 @@ #include "hsmmc.h" #include "common-board-devices.h" +#define OMAP3_EVM_TS_GPIO 175 #define OMAP3_EVM_EHCI_VBUS 22 #define OMAP3_EVM_EHCI_SELECT 61 diff --git a/arch/arm/mach-omap2/common-board-devices.c b/arch/arm/mach-omap2/common-board-devices.c index 0fee95f..06f176f 100644 --- a/arch/arm/mach-omap2/common-board-devices.c +++ b/arch/arm/mach-omap2/common-board-devices.c @@ -40,9 +40,10 @@ static struct omap2_mcspi_device_config ads7846_mcspi_config = { * of pdata->get_pendown_state, but we have done this. So set * get_pendown_state to avoid twice gpio requesting. */ +static int omap3_gpio_pendown; static int omap3_get_pendown_state(void) { - return !gpio_get_value(OMAP3_EVM_TS_GPIO); + return !gpio_get_value(omap3_gpio_pendown); } static struct ads7846_platform_data ads7846_config = { @@ -74,6 +75,7 @@ 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; + omap3_gpio_pendown = gpio_pendown; err = gpio_request_one(gpio_pendown, GPIOF_IN, "TSPenDown"); if (err) { pr_err("Couldn't obtain gpio for TSPenDown: %d\n", err); diff --git a/arch/arm/mach-omap2/common-board-devices.h b/arch/arm/mach-omap2/common-board-devices.h index 4c4ef6a..a0b4a428 100644 --- a/arch/arm/mach-omap2/common-board-devices.h +++ b/arch/arm/mach-omap2/common-board-devices.h @@ -4,7 +4,6 @@ #include "twl-common.h" #define NAND_BLOCK_SIZE SZ_128K -#define OMAP3_EVM_TS_GPIO 175 struct mtd_partition; struct ads7846_platform_data;