From: Nishanth Menon <nm@ti.com>
To: Kevin Hilman <khilman@deeprootsystems.com>
Cc: linux-omap <linux-omap@vger.kernel.org>,
"Cousson, Benoit" <b-cousson@ti.com>,
"Hunter, Jon" <jon-hunter@ti.com>,
"Chikkature Rajashekar, Madhusudhan" <madhu.cr@ti.com>,
Paul Walmsley <paul@pwsan.com>, "Dasgupta, Romit" <romit@ti.com>,
"Premi, Sanjeev" <premi@ti.com>,
"Shilimkar, Santosh" <santosh.shilimkar@ti.com>,
"Aguirre, Sergio" <saaguirre@ti.com>,
"Lam, SuiLun" <s-lam@ti.com>, "Gopinath, Thara" <thara@ti.com>,
"Sripathy, Vishwanath" <vishwanath.bs@ti.com>
Subject: Re: [PATCH 2/9 v2] omap3: pm: introduce opp accessor functions
Date: Tue, 17 Nov 2009 21:08:22 -0600 [thread overview]
Message-ID: <4B036526.6070500@ti.com> (raw)
In-Reply-To: <4B001640.5070405@ti.com>
Menon, Nishanth had written, on 11/15/2009 08:54 AM, the following:
[...]
> b) Improvements of the omap accessor functions, I will send out few of
> the proposals I can think of later when I get some free time.. we can
> discuss that too.
Here is my initial proposal, do feel free to comment/add/modify etc:
In the accessor functions listed here, I have followed:
a) The function will return 0 if success else appropriate error values,
all values are passed by pointer params.
b) Overall, the idea is to transition from exposing omap_opp to users
currently to a system where opp handling logic will be blackboxed from
the rest of the system - giving us options to optimize and scale
internal logic and storage mechanism without impacting the rest of the
system.
c) resultant code should be readable - this is one of the issues I see
with my previous implementation.
Files: Introduce opp.c and opp.h
A) Data Structures:
Interim:
opp.h
struct omap_opp {
bool enabled;
unsigned long rate; /* in hz */
u8 opp_id; /* int */
u16 vsel; /* T2 voltage value */
};
typedef struct omap_opp omap_opp_def;
Final, once resource34xx.c and all direct accesses are cleaned up:
opp.h:
struct omap_opp;
/* initial definitions of OPP, will be used by all */
struct omap_opp_def {
bool enabled; /* true/false */
unsigned long rate; /* in hz */
u16 vsel; /* in millivolts */
};
opp.c:
struct omap_opp {
bool enabled;
unsigned long rate;
u16 vsel;
};
or what ever implementation it needs. can be array, list, hash
implementation or what ever we choose it to be.
B) Accessor functions to be used:
B.1) These functions should be removed once SRF is replaced/cleaned up:
int opp_id_to_freq(unsigned long *freq, const struct omap_opp *opps, u8
opp_id);
int opp_freq_to_id(u8 *opp_id, const struct omap_opp *opps, unsigned
long freq);
B.2) initialization functions:
/* Register the OPP list for the silicon */
int opp_register(struct omap_opp *opp_list,
const struct omap_opp_def *opp_reg);
/* Enable a specific frequency */
int opp_enable(struct omap_opp *opp_list,
unsigned long freq, bool enable);
Users:
opp_register will be called by pm34xx.c based on silicon type.
opp_enable will be called by board file/ has_feature based logic etc..
on a need basis
B.3) verification functions:
/* Check if we have a frequency in the list(enabled/disabled)
* this is needed by users who would like to enable a disabled
* frequency
*/
int opp_has_freq(struct omap_opp *opp_list, unsigned long freq);
/* Check if we have a enabled frequency - this is what most users
* will need
*/
int opp_is_freq_valid(struct omap_opp *opp_list, unsigned long freq);
Users:
files who'd want to use opp_enable,
validation paths.
B.4) Limit functions:
/* To get a number of frequencies enabled */
int opp_get_freq_count(const struct omap_opp *opp_list, u8 *num);
/* Get highest enabled frequency */
int opp_get_highest_freq(struct omap_opp *opp_list,
unsigned long *freq);
/* Get lowest enabled frequency */
int opp_get_lowest_freq(struct omap_opp *opp_list, unsigned long *freq);
Users:
Obvious user is the current cpufreq
B.5) Search functions -> these will check only enabled frequencies. This
will not check if the start freq provided in *freq is an enabled
frequency or not. Assumption I am making is: if you are searching for a
frequency that is disabled in the opp list, you are not trying something
generic -hence wont support.
/* Get higher enabled frequency than the provided one */
int opp_get_higher_freq(struct omap_opp *opp_list, unsigned long *freq);
/* Get lower enabled frequency than the provided one */
int opp_get_lower_freq(struct omap_opp *opp_list, unsigned long *freq);
Users:
current srf, future scale logic
B.6) voltage functions - opp layer will not trigger voltage transition,
it is upto other users of opp layer to make a decision.
/* get voltage corresponding to a frequency */
int opp_freq_to_voltage(u16 *voltage, struct omap_opp *opp_list,
unsigned long *freq);
Users:
current SR/SRF, future voltage framework.
--
Regards,
Nishanth Menon
next prev parent reply other threads:[~2009-11-18 3:08 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-13 6:05 [PATCH 0/9 v2] omap3: pm: introduce support for 3630 OPPs Nishanth Menon
2009-11-13 6:05 ` [PATCH 1/9] omap3: pm: introduce enabled flag to omap_opp Nishanth Menon
2009-11-13 6:05 ` [PATCH 2/9 v2] omap3: pm: introduce opp accessor functions Nishanth Menon
2009-11-13 6:05 ` [PATCH 3/9] omap3: pm: srf: use opp accessor function Nishanth Menon
2009-11-13 6:05 ` [PATCH 4/9] omap3: pm: use opp accessor functions for omap-target Nishanth Menon
2009-11-13 6:05 ` [PATCH 5/9] omap3: pm: sr: replace get_opp with freq_to_opp Nishanth Menon
2009-11-13 6:05 ` [PATCH 6/9] omap3: clk: use pm accessor functions for cpufreq table Nishanth Menon
2009-11-13 6:05 ` [PATCH 7/9] omap3: pm: remove VDDx_MIN/MAX macros Nishanth Menon
2009-11-13 6:05 ` [PATCH 8/9 v2] omap3: pm: introduce dynamic OPP Nishanth Menon
2009-11-13 6:05 ` [PATCH 9/9 v2] omap3: pm: introduce 3630 opps Nishanth Menon
2009-11-18 20:07 ` Jon Hunter
2009-11-19 14:00 ` Sripathy, Vishwanath
2009-11-14 1:31 ` [PATCH 8/9 v2] omap3: pm: introduce dynamic OPP Kevin Hilman
2009-11-15 14:20 ` Menon, Nishanth
2009-11-14 0:58 ` [PATCH 2/9 v2] omap3: pm: introduce opp accessor functions Kevin Hilman
2009-11-15 14:54 ` Menon, Nishanth
2009-11-18 3:08 ` Nishanth Menon [this message]
2009-11-20 1:31 ` Kevin Hilman
2009-11-20 2:16 ` Nishanth Menon
2009-11-21 3:00 ` Nishanth Menon
2009-11-21 16:07 ` Cousson, Benoit
2009-11-21 19:08 ` Menon, Nishanth
2009-11-21 22:22 ` Cousson, Benoit
2009-11-22 3:35 ` Menon, Nishanth
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=4B036526.6070500@ti.com \
--to=nm@ti.com \
--cc=b-cousson@ti.com \
--cc=jon-hunter@ti.com \
--cc=khilman@deeprootsystems.com \
--cc=linux-omap@vger.kernel.org \
--cc=madhu.cr@ti.com \
--cc=paul@pwsan.com \
--cc=premi@ti.com \
--cc=romit@ti.com \
--cc=s-lam@ti.com \
--cc=saaguirre@ti.com \
--cc=santosh.shilimkar@ti.com \
--cc=thara@ti.com \
--cc=vishwanath.bs@ti.com \
/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