public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/4] OPP layer: hide OPP implementation details
@ 2009-12-18 23:05 Kevin Hilman
  2009-12-18 23:05 ` [PATCH v2 1/4] OMAP OPP: Add accessor function for getting OPP ID Kevin Hilman
  0 siblings, 1 reply; 11+ messages in thread
From: Kevin Hilman @ 2009-12-18 23:05 UTC (permalink / raw)
  To: linux-omap; +Cc: nm

This series continues on top of Paul's OPP cleanup series and aims to
completly hide the OPP layer implementation details.  

To do this, a couple more another accessor 
functions have been added so current SR/SRF code can still function.

The goal here is to allow continued OPP layer cleanup and possibly
alternate implementations to be done in parallel with the ongoing
SR/SRF rework efforts.

Unless I hear some objections, this series will be added onto my
pm-wip-opp branch after some more thorough testing.

Tested on OMAP3EVM, RX51

Changes from v1:
- actually works
- Fix SRF indexing after initial terminators were removed
- dropped opp_find_by_index() in favor of changing SRF remove indexing.

Kevin Hilman (4):
  OMAP OPP: Add accessor function for getting OPP ID.
  OMAP SRF: adjust OPP array access
  OMAP SR/SRF: use OPP API for OPP ID, remove direct access
  OMAP OPP: hide struct omap_opp internals in OPP layer implementation

 arch/arm/mach-omap2/resource34xx.c    |    6 +++---
 arch/arm/mach-omap2/smartreflex.c     |    4 ++--
 arch/arm/plat-omap/include/plat/opp.h |   20 ++------------------
 arch/arm/plat-omap/opp.c              |   24 ++++++++++++++++++++++++
 4 files changed, 31 insertions(+), 23 deletions(-)


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v2 1/4] OMAP OPP: Add accessor function for getting OPP ID.
  2009-12-18 23:05 [PATCH v2 0/4] OPP layer: hide OPP implementation details Kevin Hilman
@ 2009-12-18 23:05 ` Kevin Hilman
  2009-12-18 23:05   ` [PATCH v2 2/4] OMAP SRF: adjust OPP array access Kevin Hilman
                     ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Kevin Hilman @ 2009-12-18 23:05 UTC (permalink / raw)
  To: linux-omap; +Cc: nm

Add new function opp_get_opp_id() for finding the OPP ID of a given
OPP.  This allows us to further hide OPP layer details.

NOTE: OPP IDs are deprecated, and this function will eventually
      be removed after all users of OPP IDs are removed.

Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
---
 arch/arm/plat-omap/include/plat/opp.h |    1 +
 arch/arm/plat-omap/opp.c              |    5 +++++
 2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/arch/arm/plat-omap/include/plat/opp.h b/arch/arm/plat-omap/include/plat/opp.h
index cdadf67..6fe574c 100644
--- a/arch/arm/plat-omap/include/plat/opp.h
+++ b/arch/arm/plat-omap/include/plat/opp.h
@@ -243,6 +243,7 @@ int opp_disable(struct omap_opp *opp);
 
 struct omap_opp * __deprecated opp_find_by_opp_id(struct omap_opp *opps,
 						  u8 opp_id);
+u8 __deprecated opp_get_opp_id(struct omap_opp *opp);
 
 void opp_init_cpufreq_table(struct omap_opp *opps,
 			    struct cpufreq_frequency_table **table);
diff --git a/arch/arm/plat-omap/opp.c b/arch/arm/plat-omap/opp.c
index e7b6f2a..4f7fa22 100644
--- a/arch/arm/plat-omap/opp.c
+++ b/arch/arm/plat-omap/opp.c
@@ -69,6 +69,11 @@ struct omap_opp * __deprecated opp_find_by_opp_id(struct omap_opp *opps,
 	return NULL;
 }
 
+u8 __deprecated opp_get_opp_id(struct omap_opp *opp)
+{
+	return opp->opp_id;
+}
+
 int opp_get_opp_count(struct omap_opp *oppl)
 {
 	u8 n = 0;
-- 
1.6.6.rc2.1.g42108


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v2 2/4] OMAP SRF: adjust OPP array access
  2009-12-18 23:05 ` [PATCH v2 1/4] OMAP OPP: Add accessor function for getting OPP ID Kevin Hilman
