[PATCH 5/5] ARM: omap: initialize voltdm->nominal_volt

Mike Turquette mturquette at ti.com
Wed Oct 3 21:16:05 EDT 2012


From: Mike Turquette <mturquette at linaro.org>

Populate the .get_voltage callbacks for VC & VP.  Use these callbacks to
populate voltdm->nominal_volt during boot sequence.

This is useful for the Adaptive Body-Bias sequence coming in a
subsequent series.  Without this patch voltdm->nominal will not be
populated until after the first call to voltdm_scale.  This is too late
to be useful to the pre-scale sequence in the ABB series since that
sequence needs to know the voltage prior to the first transition.

Note that the .get_voltage callback will return zero for the corner case
wherein the bootloader has not scaling the voltage.  In this case it is
safe to assume that we are running at the PMIC's default power-on
voltage.  DT data providing the default voltage for each PMIC is needed
in this case.

Signed-off-by: Mike Turquette <mturquette at ti.com>
Signed-off-by: Mike Turquette <mturquette at linaro.org>
---
 arch/arm/mach-omap2/voltage.c |   13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/arch/arm/mach-omap2/voltage.c b/arch/arm/mach-omap2/voltage.c
index 4dc60e8..f45716c 100644
--- a/arch/arm/mach-omap2/voltage.c
+++ b/arch/arm/mach-omap2/voltage.c
@@ -244,9 +244,11 @@ void omap_change_voltscale_method(struct voltagedomain *voltdm,
 	switch (voltscale_method) {
 	case VOLTSCALE_VPFORCEUPDATE:
 		voltdm->scale = omap_vp_forceupdate_scale;
+		voltdm->get_voltage = omap_vp_get_init_voltage;
 		return;
 	case VOLTSCALE_VCBYPASS:
 		voltdm->scale = omap_vc_bypass_scale;
+		voltdm->get_voltage = omap_vc_get_bypass_data;
 		return;
 	default:
 		pr_warning("%s: Trying to change the method of voltage scaling"
@@ -288,13 +290,24 @@ int __init omap_voltage_late_init(void)
 
 		if (voltdm->vc) {
 			voltdm->scale = omap_vc_bypass_scale;
+			voltdm->get_voltage = omap_vc_get_bypass_data;
 			omap_vc_init_channel(voltdm);
 		}
 
 		if (voltdm->vp) {
 			voltdm->scale = omap_vp_forceupdate_scale;
+			voltdm->get_voltage = omap_vp_get_init_voltage;
 			omap_vp_init(voltdm);
 		}
+
+		/*
+		 * XXX If voltdm->nominal_volt is zero after calling
+		 * voltdm->get_voltage then we are likely running this
+		 * voltage domain at the default boot voltage of the
+		 * PMIC.  In such a case it would be best to load this
+		 * value from DT.
+		 */
+		voltdm->nominal_volt = voltdm->get_voltage(voltdm);
 	}
 
 	return 0;
-- 
1.7.9.5




More information about the linux-arm-kernel mailing list