cpufreq_powersave.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * linux/drivers/cpufreq/cpufreq_powersave.c
  3. *
  4. * Copyright (C) 2002 - 2003 Dominik Brodowski <linux@brodo.de>
  5. *
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. *
  11. */
  12. #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
  13. #include <linux/cpufreq.h>
  14. #include <linux/init.h>
  15. #include <linux/module.h>
  16. static void cpufreq_gov_powersave_limits(struct cpufreq_policy *policy)
  17. {
  18. pr_debug("setting to %u kHz\n", policy->min);
  19. __cpufreq_driver_target(policy, policy->min, CPUFREQ_RELATION_L);
  20. }
  21. static struct cpufreq_governor cpufreq_gov_powersave = {
  22. .name = "powersave",
  23. .limits = cpufreq_gov_powersave_limits,
  24. .owner = THIS_MODULE,
  25. };
  26. static int __init cpufreq_gov_powersave_init(void)
  27. {
  28. return cpufreq_register_governor(&cpufreq_gov_powersave);
  29. }
  30. static void __exit cpufreq_gov_powersave_exit(void)
  31. {
  32. cpufreq_unregister_governor(&cpufreq_gov_powersave);
  33. }
  34. MODULE_AUTHOR("Dominik Brodowski <linux@brodo.de>");
  35. MODULE_DESCRIPTION("CPUfreq policy governor 'powersave'");
  36. MODULE_LICENSE("GPL");
  37. #ifdef CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE
  38. struct cpufreq_governor *cpufreq_default_governor(void)
  39. {
  40. return &cpufreq_gov_powersave;
  41. }
  42. fs_initcall(cpufreq_gov_powersave_init);
  43. #else
  44. module_init(cpufreq_gov_powersave_init);
  45. #endif
  46. module_exit(cpufreq_gov_powersave_exit);