Hi Jonghwan,
On 7 May 2014 20:42, Jonghwan Choi jhbird.choi@samsung.com wrote:
Does it need a hardware change for using CPPC?
CPPC requires support in firmware (e.g. in the BMC). The performance registers can be implemented as memory mapped counters or dedicated registers.
+static int cppc_cpufreq_target(struct cpufreq_policy *policy,
unsigned int target_freq,
unsigned int relation)
+{
unsigned int cpu = policy->cpu;
struct cpc_desc *current_cpu_cpc = per_cpu(cpc_desc, cpu);
struct cpufreq_freqs freqs;
u16 status;
freqs.old = policy->cur;
freqs.new = target_freq;
cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE);
/* Set CPU Perf thresholds and current desired perf value. */
acpi_write(policy->max, ¤t_cpu_cpc->pcc_regs[MAX_PERF]);
acpi_write(policy->min, ¤t_cpu_cpc->pcc_regs[MIN_PERF]);
acpi_write(target_freq, ¤t_cpu_cpc->pcc_regs[DESIRED_PERF]);
status = send_pcc_cmd(CMD_WRITE, 0, PCC_SUBSPACE_IDX,
comm_base_addr);
if (status & CMD_COMPLETE) {
pr_debug("Failed to set target CPU perf for CPU:%d,
status:%d\n",
cpu, status);
return -EINVAL;
}
return 0;
+}
-> Don't need cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE)?
Yes will need some sort of post notify transition here.
/* Base address returned from PCC subspace desc needs to ioremap'd.
* Used by the client to send/recv data from platform.
*/
comm_base_addr = ioremap_nocache(pcc_comm_base_addr, len);
if (comm_base_addr) {
->Should be if (!comm_base_addr) ?
D'oh! Thanks for catching this.
Like I mentioned in the cover letter of this series, the CPPC patch is only compile tested. I'm trying to verify it at runtime, but I've put it out there early so that anyone who already has platform support for CPPC can help us immensely in giving it a try. Come to think of it, I should have probably mentioned this again in the subject of this patch. Will do it in the next revision. :)
Thanks for your quick review!
Cheers, Ashwin