From patchwork Mon Apr 23 09:14:08 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 8025 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id CFFEA23E23 for ; Mon, 23 Apr 2012 09:14:33 +0000 (UTC) Received: from mail-iy0-f180.google.com (mail-iy0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 9893EA1835A for ; Mon, 23 Apr 2012 09:14:33 +0000 (UTC) Received: by mail-iy0-f180.google.com with SMTP id e36so22452743iag.11 for ; Mon, 23 Apr 2012 02:14:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:mime-version:content-type :x-gm-message-state; bh=3yO7a9yQTakpJOo/8N+ilnCX6K0n+dgiMZPIIZvDtO4=; b=U8MAA3kUfztY92AMJAn6YE8pOSSLYIw8SHgAlEIIMFaMv+Xx3NsJfuRc8lY/aWWsk6 cqs5YNX4UxS0vUwepyz33pvrD87vBMFmlXCxj9Nt14NBzPfBiLLuiInEKrqhSJJNV1vs 9xDt43ACZOT4Lwi51seVr9oN/9lI+3OmUlKlglVfAS+3l1TolNqd1SFpbMrkCsnQCPw3 rRdevsEH+mwmhhXl7m4gHqav5rYKyQ73bYNTvOofXnbuVBhIv/EKYXNnPSYlAKLXne3w C8TjifEv+CJmhC9CcYSv5wRuYbeXGpVMxnpvk46/ARxZIxAb5MvYi/nP1PLlXQpF8gyI v3DQ== Received: by 10.43.49.201 with SMTP id vb9mr1062290icb.35.1335172473381; Mon, 23 Apr 2012 02:14:33 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.137.198 with SMTP id x6csp97912ibt; Mon, 23 Apr 2012 02:14:32 -0700 (PDT) Received: by 10.213.21.23 with SMTP id h23mr1157791ebb.94.1335172471764; Mon, 23 Apr 2012 02:14:31 -0700 (PDT) Received: from eu1sys200aog114.obsmtp.com (eu1sys200aog114.obsmtp.com. [207.126.144.137]) by mx.google.com with SMTP id m53si4190706eef.166.2012.04.23.02.14.27 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 23 Apr 2012 02:14:31 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.137 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) client-ip=207.126.144.137; Authentication-Results: mx.google.com; spf=neutral (google.com: 207.126.144.137 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) smtp.mail=linus.walleij@stericsson.com Received: from beta.dmz-eu.st.com ([164.129.1.35]) (using TLSv1) by eu1sys200aob114.postini.com ([207.126.147.11]) with SMTP ID DSNKT5Udcz7ZO0HKcwSlrnphc3ibQTqId7na@postini.com; Mon, 23 Apr 2012 09:14:31 UTC Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 4EB001B0; Mon, 23 Apr 2012 09:14:12 +0000 (GMT) Received: from relay1.stm.gmessaging.net (unknown [10.230.100.17]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id A09B424FB; Mon, 23 Apr 2012 09:14:11 +0000 (GMT) Received: from exdcvycastm003.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm003", Issuer "exdcvycastm003" (not verified)) by relay1.stm.gmessaging.net (Postfix) with ESMTPS id 2B6F024C07C; Mon, 23 Apr 2012 11:14:06 +0200 (CEST) Received: from steludxu4075.lud.stericsson.com (10.230.100.153) by smtp.stericsson.com (10.230.100.1) with Microsoft SMTP Server (TLS) id 8.3.83.0; Mon, 23 Apr 2012 11:14:10 +0200 From: Linus Walleij To: , Cc: Grant Likely , Philippe LANGLAIS , Rabin Vincent , Jonas Aberg , Lee Jones , Linus Walleij Subject: [PATCH 1/9] gpio/nomadik: don't set SLPM to 1 for non-wakeup pins Date: Mon, 23 Apr 2012 11:14:08 +0200 Message-ID: <1335172448-27506-1-git-send-email-linus.walleij@stericsson.com> X-Mailer: git-send-email 1.7.9.2 MIME-Version: 1.0 X-Gm-Message-State: ALoCoQkSeUpSdY6vv1xEB+DCrAGjcNWrcQ3GftMA7i4iNnhy36Nbt2NfRqkx+rZj61pf5DWgRNii From: Rabin Vincent Setting GPIOs' SLPM value to 1 (WAKEUP_DISABLE) is seen to cause increased power consumption in sleep/deep-sleep. So remove the code which disables SLPM based on the wakeup settings and only ensure it is on as needed. Signed-off-by: Rabin Vincent Reviewed-by: Srinidhi Kasagar Signed-off-by: Linus Walleij --- drivers/gpio/gpio-nomadik.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/drivers/gpio/gpio-nomadik.c b/drivers/gpio/gpio-nomadik.c index 839624f..f1ebd05 100644 --- a/drivers/gpio/gpio-nomadik.c +++ b/drivers/gpio/gpio-nomadik.c @@ -58,7 +58,6 @@ struct nmk_gpio_chip { u32 real_wake; u32 rwimsc; u32 fwimsc; - u32 slpm; u32 pull_up; }; @@ -583,10 +582,14 @@ static void __nmk_gpio_irq_modify(struct nmk_gpio_chip *nmk_chip, static void __nmk_gpio_set_wake(struct nmk_gpio_chip *nmk_chip, int gpio, bool on) { - if (nmk_chip->sleepmode) { + /* + * Ensure WAKEUP_ENABLE is on. No need to disable it if wakeup is + * disabled, since setting SLPM to 1 increases power consumption, and + * wakeup is anyhow controlled by the RIMSC and FIMSC registers. + */ + if (nmk_chip->sleepmode && on) { __nmk_gpio_set_slpm(nmk_chip, gpio - nmk_chip->chip.base, - on ? NMK_GPIO_SLPM_WAKEUP_ENABLE - : NMK_GPIO_SLPM_WAKEUP_DISABLE); + NMK_GPIO_SLPM_WAKEUP_ENABLE); } __nmk_gpio_irq_modify(nmk_chip, gpio, WAKE, on); @@ -1016,13 +1019,6 @@ void nmk_gpio_wakeups_suspend(void) writel(chip->fwimsc & chip->real_wake, chip->addr + NMK_GPIO_FWIMSC); - if (chip->sleepmode) { - chip->slpm = readl(chip->addr + NMK_GPIO_SLPC); - - /* 0 -> wakeup enable */ - writel(~chip->real_wake, chip->addr + NMK_GPIO_SLPC); - } - clk_disable(chip->clk); } } @@ -1042,9 +1038,6 @@ void nmk_gpio_wakeups_resume(void) writel(chip->rwimsc, chip->addr + NMK_GPIO_RWIMSC); writel(chip->fwimsc, chip->addr + NMK_GPIO_FWIMSC); - if (chip->sleepmode) - writel(chip->slpm, chip->addr + NMK_GPIO_SLPC); - clk_disable(chip->clk); } }