From: Kevin Hilman <khilman@deeprootsystems.com>
To: Thara Gopinath <thara@ti.com>
Cc: linux-omap@vger.kernel.org, paul@pwsan.com, b-cousson@ti.com,
vishwanath.bs@ti.com, sawant@ti.com, dderrick@ti.com
Subject: Re: [PATCHv2 2/8] OMAP3: PM: Adding voltage driver support for OMAP3
Date: Mon, 30 Aug 2010 16:06:11 -0700 [thread overview]
Message-ID: <8739tvya3g.fsf@deeprootsystems.com> (raw)
In-Reply-To: <1281707231-3026-3-git-send-email-thara@ti.com> (Thara Gopinath's message of "Fri, 13 Aug 2010 19:17:05 +0530")
Thara Gopinath <thara@ti.com> writes:
> This patch adds voltage driver support for OMAP3. The driver
> allows configuring the voltage controller and voltage
> processors during init and exports APIs to enable/disable
> voltage processors, scale voltage and reset voltage.
> The driver also maintains the global voltage table on a per
> VDD basis which contains the various voltages supported by the
> VDD along with per voltage dependent data like smartreflex
> n-target value, errminlimit and voltage processor errorgain.
> The driver allows scaling of VDD voltages either through
> "vc bypass method" or through "vp forceupdate method" the
> choice being configurable through the board file.
>
> This patch contains code originally in linux omap pm branch
> smartreflex driver. Major contributors to this driver are
> Lesly A M, Rajendra Nayak, Kalle Jokiniemi, Paul Walmsley,
> Nishant Menon, Kevin Hilman.
>
> Signed-off-by: Thara Gopinath <thara@ti.com>
[...]
> +unsigned long omap_voltage_get_nom_volt(struct voltagedomain *voltdm)
> +{
> + struct omap_opp *opp;
> + struct omap_vdd_info *vdd;
> + unsigned long freq;
> +
> + if (!voltdm || IS_ERR(voltdm)) {
> + pr_warning("%s: VDD specified does not exist!\n", __func__);
> + return 0;
> + }
> +
> + vdd = container_of(voltdm, struct omap_vdd_info, voltdm);
> +
> + freq = vdd->volt_clk->rate;
> + opp = opp_find_freq_ceil(vdd->opp_dev, &freq);
> + if (IS_ERR(opp)) {
> + pr_warning("%s: Unable to find OPP for vdd_%s freq%ld\n",
> + __func__, voltdm->name, freq);
> + return 0;
> + }
> +
> + /*
> + * Use higher freq voltage even if an exact match is not available
> + * we are probably masking a clock framework bug, so warn
> + */
> + if (unlikely(freq != vdd->volt_clk->rate))
> + pr_warning("%s: Available freq %ld != dpll freq %ld.\n",
> + __func__, freq, vdd->volt_clk->rate);
> +
> + return opp_get_voltage(opp);
> +}
Minor nit...
Rather than having to look this up in the OPP table every time, couldn't
this be initialized and stored in struct voltagedomain?
Whenever the voltage is changed, it's updated in struct voltagedomain
and doesn't have to be continually looked up in the OPP layer.
> +/**
> + * omap_vp_get_curr_volt : API to get the current vp voltage.
> + * @voltdm: pointer to the VDD.
> + *
> + * This API returns the current voltage for the specified voltage processor
> + */
> +unsigned long omap_vp_get_curr_volt(struct voltagedomain *voltdm)
> +{
> + struct omap_vdd_info *vdd;
> + u8 curr_vsel;
> +
> + if (!voltdm || IS_ERR(voltdm)) {
> + pr_warning("%s: VDD specified does not exist!\n", __func__);
> + return 0;
> + }
> +
> + vdd = container_of(voltdm, struct omap_vdd_info, voltdm);
> +
> + curr_vsel = voltage_read_reg(vdd->vp_offs.voltage);
> + return omap_twl_vsel_to_uv(curr_vsel);
> +}
This too. No need to read from the HW, if we just keep track of all
the changes in 'struct voltagedomain'.
Kevin
next prev parent reply other threads:[~2010-08-30 23:06 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-13 13:47 [PATCHv2 0/8] OMAP3: Adding Smartreflex and Voltage driver support Thara Gopinath
2010-08-13 13:47 ` [PATCHv2 1/8] OMAP: PM: Allowing an early init of pm debugfs driver Thara Gopinath
2010-08-24 22:16 ` Kevin Hilman
2010-08-24 22:21 ` Kevin Hilman
2010-09-14 14:56 ` Gopinath, Thara
2010-08-13 13:47 ` [PATCHv2 2/8] OMAP3: PM: Adding voltage driver support for OMAP3 Thara Gopinath
2010-08-25 0:01 ` Kevin Hilman
2010-09-14 15:32 ` Gopinath, Thara
2010-08-30 23:06 ` Kevin Hilman [this message]
2010-08-30 23:21 ` Kevin Hilman
2010-08-13 13:47 ` [PATCHv2 3/8] OMAP3: PM: Adding smartreflex driver support Thara Gopinath
2010-08-25 22:21 ` Kevin Hilman
2010-09-14 15:58 ` Gopinath, Thara
2010-09-14 17:04 ` Kevin Hilman
2010-08-13 13:47 ` [PATCHv2 4/8] OMAP3: PM: Adding smartreflex device file Thara Gopinath
2010-08-25 22:26 ` Kevin Hilman
2010-09-14 15:36 ` Gopinath, Thara
2010-09-14 16:03 ` Kevin Hilman
2010-09-15 6:12 ` Gopinath, Thara
2010-08-13 13:47 ` [PATCHv2 5/8] OMAP3: PM: Adding smartreflex hwmod data Thara Gopinath
2010-08-25 22:29 ` Kevin Hilman
2010-08-13 13:47 ` [PATCHv2 6/8] OMAP3: PM: Adding smartreflex class3 driver Thara Gopinath
2010-08-25 22:31 ` Kevin Hilman
2010-09-14 15:58 ` Gopinath, Thara
2010-08-13 13:47 ` [PATCHv2 7/8] OMAP3: PM: Adding T2 enabling of smartreflex support Thara Gopinath
2010-08-13 13:47 ` [PATCHv2 8/8] OMAP3: PM: Adding debug support to Voltage and Smartreflex drivers Thara Gopinath
2010-08-24 23:53 ` Kevin Hilman
2010-09-14 14:58 ` Gopinath, Thara
2010-09-14 16:05 ` Kevin Hilman
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=8739tvya3g.fsf@deeprootsystems.com \
--to=khilman@deeprootsystems.com \
--cc=b-cousson@ti.com \
--cc=dderrick@ti.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;
as well as URLs for NNTP newsgroup(s).