Skip to contentSkip to conversation

OMAP OPP layer

PATCH In review Kevin Hilman 1 participant 6 messages Aug 11, 2010

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

cover OMAP OPP layer

This series introduces a layer to manage Operating Performance Points (OPPs) for OMAP SoCs.

Special thanks to Nishanth for doing the bulk of the grunt work for this series and to Thara for doing significant review, testing and updates.

Kevin Hilman (1):
omap3: pm: remove OPP interfaces from OMAP PM layer

Nishanth Menon (1):
OMAP: introduce OPP layer for device-specific OPPs

Paul Walmsley (1):
omap: opp: twl/tps: Introduce TWL/TPS-specific code

Thara Gopinath (1):
OMAP: Remove dependency of generic opp layer on cpufreq.

 Documentation/arm/OMAP/omap_pm                |   93 +++++
 arch/arm/mach-omap2/io.c                      |    3 +-
 arch/arm/plat-omap/Makefile                   |    8 +-
 arch/arm/plat-omap/include/plat/omap-pm.h     |   31 +-
 arch/arm/plat-omap/include/plat/opp.h         |  160 ++++++++
 arch/arm/plat-omap/include/plat/opp_twl_tps.h |   21 +
 arch/arm/plat-omap/omap-pm-noop.c             |   11 +-
 arch/arm/plat-omap/opp.c                      |  513 +++++++++++++++++++++++++
 arch/arm/plat-omap/opp_twl_tps.c              |   41 ++
 9 files changed, 847 insertions(+), 34 deletions(-)
 create mode 100644 arch/arm/plat-omap/include/plat/opp.h
 create mode 100644 arch/arm/plat-omap/include/plat/opp_twl_tps.h
 create mode 100644 arch/arm/plat-omap/opp.c
 create mode 100644 arch/arm/plat-omap/opp_twl_tps.c
Signature · 1 line
1.7.2.1
#1 lore raw

PATCH 1/4 OMAP: introduce OPP layer for device-specific OPPs

From: Nishanth Menon <[email protected]>

OMAP SOCs have a standard set of tuples consisting of frequency and voltage pairs that the device will support per voltage domain. These are called Operating Performance Points or OPPs. The actual definitions of OMAP Operating Points varies over silicon within the same family of devices. For a specific domain, you can have a set of {frequency, voltage} pairs. As the kernel boots and more information is available, a set of these are activated based on the precise nature of device the kernel boots up on. It is interesting to remember that each IP which belongs to a voltage domain may define their own set of OPPs on top of this.

This introduces a common handling OPP mechanism accross all OMAPs. As a start this is used for OMAP3.

Note: OPP is a concept that can be used in all OMAPs, it is hence introduced under plat-omap

Contributions include:
Sanjeev Premi for the initial concept:

	http://patchwork.kernel.org/patch/50998/

Kevin Hilman for converting original design to device-based Kevin Hilman and Paul Walmsey for cleaning up many of the function abstractions, improvements and data structure handling Romit Dasgupta for using enums instead of opp pointers Thara Gopinath, Eduardo Valentin and Vishwanath BS for fixes and cleanups.

Discussions and comments from:
http://marc.info/?l=linux-omap&m=126033945313269&w=2
http://marc.info/?l=linux-omap&m=125482970102327&w=2
http://marc.info/?t=125809247500002&r=1&w=2
http://marc.info/?l=linux-omap&m=126025973426007&w=2
incorporated.

Cc Benoit Cousson <[email protected]>
Cc Madhusudhan Chikkature Rajashekar <[email protected]>
Cc Phil Carmody <[email protected]>
Cc Roberto Granados Dorado <[email protected]>
Cc Santosh Shilimkar <[email protected]>
Cc Sergio Alberto Aguirre Rodriguez <[email protected]>
Cc Tero Kristo <[email protected]>
---
 Documentation/arm/OMAP/omap_pm        |   93 ++++++
 arch/arm/plat-omap/Makefile           |    5 +
 arch/arm/plat-omap/include/plat/opp.h |  160 ++++++++++
 arch/arm/plat-omap/opp.c              |  513 +++++++++++++++++++++++++++++++++
 4 files changed, 771 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/plat-omap/include/plat/opp.h
 create mode 100644 arch/arm/plat-omap/opp.c
Documentation/arm/OMAP/omap_pm +93 -0
index 5389440..b046ebc 100644
@@ -127,3 +127,96 @@ implementation needs:
 10. (*pdata->cpu_set_freq)(unsigned long f)
 
 11. (*pdata->cpu_get_freq)(void)
