blob: 8d830d860e9129baa02aaa6f384c433160a26f86 [file] [log] [blame]
Thomas Gleixnerd2912cb2019-06-04 10:11:33 +02001// SPDX-License-Identifier: GPL-2.0-only
Linus Torvalds1da177e2005-04-16 15:20:36 -07002/*
Viresh Kumarbb176f72013-06-19 14:19:33 +05303 * linux/drivers/cpufreq/cpufreq_powersave.c
Linus Torvalds1da177e2005-04-16 15:20:36 -07004 *
Viresh Kumarbb176f72013-06-19 14:19:33 +05305 * Copyright (C) 2002 - 2003 Dominik Brodowski <linux@brodo.de>
Linus Torvalds1da177e2005-04-16 15:20:36 -07006 */
7
Viresh Kumardb701152012-10-23 01:29:03 +02008#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
9
Linus Torvalds1da177e2005-04-16 15:20:36 -070010#include <linux/cpufreq.h>
11#include <linux/init.h>
Viresh Kumar5ff0a262013-08-06 22:53:03 +053012#include <linux/module.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070013
Rafael J. Wysockie7888922016-06-02 23:24:15 +020014static void cpufreq_gov_powersave_limits(struct cpufreq_policy *policy)
Linus Torvalds1da177e2005-04-16 15:20:36 -070015{
Rafael J. Wysockie7888922016-06-02 23:24:15 +020016 pr_debug("setting to %u kHz\n", policy->min);
17 __cpufreq_driver_target(policy, policy->min, CPUFREQ_RELATION_L);
Linus Torvalds1da177e2005-04-16 15:20:36 -070018}
Dave Jones32ee8c32006-02-28 00:43:23 -050019
Rafael J. Wysockide1df262016-02-05 02:37:42 +010020static struct cpufreq_governor cpufreq_gov_powersave = {
Linus Torvalds1da177e2005-04-16 15:20:36 -070021 .name = "powersave",
Rafael J. Wysockie7888922016-06-02 23:24:15 +020022 .limits = cpufreq_gov_powersave_limits,
Linus Torvalds1da177e2005-04-16 15:20:36 -070023 .owner = THIS_MODULE,
Rafael J. Wysocki218f6682020-11-10 18:26:10 +010024 .flags = CPUFREQ_GOV_STRICT_TARGET,
Linus Torvalds1da177e2005-04-16 15:20:36 -070025};
Linus Torvalds1da177e2005-04-16 15:20:36 -070026
Linus Torvalds1da177e2005-04-16 15:20:36 -070027MODULE_AUTHOR("Dominik Brodowski <linux@brodo.de>");
28MODULE_DESCRIPTION("CPUfreq policy governor 'powersave'");
29MODULE_LICENSE("GPL");
30
Alessandro Guido30d221d2008-04-18 13:31:13 -070031#ifdef CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE
Rafael J. Wysockide1df262016-02-05 02:37:42 +010032struct cpufreq_governor *cpufreq_default_governor(void)
33{
34 return &cpufreq_gov_powersave;
35}
Alessandro Guido30d221d2008-04-18 13:31:13 -070036#endif
Quentin Perret10dd8572020-06-29 13:54:59 +053037
38cpufreq_governor_init(cpufreq_gov_powersave);
39cpufreq_governor_exit(cpufreq_gov_powersave);