diff for duplicates of <4E704D7B.40103@ti.com> diff --git a/a/1.txt b/N1/1.txt index 38ab42d..bdb5f02 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -1,4 +1,4 @@ -(CC'ing linux-arch@vger.kernel.org with some explanation +(CC'ing linux-arch at vger.kernel.org with some explanation as per Andrew's suggestion. The intention of CC'ing linux-arch is to check if there is any other architecture apart from ARM would benefit from these notifiers) @@ -8,8 +8,8 @@ Subject: Re: [PATCH v2 1/5] cpu_pm: Add cpu power management notifiers Date: Mon, 12 Sep 2011 10:32:07 +0530 From: Santosh <santosh.shilimkar@ti.com> To: Andrew Morton <akpm@linux-foundation.org> -CC: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, - linux@arm.linux.org.uk, ccross@android.com, rjw@sisk.pl, khilman@ti.com +CC: linux-arm-kernel at lists.infradead.org, linux-kernel at vger.kernel.org, + linux at arm.linux.org.uk, ccross at android.com, rjw at sisk.pl, khilman at ti.com On Saturday 10 September 2011 03:01 PM, Santosh wrote: > Andrew, diff --git a/a/2.hdr b/a/2.hdr deleted file mode 100644 index 24d75fb..0000000 --- a/a/2.hdr +++ /dev/null @@ -1,5 +0,0 @@ -Content-Type: text/x-patch; - name="0001-cpu_pm-Add-cpu-power-management-notifiers.patch" -Content-Transfer-Encoding: 7bit -Content-Disposition: attachment; - filename*0="0001-cpu_pm-Add-cpu-power-management-notifiers.patch" diff --git a/a/2.txt b/a/2.txt deleted file mode 100644 index f0898ab..0000000 --- a/a/2.txt +++ /dev/null @@ -1,377 +0,0 @@ -From 6a0ef5d42da459d9eba0a5f396e6d9a95d3f94ff Mon Sep 17 00:00:00 2001 -From: Colin Cross <ccross@android.com> -Date: Thu, 10 Feb 2011 02:04:45 -0800 -Subject: [PATCH 1/5] cpu_pm: Add cpu power management notifiers - -During some CPU power modes entered during idle, hotplug and -suspend, peripherals located in the CPU power domain, such as -the GIC, localtimers, and VFP, may be powered down. Add a -notifier chain that allows drivers for those peripherals to -be notified before and after they may be reset. - -Notified drivers can include VFP co-processor, interrupt controller -and it's PM extensions, local CPU timers context save/restore which -shouldn't be interrupted. Hence CPU PM event APIs must be called -with interrupts disabled. - -Signed-off-by: Colin Cross <ccross@android.com> -Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com> -Reviewed-by: Kevin Hilman <khilman@ti.com> -Tested-and-Acked-by: Shawn Guo <shawn.guo@linaro.org> -Tested-by: Kevin Hilman <khilman@ti.com> ---- - include/linux/cpu_pm.h | 109 ++++++++++++++++++++++++++ - kernel/Makefile | 1 + - kernel/cpu_pm.c | 200 ++++++++++++++++++++++++++++++++++++++++++++++++ - kernel/power/Kconfig | 4 + - 4 files changed, 314 insertions(+), 0 deletions(-) - create mode 100644 include/linux/cpu_pm.h - create mode 100644 kernel/cpu_pm.c - -diff --git a/include/linux/cpu_pm.h b/include/linux/cpu_pm.h -new file mode 100644 -index 0000000..455b233 ---- /dev/null -+++ b/include/linux/cpu_pm.h -@@ -0,0 +1,109 @@ -+/* -+ * Copyright (C) 2011 Google, Inc. -+ * -+ * Author: -+ * Colin Cross <ccross@android.com> -+ * -+ * This software is licensed under the terms of the GNU General Public -+ * License version 2, as published by the Free Software Foundation, and -+ * may be copied, distributed, and modified under those terms. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ */ -+ -+#ifndef _LINUX_CPU_PM_H -+#define _LINUX_CPU_PM_H -+ -+#include <linux/kernel.h> -+#include <linux/notifier.h> -+ -+/* -+ * When a CPU goes to a low power state that turns off power to the CPU's -+ * power domain, the contents of some blocks (floating point coprocessors, -+ * interrupt controllers, caches, timers) in the same power domain can -+ * be lost. The cpm_pm notifiers provide a method for platform idle, suspend, -+ * and hotplug implementations to notify the drivers for these blocks that -+ * they may be reset. -+ * -+ * All cpu_pm notifications must be called with interrupts disabled. -+ * -+ * The notifications are split into two classes: CPU notifications and CPU -+ * cluster notifications. -+ * -+ * CPU notifications apply to a single CPU and must be called on the affected -+ * CPU. They are used to save per-cpu context for affected blocks. -+ * -+ * CPU cluster notifications apply to all CPUs in a single power domain. They -+ * are used to save any global context for affected blocks, and must be called -+ * after all the CPUs in the power domain have been notified of the low power -+ * state. -+ */ -+ -+/* -+ * Event codes passed as unsigned long val to notifier calls -+ */ -+enum cpu_pm_event { -+ /* A single cpu is entering a low power state */ -+ CPU_PM_ENTER, -+ -+ /* A single cpu failed to enter a low power state */ -+ CPU_PM_ENTER_FAILED, -+ -+ /* A single cpu is exiting a low power state */ -+ CPU_PM_EXIT, -+ -+ /* A cpu power domain is entering a low power state */ -+ CPU_CLUSTER_PM_ENTER, -+ -+ /* A cpu power domain failed to enter a low power state */ -+ CPU_CLUSTER_PM_ENTER_FAILED, -+ -+ /* A cpu power domain is exiting a low power state */ -+ CPU_CLUSTER_PM_EXIT, -+}; -+ -+#ifdef CONFIG_CPU_PM -+int cpu_pm_register_notifier(struct notifier_block *nb); -+int cpu_pm_unregister_notifier(struct notifier_block *nb); -+int cpu_pm_enter(void); -+int cpu_pm_exit(void); -+int cpu_cluster_pm_enter(void); -+int cpu_cluster_pm_exit(void); -+ -+#else -+ -+static inline int cpu_pm_register_notifier(struct notifier_block *nb) -+{ -+ return 0; -+} -+ -+static inline int cpu_pm_unregister_notifier(struct notifier_block *nb) -+{ -+ return 0; -+} -+ -+static inline int cpu_pm_enter(void) -+{ -+ return 0; -+} -+ -+static inline int cpu_pm_exit(void) -+{ -+ return 0; -+} -+ -+static inline int cpu_cluster_pm_enter(void) -+{ -+ return 0; -+} -+ -+static inline int cpu_cluster_pm_exit(void) -+{ -+ return 0; -+} -+#endif -+#endif -diff --git a/kernel/Makefile b/kernel/Makefile -index eca595e..988cb3d 100644 ---- a/kernel/Makefile -+++ b/kernel/Makefile -@@ -101,6 +101,7 @@ obj-$(CONFIG_RING_BUFFER) += trace/ - obj-$(CONFIG_TRACEPOINTS) += trace/ - obj-$(CONFIG_SMP) += sched_cpupri.o - obj-$(CONFIG_IRQ_WORK) += irq_work.o -+obj-$(CONFIG_CPU_PM) += cpu_pm.o - - obj-$(CONFIG_PERF_EVENTS) += events/ - -diff --git a/kernel/cpu_pm.c b/kernel/cpu_pm.c -new file mode 100644 -index 0000000..4d1ff4a ---- /dev/null -+++ b/kernel/cpu_pm.c -@@ -0,0 +1,200 @@ -+/* -+ * Copyright (C) 2011 Google, Inc. -+ * -+ * Author: -+ * Colin Cross <ccross@android.com> -+ * -+ * This software is licensed under the terms of the GNU General Public -+ * License version 2, as published by the Free Software Foundation, and -+ * may be copied, distributed, and modified under those terms. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ */ -+ -+#include <linux/kernel.h> -+#include <linux/cpu_pm.h> -+#include <linux/module.h> -+#include <linux/notifier.h> -+#include <linux/spinlock.h> -+ -+static DEFINE_RWLOCK(cpu_pm_notifier_lock); -+static RAW_NOTIFIER_HEAD(cpu_pm_notifier_chain); -+ -+static int cpu_pm_notify(enum cpu_pm_event event, int nr_to_call, int *nr_calls) -+{ -+ int ret; -+ -+ ret = __raw_notifier_call_chain(&cpu_pm_notifier_chain, event, NULL, -+ nr_to_call, nr_calls); -+ -+ return notifier_to_errno(ret); -+} -+ -+/** -+ * cpu_pm_register_notifier - register a driver with cpu_pm -+ * @nb: notifier block to register -+ * -+ * Add a driver to a list of drivers that are notified about -+ * CPU and CPU cluster low power entry and exit. -+ * -+ * This function may sleep, and has the same return conditions as -+ * raw_notifier_chain_register. -+ */ -+int cpu_pm_register_notifier(struct notifier_block *nb) -+{ -+ unsigned long flags; -+ int ret; -+ -+ write_lock_irqsave(&cpu_pm_notifier_lock, flags); -+ ret = raw_notifier_chain_register(&cpu_pm_notifier_chain, nb); -+ write_unlock_irqrestore(&cpu_pm_notifier_lock, flags); -+ -+ return ret; -+} -+EXPORT_SYMBOL_GPL(cpu_pm_register_notifier); -+ -+/** -+ * cpu_pm_unregister_notifier - unregister a driver with cpu_pm -+ * @nb: notifier block to be unregistered -+ * -+ * Remove a driver from the CPU PM notifier list. -+ * -+ * This function may sleep, and has the same return conditions as -+ * raw_notifier_chain_unregister. -+ */ -+int cpu_pm_unregister_notifier(struct notifier_block *nb) -+{ -+ unsigned long flags; -+ int ret; -+ -+ write_lock_irqsave(&cpu_pm_notifier_lock, flags); -+ ret = raw_notifier_chain_unregister(&cpu_pm_notifier_chain, nb); -+ write_unlock_irqrestore(&cpu_pm_notifier_lock, flags); -+ -+ return ret; -+} -+EXPORT_SYMBOL_GPL(cpu_pm_unregister_notifier); -+ -+/** -+ * cpm_pm_enter - CPU low power entry notifier -+ * -+ * Notifies listeners that a single CPU is entering a low power state that may -+ * cause some blocks in the same power domain as the cpu to reset. -+ * -+ * Must be called on the affected CPU with interrupts disabled. Platform is -+ * responsible for ensuring that cpu_pm_enter is not called twice on the same -+ * CPU before cpu_pm_exit is called. Notified drivers can include VFP -+ * co-processor, interrupt controller and it's PM extensions, local CPU -+ * timers context save/restore which shouldn't be interrupted. Hence it -+ * must be called with interrupts disabled. -+ * -+ * Return conditions are same as __raw_notifier_call_chain. -+ */ -+int cpu_pm_enter(void) -+{ -+ int nr_calls; -+ int ret = 0; -+ -+ read_lock(&cpu_pm_notifier_lock); -+ ret = cpu_pm_notify(CPU_PM_ENTER, -1, &nr_calls); -+ if (ret) -+ /* -+ * Inform listeners (nr_calls - 1) about failure of CPU PM -+ * PM entry who are notified earlier to prepare for it. -+ */ -+ cpu_pm_notify(CPU_PM_ENTER_FAILED, nr_calls - 1, NULL); -+ read_unlock(&cpu_pm_notifier_lock); -+ -+ return ret; -+} -+EXPORT_SYMBOL_GPL(cpu_pm_enter); -+ -+/** -+ * cpm_pm_exit - CPU low power exit notifier -+ * -+ * Notifies listeners that a single CPU is exiting a low power state that may -+ * have caused some blocks in the same power domain as the cpu to reset. -+ * -+ * Notified drivers can include VFP co-processor, interrupt controller -+ * and it's PM extensions, local CPU timers context save/restore which -+ * shouldn't be interrupted. Hence it must be called with interrupts disabled. -+ * -+ * Return conditions are same as __raw_notifier_call_chain. -+ */ -+int cpu_pm_exit(void) -+{ -+ int ret; -+ -+ read_lock(&cpu_pm_notifier_lock); -+ ret = cpu_pm_notify(CPU_PM_EXIT, -1, NULL); -+ read_unlock(&cpu_pm_notifier_lock); -+ -+ return ret; -+} -+EXPORT_SYMBOL_GPL(cpu_pm_exit); -+ -+/** -+ * cpm_cluster_pm_enter - CPU cluster low power entry notifier -+ * -+ * Notifies listeners that all cpus in a power domain are entering a low power -+ * state that may cause some blocks in the same power domain to reset. -+ * -+ * Must be called after cpu_pm_enter has been called on all cpus in the power -+ * domain, and before cpu_pm_exit has been called on any cpu in the power -+ * domain. Notified drivers can include VFP co-processor, interrupt controller -+ * and it's PM extensions, local CPU timers context save/restore which -+ * shouldn't be interrupted. Hence it must be called with interrupts disabled. -+ * -+ * Must be called with interrupts disabled. -+ * -+ * Return conditions are same as __raw_notifier_call_chain. -+ */ -+int cpu_cluster_pm_enter(void) -+{ -+ int nr_calls; -+ int ret = 0; -+ -+ read_lock(&cpu_pm_notifier_lock); -+ ret = cpu_pm_notify(CPU_CLUSTER_PM_ENTER, -1, &nr_calls); -+ if (ret) -+ /* -+ * Inform listeners (nr_calls - 1) about failure of CPU cluster -+ * PM entry who are notified earlier to prepare for it. -+ */ -+ cpu_pm_notify(CPU_CLUSTER_PM_ENTER_FAILED, nr_calls - 1, NULL); -+ read_unlock(&cpu_pm_notifier_lock); -+ -+ return ret; -+} -+EXPORT_SYMBOL_GPL(cpu_cluster_pm_enter); -+ -+/** -+ * cpm_cluster_pm_exit - CPU cluster low power exit notifier -+ * -+ * Notifies listeners that all cpus in a power domain are exiting form a -+ * low power state that may have caused some blocks in the same power domain -+ * to reset. -+ * -+ * Must be called after cpu_pm_exit has been called on all cpus in the power -+ * domain, and before cpu_pm_exit has been called on any cpu in the power -+ * domain. Notified drivers can include VFP co-processor, interrupt controller -+ * and it's PM extensions, local CPU timers context save/restore which -+ * shouldn't be interrupted. Hence it must be called with interrupts disabled. -+ * -+ * Return conditions are same as __raw_notifier_call_chain. -+ */ -+int cpu_cluster_pm_exit(void) -+{ -+ int ret; -+ -+ read_lock(&cpu_pm_notifier_lock); -+ ret = cpu_pm_notify(CPU_CLUSTER_PM_EXIT, -1, NULL); -+ read_unlock(&cpu_pm_notifier_lock); -+ -+ return ret; -+} -+EXPORT_SYMBOL_GPL(cpu_cluster_pm_exit); -diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig -index 3744c59..80a8597 100644 ---- a/kernel/power/Kconfig -+++ b/kernel/power/Kconfig -@@ -235,3 +235,7 @@ config PM_GENERIC_DOMAINS - config PM_GENERIC_DOMAINS_RUNTIME - def_bool y - depends on PM_RUNTIME && PM_GENERIC_DOMAINS -+ -+config CPU_PM -+ bool -+ depends on SUSPEND || CPU_IDLE --- -1.7.4.1 diff --git a/a/content_digest b/N1/content_digest index 4646258..c819736 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -1,17 +1,10 @@ - "From\0Santosh <santosh.shilimkar@ti.com>\0" + "From\0santosh.shilimkar@ti.com (Santosh)\0" "Subject\0Fwd: Re: [PATCH v2 1/5] cpu_pm: Add cpu power management notifiers\0" "Date\0Wed, 14 Sep 2011 12:15:15 +0530\0" - "To\0Andrew Morton <akpm@linux-foundation.org>\0" - "Cc\0linux-arm-kernel@lists.infradead.org <linux-arm-kernel@lists.infradead.org>" - linux-kernel@vger.kernel.org - Russell King - ARM Linux <linux@arm.linux.org.uk> - Colin Cross <ccross@android.com> - Rafael J. Wysocki <rjw@sisk.pl> - khilman@ti.com <khilman@ti.com> - " linux-arch@vger.kernel.org\0" - "\01:1\0" + "To\0linux-arm-kernel@lists.infradead.org\0" + "\00:1\0" "b\0" - "(CC'ing linux-arch@vger.kernel.org with some explanation\n" + "(CC'ing linux-arch at vger.kernel.org with some explanation\n" "as per Andrew's suggestion. The intention of CC'ing linux-arch\n" "is to check if there is any other architecture apart from ARM\n" "would benefit from these notifiers)\n" @@ -21,8 +14,8 @@ "Date: Mon, 12 Sep 2011 10:32:07 +0530\n" "From: Santosh <santosh.shilimkar@ti.com>\n" "To: Andrew Morton <akpm@linux-foundation.org>\n" - "CC: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, \n" - " linux@arm.linux.org.uk, ccross@android.com, rjw@sisk.pl, khilman@ti.com\n" + "CC: linux-arm-kernel at lists.infradead.org, linux-kernel at vger.kernel.org, \n" + " linux at arm.linux.org.uk, ccross at android.com, rjw at sisk.pl, khilman at ti.com\n" "\n" "On Saturday 10 September 2011 03:01 PM, Santosh wrote:\n" "> Andrew,\n" @@ -454,385 +447,5 @@ "\n" "Regards\n" Santosh - "\01:2\0" - "fn\00001-cpu_pm-Add-cpu-power-management-notifiers.patch\0" - "b\0" - "From 6a0ef5d42da459d9eba0a5f396e6d9a95d3f94ff Mon Sep 17 00:00:00 2001\n" - "From: Colin Cross <ccross@android.com>\n" - "Date: Thu, 10 Feb 2011 02:04:45 -0800\n" - "Subject: [PATCH 1/5] cpu_pm: Add cpu power management notifiers\n" - "\n" - "During some CPU power modes entered during idle, hotplug and\n" - "suspend, peripherals located in the CPU power domain, such as\n" - "the GIC, localtimers, and VFP, may be powered down. Add a\n" - "notifier chain that allows drivers for those peripherals to\n" - "be notified before and after they may be reset.\n" - "\n" - "Notified drivers can include VFP co-processor, interrupt controller\n" - "and it's PM extensions, local CPU timers context save/restore which\n" - "shouldn't be interrupted. Hence CPU PM event APIs must be called\n" - "with interrupts disabled.\n" - "\n" - "Signed-off-by: Colin Cross <ccross@android.com>\n" - "Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>\n" - "Reviewed-by: Kevin Hilman <khilman@ti.com>\n" - "Tested-and-Acked-by: Shawn Guo <shawn.guo@linaro.org>\n" - "Tested-by: Kevin Hilman <khilman@ti.com>\n" - "---\n" - " include/linux/cpu_pm.h | 109 ++++++++++++++++++++++++++\n" - " kernel/Makefile | 1 +\n" - " kernel/cpu_pm.c | 200 ++++++++++++++++++++++++++++++++++++++++++++++++\n" - " kernel/power/Kconfig | 4 +\n" - " 4 files changed, 314 insertions(+), 0 deletions(-)\n" - " create mode 100644 include/linux/cpu_pm.h\n" - " create mode 100644 kernel/cpu_pm.c\n" - "\n" - "diff --git a/include/linux/cpu_pm.h b/include/linux/cpu_pm.h\n" - "new file mode 100644\n" - "index 0000000..455b233\n" - "--- /dev/null\n" - "+++ b/include/linux/cpu_pm.h\n" - "@@ -0,0 +1,109 @@\n" - "+/*\n" - "+ * Copyright (C) 2011 Google, Inc.\n" - "+ *\n" - "+ * Author:\n" - "+ *\tColin Cross <ccross@android.com>\n" - "+ *\n" - "+ * This software is licensed under the terms of the GNU General Public\n" - "+ * License version 2, as published by the Free Software Foundation, and\n" - "+ * may be copied, distributed, and modified under those terms.\n" - "+ *\n" - "+ * This program is distributed in the hope that it will be useful,\n" - "+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "+ * GNU General Public License for more details.\n" - "+ *\n" - "+ */\n" - "+\n" - "+#ifndef _LINUX_CPU_PM_H\n" - "+#define _LINUX_CPU_PM_H\n" - "+\n" - "+#include <linux/kernel.h>\n" - "+#include <linux/notifier.h>\n" - "+\n" - "+/*\n" - "+ * When a CPU goes to a low power state that turns off power to the CPU's\n" - "+ * power domain, the contents of some blocks (floating point coprocessors,\n" - "+ * interrupt controllers, caches, timers) in the same power domain can\n" - "+ * be lost. The cpm_pm notifiers provide a method for platform idle, suspend,\n" - "+ * and hotplug implementations to notify the drivers for these blocks that\n" - "+ * they may be reset.\n" - "+ *\n" - "+ * All cpu_pm notifications must be called with interrupts disabled.\n" - "+ *\n" - "+ * The notifications are split into two classes: CPU notifications and CPU\n" - "+ * cluster notifications.\n" - "+ *\n" - "+ * CPU notifications apply to a single CPU and must be called on the affected\n" - "+ * CPU. They are used to save per-cpu context for affected blocks.\n" - "+ *\n" - "+ * CPU cluster notifications apply to all CPUs in a single power domain. They\n" - "+ * are used to save any global context for affected blocks, and must be called\n" - "+ * after all the CPUs in the power domain have been notified of the low power\n" - "+ * state.\n" - "+ */\n" - "+\n" - "+/*\n" - "+ * Event codes passed as unsigned long val to notifier calls\n" - "+ */\n" - "+enum cpu_pm_event {\n" - "+\t/* A single cpu is entering a low power state */\n" - "+\tCPU_PM_ENTER,\n" - "+\n" - "+\t/* A single cpu failed to enter a low power state */\n" - "+\tCPU_PM_ENTER_FAILED,\n" - "+\n" - "+\t/* A single cpu is exiting a low power state */\n" - "+\tCPU_PM_EXIT,\n" - "+\n" - "+\t/* A cpu power domain is entering a low power state */\n" - "+\tCPU_CLUSTER_PM_ENTER,\n" - "+\n" - "+\t/* A cpu power domain failed to enter a low power state */\n" - "+\tCPU_CLUSTER_PM_ENTER_FAILED,\n" - "+\n" - "+\t/* A cpu power domain is exiting a low power state */\n" - "+\tCPU_CLUSTER_PM_EXIT,\n" - "+};\n" - "+\n" - "+#ifdef CONFIG_CPU_PM\n" - "+int cpu_pm_register_notifier(struct notifier_block *nb);\n" - "+int cpu_pm_unregister_notifier(struct notifier_block *nb);\n" - "+int cpu_pm_enter(void);\n" - "+int cpu_pm_exit(void);\n" - "+int cpu_cluster_pm_enter(void);\n" - "+int cpu_cluster_pm_exit(void);\n" - "+\n" - "+#else\n" - "+\n" - "+static inline int cpu_pm_register_notifier(struct notifier_block *nb)\n" - "+{\n" - "+\treturn 0;\n" - "+}\n" - "+\n" - "+static inline int cpu_pm_unregister_notifier(struct notifier_block *nb)\n" - "+{\n" - "+\treturn 0;\n" - "+}\n" - "+\n" - "+static inline int cpu_pm_enter(void)\n" - "+{\n" - "+\treturn 0;\n" - "+}\n" - "+\n" - "+static inline int cpu_pm_exit(void)\n" - "+{\n" - "+\treturn 0;\n" - "+}\n" - "+\n" - "+static inline int cpu_cluster_pm_enter(void)\n" - "+{\n" - "+\treturn 0;\n" - "+}\n" - "+\n" - "+static inline int cpu_cluster_pm_exit(void)\n" - "+{\n" - "+\treturn 0;\n" - "+}\n" - "+#endif\n" - "+#endif\n" - "diff --git a/kernel/Makefile b/kernel/Makefile\n" - "index eca595e..988cb3d 100644\n" - "--- a/kernel/Makefile\n" - "+++ b/kernel/Makefile\n" - "@@ -101,6 +101,7 @@ obj-$(CONFIG_RING_BUFFER) += trace/\n" - " obj-$(CONFIG_TRACEPOINTS) += trace/\n" - " obj-$(CONFIG_SMP) += sched_cpupri.o\n" - " obj-$(CONFIG_IRQ_WORK) += irq_work.o\n" - "+obj-$(CONFIG_CPU_PM) += cpu_pm.o\n" - " \n" - " obj-$(CONFIG_PERF_EVENTS) += events/\n" - " \n" - "diff --git a/kernel/cpu_pm.c b/kernel/cpu_pm.c\n" - "new file mode 100644\n" - "index 0000000..4d1ff4a\n" - "--- /dev/null\n" - "+++ b/kernel/cpu_pm.c\n" - "@@ -0,0 +1,200 @@\n" - "+/*\n" - "+ * Copyright (C) 2011 Google, Inc.\n" - "+ *\n" - "+ * Author:\n" - "+ *\tColin Cross <ccross@android.com>\n" - "+ *\n" - "+ * This software is licensed under the terms of the GNU General Public\n" - "+ * License version 2, as published by the Free Software Foundation, and\n" - "+ * may be copied, distributed, and modified under those terms.\n" - "+ *\n" - "+ * This program is distributed in the hope that it will be useful,\n" - "+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "+ * GNU General Public License for more details.\n" - "+ *\n" - "+ */\n" - "+\n" - "+#include <linux/kernel.h>\n" - "+#include <linux/cpu_pm.h>\n" - "+#include <linux/module.h>\n" - "+#include <linux/notifier.h>\n" - "+#include <linux/spinlock.h>\n" - "+\n" - "+static DEFINE_RWLOCK(cpu_pm_notifier_lock);\n" - "+static RAW_NOTIFIER_HEAD(cpu_pm_notifier_chain);\n" - "+\n" - "+static int cpu_pm_notify(enum cpu_pm_event event, int nr_to_call, int *nr_calls)\n" - "+{\n" - "+\tint ret;\n" - "+\n" - "+\tret = __raw_notifier_call_chain(&cpu_pm_notifier_chain, event, NULL,\n" - "+\t\tnr_to_call, nr_calls);\n" - "+\n" - "+\treturn notifier_to_errno(ret);\n" - "+}\n" - "+\n" - "+/**\n" - "+ * cpu_pm_register_notifier - register a driver with cpu_pm\n" - "+ * @nb: notifier block to register\n" - "+ *\n" - "+ * Add a driver to a list of drivers that are notified about\n" - "+ * CPU and CPU cluster low power entry and exit.\n" - "+ *\n" - "+ * This function may sleep, and has the same return conditions as\n" - "+ * raw_notifier_chain_register.\n" - "+ */\n" - "+int cpu_pm_register_notifier(struct notifier_block *nb)\n" - "+{\n" - "+\tunsigned long flags;\n" - "+\tint ret;\n" - "+\n" - "+\twrite_lock_irqsave(&cpu_pm_notifier_lock, flags);\n" - "+\tret = raw_notifier_chain_register(&cpu_pm_notifier_chain, nb);\n" - "+\twrite_unlock_irqrestore(&cpu_pm_notifier_lock, flags);\n" - "+\n" - "+\treturn ret;\n" - "+}\n" - "+EXPORT_SYMBOL_GPL(cpu_pm_register_notifier);\n" - "+\n" - "+/**\n" - "+ * cpu_pm_unregister_notifier - unregister a driver with cpu_pm\n" - "+ * @nb: notifier block to be unregistered\n" - "+ *\n" - "+ * Remove a driver from the CPU PM notifier list.\n" - "+ *\n" - "+ * This function may sleep, and has the same return conditions as\n" - "+ * raw_notifier_chain_unregister.\n" - "+ */\n" - "+int cpu_pm_unregister_notifier(struct notifier_block *nb)\n" - "+{\n" - "+\tunsigned long flags;\n" - "+\tint ret;\n" - "+\n" - "+\twrite_lock_irqsave(&cpu_pm_notifier_lock, flags);\n" - "+\tret = raw_notifier_chain_unregister(&cpu_pm_notifier_chain, nb);\n" - "+\twrite_unlock_irqrestore(&cpu_pm_notifier_lock, flags);\n" - "+\n" - "+\treturn ret;\n" - "+}\n" - "+EXPORT_SYMBOL_GPL(cpu_pm_unregister_notifier);\n" - "+\n" - "+/**\n" - "+ * cpm_pm_enter - CPU low power entry notifier\n" - "+ *\n" - "+ * Notifies listeners that a single CPU is entering a low power state that may\n" - "+ * cause some blocks in the same power domain as the cpu to reset.\n" - "+ *\n" - "+ * Must be called on the affected CPU with interrupts disabled. Platform is\n" - "+ * responsible for ensuring that cpu_pm_enter is not called twice on the same\n" - "+ * CPU before cpu_pm_exit is called. Notified drivers can include VFP\n" - "+ * co-processor, interrupt controller and it's PM extensions, local CPU\n" - "+ * timers context save/restore which shouldn't be interrupted. Hence it\n" - "+ * must be called with interrupts disabled.\n" - "+ *\n" - "+ * Return conditions are same as __raw_notifier_call_chain.\n" - "+ */\n" - "+int cpu_pm_enter(void)\n" - "+{\n" - "+\tint nr_calls;\n" - "+\tint ret = 0;\n" - "+\n" - "+\tread_lock(&cpu_pm_notifier_lock);\n" - "+\tret = cpu_pm_notify(CPU_PM_ENTER, -1, &nr_calls);\n" - "+\tif (ret)\n" - "+\t\t/*\n" - "+\t\t * Inform listeners (nr_calls - 1) about failure of CPU PM\n" - "+\t\t * PM entry who are notified earlier to prepare for it.\n" - "+\t\t */\n" - "+\t\tcpu_pm_notify(CPU_PM_ENTER_FAILED, nr_calls - 1, NULL);\n" - "+\tread_unlock(&cpu_pm_notifier_lock);\n" - "+\n" - "+\treturn ret;\n" - "+}\n" - "+EXPORT_SYMBOL_GPL(cpu_pm_enter);\n" - "+\n" - "+/**\n" - "+ * cpm_pm_exit - CPU low power exit notifier\n" - "+ *\n" - "+ * Notifies listeners that a single CPU is exiting a low power state that may\n" - "+ * have caused some blocks in the same power domain as the cpu to reset.\n" - "+ *\n" - "+ * Notified drivers can include VFP co-processor, interrupt controller\n" - "+ * and it's PM extensions, local CPU timers context save/restore which\n" - "+ * shouldn't be interrupted. Hence it must be called with interrupts disabled.\n" - "+ *\n" - "+ * Return conditions are same as __raw_notifier_call_chain.\n" - "+ */\n" - "+int cpu_pm_exit(void)\n" - "+{\n" - "+\tint ret;\n" - "+\n" - "+\tread_lock(&cpu_pm_notifier_lock);\n" - "+\tret = cpu_pm_notify(CPU_PM_EXIT, -1, NULL);\n" - "+\tread_unlock(&cpu_pm_notifier_lock);\n" - "+\n" - "+\treturn ret;\n" - "+}\n" - "+EXPORT_SYMBOL_GPL(cpu_pm_exit);\n" - "+\n" - "+/**\n" - "+ * cpm_cluster_pm_enter - CPU cluster low power entry notifier\n" - "+ *\n" - "+ * Notifies listeners that all cpus in a power domain are entering a low power\n" - "+ * state that may cause some blocks in the same power domain to reset.\n" - "+ *\n" - "+ * Must be called after cpu_pm_enter has been called on all cpus in the power\n" - "+ * domain, and before cpu_pm_exit has been called on any cpu in the power\n" - "+ * domain. Notified drivers can include VFP co-processor, interrupt controller\n" - "+ * and it's PM extensions, local CPU timers context save/restore which\n" - "+ * shouldn't be interrupted. Hence it must be called with interrupts disabled.\n" - "+ *\n" - "+ * Must be called with interrupts disabled.\n" - "+ *\n" - "+ * Return conditions are same as __raw_notifier_call_chain.\n" - "+ */\n" - "+int cpu_cluster_pm_enter(void)\n" - "+{\n" - "+\tint nr_calls;\n" - "+\tint ret = 0;\n" - "+\n" - "+\tread_lock(&cpu_pm_notifier_lock);\n" - "+\tret = cpu_pm_notify(CPU_CLUSTER_PM_ENTER, -1, &nr_calls);\n" - "+\tif (ret)\n" - "+\t\t/*\n" - "+\t\t * Inform listeners (nr_calls - 1) about failure of CPU cluster\n" - "+\t\t * PM entry who are notified earlier to prepare for it.\n" - "+\t\t */\n" - "+\t\tcpu_pm_notify(CPU_CLUSTER_PM_ENTER_FAILED, nr_calls - 1, NULL);\n" - "+\tread_unlock(&cpu_pm_notifier_lock);\n" - "+\n" - "+\treturn ret;\n" - "+}\n" - "+EXPORT_SYMBOL_GPL(cpu_cluster_pm_enter);\n" - "+\n" - "+/**\n" - "+ * cpm_cluster_pm_exit - CPU cluster low power exit notifier\n" - "+ *\n" - "+ * Notifies listeners that all cpus in a power domain are exiting form a\n" - "+ * low power state that may have caused some blocks in the same power domain\n" - "+ * to reset.\n" - "+ *\n" - "+ * Must be called after cpu_pm_exit has been called on all cpus in the power\n" - "+ * domain, and before cpu_pm_exit has been called on any cpu in the power\n" - "+ * domain. Notified drivers can include VFP co-processor, interrupt controller\n" - "+ * and it's PM extensions, local CPU timers context save/restore which\n" - "+ * shouldn't be interrupted. Hence it must be called with interrupts disabled.\n" - "+ *\n" - "+ * Return conditions are same as __raw_notifier_call_chain.\n" - "+ */\n" - "+int cpu_cluster_pm_exit(void)\n" - "+{\n" - "+\tint ret;\n" - "+\n" - "+\tread_lock(&cpu_pm_notifier_lock);\n" - "+\tret = cpu_pm_notify(CPU_CLUSTER_PM_EXIT, -1, NULL);\n" - "+\tread_unlock(&cpu_pm_notifier_lock);\n" - "+\n" - "+\treturn ret;\n" - "+}\n" - "+EXPORT_SYMBOL_GPL(cpu_cluster_pm_exit);\n" - "diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig\n" - "index 3744c59..80a8597 100644\n" - "--- a/kernel/power/Kconfig\n" - "+++ b/kernel/power/Kconfig\n" - "@@ -235,3 +235,7 @@ config PM_GENERIC_DOMAINS\n" - " config PM_GENERIC_DOMAINS_RUNTIME\n" - " \tdef_bool y\n" - " \tdepends on PM_RUNTIME && PM_GENERIC_DOMAINS\n" - "+\n" - "+config CPU_PM\n" - "+\tbool\n" - "+\tdepends on SUSPEND || CPU_IDLE\n" - "-- \n" - 1.7.4.1 -fc4a29da4d3c4ed542301bafce533f64aef399ec22e6575bf9211ced92a5217a +585d1a682a7c17d401212b1cf67098a0c78699bf5edb1eee7875e720a684757b
diff --git a/a/2.txt b/N2/2.txt index f0898ab..c696dea 100644 --- a/a/2.txt +++ b/N2/2.txt @@ -1,4 +1,4 @@ -From 6a0ef5d42da459d9eba0a5f396e6d9a95d3f94ff Mon Sep 17 00:00:00 2001 +>From 6a0ef5d42da459d9eba0a5f396e6d9a95d3f94ff Mon Sep 17 00:00:00 2001 From: Colin Cross <ccross@android.com> Date: Thu, 10 Feb 2011 02:04:45 -0800 Subject: [PATCH 1/5] cpu_pm: Add cpu power management notifiers diff --git a/a/content_digest b/N2/content_digest index 4646258..66f1547 100644 --- a/a/content_digest +++ b/N2/content_digest @@ -457,7 +457,7 @@ "\01:2\0" "fn\00001-cpu_pm-Add-cpu-power-management-notifiers.patch\0" "b\0" - "From 6a0ef5d42da459d9eba0a5f396e6d9a95d3f94ff Mon Sep 17 00:00:00 2001\n" + ">From 6a0ef5d42da459d9eba0a5f396e6d9a95d3f94ff Mon Sep 17 00:00:00 2001\n" "From: Colin Cross <ccross@android.com>\n" "Date: Thu, 10 Feb 2011 02:04:45 -0800\n" "Subject: [PATCH 1/5] cpu_pm: Add cpu power management notifiers\n" @@ -835,4 +835,4 @@ "-- \n" 1.7.4.1 -fc4a29da4d3c4ed542301bafce533f64aef399ec22e6575bf9211ced92a5217a +ed7e0e96d751426c711690f2a15c31d8e552e12f1a253f7344e217b6f7b6f4f3
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.