+
+OMAP OPP Layer
+==============
+OMAP SOCs have a standard set of tuples consisting of frequency and
+voltage pairs that the device will support per voltage domain. This
+is called Operating Performance Point or OPP. The actual definitions
+of OMAP OPP varies over silicon within the same family of devices.
+For a specific domain, you can have a set of {frequency, voltage}
+pairs. As the kernel boots and more information is available, a set
+of these are activated based on the precise nature of device the kernel
+boots up on. It is interesting to remember that each IP which belongs
+to a voltage domain may define their own set of OPPs on top of this.
+
+OPP layer of its own depends on silicon specific implementation and
+board specific data to finalize on the final set of OPPs available
+in a system
+
+Initial list initialization:
+---------------------------
+The normal initialization sequence is for boardxyz_init_irq to call
+omap2_init_common_hw (for omap2+) and which in turn does the default
+setup required.
+
+Silicon specific initialization: First the OPP layer needs to be told
+to initialize the tables for OMAP3, there are two options here:
+a) If the desire is to use the default tables defined for that silicon,
+the board file does not need to call any initialization function, the
+defaults are setup as part of initialization flow when
+omap2_init_common_hw is called.
+
+b) board files would like to customize the default definition. In this
+case, board file needs to call explicitly prior to table operations.
+the sequence is:
+boardxyz_init_irq()
+{
+	... do things ..
+	omap3_pm_init_opp_table()
+	.. customizations and other things ..
+	omap2_init_common_hw()
+}
+1. omap3_pm_init_opp_table - this in turn calls opp_init_list for all
+OPP types. This is the generic silicon operating points, however, the
+system may have additional features or customizations required. This
+flexibility is provided by the following apis:
+
+Query functions:
+----------------
+Search for OPPs for various cases:
+2. opp_find_freq_exact - exact search function
+3. opp_find_freq_floor - round_up search function
+4. opp_find_freq_ceil - round_down search function
+
+OPP modifier functions:
+----------------------
+This allows opp layer users to add customized OPPs or change the table
+for any need they may have
+5. opp_add - add a new OPP - NOTE: use struct omap_opp_def and define
+the custom OPP with OMAP_OPP_DEF for usage.
+6. opp_enable - enable a disabled OPP
+7. opp_disable - disable an enabled OPP
+
+OPP Data retrieval functions:
+----------------------------
+The following sets of functions are useful for drivers to retrieve
+data stored in opp layer for various functions.
+8. opp_get_voltage - retrieve voltage for an opp
+9. opp_get_freq - get the frequency for an opp
+10. opp_get_opp_count - get number of opps enabled for a domain
+
+Cpufreq table generation:
+------------------------
+11. opp_init_cpufreq_table - this translates the OPP layer's internal
+OPP arrangement into a table understood and operated upon by the
+cpufreq layer.
+
+Deprecated functions:
+--------------------
+To maintain compatibility with out of tree drivers, opp_id is needed.
+OPP IDs are not constant across silicon families, nor are they constant
+within a given silicon family. The rest of the layers should stop using
+these functions at the earliest. For the out of tree drivers currently,
+This is exposed by the following deprecated functions:
+12. opp_find_by_opp_id - get an OPP for an OPP ID
+13. opp_get_opp_id - get the OPP ID for an OPP
+
+Data Structures:
+---------------
+struct omap_opp * is a handle structure whose internals are known only
+to the OPP layer and is meant to hide the complexity away from users of
+opp layer.
+
+struct omap_opp_def * is the definitions that users can interface with
+opp layer and is meant to define one OPP.
arch/arm/plat-omap/Makefile +5 -0
index 9405831..70b012d 100644
@@ -12,6 +12,11 @@ obj-  :=
 # OCPI interconnect support for 1710, 1610 and 5912
 obj-$(CONFIG_ARCH_OMAP16XX) += ocpi.o
 
+# OPP support in (OMAP3+ only at the moment)
+ifdef CONFIG_CPU_FREQ
+obj-$(CONFIG_ARCH_OMAP3) += opp.o
+endif
+
 # omap_device support (OMAP2+ only at the moment)
 obj-$(CONFIG_ARCH_OMAP2) += omap_device.o
 obj-$(CONFIG_ARCH_OMAP3) += omap_device.o
arch/arm/plat-omap/include/plat/opp.h new file +160 -0

160 lines not on this page · raw message

arch/arm/plat-omap/opp.c new file +513 -0

513 lines not on this page · raw message

