public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Adam Belay <abelay@novell.com>
Cc: Linux-pm mailing list <linux-pm@lists.osdl.org>
Subject: Re: [RFC] power trees
Date: Sun, 21 Aug 2005 16:00:35 +0200	[thread overview]
Message-ID: <20050821140034.GA3039@openzaurus.ucw.cz> (raw)
In-Reply-To: <1123735844.4380.64.camel@localhost.localdomain>

[-- Attachment #1: Type: text/plain, Size: 2047 bytes --]

Hi!

> My implementation has two primary goals:
> 
> 1.) To help device drivers track and control their device's power state
> 
> 2.) To bubble power state dependency changes from a leaf node to the
> last affected parent node in the chain.
> 
> The basic unit of the tree is referred to as a "pm_node".  Each
> "pm_node" has a list of states it supports, a current state, and a
> driver to handle state transitions.  Any "pm_node" can have children and
> therefore act as a power container.
> 
> struct pm_state {
> 	char			*name;
> 	unsigned long		index;
> 	unsigned long		link_req;
> 	void			*link_data;
> };
> 
> "index" is a driver specific value that indicates the state.  "link_req"
> is a set of flags that indicate requirements from the parent "pm_node".
> "link_data" provides additional requirement information.
> 
> struct pm_node {
> 	struct semaphore	sem;
> 	struct list_head	children;
> 	struct list_head	child_list;
> 	struct pm_node		*parent;
> 	struct pm_node		*tmp_path;
> 	struct device		*dev;
> 
> 	struct pm_node_driver	*drv;
> 	unsigned int		current_state;
> 	unsigned int		target_state;

Would not it be cleaner to have struct pm_state *current_state, target state?

> "states" is a list of power states sorted from most functional to least
> functional.  "current_state" and "target_state" are index values for
> that list.
> 
> struct pm_node_driver {
> 	int (*set_state) 	(struct pm_node *node);
> 	int (*raise_event)	(struct pm_node *domain,
> 				 struct pm_node *child,
> 				 unsigned long *new_state);

struct pm_state here, too?

> 	void (*lower_event)	(struct pm_node *domain);
> };
> 
> "raise_event" notifies the power domain when a child has increased its

"Increase" == went more power hungry?

> I apologize for the unpolished/untested state of the code as it's
> primarily intended to illustrate a concept.  I'll need to look over the
> problem more carefully if we decide this is the right direction.  Power

Seems ok to me.

-- 
64 bytes from 195.113.31.123: icmp_seq=28 ttl=51 time=448769.1 ms         


[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



  parent reply	other threads:[~2005-08-21 14:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-11  4:50 [RFC] power trees Adam Belay
2005-08-11 18:29 ` Greg KH
2005-08-21 14:00 ` Pavel Machek [this message]
2005-08-21 16:15   ` Alan Stern
2005-08-21 17:37     ` Pavel Machek
2005-08-26 23:37       ` Alan Stern
2005-08-27  2:42     ` David Brownell
2005-08-31 10:42       ` Tony Lindgren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050821140034.GA3039@openzaurus.ucw.cz \
    --to=pavel@ucw.cz \
    --cc=abelay@novell.com \
    --cc=linux-pm@lists.osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox