cpufreq: Specify default governor on command line
authorQuentin Perret <qperret@google.com>
Mon, 29 Jun 2020 08:25:00 +0000 (13:55 +0530)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 2 Jul 2020 11:03:30 +0000 (13:03 +0200)
commit8412b4563e5910485c7bcd4fdcd8bcc3e728284c
tree65b3dd3492c141dfa9feb32bd3b99de656cc1205
parent10dd8573b09e84b81539d939d55ebdb6a36c5f3a
cpufreq: Specify default governor on command line

Currently, the only way to specify the default CPUfreq governor is
via Kconfig options, which suits users who can build the kernel
themselves perfectly.

However, for those who use a distro-like kernel (such as Android,
with the Generic Kernel Image project), the only way to use a
non-default governor is to boot to userspace, and to then switch
using the sysfs interface. Being able to specify the default governor
on the command line, like is the case for cpuidle, would allow those
users to specify their governor of choice earlier on, and to simplify
the userspace boot procedure slighlty.

To support this use-case, add a kernel command line parameter
allowing the default governor for CPUfreq to be specified, which
takes precedence over the built-in default.

This implementation has one notable limitation: the default governor
must be registered before the driver. This is solved for builtin
governors and drivers using appropriate *_initcall() functions. And
in the modular case, this must be reflected as a constraint on the
module loading order.

Signed-off-by: Quentin Perret <qperret@google.com>
[ Viresh: Converted 'default_governor' to a string and parsing it only
  at initcall level, and several updates to
  cpufreq_init_policy(). ]
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
[ rjw: Changelog ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Documentation/admin-guide/kernel-parameters.txt
Documentation/admin-guide/pm/cpufreq.rst
drivers/cpufreq/cpufreq.c