Signature · 1 line
1.7.2.1
#2 lore raw

PATCH 2/4 omap: opp: twl/tps: Introduce TWL/TPS-specific code

In reply to Kevin Hilman

From: Paul Walmsley <[email protected]>

The OPP layer code should be independent of the PMIC, introduce the TWL/TPS-specific code out to its own file.

---
 arch/arm/plat-omap/Makefile                   |    1 +
 arch/arm/plat-omap/include/plat/opp_twl_tps.h |   21 +++++++++++++
 arch/arm/plat-omap/opp_twl_tps.c              |   41 +++++++++++++++++++++++++
 3 files changed, 63 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/plat-omap/include/plat/opp_twl_tps.h
 create mode 100644 arch/arm/plat-omap/opp_twl_tps.c
arch/arm/plat-omap/Makefile +1 -0
index 70b012d..faf831d 100644
@@ -15,6 +15,7 @@ obj-$(CONFIG_ARCH_OMAP16XX) += ocpi.o
 # OPP support in (OMAP3+ only at the moment)
 ifdef CONFIG_CPU_FREQ
 obj-$(CONFIG_ARCH_OMAP3) += opp.o
+obj-$(CONFIG_TWL4030_CORE) += opp_twl_tps.o
 endif
 
 # omap_device support (OMAP2+ only at the moment)
arch/arm/plat-omap/include/plat/opp_twl_tps.h new file +21 -0
new file mode 100644
index 0000000..8784e5f
@@ -0,0 +1,21 @@
+/*
+ * opp_twl_tps.h - TWL/TPS-specific headers for the OPP code
+ *
+ * Copyright (C) 2009 Texas Instruments Incorporated.
+ *	Nishanth Menon
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * XXX This code belongs as part of some other TWL/TPS code.
+ */
+#ifndef _ARCH_ARM_PLAT_OMAP_OPP_TWL_TPS_H
+#define _ARCH_ARM_PLAT_OMAP_OPP_TWL_TPS_H
+
+#include <linux/kernel.h>
+
+unsigned long omap_twl_vsel_to_uv(const u8 vsel);
+u8 omap_twl_uv_to_vsel(unsigned long uV);
+
+#endif
arch/arm/plat-omap/opp_twl_tps.c new file +41 -0

41 lines not on this page · raw message

Signature · 1 line
1.7.2.1
#3 lore raw

PATCH 3/4 omap3: pm: remove OPP interfaces from OMAP PM layer

In reply to Kevin Hilman

With new OPP layer, OPP users will access OPP API directly instead of using OMAP PM layer, so remove all notions of OPPs from the OMAP PM layer.

---
 arch/arm/mach-omap2/io.c                  |    3 +-
 arch/arm/plat-omap/include/plat/omap-pm.h |   31 +++++++++-------------------
 arch/arm/plat-omap/omap-pm-noop.c         |   11 +---------
 3 files changed, 12 insertions(+), 33 deletions(-)
