mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
cpufreq: expose scaling_cur_freq sysfs file for set_policy() drivers
commit c034b02e21
upstream.
Currently the core does not expose scaling_cur_freq for set_policy()
drivers this breaks some userspace monitoring tools.
Change the core to expose this file for all drivers and if the
set_policy() driver supports the get() callback use it to retrieve the
current frequency.
Link: https://bugzilla.kernel.org/show_bug.cgi?id=73741
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
[lizf: Backported to 3.4: adjust context]
Signed-off-by: Zefan Li <lizefan@huawei.com>
This commit is contained in:
parent
e930516632
commit
aea44610e1
1 changed files with 17 additions and 6 deletions
|
@ -371,7 +371,18 @@ show_one(cpuinfo_max_freq, cpuinfo.max_freq);
|
|||
show_one(cpuinfo_transition_latency, cpuinfo.transition_latency);
|
||||
show_one(scaling_min_freq, min);
|
||||
show_one(scaling_max_freq, max);
|
||||
show_one(scaling_cur_freq, cur);
|
||||
|
||||
static ssize_t show_scaling_cur_freq(
|
||||
struct cpufreq_policy *policy, char *buf)
|
||||
{
|
||||
ssize_t ret;
|
||||
|
||||
if (cpufreq_driver && cpufreq_driver->setpolicy && cpufreq_driver->get)
|
||||
ret = sprintf(buf, "%u\n", cpufreq_driver->get(policy->cpu));
|
||||
else
|
||||
ret = sprintf(buf, "%u\n", policy->cur);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int __cpufreq_set_policy(struct cpufreq_policy *data,
|
||||
struct cpufreq_policy *policy);
|
||||
|
@ -818,11 +829,11 @@ static int cpufreq_add_dev_interface(unsigned int cpu,
|
|||
if (ret)
|
||||
goto err_out_kobj_put;
|
||||
}
|
||||
if (cpufreq_driver->target) {
|
||||
ret = sysfs_create_file(&policy->kobj, &scaling_cur_freq.attr);
|
||||
if (ret)
|
||||
goto err_out_kobj_put;
|
||||
}
|
||||
|
||||
ret = sysfs_create_file(&policy->kobj, &scaling_cur_freq.attr);
|
||||
if (ret)
|
||||
goto err_out_kobj_put;
|
||||
|
||||
if (cpufreq_driver->bios_limit) {
|
||||
ret = sysfs_create_file(&policy->kobj, &bios_limit.attr);
|
||||
if (ret)
|
||||
|
|
Loading…
Reference in a new issue