ARM: tegra: dvfs: Check I2C pending flag for CL-DVFS tuning
Alex Frid [Fri, 1 Mar 2013 04:13:35 +0000 (20:13 -0800)]
In CL-DVFS tuning timer callback ignored last I2C data, and re-start
timer, if I2C pending flag is set.

Change-Id: Ifb609ff66498f30e20f0d9a0a5a56901ed707808
Signed-off-by: Alex Frid <afrid@nvidia.com>
Reviewed-on: http://git-master/r/205382
(cherry picked from commit e31e9249827b3ec34f48cec9e28c3103a399a430)
Reviewed-on: http://git-master/r/207893
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Yu-Huan Hsu <yhsu@nvidia.com>

arch/arm/mach-tegra/tegra_cl_dvfs.c

index 3dd3eac..ddf92eb 100644 (file)
@@ -530,7 +530,8 @@ static void tune_timer_cb(unsigned long data)
                val = cl_dvfs_readl(cld, CL_DVFS_I2C_STS);
                out_last = (val >> CL_DVFS_I2C_STS_I2C_LAST_SHIFT) & OUT_MASK;
 
-               if ((out_last >= cld->tune_high_out_min)  &&
+               if (!(val & CL_DVFS_I2C_STS_I2C_REQ_PENDING) &&
+                   (out_last >= cld->tune_high_out_min)  &&
                    (out_min >= cld->tune_high_out_min)) {
                        udelay(CL_DVFS_OUTPUT_RAMP_DELAY);
                        set_tune_state(cld, TEGRA_CL_DVFS_TUNE_HIGH);