From patchwork Fri Oct 30 04:24:15 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 56559 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n9U4TFOK030510 for ; Fri, 30 Oct 2009 04:29:15 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752663AbZJ3E3J (ORCPT ); Fri, 30 Oct 2009 00:29:09 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752756AbZJ3E3J (ORCPT ); Fri, 30 Oct 2009 00:29:09 -0400 Received: from mail-yx0-f187.google.com ([209.85.210.187]:46526 "EHLO mail-yx0-f187.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752663AbZJ3E3I (ORCPT ); Fri, 30 Oct 2009 00:29:08 -0400 Received: by mail-yx0-f187.google.com with SMTP id 17so2380788yxe.33 for ; Thu, 29 Oct 2009 21:29:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:date:message-id :in-reply-to:references:subject; bh=lFeEkzV91Ho4lroCLYURxTIWf7doO3BombB7e5gNOkM=; b=g8ITqYoNuQFIxFVc7RsJxG71GNC4BDqKTA2sgMgbAJgch+DjT9FFbprPb1QJL/Bkl+ THs+wpVxA5LisJNCcRXRCFOrr8GVjmQ/uvbT5HyclvOSZm7ngo9L4pBsaKO2xNYYu9VC pbjnLzL0zm4ZDaCB1qylEwr8xB2wxRZUnNRBY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:date:message-id:in-reply-to:references:subject; b=kaxEPUxwducezYTUMWFyQGStPIB/qo4PqUeLDn11bzjpNpMisW3DkQs0cUySXjuDHu 8V0zMiLuTnSLOJNGqeL7rzcBaPZFOzRtsP4m8f2lZ+CuL/zpAtG6L5QWyedcwupapGY1 Ah5x1eMhXBh2npgdiYoBQnamC4JdRSqtaKMg4= Received: by 10.90.242.1 with SMTP id p1mr2697707agh.105.1256876953610; Thu, 29 Oct 2009 21:29:13 -0700 (PDT) Received: from rxone.opensource.se (49.14.32.202.bf.2iij.net [202.32.14.49]) by mx.google.com with ESMTPS id 7sm1209012yxd.62.2009.10.29.21.29.12 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 29 Oct 2009 21:29:13 -0700 (PDT) From: Magnus Damm To: linux-sh@vger.kernel.org Cc: Magnus Damm , lethal@linux-sh.org Date: Fri, 30 Oct 2009 13:24:15 +0900 Message-Id: <20091030042415.11783.76330.sendpatchset@rxone.opensource.se> In-Reply-To: <20091030042331.11783.88942.sendpatchset@rxone.opensource.se> References: <20091030042331.11783.88942.sendpatchset@rxone.opensource.se> Subject: [PATCH 05/09] sh: Keep track of allowed sleep modes Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org --- 0011/arch/sh/include/asm/suspend.h +++ work/arch/sh/include/asm/suspend.h 2009-10-28 19:16:48.000000000 +0900 @@ -49,6 +49,9 @@ struct sh_sleep_data { unsigned long sr; }; +/* a bitmap of supported sleep modes (SUSP_SH..) */ +extern unsigned long sh_mobile_sleep_supported; + #endif /* flags passed to assembly suspend code */ --- 0001/arch/sh/kernel/cpu/shmobile/cpuidle.c +++ work/arch/sh/kernel/cpu/shmobile/cpuidle.c 2009-10-28 19:22:28.000000000 +0900 @@ -87,25 +87,31 @@ void sh_mobile_setup_cpuidle(void) dev->safe_state = state; - state = &dev->states[i++]; - snprintf(state->name, CPUIDLE_NAME_LEN, "C1"); - strncpy(state->desc, "SuperH Sleep Mode [SF]", CPUIDLE_DESC_LEN); - state->exit_latency = 100; - state->target_residency = 1 * 2; - state->power_usage = 1; - state->flags = 0; - state->flags |= CPUIDLE_FLAG_TIME_VALID; - state->enter = cpuidle_sleep_enter; + if (sh_mobile_sleep_supported & SUSP_SH_SF) { + state = &dev->states[i++]; + snprintf(state->name, CPUIDLE_NAME_LEN, "C1"); + strncpy(state->desc, "SuperH Sleep Mode [SF]", + CPUIDLE_DESC_LEN); + state->exit_latency = 100; + state->target_residency = 1 * 2; + state->power_usage = 1; + state->flags = 0; + state->flags |= CPUIDLE_FLAG_TIME_VALID; + state->enter = cpuidle_sleep_enter; + } - state = &dev->states[i++]; - snprintf(state->name, CPUIDLE_NAME_LEN, "C2"); - strncpy(state->desc, "SuperH Mobile Standby Mode [SF]", CPUIDLE_DESC_LEN); - state->exit_latency = 2300; - state->target_residency = 1 * 2; - state->power_usage = 1; - state->flags = 0; - state->flags |= CPUIDLE_FLAG_TIME_VALID; - state->enter = cpuidle_sleep_enter; + if (sh_mobile_sleep_supported & SUSP_SH_STANDBY) { + state = &dev->states[i++]; + snprintf(state->name, CPUIDLE_NAME_LEN, "C2"); + strncpy(state->desc, "SuperH Mobile Standby Mode [SF]", + CPUIDLE_DESC_LEN); + state->exit_latency = 2300; + state->target_residency = 1 * 2; + state->power_usage = 1; + state->flags = 0; + state->flags |= CPUIDLE_FLAG_TIME_VALID; + state->enter = cpuidle_sleep_enter; + } dev->state_count = i; --- 0011/arch/sh/kernel/cpu/shmobile/pm.c +++ work/arch/sh/kernel/cpu/shmobile/pm.c 2009-10-28 19:18:57.000000000 +0900 @@ -70,6 +70,8 @@ extern const char sh_mobile_sleep_enter_ extern const char sh_mobile_sleep_resume_start; extern const char sh_mobile_sleep_resume_end; +unsigned long sh_mobile_sleep_supported = SUSP_SH_SLEEP; + void sh_mobile_register_self_refresh(unsigned long flags, void *pre_start, void *pre_end, void *post_start, void *post_end) @@ -105,10 +107,15 @@ void sh_mobile_register_self_refresh(uns vp = onchip_mem + 0x600; /* located at interrupt vector */ n = &sh_mobile_sleep_resume_end - &sh_mobile_sleep_resume_start; memcpy(vp, &sh_mobile_sleep_resume_start, n); + + sh_mobile_sleep_supported |= flags; } static int sh_pm_enter(suspend_state_t state) { + if (!(sh_mobile_sleep_supported & SUSP_MODE_STANDBY_SF)) + return -ENXIO; + local_irq_disable(); set_bl_bit(); sh_mobile_call_standby(SUSP_MODE_STANDBY_SF);