~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/Documentation/cpu-freq/core.rst

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 .. SPDX-License-Identifier: GPL-2.0
  2 
  3 =============================================================
  4 General description of the CPUFreq core and CPUFreq notifiers
  5 =============================================================
  6 
  7 Authors:
  8         - Dominik Brodowski  <linux@brodo.de>
  9         - David Kimdon <dwhedon@debian.org>
 10         - Rafael J. Wysocki <rafael.j.wysocki@intel.com>
 11         - Viresh Kumar <viresh.kumar@linaro.org>
 12 
 13 .. Contents:
 14 
 15    1.  CPUFreq core and interfaces
 16    2.  CPUFreq notifiers
 17    3.  CPUFreq Table Generation with Operating Performance Point (OPP)
 18 
 19 1. General Information
 20 ======================
 21 
 22 The CPUFreq core code is located in drivers/cpufreq/cpufreq.c. This
 23 cpufreq code offers a standardized interface for the CPUFreq
 24 architecture drivers (those pieces of code that do actual
 25 frequency transitions), as well as to "notifiers". These are device
 26 drivers or other part of the kernel that need to be informed of
 27 policy changes (ex. thermal modules like ACPI) or of all
 28 frequency changes (ex. timing code) or even need to force certain
 29 speed limits (like LCD drivers on ARM architecture). Additionally, the
 30 kernel "constant" loops_per_jiffy is updated on frequency changes
 31 here.
 32 
 33 Reference counting of the cpufreq policies is done by cpufreq_cpu_get
 34 and cpufreq_cpu_put, which make sure that the cpufreq driver is
 35 correctly registered with the core, and will not be unloaded until
 36 cpufreq_put_cpu is called. That also ensures that the respective cpufreq
 37 policy doesn't get freed while being used.
 38 
 39 2. CPUFreq notifiers
 40 ====================
 41 
 42 CPUFreq notifiers conform to the standard kernel notifier interface.
 43 See linux/include/linux/notifier.h for details on notifiers.
 44 
 45 There are two different CPUFreq notifiers - policy notifiers and
 46 transition notifiers.
 47 
 48 
 49 2.1 CPUFreq policy notifiers
 50 ----------------------------
 51 
 52 These are notified when a new policy is created or removed.
 53 
 54 The phase is specified in the second argument to the notifier.  The phase is
 55 CPUFREQ_CREATE_POLICY when the policy is first created and it is
 56 CPUFREQ_REMOVE_POLICY when the policy is removed.
 57 
 58 The third argument, a ``void *pointer``, points to a struct cpufreq_policy
 59 consisting of several values, including min, max (the lower and upper
 60 frequencies (in kHz) of the new policy).
 61 
 62 
 63 2.2 CPUFreq transition notifiers
 64 --------------------------------
 65 
 66 These are notified twice for each online CPU in the policy, when the
 67 CPUfreq driver switches the CPU core frequency and this change has no
 68 any external implications.
 69 
 70 The second argument specifies the phase - CPUFREQ_PRECHANGE or
 71 CPUFREQ_POSTCHANGE.
 72 
 73 The third argument is a struct cpufreq_freqs with the following
 74 values:
 75 
 76 ======  ======================================
 77 policy  a pointer to the struct cpufreq_policy
 78 old     old frequency
 79 new     new frequency
 80 flags   flags of the cpufreq driver
 81 ======  ======================================
 82 
 83 3. CPUFreq Table Generation with Operating Performance Point (OPP)
 84 ==================================================================
 85 For details about OPP, see Documentation/power/opp.rst
 86 
 87 dev_pm_opp_init_cpufreq_table -
 88         This function provides a ready to use conversion routine to translate
 89         the OPP layer's internal information about the available frequencies
 90         into a format readily providable to cpufreq.
 91 
 92         .. Warning::
 93 
 94            Do not use this function in interrupt context.
 95 
 96         Example::
 97 
 98          soc_pm_init()
 99          {
100                 /* Do things */
101                 r = dev_pm_opp_init_cpufreq_table(dev, &freq_table);
102                 if (!r)
103                         policy->freq_table = freq_table;
104                 /* Do other things */
105          }
106 
107         .. note::
108 
109            This function is available only if CONFIG_CPU_FREQ is enabled in
110            addition to CONFIG_PM_OPP.
111 
112 dev_pm_opp_free_cpufreq_table
113         Free up the table allocated by dev_pm_opp_init_cpufreq_table

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php