diff options
Diffstat (limited to 'drivers/cpufreq/cpufreq.c')
-rw-r--r-- | drivers/cpufreq/cpufreq.c | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 24bf76fba141..644b54e1e7d1 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -512,7 +512,18 @@ show_one(cpuinfo_max_freq, cpuinfo.max_freq); | |||
512 | show_one(cpuinfo_transition_latency, cpuinfo.transition_latency); | 512 | show_one(cpuinfo_transition_latency, cpuinfo.transition_latency); |
513 | show_one(scaling_min_freq, min); | 513 | show_one(scaling_min_freq, min); |
514 | show_one(scaling_max_freq, max); | 514 | show_one(scaling_max_freq, max); |
515 | show_one(scaling_cur_freq, cur); | 515 | |
516 | static ssize_t show_scaling_cur_freq( | ||
517 | struct cpufreq_policy *policy, char *buf) | ||
518 | { | ||
519 | ssize_t ret; | ||
520 | |||
521 | if (cpufreq_driver && cpufreq_driver->setpolicy && cpufreq_driver->get) | ||
522 | ret = sprintf(buf, "%u\n", cpufreq_driver->get(policy->cpu)); | ||
523 | else | ||
524 | ret = sprintf(buf, "%u\n", policy->cur); | ||
525 | return ret; | ||
526 | } | ||
516 | 527 | ||
517 | static int cpufreq_set_policy(struct cpufreq_policy *policy, | 528 | static int cpufreq_set_policy(struct cpufreq_policy *policy, |
518 | struct cpufreq_policy *new_policy); | 529 | struct cpufreq_policy *new_policy); |
@@ -906,11 +917,11 @@ static int cpufreq_add_dev_interface(struct cpufreq_policy *policy, | |||
906 | if (ret) | 917 | if (ret) |
907 | goto err_out_kobj_put; | 918 | goto err_out_kobj_put; |
908 | } | 919 | } |
909 | if (has_target()) { | 920 | |
910 | ret = sysfs_create_file(&policy->kobj, &scaling_cur_freq.attr); | 921 | ret = sysfs_create_file(&policy->kobj, &scaling_cur_freq.attr); |
911 | if (ret) | 922 | if (ret) |
912 | goto err_out_kobj_put; | 923 | goto err_out_kobj_put; |
913 | } | 924 | |
914 | if (cpufreq_driver->bios_limit) { | 925 | if (cpufreq_driver->bios_limit) { |
915 | ret = sysfs_create_file(&policy->kobj, &bios_limit.attr); | 926 | ret = sysfs_create_file(&policy->kobj, &bios_limit.attr); |
916 | if (ret) | 927 | if (ret) |
@@ -1731,6 +1742,21 @@ const char *cpufreq_get_current_driver(void) | |||
1731 | } | 1742 | } |
1732 | EXPORT_SYMBOL_GPL(cpufreq_get_current_driver); | 1743 | EXPORT_SYMBOL_GPL(cpufreq_get_current_driver); |
1733 | 1744 | ||
1745 | /** | ||
1746 | * cpufreq_get_driver_data - return current driver data | ||
1747 | * | ||
1748 | * Return the private data of the currently loaded cpufreq | ||
1749 | * driver, or NULL if no cpufreq driver is loaded. | ||
1750 | */ | ||
1751 | void *cpufreq_get_driver_data(void) | ||
1752 | { | ||
1753 | if (cpufreq_driver) | ||
1754 | return cpufreq_driver->driver_data; | ||
1755 | |||
1756 | return NULL; | ||
1757 | } | ||
1758 | EXPORT_SYMBOL_GPL(cpufreq_get_driver_data); | ||
1759 | |||
1734 | /********************************************************************* | 1760 | /********************************************************************* |
1735 | * NOTIFIER LISTS INTERFACE * | 1761 | * NOTIFIER LISTS INTERFACE * |
1736 | *********************************************************************/ | 1762 | *********************************************************************/ |