@ 2009-12-18 23:05   ` Kevin Hilman
  2009-12-18 23:05     ` [PATCH v2 3/4] OMAP SR/SRF: use OPP API for OPP ID, remove direct access Kevin Hilman
  2009-12-19 12:00     ` [PATCH v2 2/4] OMAP SRF: adjust OPP array access Menon, Nishanth
  2009-12-19 11:56   ` [PATCH v2 1/4] OMAP OPP: Add accessor function for getting OPP ID Menon, Nishanth
  2009-12-21  7:11   ` Romit Dasgupta
  2 siblings, 2 replies; 11+ messages in thread
From: Kevin Hilman @ 2009-12-18 23:05 UTC (permalink / raw)
  To: linux-omap; +Cc: nm

With the initial terminators removed from the OPP struct arrarys,
the direct indexing of the array needs to be adjusted by one.

Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
---
 arch/arm/mach-omap2/resource34xx.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/resource34xx.c b/arch/arm/mach-omap2/resource34xx.c
index 05e70b7..1fa8bb5 100644
--- a/arch/arm/mach-omap2/resource34xx.c
+++ b/arch/arm/mach-omap2/resource34xx.c
@@ -337,8 +337,8 @@ static int program_opp(int res, struct omap_opp *opp, int target_level,
 #ifdef CONFIG_OMAP_SMARTREFLEX
 	unsigned long t_opp, c_opp;
 
-	t_opp = ID_VDD(res) | ID_OPP_NO(opp[target_level].opp_id);
-	c_opp = ID_VDD(res) | ID_OPP_NO(opp[current_level].opp_id);
+	t_opp = ID_VDD(res) | ID_OPP_NO(opp[target_level - 1].opp_id);
+	c_opp = ID_VDD(res) | ID_OPP_NO(opp[current_level - 1].opp_id);
 #endif
 
 	/* See if have a freq associated, if not, invalid opp */
-- 
1.6.6.rc2.1.g42108


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v2 3/4] OMAP SR/SRF: use OPP API for OPP ID, remove direct access
  2009-12-18 23:05   ` [PATCH v2 2/4] OMAP SRF: adjust OPP array access Kevin Hilman
@ 2009-12-18 23:05     ` Kevin Hilman
  2009-12-18 23:05       ` [PATCH v2 4/4] OMAP OPP: hide struct omap_opp internals in OPP layer implementation Kevin Hilman
  2009-12-19 12:03       ` [PATCH v2 3/4] OMAP SR/SRF: use OPP API for OPP ID, remove direct access Menon, Nishanth
  2009-12-19 12:00     ` [PATCH v2 2/4] OMAP SRF: adjust OPP array access Menon, Nishanth
  1 sibling, 2 replies; 11+ messages in thread
From: Kevin Hilman @ 2009-12-18 23:05 UTC (permalink / raw)
  To: linux-omap; +Cc: nm

SR and SRF currenly direclty access OPP struct internals.  Use new
accessor function to get OPP ID.

Also SRF was doing doing direct access of the OPP struct array using a
convoluted conversion from a 'level' to an OPP ID, when they're
actually the same thing.

Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
---
 arch/arm/mach-omap2/resource34xx.c |    6 +++---
 arch/arm/mach-omap2/smartreflex.c  |    4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-omap2/resource34xx.c b/arch/arm/mach-omap2/resource34xx.c
index 1fa8bb5..31b8af2 100644
--- a/arch/arm/mach-omap2/resource34xx.c
+++ b/arch/arm/mach-omap2/resource34xx.c
@@ -204,7 +204,7 @@ static int __deprecated freq_to_opp(u8 *opp_id, struct omap_opp *opps,
 	opp = opp_find_freq_ceil(opps, &freq);
 	if (IS_ERR(opp))
 		return -EINVAL;
-	*opp_id = opp->opp_id;
+	*opp_id = opp_get_opp_id(opp);
 	return 0;
 }
 
