Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 45a428eb authored by Aaro Koskinen's avatar Aaro Koskinen Committed by Rafael J. Wysocki
Browse files

cpufreq: pmac64: speed up frequency switch



Some functions on switch path use msleep() which is inaccurate, and
depends on HZ. With HZ=100 msleep(1) takes actually over ten times longer.
Using usleep_range() we get more accurate sleeps.

I measured the "pfunc_slewing_done" polling to take 300us at max (on
2.3GHz dual-processor Xserve G5), so using 500us sleep there should
be fine.

With the patch, g5_switch_freq() duration drops from ~50ms to ~10ms on
Xserve with HZ=100.

Signed-off-by: default avatarAaro Koskinen <aaro.koskinen@iki.fi>
Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Acked-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent fbbc5bfb
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -137,7 +137,7 @@ static void g5_vdnap_switch_volt(int speed_mode)
		pmf_call_one(pfunc_vdnap0_complete, &args);
		pmf_call_one(pfunc_vdnap0_complete, &args);
		if (done)
		if (done)
			break;
			break;
		msleep(1);
		usleep_range(1000, 1000);
	}
	}
	if (done == 0)
	if (done == 0)
		printk(KERN_WARNING "cpufreq: Timeout in clock slewing !\n");
		printk(KERN_WARNING "cpufreq: Timeout in clock slewing !\n");
@@ -236,7 +236,7 @@ static void g5_pfunc_switch_volt(int speed_mode)
		if (pfunc_cpu1_volt_low)
		if (pfunc_cpu1_volt_low)
			pmf_call_one(pfunc_cpu1_volt_low, NULL);
			pmf_call_one(pfunc_cpu1_volt_low, NULL);
	}
	}
	msleep(10); /* should be faster , to fix */
	usleep_range(10000, 10000); /* should be faster , to fix */
}
}


/*
/*
@@ -281,7 +281,7 @@ static int g5_pfunc_switch_freq(int speed_mode)
		pmf_call_one(pfunc_slewing_done, &args);
		pmf_call_one(pfunc_slewing_done, &args);
		if (done)
		if (done)
			break;
			break;
		msleep(1);
		usleep_range(500, 500);
	}
	}
	if (done == 0)
	if (done == 0)
		printk(KERN_WARNING "cpufreq: Timeout in clock slewing !\n");
		printk(KERN_WARNING "cpufreq: Timeout in clock slewing !\n");