[PATCH 3/8] OMAP2+: powerdomain: control power domains next state

2011-10-12 Thread jean . pihet
From: Jean Pihet j-pi...@ti.com

When a PM QoS device latency constraint is requested or removed the
PM QoS layer notifies the underlying layer with the updated aggregated
constraint value. The constraint is stored in the powerdomain constraints
list and then applied to the corresponding power domain.
The power domains get the next power state programmed directly in the
registers via pwrdm_wakeuplat_update_pwrst.

Tested on OMAP3 Beagleboard and OMAP4 Pandaboard in RET/OFF using
wake-up latency constraints on MPU, CORE and PER.

Signed-off-by: Jean Pihet j-pi...@ti.com
---
 arch/arm/mach-omap2/powerdomain.c |  200 +
 arch/arm/mach-omap2/powerdomain.h |   35 ++-
 2 files changed, 233 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/powerdomain.c 
b/arch/arm/mach-omap2/powerdomain.c
index 9af0847..50f5802 100644
--- a/arch/arm/mach-omap2/powerdomain.c
+++ b/arch/arm/mach-omap2/powerdomain.c
@@ -17,8 +17,10 @@
 #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 linux/pm_qos.h
 #include trace/events/power.h
 
 #include cm2xxx_3xxx.h
@@ -104,6 +106,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 data */
+   spin_lock_init(pwrdm-wkup_lat_plist_lock);
+   plist_head_init(pwrdm-wkup_lat_plist_head);
+   pwrdm-wkup_lat_next_state = PWRDM_POWER_OFF;
+
+   /* Initialize the pwrdm state */
pwrdm_wait_transition(pwrdm);
pwrdm-state = pwrdm_read_pwrst(pwrdm);
pwrdm-state_counter[pwrdm-state] = 1;
@@ -191,6 +199,84 @@ 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 PM_QOS_DEV_LAT_DEFAULT_VALUE 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.
+ * The power domains get the next power state programmed directly in the
+ * registers.
+ *
+ * Returns 0 in case of success, -EINVAL in case of invalid parameters,
+ * or the return value from omap_set_pwrdm_state.
+ */
+static int pwrdm_wakeuplat_update_pwrst(struct powerdomain *pwrdm,
+   long min_latency)
+{
+   int ret = 0, new_state;
+
+   if (!pwrdm) {
+   WARN(1, powerdomain: %s: invalid parameter(s), __func__);
+   return -EINVAL;
+   }
+
+   /*
+* Apply constraints to power domains by programming
+* the pwrdm next power state.
+*/
+
+   /*
+* Find the next supported power state with
+* wakeup latency  minimum constraint
+*/
+   for (new_state = 0x0; new_state  PWRDM_MAX_PWRSTS; new_state++) {
+   if (min_latency == PM_QOS_DEV_LAT_DEFAULT_VALUE)
+   break;
+   if ((pwrdm-wakeup_lat[new_state] != UNSUP_STATE) 
+   (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;
+   }
+
+   pwrdm-wkup_lat_next_state = new_state;
+   if (pwrdm_read_next_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 */
 
 /**
@@ -931,6 +1017,120 @@ int pwrdm_post_transition(void)
 }
 
 /**
+ * pwrdm_set_wkup_lat_constraint - Set/update/remove a 

[PATCH 3/8] OMAP2+: powerdomain: control power domains next state

2011-09-21 Thread Jean Pihet
When a PM QoS device latency constraint is requested or removed the
PM QoS layer notifies the underlying layer with the updated aggregated
constraint value. The constraint is stored in the powerdomain constraints
list and then applied to the corresponding power domain.
The power domains get the next power state programmed directly in the
registers via pwrdm_wakeuplat_update_pwrst.

Tested on OMAP3 Beagleboard and OMAP4 Pandaboard in RET/OFF using
wake-up latency constraints on MPU, CORE and PER.

Signed-off-by: Jean Pihet j-pi...@ti.com
---
 arch/arm/mach-omap2/powerdomain.c |  197 +
 arch/arm/mach-omap2/powerdomain.h |   35 ++-
 2 files changed, 230 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/powerdomain.c 
b/arch/arm/mach-omap2/powerdomain.c
index 9af0847..8fc0aaa 100644
--- a/arch/arm/mach-omap2/powerdomain.c
+++ b/arch/arm/mach-omap2/powerdomain.c
@@ -17,8 +17,10 @@
 #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 linux/pm_qos.h
 #include trace/events/power.h
 
 #include cm2xxx_3xxx.h
@@ -104,6 +106,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 data */
+   spin_lock_init(pwrdm-wkup_lat_plist_lock);
+   plist_head_init(pwrdm-wkup_lat_plist_head);
+   pwrdm-wkup_lat_next_state = PWRDM_POWER_OFF;
+
+   /* Initialize the pwrdm state */
pwrdm_wait_transition(pwrdm);
pwrdm-state = pwrdm_read_pwrst(pwrdm);
pwrdm-state_counter[pwrdm-state] = 1;
@@ -191,6 +199,83 @@ 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 PM_QOS_DEV_LAT_DEFAULT_VALUE 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.
+ * The power domains 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;
+
+   if (!pwrdm) {
+   WARN(1, powerdomain: %s: invalid parameter(s), __func__);
+   return -EINVAL;
+   }
+
+   /*
+* Apply constraints to power domains by programming
+* the pwrdm next power state.
+*/
+
+   /*
+* Find the next supported power state with
+* wakeup latency  minimum constraint
+*/
+   for (new_state = 0x0; new_state  PWRDM_MAX_PWRSTS; new_state++) {
+   if (min_latency == PM_QOS_DEV_LAT_DEFAULT_VALUE)
+   break;
+   if ((pwrdm-wakeup_lat[new_state] != UNSUP_STATE) 
+   (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;
+   }
+
+   pwrdm-wkup_lat_next_state = new_state;
+   if (pwrdm_read_next_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 +1015,118 @@ 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 

[PATCH 3/8] OMAP2+: powerdomain: control power domains next state

2011-09-21 Thread jean . pihet
From: Jean Pihet j-pi...@ti.com

When a PM QoS device latency constraint is requested or removed the
PM QoS layer notifies the underlying layer with the updated aggregated
constraint value. The constraint is stored in the powerdomain constraints
list and then applied to the corresponding power domain.
The power domains get the next power state programmed directly in the
registers via pwrdm_wakeuplat_update_pwrst.

Tested on OMAP3 Beagleboard and OMAP4 Pandaboard in RET/OFF using
wake-up latency constraints on MPU, CORE and PER.

Signed-off-by: Jean Pihet j-pi...@ti.com
---
 arch/arm/mach-omap2/powerdomain.c |  197 +
 arch/arm/mach-omap2/powerdomain.h |   35 ++-
 2 files changed, 230 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/powerdomain.c 
b/arch/arm/mach-omap2/powerdomain.c
index 9af0847..8fc0aaa 100644
--- a/arch/arm/mach-omap2/powerdomain.c
+++ b/arch/arm/mach-omap2/powerdomain.c
@@ -17,8 +17,10 @@
 #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 linux/pm_qos.h
 #include trace/events/power.h
 
 #include cm2xxx_3xxx.h
@@ -104,6 +106,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 data */
+   spin_lock_init(pwrdm-wkup_lat_plist_lock);
+   plist_head_init(pwrdm-wkup_lat_plist_head);
+   pwrdm-wkup_lat_next_state = PWRDM_POWER_OFF;
+
+   /* Initialize the pwrdm state */
pwrdm_wait_transition(pwrdm);
pwrdm-state = pwrdm_read_pwrst(pwrdm);
pwrdm-state_counter[pwrdm-state] = 1;
@@ -191,6 +199,83 @@ 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 PM_QOS_DEV_LAT_DEFAULT_VALUE 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.
+ * The power domains 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;
+
+   if (!pwrdm) {
+   WARN(1, powerdomain: %s: invalid parameter(s), __func__);
+   return -EINVAL;
+   }
+
+   /*
+* Apply constraints to power domains by programming
+* the pwrdm next power state.
+*/
+
+   /*
+* Find the next supported power state with
+* wakeup latency  minimum constraint
+*/
+   for (new_state = 0x0; new_state  PWRDM_MAX_PWRSTS; new_state++) {
+   if (min_latency == PM_QOS_DEV_LAT_DEFAULT_VALUE)
+   break;
+   if ((pwrdm-wakeup_lat[new_state] != UNSUP_STATE) 
+   (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;
+   }
+
+   pwrdm-wkup_lat_next_state = new_state;
+   if (pwrdm_read_next_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 +1015,118 @@ 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 

Re: [PATCH 3/8] OMAP2+: powerdomain: control power domains next state

2011-09-16 Thread Kevin Hilman
Jean Pihet jean.pi...@newoldbits.com writes:

 When a PM QoS device latency constraint is requested or removed the
 PM QoS layer notifies the underlying layer with the updated aggregated
 constraint value. The constraint is stored in the powerdomain constraints
 list and then applied to the corresponding power domain.
 The power domains get the next power state programmed directly in the
 registers via pwrdm_wakeuplat_update_pwrst.

 Tested on OMAP3 Beagleboard and OMAP4 Pandaboard in RET/OFF using
 wake-up latency constraints on MPU, CORE and PER.

 Signed-off-by: Jean Pihet j-pi...@ti.com

[...]

 @@ -191,6 +198,77 @@ 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 PM_QOS_DEV_LAT_DEFAULT_VALUE 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.
 + * The power domains 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 power domains 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 == PM_QOS_DEV_LAT_DEFAULT_VALUE ||
 + pwrdm-wakeup_lat[new_state] = min_latency)

Since min_latency is signed, this is a signed compare.  In later patches
you've defined the UNSUP_STATE to be -1, which will always be =
min_latency whn using a signed compare.

So, won't this always end up picking the first state marked as
UNSUP_STATE?

 + break;
 + }

Kevin
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/8] OMAP2+: powerdomain: control power domains next state

2011-09-02 Thread Jean Pihet
When a PM QoS device latency constraint is requested or removed the
PM QoS layer notifies the underlying layer with the updated aggregated
constraint value. The constraint is stored in the powerdomain constraints
list and then applied to the corresponding power domain.
The power domains get the next power state programmed directly in the
registers via pwrdm_wakeuplat_update_pwrst.

Tested on OMAP3 Beagleboard and OMAP4 Pandaboard in RET/OFF using
wake-up latency constraints on MPU, CORE and PER.

Signed-off-by: Jean Pihet j-pi...@ti.com
---
 arch/arm/mach-omap2/powerdomain.c |  190 +
 arch/arm/mach-omap2/powerdomain.h |   33 ++-
 2 files changed, 221 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/powerdomain.c 
b/arch/arm/mach-omap2/powerdomain.c
index 9af0847..afa8153 100644
--- a/arch/arm/mach-omap2/powerdomain.c
+++ b/arch/arm/mach-omap2/powerdomain.c
@@ -17,8 +17,10 @@
 #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 linux/pm_qos.h
 #include trace/events/power.h
 
 #include cm2xxx_3xxx.h
@@ -104,6 +106,11 @@ 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);
+
+   /* Initialize the pwrdm state */
pwrdm_wait_transition(pwrdm);
pwrdm-state = pwrdm_read_pwrst(pwrdm);
pwrdm-state_counter[pwrdm-state] = 1;
@@ -191,6 +198,77 @@ 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 PM_QOS_DEV_LAT_DEFAULT_VALUE 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.
+ * The power domains 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 power domains 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 == PM_QOS_DEV_LAT_DEFAULT_VALUE ||
+   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_next_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 +1008,118 @@ 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 PM_QOS_DEV_LAT_DEFAULT_VALUE removes
+ *  the constraint.
+