Subject: Re: Making a common API for cpu frequency drivers
To: Juan RP <juan@xtrarom.org>
From: Garrett D'Amore <garrett_damore@tadpole.com>
List: tech-kern
Date: 09/01/2006 07:27:36
Juan RP wrote:
> Hi,
>
> Cube suggested that the way to go for drivers changing CPU frequency
> (speedstep, powernow, longrun, etc) is to use a new sysmon object.
>
> Before starting the work, I would like to know what do I need exactly.
> I've come up with the following plan:
>
> We could have more than 1 driver registered (for example speedstep
> and Pentium 4 TCC (feature TM/TM2)).
>
> * Each driver will be registered via sysmon_clockfreq_register.
>
> * Each driver will be unregistered via sysmon_clockfreq_unregister.
>
> * Each driver will return to sysmon_clockfreq:
>
>         - A list of working frequencies via prop_array(3) for drivers
> 	  like powernow, est and longrun. (is it ok to use prop_array?)
>
>         - If previous list is NULL, a pair name/value will be used
>           instead via prop_dictionary(3) (again I'm not sure what prop
> 	  type is better for this).
>
> * Each driver will get its current state frequency via CLKFREQ_GIOMODE
>   ioctl and proplib will be used to pass value between kernel/userland.
>
> * Each driver will change its current state frequency via CLKFREQ_SIOMODE
>   ioctl and proplib will be used to pass value between kernel/userland.
>
> I think it's enough for now, do you think am I missing something?
>
> What type of proplib might be used for all these fields?
>
> Do you think that sysmon_clockfreq is the correct name?
>
> Please speak up and help me making the API.
>
> Thanks.
>   

Quite honestly, I'd rather not have the driver handle the ioctls, but
rather have sysmon handle them. Sysmon can pass the ioctl to an entry
point in the driver set up with sysctl_clockfreq_register.

Because one problem that you are neglecting to consider is how user code
determines the device node to attach to.  By having sysmon handle it,
this needn't be a concern.

Properly done, I can use this for Tadpole's SPARC laptops, too.

-- 
Garrett D'Amore, Principal Software Engineer
Tadpole Computer / Computing Technologies Division,
General Dynamics C4 Systems
http://www.tadpolecomputer.com/
Phone: 951 325-2134  Fax: 951 325-2191