Skip to contentSkip to conversation

OMAP3 : PM : Functions to get freq from opp and vice-versa

PATCH Superseded Sanjeev Premi 2 participants 3 messages Sep 9, 2009 – Oct 1, 2009

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 OMAP3 : PM : Functions to get freq from opp and vice-versa

There is no generic function to get OPP corresponding to frequency and vice versa.

Function get_opp() - in resource34xx.c - is included only when CONFIG_OMAP_PM_SRF is enabled. Moreover, it is always called with an explicit addition of MAX_VDDn_OPP e.g.
opp = get_opp(mpu_opps + MAX_VDD1_OPP, clk->rate); opp = get_opp(l3_opps + MAX_VDD2_OPP, clk->rate);

This is 'addition' is required as there is no encapsulation of MIN and MAX VDDs associated to the table.

This patch fixes the issue by creating a 'table' object that encapsulates the MIN and MAX values and the existing rate table.

---
 arch/arm/mach-omap2/omap3-opp.h           |   42 +++------------------
 arch/arm/mach-omap2/pm.c                  |   49 +++++++++++++++++++++++++
 arch/arm/mach-omap2/pm34xx.c              |   57 +++++++++++++++++++++++++++++
 arch/arm/plat-omap/include/mach/omap-pm.h |   25 +++++++++++++
 4 files changed, 137 insertions(+), 36 deletions(-)
arch/arm/mach-omap2/omap3-opp.h +6 -36
index 3c9a582..52deb4a 100644
@@ -21,42 +21,12 @@
 #define S83M    83000000
 #define S166M   166000000
 
-static struct omap_opp omap3_mpu_rate_table[] = {
-	{0, 0, 0},
-	/*OPP1*/
-	{S125M, VDD1_OPP1, 0x1E},
-	/*OPP2*/
-	{S250M, VDD1_OPP2, 0x26},
-	/*OPP3*/
-	{S500M, VDD1_OPP3, 0x30},
-	/*OPP4*/
-	{S550M, VDD1_OPP4, 0x36},
-	/*OPP5*/
-	{S600M, VDD1_OPP5, 0x3C},
-};
+extern struct omap_opp omap3_mpu_rate_table[];
+extern struct omap_opp omap3_dsp_rate_table[];
+extern struct omap_opp omap3_l3_rate_table[];
 
-static struct omap_opp omap3_l3_rate_table[] = {
-	{0, 0, 0},
-	/*OPP1*/
-	{0, VDD2_OPP1, 0x1E},
-	/*OPP2*/
-	{S83M, VDD2_OPP2, 0x24},
-	/*OPP3*/
-	{S166M, VDD2_OPP3, 0x2C},
-};
-
-static struct omap_opp omap3_dsp_rate_table[] = {
-	{0, 0, 0},
-	/*OPP1*/
-	{S90M, VDD1_OPP1, 0x1E},
-	/*OPP2*/
-	{S180M, VDD1_OPP2, 0x26},
-	/*OPP3*/
-	{S360M, VDD1_OPP3, 0x30},
-	/*OPP4*/
-	{S400M, VDD1_OPP4, 0x36},
-	/*OPP5*/
-	{S430M, VDD1_OPP5, 0x3C},
-};
+extern const struct omap_opp_table omap3_mpu_opp_table;
+extern const struct omap_opp_table omap3_dsp_opp_table;
+extern const struct omap_opp_table omap3_l3_opp_table;
 
 #endif
arch/arm/mach-omap2/pm.c +49 -0

58 lines not on this page · raw message

arch/arm/mach-omap2/pm34xx.c +57 -0

69 lines not on this page · raw message

arch/arm/plat-omap/include/mach/omap-pm.h +25 -0
index 583e540..cf910ef 100644
@@ -33,6 +33,20 @@ struct omap_opp {
 	u16 vsel;
 };
 
+/* struct omap_opp_table - View OPP table as an object
+ * @min: Minimum OPP id
+ * @max: Maximim OPP id
+ * @opps: Pointer to array defining the OPPs.
+ *
+ * An OPP table has varied length. Knowing minimum and maximum
+ * OPP ids allow easy traversal.
+ */
+struct omap_opp_table {
+	u8	min;
+	u8	max;
+	struct omap_opp* opps;
+};
+
 extern struct omap_opp *mpu_opps;
 extern struct omap_opp *dsp_opps;
 extern struct omap_opp *l3_opps;
@@ -49,6 +63,17 @@ extern struct omap_opp *l3_opps;
 #define OCP_INITIATOR_AGENT		2
 
 /**
+ *
+ */
+int opp_to_freq(unsigned long* freq, const struct omap_opp_table* table, u8 opp);
+
+/**
+ *
+ */
+int freq_to_opp(u8* opp, const struct omap_opp_table* table, unsigned long freq);
+
+
+/**
  * omap_pm_if_early_init - OMAP PM init code called before clock fw init
  * @mpu_opp_table: array ptr to struct omap_opp for MPU
  * @dsp_opp_table: array ptr to struct omap_opp for DSP
Signature · 1 line
1.6.2.2
#1 lore raw
Quoted 9 lines · Sanjeev Premi

There is no generic function to get OPP corresponding to frequency and vice versa.

Function get_opp() - in resource34xx.c - is included only when CONFIG_OMAP_PM_SRF is enabled. Moreover, it is always called with an explicit addition of MAX_VDDn_OPP e.g.
opp = get_opp(mpu_opps + MAX_VDD1_OPP, clk->rate); opp = get_opp(l3_opps + MAX_VDD2_OPP, clk->rate);

Quoted 7 lines

This is 'addition' is required as there is no encapsulation of MIN and MAX VDDs associated to the table.

This patch fixes the issue by creating a 'table' object that encapsulates the MIN and MAX values and the existing rate table.

Looks ok, minor comment below...

[...]

Quoted 26 lines
arch/arm/plat-omap/include/mach/omap-pm.h +14 -0
index 583e540..cf910ef 100644
@@ -33,6 +33,20 @@ struct omap_opp {
 	u16 vsel;
 };
 
+/* struct omap_opp_table - View OPP table as an object
+ * @min: Minimum OPP id
+ * @max: Maximim OPP id
+ * @opps: Pointer to array defining the OPPs.
+ *
+ * An OPP table has varied length. Knowing minimum and maximum
+ * OPP ids allow easy traversal.
+ */
+struct omap_opp_table {
+	u8	min;
+	u8	max;
+	struct omap_opp* opps;
+};
+
 extern struct omap_opp *mpu_opps;
 extern struct omap_opp *dsp_opps;
 extern struct omap_opp *l3_opps;

arch/arm/plat-omap/include/mach/omap-pm.h extern struct omap_opp *l3_opps; · line 67

Quoted 5 lines
arch/arm/plat-omap/include/mach/omap-pm.h +2 -0
@@ -49,6 +63,17 @@ extern struct omap_opp *l3_opps;
 #define OCP_INITIATOR_AGENT		2
 
 /**
+ *
+ */

Either add a useful comment or remove the comment block (preferably the latter)

arch/arm/plat-omap/include/mach/omap-pm.h extern struct omap_opp *l3_opps; · line 72

Quoted 5 lines
arch/arm/plat-omap/include/mach/omap-pm.h +5 -0
+int opp_to_freq(unsigned long* freq, const struct omap_opp_table* table, u8 opp);
+
+/**
+ *
+ */

ditto

Kevin

#2 lore raw
Quoted 23 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Kevin Hilman
Sent: Wednesday, September 30, 2009 11:48 PM
To: Premi, Sanjeev
Cc: [email protected]
Subject: Re: [PATCH] OMAP3 : PM : Functions to get freq from opp and vice-versa

Quoted 12 lines · Sanjeev Premi

There is no generic function to get OPP corresponding to frequency and vice versa.

Function get_opp() - in resource34xx.c - is included only when CONFIG_OMAP_PM_SRF is enabled. Moreover, it is always called with an explicit addition of MAX_VDDn_OPP e.g.
opp = get_opp(mpu_opps + MAX_VDD1_OPP, clk->rate); opp = get_opp(l3_opps + MAX_VDD2_OPP, clk->rate);

This is 'addition' is required as there is no encapsulation of MIN and MAX VDDs associated to the table.

Quoted 6 lines
Quoted 4 lines

This patch fixes the issue by creating a 'table' object that encapsulates the MIN and MAX values and the existing rate table.

Looks ok, minor comment below...

[sp] Will take care of the comments in the next patch.

Best regards,
Sanjeev

Quoted 56 lines

[...]

Review

Quoted 1 line
(quoted diff) +0 -0

b/arch/arm/plat-omap/include/mach/omap-pm.h

Quoted 25 lines

index 583e540..cf910ef 100644

arch/arm/plat-omap/include/mach/omap-pm.h +14 -0
@@ -33,6 +33,20 @@ struct omap_opp {
 	u16 vsel;
 };
 
+/* struct omap_opp_table - View OPP table as an object
+ * @min: Minimum OPP id
+ * @max: Maximim OPP id
+ * @opps: Pointer to array defining the OPPs.
+ *
+ * An OPP table has varied length. Knowing minimum and maximum
+ * OPP ids allow easy traversal.
+ */
+struct omap_opp_table {
+	u8	min;
+	u8	max;
+	struct omap_opp* opps;
+};
+
 extern struct omap_opp *mpu_opps;
 extern struct omap_opp *dsp_opps;
 extern struct omap_opp *l3_opps;

arch/arm/plat-omap/include/mach/omap-pm.h extern struct omap_opp *l3_opps; · line 67

Quoted 5 lines
arch/arm/plat-omap/include/mach/omap-pm.h +2 -0
@@ -49,6 +63,17 @@ extern struct omap_opp *l3_opps;
 #define OCP_INITIATOR_AGENT		2
 
 /**
+ *
+ */

Either add a useful comment or remove the comment block (preferably the latter)

arch/arm/plat-omap/include/mach/omap-pm.h extern struct omap_opp *l3_opps; · line 68

Quoted 1 line
arch/arm/plat-omap/include/mach/omap-pm.h +1 -0
+int opp_to_freq(unsigned long* freq, const struct 

omap_opp_table* table, u8 opp);

arch/arm/plat-omap/include/mach/omap-pm.h extern struct omap_opp *l3_opps; · line 72

Quoted 4 lines
arch/arm/plat-omap/include/mach/omap-pm.h +4 -0
+
+/**
+ *
+ */

ditto

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