@@ -337,8 +337,8 @@ static int program_opp(int res, struct omap_opp *opp, int target_level,
 #ifdef CONFIG_OMAP_SMARTREFLEX
 	unsigned long t_opp, c_opp;
 
-	t_opp = ID_VDD(res) | ID_OPP_NO(opp[target_level - 1].opp_id);
-	c_opp = ID_VDD(res) | ID_OPP_NO(opp[current_level - 1].opp_id);
+	t_opp = ID_VDD(res) | ID_OPP_NO(target_level - 1);
+	c_opp = ID_VDD(res) | ID_OPP_NO(current_level - 1);
 #endif
 
 	/* See if have a freq associated, if not, invalid opp */
diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c
index 9c0d5bf..d341857 100644
--- a/arch/arm/mach-omap2/smartreflex.c
+++ b/arch/arm/mach-omap2/smartreflex.c
@@ -159,7 +159,7 @@ static u8 get_vdd1_opp(void)
 	if (IS_ERR(opp))
 		return 0;
 
-	return opp->opp_id;
+	return opp_get_opp_id(opp);
 }
 
 static u8 get_vdd2_opp(void)
@@ -174,7 +174,7 @@ static u8 get_vdd2_opp(void)
 	if (IS_ERR(opp))
 		return 0;
 
-	return opp->opp_id;
+	return opp_get_opp_id(opp);
 }
 
 
-- 
1.6.6.rc2.1.g42108


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v2 4/4] OMAP OPP: hide struct omap_opp internals in OPP layer implementation
  2009-12-18 23:05     ` [PATCH v2 3/4] OMAP SR/SRF: use OPP API for OPP ID, remove direct access Kevin Hilman
@ 2009-12-18 23:05       ` Kevin Hilman
  2009-12-19 12:04         ` Menon, Nishanth
  2009-12-19 12:03       ` [PATCH v2 3/4] OMAP SR/SRF: use OPP API for OPP ID, remove direct access Menon, Nishanth
  1 sibling, 1 reply; 11+ messages in thread
From: Kevin Hilman @ 2009-12-18 23:05 UTC (permalink / raw)
  To: linux-omap; +Cc: nm

Now that we have accessor/helper functions for all the OPP layer
details, move 'struct omap_opp' into the OPP layer so no direct
accesses to OPP internals can be done.

Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
---
 arch/arm/plat-omap/include/plat/opp.h |   19 +------------------
 arch/arm/plat-omap/opp.c              |   19 +++++++++++++++++++
 2 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/arch/arm/plat-omap/include/plat/opp.h b/arch/arm/plat-omap/include/plat/opp.h
index 6fe574c..9f91ad3 100644
--- a/arch/arm/plat-omap/include/plat/opp.h
+++ b/arch/arm/plat-omap/include/plat/opp.h
@@ -17,24 +17,7 @@ extern struct omap_opp *mpu_opps;
 extern struct omap_opp *dsp_opps;
 extern struct omap_opp *l3_opps;
 
