From: khilman@deeprootsystems•com (Kevin Hilman)
To: linux-arm-kernel@lists•infradead.org
Subject: [PATCH 3/5] ARM: omap: vc: .get_voltage callback
Date: Fri, 26 Oct 2012 11:13:43 -0700 [thread overview]
Message-ID: <87sj91hzjc.fsf@deeprootsystems.com> (raw)
In-Reply-To: <1349313365-5262-4-git-send-email-mturquette@ti.com> (Mike Turquette's message of "Wed, 3 Oct 2012 18:16:03 -0700")
Mike Turquette <mturquette@ti•com> writes:
> From: Mike Turquette <mturquette@linaro•org>
>
> Implement the voltdm->get_voltage callback for the voltage controller
> driver.
nit: since it's not actually used in this series, it should say
Impelment the function that will be used as the ->get_voltage()
callback...
> This reads the DATA field corresponding to each VC and returns
> the voltage, after converting it from vsel format.
>
> If DATA is zero (the reset value) then the caller must interpret this as
> the PMIC running at the default power-on voltage. In such a case DT
> data for the PMIC is necessary to know the voltage.
>
> Signed-off-by: Mike Turquette <mturquette@ti•com>
> Signed-off-by: Mike Turquette <mturquette@linaro•org>
> ---
> arch/arm/mach-omap2/vc.c | 21 +++++++++++++++++++++
> arch/arm/mach-omap2/vc.h | 1 +
> 2 files changed, 22 insertions(+)
>
> diff --git a/arch/arm/mach-omap2/vc.c b/arch/arm/mach-omap2/vc.c
> index 2bcac64..90a9ea6 100644
> --- a/arch/arm/mach-omap2/vc.c
> +++ b/arch/arm/mach-omap2/vc.c
> @@ -101,6 +101,27 @@ static int omap_vc_config_channel(struct voltagedomain *voltdm)
> }
>
> /* Voltage scale and accessory APIs */
> +unsigned long omap_vc_get_bypass_data(struct voltagedomain *voltdm)
> +{
> + struct omap_vc_channel *vc = voltdm->vc;
> + u32 vc_bypass_value;
> + u8 vsel;
> + unsigned long volt;
> +
> + /* sanity */
> + if (!voltdm->pmic || !voltdm->pmic->vsel_to_uv ||
> + !voltdm->read || !voltdm->write)
> + return 0;
> +
> + vc_bypass_value = voltdm->read(vc->common->bypass_val_reg);
> + vc_bypass_value &= vc->common->data_mask;
> + vsel = vc_bypass_value >> __ffs(vc->common->data_mask);
Ah, now I see where the data_mask is used. :)
Kevin
> + volt = voltdm->pmic->vsel_to_uv(vsel);
> +
> + return volt;
> +}
> +
> int omap_vc_pre_scale(struct voltagedomain *voltdm,
> unsigned long target_volt,
> u8 *target_vsel, u8 *current_vsel)
> diff --git a/arch/arm/mach-omap2/vc.h b/arch/arm/mach-omap2/vc.h
> index 84a61b1..e7d4719 100644
> --- a/arch/arm/mach-omap2/vc.h
> +++ b/arch/arm/mach-omap2/vc.h
> @@ -112,6 +112,7 @@ extern struct omap_vc_channel omap4_vc_iva;
> extern struct omap_vc_channel omap4_vc_core;
>
> void omap_vc_init_channel(struct voltagedomain *voltdm);
> +unsigned long omap_vc_get_bypass_data(struct voltagedomain *voltdm);
> int omap_vc_pre_scale(struct voltagedomain *voltdm,
> unsigned long target_volt,
> u8 *target_vsel, u8 *current_vsel);
next prev parent reply other threads:[~2012-10-26 18:13 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-04 1:16 [RFC][PATCH 0/5] Introduce .get_voltage callback into voltdm Mike Turquette
2012-10-04 1:16 ` [PATCH 1/5] ARM: omap: vc: replace data_shift with data_mask Mike Turquette
2012-10-26 17:27 ` Kevin Hilman
2012-10-04 1:16 ` [PATCH 2/5] ARM: omap: introduce .get_voltage callback Mike Turquette
2012-10-04 1:16 ` [PATCH 3/5] ARM: omap: vc: " Mike Turquette
2012-10-26 18:13 ` Kevin Hilman [this message]
2012-10-04 1:16 ` [PATCH 4/5] ARM: omap: vp: " Mike Turquette
2012-10-04 1:16 ` [PATCH 5/5] ARM: omap: initialize voltdm->nominal_volt Mike Turquette
2012-10-26 18:17 ` [RFC][PATCH 0/5] Introduce .get_voltage callback into voltdm Kevin Hilman
2012-10-26 19:40 ` Mike Turquette
2013-03-31 2:35 ` Paul Walmsley
2013-04-01 21:56 ` Mike Turquette
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=87sj91hzjc.fsf@deeprootsystems.com \
--to=khilman@deeprootsystems$(echo .)com \
--cc=linux-arm-kernel@lists$(echo .)infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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