€•HJŒ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Œ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”“”)”}”(hhòh]”(hŒDominik Brodowski <”…””}”(hhöhžhhŸNh NubhŒ reference”“”)”}”(hŒlinux@brodo.de”h]”hŒlinux@brodo.de”…””}”(hhÿhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”Œmailto:linux@brodo.de”uh1hýhhöubhŒ>”…””}”(hhöhžhhŸNh Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h Khhðubah}”(h]”h ]”h"]”h$]”h&]”uh1hîhhëubhï)”}”(hŒ!David Kimdon ”h]”hõ)”}”(hj!h]”(hŒDavid Kimdon <”…””}”(hj#hžhhŸNh Nubhþ)”}”(hŒdwhedon@debian.org”h]”hŒdwhedon@debian.org”…””}”(hj*hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”Œmailto:dwhedon@debian.org”uh1hýhj#ubhŒ>”…””}”(hj#hžhhŸNh Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h K hjubah}”(h]”h ]”h"]”h$]”h&]”uh1hîhhëubhï)”}”(hŒ.Rafael J. Wysocki ”h]”hõ)”}”(hjLh]”(hŒRafael J. Wysocki <”…””}”(hjNhžhhŸNh Nubhþ)”}”(hŒrafael.j.wysocki@intel.com”h]”hŒrafael.j.wysocki@intel.com”…””}”(hjUhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”Œ!mailto:rafael.j.wysocki@intel.com”uh1hýhjNubhŒ>”…””}”(hjNhžhhŸNh Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h K hjJubah}”(h]”h ]”h"]”h$]”h&]”uh1hîhhëubhï)”}”(hŒ'Viresh Kumar ”h]”hõ)”}”(hŒ&Viresh Kumar ”h]”(hŒViresh Kumar <”…””}”(hjyhžhhŸNh Nubhþ)”}”(hŒviresh.kumar@linaro.org”h]”hŒviresh.kumar@linaro.org”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”Œmailto:viresh.kumar@linaro.org”uh1hýhjyubhŒ>”…””}”(hjyhžhhŸNh Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h K hjuubah}”(h]”h ]”h"]”h$]”h&]”uh1hîhhë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 Kubhõ)”}”(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&]”uh1hôhŸh³h KhjÉhžhubhõ)”}”(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&]”uh1hôhŸ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¹hjþhžhhŸh³h K(ubhõ)”}”(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.”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h K*hjþhžhubhõ)”}”(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.”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h K-hjþhžhubhµ)”}”(hhh]”(hº)”}”(hŒ2.1 CPUFreq policy notifiers”h]”hŒ2.1 CPUFreq policy notifiers”…””}”(hj.hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¹hj+hžhhŸh³h K2ubhõ)”}”(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.”…””}”(hj<hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h K4hj+hžhubhõ)”}”(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.”…””}”(hjJhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h K6hj+hžhubhõ)”}”(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 ”…””}”(hjXhžhhŸNh NubhŒliteral”“”)”}”(hŒ``void *pointer``”h]”hŒ void *pointer”…””}”(hjbhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j`hjXubhŒ’, points to a struct cpufreq_policy consisting of several values, including min, max (the lower and upper frequencies (in kHz) of the new policy).”…””}”(hjXhžhhŸNh Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h K:hj+hžhubeh}”(h]”Œcpufreq-policy-notifiers”ah ]”h"]”Œ2.1 cpufreq policy notifiers”ah$]”h&]”uh1h´hjþhž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@ubhõ)”}”(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&]”uh1hôhŸh³h KBhj‚hžhubhõ)”}”(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&]”uh1hôhŸh³h KFhj‚hžhubhõ)”}”(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&]”uh1hôhŸ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]”hõ)”}”(hŒpolicy”h]”hŒpolicy”…””}”(hjìhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h KMhjéubah}”(h]”h ]”h"]”h$]”h&]”uh1jçhjäubjè)”}”(hhh]”hõ)”}”(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&]”uh1hôhŸh³h KMhjubah}”(h]”h ]”h"]”h$]”h&]”uh1jçhjäubeh}”(h]”h ]”h"]”h$]”h&]”uh1jâhjßubjã)”}”(hhh]”(jè)”}”(hhh]”hõ)”}”(hŒold”h]”hŒold”…””}”(hj#hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h KNhj ubah}”(h]”h ]”h"]”h$]”h&]”uh1jçhjubjè)”}”(hhh]”hõ)”}”(hŒ old frequency”h]”hŒ old frequency”…””}”(hj:hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h KNhj7ubah}”(h]”h ]”h"]”h$]”h&]”uh1jçhjubeh}”(h]”h ]”h"]”h$]”h&]”uh1jâhjßubjã)”}”(hhh]”(jè)”}”(hhh]”hõ)”}”(hŒnew”h]”hŒnew”…””}”(hjZhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h KOhjWubah}”(h]”h ]”h"]”h$]”h&]”uh1jçhjTubjè)”}”(hhh]”hõ)”}”(hŒ new frequency”h]”hŒ new frequency”…””}”(hjqhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h KOhjnubah}”(h]”h ]”h"]”h$]”h&]”uh1jçhjTubeh}”(h]”h ]”h"]”h$]”h&]”uh1jâhjßubjã)”}”(hhh]”(jè)”}”(hhh]”hõ)”}”(hŒflags”h]”hŒflags”…””}”(hj‘hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h KPhjŽubah}”(h]”h ]”h"]”h$]”h&]”uh1jçhj‹ubjè)”}”(hhh]”hõ)”}”(hŒflags of the cpufreq driver”h]”hŒflags of the cpufreq driver”…””}”(hj¨hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸ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´hjþhž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 KTubhõ)”}”(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&]”uh1hôhŸ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 -”…””}”(hj hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÔhŸh³h Knhjubhå)”}”(hhh]”(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.”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.”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h KXhjubhŒwarning”“”)”}”(hŒ.Do not use this function in interrupt context.”h]”hõ)”}”(hj.h]”hŒ.Do not use this function in interrupt context.”…””}”(hj0hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h K^hj,ubah}”(h]”h ]”h"]”h$]”h&]”uh1j*hjubhõ)”}”(hŒ Example::”h]”hŒExample:”…””}”(hjChžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h K`hjubhŒ 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 */ }”…””}”hjSsbah}”(h]”h ]”h"]”h$]”h&]”h±h²uh1jQhŸh³h KbhjubhŒnote”“”)”}”(hŒ[This function is available only if CONFIG_CPU_FREQ is enabled in addition to CONFIG_PM_OPP.”h]”hõ)”}”(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.”…””}”(hjghžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hôhŸh³h Kmhjcubah}”(h]”h ]”h"]”h$]”h&]”uh1jahjubeh}”(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]”hõ)”}”(hŒ