-/**
- * struct omap_opp - OMAP OPP description structure
- * @enabled:	true/false - marking this OPP as enabled/disabled
- * @rate:	Frequency in hertz
- * @opp_id:	(DEPRECATED) opp identifier
- * @u_volt:     minimum microvolts DC required for this OPP to function
- *
- * This structure stores the OPP information for a given domain.
- * Due to legacy reasons, this structure is currently exposed and
- * will soon be removed elsewhere and will only be used as a handle
- * from the OPP internal referencing mechanism
- */
-struct omap_opp {
-	bool enabled;
-	unsigned long rate;
-	unsigned long u_volt;
-	u8 __deprecated opp_id;
-};
+struct omap_opp;
 
 /**
  * opp_get_voltage() - Gets the voltage corresponding to an opp
diff --git a/arch/arm/plat-omap/opp.c b/arch/arm/plat-omap/opp.c
index 4f7fa22..4fe1933 100644
--- a/arch/arm/plat-omap/opp.c
+++ b/arch/arm/plat-omap/opp.c
@@ -19,6 +19,25 @@
 #include <plat/opp_twl_tps.h>
 #include <plat/opp.h>
 
+/**
+ * struct omap_opp - OMAP OPP description structure
+ * @enabled:	true/false - marking this OPP as enabled/disabled
+ * @rate:	Frequency in hertz
+ * @opp_id:	(DEPRECATED) opp identifier
+ * @u_volt:     minimum microvolts DC required for this OPP to function
+ *
+ * This structure stores the OPP information for a given domain.
+ * Due to legacy reasons, this structure is currently exposed and
+ * will soon be removed elsewhere and will only be used as a handle
+ * from the OPP internal referencing mechanism
+ */
+struct omap_opp {
+	bool enabled;
+	unsigned long rate;
+	unsigned long u_volt;
+	u8 opp_id;
+};
+
 /*
  * DEPRECATED: Meant to detect end of opp array
  * This is meant to help co-exist with current SRF etc
-- 
1.6.6.rc2.1.g42108


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 1/4] OMAP OPP: Add accessor function for getting OPP ID.
  2009-12-18 23:05 ` [PATCH v2 1/4] OMAP OPP: Add accessor function for getting OPP ID Kevin Hilman
  2009-12-18 23:05   ` [PATCH v2 2/4] OMAP SRF: adjust OPP array access Kevin Hilman
@ 2009-12-19 11:56   ` Menon, Nishanth
  2009-12-21  7:11   ` Romit Dasgupta
  2 siblings, 0 replies; 11+ messages in thread
From: Menon, Nishanth @ 2009-12-19 11:56 UTC (permalink / raw)
  To: Kevin Hilman; +Cc: linux-omap@vger.kernel.org

Kevin Hilman said the following on 12/19/2009 04:35 AM:
> Add new function opp_get_opp_id() for finding the OPP ID of a given
> OPP.  This allows us to further hide OPP layer details.
>
> NOTE: OPP IDs are deprecated, and this function will eventually
>       be removed after all users of OPP IDs are removed.
>
> Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
> ---
>  arch/arm/plat-omap/include/plat/opp.h |    1 +
>  arch/arm/plat-omap/opp.c              |    5 +++++
>  2 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/plat-omap/include/plat/opp.h b/arch/arm/plat-omap/include/plat/opp.h
> index cdadf67..6fe574c 100644
> --- a/arch/arm/plat-omap/include/plat/opp.h
> +++ b/arch/arm/plat-omap/include/plat/opp.h
> @@ -243,6 +243,7 @@ int opp_disable(struct omap_opp *opp);
>  
>  struct omap_opp * __deprecated opp_find_by_opp_id(struct omap_opp *opps,
>  						  u8 opp_id);
> +u8 __deprecated opp_get_opp_id(struct omap_opp *opp);
>   
Sigh.. ok... been trying to avoid this precisely :(
Acked-by: Nishanth Menon <nm@ti.com>
>  
>  void opp_init_cpufreq_table(struct omap_opp *opps,
>  			    struct cpufreq_frequency_table **table);
> diff --git a/arch/arm/plat-omap/opp.c b/arch/arm/plat-omap/opp.c
> index e7b6f2a..4f7fa22 100644
> --- a/arch/arm/plat-omap/opp.c
> +++ b/arch/arm/plat-omap/opp.c
> @@ -69,6 +69,11 @@ struct omap_opp * __deprecated opp_find_by_opp_id(struct omap_opp *opps,
>  	return NULL;
>  }
>  
> +u8 __deprecated opp_get_opp_id(struct omap_opp *opp)
> +{
> +	return opp->opp_id;
> +}
> +
>  int opp_get_opp_count(struct omap_opp *oppl)
>  {
>  	u8 n = 0;
>   


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 2/4] OMAP SRF: adjust OPP array access
  2009-12-18 23:05   ` [PATCH v2 2/4] OMAP SRF: adjust OPP array access Kevin Hilman
  2009-12-18 23:05     ` [PATCH v2 3/4] OMAP SR/SRF: use OPP API for OPP ID, remove direct access Kevin Hilman
@ 2009-12-19 12:00     ` Menon, Nishanth
  1 sibling, 0 replies; 11+ messages in thread
From: Menon, Nishanth @ 2009-12-19 12:00 UTC (permalink / raw)
  To: Kevin Hilman; +Cc: linux-omap@vger.kernel.org

Kevin Hilman said the following on 12/19/2009 04:35 AM:
> With the initial terminators removed from the OPP struct arrarys,
> the direct indexing of the array needs to be adjusted by one.
>
> Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
> ---
>  arch/arm/mach-omap2/resource34xx.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/resource34xx.c b/arch/arm/mach-omap2/resource34xx.c
> index 05e70b7..1fa8bb5 100644
> --- a/arch/arm/mach-omap2/resource34xx.c
> +++ b/arch/arm/mach-omap2/resource34xx.c
> @@ -337,8 +337,8 @@ static int program_opp(int res, struct omap_opp *opp, int target_level,
>  #ifdef CONFIG_OMAP_SMARTREFLEX
>  	unsigned long t_opp, c_opp;
>  
> -	t_opp = ID_VDD(res) | ID_OPP_NO(opp[target_level].opp_id);
> -	c_opp = ID_VDD(res) | ID_OPP_NO(opp[current_level].opp_id);
> +	t_opp = ID_VDD(res) | ID_OPP_NO(opp[target_level - 1].opp_id);
> +	c_opp = ID_VDD(res) | ID_OPP_NO(opp[current_level - 1].opp_id);
>  #endif
>   
Acked-by: Nishanth Menon <nm@ti.com>
>  
>  	/* See if have a freq associated, if not, invalid opp */
>   


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 3/4] OMAP SR/SRF: use OPP API for OPP ID, remove direct access
  2009-12-18 23:05     ` [PATCH v2 3/4] OMAP SR/SRF: use OPP API for OPP ID, remove direct access Kevin Hilman
  2009-12-18 23:05       ` [PATCH v2 4/4] OMAP OPP: hide struct omap_opp internals in OPP layer implementation Kevin Hilman
