From: Tony Lindgren <tony@atomide.com>
To: Thara Gopinath <thara@ti.com>
Cc: linux-omap@vger.kernel.org, paul@pwsan.com,
khilman@deeprootsystems.com, b-cousson@ti.com,
vishwanath.bs@ti.com, sawant@ti.com
Subject: Re: [PATCH v3 3/6] OMAP4: PM: Program correct init voltages for scalable VDDs
Date: Thu, 4 Nov 2010 10:20:10 -0700 [thread overview]
Message-ID: <20101104172010.GB9264@atomide.com> (raw)
In-Reply-To: <1288196196-15469-4-git-send-email-thara@ti.com>
Hi Thara,
* Thara Gopinath <thara@ti.com> [101027 09:08]:
> By default the system boots up at nominal voltage for every
> voltage domain in the system. This patch puts vdd_mpu, vdd_iva
> and vdd_core to the correct boot up voltage as per the opp tables
> specified. This patch implements this by matching the rate of
> the main clock of the voltage domain with the opp table and
> picking up the correct voltage.
>
> Signed-off-by: Thara Gopinath <thara@ti.com>
> ---
> arch/arm/mach-omap2/pm.c | 4 ++++
> 1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
> index 353e155..0651667 100644
> --- a/arch/arm/mach-omap2/pm.c
> +++ b/arch/arm/mach-omap2/pm.c
> @@ -211,6 +211,10 @@ static int __init omap2_common_pm_init(void)
> if (cpu_is_omap34xx()) {
> omap2_set_init_voltage("mpu", "dpll1_ck", mpu_dev);
> omap2_set_init_voltage("core", "l3_ick", l3_dev);
> + } else if (cpu_is_omap44xx()) {
> + omap2_set_init_voltage("mpu", "dpll_mpu_ck", mpu_dev);
> + omap2_set_init_voltage("core", "l3_div_ck", l3_dev);
> + omap2_set_init_voltage("iva", "dpll_iva_m5x2_ck", iva_dev);
> }
>
> omap_pm_if_init();
In general, we want to avoid adding these "if cpu_is_ompa34xx else if"
things all over the place. That makes the code hard to maintain and
requires patching all over the place to add support for new omaps.
Instead, please do something like this:
static int __init omap_common_whatever_init(struct whatever_data *d)
{
...
return 0;
}
static int __init omap3_whatever_init(void)
{
struct whatever_data *d;
if (!cpu_is_omap34xx())
return -ENODEV;
/* Initialize omap3 specific things */
...
return omap_common_whatever_init(d);
}
device_initcall(omap3_whatever_init);
static int __init omap4_whatever_init(void)
{
struct whatever_data *d;
if (!cpu_is_omap44xx())
return -ENODEV;
/* Initialize omap4 specific things */
...
return omap_common_whatever_init(d);
}
device_initcall(omap4_whatever_init);
...
This way the common code stays readable and does not need
to be patched when support for new omaps is added. Also the
code for unselected omaps gets optimized out and an extra
level of code indentation is left out.
Regards,
Tony
next prev parent reply other threads:[~2010-11-04 17:20 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-27 16:16 [PATCH v3 0/6] OMAP4: Smartreflex and Voltage layer support Thara Gopinath
2010-10-27 16:16 ` [PATCH v3 1/6] OMAP4: Add the new voltage to vsel calculation formula Thara Gopinath
2010-11-04 17:24 ` Tony Lindgren
2010-11-15 14:46 ` Gopinath, Thara
2010-10-27 16:16 ` [PATCH v3 2/6] OMAP4: Adding voltage driver support Thara Gopinath
2010-11-10 19:22 ` Kevin Hilman
2010-11-15 11:04 ` Gopinath, Thara
2010-10-27 16:16 ` [PATCH v3 3/6] OMAP4: PM: Program correct init voltages for scalable VDDs Thara Gopinath
2010-11-04 17:20 ` Tony Lindgren [this message]
2010-11-15 14:51 ` Gopinath, Thara
2010-10-27 16:16 ` [PATCH v3 4/6] OMAP4: hwmod: Add inital data for smartreflex modules Thara Gopinath
2010-10-27 16:16 ` [PATCH v3 5/6] OMAP4: Adding dev atrributes to OMAP4 smartreflex hwmod data Thara Gopinath
2010-10-27 16:16 ` [PATCH v3 6/6] OMAP4: Smartreflex framework extensions Thara Gopinath
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=20101104172010.GB9264@atomide.com \
--to=tony@atomide.com \
--cc=b-cousson@ti.com \
--cc=khilman@deeprootsystems.com \
--cc=linux-omap@vger.kernel.org \
--cc=paul@pwsan.com \
--cc=sawant@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