OMAP: add PM_CONSTRAINTS framework
Subsystems (5)
v4 cover OMAP: add PM_CONSTRAINTS framework
From: Jean Pihet <[email protected]>
Implement OMAP PM layer omap_pm_set_max_dev_wakeup_lat API by creating a unified API which calls omap_device_set_dev_constraint for all classes of constraints (devices wake-up latency, devices throughput...).
The implementation of the constraints framework is at the omap_device
level: management and storage of the constraints, dispatching of the constraints to the appropriate low level layers.
NOTE: only works for devices which have been converted to use
omap_device/omap_hwmod.
Longer term, we could possibly remove this API from the OMAP PM layer, and instead directly use the device level API.
For the devices wake-up latency constraints, the power domains get the next power state programmed directly in the registers via pwrdm_wakeuplat_update_pwrst.
Note about PM QOS: the MPU and CORE power domains get the next power state via cpuidle, which get the strongest wake-up latency constraint by querying PM QOS. The usage of PM QOS is temporary, until a generic solution is in place.
The bus throughput constraints framework is supported by still is a no-op for the moment.
For the wake-up latency constraints framework to have effect on the power domains states, CONFIG_CPU_IDLE and CONFIG_OMAP_PM_CONSTRAINTS must be enabled.
Based on Vibhore's original patch and completely reworked using omap_device, omap_hwmod, powerdomain and PM QOS frameworks.
Cc: Vibhore Vardhan <[email protected]>
Tested on OMAP3 Beagleboard in RET/OFF using wake-up latency constraints on MPU, CORE and PER.
Based on khilman's pm-core branch
v4:
. updated after review comments on linux-omap mailing list, . bug fix in the use of plist_first and plist_last if the list is empty.
v3:
. updated after review comments from Kevin,
. patches re-ordering for git bisect compliance,
. reworked the constraints storage and management:
- the omap_device layer stores all constraints in per-omap_device constraints lists,
- the powerdomain layer manages the wake-up latency constraints in per-pwrdm constraint list and applies the constraint to the corresponding power domain.
. add the support for the INACTIVE power state,
. move the power domains state initialization from pwrdms_setup to an early init call.
v2:
. updated after review comments from Kevin and Paul,
. initial patch split according to the layering,
. added support for ascending or descending order of constraints values, . added throughput constraints to the framework, although the tput implementation
currently is a no-op.
To Do:
. refine the wake-up latency figures by defining the conditions of measurements and by
measuring on actual OMAP3 hardware,
. define the effect of power domains states combinations,
. debug: add some control knobs for the wake-up latencies in /sysfs,
. add a user-space API to request and remove constraints,
. add OMAP4 support when low power modes code is merged in.
Jean Pihet (8):
OMAP PM: create a PM layer plugin for per-device constraints OMAP2+: powerdomain: control power domains next state
OMAP3: powerdomain data: add wake-up latency figures OMAP2+: omap_hwmod: manage the omap_devices the wake-up latency
constraints
OMAP: PM CONSTRAINTS: add an enum for the classes of constraint OMAP2+: omap_device: implement the constraints management code
OMAP: PM CONSTRAINTS: implement wake-up latency constraints OMAP PM: early init of the pwrdms states
arch/arm/mach-omap2/omap_hwmod.c | 26 ++- arch/arm/mach-omap2/pm34xx.c | 2 +- arch/arm/mach-omap2/pm44xx.c | 2 +- arch/arm/mach-omap2/powerdomain.c | 213 ++++++++++++++ arch/arm/mach-omap2/powerdomain.h | 42 +++- arch/arm/mach-omap2/powerdomains3xxx_data.c | 84 ++++++- arch/arm/plat-omap/Kconfig | 7 + arch/arm/plat-omap/Makefile | 1 + arch/arm/plat-omap/include/plat/omap-pm.h | 4 + arch/arm/plat-omap/include/plat/omap_device.h | 15 +- arch/arm/plat-omap/include/plat/omap_hwmod.h | 2 + arch/arm/plat-omap/omap-pm-constraints.c | 369 +++++++++++++++++++++++++ arch/arm/plat-omap/omap_device.c | 191 +++++++++++++ 13 files changed, 950 insertions(+), 8 deletions(-) create mode 100644 arch/arm/plat-omap/omap-pm-constraints.c
Signature · 1 line
1.7.2.5
PATCH v4 1/8 OMAP PM: create a PM layer plugin for per-device constraints
From: Jean Pihet <[email protected]>
Created arch/arm/plat-omap/omap-pm-constraints.c file from arch/arm/plat-omap/omap-pm-noop.c and the associated Kconfig option OMAP_PM_CONSTRAINTS.
Based on the original patch from Vishwanath,
cf. https://patchwork.kernel.org/patch/327312/
--- arch/arm/plat-omap/Kconfig | 7 + arch/arm/plat-omap/Makefile | 1 + arch/arm/plat-omap/omap-pm-constraints.c | 363 ++++++++++++++++++++++++++++++ 3 files changed, 371 insertions(+), 0 deletions(-) create mode 100644 arch/arm/plat-omap/omap-pm-constraints.c
arch/arm/plat-omap/Kconfig +7 -0
@@ -215,6 +215,13 @@ config OMAP_PM_NONE config OMAP_PM_NOOP bool "No-op/debug PM layer" +config OMAP_PM_CONSTRAINTS + depends on PM + bool "Per device constraints" + help + Select this option to enable the PM layer plugin for + the per-device constraints support + endchoice endmenu
arch/arm/plat-omap/Makefile +1 -0
@@ -32,3 +32,4 @@ obj-y += $(i2c-omap-m) $(i2c-omap-y) obj-$(CONFIG_OMAP_MBOX_FWK) += mailbox.o obj-$(CONFIG_OMAP_PM_NOOP) += omap-pm-noop.o +obj-$(CONFIG_OMAP_PM_CONSTRAINTS) += omap-pm-constraints.o
arch/arm/plat-omap/omap-pm-constraints.c new file +363 -0
363 lines not on this page · raw message
Signature · 1 line
1.7.2.5
Tony Lindgren
maintainerPATCH 1/8 OMAP PM: create a PM layer plugin for per-device constraints
Quoted 2 lines · jean.pihet at newoldbits.com
+int
omap_pm_set_max_mpu_wakeup_lat(struct device *dev, long t)
...
Quoted 1 line
+int omap_pm_set_max_dev_wakeup_lat(struct device
*req_dev, struct device *dev,
...
Quoted 1 line
+int
omap_pm_set_min_clk_rate(struct device *dev, struct clk *c, long r)
...
You should implement this as a Linux generic framework, we don't want to add more omap specific frameworks.
Or maybe you can leave this out if they're just stubs for TI CDP code?
Tony
PATCH 1/8 OMAP PM: create a PM layer plugin for per-device constraints
Tony,
Quoted 5 lines · Tony Lindgren
Quoted 2 lines · jean.pihet at newoldbits.com
+int
omap_pm_set_max_mpu_wakeup_lat(struct device *dev, long t)...
Quoted 8 lines
Quoted 1 line
+int omap_pm_set_max_dev_wakeup_lat(struct device
*req_dev, struct device *dev,...
Quoted 1 line
+int
omap_pm_set_min_clk_rate(struct device *dev, struct clk *c, long r)...
You should implement this as a Linux generic framework, we don't want to add more omap specific frameworks.
This series isn't adding any new OMAP-specific frameworks. The OMAP PM layer is already in place, and has been there for awhile. OMAP PM is a layer which can have "plugins" so we can experiment with ways of handling constraints without changing the driver interface, and this series is just implementing a new plugin.
Once we are happy with a constraint layer, and can prove it will work, the plan is to get rid of the (existing) OMAP-specific APIs and propose a generic interface.
Kevin
Tony Lindgren
maintainerPATCH 1/8 OMAP PM: create a PM layer plugin for per-device constraints
Quoted 15 lines · Kevin Hilman
Tony,
Quoted 11 lines · Tony Lindgren
Quoted 2 lines · jean.pihet at newoldbits.com
+int
omap_pm_set_max_mpu_wakeup_lat(struct device *dev, long t)...
Quoted 1 line
+int omap_pm_set_max_dev_wakeup_lat(struct device
*req_dev, struct device *dev,...
Quoted 1 line
+int
omap_pm_set_min_clk_rate(struct device *dev, struct clk *c, long r)...
Quoted 8 lines
Quoted 2 lines
You should implement this as a Linux generic framework, we don't want to add more omap specific frameworks.
This series isn't adding any new OMAP-specific frameworks. The OMAP PM layer is already in place, and has been there for awhile. OMAP PM is a layer which can have "plugins" so we can experiment with ways of handling constraints without changing the driver interface, and this series is just implementing a new plugin.
But in this case the plugin is just stubs. The only function that does something is omap_pm_get_dev_context_loss_count. And then patch 8 in this series starts adding a new omap specific features for constraints.
So the problem is patches 1 & 8 in this series. The rest is just fine as it's the necessary omap hardware specific implementation.
Quoted 3 lines
Once we are happy with a constraint layer, and can prove it will work, the plan is to get rid of the (existing) OMAP-specific APIs and propose a generic interface.
Well I don't think we should start building new omap specific layer on an omap specific framework.
Instead, the constraint layer should be made generic to start with, even if it's just a minimal implementation initially.
Maybe it could be just a generic header file to start with?
Regards,
Tony
Tony Lindgren
maintainerPATCH 1/8 OMAP PM: create a PM layer plugin for per-device constraints
Quoted 3 lines · Tony Lindgren
So the problem is patches 1 & 8 in this series. The rest is just fine as it's the necessary omap hardware specific implementation.
Sorry, patches 1 & 7 I mean.
Tony
PATCH v4 2/8 OMAP2+: powerdomain: control power domains next state
In reply to jean.pihet at newoldbits.comFrom: Jean Pihet <[email protected]>
When a wake-up latency constraint is requested or removed the omap device layer dispatches the updated strongest constraint value to the corresponding power domain.
The power domains get the next power state programmed directly in the registers via pwrdm_wakeuplat_update_pwrst.
Note about PM QOS: the MPU and CORE power domains get the next power state via cpuidle, which get the strongest wake-up latency constraint by querying PM QOS. The usage of PM QOS is temporary, until a generic solution is in place.
Tested on OMAP3 Beagleboard in RET/OFF using wake-up latency constraints on MPU, CORE and PER.
--- arch/arm/mach-omap2/powerdomain.c | 208 +++++++++++++++++++++++++++++++++++++ arch/arm/mach-omap2/powerdomain.h | 42 +++++++- 2 files changed, 248 insertions(+), 2 deletions(-)
arch/arm/mach-omap2/powerdomain.c +208 -0
@@ -17,6 +17,7 @@#include <linux/kernel.h> #include <linux/types.h> #include <linux/list.h> +#include <linux/slab.h> #include <linux/errno.h> #include <linux/string.h> #include <trace/events/power.h>
@@ -104,6 +105,12 @@ static int _pwrdm_register(struct powerdomain *pwrdm)for (i =0 ; i < pwrdm->banks; i++) pwrdm->ret_mem_off_counter[i] =0 ; +/* Initialize the per-od wake-up constraints list and spinlock */ +spin_lock_init (&pwrdm->wkup_lat_plist_lock); +plist_head_init (&pwrdm->wkup_lat_plist_head, + &pwrdm->wkup_lat_plist_lock); + +/* Initialize the pwrdm state */ pwrdm_wait_transition (pwrdm); pwrdm->state =pwrdm_read_pwrst (pwrdm); pwrdm->state_counter[pwrdm->state] =1 ;
@@ -191,6 +198,103 @@ static int _pwrdm_post_transition_cb(struct powerdomain *pwrdm, void *unused)return 0 ; } +/** +* pwrdm_wakeuplat_update_pwrst - Update power domain power state if needed +* @pwrdm: struct powerdomain * to which requesting device belongs to. +* @min_latency: the allowed wake-up latency for the given power domain. A +* value of 0 means 'no constraint' on the pwrdm. +* +* Finds the power domain next power state that fulfills the constraint. +* Programs a new target state if it is different from current power state. +* +* Note about PM QOS: the MPU and CORE power domains get the next power +* state via cpuidle, which get the strongest wake-up latency constraint +* by querying PM QOS. The usage of PM QOS is temporary, until a generic +* solution is in place. +* The power domains other then MPU and CORE get the next power state +* programmed directly in the registers. +* +* Returns 0 upon success. +*/ +static int pwrdm_wakeuplat_update_pwrst (struct powerdomain *pwrdm, +long min_latency) +{ +int ret =0 , new_state =0 ; + +if (!pwrdm) { +WARN (1 ,"powerdomain: %s: invalid parameter(s)" , __func__); +return -EINVAL ; + } + +/* +* Apply constraints to MPU and CORE via the PM QOS API. +* Every power domain struct has a pm_qos_request_list field +*/ +if (pwrdm->flags &PWRDM_USES_PM_QOS_CONSTRAINTS ) { +if (pm_qos_request_active (&pwrdm->pm_qos_request)) +pm_qos_remove_request (&pwrdm->pm_qos_request); + +if (min_latency >0 ) { +pm_qos_add_request (&pwrdm->pm_qos_request, +PM_QOS_CPU_DMA_LATENCY , + min_latency); +pr_debug ("powerdomain: %s: pwrdm %s: " +"adding a PM_QOS_CPU_DMA_LATENCY request, " +"min_latency=%ld\n" , __func__, pwrdm->name, + min_latency); + } + +return 0 ; + } + +/* +* Apply constraints to pwrdm other than MPU and CORE by programming +* the pwrdm next power state. +*/ + +/* Find power state with wakeup latency < minimum constraint */ +for (new_state =0x0 ; new_state <PWRDM_MAX_PWRSTS ; new_state++) { +if (min_latency ==0 || + pwrdm->wakeup_lat[new_state] <= min_latency) +break ; + } + +switch (new_state) { +case PWRDM_FUNC_PWRST_OFF : + new_state =PWRDM_POWER_OFF ; +break ; +case PWRDM_FUNC_PWRST_OSWR : +pwrdm_set_logic_retst (pwrdm,PWRDM_POWER_OFF ); + new_state =PWRDM_POWER_RET ; +break ; +case PWRDM_FUNC_PWRST_CSWR : +pwrdm_set_logic_retst (pwrdm,PWRDM_POWER_RET ); + new_state =PWRDM_POWER_RET ; +break ; +case PWRDM_FUNC_PWRST_INACTIVE : + new_state =PWRDM_POWER_INACTIVE ; +break ; +case PWRDM_FUNC_PWRST_ON : + new_state =PWRDM_POWER_ON ; +break ; +default : +pr_warn ("powerdomain: requested latency constraint not " +"supported %s set to ON state\n" , pwrdm->name); + new_state =PWRDM_POWER_ON ; +break ; + } + +if (pwrdm_read_pwrst (pwrdm) != new_state) + ret =omap_set_pwrdm_state (pwrdm, new_state); + +pr_debug ("powerdomain: %s pwrst: curr=%d, prev=%d next=%d " +"min_latency=%ld, set_state=%d\n" , pwrdm->name, +pwrdm_read_pwrst (pwrdm),pwrdm_read_prev_pwrst (pwrdm), +pwrdm_read_next_pwrst (pwrdm), min_latency, new_state); + +return ret; +} +/* Public functions */ /**
@@ -930,6 +1034,110 @@ int pwrdm_post_transition(void)return 0 ; } +/* +* pwrdm_set_wkup_lat_constraint - Set/update/remove a powerdomain wakeup +* latency constraint and apply it +* @pwrdm: struct powerdomain * which the constraint applies to +* @cookie: constraint identifier, used for tracking. +* @min_latency: minimum wakeup latency constraint (in microseconds) for +* the given pwrdm. The value of 0 removes the constraint. +* +* Tracks the constraints by @cookie. +* Constraint set/update: Adds a new entry to powerdomain's wake-up latency +* constraint list. +* If the constraint identifier already exists in the list, the old value is +* overwritten. +* Constraint removal: Removes the identifier's entry from powerdomain's +* wakeup latency constraint list. +* +* Applies the strongest constraint value for the given pwrdm by calling +* pwrdm_wakeuplat_update_pwrst. +* +* Returns 0 upon success or a negative value in case of error. +* +* The caller must check the validity of the parameters. +*/ +int pwrdm_set_wkup_lat_constraint (struct powerdomain *pwrdm,void *cookie, +long min_latency) +{ +struct pwrdm_wkup_constraints_entry *user =NULL , *tmp_user; +int ret =0 ; +long value =0 ; +unsigned long flags; + +pr_debug ("powerdomain: %s: pwrdm %s, cookie=0x%p, min_latency=%ld\n" , + __func__, pwrdm->name, cookie, min_latency); + +/* Check if there already is a constraint for cookie */ +spin_lock_irqsave (&pwrdm->wkup_lat_plist_lock, flags); +plist_for_each_entry (tmp_user, &pwrdm->wkup_lat_plist_head, node) { +if (tmp_user->cookie == cookie) { + user = tmp_user; +break ; + } + } +spin_unlock_irqrestore (&pwrdm->wkup_lat_plist_lock, flags); + +if (min_latency >0 ) { +/* Nothing to update, job done */ +if (user && (user->node.prio == min_latency)) + goto exit_ok; + +/* Add new entry to the list or update existing request */ +if (!user) { + user =kzalloc ( +sizeof (struct pwrdm_wkup_constraints_entry ), +GFP_KERNEL ); +if (!user) { +pr_err ("%s: FATAL ERROR: kzalloc failed\n" , + __func__); + ret = -ENOMEM ; + goto exit_error; + } + user->cookie = cookie; + }else { +spin_lock_irqsave (&pwrdm->wkup_lat_plist_lock, flags); +plist_del (&user->node, &pwrdm->wkup_lat_plist_head); +spin_unlock_irqrestore (&pwrdm->wkup_lat_plist_lock, + flags); + } + +spin_lock_irqsave (&pwrdm->wkup_lat_plist_lock, flags); +plist_node_init (&user->node, min_latency); +plist_add (&user->node, &pwrdm->wkup_lat_plist_head); +spin_unlock_irqrestore (&pwrdm->wkup_lat_plist_lock, flags); + }else { +/* Remove the constraint from the list */ +if (!user) { +pr_err ("%s: Error: no prior constraint to release\n" , + __func__); + ret = -EINVAL ; + goto exit_error; + } + +spin_lock_irqsave (&pwrdm->wkup_lat_plist_lock, flags); +plist_del (&user->node, &pwrdm->wkup_lat_plist_head); +spin_unlock_irqrestore (&pwrdm->wkup_lat_plist_lock, flags); +kfree (user); + } + +exit_ok: +/* Find the strongest constraint from the list */ +if (!plist_head_empty (&pwrdm->wkup_lat_plist_head)) { +spin_lock_irqsave (&pwrdm->wkup_lat_plist_lock, flags); + value =plist_first (&pwrdm->wkup_lat_plist_head)->prio; +spin_unlock_irqrestore (&pwrdm->wkup_lat_plist_lock, flags); + } + +/* Apply the constraint to the pwrdm */ +pr_debug ("powerdomain: %s: pwrdm %s, value=%ld\n" , + __func__, pwrdm->name, value); +pwrdm_wakeuplat_update_pwrst (pwrdm, value); + +exit_error: +return ret; +} +/** * pwrdm_get_context_loss_count - get powerdomain's context loss count * @pwrdm: struct powerdomain * to wait for
arch/arm/mach-omap2/powerdomain.h +40 -2
78 lines not on this page · raw message
Signature · 1 line
1.7.2.5
PATCH v4 3/8 OMAP3: powerdomain data: add wake-up latency figures
In reply to jean.pihet at newoldbits.comFrom: Jean Pihet <[email protected]>
Figures are added to the power domains structs.
Note: the figures are preliminary figures. More accurate measurements are needed. Also the conditions of measurements shall be investigated and described.
Tested on OMAP3 Beagleboard in RET/OFF using wake-up latency constraints on MPU, CORE and PER.
--- arch/arm/mach-omap2/powerdomains3xxx_data.c | 84 ++++++++++++++++++++++++++- 1 files changed, 82 insertions(+), 2 deletions(-)
arch/arm/mach-omap2/powerdomains3xxx_data.c +82 -2
@@ -31,6 +31,13 @@/* * Powerdomains +* +* The wakeup_lat values are derived from measurements on +* the actual target. +* +* Note: the latency figures are preliminary and only used +* for the constraints framework validation. +* Actual figures and measurements conditions shall be added. */ static struct powerdomain iva2_pwrdm = {
@@ -52,6 +59,13 @@ static struct powerdomain iva2_pwrdm = { [2] = PWRSTS_OFF_ON, [3] = PWRSTS_ON, }, + .wakeup_lat = { + [PWRDM_FUNC_PWRST_OFF] = 1100, + [PWRDM_FUNC_PWRST_OSWR] = UNSUP_STATE, + [PWRDM_FUNC_PWRST_CSWR] = 350, + [PWRDM_FUNC_PWRST_INACTIVE] = UNSUP_STATE, + [PWRDM_FUNC_PWRST_ON] = 0, + }, };static struct powerdomain mpu_3xxx_pwrdm = {
@@ -60,7 +74,8 @@ static struct powerdomain mpu_3xxx_pwrdm = { .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430), .pwrsts = PWRSTS_OFF_RET_ON, .pwrsts_logic_ret = PWRSTS_OFF_RET, - .flags = PWRDM_HAS_MPU_QUIRK, + .flags =PWRDM_HAS_MPU_QUIRK | + PWRDM_USES_PM_QOS_CONSTRAINTS, .banks = 1, .pwrsts_mem_ret = { [0] = PWRSTS_OFF_RET,
@@ -68,6 +83,13 @@ static struct powerdomain mpu_3xxx_pwrdm = { .pwrsts_mem_on = { [0] = PWRSTS_OFF_ON, }, + .wakeup_lat = { + [PWRDM_FUNC_PWRST_OFF] = 95, + [PWRDM_FUNC_PWRST_OSWR] = UNSUP_STATE, + [PWRDM_FUNC_PWRST_CSWR] = 45, + [PWRDM_FUNC_PWRST_INACTIVE] = UNSUP_STATE, + [PWRDM_FUNC_PWRST_ON] = 0, + }, };/*
@@ -90,6 +112,7 @@ static struct powerdomain core_3xxx_pre_es3_1_pwrdm = { .pwrsts = PWRSTS_OFF_RET_ON, .pwrsts_logic_ret = PWRSTS_OFF_RET, .banks = 2, + .flags = PWRDM_USES_PM_QOS_CONSTRAINTS, .pwrsts_mem_ret = { [0] = PWRSTS_OFF_RET, /* MEM1RETSTATE */ [1] = PWRSTS_OFF_RET, /* MEM2RETSTATE */
@@ -98,6 +121,13 @@ static struct powerdomain core_3xxx_pre_es3_1_pwrdm = { [0] = PWRSTS_OFF_RET_ON, /* MEM1ONSTATE */ [1 ] =PWRSTS_OFF_RET_ON ,/* MEM2ONSTATE */ }, + .wakeup_lat = { + [PWRDM_FUNC_PWRST_OFF] = 100, + [PWRDM_FUNC_PWRST_OSWR] = UNSUP_STATE, + [PWRDM_FUNC_PWRST_CSWR] = 60, + [PWRDM_FUNC_PWRST_INACTIVE] = UNSUP_STATE, + [PWRDM_FUNC_PWRST_ON] = 0, + }, }; static struct powerdomain core_3xxx_es3_1_pwrdm = {
@@ -111,7 +141,8 @@ static struct powerdomain core_3xxx_es3_1_pwrdm = {* Setting the SAR flag for errata ID i478 which applies * to 3430 <= ES3.1 */ - .flags = PWRDM_HAS_HDWR_SAR, /* for USBTLL only */ + .flags = PWRDM_HAS_HDWR_SAR /* for USBTLL only */ | + PWRDM_USES_PM_QOS_CONSTRAINTS, .banks = 2, .pwrsts_mem_ret = { [0] = PWRSTS_OFF_RET, /* MEM1RETSTATE */
@@ -121,6 +152,13 @@ static struct powerdomain core_3xxx_es3_1_pwrdm = { [0] = PWRSTS_OFF_RET_ON, /* MEM1ONSTATE */ [1 ] =PWRSTS_OFF_RET_ON ,/* MEM2ONSTATE */ }, + .wakeup_lat = { + [PWRDM_FUNC_PWRST_OFF] = 100, + [PWRDM_FUNC_PWRST_OSWR] = UNSUP_STATE, + [PWRDM_FUNC_PWRST_CSWR] = 60, + [PWRDM_FUNC_PWRST_INACTIVE] = UNSUP_STATE, + [PWRDM_FUNC_PWRST_ON] = 0, + }, }; static struct powerdomain dss_pwrdm = {
@@ -136,6 +174,13 @@ static struct powerdomain dss_pwrdm = { .pwrsts_mem_on = { [0 ] =PWRSTS_ON ,/* MEMONSTATE */ }, + .wakeup_lat = { + [PWRDM_FUNC_PWRST_OFF] = 70, + [PWRDM_FUNC_PWRST_OSWR] = UNSUP_STATE, + [PWRDM_FUNC_PWRST_CSWR] = 20, + [PWRDM_FUNC_PWRST_INACTIVE] = UNSUP_STATE, + [PWRDM_FUNC_PWRST_ON] = 0, + }, };/*
@@ -157,6 +202,13 @@ static struct powerdomain sgx_pwrdm = { .pwrsts_mem_on = { [0 ] =PWRSTS_ON ,/* MEMONSTATE */ }, + .wakeup_lat = { + [PWRDM_FUNC_PWRST_OFF] = 1000, + [PWRDM_FUNC_PWRST_OSWR] = UNSUP_STATE, + [PWRDM_FUNC_PWRST_CSWR] = UNSUP_STATE, + [PWRDM_FUNC_PWRST_INACTIVE] = UNSUP_STATE, + [PWRDM_FUNC_PWRST_ON] = 0, + }, }; static struct powerdomain cam_pwrdm = {
@@ -172,6 +224,13 @@ static struct powerdomain cam_pwrdm = { .pwrsts_mem_on = { [0 ] =PWRSTS_ON ,/* MEMONSTATE */ }, + .wakeup_lat = { + [PWRDM_FUNC_PWRST_OFF] = 850, + [PWRDM_FUNC_PWRST_OSWR] = UNSUP_STATE, + [PWRDM_FUNC_PWRST_CSWR] = 35, + [PWRDM_FUNC_PWRST_INACTIVE] = UNSUP_STATE, + [PWRDM_FUNC_PWRST_ON] = 0, + }, }; static struct powerdomain per_pwrdm = {
@@ -187,6 +246,13 @@ static struct powerdomain per_pwrdm = { .pwrsts_mem_on = { [0 ] =PWRSTS_ON ,/* MEMONSTATE */ }, + .wakeup_lat = { + [PWRDM_FUNC_PWRST_OFF] = 200, + [PWRDM_FUNC_PWRST_OSWR] = UNSUP_STATE, + [PWRDM_FUNC_PWRST_CSWR] = 110, + [PWRDM_FUNC_PWRST_INACTIVE] = UNSUP_STATE, + [PWRDM_FUNC_PWRST_ON] = 0, + }, }; static struct powerdomain emu_pwrdm = {
@@ -201,6 +267,13 @@ static struct powerdomain neon_pwrdm = { .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430), .pwrsts = PWRSTS_OFF_RET_ON, .pwrsts_logic_ret = PWRSTS_RET, + .wakeup_lat = { + [PWRDM_FUNC_PWRST_OFF] = 200, + [PWRDM_FUNC_PWRST_OSWR] = UNSUP_STATE, + [PWRDM_FUNC_PWRST_CSWR] = 35, + [PWRDM_FUNC_PWRST_INACTIVE] = UNSUP_STATE, + [PWRDM_FUNC_PWRST_ON] = 0, + }, };static struct powerdomain usbhost_pwrdm = {
@@ -223,6 +296,13 @@ static struct powerdomain usbhost_pwrdm = { .pwrsts_mem_on = { [0 ] =PWRSTS_ON ,/* MEMONSTATE */ }, + .wakeup_lat = { + [PWRDM_FUNC_PWRST_OFF] = 800, + [PWRDM_FUNC_PWRST_OSWR] = UNSUP_STATE, + [PWRDM_FUNC_PWRST_CSWR] = 150, + [PWRDM_FUNC_PWRST_INACTIVE] = UNSUP_STATE, + [PWRDM_FUNC_PWRST_ON] = 0, + }, }; static struct powerdomain dpll1_pwrdm = {
Signature · 1 line
1.7.2.5
PATCH v4 4/8 OMAP2+: omap_hwmod: manage the omap_devices the wake-up latency constraints
In reply to jean.pihet at newoldbits.comFrom: Jean Pihet <[email protected]>
Hwmod is queried from the omap device layer to manage the power domains wake-up latency constraints. Hwmod retrieves the correct power domain and if it exists it calls the corresponding power domain function.
Tested on OMAP3 Beagleboard in RET/OFF using wake-up latency constraints on MPU, CORE and PER.
--- arch/arm/mach-omap2/omap_hwmod.c | 26 +++++++++++++++++++++++++- arch/arm/plat-omap/include/plat/omap_hwmod.h | 2 ++ 2 files changed, 27 insertions(+), 1 deletions(-)
arch/arm/mach-omap2/omap_hwmod.c +25 -1
@@ -142,6 +142,7 @@#include "powerdomain.h" #include <plat/clock.h> #include <plat/omap_hwmod.h> +#include <plat/omap_device.h> #include <plat/prcm.h> #include "cm2xxx_3xxx.h"
@@ -2322,11 +2323,34 @@ ohsps_unlock:return ret; } +/* +* omap_hwmod_set_wkup_constraint- set/release a wake-up latency constraint +* +* @oh: struct omap_hwmod* to which the target device belongs to. +* @cookie: identifier of the constraints list for @oh. +* @min_latency: the minimum allowed wake-up latency for @oh. +* +* Returns 0 upon success. +*/ +int omap_hwmod_set_wkup_lat_constraint (struct omap_hwmod *oh, +void *cookie,long min_latency) +{ +struct powerdomain *pwrdm =omap_hwmod_get_pwrdm (oh); + +if (!pwrdm) { +pr_err ("%s: Error: could not find powerdomain " +"for %s\n" , __func__, oh->name); +return -EINVAL ; + } + +return pwrdm_set_wkup_lat_constraint (pwrdm, cookie, min_latency); +} +/** * omap_hwmod_get_context_loss_count - get lost context count * @oh: struct omap_hwmod * * -* Query the powerdomain of of @oh to get the context loss +* Query the powerdomain of @oh to get the context loss * count for this device. * * Returns the context loss count of the powerdomain assocated with @oh
arch/arm/plat-omap/include/plat/omap_hwmod.h +2 -0
@@ -598,6 +598,8 @@ int omap_hwmod_for_each_by_class(const char *classname, void *user);int omap_hwmod_set_postsetup_state (struct omap_hwmod *oh,u8 state); +int omap_hwmod_set_wkup_lat_constraint (struct omap_hwmod *oh,void *cookie, +long min_latency);u32 omap_hwmod_get_context_loss_count (struct omap_hwmod *oh);int omap_hwmod_no_setup_reset (struct omap_hwmod *oh);
Signature · 1 line
1.7.2.5
PATCH v4 5/8 OMAP: PM CONSTRAINTS: add an enum for the classes of constraint
In reply to jean.pihet at newoldbits.comFrom: Jean Pihet <[email protected]>
Defined values in the enum:
- OMAP_PM_CONSTRAINT_WKUP_LAT
- OMAP_PM_CONSTRAINT_THROUGHPUT
More classes can be added later if needed.
Tested on OMAP3 Beagleboard in RET/OFF using wake-up latency constraints on MPU, CORE and PER.
--- arch/arm/plat-omap/include/plat/omap-pm.h | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
arch/arm/plat-omap/include/plat/omap-pm.h +4 -0
@@ -70,6 +70,10 @@ void omap_pm_if_exit(void);* Device-driver-originated constraints (via board-*.c files, platform_data) */ +enum omap_pm_constraint_class { +OMAP_PM_CONSTRAINT_WKUP_LAT , +OMAP_PM_CONSTRAINT_THROUGHPUT +};/** * omap_pm_set_max_mpu_wakeup_lat - set the maximum MPU wakeup latency
Signature · 1 line
1.7.2.5
PATCH v4 6/8 OMAP2+: omap_device: implement the constraints management code
In reply to jean.pihet at newoldbits.comFrom: Jean Pihet <[email protected]>
The code at omap device level manages the constraints: storage, tracking of requesters and dispatching to the low level code (e.g. powerdomain for the wake-up latency constraints).
Tested on OMAP3 Beagleboard in RET/OFF using wake-up latency constraints on MPU, CORE and PER.
--- arch/arm/plat-omap/include/plat/omap_device.h | 15 ++- arch/arm/plat-omap/omap_device.c | 191 +++++++++++++++++++++++++ 2 files changed, 205 insertions(+), 1 deletions(-)
arch/arm/plat-omap/include/plat/omap_device.h +14 -1
@@ -32,9 +32,11 @@#define __ARCH_ARM_PLAT_OMAP_INCLUDE_MACH_OMAP_DEVICE_H#include <linux/kernel.h> +#include <linux/plist.h> #include <linux/platform_device.h> #include <plat/omap_hwmod.h> +#include <plat/omap-pm.h> extern struct device omap_device_parent;
@@ -54,8 +56,8 @@ extern struct device omap_device_parent;* @pm_lat_level: array index of the last odpl entry executed - -1 if never * @dev_wakeup_lat: dev wakeup latency in nanoseconds * @_dev_wakeup_lat_limit: dev wakeup latency limit in nsec - set by OMAP PM +* @wkup_lat_plist_head: devices wake-up latency constraints list * @_state: one of OMAP_DEVICE_STATE_* (see above) -* @flags: device flags * * Integrates omap_hwmod data into Linux platform_device. *
@@ -67,6 +69,7 @@ struct omap_device {struct platform_device pdev;struct omap_hwmod **hwmods;struct omap_device_pm_latency *pm_lats; +struct plist_head wkup_lat_plist_head;u32 dev_wakeup_lat;u32 _dev_wakeup_lat_limit;u8 pm_lats_cnt;
@@ -75,6 +78,13 @@ struct omap_device {u8 _state; }; +/* Linked list for the devices constraints entries */ +struct omap_device_constraints_entry { +struct device *dev; +struct device *req_dev; +struct plist_node node; +}; +/* Device driver interface (call via platform_data fn ptrs) */ int omap_device_enable (struct platform_device *pdev);
@@ -107,6 +117,9 @@ void __iomem *omap_device_get_rt_va(struct omap_device *od);int omap_device_align_pm_lat (struct platform_device *pdev,u32 new_wakeup_lat_limit);struct powerdomain *omap_device_get_pwrdm (struct omap_device *od); +int omap_device_set_dev_constraint (enum omap_pm_constraint_class class, +struct device *req_dev, +struct device *dev,long t);u32 omap_device_get_context_loss_count (struct platform_device *pdev);/* Other */
arch/arm/plat-omap/omap_device.c +191 -0
213 lines not on this page · raw message
Signature · 1 line
1.7.2.5
PATCH 6/8 OMAP2+: omap_device: implement the constraints management code
Quoted 66 lines · On Wed, May 4, 2011 at 6:35 AM, <[email protected]> wrote:
...
arch/arm/plat-omap/omap_device.c +5
-0@@ -292,10 +292,196 @@ static void _add_optional_clock_clkdev(struct omap_device *od, } } +/* Spinlock that protects the constraints lists */ +static spinlock_t _constraints_lock; + +/* +* _store_constraint: add/update/remove a constraint from a plist. There is
+ * one plist peromap_device.
+ *
+ * @constraints_list: plist to use
+ * @req_dev: constraint requester, used to track the requests
+ * @dev: device constraint target, used to track the requests
+ * @value: constraint value. The plist is sorted by the value. -1 remove the
+ * constraint from the list
+ * @ascending: return the lowest constraint value if set to 1, return the
+ * highest value if not.
+ *
+ * Tracks the constraints byreq_devand dev.
+ * Returns the strongest constraint value for the given device, 0 in the
+ * case there is no constraint or a negative value in case of error.
+ *
+ * The caller must check the validity of the parameters.
+ */arch/arm/plat-omap/omap_device.c +12
-0+static long _store_constraint (struct plist_head *constraints_list, +struct device *req_dev,struct device *dev, +long value,int ascending) +{ +struct omap_device_constraints_entry *user =NULL , *tmp_user; +int ret =0 ; +unsigned long flags; + +/* Check if there already is a constraint for dev and req_dev */ +spin_lock_irqsave (&_constraints_lock, flags); +plist_for_each_entry (tmp_user, constraints_list, node) { + if ((tmp_user->req_dev == req_dev) && (tmp_user->dev ==dev)) {
arch/arm/plat-omap/omap_device.c +15
-0+ user = tmp_user; +break ; + } + } +spin_unlock_irqrestore (&_constraints_lock, flags); + +if (value >=0 ) { +/* Nothing to update, job done */ +if (user && (user->node.prio == value)) + goto exit_ok; + +/* Add new entry to the list or update existing request */ +if (!user) { + user = kzalloc( + sizeof(struct
omap_device_constraints_entry),arch/arm/plat-omap/omap_device.c +2
-0+ GFP_KERNEL); +if (!user) {
arch/arm/plat-omap/omap_device.c static void _add_optional_clock_clkdev(struct omap_device *od, · line 354
Quoted 10 lines
arch/arm/plat-omap/omap_device.c +10
-0+pr_err ("%s: FATAL ERROR: kzalloc failed\n" , + __func__); + ret = -ENOMEM ; + goto exit_error; + } + user->req_dev = req_dev; + user->dev = dev; + }else { +spin_lock_irqsave (&_constraints_lock, flags); +plist_del (&user->node, constraints_list);
spinlock was dropped, no ref counting, not safe to assume user is still valid.
arch/arm/plat-omap/omap_device.c static void _add_optional_clock_clkdev(struct omap_device *od, · line 359
Quoted 6 lines
arch/arm/plat-omap/omap_device.c +5
-0+spin_unlock_irqrestore (&_constraints_lock, flags); + } + +spin_lock_irqsave (&_constraints_lock, flags); +plist_node_init (&user->node, value);
and user may be invalid here
Quoted 8 lines
arch/arm/plat-omap/omap_device.c +6
-0+plist_add (&user->node, constraints_list); +spin_unlock_irqrestore (&_constraints_lock, flags); + }else { +/* Remove the constraint from the list */ +if (!user) { + pr_err("%s: Error: no prior constraint torelease\n",
arch/arm/plat-omap/omap_device.c static void _add_optional_clock_clkdev(struct omap_device *od, · line 372
Quoted 7 lines
arch/arm/plat-omap/omap_device.c +7
-0+ __func__); + ret = -EINVAL ; + goto exit_error; + } + +spin_lock_irqsave (&_constraints_lock, flags); +plist_del (&user->node, constraints_list);
and here
arch/arm/plat-omap/omap_device.c static void _add_optional_clock_clkdev(struct omap_device *od, · line 380
Quoted 9 lines
arch/arm/plat-omap/omap_device.c +8
-0+spin_unlock_irqrestore (&_constraints_lock, flags); +kfree (user); + } + +exit_ok: +/* Find the strongest constraint for the given device */ +if (!plist_head_empty (constraints_list)) { +spin_lock_irqsave (&_constraints_lock, flags);
Deref of plist_first/last() should happen after a plist_head_empty() check with the spinlock held.
Quoted 5 lines
arch/arm/plat-omap/omap_device.c +4
-0+if (ascending) { +/* Find the lowest (i.e. first) value */ + ret =plist_first (constraints_list)->prio; + }else {
arch/arm/plat-omap/omap_device.c static void _add_optional_clock_clkdev(struct omap_device *od, · line 393
Quoted 10 lines
arch/arm/plat-omap/omap_device.c +9
-0+/* Find the highest (i.e. last) value */ + ret =plist_last (constraints_list)->prio; + } +spin_unlock_irqrestore (&_constraints_lock, flags); + } + +exit_error: +return ret; +}
Todd
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20110504/49eafa40/attachment-0001.html>
PATCH v4 7/8 OMAP: PM CONSTRAINTS: implement wake-up latency constraints
In reply to jean.pihet at newoldbits.comFrom: Jean Pihet <[email protected]>
Implement the wake-up latency constraints using an internal unified function _set_dev_constraint at OMAP PM level, which calls the corresponding function at omap device level.
The actual constraints management code is at the omap device level.
Note: the bus throughput function is implemented but currently is a no-op.
Tested on OMAP3 Beagleboard in RET/OFF using wake-up latency constraints on MPU, CORE and PER.
--- arch/arm/plat-omap/omap-pm-constraints.c | 172 +++++++++++++++-------------- 1 files changed, 89 insertions(+), 83 deletions(-)
arch/arm/plat-omap/omap-pm-constraints.c +89 -83
@@ -24,6 +24,7 @@/* Interface documentation is in mach/omap-pm.h */ #include <plat/omap-pm.h> #include <plat/omap_device.h> +#include <plat/common.h> static bool off_mode_enabled;static u32 dummy_context_loss_counter;
@@ -32,119 +33,124 @@ static u32 dummy_context_loss_counter;* Device-driver-originated constraints (via board-*.c files) */ -int omap_pm_set_max_mpu_wakeup_lat (struct device *dev,long t) +/* +* Generic function to omap_device layer for the constraints API. +*/ +static int _set_dev_constraint (enum omap_pm_constraint_class class, +struct device *req_dev,struct device *dev, +long t) { -if (!dev || t <-1 ) { +int ret =0 ; + +if (!req_dev || !dev || t <-1 ) {WARN (1 ,"OMAP PM: %s: invalid parameter(s)" , __func__);return -EINVAL ; - }; - -if (t ==-1 ) -pr_debug ("OMAP PM: remove max MPU wakeup latency constraint: " -"dev %s\n" ,dev_name (dev)); -else -pr_debug ("OMAP PM: add max MPU wakeup latency constraint: " -"dev %s, t = %ld usec\n" ,dev_name (dev), t); + } -/* -* For current Linux, this needs to map the MPU to a -* powerdomain, then go through the list of current max lat -* constraints on the MPU and find the smallest. If -* the latency constraint has changed, the code should -* recompute the state to enter for the next powerdomain -* state. -* -* TI CDP code can call constraint_set here. -*/ +/* Only valid for omap_devices */ +if (dev->parent == &omap_device_parent) { +if (t ==-1 ) +pr_debug ("OMAP PM: remove constraint of class %d " +"from req_dev %s on dev %s\n" , + class,dev_name (req_dev),dev_name (dev)); +else +pr_debug ("OMAP PM: add constraint of class %d " +"from req_dev %s on dev %s, t = %ld\n" , + class,dev_name (req_dev),dev_name (dev), t); + + ret =omap_device_set_dev_constraint (class, req_dev, dev, t); + }else { +pr_err ("OMAP-PM: %s: Error: not an omap_device\n" , __func__); +return -EINVAL ; + } -return 0 ; +return ret; } +/* +* omap_pm_set_min_bus_tput - set/release bus throughput constraints +*/ int omap_pm_set_min_bus_tput (struct device *dev,u8 agent_id,unsigned long r) { +long t; +struct device *req_dev =NULL ; +if (!dev || (agent_id !=OCP_INITIATOR_AGENT && agent_id !=OCP_TARGET_AGENT )) {WARN (1 ,"OMAP PM: %s: invalid parameter(s)" , __func__);return -EINVAL ; }; +/* +* This code calls the generic omap_device API function +* _set_dev_constraint with the class OMAP_PM_CONSTRAINT_THROUGHPUT. +* _set_dev_constraint should manage the constraints lists and call +* the appropriate low level code that models the interconnect, +* computes the required clock frequency, converts that to a VDD2 +* OPP ID and sets the VDD2 OPP appropriately. +*/ + +/* +* A value of r == 0 removes the constraint. Convert it to the +* generic _set_dev_constraint convention (-1 for constraint removal) +*/ if (r ==0 ) -pr_debug ("OMAP PM: remove min bus tput constraint: " -"dev %s for agent_id %d\n" ,dev_name (dev), agent_id); + t =-1 ;else -pr_debug ("OMAP PM: add min bus tput constraint: " -"dev %s for agent_id %d: rate %ld KiB\n" , -dev_name (dev), agent_id, r); + t = r;/* -* This code should model the interconnect and compute the -* required clock frequency, convert that to a VDD2 OPP ID, then -* set the VDD2 OPP appropriately. -* -* TI CDP code can call constraint_set here on the VDD2 OPP. +* Assign the device for L3 or L4 interconnect to req_dev, +* based on the value of agent_id */ +switch (agent_id) { +case OCP_INITIATOR_AGENT : + req_dev =omap2_get_l3_device (); +break ; +case OCP_TARGET_AGENT : +/* Fixme: need the device for L4 interconnect */ +break ; + } -return 0 ; +return _set_dev_constraint (OMAP_PM_CONSTRAINT_THROUGHPUT , + req_dev, dev, t); } +/* +* omap_pm_set_max_dev_wakeup_lat - set/release devices wake-up latency +* constraints +*/ int omap_pm_set_max_dev_wakeup_lat (struct device *req_dev,struct device *dev,long t) { -if (!req_dev || !dev || t <-1 ) { -WARN (1 ,"OMAP PM: %s: invalid parameter(s)" , __func__); -return -EINVAL ; - }; - -if (t ==-1 ) -pr_debug ("OMAP PM: remove max device latency constraint: " -"dev %s\n" ,dev_name (dev)); -else -pr_debug ("OMAP PM: add max device latency constraint: " -"dev %s, t = %ld usec\n" ,dev_name (dev), t); - -/* -* For current Linux, this needs to map the device to a -* powerdomain, then go through the list of current max lat -* constraints on that powerdomain and find the smallest. If -* the latency constraint has changed, the code should -* recompute the state to enter for the next powerdomain -* state. Conceivably, this code should also determine -* whether to actually disable the device clocks or not, -* depending on how long it takes to re-enable the clocks. -* -* TI CDP code can call constraint_set here. -*/ - -return 0 ; +return _set_dev_constraint (OMAP_PM_CONSTRAINT_WKUP_LAT , req_dev, + dev, t); } -int omap_pm_set_max_sdma_lat (struct device *dev,long t) +/* +* omap_pm_set_max_mpu_wakeup_lat - set/release MPU wake-up latency +* constraints +* +* Maps to _set_dev_constraint with OMAP_PM_CONSTRAINT_WKUP_LAT +* as constraint class and the MPU device as constraints target. +*/ +int omap_pm_set_max_mpu_wakeup_lat (struct device *req_dev,long t) { -if (!dev || t <-1 ) { -WARN (1 ,"OMAP PM: %s: invalid parameter(s)" , __func__); -return -EINVAL ; - }; - -if (t ==-1 ) -pr_debug ("OMAP PM: remove max DMA latency constraint: " -"dev %s\n" ,dev_name (dev)); -else -pr_debug ("OMAP PM: add max DMA latency constraint: " -"dev %s, t = %ld usec\n" ,dev_name (dev), t); - -/* -* For current Linux PM QOS params, this code should scan the -* list of maximum CPU and DMA latencies and select the -* smallest, then set cpu_dma_latency pm_qos_param -* accordingly. -* -* For future Linux PM QOS params, with separate CPU and DMA -* latency params, this code should just set the dma_latency param. -* -* TI CDP code can call constraint_set here. -*/ +return _set_dev_constraint (OMAP_PM_CONSTRAINT_WKUP_LAT , req_dev, +omap2_get_mpuss_device (), t); +} -return 0 ; +/* +* omap_pm_set_max_sdma_lat - set/release SDMA start latency +* constraints +* +* Currently maps to _set_dev_constraint with OMAP_PM_CONSTRAINT_WKUP_LAT +* as constraint class and the L3 device as constraints target. +*/ +int omap_pm_set_max_sdma_lat (struct device *req_dev,long t) +{ +return _set_dev_constraint (OMAP_PM_CONSTRAINT_WKUP_LAT , req_dev, +omap2_get_l3_device (), t); }int omap_pm_set_min_clk_rate (struct device *dev,struct clk *c,long r)
Signature · 1 line
1.7.2.5
PATCH v4 8/8 OMAP PM: early init of the pwrdms states
In reply to jean.pihet at newoldbits.comFrom: Jean Pihet <[email protected]>
The powerdomains next states are initialized in pwrdms_setup as a late_initcall. Because the wake-up constraint can be requested early in the boot sequence, the power domains next states can be overwritten by pwrdms_setup.
This patch fixes it by initializing the power domains next states early at boot, so that the constraints can be applied. Later in the pwrdms_setup function the currently programmed next states are re-used as next state values.
Applies to OMAP3 and OMAP4.
Tested on OMAP3 Beagleboard in RET/OFF using wake-up latency constraints on MPU, CORE and PER.
--- arch/arm/mach-omap2/pm34xx.c | 2 +- arch/arm/mach-omap2/pm44xx.c | 2 +- arch/arm/mach-omap2/powerdomain.c | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-)
arch/arm/mach-omap2/pm34xx.c +1 -1
@@ -840,7 +840,7 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused)if (!pwrst)return -ENOMEM ; pwrst->pwrdm = pwrdm; - pwrst->next_state =PWRDM_POWER_RET ; + pwrst->next_state =pwrdm_read_next_pwrst (pwrdm);list_add (&pwrst->node, &pwrst_list);if (pwrdm_has_hdwr_sar (pwrdm))
arch/arm/mach-omap2/pm44xx.c +1 -1
@@ -84,7 +84,7 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused)if (!pwrst)return -ENOMEM ; pwrst->pwrdm = pwrdm; - pwrst->next_state =PWRDM_POWER_ON ; + pwrdm->state =pwrdm_read_pwrst (pwrdm);list_add (&pwrst->node, &pwrst_list);return pwrdm_set_next_pwrst (pwrst->pwrdm, pwrst->next_state);
arch/arm/mach-omap2/powerdomain.c +5 -0
@@ -78,6 +78,7 @@ static struct powerdomain *_pwrdm_lookup(const char *name)static int _pwrdm_register (struct powerdomain *pwrdm) {int i; +int next_state =PWRDM_POWER_RET ;if (!pwrdm || !pwrdm->name)return -EINVAL ;
@@ -114,6 +115,10 @@ static int _pwrdm_register(struct powerdomain *pwrdm)pwrdm_wait_transition (pwrdm); pwrdm->state =pwrdm_read_pwrst (pwrdm); pwrdm->state_counter[pwrdm->state] =1 ; +/* Early init of the next power state */ +if (cpu_is_omap44xx ()) + next_state =PWRDM_POWER_ON ; +pwrdm_set_next_pwrst (pwrdm, next_state);pr_debug ("powerdomain: registered %s\n" , pwrdm->name);
Signature · 1 line
1.7.2.5