@ 2009-12-19 12:03       ` Menon, Nishanth
  2009-12-22 16:16         ` Kevin Hilman
  1 sibling, 1 reply; 11+ messages in thread
From: Menon, Nishanth @ 2009-12-19 12:03 UTC (permalink / raw)
  To: Kevin Hilman; +Cc: linux-omap@vger.kernel.org

Kevin Hilman said the following on 12/19/2009 04:35 AM:
> SR and SRF currenly direclty access OPP struct internals.  Use new
> accessor function to get OPP ID.
>
> Also SRF was doing doing direct access of the OPP struct array using a
> convoluted conversion from a 'level' to an OPP ID, when they're
> actually the same thing.
>
> Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
> ---
>  arch/arm/mach-omap2/resource34xx.c |    6 +++---
>  arch/arm/mach-omap2/smartreflex.c  |    4 ++--
>  2 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/resource34xx.c b/arch/arm/mach-omap2/resource34xx.c
> index 1fa8bb5..31b8af2 100644
> --- a/arch/arm/mach-omap2/resource34xx.c
> +++ b/arch/arm/mach-omap2/resource34xx.c
> @@ -204,7 +204,7 @@ static int __deprecated freq_to_opp(u8 *opp_id, struct omap_opp *opps,
>  	opp = opp_find_freq_ceil(opps, &freq);
>  	if (IS_ERR(opp))
>  		return -EINVAL;
> -	*opp_id = opp->opp_id;
> +	*opp_id = opp_get_opp_id(opp);
>  	return 0;
>  }
>  
> @@ -337,8 +337,8 @@ static int program_opp(int res, struct omap_opp *opp, int target_level,
>  #ifdef CONFIG_OMAP_SMARTREFLEX
>  	unsigned long t_opp, c_opp;
>  
> -	t_opp = ID_VDD(res) | ID_OPP_NO(opp[target_level - 1].opp_id);
> -	c_opp = ID_VDD(res) | ID_OPP_NO(opp[current_level - 1].opp_id);
> +	t_opp = ID_VDD(res) | ID_OPP_NO(target_level - 1);
> +	c_opp = ID_VDD(res) | ID_OPP_NO(current_level - 1);
>   
not sure of this.
target_level = 3,
opp[target_level - 1].opp_id ==3
BUT,
target_level -1 = 2

these are not the same.
>  #endif
>  
>  	/* See if have a freq associated, if not, invalid opp */
> diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c
> index 9c0d5bf..d341857 100644
> --- a/arch/arm/mach-omap2/smartreflex.c
> +++ b/arch/arm/mach-omap2/smartreflex.c
> @@ -159,7 +159,7 @@ static u8 get_vdd1_opp(void)
>  	if (IS_ERR(opp))
>  		return 0;
>  
> -	return opp->opp_id;
> +	return opp_get_opp_id(opp);
>  }
>  
>  static u8 get_vdd2_opp(void)
> @@ -174,7 +174,7 @@ static u8 get_vdd2_opp(void)
>  	if (IS_ERR(opp))
>  		return 0;
>  
> -	return opp->opp_id;
> +	return opp_get_opp_id(opp);
>  }
>  
>  
>   


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 4/4] OMAP OPP: hide struct omap_opp internals in OPP layer implementation
  2009-12-18 23:05       ` [PATCH v2 4/4] OMAP OPP: hide struct omap_opp internals in OPP layer implementation Kevin Hilman
@ 2009-12-19 12:04         ` Menon, Nishanth
  0 siblings, 0 replies; 11+ messages in thread
