From patchwork Tue May 24 14:24:47 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tarun Kanti DebBarma X-Patchwork-Id: 812192 Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p4OERi2D012483 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 24 May 2011 14:28:06 GMT Received: from canuck.infradead.org ([2001:4978:20e::1]) by bombadil.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QOsYm-0003DM-AM; Tue, 24 May 2011 14:26:12 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QOsYk-0000C0-JD; Tue, 24 May 2011 14:26:10 +0000 Received: from bear.ext.ti.com ([192.94.94.41]) by canuck.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QOsXk-00006M-FJ for linux-arm-kernel@lists.infradead.org; Tue, 24 May 2011 14:25:13 +0000 Received: from dbdp20.itg.ti.com ([172.24.170.38]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id p4OEP44k000741 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 24 May 2011 09:25:06 -0500 Received: from dbde70.ent.ti.com (localhost [127.0.0.1]) by dbdp20.itg.ti.com (8.13.8/8.13.8) with ESMTP id p4OEOwxD028450; Tue, 24 May 2011 19:55:00 +0530 (IST) Received: from dbdp31.itg.ti.com (172.24.170.98) by DBDE70.ent.ti.com (172.24.170.148) with Microsoft SMTP Server id 8.3.106.1; Tue, 24 May 2011 19:54:59 +0530 Received: from localhost.localdomain ([172.24.190.106]) by dbdp31.itg.ti.com (8.13.8/8.13.8) with ESMTP id p4OEOsqD004036; Tue, 24 May 2011 19:54:59 +0530 (IST) From: Tarun Kanti DebBarma To: Subject: [PATCH 08/15] OMAP2+: GPIO: make workaround_enabled bank specific Date: Tue, 24 May 2011 19:54:47 +0530 Message-ID: <1306247094-25372-9-git-send-email-tarun.kanti@ti.com> X-Mailer: git-send-email 1.6.0.4 In-Reply-To: <1306247094-25372-1-git-send-email-tarun.kanti@ti.com> References: <1306247094-25372-1-git-send-email-tarun.kanti@ti.com> MIME-Version: 1.0 X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110524_102509_237308_B5D4C442 X-CRM114-Status: GOOD ( 13.75 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [192.94.94.41 listed in list.dnswl.org] -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain Cc: khilman@ti.com, tony@atomide.com, santosh.shilimkar@ti.com, linux-arm-kernel@lists.infradead.org, Charulatha V X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.12 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 X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Tue, 24 May 2011 14:28:06 +0000 (UTC) From: Charulatha V Make workaround_enabled flag bank-specific instead of using a single flag for all the banks together. This would be helpful while making use of runtime framework in OMAP GPIO driver which would make the driver handle each GPIO bank independently. Also rename workaround_enabled flag to off_mode_wkup_wa_enabled Signed-off-by: Charulatha V --- drivers/gpio/gpio_omap.c | 15 +++++---------- 1 files changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/gpio/gpio_omap.c b/drivers/gpio/gpio_omap.c index bc02ec5..fcc60be 100644 --- a/drivers/gpio/gpio_omap.c +++ b/drivers/gpio/gpio_omap.c @@ -72,6 +72,7 @@ struct gpio_bank { struct device *dev; bool dbck_flag; bool loses_context; + bool off_mode_wkup_wa_enabled; int stride; u32 width; u32 ctx_lost_cnt_before; @@ -1077,6 +1078,7 @@ static void __init omap_gpio_chip_init(struct gpio_bank *bank) static int gpio; bank->mod_usage = 0; + bank->off_mode_wkup_wa_enabled = false; /* * REVISIT eventually switch from OMAP-specific gpio structs * over to the generic ones @@ -1316,11 +1318,8 @@ static struct sys_device omap_gpio_device = { static void omap_gpio_save_context(struct gpio_bank *bank); static void omap_gpio_restore_context(struct gpio_bank *bank); -static int workaround_enabled; - void omap2_gpio_prepare_for_idle(int off_mode) { - int c = 0; struct gpio_bank *bank; list_for_each_entry(bank, &omap_gpio_list, node) { @@ -1378,7 +1377,7 @@ void omap2_gpio_prepare_for_idle(int off_mode) __raw_writel(l2, bank->base + OMAP4_GPIO_RISINGDETECT); } - c++; + bank->off_mode_wkup_wa_enabled = true; save_gpio_ctx: pdev = to_platform_device(bank->dev); @@ -1386,11 +1385,6 @@ save_gpio_ctx: omap_device_get_context_loss_count(pdev); omap_gpio_save_context(bank); } - if (!c) { - workaround_enabled = 0; - return; - } - workaround_enabled = 1; } void omap2_gpio_resume_after_idle(void) @@ -1415,7 +1409,7 @@ void omap2_gpio_resume_after_idle(void) if (ctx_lost_cnt_after == bank->ctx_lost_cnt_before) continue; - if (!workaround_enabled) + if (!bank->off_mode_wkup_wa_enabled) goto restore_gpio_ctx; if (!(bank->enabled_non_wakeup_gpios)) @@ -1495,6 +1489,7 @@ void omap2_gpio_resume_after_idle(void) } restore_gpio_ctx: + bank->off_mode_wkup_wa_enabled = false; omap_gpio_restore_context(bank); }