From patchwork Thu Oct 29 10:51:48 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 56445 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 n9TAue7d016657 for ; Thu, 29 Oct 2009 10:56:48 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752745AbZJ2K4m (ORCPT ); Thu, 29 Oct 2009 06:56:42 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752319AbZJ2K4m (ORCPT ); Thu, 29 Oct 2009 06:56:42 -0400 Received: from mail-yw0-f202.google.com ([209.85.211.202]:42645 "EHLO mail-yw0-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752745AbZJ2K4l (ORCPT ); Thu, 29 Oct 2009 06:56:41 -0400 Received: by mail-yw0-f202.google.com with SMTP id 40so1518287ywh.33 for ; Thu, 29 Oct 2009 03:56:47 -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=HAVQZnCVIRgY6/+frTiB9+HQ/dlsAi9bYBwXoERu5Ew=; b=gp8d8DzQ41EFqpaGPow5F37dmRf7s954N30XXFIaZ8x0W0MArxak/tA6JvpEtxGUFz HiwDxQZXe0GeBs8dOtc4w6Ne1Q3zWuhFuHzzHV0KfwPKzHIT9XFd1t+gE/aOj/ZjO3N4 l2QywCQH1faGn9pwgNsDTPI0oNxvxuLn0T518= 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=LnviR5quqeIjeCgu4pwjZJJxsB2hAVA6YEW/3/+3dS0f+SND7dVIlzVn16lu5q0vZm CJ61PybiIPtx7hZ1hofgQh+NNfRQyw6BA6iVZFn+4Qt++xmn9YBGAOdpyl9zOfnTyQDA jZgH3iJY5qS3uo72v5KVPlCaP6D0go6c3nfbE= Received: by 10.150.115.8 with SMTP id n8mr44357ybc.64.1256813807065; Thu, 29 Oct 2009 03:56:47 -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 6sm694524ywc.54.2009.10.29.03.56.45 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 29 Oct 2009 03:56:46 -0700 (PDT) From: Magnus Damm To: linux-sh@vger.kernel.org Cc: Magnus Damm , lethal@linux-sh.org Date: Thu, 29 Oct 2009 19:51:48 +0900 Message-Id: <20091029105148.29078.19112.sendpatchset@rxone.opensource.se> In-Reply-To: <20091029105131.29078.26418.sendpatchset@rxone.opensource.se> References: <20091029105131.29078.26418.sendpatchset@rxone.opensource.se> Subject: [PATCH 02/07] sh: Add notifiers chains for cpu/board code Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org --- 0001/arch/sh/include/asm/suspend.h +++ work/arch/sh/include/asm/suspend.h 2009-10-28 12:19:48.000000000 +0900 @@ -2,6 +2,7 @@ #define _ASM_SH_SUSPEND_H #ifndef __ASSEMBLY__ +#include static inline int arch_prepare_suspend(void) { return 0; } #include @@ -19,6 +20,16 @@ void sh_mobile_setup_cpuidle(void); static inline void sh_mobile_setup_cpuidle(void) {} #endif +/* notifier chains for pre/post sleep hooks */ +extern struct atomic_notifier_head sh_mobile_pre_sleep_notifier_list; +extern struct atomic_notifier_head sh_mobile_post_sleep_notifier_list; + +/* priority levels for notifiers */ +#define SH_MOBILE_SLEEP_BOARD 0 +#define SH_MOBILE_SLEEP_CPU 1 +#define SH_MOBILE_PRE(x) (x) +#define SH_MOBILE_POST(x) (-(x)) + #endif /* flags passed to assembly suspend code */ --- 0001/arch/sh/kernel/cpu/shmobile/pm.c +++ work/arch/sh/kernel/cpu/shmobile/pm.c 2009-10-28 12:18:47.000000000 +0900 @@ -17,6 +17,12 @@ #include /* + * Notifier lists for pre/post sleep notification + */ +ATOMIC_NOTIFIER_HEAD(sh_mobile_pre_sleep_notifier_list); +ATOMIC_NOTIFIER_HEAD(sh_mobile_post_sleep_notifier_list); + +/* * Sleep modes available on SuperH Mobile: * * Sleep mode is just plain "sleep" instruction @@ -44,8 +50,14 @@ void sh_mobile_call_standby(unsigned lon void *onchip_mem = (void *)ILRAM_BASE; void (*standby_onchip_mem)(unsigned long, unsigned long) = onchip_mem; + atomic_notifier_call_chain(&sh_mobile_pre_sleep_notifier_list, + mode, NULL); + /* Let assembly snippet in on-chip memory handle the rest */ standby_onchip_mem(mode, ILRAM_BASE); + + atomic_notifier_call_chain(&sh_mobile_post_sleep_notifier_list, + mode, NULL); } static int sh_pm_enter(suspend_state_t state)