From: Menon, Nishanth @ 2009-12-19 12:04 UTC (permalink / raw)
  To: Kevin Hilman; +Cc: linux-omap@vger.kernel.org

Kevin Hilman said the following on 12/19/2009 04:35 AM:
> Now that we have accessor/helper functions for all the OPP layer
> details, move 'struct omap_opp' into the OPP layer so no direct
> accesses to OPP internals can be done.
>
> Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
> ---
>  arch/arm/plat-omap/include/plat/opp.h |   19 +------------------
>  arch/arm/plat-omap/opp.c              |   19 +++++++++++++++++++
>  2 files changed, 20 insertions(+), 18 deletions(-)
>
> diff --git a/arch/arm/plat-omap/include/plat/opp.h b/arch/arm/plat-omap/include/plat/opp.h
> index 6fe574c..9f91ad3 100644
> --- a/arch/arm/plat-omap/include/plat/opp.h
> +++ b/arch/arm/plat-omap/include/plat/opp.h
> @@ -17,24 +17,7 @@ extern struct omap_opp *mpu_opps;
>  extern struct omap_opp *dsp_opps;
>  extern struct omap_opp *l3_opps;
>  
> -/**
> - * struct omap_opp - OMAP OPP description structure
> - * @enabled:	true/false - marking this OPP as enabled/disabled
> - * @rate:	Frequency in hertz
> - * @opp_id:	(DEPRECATED) opp identifier
> - * @u_volt:     minimum microvolts DC required for this OPP to function
> - *
> - * This structure stores the OPP information for a given domain.
> - * Due to legacy reasons, this structure is currently exposed and
> - * will soon be removed elsewhere and will only be used as a handle
> - * from the OPP internal referencing mechanism
> - */
> -struct omap_opp {
> -	bool enabled;
> -	unsigned long rate;
> -	unsigned long u_volt;
> -	u8 __deprecated opp_id;
> -};
> +struct omap_opp;
>  
>  /**
>   * opp_get_voltage() - Gets the voltage corresponding to an opp
> diff --git a/arch/arm/plat-omap/opp.c b/arch/arm/plat-omap/opp.c
> index 4f7fa22..4fe1933 100644
> --- a/arch/arm/plat-omap/opp.c
> +++ b/arch/arm/plat-omap/opp.c
> @@ -19,6 +19,25 @@
>  #include <plat/opp_twl_tps.h>
>  #include <plat/opp.h>
>  
> +/**
> + * struct omap_opp - OMAP OPP description structure
> + * @enabled:	true/false - marking this OPP as enabled/disabled
> + * @rate:	Frequency in hertz
> + * @opp_id:	(DEPRECATED) opp identifier
> + * @u_volt:     minimum microvolts DC required for this OPP to function
> + *
> + * This structure stores the OPP information for a given domain.
> + * Due to legacy reasons, this structure is currently exposed and
> + * will soon be removed elsewhere and will only be used as a handle
> + * from the OPP internal referencing mechanism
> + */
> +struct omap_opp {
> +	bool enabled;
> +	unsigned long rate;
> +	unsigned long u_volt;
> +	u8 opp_id;
> +};
> +
>  /*
>   * DEPRECATED: Meant to detect end of opp array
>   * This is meant to help co-exist with current SRF etc
>   
big time ACK if we can fix the 2/3 patch
Acked-by: Nishanth Menon <nm@ti.com>
Thanks.

Regards,
Nishanth Menon


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 1/4] OMAP OPP: Add accessor function for getting OPP ID.
  2009-12-18 23:05 ` [PATCH v2 1/4] OMAP OPP: Add accessor function for getting OPP ID Kevin Hilman
  2009-12-18 23:05   ` [PATCH v2 2/4] OMAP SRF: adjust OPP array access Kevin Hilman
  2009-12-19 11:56   ` [PATCH v2 1/4] OMAP OPP: Add accessor function for getting OPP ID Menon, Nishanth
@ 2009-12-21  7:11   ` Romit Dasgupta
  2 siblings, 0 replies; 11+ messages in thread
From: Romit Dasgupta @ 2009-12-21  7:11 UTC (permalink / raw)
  To: Kevin Hilman; +Cc: linux-omap@vger.kernel.org, Menon, Nishanth

Kevin,
        Some comments below:
Kevin Hilman wrote:
> Add new function opp_get_opp_id() for finding the OPP ID of a given
> OPP.  This allows us to further hide OPP layer details.
> 
> NOTE: OPP IDs are deprecated, and this function will eventually
>       be removed after all users of OPP IDs are removed.
Let us not add a deprecated function. If we are fixing this let us fix it right
the first time.
>  
> +u8 __deprecated opp_get_opp_id(struct omap_opp *opp)
> +{
> +	return opp->opp_id;
> +}
> +
>  int opp_get_opp_count(struct omap_opp *oppl)
>  {
>  	u8 n = 0;


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 3/4] OMAP SR/SRF: use OPP API for OPP ID, remove direct access
  2009-12-19 12:03       ` [PATCH v2 3/4] OMAP SR/SRF: use OPP API for OPP ID, remove direct access Menon, Nishanth
@ 2009-12-22 16:16         ` Kevin Hilman
  0 siblings, 0 replies; 11+ messages in thread
From: Kevin Hilman @ 2009-12-22 16:16 UTC (permalink / raw)
  To: nm; +Cc: linux-omap@vger.kernel.org

"Menon, Nishanth" <nm@ti.com> writes:

> Kevin Hilman said the following on 12/19/2009 04:35 AM:
>> SR and SRF currenly direclty access OPP struct internals.  Use new
>> accessor function to get OPP ID.
>>
>> Also SRF was doing doing direct access of the OPP struct array using a
>> convoluted conversion from a 'level' to an OPP ID, when they're
>> actually the same thing.
>>
>> Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
>> ---
>>  arch/arm/mach-omap2/resource34xx.c |    6 +++---
>>  arch/arm/mach-omap2/smartreflex.c  |    4 ++--
>>  2 files changed, 5 insertions(+), 5 deletions(-)
>>
>> diff --git a/arch/arm/mach-omap2/resource34xx.c b/arch/arm/mach-omap2/resource34xx.c
>> index 1fa8bb5..31b8af2 100644
>> --- a/arch/arm/mach-omap2/resource34xx.c
>> +++ b/arch/arm/mach-omap2/resource34xx.c
>> @@ -204,7 +204,7 @@ static int __deprecated freq_to_opp(u8 *opp_id, struct omap_opp *opps,
>>  	opp = opp_find_freq_ceil(opps, &freq);
>>  	if (IS_ERR(opp))
>>  		return -EINVAL;
>> -	*opp_id = opp->opp_id;
>> +	*opp_id = opp_get_opp_id(opp);
>>  	return 0;
>>  }
>>  @@ -337,8 +337,8 @@ static int program_opp(int res, struct omap_opp
>> *opp, int target_level,
>>  #ifdef CONFIG_OMAP_SMARTREFLEX
>>  	unsigned long t_opp, c_opp;
>>  -	t_opp = ID_VDD(res) | ID_OPP_NO(opp[target_level - 1].opp_id);
>> -	c_opp = ID_VDD(res) | ID_OPP_NO(opp[current_level - 1].opp_id);
>> +	t_opp = ID_VDD(res) | ID_OPP_NO(target_level - 1);
>> +	c_opp = ID_VDD(res) | ID_OPP_NO(current_level - 1);
>>   
> not sure of this.
> target_level = 3,
> opp[target_level - 1].opp_id ==3
> BUT,
> target_level -1 = 2
> these are not the same.

Hmm, good catch.

Now that it's not being used as index into OPP array, I should be
using target level directly.

Will update in pm-wip-opp.

Kevin



>>  #endif
>>   	/* See if have a freq associated, if not, invalid opp */
>> diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c
>> index 9c0d5bf..d341857 100644
>> --- a/arch/arm/mach-omap2/smartreflex.c
>> +++ b/arch/arm/mach-omap2/smartreflex.c
>> @@ -159,7 +159,7 @@ static u8 get_vdd1_opp(void)
>>  	if (IS_ERR(opp))
>>  		return 0;
>>  -	return opp->opp_id;
>> +	return opp_get_opp_id(opp);
>>  }
>>   static u8 get_vdd2_opp(void)
>> @@ -174,7 +174,7 @@ static u8 get_vdd2_opp(void)
>>  	if (IS_ERR(opp))
>>  		return 0;
>>  -	return opp->opp_id;
>> +	return opp_get_opp_id(opp);
>>  }
>>     
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2009-12-22 16:16 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-18 23:05 [PATCH v2 0/4] OPP layer: hide OPP implementation details Kevin Hilman
2009-12-18 23:05 ` [PATCH v2 1/4] OMAP OPP: Add accessor function for getting OPP ID Kevin Hilman
2009-12-18 23:05   ` [PATCH v2 2/4] OMAP SRF: adjust OPP array access Kevin Hilman
2009-12-18 23:05     ` [PATCH v2 3/4] OMAP SR/SRF: use OPP API for OPP ID, remove direct access Kevin Hilman
2009-12-18 23:05       ` [PATCH v2 4/4] OMAP OPP: hide struct omap_opp internals in OPP layer implementation Kevin Hilman
2009-12-19 12:04         ` Menon, Nishanth
2009-12-19 12:03       ` [PATCH v2 3/4] OMAP SR/SRF: use OPP API for OPP ID, remove direct access Menon, Nishanth
2009-12-22 16:16         ` Kevin Hilman
2009-12-19 12:00     ` [PATCH v2 2/4] OMAP SRF: adjust OPP array access Menon, Nishanth
2009-12-19 11:56   ` [PATCH v2 1/4] OMAP OPP: Add accessor function for getting OPP ID Menon, Nishanth
2009-12-21  7:11   ` Romit Dasgupta

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox