Re: [PATCH] OMAP3: SRF: Fix latency resource target value computations

2009-10-13 Thread Kevin Hilman
Rajendra Nayak rna...@ti.com writes:

 The Shared resource framework currently considers the highest requested
 level for a resource as the target level to be set. This works for OPP
 and frequency resources as they are used to model performace based
 constraints. However for latency based constraints/resources the least 
 requested
 level should be the one considered for the target level. This patch fixes
 the issue by having an additional flag to identify the different types
 of resources. Currently supported ones are Performace resources and
 latency resources.

 Signed-off-by: Rajendra Nayak rna...@ti.com

Thanks, pulling into PM branch.

Kevin

 ---
  arch/arm/mach-omap2/resource34xx.c |4 ++--
  arch/arm/mach-omap2/resource34xx.h |   16 
  arch/arm/plat-omap/include/mach/resource.h |9 -
  arch/arm/plat-omap/resource.c  |   20 ++--
  4 files changed, 40 insertions(+), 9 deletions(-)

 diff --git a/arch/arm/mach-omap2/resource34xx.c 
 b/arch/arm/mach-omap2/resource34xx.c
 index 491e1dc..e1a540e 100644
 --- a/arch/arm/mach-omap2/resource34xx.c
 +++ b/arch/arm/mach-omap2/resource34xx.c
 @@ -41,7 +41,7 @@
  void init_latency(struct shared_resource *resp)
  {
   resp-no_of_users = 0;
 - resp-curr_level = RES_DEFAULTLEVEL;
 + resp-curr_level = RES_LATENCY_DEFAULTLEVEL;
   *((u8 *)resp-resource_data) = 0;
   return;
  }
 @@ -65,7 +65,7 @@ int set_latency(struct shared_resource *resp, u32 latency)
   resp-curr_level = latency;
  
   pm_qos_req_added = resp-resource_data;
 - if (latency == RES_DEFAULTLEVEL)
 + if (latency == RES_LATENCY_DEFAULTLEVEL)
   /* No more users left, remove the pm_qos_req if present */
   if (*pm_qos_req_added) {
   pm_qos_remove_requirement(PM_QOS_CPU_DMA_LATENCY,
 diff --git a/arch/arm/mach-omap2/resource34xx.h 
 b/arch/arm/mach-omap2/resource34xx.h
 index 3c70eef..918a76c 100644
 --- a/arch/arm/mach-omap2/resource34xx.h
 +++ b/arch/arm/mach-omap2/resource34xx.h
 @@ -49,6 +49,7 @@ static struct shared_resource_ops lat_res_ops = {
  static struct shared_resource mpu_latency = {
   .name   = mpu_latency,
   .omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
 + .flags  = RES_TYPE_LATENCY,
   .resource_data  = mpu_qos_req_added,
   .ops= lat_res_ops,
  };
 @@ -56,6 +57,7 @@ static struct shared_resource mpu_latency = {
  static struct shared_resource core_latency = {
   .name   = core_latency,
   .omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
 + .flags  = RES_TYPE_LATENCY,
   .resource_data  = core_qos_req_added,
   .ops= lat_res_ops,
  };
 @@ -91,6 +93,7 @@ static struct shared_resource_ops pd_lat_res_ops = {
  static struct shared_resource core_pwrdm_latency = {
   .name   = core_pwrdm_latency,
   .omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
 + .flags  = RES_TYPE_LATENCY,
   .resource_data  = core_qos_req_added,
   .ops= lat_res_ops,
  };
 @@ -106,6 +109,7 @@ static struct pd_latency_db iva2_pwrdm_lat_db = {
  static struct shared_resource iva2_pwrdm_latency = {
   .name   = iva2_pwrdm_latency,
   .omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
 + .flags  = RES_TYPE_LATENCY,
   .resource_data  = iva2_pwrdm_lat_db,
   .ops= pd_lat_res_ops,
  };
 @@ -129,6 +133,7 @@ static struct pd_latency_db sgx_pwrdm_lat_db = {
  static struct shared_resource gfx_pwrdm_latency = {
   .name   = gfx_pwrdm_latency,
   .omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP3430ES1),
 + .flags  = RES_TYPE_LATENCY,
   .resource_data  = gfx_pwrdm_lat_db,
   .ops= pd_lat_res_ops,
  };
 @@ -136,6 +141,7 @@ static struct shared_resource gfx_pwrdm_latency = {
  static struct shared_resource sgx_pwrdm_latency = {
   .name   = sgx_pwrdm_latency,
   .omap_chip  = OMAP_CHIP_INIT(CHIP_GE_OMAP3430ES2),
 + .flags  = RES_TYPE_LATENCY,
   .resource_data  = sgx_pwrdm_lat_db,
   .ops= pd_lat_res_ops,
  };
 @@ -151,6 +157,7 @@ static struct pd_latency_db dss_pwrdm_lat_db = {
  static struct shared_resource dss_pwrdm_latency = {
   .name   = dss_pwrdm_latency,
   .omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
 + .flags  = RES_TYPE_LATENCY,
   .resource_data  = dss_pwrdm_lat_db,
   .ops= pd_lat_res_ops,
  };
 @@ -166,6 +173,7 @@ static struct pd_latency_db cam_pwrdm_lat_db = {
  static struct shared_resource cam_pwrdm_latency = {
   .name   = cam_pwrdm_latency,
   .omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
 + .flags  = RES_TYPE_LATENCY,
   .resource_data  = cam_pwrdm_lat_db,
   .ops= pd_lat_res_ops,
  };
 @@ -181,6 +189,7 @@ static struct pd_latency_db 

[PATCH] OMAP3: SRF: Fix latency resource target value computations

2009-10-06 Thread Rajendra Nayak
The Shared resource framework currently considers the highest requested
level for a resource as the target level to be set. This works for OPP
and frequency resources as they are used to model performace based
constraints. However for latency based constraints/resources the least requested
level should be the one considered for the target level. This patch fixes
the issue by having an additional flag to identify the different types
of resources. Currently supported ones are Performace resources and
latency resources.

Signed-off-by: Rajendra Nayak rna...@ti.com
---
 arch/arm/mach-omap2/resource34xx.c |4 ++--
 arch/arm/mach-omap2/resource34xx.h |   16 
 arch/arm/plat-omap/include/mach/resource.h |9 -
 arch/arm/plat-omap/resource.c  |   20 ++--
 4 files changed, 40 insertions(+), 9 deletions(-)

diff --git a/arch/arm/mach-omap2/resource34xx.c 
b/arch/arm/mach-omap2/resource34xx.c
index 491e1dc..e1a540e 100644
--- a/arch/arm/mach-omap2/resource34xx.c
+++ b/arch/arm/mach-omap2/resource34xx.c
@@ -41,7 +41,7 @@
 void init_latency(struct shared_resource *resp)
 {
resp-no_of_users = 0;
-   resp-curr_level = RES_DEFAULTLEVEL;
+   resp-curr_level = RES_LATENCY_DEFAULTLEVEL;
*((u8 *)resp-resource_data) = 0;
return;
 }
@@ -65,7 +65,7 @@ int set_latency(struct shared_resource *resp, u32 latency)
resp-curr_level = latency;
 
pm_qos_req_added = resp-resource_data;
-   if (latency == RES_DEFAULTLEVEL)
+   if (latency == RES_LATENCY_DEFAULTLEVEL)
/* No more users left, remove the pm_qos_req if present */
if (*pm_qos_req_added) {
pm_qos_remove_requirement(PM_QOS_CPU_DMA_LATENCY,
diff --git a/arch/arm/mach-omap2/resource34xx.h 
b/arch/arm/mach-omap2/resource34xx.h
index 3c70eef..918a76c 100644
--- a/arch/arm/mach-omap2/resource34xx.h
+++ b/arch/arm/mach-omap2/resource34xx.h
@@ -49,6 +49,7 @@ static struct shared_resource_ops lat_res_ops = {
 static struct shared_resource mpu_latency = {
.name   = mpu_latency,
.omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
+   .flags  = RES_TYPE_LATENCY,
.resource_data  = mpu_qos_req_added,
.ops= lat_res_ops,
 };
@@ -56,6 +57,7 @@ static struct shared_resource mpu_latency = {
 static struct shared_resource core_latency = {
.name   = core_latency,
.omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
+   .flags  = RES_TYPE_LATENCY,
.resource_data  = core_qos_req_added,
.ops= lat_res_ops,
 };
@@ -91,6 +93,7 @@ static struct shared_resource_ops pd_lat_res_ops = {
 static struct shared_resource core_pwrdm_latency = {
.name   = core_pwrdm_latency,
.omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
+   .flags  = RES_TYPE_LATENCY,
.resource_data  = core_qos_req_added,
.ops= lat_res_ops,
 };
@@ -106,6 +109,7 @@ static struct pd_latency_db iva2_pwrdm_lat_db = {
 static struct shared_resource iva2_pwrdm_latency = {
.name   = iva2_pwrdm_latency,
.omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
+   .flags  = RES_TYPE_LATENCY,
.resource_data  = iva2_pwrdm_lat_db,
.ops= pd_lat_res_ops,
 };
@@ -129,6 +133,7 @@ static struct pd_latency_db sgx_pwrdm_lat_db = {
 static struct shared_resource gfx_pwrdm_latency = {
.name   = gfx_pwrdm_latency,
.omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP3430ES1),
+   .flags  = RES_TYPE_LATENCY,
.resource_data  = gfx_pwrdm_lat_db,
.ops= pd_lat_res_ops,
 };
@@ -136,6 +141,7 @@ static struct shared_resource gfx_pwrdm_latency = {
 static struct shared_resource sgx_pwrdm_latency = {
.name   = sgx_pwrdm_latency,
.omap_chip  = OMAP_CHIP_INIT(CHIP_GE_OMAP3430ES2),
+   .flags  = RES_TYPE_LATENCY,
.resource_data  = sgx_pwrdm_lat_db,
.ops= pd_lat_res_ops,
 };
@@ -151,6 +157,7 @@ static struct pd_latency_db dss_pwrdm_lat_db = {
 static struct shared_resource dss_pwrdm_latency = {
.name   = dss_pwrdm_latency,
.omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
+   .flags  = RES_TYPE_LATENCY,
.resource_data  = dss_pwrdm_lat_db,
.ops= pd_lat_res_ops,
 };
@@ -166,6 +173,7 @@ static struct pd_latency_db cam_pwrdm_lat_db = {
 static struct shared_resource cam_pwrdm_latency = {
.name   = cam_pwrdm_latency,
.omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
+   .flags  = RES_TYPE_LATENCY,
.resource_data  = cam_pwrdm_lat_db,
.ops= pd_lat_res_ops,
 };
@@ -181,6 +189,7 @@ static struct pd_latency_db per_pwrdm_lat_db = {
 static struct shared_resource per_pwrdm_latency = {
.name