cpufreq.c (1724c7c0c9494dcbdd7f630f29e1e8427cb231d1) cpufreq.c (e948bc8fbee077735c2b71b991a5ca5e573f3506)
1/*
2 * linux/drivers/cpufreq/cpufreq.c
3 *
4 * Copyright (C) 2001 Russell King
5 * (C) 2002 - 2003 Dominik Brodowski <linux@brodo.de>
6 * (C) 2013 Viresh Kumar <viresh.kumar@linaro.org>
7 *
8 * Oct 2005 - Ashok Raj <ashok.raj@intel.com>

--- 510 unchanged lines hidden (view full) ---

519
520 if (cpufreq_driver->resolve_freq)
521 return cpufreq_driver->resolve_freq(policy, target_freq);
522
523 return target_freq;
524}
525EXPORT_SYMBOL_GPL(cpufreq_driver_resolve_freq);
526
1/*
2 * linux/drivers/cpufreq/cpufreq.c
3 *
4 * Copyright (C) 2001 Russell King
5 * (C) 2002 - 2003 Dominik Brodowski <linux@brodo.de>
6 * (C) 2013 Viresh Kumar <viresh.kumar@linaro.org>
7 *
8 * Oct 2005 - Ashok Raj <ashok.raj@intel.com>

--- 510 unchanged lines hidden (view full) ---

519
520 if (cpufreq_driver->resolve_freq)
521 return cpufreq_driver->resolve_freq(policy, target_freq);
522
523 return target_freq;
524}
525EXPORT_SYMBOL_GPL(cpufreq_driver_resolve_freq);
526
527unsigned int cpufreq_policy_transition_delay_us(struct cpufreq_policy *policy)
528{
529 unsigned int latency;
530
531 if (policy->transition_delay_us)
532 return policy->transition_delay_us;
533
534 latency = policy->cpuinfo.transition_latency / NSEC_PER_USEC;
535 if (latency) {
536 /*
537 * For platforms that can change the frequency very fast (< 10
538 * us), the above formula gives a decent transition delay. But
539 * for platforms where transition_latency is in milliseconds, it
540 * ends up giving unrealistic values.
541 *
542 * Cap the default transition delay to 10 ms, which seems to be
543 * a reasonable amount of time after which we should reevaluate
544 * the frequency.
545 */
546 return min(latency * LATENCY_MULTIPLIER, (unsigned int)10000);
547 }
548
549 return LATENCY_MULTIPLIER;
550}
551EXPORT_SYMBOL_GPL(cpufreq_policy_transition_delay_us);
552
527/*********************************************************************
528 * SYSFS INTERFACE *
529 *********************************************************************/
530static ssize_t show_boost(struct kobject *kobj,
531 struct attribute *attr, char *buf)
532{
533 return sprintf(buf, "%d\n", cpufreq_driver->boost_enabled);
534}

--- 1448 unchanged lines hidden (view full) ---

1983 return 0;
1984 /*
1985 * Governor might not be initiated here if ACPI _PPC changed
1986 * notification happened, so check it.
1987 */
1988 if (!policy->governor)
1989 return -EINVAL;
1990
553/*********************************************************************
554 * SYSFS INTERFACE *
555 *********************************************************************/
556static ssize_t show_boost(struct kobject *kobj,
557 struct attribute *attr, char *buf)
558{
559 return sprintf(buf, "%d\n", cpufreq_driver->boost_enabled);
560}

--- 1448 unchanged lines hidden (view full) ---

2009 return 0;
2010 /*
2011 * Governor might not be initiated here if ACPI _PPC changed
2012 * notification happened, so check it.
2013 */
2014 if (!policy->governor)
2015 return -EINVAL;
2016
1991 if (policy->governor->max_transition_latency &&
1992 policy->cpuinfo.transition_latency >
1993 policy->governor->max_transition_latency) {
2017 /* Platform doesn't want dynamic frequency switching ? */
2018 if (policy->governor->dynamic_switching &&
2019 cpufreq_driver->flags & CPUFREQ_NO_AUTO_DYNAMIC_SWITCHING) {
1994 struct cpufreq_governor *gov = cpufreq_fallback_governor();
1995
1996 if (gov) {
2020 struct cpufreq_governor *gov = cpufreq_fallback_governor();
2021
2022 if (gov) {
1997 pr_warn("%s governor failed, too long transition latency of HW, fallback to %s governor\n",
2023 pr_warn("Can't use %s governor as dynamic switching is disallowed. Fallback to %s governor\n",
1998 policy->governor->name, gov->name);
1999 policy->governor = gov;
2000 } else {
2001 return -EINVAL;
2002 }
2003 }
2004
2005 if (!try_module_get(policy->governor->owner))

--- 566 unchanged lines hidden ---
2024 policy->governor->name, gov->name);
2025 policy->governor = gov;
2026 } else {
2027 return -EINVAL;
2028 }
2029 }
2030
2031 if (!try_module_get(policy->governor->owner))

--- 566 unchanged lines hidden ---