€•öKŒsphinx.addnodes”Œdocument”“”)”}”(Œ rawsource”Œ”Œchildren”]”(Œ translations”Œ LanguagesNode”“”)”}”(hhh]”(hŒ pending_xref”“”)”}”(hhh]”Œdocutils.nodes”ŒText”“”ŒChinese (Simplified)”…””}”Œparent”hsbaŒ attributes”}”(Œids”]”Œclasses”]”Œnames”]”Œdupnames”]”Œbackrefs”]”Œ refdomain”Œstd”Œreftype”Œdoc”Œ reftarget”Œ!/translations/zh_CN/cpu-freq/core”Œmodname”NŒ classname”NŒ refexplicit”ˆuŒtagname”hhh ubh)”}”(hhh]”hŒChinese (Traditional)”…””}”hh2sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ!/translations/zh_TW/cpu-freq/core”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒItalian”…””}”hhFsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ!/translations/it_IT/cpu-freq/core”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒJapanese”…””}”hhZsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ!/translations/ja_JP/cpu-freq/core”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒKorean”…””}”hhnsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ!/translations/ko_KR/cpu-freq/core”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒPortuguese (Brazilian)”…””}”hh‚sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ!/translations/pt_BR/cpu-freq/core”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒSpanish”…””}”hh–sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ!/translations/sp_SP/cpu-freq/core”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubeh}”(h]”h ]”h"]”h$]”h&]”Œcurrent_language”ŒEnglish”uh1h hhŒ _document”hŒsource”NŒline”NubhŒcomment”“”)”}”(hŒ SPDX-License-Identifier: GPL-2.0”h]”hŒ SPDX-License-Identifier: GPL-2.0”…””}”hh·sbah}”(h]”h ]”h"]”h$]”h&]”Œ xml:space”Œpreserve”uh1hµhhh²hh³Œ;/var/lib/git/docbuild/linux/Documentation/cpu-freq/core.rst”h´KubhŒsection”“”)”}”(hhh]”(hŒtitle”“”)”}”(hŒ=General description of the CPUFreq core and CPUFreq notifiers”h]”hŒ=General description of the CPUFreq core and CPUFreq notifiers”…””}”(hhÏh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhhÊh²hh³hÇh´KubhŒdefinition_list”“”)”}”(hhh]”hŒdefinition_list_item”“”)”}”(hŒ­Authors: - Dominik Brodowski - David Kimdon - Rafael J. Wysocki - Viresh Kumar ”h]”(hŒterm”“”)”}”(hŒAuthors:”h]”hŒAuthors:”…””}”(hhêh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hèh³hÇh´K hhäubhŒ definition”“”)”}”(hhh]”hŒ bullet_list”“”)”}”(hhh]”(hŒ list_item”“”)”}”(hŒ#Dominik Brodowski ”h]”hŒ paragraph”“”)”}”(hjh]”(hŒDominik Brodowski <”…””}”(hj h²hh³Nh´NubhŒ reference”“”)”}”(hŒlinux@brodo.de”h]”hŒlinux@brodo.de”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”Œmailto:linux@brodo.de”uh1jhj ubhŒ>”…””}”(hj h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´Khjubah}”(h]”h ]”h"]”h$]”h&]”uh1jhhÿubj)”}”(hŒ!David Kimdon ”h]”j )”}”(hj5h]”(hŒDavid Kimdon <”…””}”(hj7h²hh³Nh´Nubj)”}”(hŒdwhedon@debian.org”h]”hŒdwhedon@debian.org”…””}”(hj>h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”Œmailto:dwhedon@debian.org”uh1jhj7ubhŒ>”…””}”(hj7h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´K hj3ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhhÿubj)”}”(hŒ.Rafael J. Wysocki ”h]”j )”}”(hj`h]”(hŒRafael J. Wysocki <”…””}”(hjbh²hh³Nh´Nubj)”}”(hŒrafael.j.wysocki@intel.com”h]”hŒrafael.j.wysocki@intel.com”…””}”(hjih²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”Œ!mailto:rafael.j.wysocki@intel.com”uh1jhjbubhŒ>”…””}”(hjbh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´K hj^ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhhÿubj)”}”(hŒ'Viresh Kumar ”h]”j )”}”(hŒ&Viresh Kumar ”h]”(hŒViresh Kumar <”…””}”(hjh²hh³Nh´Nubj)”}”(hŒviresh.kumar@linaro.org”h]”hŒviresh.kumar@linaro.org”…””}”(hj•h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”Œmailto:viresh.kumar@linaro.org”uh1jhjubhŒ>”…””}”(hjh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´K hj‰ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhhÿubeh}”(h]”h ]”h"]”h$]”h&]”Œbullet”Œ-”uh1hýh³hÇh´Khhúubah}”(h]”h ]”h"]”h$]”h&]”uh1høhhäubeh}”(h]”h ]”h"]”h$]”h&]”uh1hâh³hÇh´K hhßubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝhhÊh²hh³Nh´Nubh¶)”}”(hŒ„Contents: 1. CPUFreq core and interfaces 2. CPUFreq notifiers 3. CPUFreq Table Generation with Operating Performance Point (OPP)”h]”hŒ„Contents: 1. CPUFreq core and interfaces 2. CPUFreq notifiers 3. CPUFreq Table Generation with Operating Performance Point (OPP)”…””}”hjÏsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1hµhhÊh²hh³hÇh´KubhÉ)”}”(hhh]”(hÎ)”}”(hŒ1. General Information”h]”hŒ1. General Information”…””}”(hjàh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjÝh²hh³hÇh´Kubj )”}”(hXHThe CPUFreq core code is located in drivers/cpufreq/cpufreq.c. This cpufreq code offers a standardized interface for the CPUFreq architecture drivers (those pieces of code that do actual frequency transitions), as well as to "notifiers". These are device drivers or other part of the kernel that need to be informed of policy changes (ex. thermal modules like ACPI) or of all frequency changes (ex. timing code) or even need to force certain speed limits (like LCD drivers on ARM architecture). Additionally, the kernel "constant" loops_per_jiffy is updated on frequency changes here.”h]”hXPThe CPUFreq core code is located in drivers/cpufreq/cpufreq.c. This cpufreq code offers a standardized interface for the CPUFreq architecture drivers (those pieces of code that do actual frequency transitions), as well as to “notifiersâ€. These are device drivers or other part of the kernel that need to be informed of policy changes (ex. thermal modules like ACPI) or of all frequency changes (ex. timing code) or even need to force certain speed limits (like LCD drivers on ARM architecture). Additionally, the kernel “constant†loops_per_jiffy is updated on frequency changes here.”…””}”(hjîh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´KhjÝh²hubj )”}”(hX<Reference counting of the cpufreq policies is done by cpufreq_cpu_get and cpufreq_cpu_put, which make sure that the cpufreq driver is correctly registered with the core, and will not be unloaded until cpufreq_put_cpu is called. That also ensures that the respective cpufreq policy doesn't get freed while being used.”h]”hX>Reference counting of the cpufreq policies is done by cpufreq_cpu_get and cpufreq_cpu_put, which make sure that the cpufreq driver is correctly registered with the core, and will not be unloaded until cpufreq_put_cpu is called. That also ensures that the respective cpufreq policy doesn’t get freed while being used.”…””}”(hjüh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´K!hjÝh²hubeh}”(h]”Œgeneral-information”ah ]”h"]”Œ1. general information”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´KubhÉ)”}”(hhh]”(hÎ)”}”(hŒ2. CPUFreq notifiers”h]”hŒ2. CPUFreq notifiers”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjh²hh³hÇh´K(ubj )”}”(hŒCPUFreq notifiers conform to the standard kernel notifier interface. See linux/include/linux/notifier.h for details on notifiers.”h]”hŒCPUFreq notifiers conform to the standard kernel notifier interface. See linux/include/linux/notifier.h for details on notifiers.”…””}”(hj#h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´K*hjh²hubj )”}”(hŒVThere are two different CPUFreq notifiers - policy notifiers and transition notifiers.”h]”hŒVThere are two different CPUFreq notifiers - policy notifiers and transition notifiers.”…””}”(hj1h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´K-hjh²hubhÉ)”}”(hhh]”(hÎ)”}”(hŒ2.1 CPUFreq policy notifiers”h]”hŒ2.1 CPUFreq policy notifiers”…””}”(hjBh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj?h²hh³hÇh´K2ubj )”}”(hŒ;These are notified when a new policy is created or removed.”h]”hŒ;These are notified when a new policy is created or removed.”…””}”(hjPh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´K4hj?h²hubj )”}”(hŒ¿The phase is specified in the second argument to the notifier. The phase is CPUFREQ_CREATE_POLICY when the policy is first created and it is CPUFREQ_REMOVE_POLICY when the policy is removed.”h]”hŒ¿The phase is specified in the second argument to the notifier. The phase is CPUFREQ_CREATE_POLICY when the policy is first created and it is CPUFREQ_REMOVE_POLICY when the policy is removed.”…””}”(hj^h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´K6hj?h²hubj )”}”(hŒ¹The third argument, a ``void *pointer``, points to a struct cpufreq_policy consisting of several values, including min, max (the lower and upper frequencies (in kHz) of the new policy).”h]”(hŒThe third argument, a ”…””}”(hjlh²hh³Nh´NubhŒliteral”“”)”}”(hŒ``void *pointer``”h]”hŒ void *pointer”…””}”(hjvh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jthjlubhŒ’, points to a struct cpufreq_policy consisting of several values, including min, max (the lower and upper frequencies (in kHz) of the new policy).”…””}”(hjlh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´K:hj?h²hubeh}”(h]”Œcpufreq-policy-notifiers”ah ]”h"]”Œ2.1 cpufreq policy notifiers”ah$]”h&]”uh1hÈhjh²hh³hÇh´K2ubhÉ)”}”(hhh]”(hÎ)”}”(hŒ 2.2 CPUFreq transition notifiers”h]”hŒ 2.2 CPUFreq transition notifiers”…””}”(hj™h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj–h²hh³hÇh´K@ubj )”}”(hŒ¥These are notified twice for each online CPU in the policy, when the CPUfreq driver switches the CPU core frequency and this change has no any external implications.”h]”hŒ¥These are notified twice for each online CPU in the policy, when the CPUfreq driver switches the CPU core frequency and this change has no any external implications.”…””}”(hj§h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´KBhj–h²hubj )”}”(hŒRThe second argument specifies the phase - CPUFREQ_PRECHANGE or CPUFREQ_POSTCHANGE.”h]”hŒRThe second argument specifies the phase - CPUFREQ_PRECHANGE or CPUFREQ_POSTCHANGE.”…””}”(hjµh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´KFhj–h²hubj )”}”(hŒGThe third argument is a struct cpufreq_freqs with the following values:”h]”hŒGThe third argument is a struct cpufreq_freqs with the following values:”…””}”(hjÃh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´KIhj–h²hubhŒtable”“”)”}”(hhh]”hŒtgroup”“”)”}”(hhh]”(hŒcolspec”“”)”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œcolwidth”Kuh1jÛhjØubjÜ)”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œcolwidth”K&uh1jÛhjØubhŒtbody”“”)”}”(hhh]”(hŒrow”“”)”}”(hhh]”(hŒentry”“”)”}”(hhh]”j )”}”(hŒpolicy”h]”hŒpolicy”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´KMhjýubah}”(h]”h ]”h"]”h$]”h&]”uh1jûhjøubjü)”}”(hhh]”j )”}”(hŒ&a pointer to the struct cpufreq_policy”h]”hŒ&a pointer to the struct cpufreq_policy”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´KMhjubah}”(h]”h ]”h"]”h$]”h&]”uh1jûhjøubeh}”(h]”h ]”h"]”h$]”h&]”uh1jöhjóubj÷)”}”(hhh]”(jü)”}”(hhh]”j )”}”(hŒold”h]”hŒold”…””}”(hj7h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´KNhj4ubah}”(h]”h ]”h"]”h$]”h&]”uh1jûhj1ubjü)”}”(hhh]”j )”}”(hŒ old frequency”h]”hŒ old frequency”…””}”(hjNh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´KNhjKubah}”(h]”h ]”h"]”h$]”h&]”uh1jûhj1ubeh}”(h]”h ]”h"]”h$]”h&]”uh1jöhjóubj÷)”}”(hhh]”(jü)”}”(hhh]”j )”}”(hŒnew”h]”hŒnew”…””}”(hjnh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´KOhjkubah}”(h]”h ]”h"]”h$]”h&]”uh1jûhjhubjü)”}”(hhh]”j )”}”(hŒ new frequency”h]”hŒ new frequency”…””}”(hj…h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´KOhj‚ubah}”(h]”h ]”h"]”h$]”h&]”uh1jûhjhubeh}”(h]”h ]”h"]”h$]”h&]”uh1jöhjóubj÷)”}”(hhh]”(jü)”}”(hhh]”j )”}”(hŒflags”h]”hŒflags”…””}”(hj¥h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´KPhj¢ubah}”(h]”h ]”h"]”h$]”h&]”uh1jûhjŸubjü)”}”(hhh]”j )”}”(hŒflags of the cpufreq driver”h]”hŒflags of the cpufreq driver”…””}”(hj¼h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´KPhj¹ubah}”(h]”h ]”h"]”h$]”h&]”uh1jûhjŸubeh}”(h]”h ]”h"]”h$]”h&]”uh1jöhjóubeh}”(h]”h ]”h"]”h$]”h&]”uh1jñhjØubeh}”(h]”h ]”h"]”h$]”h&]”Œcols”Kuh1jÖhjÓubah}”(h]”h ]”h"]”h$]”h&]”uh1jÑhj–h²hh³hÇh´Nubeh}”(h]”Œcpufreq-transition-notifiers”ah ]”h"]”Œ 2.2 cpufreq transition notifiers”ah$]”h&]”uh1hÈhjh²hh³hÇh´K@ubeh}”(h]”Œcpufreq-notifiers”ah ]”h"]”Œ2. cpufreq notifiers”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´K(ubhÉ)”}”(hhh]”(hÎ)”}”(hŒB3. CPUFreq Table Generation with Operating Performance Point (OPP)”h]”hŒB3. CPUFreq Table Generation with Operating Performance Point (OPP)”…””}”(hjüh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjùh²hh³hÇh´KTubj )”}”(hŒ6For details about OPP, see Documentation/power/opp.rst”h]”hŒ6For details about OPP, see Documentation/power/opp.rst”…””}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´KUhjùh²hubhÞ)”}”(hhh]”(hã)”}”(hX\dev_pm_opp_init_cpufreq_table - This function provides a ready to use conversion routine to translate the OPP layer's internal information about the available frequencies into a format readily providable to cpufreq. .. Warning:: Do not use this function in interrupt context. Example:: soc_pm_init() { /* Do things */ r = dev_pm_opp_init_cpufreq_table(dev, &freq_table); if (!r) policy->freq_table = freq_table; /* Do other things */ } .. note:: This function is available only if CONFIG_CPU_FREQ is enabled in addition to CONFIG_PM_OPP. ”h]”(hé)”}”(hŒdev_pm_opp_init_cpufreq_table -”h]”hŒdev_pm_opp_init_cpufreq_table -”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hèh³hÇh´Knhjubhù)”}”(hhh]”(j )”}”(hŒ·This function provides a ready to use conversion routine to translate the OPP layer's internal information about the available frequencies into a format readily providable to cpufreq.”h]”hŒ¹This function provides a ready to use conversion routine to translate the OPP layer’s internal information about the available frequencies into a format readily providable to cpufreq.”…””}”(hj0h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´KXhj-ubhŒwarning”“”)”}”(hŒ.Do not use this function in interrupt context.”h]”j )”}”(hjBh]”hŒ.Do not use this function in interrupt context.”…””}”(hjDh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´K^hj@ubah}”(h]”h ]”h"]”h$]”h&]”uh1j>hj-ubj )”}”(hŒ Example::”h]”hŒExample:”…””}”(hjWh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´K`hj-ubhŒ literal_block”“”)”}”(hŒÀsoc_pm_init() { /* Do things */ r = dev_pm_opp_init_cpufreq_table(dev, &freq_table); if (!r) policy->freq_table = freq_table; /* Do other things */ }”h]”hŒÀsoc_pm_init() { /* Do things */ r = dev_pm_opp_init_cpufreq_table(dev, &freq_table); if (!r) policy->freq_table = freq_table; /* Do other things */ }”…””}”hjgsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1jeh³hÇh´Kbhj-ubhŒnote”“”)”}”(hŒ[This function is available only if CONFIG_CPU_FREQ is enabled in addition to CONFIG_PM_OPP.”h]”j )”}”(hŒ[This function is available only if CONFIG_CPU_FREQ is enabled in addition to CONFIG_PM_OPP.”h]”hŒ[This function is available only if CONFIG_CPU_FREQ is enabled in addition to CONFIG_PM_OPP.”…””}”(hj{h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´Kmhjwubah}”(h]”h ]”h"]”h$]”h&]”uh1juhj-ubeh}”(h]”h ]”h"]”h$]”h&]”uh1høhjubeh}”(h]”h ]”h"]”h$]”h&]”uh1hâh³hÇh´Knhjubhã)”}”(hŒZdev_pm_opp_free_cpufreq_table Free up the table allocated by dev_pm_opp_init_cpufreq_table”h]”(hé)”}”(hŒdev_pm_opp_free_cpufreq_table”h]”hŒdev_pm_opp_free_cpufreq_table”…””}”(hjŸh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hèh³hÇh´Kphj›ubhù)”}”(hhh]”j )”}”(hŒ