PowerOP, PowerOP Core, 1/2
Subsystems (2)
PATCH 1/1 PowerOP, PowerOP Core, 1/2
The PowerOP Core provides completely arch independent interface to create and control operating points which consist of arbitrary subset of power parameters available on a certain platform. Also, PowerOP Core provides optional SysFS interface to access operating point from userspace.
include/linux/powerop.h new file +42 -0
@@ -0,0 +1,42 @@ +/* +* PowerOP core definitions +* +* Author: Eugeny S. Mints <[email protected]> +* +* 2006 (C) Nomad Global Solutions, Inc. This file is licensed under +* the terms of the GNU General Public License version 2. This program +* is licensed "as is" without any warranty of any kind, whether express +* or implied. +* +* Based on ideas and code by Todd Poynor <[email protected]> +*/ +#ifndef __POWEROP_H__ +#define __POWEROP_H__ + +#define POWEROP_MAX_OPT_NAME_LENGTH 32 + +#define POWEROP_REGISTER_EVENT 1 +#define POWEROP_UNREGISTER_EVENT 2 + +/* Interface to an arch PM Core layer */ +struct powerop_driver { +char *name; +void *(*create_point) (const char *pwr_params,va_list args); +int (*set_point) (void *md_opt); +int (*get_point) (void *md_opt,const char *pwr_params,va_list args); +}; + +int powerop_driver_register (struct powerop_driver *p); +void powerop_driver_unregister (struct powerop_driver *p); + +/* Main PowerOP Core interface */ +int powerop_register_point (const char *id,const char *pwr_params, ...); +int powerop_unregister_point (const char *id); +int powerop_set_point (const char *id); +int powerop_get_point (const char *id,const char *pwr_params, ...); +int powerop_get_registered_opt_names (char *opt_names_list[],int *length); +void powerop_put_registered_opt_names (char *opt_names_list[]); +int powerop_register_notifier (struct notifier_block *nb); +int powerop_unregister_notifier (struct notifier_block *nb); + +#endif /* __POWEROP_H__ */
include/linux/powerop_sysfs.h new file +59 -0
59 lines not on this page · raw message
kernel/power/Kconfig +28 -0
@@ -104,3 +104,31 @@ config SUSPEND_SMP bool depends on HOTPLUG_CPU && X86 && PM default y + +# +# powerop +# + +menu "PowerOP (Power Management)" + +config POWEROP + tristate "PowerOP Core" + help + +config POWEROP_SYSFS + bool "Enable PowerOP sysfs interface" + depends on PM && POWEROP && SYSFS + help + +config POWEROP_SYSFS_OP_CREATE + bool "Enable creation of operating point via sysfs interface" + depends on POWEROP_SYSFS + help + +config POWEROP_SYSFS_OP_DEBUG_IF + bool "Enable special hw operating point" + depends on POWEROP_SYSFS + help + "hw point(ro) is used to get snapshots of power parameter values" + +endmenu
kernel/power/Makefile +9 -0
@@ -10,3 +10,12 @@ obj-$(CONFIG_SOFTWARE_SUSPEND) += swsusp obj-$(CONFIG_SUSPEND_SMP) += smp.o obj-$(CONFIG_MAGIC_SYSRQ) += poweroff.o + +# PowerOP + +powerop-pm-objs := powerop.o +ifeq ($(CONFIG_POWEROP_SYSFS),y) + powerop-pm-objs += powerop_sysfs.o +endif + +obj-$(CONFIG_POWEROP) += powerop-pm.o
kernel/power/main.c +2 -1
@@ -16,6 +16,7 @@ #include <linux/errno.h>#include <linux/init.h> #include <linux/pm.h> #include <linux/console.h> +#include <linux/module.h> #include "power.h"
@@ -233,7 +234,7 @@ int pm_suspend(suspend_state_t state)decl_subsys (power,NULL ,NULL ); - +EXPORT_SYMBOL_GPL (power_subsys);/** * state - control system power state.
kernel/power/powerop.c new file +407 -0
407 lines not on this page · raw message
kernel/power/powerop_point.h new file +36 -0
@@ -0,0 +1,36 @@ +/* +* PowerOP core non-public header +* +* Author: Eugeny S. Mints <[email protected]> +* +* 2006 (C) Nomad Global Solutions, Inc. This file is licensed under +* the terms of the GNU General Public License version 2. This program +* is licensed "as is" without any warranty of any kind, whether express +* or implied. +* +* Based on ideas and code by Todd Poynor <[email protected]> +*/ +#ifndef __POWEROP_INT_H__ +#define __POWEROP_INT_H__ + +#define POWEROP_MAX_OPT_NAME_LENGTH 32 + +/** +* struct powerop_point - PowerOP Core representation of operating point +* @kobj: hook to reference an operating point in some arch independent way +* (for ex. sysfs) +* @md_opt: pointer to opaque arch dependent set of power parameters +* +*/ +struct powerop_point { +struct kobject kobj; +void *md_opt; +struct list_head node; +#ifdef CONFIG_POWEROP_SYSFS +struct completion released; +#endif +}; + +#define to_namedop (_kobj) container_of(_kobj, struct powerop_point, kobj) + +#endif /* __POWEROP_INT_H__ */
kernel/power/powerop_sysfs.c new file +254 -0
254 lines not on this page · raw message
kernel/power/powerop_sysfs_point.h new file +42 -0
42 lines not on this page · raw message