Skip to contentSkip to conversation

power: introduce library for device-specific OPPs

PATCH Superseded Nishanth Menon 2 participants 7 messages Sep 18, 2010

Subsystems (4)

v2 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 power: introduce library for device-specific OPPs

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 Operating Performance 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.

To implement an OPP, some sort of power management support is necessary hence this library enablement depends on CONFIG_PM, however this does not fit into the core power framework as it is an independent library. This is hence introduced under lib allowing all architectures to selectively enable the feature based on their capabilities.

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.
Linus Walleij for recommending this layer be made generic for usage in other architectures beyond OMAP and ARM.
Andrew and Raphael for various suggestions and improvements to the code.

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
http://marc.info/?t=128152609200064&r=1&w=2
http://marc.info/?t=128468723000002&r=1&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]>
Cc Eduardo Valentin <[email protected]>
Cc Paul Walmsley <[email protected]>
Cc Sanjeev Premi <[email protected]>
Cc Thara Gopinath <[email protected]>
Cc Vishwanath BS <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Mark Brown <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Rafael J. Wysocki <[email protected]>

---

Restricting this post to just the lists and get_maintainer.pl --nogit to prevent spam as suggested:

	http://lwn.net/Articles/403542/

Code based on Linus's tree commit 03a7ab0
V2 changes:
Incorporated review comments from v1. major changes being:
$subject change to reflect this is for power. Documentation revamp and including it in the patch :) OPP_DEF removed - lets introduce this if needed or leave it to
SOC frameworks to organize code as needed.
Rename of enable to available to better reflect the intent few fixes and typos
Introduced mutex based locking for controlling access to list
modification (note: query functions are still unsafe- rationale in the patch below)
A new home for opp.c in drivers/base/power (moved from lib/) A few optimization in function flow and additional error checks
added to exposed functions
offline aligned with Kevin for cleaning up the copyrights

V1: http://marc.info/?t=128468723000002&r=1&w=2
converted from being TI OMAP specific to linux generic

 Documentation/power/00-INDEX |    2 +
 Documentation/power/opp.txt  |  326 ++++++++++++++++++++++++++
 drivers/base/power/Makefile  |    1 +
 drivers/base/power/opp.c     |  527 ++++++++++++++++++++++++++++++++++++++++++
 include/linux/opp.h          |  126 ++++++++++
 kernel/power/Kconfig         |   14 ++
 6 files changed, 996 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/power/opp.txt
 create mode 100644 drivers/base/power/opp.c
 create mode 100644 include/linux/opp.h
Documentation/power/00-INDEX +2 -0
index fb742c2..45e9d4a 100644
@@ -14,6 +14,8 @@ interface.txt
 	- Power management user interface in /sys/power
 notifiers.txt
 	- Registering suspend notifiers in device drivers
+opp.txt
+	- Operating Performance Point library
 pci.txt
 	- How the PCI Subsystem Does Power Management
 pm_qos_interface.txt
Documentation/power/opp.txt new file +326 -0

326 lines not on this page · raw message

drivers/base/power/Makefile +1 -0
index cbccf9a..abe46ed 100644
@@ -3,6 +3,7 @@ obj-$(CONFIG_PM_SLEEP)	+= main.o wakeup.o
 obj-$(CONFIG_PM_RUNTIME)	+= runtime.o
 obj-$(CONFIG_PM_OPS)	+= generic_ops.o
 obj-$(CONFIG_PM_TRACE_RTC)	+= trace.o
+obj-$(CONFIG_PM_OPP)	+= opp.o
 
 ccflags-$(CONFIG_DEBUG_DRIVER) := -DDEBUG
 ccflags-$(CONFIG_PM_VERBOSE)   += -DDEBUG
drivers/base/power/opp.c new file +527 -0

527 lines not on this page · raw message

include/linux/opp.h new file +126 -0

126 lines not on this page · raw message

kernel/power/Kconfig +14 -0
index ca6066a..634eab6 100644
@@ -242,3 +242,17 @@ config PM_OPS
 	bool
 	depends on PM_SLEEP || PM_RUNTIME
 	default y
+
+config PM_OPP
+	bool "Enable Operating Performance Point(OPP) Layer library"
+	depends on PM
+	---help---
+	  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 OPP varies over silicon within the same family of devices.
+
+	  OPP layer organizes the data internally using device pointers
+	  representing individual voltage domains and provides SOC
+	  implementations a ready to use framework to manage OPPs.
+	  For more information, read <file:Documentation/power/opp.txt>
Signature · 1 line
1.6.3.3
#1 lore raw
Quoted 2 lines · Nishanth Menon

This is hence introduced under lib allowing all architectures to selectively enable the feature based on their capabilities.

<snip>

Quoted 10 lines
 Documentation/power/00-INDEX |    2 +
 Documentation/power/opp.txt  |  326 ++++++++++++++++++++++++++
 drivers/base/power/Makefile  |    1 +
 drivers/base/power/opp.c     |  527 ++++++++++++++++++++++++++++++++++++++++++
 include/linux/opp.h          |  126 ++++++++++
 kernel/power/Kconfig         |   14 ++
 6 files changed, 996 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/power/opp.txt
 create mode 100644 drivers/base/power/opp.c
 create mode 100644 include/linux/opp.h

That doesn't look like the files are under lib/

Did you forget to move them, or do you need to update the changelog message?

thanks,

greg k-h

#2 lore raw

Greg KH had written, on 09/18/2010 12:38 AM, the following:

Quoted 17 lines · Nishanth Menon
Quoted 2 lines

This is hence introduced under lib allowing all architectures to selectively enable the feature based on their capabilities.

<snip>

Quoted 10 lines
 Documentation/power/00-INDEX |    2 +
 Documentation/power/opp.txt  |  326 ++++++++++++++++++++++++++
 drivers/base/power/Makefile  |    1 +
 drivers/base/power/opp.c     |  527 ++++++++++++++++++++++++++++++++++++++++++
 include/linux/opp.h          |  126 ++++++++++
 kernel/power/Kconfig         |   14 ++
 6 files changed, 996 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/power/opp.txt
 create mode 100644 drivers/base/power/opp.c
 create mode 100644 include/linux/opp.h
Quoted 4 lines

That doesn't look like the files are under lib/

Did you forget to move them, or do you need to update the changelog message?

Aww... and I thought I fixed them all.. the commit message is wrong. we had an alignment earlier today to move it from lib to drivers/base/power [1] :(

Thanks for catching it. Will fix it in rev 3 after collating any further comments as well.

[1] http://marc.info/?l=linux-arm-kernel&m=128476405731191&w=2

Signature · 2 lines
Regards,
Nishanth Menon
#3 lore raw

Menon, Nishanth had written, on 09/18/2010 12:42 AM, the following:

Quoted 21 lines

Greg KH had written, on 09/18/2010 12:38 AM, the following:

Quoted 15 lines · Nishanth Menon
Quoted 2 lines

This is hence introduced under lib allowing all architectures to selectively enable the feature based on their capabilities.

<snip>

Quoted 10 lines
 Documentation/power/00-INDEX |    2 +
 Documentation/power/opp.txt  |  326 ++++++++++++++++++++++++++
 drivers/base/power/Makefile  |    1 +
 drivers/base/power/opp.c     |  527 ++++++++++++++++++++++++++++++++++++++++++
 include/linux/opp.h          |  126 ++++++++++
 kernel/power/Kconfig         |   14 ++
 6 files changed, 996 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/power/opp.txt
 create mode 100644 drivers/base/power/opp.c
 create mode 100644 include/linux/opp.h
Quoted 4 lines

That doesn't look like the files are under lib/

Did you forget to move them, or do you need to update the changelog message?

Quoted 8 lines

Aww... and I thought I fixed them all.. the commit message is wrong. we had an alignment earlier today to move it from lib to drivers/base/power [1] :(

Thanks for catching it. Will fix it in rev 3 after collating any further comments as well.

[1] http://marc.info/?l=linux-arm-kernel&m=128476405731191&w=2

Yikes..sleepy eyes and long threads don't go well together :(

[1] http://marc.info/?l=linux-arm-kernel&m=128476651001280&w=2 is the link I had intended

apologies on the spam.. :(

Signature · 2 lines
Regards,
Nishanth Menon
#4 lore raw
In reply to Nishanth Menon

Menon, Nishanth had written, on 09/18/2010 12:42 AM, the following:

Quoted 21 lines

Greg KH had written, on 09/18/2010 12:38 AM, the following:

Quoted 15 lines · Nishanth Menon
Quoted 2 lines

This is hence introduced under lib allowing all architectures to selectively enable the feature based on their capabilities.

<snip>

Quoted 10 lines
 Documentation/power/00-INDEX |    2 +
 Documentation/power/opp.txt  |  326 ++++++++++++++++++++++++++
 drivers/base/power/Makefile  |    1 +
 drivers/base/power/opp.c     |  527 ++++++++++++++++++++++++++++++++++++++++++
 include/linux/opp.h          |  126 ++++++++++
 kernel/power/Kconfig         |   14 ++
 6 files changed, 996 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/power/opp.txt
 create mode 100644 drivers/base/power/opp.c
 create mode 100644 include/linux/opp.h
Quoted 4 lines

That doesn't look like the files are under lib/

Did you forget to move them, or do you need to update the changelog message?

Quoted 8 lines

Aww... and I thought I fixed them all.. the commit message is wrong. we had an alignment earlier today to move it from lib to drivers/base/power [1] :(

Thanks for catching it. Will fix it in rev 3 after collating any further comments as well.

[1] http://marc.info/?l=linux-arm-kernel&m=128476405731191&w=2

Yikes..sleepy eyes and long threads don't go well together :(

[1] http://marc.info/?l=linux-arm-kernel&m=128476651001280&w=2 is the link I had intended

apologies on the spam.. :(

Signature · 2 lines
Regards,
Nishanth Menon
#5 lore raw
In reply to Greg KH

Greg KH had written, on 09/18/2010 12:38 AM, the following:

Quoted 17 lines · Nishanth Menon
Quoted 2 lines

This is hence introduced under lib allowing all architectures to selectively enable the feature based on their capabilities.

<snip>

Quoted 10 lines
 Documentation/power/00-INDEX |    2 +
 Documentation/power/opp.txt  |  326 ++++++++++++++++++++++++++
 drivers/base/power/Makefile  |    1 +
 drivers/base/power/opp.c     |  527 ++++++++++++++++++++++++++++++++++++++++++
 include/linux/opp.h          |  126 ++++++++++
 kernel/power/Kconfig         |   14 ++
 6 files changed, 996 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/power/opp.txt
 create mode 100644 drivers/base/power/opp.c
 create mode 100644 include/linux/opp.h
Quoted 4 lines

That doesn't look like the files are under lib/

Did you forget to move them, or do you need to update the changelog message?

Aww... and I thought I fixed them all.. the commit message is wrong. we had an alignment earlier today to move it from lib to drivers/base/power [1] :(

Thanks for catching it. Will fix it in rev 3 after collating any further comments as well.

[1] http://marc.info/?l=linux-arm-kernel&m=128476405731191&w=2

Signature · 2 lines
Regards,
Nishanth Menon
#6 lore raw
In reply to Nishanth Menon
Quoted 2 lines · Nishanth Menon

This is hence introduced under lib allowing all architectures to selectively enable the feature based on their capabilities.

<snip>

Quoted 10 lines
 Documentation/power/00-INDEX |    2 +
 Documentation/power/opp.txt  |  326 ++++++++++++++++++++++++++
 drivers/base/power/Makefile  |    1 +
 drivers/base/power/opp.c     |  527 ++++++++++++++++++++++++++++++++++++++++++
 include/linux/opp.h          |  126 ++++++++++
 kernel/power/Kconfig         |   14 ++
 6 files changed, 996 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/power/opp.txt
 create mode 100644 drivers/base/power/opp.c
 create mode 100644 include/linux/opp.h

That doesn't look like the files are under lib/

Did you forget to move them, or do you need to update the changelog message?

thanks,

greg k-h