diff options
Diffstat (limited to 'drivers/cpufreq/cpufreq.c')
-rw-r--r-- | drivers/cpufreq/cpufreq.c | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index ff57c40e9b8b..f20668c09ce0 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -647,6 +647,21 @@ static ssize_t show_scaling_setspeed(struct cpufreq_policy *policy, char *buf) | |||
647 | return policy->governor->show_setspeed(policy, buf); | 647 | return policy->governor->show_setspeed(policy, buf); |
648 | } | 648 | } |
649 | 649 | ||
650 | /** | ||
651 | * show_scaling_driver - show the current cpufreq HW/BIOS limitation | ||
652 | */ | ||
653 | static ssize_t show_bios_limit(struct cpufreq_policy *policy, char *buf) | ||
654 | { | ||
655 | unsigned int limit; | ||
656 | int ret; | ||
657 | if (cpufreq_driver->bios_limit) { | ||
658 | ret = cpufreq_driver->bios_limit(policy->cpu, &limit); | ||
659 | if (!ret) | ||
660 | return sprintf(buf, "%u\n", limit); | ||
661 | } | ||
662 | return sprintf(buf, "%u\n", policy->cpuinfo.max_freq); | ||
663 | } | ||
664 | |||
650 | #define define_one_ro(_name) \ | 665 | #define define_one_ro(_name) \ |
651 | static struct freq_attr _name = \ | 666 | static struct freq_attr _name = \ |
652 | __ATTR(_name, 0444, show_##_name, NULL) | 667 | __ATTR(_name, 0444, show_##_name, NULL) |
@@ -666,6 +681,7 @@ define_one_ro(cpuinfo_transition_latency); | |||
666 | define_one_ro(scaling_available_governors); | 681 | define_one_ro(scaling_available_governors); |
667 | define_one_ro(scaling_driver); | 682 | define_one_ro(scaling_driver); |
668 | define_one_ro(scaling_cur_freq); | 683 | define_one_ro(scaling_cur_freq); |
684 | define_one_ro(bios_limit); | ||
669 | define_one_ro(related_cpus); | 685 | define_one_ro(related_cpus); |
670 | define_one_ro(affected_cpus); | 686 | define_one_ro(affected_cpus); |
671 | define_one_rw(scaling_min_freq); | 687 | define_one_rw(scaling_min_freq); |
@@ -767,8 +783,9 @@ static struct kobj_type ktype_cpufreq = { | |||
767 | * 0: Success | 783 | * 0: Success |
768 | * Positive: When we have a managed CPU and the sysfs got symlinked | 784 | * Positive: When we have a managed CPU and the sysfs got symlinked |
769 | */ | 785 | */ |
770 | int cpufreq_add_dev_policy(unsigned int cpu, struct cpufreq_policy *policy, | 786 | static int cpufreq_add_dev_policy(unsigned int cpu, |
771 | struct sys_device *sys_dev) | 787 | struct cpufreq_policy *policy, |
788 | struct sys_device *sys_dev) | ||
772 | { | 789 | { |
773 | int ret = 0; | 790 | int ret = 0; |
774 | #ifdef CONFIG_SMP | 791 | #ifdef CONFIG_SMP |
@@ -842,7 +859,8 @@ int cpufreq_add_dev_policy(unsigned int cpu, struct cpufreq_policy *policy, | |||
842 | 859 | ||
843 | 860 | ||
844 | /* symlink affected CPUs */ | 861 | /* symlink affected CPUs */ |
845 | int cpufreq_add_dev_symlink(unsigned int cpu, struct cpufreq_policy *policy) | 862 | static int cpufreq_add_dev_symlink(unsigned int cpu, |
863 | struct cpufreq_policy *policy) | ||
846 | { | 864 | { |
847 | unsigned int j; | 865 | unsigned int j; |
848 | int ret = 0; | 866 | int ret = 0; |
@@ -869,8 +887,9 @@ int cpufreq_add_dev_symlink(unsigned int cpu, struct cpufreq_policy *policy) | |||
869 | return ret; | 887 | return ret; |
870 | } | 888 | } |
871 | 889 | ||
872 | int cpufreq_add_dev_interface(unsigned int cpu, struct cpufreq_policy *policy, | 890 | static int cpufreq_add_dev_interface(unsigned int cpu, |
873 | struct sys_device *sys_dev) | 891 | struct cpufreq_policy *policy, |
892 | struct sys_device *sys_dev) | ||
874 | { | 893 | { |
875 | struct cpufreq_policy new_policy; | 894 | struct cpufreq_policy new_policy; |
876 | struct freq_attr **drv_attr; | 895 | struct freq_attr **drv_attr; |
@@ -902,6 +921,11 @@ int cpufreq_add_dev_interface(unsigned int cpu, struct cpufreq_policy *policy, | |||
902 | if (ret) | 921 | if (ret) |
903 | goto err_out_kobj_put; | 922 | goto err_out_kobj_put; |
904 | } | 923 | } |
924 | if (cpufreq_driver->bios_limit) { | ||
925 | ret = sysfs_create_file(&policy->kobj, &bios_limit.attr); | ||
926 | if (ret) | ||
927 | goto err_out_kobj_put; | ||
928 | } | ||
905 | 929 | ||
906 | spin_lock_irqsave(&cpufreq_driver_lock, flags); | 930 | spin_lock_irqsave(&cpufreq_driver_lock, flags); |
907 | for_each_cpu(j, policy->cpus) { | 931 | for_each_cpu(j, policy->cpus) { |