aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq/cpufreq.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/cpufreq/cpufreq.c')
-rw-r--r--drivers/cpufreq/cpufreq.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 613314851ecc..64926aa990db 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -601,6 +601,31 @@ static ssize_t show_affected_cpus (struct cpufreq_policy * policy, char *buf)
601 return i; 601 return i;
602} 602}
603 603
604static ssize_t store_scaling_setspeed(struct cpufreq_policy *policy,
605 const char *buf, size_t count)
606{
607 unsigned int freq = 0;
608 unsigned int ret;
609
610 if (!policy->governor->store_setspeed)
611 return -EINVAL;
612
613 ret = sscanf(buf, "%u", &freq);
614 if (ret != 1)
615 return -EINVAL;
616
617 policy->governor->store_setspeed(policy, freq);
618
619 return count;
620}
621
622static ssize_t show_scaling_setspeed(struct cpufreq_policy *policy, char *buf)
623{
624 if (!policy->governor->show_setspeed)
625 return sprintf(buf, "<unsupported>\n");
626
627 return policy->governor->show_setspeed(policy, buf);
628}
604 629
605#define define_one_ro(_name) \ 630#define define_one_ro(_name) \
606static struct freq_attr _name = \ 631static struct freq_attr _name = \
@@ -624,6 +649,7 @@ define_one_ro(affected_cpus);
624define_one_rw(scaling_min_freq); 649define_one_rw(scaling_min_freq);
625define_one_rw(scaling_max_freq); 650define_one_rw(scaling_max_freq);
626define_one_rw(scaling_governor); 651define_one_rw(scaling_governor);
652define_one_rw(scaling_setspeed);
627 653
628static struct attribute * default_attrs[] = { 654static struct attribute * default_attrs[] = {
629 &cpuinfo_min_freq.attr, 655 &cpuinfo_min_freq.attr,
@@ -634,6 +660,7 @@ static struct attribute * default_attrs[] = {
634 &scaling_governor.attr, 660 &scaling_governor.attr,
635 &scaling_driver.attr, 661 &scaling_driver.attr,
636 &scaling_available_governors.attr, 662 &scaling_available_governors.attr,
663 &scaling_setspeed.attr,
637 NULL 664 NULL
638}; 665};
639 666