arch/arm/mach-omap2/io.c +1 -2
index b9ea70b..c09bf10 100644
@@ -323,8 +323,7 @@ void __init omap2_init_common_hw(struct omap_sdrc_params *sdrc_cs0,
 		omap2430_hwmod_init();
 	else if (cpu_is_omap34xx())
 		omap3xxx_hwmod_init();
-	/* The OPP tables have to be registered before a clk init */
-	omap_pm_if_early_init(mpu_opps, dsp_opps, l3_opps);
+	omap_pm_if_early_init();
 
 	if (cpu_is_omap2420())
 		omap2420_clk_init();
arch/arm/plat-omap/include/plat/omap-pm.h +10 -21
index 728fbb9..c5b533d 100644
@@ -19,24 +19,7 @@
 #include <linux/clk.h>
 
 #include "powerdomain.h"
-
-/**
- * struct omap_opp - clock frequency-to-OPP ID table for DSP, MPU
- * @rate: target clock rate
- * @opp_id: OPP ID
- * @min_vdd: minimum VDD1 voltage (in millivolts) for this OPP
- *
- * Operating performance point data.  Can vary by OMAP chip and board.
- */
-struct omap_opp {
-	unsigned long rate;
-	u8 opp_id;
-	u16 min_vdd;
-};
-
-extern struct omap_opp *mpu_opps;
-extern struct omap_opp *dsp_opps;
-extern struct omap_opp *l3_opps;
+#include <plat/opp.h>
 
 /*
  * agent_id values for use with omap_pm_set_min_bus_tput():
@@ -59,9 +42,11 @@ extern struct omap_opp *l3_opps;
  * framework starts.  The "_if_" is to avoid name collisions with the
  * PM idle-loop code.
  */
-int __init omap_pm_if_early_init(struct omap_opp *mpu_opp_table,
-				 struct omap_opp *dsp_opp_table,
-				 struct omap_opp *l3_opp_table);
+#ifdef CONFIG_OMAP_PM_NONE
+#define omap_pm_if_early_init() 0
+#else
+int __init omap_pm_if_early_init(void);
+#endif
 
 /**
  * omap_pm_if_init - OMAP PM init code called after clock fw init
@@ -69,7 +54,11 @@ int __init omap_pm_if_early_init(struct omap_opp *mpu_opp_table,
  * The main initialization code.  OPP tables are passed in here.  The
  * "_if_" is to avoid name collisions with the PM idle-loop code.
  */
+#ifdef CONFIG_OMAP_PM_NONE
+#define omap_pm_if_init() 0
+#else
 int __init omap_pm_if_init(void);
+#endif
 
 /**
  * omap_pm_if_exit - OMAP PM exit code
arch/arm/plat-omap/omap-pm-noop.c +1 -10
index e129ce8..ca75abb 100644
@@ -26,10 +26,6 @@
 
 #include <plat/powerdomain.h>
 
-struct omap_opp *dsp_opps;
-struct omap_opp *mpu_opps;
-struct omap_opp *l3_opps;
-
 /*
  * Device-driver-originated constraints (via board-*.c files)
  */
@@ -308,13 +304,8 @@ int omap_pm_get_dev_context_loss_count(struct device *dev)
 
 
 /* Should be called before clk framework init */
-int __init omap_pm_if_early_init(struct omap_opp *mpu_opp_table,
-				 struct omap_opp *dsp_opp_table,
-				 struct omap_opp *l3_opp_table)
+int __init omap_pm_if_early_init(void)
 {
-	mpu_opps = mpu_opp_table;
-	dsp_opps = dsp_opp_table;
-	l3_opps = l3_opp_table;
 	return 0;
 }
 
Signature · 1 line
1.7.2.1
#4 lore raw

PATCH 4/4 OMAP: Remove dependency of generic opp layer on cpufreq.

In reply to Kevin Hilman

From: Thara Gopinath <[email protected]>

This patch removes the dependency of the opp layer on cpufreq layer. OPP layer is now enabled to compile and exist in the system irrespective of whether cpu freq layer is enabled or not.

[NM Note:
Original Patch: https://patchwork.kernel.org/patch/111664/
Still pending: http://marc.info/?l=linux-omap&m=127530955314582&w=2
To be squashed to patch 1
]

---
 arch/arm/plat-omap/Makefile           |    4 ++--
 arch/arm/plat-omap/include/plat/opp.h |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
arch/arm/plat-omap/Makefile +2 -2
index faf831d..852fa33 100644
@@ -13,7 +13,7 @@ obj-  :=
 obj-$(CONFIG_ARCH_OMAP16XX) += ocpi.o
 
 # OPP support in (OMAP3+ only at the moment)
-ifdef CONFIG_CPU_FREQ
+ifdef CONFIG_PM
 obj-$(CONFIG_ARCH_OMAP3) += opp.o
 obj-$(CONFIG_TWL4030_CORE) += opp_twl_tps.o
 endif
@@ -37,4 +37,4 @@ obj-y += $(i2c-omap-m) $(i2c-omap-y)
 # OMAP mailbox framework
 obj-$(CONFIG_OMAP_MBOX_FWK) += mailbox.o
 
-obj-$(CONFIG_OMAP_PM_NOOP) += omap-pm-noop.o
\ No newline at end of file
+obj-$(CONFIG_OMAP_PM_NOOP) += omap-pm-noop.o
arch/arm/plat-omap/include/plat/opp.h +2 -2
index 403b69b..f9feb8d 100644
@@ -61,7 +61,7 @@ struct omap_opp_def {
 
 struct omap_opp;
 
-#ifdef CONFIG_CPU_FREQ
+#ifdef CONFIG_PM
 
 unsigned long opp_get_voltage(const struct omap_opp *opp);
 
@@ -156,5 +156,5 @@ void opp_init_cpufreq_table(struct omap_opp *opps,
 {
 }
 
-#endif		/* CONFIG_CPU_FREQ */
+#endif		/* CONFIG_PM */
 #endif		/* __ASM_ARM_OMAP_OPP_H */
Signature · 1 line
1.7.2.1