Űsphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}parenthsba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget6/translations/zh_CN/driver-api/thermal/power_allocatormodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget6/translations/zh_TW/driver-api/thermal/power_allocatormodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget6/translations/it_IT/driver-api/thermal/power_allocatormodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget6/translations/ja_JP/driver-api/thermal/power_allocatormodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget6/translations/ko_KR/driver-api/thermal/power_allocatormodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget6/translations/sp_SP/driver-api/thermal/power_allocatormodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhsection)}(hhh](htitle)}(h!Power allocator governor tunablesh]h!Power allocator governor tunables}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhP/var/lib/git/docbuild/linux/Documentation/driver-api/thermal/power_allocator.rsthKubh)}(hhh](h)}(h Trip pointsh]h Trip points}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh paragraph)}(hHThe governor works optimally with the following two passive trip points:h]hHThe governor works optimally with the following two passive trip points:}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubhenumerated_list)}(hhh](h list_item)}(h"switch on" trip point: temperature above which the governor control loop starts operating. This is the first passive trip point of the thermal zone. h]h)}(h"switch on" trip point: temperature above which the governor control loop starts operating. This is the first passive trip point of the thermal zone.h]h“switch on” trip point: temperature above which the governor control loop starts operating. This is the first passive trip point of the thermal zone.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK hhubah}(h]h ]h"]h$]h&]uh1hhhhhhhhNubh)}(h"desired temperature" trip point: it should be higher than the "switch on" trip point. This the target temperature the governor is controlling for. This is the last passive trip point of the thermal zone. h]h)}(h"desired temperature" trip point: it should be higher than the "switch on" trip point. This the target temperature the governor is controlling for. This is the last passive trip point of the thermal zone.h]h“desired temperature” trip point: it should be higher than the “switch on” trip point. This the target temperature the governor is controlling for. This is the last passive trip point of the thermal zone.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhubah}(h]h ]h"]h$]h&]uh1hhhhhhhhNubeh}(h]h ]h"]h$]h&]enumtypearabicprefixhsuffix.uh1hhhhhhhhK ubeh}(h] trip-pointsah ]h"] trip pointsah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hPID Controllerh]hPID Controller}(hj%hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj"hhhhhKubh)}(hThe power allocator governor implements a Proportional-Integral-Derivative controller (PID controller) with temperature as the control input and power as the controlled output:h]hThe power allocator governor implements a Proportional-Integral-Derivative controller (PID controller) with temperature as the control input and power as the controlled output:}(hj3hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj"hhubh block_quote)}(hJP_max = k_p * e + k_i * err_integral + k_d * diff_err + sustainable_power h]h)}(hIP_max = k_p * e + k_i * err_integral + k_d * diff_err + sustainable_powerh]hIP_max = k_p * e + k_i * err_integral + k_d * diff_err + sustainable_power}(hjGhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjCubah}(h]h ]h"]h$]h&]uh1jAhhhKhj"hhubhdefinition_list)}(hhh]hdefinition_list_item)}(hwhere - e = desired_temperature - current_temperature - err_integral is the sum of previous errors - diff_err = e - previous_error h](hterm)}(hwhereh]hwhere}(hjhhhhNhNubah}(h]h ]h"]h$]h&]uh1jfhhhKhjbubh definition)}(hhh]h bullet_list)}(hhh](h)}(h-e = desired_temperature - current_temperatureh]h)}(hjh]h-e = desired_temperature - current_temperature}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1hhj}ubh)}(h*err_integral is the sum of previous errorsh]h)}(hjh]h*err_integral is the sum of previous errors}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1hhj}ubh)}(hdiff_err = e - previous_error h]h)}(hdiff_err = e - previous_errorh]hdiff_err = e - previous_error}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1hhj}ubeh}(h]h ]h"]h$]h&]bullet-uh1j{hhhKhjxubah}(h]h ]h"]h$]h&]uh1jvhjbubeh}(h]h ]h"]h$]h&]uh1j`hhhKhj]ubah}(h]h ]h"]h$]h&]uh1j[hj"hhhNhNubh)}(h)It is similar to the one depicted below::h]h(It is similar to the one depicted below:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK!hj"hhubh literal_block)}(hXF k_d | current_temp | | v | +----------+ +---+ | +----->| diff_err |-->| X |------+ | | +----------+ +---+ | | | | tdp actor | | k_i | | get_requested_power() | | | | | | | | | | | | | | ... v | v v v v v +---+ | +-------+ +---+ +---+ +---+ +----------+ | S |-----+----->| sum e |----->| X |--->| S |-->| S |-->|power | +---+ | +-------+ +---+ +---+ +---+ |allocation| ^ | ^ +----------+ | | | | | | | +---+ | | | | +------->| X |-------------------+ v v | +---+ granted performance desired_temperature ^ | | k_po/k_puh]hXF k_d | current_temp | | v | +----------+ +---+ | +----->| diff_err |-->| X |------+ | | +----------+ +---+ | | | | tdp actor | | k_i | | get_requested_power() | | | | | | | | | | | | | | ... v | v v v v v +---+ | +-------+ +---+ +---+ +---+ +----------+ | S |-----+----->| sum e |----->| X |--->| S |-->| S |-->|power | +---+ | +-------+ +---+ +---+ +---+ |allocation| ^ | ^ +----------+ | | | | | | | +---+ | | | | +------->| X |-------------------+ v v | +---+ granted performance desired_temperature ^ | | k_po/k_pu}hjsbah}(h]h ]h"]h$]h&] xml:spacepreserveuh1jhhhK#hj"hhubeh}(h]pid-controllerah ]h"]pid controllerah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hSustainable powerh]hSustainable power}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhK=ubh)}(hXAn estimate of the sustainable dissipatable power (in mW) should be provided while registering the thermal zone. This estimates the sustained power that can be dissipated at the desired control temperature. This is the maximum sustained power for allocation at the desired maximum temperature. The actual sustained power can vary for a number of reasons. The closed loop controller will take care of variations such as environmental conditions, and some factors related to the speed-grade of the silicon. `sustainable_power` is therefore simply an estimate, and may be tuned to affect the aggressiveness of the thermal ramp. For reference, the sustainable power of a 4" phone is typically 2000mW, while on a 10" tablet is around 4500mW (may vary depending on screen size). It is possible to have the power value expressed in an abstract scale. The sustained power should be aligned to the scale used by the related cooling devices.h](hXAn estimate of the sustainable dissipatable power (in mW) should be provided while registering the thermal zone. This estimates the sustained power that can be dissipated at the desired control temperature. This is the maximum sustained power for allocation at the desired maximum temperature. The actual sustained power can vary for a number of reasons. The closed loop controller will take care of variations such as environmental conditions, and some factors related to the speed-grade of the silicon. }(hjhhhNhNubhtitle_reference)}(h`sustainable_power`h]hsustainable_power}(hj#hhhNhNubah}(h]h ]h"]h$]h&]uh1j!hjubhX is therefore simply an estimate, and may be tuned to affect the aggressiveness of the thermal ramp. For reference, the sustainable power of a 4” phone is typically 2000mW, while on a 10” tablet is around 4500mW (may vary depending on screen size). It is possible to have the power value expressed in an abstract scale. The sustained power should be aligned to the scale used by the related cooling devices.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK?hjhhubh)}(hYIf you are using device tree, do add it as a property of the thermal-zone. For example::h]hXIf you are using device tree, do add it as a property of the thermal-zone. For example:}(hj;hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKNhjhhubj)}(hthermal-zones { soc_thermal { polling-delay = <1000>; polling-delay-passive = <100>; sustainable-power = <2500>; ...h]hthermal-zones { soc_thermal { polling-delay = <1000>; polling-delay-passive = <100>; sustainable-power = <2500>; ...}hjIsbah}(h]h ]h"]h$]h&]jjuh1jhhhKQhjhhubh)}(hInstead, if the thermal zone is registered from the platform code, pass a `thermal_zone_params` that has a `sustainable_power`. If no `thermal_zone_params` were being passed, then something like below will suffice::h](hJInstead, if the thermal zone is registered from the platform code, pass a }(hjWhhhNhNubj")}(h`thermal_zone_params`h]hthermal_zone_params}(hj_hhhNhNubah}(h]h ]h"]h$]h&]uh1j!hjWubh that has a }(hjWhhhNhNubj")}(h`sustainable_power`h]hsustainable_power}(hjqhhhNhNubah}(h]h ]h"]h$]h&]uh1j!hjWubh . If no }(hjWhhhNhNubj")}(h`thermal_zone_params`h]hthermal_zone_params}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j!hjWubh; were being passed, then something like below will suffice:}(hjWhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKXhjhhubj)}(h[static const struct thermal_zone_params tz_params = { .sustainable_power = 3500, };h]h[static const struct thermal_zone_params tz_params = { .sustainable_power = 3500, };}hjsbah}(h]h ]h"]h$]h&]jjuh1jhhhK]hjhhubh)}(hRand then pass `tz_params` as the 5th parameter to `thermal_zone_device_register()`h](hand then pass }(hjhhhNhNubj")}(h `tz_params`h]h tz_params}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j!hjubh as the 5th parameter to }(hjhhhNhNubj")}(h `thermal_zone_device_register()`h]hthermal_zone_device_register()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j!hjubeh}(h]h ]h"]h$]h&]uh1hhhhKahjhhubeh}(h]sustainable-powerah ]h"]sustainable powerah$]h&]uh1hhhhhhhhK=ubh)}(hhh](h)}(h k_po and k_puh]h k_po and k_pu}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKeubh)}(hXThe implementation of the PID controller in the power allocator thermal governor allows the configuration of two proportional term constants: `k_po` and `k_pu`. `k_po` is the proportional term constant during temperature overshoot periods (current temperature is above "desired temperature" trip point). Conversely, `k_pu` is the proportional term constant during temperature undershoot periods (current temperature below "desired temperature" trip point).h](hThe implementation of the PID controller in the power allocator thermal governor allows the configuration of two proportional term constants: }(hjhhhNhNubj")}(h`k_po`h]hk_po}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j!hjubh and }(hjhhhNhNubj")}(h`k_pu`h]hk_pu}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j!hjubh. }(hjhhhNhNubj")}(h`k_po`h]hk_po}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j!hjubh is the proportional term constant during temperature overshoot periods (current temperature is above “desired temperature” trip point). Conversely, }(hjhhhNhNubj")}(h`k_pu`h]hk_pu}(hj.hhhNhNubah}(h]h ]h"]h$]h&]uh1j!hjubh is the proportional term constant during temperature undershoot periods (current temperature below “desired temperature” trip point).}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKghjhhubh)}(hXThese controls are intended as the primary mechanism for configuring the permitted thermal "ramp" of the system. For instance, a lower `k_pu` value will provide a slower ramp, at the cost of capping available capacity at a low temperature. On the other hand, a high value of `k_pu` will result in the governor granting very high power while temperature is low, and may lead to temperature overshooting.h](hThese controls are intended as the primary mechanism for configuring the permitted thermal “ramp” of the system. For instance, a lower }(hjFhhhNhNubj")}(h`k_pu`h]hk_pu}(hjNhhhNhNubah}(h]h ]h"]h$]h&]uh1j!hjFubh value will provide a slower ramp, at the cost of capping available capacity at a low temperature. On the other hand, a high value of }(hjFhhhNhNubj")}(h`k_pu`h]hk_pu}(hj`hhhNhNubah}(h]h ]h"]h$]h&]uh1j!hjFubhy will result in the governor granting very high power while temperature is low, and may lead to temperature overshooting.}(hjFhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKohjhhubh)}(h!The default value for `k_pu` is::h](hThe default value for }(hjxhhhNhNubj")}(h`k_pu`h]hk_pu}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j!hjxubh is:}(hjxhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKvhjhhubj)}(h>2 * sustainable_power / (desired_temperature - switch_on_temp)h]h>2 * sustainable_power / (desired_temperature - switch_on_temp)}hjsbah}(h]h ]h"]h$]h&]jjuh1jhhhKxhjhhubh)}(hThis means that at `switch_on_temp` the output of the controller's proportional term will be 2 * `sustainable_power`. The default value for `k_po` is::h](hThis means that at }(hjhhhNhNubj")}(h`switch_on_temp`h]hswitch_on_temp}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j!hjubh@ the output of the controller’s proportional term will be 2 * }(hjhhhNhNubj")}(h`sustainable_power`h]hsustainable_power}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j!hjubh. The default value for }(hjhhhNhNubj")}(h`k_po`h]hk_po}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j!hjubh is:}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKzhjhhubj)}(h:sustainable_power / (desired_temperature - switch_on_temp)h]h:sustainable_power / (desired_temperature - switch_on_temp)}hjsbah}(h]h ]h"]h$]h&]jjuh1jhhhK~hjhhubh)}(h]Focusing on the proportional and feed forward values of the PID controller equation we have::h]h\Focusing on the proportional and feed forward values of the PID controller equation we have:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj)}(h#P_max = k_p * e + sustainable_powerh]h#P_max = k_p * e + sustainable_power}hjsbah}(h]h ]h"]h$]h&]jjuh1jhhhKhjhhubh)}(hXThe proportional term is proportional to the difference between the desired temperature and the current one. When the current temperature is the desired one, then the proportional component is zero and `P_max` = `sustainable_power`. That is, the system should operate in thermal equilibrium under constant load. `sustainable_power` is only an estimate, which is the reason for closed-loop control such as this.h](hThe proportional term is proportional to the difference between the desired temperature and the current one. When the current temperature is the desired one, then the proportional component is zero and }(hjhhhNhNubj")}(h`P_max`h]hP_max}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j!hjubh = }(hjhhhNhNubj")}(h`sustainable_power`h]hsustainable_power}(hj.hhhNhNubah}(h]h ]h"]h$]h&]uh1j!hjubhS. That is, the system should operate in thermal equilibrium under constant load. }(hjhhhNhNubj")}(h`sustainable_power`h]hsustainable_power}(hj@hhhNhNubah}(h]h ]h"]h$]h&]uh1j!hjubhO is only an estimate, which is the reason for closed-loop control such as this.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hExpanding `k_pu` we get::h](h Expanding }(hjXhhhNhNubj")}(h`k_pu`h]hk_pu}(hj`hhhNhNubah}(h]h ]h"]h$]h&]uh1j!hjXubh we get:}(hjXhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj)}(hTP_max = 2 * sustainable_power * (T_set - T) / (T_set - T_on) + sustainable_powerh]hTP_max = 2 * sustainable_power * (T_set - T) / (T_set - T_on) + sustainable_power}hjxsbah}(h]h ]h"]h$]h&]jjuh1jhhhKhjhhubh)}(hwhere:h]hwhere:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubjB)}(hf- T_set is the desired temperature - T is the current temperature - T_on is the switch on temperature h]j|)}(hhh](h)}(h T_set is the desired temperatureh]h)}(hjh]h T_set is the desired temperature}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1hhjubh)}(hT is the current temperatureh]h)}(hjh]hT is the current temperature}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1hhjubh)}(h"T_on is the switch on temperature h]h)}(h!T_on is the switch on temperatureh]h!T_on is the switch on temperature}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1hhjubeh}(h]h ]h"]h$]h&]jjuh1j{hhhKhjubah}(h]h ]h"]h$]h&]uh1jAhhhKhjhhubh)}(hVWhen the current temperature is the switch_on temperature, the above formula becomes::h]hUWhen the current temperature is the switch_on temperature, the above formula becomes:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj)}(hP_max = 2 * sustainable_power * (T_set - T_on) / (T_set - T_on) + sustainable_power = 2 * sustainable_power + sustainable_power = 3 * sustainable_powerh]hP_max = 2 * sustainable_power * (T_set - T_on) / (T_set - T_on) + sustainable_power = 2 * sustainable_power + sustainable_power = 3 * sustainable_power}hjsbah}(h]h ]h"]h$]h&]jjuh1jhhhKhjhhubh)}(hTherefore, the proportional term alone linearly decreases power from 3 * `sustainable_power` to `sustainable_power` as the temperature rises from the switch on temperature to the desired temperature.h](hITherefore, the proportional term alone linearly decreases power from 3 * }(hj hhhNhNubj")}(h`sustainable_power`h]hsustainable_power}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j!hj ubh to }(hj hhhNhNubj")}(h`sustainable_power`h]hsustainable_power}(hj#hhhNhNubah}(h]h ]h"]h$]h&]uh1j!hj ubhT as the temperature rises from the switch on temperature to the desired temperature.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubeh}(h] k-po-and-k-puah ]h"] k_po and k_puah$]h&]uh1hhhhhhhhKeubh)}(hhh](h)}(hk_i and integral_cutoffh]hk_i and integral_cutoff}(hjFhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjChhhhhKubh)}(hX`k_i` configures the PID loop's integral term constant. This term allows the PID controller to compensate for long term drift and for the quantized nature of the output control: cooling devices can't set the exact power that the governor requests. When the temperature error is below `integral_cutoff`, errors are accumulated in the integral term. This term is then multiplied by `k_i` and the result added to the output of the controller. Typically `k_i` is set low (1 or 2) and `integral_cutoff` is 0.h](j")}(h`k_i`h]hk_i}(hjXhhhNhNubah}(h]h ]h"]h$]h&]uh1j!hjTubhX configures the PID loop’s integral term constant. This term allows the PID controller to compensate for long term drift and for the quantized nature of the output control: cooling devices can’t set the exact power that the governor requests. When the temperature error is below }(hjThhhNhNubj")}(h`integral_cutoff`h]hintegral_cutoff}(hjjhhhNhNubah}(h]h ]h"]h$]h&]uh1j!hjTubhP, errors are accumulated in the integral term. This term is then multiplied by }(hjThhhNhNubj")}(h`k_i`h]hk_i}(hj|hhhNhNubah}(h]h ]h"]h$]h&]uh1j!hjTubhB and the result added to the output of the controller. Typically }(hjThhhNhNubj")}(h`k_i`h]hk_i}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j!hjTubh is set low (1 or 2) and }(hjThhhNhNubj")}(h`integral_cutoff`h]hintegral_cutoff}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j!hjTubh is 0.}(hjThhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjChhubeh}(h]k-i-and-integral-cutoffah ]h"]k_i and integral_cutoffah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hk_dh]hk_d}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubh)}(hj`k_d` configures the PID loop's derivative term constant. It's recommended to leave it as the default: 0.h](j")}(h`k_d`h]hk_d}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j!hjubhi configures the PID loop’s derivative term constant. It’s recommended to leave it as the default: 0.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hhh](h)}(hCooling device power APIh]hCooling device power API}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubh)}(hCooling devices controlled by this governor must supply the additional "power" API in their `cooling_device_ops`. It consists on three ops:h](h`Cooling devices controlled by this governor must supply the additional “power” API in their }(hjhhhNhNubj")}(h`cooling_device_ops`h]hcooling_device_ops}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j!hjubh. It consists on three ops:}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hhh]h)}(h:: int get_requested_power(struct thermal_cooling_device *cdev, struct thermal_zone_device *tz, u32 *power); h]j)}(hint get_requested_power(struct thermal_cooling_device *cdev, struct thermal_zone_device *tz, u32 *power);h]hint get_requested_power(struct thermal_cooling_device *cdev, struct thermal_zone_device *tz, u32 *power);}hj%sbah}(h]h ]h"]h$]h&]jjuh1jhhhKhj!ubah}(h]h ]h"]h$]h&]uh1hhjhhhhhNubah}(h]h ]h"]h$]h&]jjjhjjuh1hhjhhhhhKubj\)}(hhh](ja)}(h2@cdev: The `struct thermal_cooling_device` pointerh](jg)}(h@cdev:h]h@cdev:}(hjFhhhNhNubah}(h]h ]h"]h$]h&]uh1jfhhhKhjBubjw)}(hhh]h)}(h+The `struct thermal_cooling_device` pointerh](hThe }(hjWhhhNhNubj")}(h`struct thermal_cooling_device`h]hstruct thermal_cooling_device}(hj_hhhNhNubah}(h]h ]h"]h$]h&]uh1j!hjWubh pointer}(hjWhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjTubah}(h]h ]h"]h$]h&]uh1jvhjBubeh}(h]h ]h"]h$]h&]uh1j`hhhKhj?ubja)}(h5@tz: thermal zone in which we are currently operatingh](jg)}(h@tz:h]h@tz:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jfhhhKhjubjw)}(hhh]h)}(h0thermal zone in which we are currently operatingh]h0thermal zone in which we are currently operating}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jvhjubeh}(h]h ]h"]h$]h&]uh1j`hhhKhj?hhubja)}(h7@power: pointer in which to store the calculated power h](jg)}(h@power:h]h@power:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jfhhhKhjubjw)}(hhh]h)}(h.pointer in which to store the calculated powerh]h.pointer in which to store the calculated power}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jvhjubeh}(h]h ]h"]h$]h&]uh1j`hhhKhj?hhubeh}(h]h ]h"]h$]h&]uh1j[hjhhhhhNubh)}(hX`get_requested_power()` calculates the power requested by the device in milliwatts and stores it in @power . It should return 0 on success, -E* on failure. This is currently used by the power allocator governor to calculate how much power to give to each cooling device.h](j")}(h`get_requested_power()`h]hget_requested_power()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j!hjubh calculates the power requested by the device in milliwatts and stores it in @power . It should return 0 on success, -E* on failure. This is currently used by the power allocator governor to calculate how much power to give to each cooling device.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hhh]h)}(h:: int state2power(struct thermal_cooling_device *cdev, struct thermal_zone_device *tz, unsigned long state, u32 *power); h]j)}(hint state2power(struct thermal_cooling_device *cdev, struct thermal_zone_device *tz, unsigned long state, u32 *power);h]hint state2power(struct thermal_cooling_device *cdev, struct thermal_zone_device *tz, unsigned long state, u32 *power);}hj sbah}(h]h ]h"]h$]h&]jjuh1jhhhKhjubah}(h]h ]h"]h$]h&]uh1hhjhhhhhNubah}(h]h ]h"]h$]h&]jjjhjjstartKuh1hhjhhhhhKubj\)}(hhh](ja)}(h2@cdev: The `struct thermal_cooling_device` pointerh](jg)}(h@cdev:h]h@cdev:}(hj,hhhNhNubah}(h]h ]h"]h$]h&]uh1jfhhhKhj(ubjw)}(hhh]h)}(h+The `struct thermal_cooling_device` pointerh](hThe }(hj=hhhNhNubj")}(h`struct thermal_cooling_device`h]hstruct thermal_cooling_device}(hjEhhhNhNubah}(h]h ]h"]h$]h&]uh1j!hj=ubh pointer}(hj=hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj:ubah}(h]h ]h"]h$]h&]uh1jvhj(ubeh}(h]h ]h"]h$]h&]uh1j`hhhKhj%ubja)}(h5@tz: thermal zone in which we are currently operatingh](jg)}(h@tz:h]h@tz:}(hjmhhhNhNubah}(h]h ]h"]h$]h&]uh1jfhhhKhjiubjw)}(hhh]h)}(h0thermal zone in which we are currently operatingh]h0thermal zone in which we are currently operating}(hj~hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj{ubah}(h]h ]h"]h$]h&]uh1jvhjiubeh}(h]h ]h"]h$]h&]uh1j`hhhKhj%hhubja)}(h@state: A cooling device stateh](jg)}(h@state:h]h@state:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jfhhhKhjubjw)}(hhh]h)}(hA cooling device stateh]hA cooling device state}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jvhjubeh}(h]h ]h"]h$]h&]uh1j`hhhKhj%hhubja)}(h7@power: pointer in which to store the equivalent power h](jg)}(h@power:h]h@power:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jfhhhKhjubjw)}(hhh]h)}(h.pointer in which to store the equivalent powerh]h.pointer in which to store the equivalent power}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jvhjubeh}(h]h ]h"]h$]h&]uh1j`hhhKhj%hhubeh}(h]h ]h"]h$]h&]uh1j[hjhhhhhNubh)}(hConvert cooling device state @state into power consumption in milliwatts and store it in @power. It should return 0 on success, -E* on failure. This is currently used by thermal core to calculate the maximum power that an actor can consume.h]hConvert cooling device state @state into power consumption in milliwatts and store it in @power. It should return 0 on success, -E* on failure. This is currently used by thermal core to calculate the maximum power that an actor can consume.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hhh]h)}(hu:: int power2state(struct thermal_cooling_device *cdev, u32 power, unsigned long *state); h]j)}(hfint power2state(struct thermal_cooling_device *cdev, u32 power, unsigned long *state);h]hfint power2state(struct thermal_cooling_device *cdev, u32 power, unsigned long *state);}hjsbah}(h]h ]h"]h$]h&]jjuh1jhhhKhj ubah}(h]h ]h"]h$]h&]uh1hhj hhhhhNubah}(h]h ]h"]h$]h&]jjjhjjj$Kuh1hhjhhhhhKubj\)}(hhh](ja)}(h2@cdev: The `struct thermal_cooling_device` pointerh](jg)}(h@cdev:h]h@cdev:}(hj2hhhNhNubah}(h]h ]h"]h$]h&]uh1jfhhhKhj.ubjw)}(hhh]h)}(h+The `struct thermal_cooling_device` pointerh](hThe }(hjChhhNhNubj")}(h`struct thermal_cooling_device`h]hstruct thermal_cooling_device}(hjKhhhNhNubah}(h]h ]h"]h$]h&]uh1j!hjCubh pointer}(hjChhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj@ubah}(h]h ]h"]h$]h&]uh1jvhj.ubeh}(h]h ]h"]h$]h&]uh1j`hhhKhj+ubja)}(h@power: power in milliwattsh](jg)}(h@power:h]h@power:}(hjshhhNhNubah}(h]h ]h"]h$]h&]uh1jfhhhKhjoubjw)}(hhh]h)}(hpower in milliwattsh]hpower in milliwatts}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jvhjoubeh}(h]h ]h"]h$]h&]uh1j`hhhKhj+hhubja)}(h6@state: pointer in which to store the resulting state h](jg)}(h@state:h]h@state:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jfhhhKhjubjw)}(hhh]h)}(h-pointer in which to store the resulting stateh]h-pointer in which to store the resulting state}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jvhjubeh}(h]h ]h"]h$]h&]uh1j`hhhKhj+hhubeh}(h]h ]h"]h$]h&]uh1j[hjhhhhhNubh)}(hXCalculate a cooling device state that would make the device consume at most @power mW and store it in @state. It should return 0 on success, -E* on failure. This is currently used by the thermal core to convert a given power set by the power allocator governor to a state that the cooling device can set. It is a function because this conversion may depend on external factors that may change so this function should the best conversion given "current circumstances".h]hXCalculate a cooling device state that would make the device consume at most @power mW and store it in @state. It should return 0 on success, -E* on failure. This is currently used by the thermal core to convert a given power set by the power allocator governor to a state that the cooling device can set. It is a function because this conversion may depend on external factors that may change so this function should the best conversion given “current circumstances”.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubeh}(h]cooling-device-power-apiah ]h"]cooling device power apiah$]h&]uh1hhjhhhhhKubeh}(h]k-dah ]h"]k_dah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hCooling device weightsh]hCooling device weights}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubh)}(hX Weights are a mechanism to bias the allocation among cooling devices. They express the relative power efficiency of different cooling devices. Higher weight can be used to express higher power efficiency. Weighting is relative such that if each cooling device has a weight of one they are considered equal. This is particularly useful in heterogeneous systems where two cooling devices may perform the same kind of compute, but with different efficiency. For example, a system with two different types of processors.h]hX Weights are a mechanism to bias the allocation among cooling devices. They express the relative power efficiency of different cooling devices. Higher weight can be used to express higher power efficiency. Weighting is relative such that if each cooling device has a weight of one they are considered equal. This is particularly useful in heterogeneous systems where two cooling devices may perform the same kind of compute, but with different efficiency. For example, a system with two different types of processors.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hX=If the thermal zone is registered using `thermal_zone_device_register()` (i.e., platform code), then weights are passed as part of the thermal zone's `thermal_bind_parameters`. If the platform is registered using device tree, then they are passed as the `contribution` property of each map in the `cooling-maps` node.h](h(If the thermal zone is registered using }(hj hhhNhNubj")}(h `thermal_zone_device_register()`h]hthermal_zone_device_register()}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j!hj ubhP (i.e., platform code), then weights are passed as part of the thermal zone’s }(hj hhhNhNubj")}(h`thermal_bind_parameters`h]hthermal_bind_parameters}(hj* hhhNhNubah}(h]h ]h"]h$]h&]uh1j!hj ubhO. If the platform is registered using device tree, then they are passed as the }(hj hhhNhNubj")}(h`contribution`h]h contribution}(hj< hhhNhNubah}(h]h ]h"]h$]h&]uh1j!hj ubh property of each map in the }(hj hhhNhNubj")}(h`cooling-maps`h]h cooling-maps}(hjN hhhNhNubah}(h]h ]h"]h$]h&]uh1j!hj ubh node.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(hhh](h)}(h+Limitations of the power allocator governorh]h+Limitations of the power allocator governor}(hji hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjf hhhhhMubh)}(hXThe power allocator governor's PID controller works best if there is a periodic tick. If you have a driver that calls `thermal_zone_device_update()` (or anything that ends up calling the governor's `throttle()` function) repetitively, the governor response won't be very good. Note that this is not particular to this governor, step-wise will also misbehave if you call its throttle() faster than the normal thermal framework tick (due to interrupts for example) as it will overreact.h](hyThe power allocator governor’s PID controller works best if there is a periodic tick. If you have a driver that calls }(hjw hhhNhNubj")}(h`thermal_zone_device_update()`h]hthermal_zone_device_update()}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j!hjw ubh4 (or anything that ends up calling the governor’s }(hjw hhhNhNubj")}(h `throttle()`h]h throttle()}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j!hjw ubhX function) repetitively, the governor response won’t be very good. Note that this is not particular to this governor, step-wise will also misbehave if you call its throttle() faster than the normal thermal framework tick (due to interrupts for example) as it will overreact.}(hjw hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM hjf hhubeh}(h]+limitations-of-the-power-allocator-governorah ]h"]+limitations of the power allocator governorah$]h&]uh1hhjhhhhhMubh)}(hhh](h)}(hEnergy Model requirementsh]hEnergy Model requirements}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhMubh)}(hAnother important thing is the consistent scale of the power values provided by the cooling devices. All of the cooling devices in a single thermal zone should have power values reported either in milli-Watts or scaled to the same 'abstract scale'.h]hAnother important thing is the consistent scale of the power values provided by the cooling devices. All of the cooling devices in a single thermal zone should have power values reported either in milli-Watts or scaled to the same ‘abstract scale’.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj hhubeh}(h]energy-model-requirementsah ]h"]energy model requirementsah$]h&]uh1hhjhhhhhMubeh}(h]cooling-device-weightsah ]h"]cooling device weightsah$]h&]uh1hhhhhhhhKubeh}(h]!power-allocator-governor-tunablesah ]h"]!power allocator governor tunablesah$]h&]uh1hhhhhhhhKubeh}(h]h ]h"]h$]h&]sourcehuh1hcurrent_sourceN current_lineNsettingsdocutils.frontendValues)}(hN generatorN datestampN source_linkN source_urlN toc_backlinksentryfootnote_backlinksK sectnum_xformKstrip_commentsNstrip_elements_with_classesN strip_classesN report_levelK halt_levelKexit_status_levelKdebugNwarning_streamN tracebackinput_encoding utf-8-siginput_encoding_error_handlerstrictoutput_encodingutf-8output_encoding_error_handlerj error_encodingutf-8error_encoding_error_handlerbackslashreplace language_codeenrecord_dependenciesNconfigN id_prefixhauto_id_prefixid dump_settingsNdump_internalsNdump_transformsNdump_pseudo_xmlNexpose_internalsNstrict_visitorN_disable_configN_sourceh _destinationN _config_files]7/var/lib/git/docbuild/linux/Documentation/docutils.confafile_insertion_enabled raw_enabledKline_length_limitM'pep_referencesN pep_base_urlhttps://peps.python.org/pep_file_url_templatepep-%04drfc_referencesN rfc_base_url&https://datatracker.ietf.org/doc/html/ tab_widthKtrim_footnote_reference_spacesyntax_highlightlong smart_quotessmartquotes_locales]character_level_inline_markupdoctitle_xform docinfo_xformKsectsubtitle_xform image_loadinglinkembed_stylesheetcloak_email_addressessection_self_linkenvNubreporterNindirect_targets]substitution_defs}substitution_names}refnames}refids}nameids}(j j jjjjjjj@j=jjjjjjj j j j j j u nametypes}(j jjjj@jjjj j j uh}(j hjhjj"jjj=jjjCjjjjj jj jf j j u footnote_refs} citation_refs} autofootnotes]autofootnote_refs]symbol_footnotes]symbol_footnote_refs] footnotes] citations]autofootnote_startKsymbol_footnote_startK id_counter collectionsCounter}Rparse_messages](hsystem_message)}(hhh]h)}(h:Enumerated list start value not ordinal-1: "2" (ordinal 2)h]h>Enumerated list start value not ordinal-1: “2” (ordinal 2)}(hjr hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjo ubah}(h]h ]h"]h$]h&]levelKtypeINFOsourcehlineKuh1jm hjhhhhhKubjn )}(hhh]h)}(h:Enumerated list start value not ordinal-1: "3" (ordinal 3)h]h>Enumerated list start value not ordinal-1: “3” (ordinal 3)}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj ubah}(h]h ]h"]h$]h&]levelKtypej sourcehlineKuh1jm hjhhhhhKubetransform_messages] transformerN include_log] decorationNhhub.