diff for duplicates of <87vd5wm1wx.fsf@deeprootsystems.com> diff --git a/a/1.txt b/N1/1.txt index 56a63ed..2cc34c3 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -112,175 +112,3 @@ added a FIXME in the code. Thanks for the feedback Paul. Kevin - - ->From e7410cf7831c2e5106a90dac6179df5d2c9bd60e Mon Sep 17 00:00:00 2001 -From: Kevin Hilman <khilman@deeprootsystems.com> -Date: Wed, 8 Sep 2010 16:37:42 -0700 -Subject: [PATCH 03/13] OMAP3: PM: move device-specific special cases from PM core into CPUidle - -In an effort to simplify the core idle path, move any device-specific -special case handling from the core PM idle path into the CPUidle -pre-idle checking path. - -This keeps the core, interrupts-disabled idle path streamlined and -independent of any device-specific handling, and also allows CPUidle -to do the checking only for certain C-states as needed. This patch -has the device checks in place for all states with the CHECK_BM flag, -namely all states >= C2. - -This patch was inspired by a similar patch written by Tero Kristo as -part of a larger series to add INACTIVE state support. - -NOTE: This is a baby-step towards decoupling device idle (or system -idle) from CPU idle. Eventually, CPUidle should only manage the CPU, -and device/system idle should be managed elsewhere. - -Cc: Tero Kristo <tero.kristo@nokia.com> -Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com> ---- - arch/arm/mach-omap2/cpuidle34xx.c | 58 +++++++++++++++++++++++++++++++++++-- - arch/arm/mach-omap2/pm34xx.c | 14 +-------- - 2 files changed, 56 insertions(+), 16 deletions(-) - -diff --git a/arch/arm/mach-omap2/cpuidle34xx.c b/arch/arm/mach-omap2/cpuidle34xx.c -index 3d3d035..8ea012e 100644 ---- a/arch/arm/mach-omap2/cpuidle34xx.c -+++ b/arch/arm/mach-omap2/cpuidle34xx.c -@@ -60,7 +60,8 @@ struct omap3_processor_cx { - - struct omap3_processor_cx omap3_power_states[OMAP3_MAX_STATES]; - struct omap3_processor_cx current_cx_state; --struct powerdomain *mpu_pd, *core_pd; -+struct powerdomain *mpu_pd, *core_pd, *per_pd; -+struct powerdomain *cam_pd; - - /* - * The latencies/thresholds for various C states have -@@ -233,14 +234,62 @@ static int omap3_enter_idle_bm(struct cpuidle_device *dev, - struct cpuidle_state *state) - { - struct cpuidle_state *new_state = next_valid_state(dev, state); -+ u32 core_next_state, per_next_state = 0, per_saved_state = 0; -+ u32 cam_state; -+ struct omap3_processor_cx *cx; -+ int ret; - - if ((state->flags & CPUIDLE_FLAG_CHECK_BM) && omap3_idle_bm_check()) { - BUG_ON(!dev->safe_state); - new_state = dev->safe_state; -+ goto select_state; -+ } -+ -+ cx = cpuidle_get_statedata(state); -+ core_next_state = cx->core_state; -+ -+ /* -+ * FIXME: we currently manage device-specific idle states -+ * for PER and CORE in combination with CPU-specific -+ * idle states. This is wrong, and device-specific -+ * idle managment needs to be separated out into -+ * its own code. -+ */ -+ -+ /* -+ * Prevent idle completely if CAM is active. -+ * CAM does not have wakeup capability in OMAP3. -+ */ -+ cam_state = pwrdm_read_pwrst(cam_pd); -+ if (cam_state == PWRDM_POWER_ON) { -+ new_state = dev->safe_state; -+ goto select_state; -+ } -+ -+ /* -+ * Prevent PER off if CORE is not in retention or off as this -+ * would disable PER wakeups completely. -+ */ -+ per_next_state = per_saved_state = pwrdm_read_next_pwrst(per_pd); -+ if ((per_next_state == PWRDM_POWER_OFF) && -+ (core_next_state > PWRDM_POWER_RET)) { -+ per_next_state = PWRDM_POWER_RET; -+ pwrdm_set_next_pwrst(per_pd, per_next_state); - } - -+ /* Are we changing PER target state? */ -+ if (per_next_state != per_saved_state) -+ pwrdm_set_next_pwrst(per_pd, per_next_state); -+ -+select_state: - dev->last_state = new_state; -- return omap3_enter_idle(dev, new_state); -+ ret = omap3_enter_idle(dev, new_state); -+ -+ /* Restore original PER state if it was modified */ -+ if (per_next_state != per_saved_state) -+ pwrdm_set_next_pwrst(per_pd, per_saved_state); -+ -+ return ret; - } - - DEFINE_PER_CPU(struct cpuidle_device, omap3_idle_dev); -@@ -328,7 +377,8 @@ void omap_init_power_states(void) - cpuidle_params_table[OMAP3_STATE_C2].threshold; - omap3_power_states[OMAP3_STATE_C2].mpu_state = PWRDM_POWER_ON; - omap3_power_states[OMAP3_STATE_C2].core_state = PWRDM_POWER_ON; -- omap3_power_states[OMAP3_STATE_C2].flags = CPUIDLE_FLAG_TIME_VALID; -+ omap3_power_states[OMAP3_STATE_C2].flags = CPUIDLE_FLAG_TIME_VALID | -+ CPUIDLE_FLAG_CHECK_BM; - - /* C3 . MPU CSWR + Core inactive */ - omap3_power_states[OMAP3_STATE_C3].valid = -@@ -426,6 +476,8 @@ int __init omap3_idle_init(void) - - mpu_pd = pwrdm_lookup("mpu_pwrdm"); - core_pd = pwrdm_lookup("core_pwrdm"); -+ per_pd = pwrdm_lookup("per_pwrdm"); -+ cam_pd = pwrdm_lookup("cam_pwrdm"); - - omap_init_power_states(); - cpuidle_register_driver(&omap3_idle_driver); -diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c -index 429268e..bb2ba1e 100644 ---- a/arch/arm/mach-omap2/pm34xx.c -+++ b/arch/arm/mach-omap2/pm34xx.c -@@ -346,7 +346,6 @@ void omap_sram_idle(void) - int core_next_state = PWRDM_POWER_ON; - int core_prev_state, per_prev_state; - u32 sdrc_pwr = 0; -- int per_state_modified = 0; - - if (!_omap_sram_idle) - return; -@@ -391,19 +390,10 @@ void omap_sram_idle(void) - if (per_next_state < PWRDM_POWER_ON) { - omap_uart_prepare_idle(2); - omap2_gpio_prepare_for_idle(per_next_state); -- if (per_next_state == PWRDM_POWER_OFF) { -- if (core_next_state == PWRDM_POWER_ON) { -- per_next_state = PWRDM_POWER_RET; -- pwrdm_set_next_pwrst(per_pwrdm, per_next_state); -- per_state_modified = 1; -- } else -+ if (per_next_state == PWRDM_POWER_OFF) - omap3_per_save_context(); -- } - } - -- if (pwrdm_read_pwrst(cam_pwrdm) == PWRDM_POWER_ON) -- omap2_clkdm_deny_idle(mpu_pwrdm->pwrdm_clkdms[0]); -- - /* CORE */ - if (core_next_state < PWRDM_POWER_ON) { - omap_uart_prepare_idle(0); -@@ -470,8 +460,6 @@ void omap_sram_idle(void) - if (per_prev_state == PWRDM_POWER_OFF) - omap3_per_restore_context(); - omap_uart_resume_idle(2); -- if (per_state_modified) -- pwrdm_set_next_pwrst(per_pwrdm, PWRDM_POWER_OFF); - } - - /* Disable IO-PAD and IO-CHAIN wakeup */ --- -1.7.2.1 diff --git a/a/content_digest b/N1/content_digest index 256185f..458d4e5 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -4,13 +4,10 @@ "ref\0878w2vkp65.fsf@deeprootsystems.com\0" "ref\0alpine.DEB.2.00.1009231709000.10678@utopia.booyaka.com\0" "ref\087eickowdo.fsf@deeprootsystems.com\0" - "From\0Kevin Hilman <khilman@deeprootsystems.com>\0" - "Subject\0Re: [PATCH 03/10] OMAP3: PM: move device-specific special cases from PM core into CPUidle\0" + "From\0khilman@deeprootsystems.com (Kevin Hilman)\0" + "Subject\0[PATCH 03/10] OMAP3: PM: move device-specific special cases from PM core into CPUidle\0" "Date\0Thu, 23 Sep 2010 17:16:14 -0700\0" - "To\0Paul Walmsley <paul@pwsan.com>\0" - "Cc\0linux-omap@vger.kernel.org" - linux-arm-kernel@lists.infradead.org - " Tero Kristo <tero.kristo@nokia.com>\0" + "To\0linux-arm-kernel@lists.infradead.org\0" "\00:1\0" "b\0" "Kevin Hilman <khilman@deeprootsystems.com> writes:\n" @@ -126,178 +123,6 @@ "\n" "Thanks for the feedback Paul.\n" "\n" - "Kevin\n" - "\n" - "\n" - ">From e7410cf7831c2e5106a90dac6179df5d2c9bd60e Mon Sep 17 00:00:00 2001\n" - "From: Kevin Hilman <khilman@deeprootsystems.com>\n" - "Date: Wed, 8 Sep 2010 16:37:42 -0700\n" - "Subject: [PATCH 03/13] OMAP3: PM: move device-specific special cases from PM core into CPUidle\n" - "\n" - "In an effort to simplify the core idle path, move any device-specific\n" - "special case handling from the core PM idle path into the CPUidle\n" - "pre-idle checking path.\n" - "\n" - "This keeps the core, interrupts-disabled idle path streamlined and\n" - "independent of any device-specific handling, and also allows CPUidle\n" - "to do the checking only for certain C-states as needed. This patch\n" - "has the device checks in place for all states with the CHECK_BM flag,\n" - "namely all states >= C2.\n" - "\n" - "This patch was inspired by a similar patch written by Tero Kristo as\n" - "part of a larger series to add INACTIVE state support.\n" - "\n" - "NOTE: This is a baby-step towards decoupling device idle (or system\n" - "idle) from CPU idle. Eventually, CPUidle should only manage the CPU,\n" - "and device/system idle should be managed elsewhere.\n" - "\n" - "Cc: Tero Kristo <tero.kristo@nokia.com>\n" - "Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>\n" - "---\n" - " arch/arm/mach-omap2/cpuidle34xx.c | 58 +++++++++++++++++++++++++++++++++++--\n" - " arch/arm/mach-omap2/pm34xx.c | 14 +--------\n" - " 2 files changed, 56 insertions(+), 16 deletions(-)\n" - "\n" - "diff --git a/arch/arm/mach-omap2/cpuidle34xx.c b/arch/arm/mach-omap2/cpuidle34xx.c\n" - "index 3d3d035..8ea012e 100644\n" - "--- a/arch/arm/mach-omap2/cpuidle34xx.c\n" - "+++ b/arch/arm/mach-omap2/cpuidle34xx.c\n" - "@@ -60,7 +60,8 @@ struct omap3_processor_cx {\n" - " \n" - " struct omap3_processor_cx omap3_power_states[OMAP3_MAX_STATES];\n" - " struct omap3_processor_cx current_cx_state;\n" - "-struct powerdomain *mpu_pd, *core_pd;\n" - "+struct powerdomain *mpu_pd, *core_pd, *per_pd;\n" - "+struct powerdomain *cam_pd;\n" - " \n" - " /*\n" - " * The latencies/thresholds for various C states have\n" - "@@ -233,14 +234,62 @@ static int omap3_enter_idle_bm(struct cpuidle_device *dev,\n" - " \t\t\t struct cpuidle_state *state)\n" - " {\n" - " \tstruct cpuidle_state *new_state = next_valid_state(dev, state);\n" - "+\tu32 core_next_state, per_next_state = 0, per_saved_state = 0;\n" - "+\tu32 cam_state;\n" - "+\tstruct omap3_processor_cx *cx;\n" - "+\tint ret;\n" - " \n" - " \tif ((state->flags & CPUIDLE_FLAG_CHECK_BM) && omap3_idle_bm_check()) {\n" - " \t\tBUG_ON(!dev->safe_state);\n" - " \t\tnew_state = dev->safe_state;\n" - "+\t\tgoto select_state;\n" - "+\t}\n" - "+\n" - "+\tcx = cpuidle_get_statedata(state);\n" - "+\tcore_next_state = cx->core_state;\n" - "+\n" - "+\t/*\n" - "+\t * FIXME: we currently manage device-specific idle states\n" - "+\t * for PER and CORE in combination with CPU-specific\n" - "+\t * idle states. This is wrong, and device-specific\n" - "+\t * idle managment needs to be separated out into \n" - "+\t * its own code.\n" - "+\t */\n" - "+\n" - "+\t/*\n" - "+\t * Prevent idle completely if CAM is active.\n" - "+\t * CAM does not have wakeup capability in OMAP3.\n" - "+\t */\n" - "+\tcam_state = pwrdm_read_pwrst(cam_pd);\n" - "+\tif (cam_state == PWRDM_POWER_ON) {\n" - "+\t\tnew_state = dev->safe_state;\n" - "+\t\tgoto select_state;\n" - "+\t}\n" - "+\n" - "+\t/*\n" - "+\t * Prevent PER off if CORE is not in retention or off as this\n" - "+\t * would disable PER wakeups completely.\n" - "+\t */\n" - "+\tper_next_state = per_saved_state = pwrdm_read_next_pwrst(per_pd);\n" - "+\tif ((per_next_state == PWRDM_POWER_OFF) &&\n" - "+\t (core_next_state > PWRDM_POWER_RET)) {\n" - "+\t\tper_next_state = PWRDM_POWER_RET;\n" - "+\t\tpwrdm_set_next_pwrst(per_pd, per_next_state);\n" - " \t}\n" - " \n" - "+\t/* Are we changing PER target state? */\n" - "+\tif (per_next_state != per_saved_state)\n" - "+\t\tpwrdm_set_next_pwrst(per_pd, per_next_state);\n" - "+\n" - "+select_state:\n" - " \tdev->last_state = new_state;\n" - "-\treturn omap3_enter_idle(dev, new_state);\n" - "+\tret = omap3_enter_idle(dev, new_state);\n" - "+\n" - "+\t/* Restore original PER state if it was modified */\n" - "+\tif (per_next_state != per_saved_state)\n" - "+\t\tpwrdm_set_next_pwrst(per_pd, per_saved_state);\n" - "+\n" - "+\treturn ret;\n" - " }\n" - " \n" - " DEFINE_PER_CPU(struct cpuidle_device, omap3_idle_dev);\n" - "@@ -328,7 +377,8 @@ void omap_init_power_states(void)\n" - " \t\t\tcpuidle_params_table[OMAP3_STATE_C2].threshold;\n" - " \tomap3_power_states[OMAP3_STATE_C2].mpu_state = PWRDM_POWER_ON;\n" - " \tomap3_power_states[OMAP3_STATE_C2].core_state = PWRDM_POWER_ON;\n" - "-\tomap3_power_states[OMAP3_STATE_C2].flags = CPUIDLE_FLAG_TIME_VALID;\n" - "+\tomap3_power_states[OMAP3_STATE_C2].flags = CPUIDLE_FLAG_TIME_VALID |\n" - "+\t\t\t\tCPUIDLE_FLAG_CHECK_BM;\n" - " \n" - " \t/* C3 . MPU CSWR + Core inactive */\n" - " \tomap3_power_states[OMAP3_STATE_C3].valid =\n" - "@@ -426,6 +476,8 @@ int __init omap3_idle_init(void)\n" - " \n" - " \tmpu_pd = pwrdm_lookup(\"mpu_pwrdm\");\n" - " \tcore_pd = pwrdm_lookup(\"core_pwrdm\");\n" - "+\tper_pd = pwrdm_lookup(\"per_pwrdm\");\n" - "+\tcam_pd = pwrdm_lookup(\"cam_pwrdm\");\n" - " \n" - " \tomap_init_power_states();\n" - " \tcpuidle_register_driver(&omap3_idle_driver);\n" - "diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c\n" - "index 429268e..bb2ba1e 100644\n" - "--- a/arch/arm/mach-omap2/pm34xx.c\n" - "+++ b/arch/arm/mach-omap2/pm34xx.c\n" - "@@ -346,7 +346,6 @@ void omap_sram_idle(void)\n" - " \tint core_next_state = PWRDM_POWER_ON;\n" - " \tint core_prev_state, per_prev_state;\n" - " \tu32 sdrc_pwr = 0;\n" - "-\tint per_state_modified = 0;\n" - " \n" - " \tif (!_omap_sram_idle)\n" - " \t\treturn;\n" - "@@ -391,19 +390,10 @@ void omap_sram_idle(void)\n" - " \tif (per_next_state < PWRDM_POWER_ON) {\n" - " \t\tomap_uart_prepare_idle(2);\n" - " \t\tomap2_gpio_prepare_for_idle(per_next_state);\n" - "-\t\tif (per_next_state == PWRDM_POWER_OFF) {\n" - "-\t\t\tif (core_next_state == PWRDM_POWER_ON) {\n" - "-\t\t\t\tper_next_state = PWRDM_POWER_RET;\n" - "-\t\t\t\tpwrdm_set_next_pwrst(per_pwrdm, per_next_state);\n" - "-\t\t\t\tper_state_modified = 1;\n" - "-\t\t\t} else\n" - "+\t\tif (per_next_state == PWRDM_POWER_OFF)\n" - " \t\t\t\tomap3_per_save_context();\n" - "-\t\t}\n" - " \t}\n" - " \n" - "-\tif (pwrdm_read_pwrst(cam_pwrdm) == PWRDM_POWER_ON)\n" - "-\t\tomap2_clkdm_deny_idle(mpu_pwrdm->pwrdm_clkdms[0]);\n" - "-\n" - " \t/* CORE */\n" - " \tif (core_next_state < PWRDM_POWER_ON) {\n" - " \t\tomap_uart_prepare_idle(0);\n" - "@@ -470,8 +460,6 @@ void omap_sram_idle(void)\n" - " \t\tif (per_prev_state == PWRDM_POWER_OFF)\n" - " \t\t\tomap3_per_restore_context();\n" - " \t\tomap_uart_resume_idle(2);\n" - "-\t\tif (per_state_modified)\n" - "-\t\t\tpwrdm_set_next_pwrst(per_pwrdm, PWRDM_POWER_OFF);\n" - " \t}\n" - " \n" - " \t/* Disable IO-PAD and IO-CHAIN wakeup */\n" - "-- \n" - 1.7.2.1 + Kevin -f9c69b969c2a287b25241ac9cb75dba15e10b3943f3bd9a20d813bbcb5393b29 +5857eb0f7c26bb2a6e22f015960f1adbbadf9e6a902d24edd9302c4e15461281
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.