Isphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}(hhparenthuba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget)/translations/zh_CN/power/charger-managermodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}(hhhh2ubah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget)/translations/zh_TW/power/charger-managermodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}(hhhhFubah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget)/translations/it_IT/power/charger-managermodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}(hhhhZubah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget)/translations/ja_JP/power/charger-managermodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}(hhhhnubah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget)/translations/ko_KR/power/charger-managermodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}(hhhhubah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget)/translations/sp_SP/power/charger-managermodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhsection)}(hhh](htitle)}(hCharger Managerh]hCharger Manager}(hhhhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhC/var/lib/git/docbuild/linux/Documentation/power/charger-manager.rsthKubh block_quote)}(hhh]henumerated_list)}(hhh]h list_item)}(h22011 MyungJoo Ham , GPL h]h paragraph)}(h12011 MyungJoo Ham , GPLh](h2011 MyungJoo Ham <}(h2011 MyungJoo Ham , GPL}(h>, GPLhhhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhhubah}(h]h ]h"]h$]h&]uh1hhhubah}(h]h ]h"]h$]h&]enumtype upperalphaprefix(suffix)startKuh1hhhubah}(h]h ]h"]h$]h&]uh1hhhhhhNhNubh)}(hXCharger Manager provides in-kernel battery charger management that requires temperature monitoring during suspend-to-RAM state and where each battery may have multiple chargers attached and the userland wants to look at the aggregated information of the multiple chargers.h]hXCharger Manager provides in-kernel battery charger management that requires temperature monitoring during suspend-to-RAM state and where each battery may have multiple chargers attached and the userland wants to look at the aggregated information of the multiple chargers.}(hj hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hX[Charger Manager is a platform_driver with power-supply-class entries. An instance of Charger Manager (a platform-device created with Charger-Manager) represents an independent battery with chargers. If there are multiple batteries with their own chargers acting independently in a system, the system may need multiple instances of Charger Manager.h]hX[Charger Manager is a platform_driver with power-supply-class entries. An instance of Charger Manager (a platform-device created with Charger-Manager) represents an independent battery with chargers. If there are multiple batteries with their own chargers acting independently in a system, the system may need multiple instances of Charger Manager.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK hhhhubh)}(hhh](h)}(h1. Introductionh]h1. Introduction}(hj)hj'hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj$hhhhhKubh)}(h'Charger Manager supports the following:h]h'Charger Manager supports the following:}(hj7hj5hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj$hhubh bullet_list)}(hhh](h)}(hXSupport for multiple chargers (e.g., a device with USB, AC, and solar panels) A system may have multiple chargers (or power sources) and some of they may be activated at the same time. Each charger may have its own power-supply-class and each power-supply-class can provide different information about the battery status. This framework aggregates charger-related information from multiple sources and shows combined information as a single power-supply-class. h]hdefinition_list)}(hhh]hdefinition_list_item)}(hXSupport for multiple chargers (e.g., a device with USB, AC, and solar panels) A system may have multiple chargers (or power sources) and some of they may be activated at the same time. Each charger may have its own power-supply-class and each power-supply-class can provide different information about the battery status. This framework aggregates charger-related information from multiple sources and shows combined information as a single power-supply-class. h](hterm)}(hMSupport for multiple chargers (e.g., a device with USB, AC, and solar panels)h]hMSupport for multiple chargers (e.g., a device with USB, AC, and solar panels)}(hj[hjYhhhNhNubah}(h]h ]h"]h$]h&]uh1jWhhhKhjSubh definition)}(hhh]h)}(hX~A system may have multiple chargers (or power sources) and some of they may be activated at the same time. Each charger may have its own power-supply-class and each power-supply-class can provide different information about the battery status. This framework aggregates charger-related information from multiple sources and shows combined information as a single power-supply-class.h]hX~A system may have multiple chargers (or power sources) and some of they may be activated at the same time. Each charger may have its own power-supply-class and each power-supply-class can provide different information about the battery status. This framework aggregates charger-related information from multiple sources and shows combined information as a single power-supply-class.}(hjnhjlhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjiubah}(h]h ]h"]h$]h&]uh1jghjSubeh}(h]h ]h"]h$]h&]uh1jQhhhKhjNubah}(h]h ]h"]h$]h&]uh1jLhjHubah}(h]h ]h"]h$]h&]uh1hhjEhhhNhNubh)}(hXSupport for in suspend-to-RAM polling (with suspend_again callback) While the battery is being charged and the system is in suspend-to-RAM, we may need to monitor the battery health by looking at the ambient or battery temperature. We can accomplish this by waking up the system periodically. However, such a method wakes up devices unnecessarily for monitoring the battery health and tasks, and user processes that are supposed to be kept suspended. That, in turn, incurs unnecessary power consumption and slow down charging process. Or even, such peak power consumption can stop chargers in the middle of charging (external power input < device power consumption), which not only affects the charging time, but the lifespan of the battery. Charger Manager provides a function "cm_suspend_again" that can be used as suspend_again callback of platform_suspend_ops. If the platform requires tasks other than cm_suspend_again, it may implement its own suspend_again callback that calls cm_suspend_again in the middle. Normally, the platform will need to resume and suspend some devices that are used by Charger Manager. h]jM)}(hhh]jR)}(hX_Support for in suspend-to-RAM polling (with suspend_again callback) While the battery is being charged and the system is in suspend-to-RAM, we may need to monitor the battery health by looking at the ambient or battery temperature. We can accomplish this by waking up the system periodically. However, such a method wakes up devices unnecessarily for monitoring the battery health and tasks, and user processes that are supposed to be kept suspended. That, in turn, incurs unnecessary power consumption and slow down charging process. Or even, such peak power consumption can stop chargers in the middle of charging (external power input < device power consumption), which not only affects the charging time, but the lifespan of the battery. Charger Manager provides a function "cm_suspend_again" that can be used as suspend_again callback of platform_suspend_ops. If the platform requires tasks other than cm_suspend_again, it may implement its own suspend_again callback that calls cm_suspend_again in the middle. Normally, the platform will need to resume and suspend some devices that are used by Charger Manager. h](jX)}(hCSupport for in suspend-to-RAM polling (with suspend_again callback)h]hCSupport for in suspend-to-RAM polling (with suspend_again callback)}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jWhhhK0hjubjh)}(hhh](h)}(hXWhile the battery is being charged and the system is in suspend-to-RAM, we may need to monitor the battery health by looking at the ambient or battery temperature. We can accomplish this by waking up the system periodically. However, such a method wakes up devices unnecessarily for monitoring the battery health and tasks, and user processes that are supposed to be kept suspended. That, in turn, incurs unnecessary power consumption and slow down charging process. Or even, such peak power consumption can stop chargers in the middle of charging (external power input < device power consumption), which not only affects the charging time, but the lifespan of the battery.h]hXWhile the battery is being charged and the system is in suspend-to-RAM, we may need to monitor the battery health by looking at the ambient or battery temperature. We can accomplish this by waking up the system periodically. However, such a method wakes up devices unnecessarily for monitoring the battery health and tasks, and user processes that are supposed to be kept suspended. That, in turn, incurs unnecessary power consumption and slow down charging process. Or even, such peak power consumption can stop chargers in the middle of charging (external power input < device power consumption), which not only affects the charging time, but the lifespan of the battery.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK hjubh)}(hXwCharger Manager provides a function "cm_suspend_again" that can be used as suspend_again callback of platform_suspend_ops. If the platform requires tasks other than cm_suspend_again, it may implement its own suspend_again callback that calls cm_suspend_again in the middle. Normally, the platform will need to resume and suspend some devices that are used by Charger Manager.h]hX{Charger Manager provides a function “cm_suspend_again” that can be used as suspend_again callback of platform_suspend_ops. If the platform requires tasks other than cm_suspend_again, it may implement its own suspend_again callback that calls cm_suspend_again in the middle. Normally, the platform will need to resume and suspend some devices that are used by Charger Manager.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK+hjubeh}(h]h ]h"]h$]h&]uh1jghjubeh}(h]h ]h"]h$]h&]uh1jQhhhK0hjubah}(h]h ]h"]h$]h&]uh1jLhjubah}(h]h ]h"]h$]h&]uh1hhjEhhhNhNubh)}(hXESupport for premature full-battery event handling If the battery voltage drops by "fullbatt_vchkdrop_uV" after "fullbatt_vchkdrop_ms" from the full-battery event, the framework restarts charging. This check is also performed while suspended by setting wakeup time accordingly and using suspend_again. h]jM)}(hhh]jR)}(hX-Support for premature full-battery event handling If the battery voltage drops by "fullbatt_vchkdrop_uV" after "fullbatt_vchkdrop_ms" from the full-battery event, the framework restarts charging. This check is also performed while suspended by setting wakeup time accordingly and using suspend_again. h](jX)}(h1Support for premature full-battery event handlingh]h1Support for premature full-battery event handling}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jWhhhK6hjubjh)}(hhh]h)}(hIf the battery voltage drops by "fullbatt_vchkdrop_uV" after "fullbatt_vchkdrop_ms" from the full-battery event, the framework restarts charging. This check is also performed while suspended by setting wakeup time accordingly and using suspend_again.h]hXIf the battery voltage drops by “fullbatt_vchkdrop_uV” after “fullbatt_vchkdrop_ms” from the full-battery event, the framework restarts charging. This check is also performed while suspended by setting wakeup time accordingly and using suspend_again.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK3hjubah}(h]h ]h"]h$]h&]uh1jghjubeh}(h]h ]h"]h$]h&]uh1jQhhhK6hjubah}(h]h ]h"]h$]h&]uh1jLhjubah}(h]h ]h"]h$]h&]uh1hhjEhhhNhNubh)}(h{Support for uevent-notify With the charger-related events, the device sends notification to users with UEVENT. h]jM)}(hhh]jR)}(hoSupport for uevent-notify With the charger-related events, the device sends notification to users with UEVENT. h](jX)}(hSupport for uevent-notifyh]hSupport for uevent-notify}(hj1hj/hhhNhNubah}(h]h ]h"]h$]h&]uh1jWhhhK:hj+ubjh)}(hhh]h)}(hTWith the charger-related events, the device sends notification to users with UEVENT.h]hTWith the charger-related events, the device sends notification to users with UEVENT.}(hjBhj@hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK9hj=ubah}(h]h ]h"]h$]h&]uh1jghj+ubeh}(h]h ]h"]h$]h&]uh1jQhhhK:hj(ubah}(h]h ]h"]h$]h&]uh1jLhj$ubah}(h]h ]h"]h$]h&]uh1hhjEhhhNhNubeh}(h]h ]h"]h$]h&]bullet*uh1jChhhKhj$hhubeh}(h] introductionah ]h"]1. introductionah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(h92. Global Charger-Manager Data related with suspend_againh]h92. Global Charger-Manager Data related with suspend_again}(hj{hjyhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjvhhhhhK=ubh)}(hX"In order to setup Charger Manager with suspend-again feature (in-suspend monitoring), the user should provide charger_global_desc with setup_charger_manager(`struct charger_global_desc *`). This charger_global_desc data for in-suspend monitoring is global as the name suggests. Thus, the user needs to provide only once even if there are multiple batteries. If there are multiple batteries, the multiple instances of Charger Manager share the same charger_global_desc and it will manage in-suspend monitoring for all instances of Charger Manager.h](hIn order to setup Charger Manager with suspend-again feature (in-suspend monitoring), the user should provide charger_global_desc with setup_charger_manager(}(hIn order to setup Charger Manager with suspend-again feature (in-suspend monitoring), the user should provide charger_global_desc with setup_charger_manager(hjhhhNhNubhtitle_reference)}(h`struct charger_global_desc *`h]hstruct charger_global_desc *}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhXg). This charger_global_desc data for in-suspend monitoring is global as the name suggests. Thus, the user needs to provide only once even if there are multiple batteries. If there are multiple batteries, the multiple instances of Charger Manager share the same charger_global_desc and it will manage in-suspend monitoring for all instances of Charger Manager.}(hXg). This charger_global_desc data for in-suspend monitoring is global as the name suggests. Thus, the user needs to provide only once even if there are multiple batteries. If there are multiple batteries, the multiple instances of Charger Manager share the same charger_global_desc and it will manage in-suspend monitoring for all instances of Charger Manager.hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK>hjvhhubh)}(hThe user needs to provide all the three entries to `struct charger_global_desc` properly in order to activate in-suspend monitoring:h](h3The user needs to provide all the three entries to }(h3The user needs to provide all the three entries to hjhhhNhNubj)}(h`struct charger_global_desc`h]hstruct charger_global_desc}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh5 properly in order to activate in-suspend monitoring:}(h5 properly in order to activate in-suspend monitoring:hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKGhjvhhubjM)}(hhh](jR)}(hX`char *rtc_name;` The name of rtc (e.g., "rtc0") used to wakeup the system from suspend for Charger Manager. The alarm interrupt (AIE) of the rtc should be able to wake up the system from suspend. Charger Manager saves and restores the alarm value and use the previously-defined alarm if it is going to go off earlier than Charger Manager so that Charger Manager does not interfere with previously-defined alarms. h](jX)}(h`char *rtc_name;`h]j)}(hjh]hchar *rtc_name;}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jWhhhKPhjubjh)}(hhh]h)}(hXThe name of rtc (e.g., "rtc0") used to wakeup the system from suspend for Charger Manager. The alarm interrupt (AIE) of the rtc should be able to wake up the system from suspend. Charger Manager saves and restores the alarm value and use the previously-defined alarm if it is going to go off earlier than Charger Manager so that Charger Manager does not interfere with previously-defined alarms.h]hXThe name of rtc (e.g., “rtc0”) used to wakeup the system from suspend for Charger Manager. The alarm interrupt (AIE) of the rtc should be able to wake up the system from suspend. Charger Manager saves and restores the alarm value and use the previously-defined alarm if it is going to go off earlier than Charger Manager so that Charger Manager does not interfere with previously-defined alarms.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKKhjubah}(h]h ]h"]h$]h&]uh1jghjubeh}(h]h ]h"]h$]h&]uh1jQhhhKPhjubjR)}(hX,`bool (*rtc_only_wakeup)(void);` This callback should let CM know whether the wakeup-from-suspend is caused only by the alarm of "rtc" in the same struct. If there is any other wakeup source triggered the wakeup, it should return false. If the "rtc" is the only wakeup reason, it should return true. h](jX)}(h `bool (*rtc_only_wakeup)(void);`h]j)}(hjh]hbool (*rtc_only_wakeup)(void);}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]uh1jWhhhKWhjubjh)}(hhh]h)}(hX This callback should let CM know whether the wakeup-from-suspend is caused only by the alarm of "rtc" in the same struct. If there is any other wakeup source triggered the wakeup, it should return false. If the "rtc" is the only wakeup reason, it should return true.h]hXThis callback should let CM know whether the wakeup-from-suspend is caused only by the alarm of “rtc” in the same struct. If there is any other wakeup source triggered the wakeup, it should return false. If the “rtc” is the only wakeup reason, it should return true.}(hj(hj&hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKShj#ubah}(h]h ]h"]h$]h&]uh1jghjubeh}(h]h ]h"]h$]h&]uh1jQhhhKWhjhhubjR)}(h`bool assume_timer_stops_in_suspend;` if true, Charger Manager assumes that the timer (CM uses jiffies as timer) stops during suspend. Then, CM assumes that the suspend-duration is same as the alarm length. h](jX)}(h%`bool assume_timer_stops_in_suspend;`h]j)}(hjFh]h#bool assume_timer_stops_in_suspend;}(hhhjHhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjDubah}(h]h ]h"]h$]h&]uh1jWhhhK]hj@ubjh)}(hhh]h)}(hif true, Charger Manager assumes that the timer (CM uses jiffies as timer) stops during suspend. Then, CM assumes that the suspend-duration is same as the alarm length.h]hif true, Charger Manager assumes that the timer (CM uses jiffies as timer) stops during suspend. Then, CM assumes that the suspend-duration is same as the alarm length.}(hj`hj^hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKZhj[ubah}(h]h ]h"]h$]h&]uh1jghj@ubeh}(h]h ]h"]h$]h&]uh1jQhhhK]hjhhubeh}(h]h ]h"]h$]h&]uh1jLhjvhhhhhNubeh}(h]6global-charger-manager-data-related-with-suspend-againah ]h"]92. global charger-manager data related with suspend_againah$]h&]uh1hhhhhhhhK=ubh)}(hhh](h)}(h3. How to setup suspend_againh]h3. How to setup suspend_again}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhK`ubh)}(hXCharger Manager provides a function "extern bool cm_suspend_again(void)". When cm_suspend_again is called, it monitors every battery. The suspend_ops callback of the system's platform_suspend_ops can call cm_suspend_again function to know whether Charger Manager wants to suspend again or not. If there are no other devices or tasks that want to use suspend_again feature, the platform_suspend_ops may directly refer to cm_suspend_again for its suspend_again callback.h]hXCharger Manager provides a function “extern bool cm_suspend_again(void)”. When cm_suspend_again is called, it monitors every battery. The suspend_ops callback of the system’s platform_suspend_ops can call cm_suspend_again function to know whether Charger Manager wants to suspend again or not. If there are no other devices or tasks that want to use suspend_again feature, the platform_suspend_ops may directly refer to cm_suspend_again for its suspend_again callback.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKahjhhubh)}(hThe cm_suspend_again() returns true (meaning "I want to suspend again") if the system was woken up by Charger Manager and the polling (in-suspend monitoring) results in "normal".h]hThe cm_suspend_again() returns true (meaning “I want to suspend again”) if the system was woken up by Charger Manager and the polling (in-suspend monitoring) results in “normal”.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKihjhhubeh}(h]how-to-setup-suspend-againah ]h"]3. how to setup suspend_againah$]h&]uh1hhhhhhhhK`ubh)}(hhh](h)}(h-4. Charger-Manager Data (struct charger_desc)h]h-4. Charger-Manager Data (struct charger_desc)}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKnubh)}(hFor each battery charged independently from other batteries (if a series of batteries are charged by a single charger, they are counted as one independent battery), an instance of Charger Manager is attached to it. The followingh]hFor each battery charged independently from other batteries (if a series of batteries are charged by a single charger, they are counted as one independent battery), an instance of Charger Manager is attached to it. The following}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKohjhhubh)}(hstruct charger_desc elements:h]hstruct charger_desc elements:}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKshjhhubjM)}(hhh](jR)}(h`char *psy_name;` The power-supply-class name of the battery. Default is "battery" if psy_name is NULL. Users can access the psy entries at "/sys/class/power_supply/[psy_name]/". h](jX)}(h`char *psy_name;`h]j)}(hjh]hchar *psy_name;}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jWhhhKxhjubjh)}(hhh]h)}(hThe power-supply-class name of the battery. Default is "battery" if psy_name is NULL. Users can access the psy entries at "/sys/class/power_supply/[psy_name]/".h]hThe power-supply-class name of the battery. Default is “battery” if psy_name is NULL. Users can access the psy entries at “/sys/class/power_supply/[psy_name]/”.}(hj hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKvhjubah}(h]h ]h"]h$]h&]uh1jghjubeh}(h]h ]h"]h$]h&]uh1jQhhhKxhjubjR)}(hXP`enum polling_modes polling_mode;` CM_POLL_DISABLE: do not poll this battery. CM_POLL_ALWAYS: always poll this battery. CM_POLL_EXTERNAL_POWER_ONLY: poll this battery if and only if an external power source is attached. CM_POLL_CHARGING_ONLY: poll this battery if and only if the battery is being charged. h](jX)}(h"`enum polling_modes polling_mode;`h]j)}(hj)h]h enum polling_modes polling_mode;}(hhhj+hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj'ubah}(h]h ]h"]h$]h&]uh1jWhhhKhj#ubjh)}(hhh]jM)}(hhh](jR)}(h*CM_POLL_DISABLE: do not poll this battery.h](jX)}(hCM_POLL_DISABLE:h]hCM_POLL_DISABLE:}(hjJhjHhhhNhNubah}(h]h ]h"]h$]h&]uh1jWhhhK{hjDubjh)}(hhh]h)}(hdo not poll this battery.h]hdo not poll this battery.}(hj[hjYhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK|hjVubah}(h]h ]h"]h$]h&]uh1jghjDubeh}(h]h ]h"]h$]h&]uh1jQhhhK{hjAubjR)}(h)CM_POLL_ALWAYS: always poll this battery.h](jX)}(hCM_POLL_ALWAYS:h]hCM_POLL_ALWAYS:}(hjyhjwhhhNhNubah}(h]h ]h"]h$]h&]uh1jWhhhK}hjsubjh)}(hhh]h)}(halways poll this battery.h]halways poll this battery.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK~hjubah}(h]h ]h"]h$]h&]uh1jghjsubeh}(h]h ]h"]h$]h&]uh1jQhhhK}hjAubjR)}(hcCM_POLL_EXTERNAL_POWER_ONLY: poll this battery if and only if an external power source is attached.h](jX)}(hCM_POLL_EXTERNAL_POWER_ONLY:h]hCM_POLL_EXTERNAL_POWER_ONLY:}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jWhhhKhjubjh)}(hhh]h)}(hFpoll this battery if and only if an external power source is attached.h]hFpoll this battery if and only if an external power source is attached.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jghjubeh}(h]h ]h"]h$]h&]uh1jQhhhKhjAubjR)}(hVCM_POLL_CHARGING_ONLY: poll this battery if and only if the battery is being charged. h](jX)}(hCM_POLL_CHARGING_ONLY:h]hCM_POLL_CHARGING_ONLY:}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jWhhhKhjubjh)}(hhh]h)}(h>poll this battery if and only if the battery is being charged.h]h>poll this battery if and only if the battery is being charged.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jghjubeh}(h]h ]h"]h$]h&]uh1jQhhhKhjAubeh}(h]h ]h"]h$]h&]uh1jLhj>ubah}(h]h ]h"]h$]h&]uh1jghj#ubeh}(h]h ]h"]h$]h&]uh1jQhhhKhjhhubjR)}(hX`unsigned int fullbatt_vchkdrop_ms; / unsigned int fullbatt_vchkdrop_uV;` If both have non-zero values, Charger Manager will check the battery voltage drop fullbatt_vchkdrop_ms after the battery is fully charged. If the voltage drop is over fullbatt_vchkdrop_uV, Charger Manager will try to recharge the battery by disabling and enabling chargers. Recharge with voltage drop condition only (without delay condition) is needed to be implemented with hardware interrupts from fuel gauges or charger devices/chips. h](jX)}(hI`unsigned int fullbatt_vchkdrop_ms; / unsigned int fullbatt_vchkdrop_uV;`h]j)}(hjh]hGunsigned int fullbatt_vchkdrop_ms; / unsigned int fullbatt_vchkdrop_uV;}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jWhhhKhjubjh)}(hhh]h)}(hXIf both have non-zero values, Charger Manager will check the battery voltage drop fullbatt_vchkdrop_ms after the battery is fully charged. If the voltage drop is over fullbatt_vchkdrop_uV, Charger Manager will try to recharge the battery by disabling and enabling chargers. Recharge with voltage drop condition only (without delay condition) is needed to be implemented with hardware interrupts from fuel gauges or charger devices/chips.h]hXIf both have non-zero values, Charger Manager will check the battery voltage drop fullbatt_vchkdrop_ms after the battery is fully charged. If the voltage drop is over fullbatt_vchkdrop_uV, Charger Manager will try to recharge the battery by disabling and enabling chargers. Recharge with voltage drop condition only (without delay condition) is needed to be implemented with hardware interrupts from fuel gauges or charger devices/chips.}(hj2hj0hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj-ubah}(h]h ]h"]h$]h&]uh1jghjubeh}(h]h ]h"]h$]h&]uh1jQhhhKhjhhubjR)}(h`unsigned int fullbatt_uV;` If specified with a non-zero value, Charger Manager assumes that the battery is full (capacity = 100) if the battery is not being charged and the battery voltage is equal to or greater than fullbatt_uV. h](jX)}(h`unsigned int fullbatt_uV;`h]j)}(hjPh]hunsigned int fullbatt_uV;}(hhhjRhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjNubah}(h]h ]h"]h$]h&]uh1jWhhhKhjJubjh)}(hhh]h)}(hIf specified with a non-zero value, Charger Manager assumes that the battery is full (capacity = 100) if the battery is not being charged and the battery voltage is equal to or greater than fullbatt_uV.h]hIf specified with a non-zero value, Charger Manager assumes that the battery is full (capacity = 100) if the battery is not being charged and the battery voltage is equal to or greater than fullbatt_uV.}(hjjhjhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjeubah}(h]h ]h"]h$]h&]uh1jghjJubeh}(h]h ]h"]h$]h&]uh1jQhhhKhjhhubjR)}(h`unsigned int polling_interval_ms;` Required polling interval in ms. Charger Manager will poll this battery every polling_interval_ms or more frequently. h](jX)}(h#`unsigned int polling_interval_ms;`h]j)}(hjh]h!unsigned int polling_interval_ms;}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jWhhhKhjubjh)}(hhh]h)}(huRequired polling interval in ms. Charger Manager will poll this battery every polling_interval_ms or more frequently.h]huRequired polling interval in ms. Charger Manager will poll this battery every polling_interval_ms or more frequently.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jghjubeh}(h]h ]h"]h$]h&]uh1jQhhhKhjhhubjR)}(hX&`enum data_source battery_present;` CM_BATTERY_PRESENT: assume that the battery exists. CM_NO_BATTERY: assume that the battery does not exists. CM_FUEL_GAUGE: get battery presence information from fuel gauge. CM_CHARGER_STAT: get battery presence from chargers. h](jX)}(h#`enum data_source battery_present;`h]j)}(hjh]h!enum data_source battery_present;}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jWhhhKhjubjh)}(hhh]jM)}(hhh](jR)}(h3CM_BATTERY_PRESENT: assume that the battery exists.h](jX)}(hCM_BATTERY_PRESENT:h]hCM_BATTERY_PRESENT:}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jWhhhKhjubjh)}(hhh]h)}(hassume that the battery exists.h]hassume that the battery exists.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jghjubeh}(h]h ]h"]h$]h&]uh1jQhhhKhjubjR)}(h7CM_NO_BATTERY: assume that the battery does not exists.h](jX)}(hCM_NO_BATTERY:h]hCM_NO_BATTERY:}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jWhhhKhj ubjh)}(hhh]h)}(h(assume that the battery does not exists.h]h(assume that the battery does not exists.}(hj!hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jghj ubeh}(h]h ]h"]h$]h&]uh1jQhhhKhjubjR)}(h@CM_FUEL_GAUGE: get battery presence information from fuel gauge.h](jX)}(hCM_FUEL_GAUGE:h]hCM_FUEL_GAUGE:}(hj?hj=hhhNhNubah}(h]h ]h"]h$]h&]uh1jWhhhKhj9ubjh)}(hhh]h)}(h1get battery presence information from fuel gauge.h]h1get battery presence information from fuel gauge.}(hjPhjNhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjKubah}(h]h ]h"]h$]h&]uh1jghj9ubeh}(h]h ]h"]h$]h&]uh1jQhhhKhjubjR)}(h5CM_CHARGER_STAT: get battery presence from chargers. h](jX)}(hCM_CHARGER_STAT:h]hCM_CHARGER_STAT:}(hjnhjlhhhNhNubah}(h]h ]h"]h$]h&]uh1jWhhhKhjhubjh)}(hhh]h)}(h#get battery presence from chargers.h]h#get battery presence from chargers.}(hjhj}hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjzubah}(h]h ]h"]h$]h&]uh1jghjhubeh}(h]h ]h"]h$]h&]uh1jQhhhKhjubeh}(h]h ]h"]h$]h&]uh1jLhjubah}(h]h ]h"]h$]h&]uh1jghjubeh}(h]h ]h"]h$]h&]uh1jQhhhKhjhhubjR)}(hX~`char **psy_charger_stat;` An array ending with NULL that has power-supply-class names of chargers. Each power-supply-class should provide "PRESENT" (if battery_present is "CM_CHARGER_STAT"), "ONLINE" (shows whether an external power source is attached or not), and "STATUS" (shows whether the battery is {"FULL" or not FULL} or {"FULL", "Charging", "Discharging", "NotCharging"}). h](jX)}(h`char **psy_charger_stat;`h]j)}(hjh]hchar **psy_charger_stat;}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jWhhhKhjubjh)}(hhh]h)}(hXbAn array ending with NULL that has power-supply-class names of chargers. Each power-supply-class should provide "PRESENT" (if battery_present is "CM_CHARGER_STAT"), "ONLINE" (shows whether an external power source is attached or not), and "STATUS" (shows whether the battery is {"FULL" or not FULL} or {"FULL", "Charging", "Discharging", "NotCharging"}).h]hXAn array ending with NULL that has power-supply-class names of chargers. Each power-supply-class should provide “PRESENT” (if battery_present is “CM_CHARGER_STAT”), “ONLINE” (shows whether an external power source is attached or not), and “STATUS” (shows whether the battery is {“FULL” or not FULL} or {“FULL”, “Charging”, “Discharging”, “NotCharging”}).}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jghjubeh}(h]h ]h"]h$]h&]uh1jQhhhKhjhhubjR)}(h`int num_charger_regulators; / struct regulator_bulk_data *charger_regulators;` Regulators representing the chargers in the form for regulator framework's bulk functions. h](jX)}(hO`int num_charger_regulators; / struct regulator_bulk_data *charger_regulators;`h]j)}(hjh]hMint num_charger_regulators; / struct regulator_bulk_data *charger_regulators;}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jWhhhKhjubjh)}(hhh]h)}(hZRegulators representing the chargers in the form for regulator framework's bulk functions.h]h\Regulators representing the chargers in the form for regulator framework’s bulk functions.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jghjubeh}(h]h ]h"]h$]h&]uh1jQhhhKhjhhubjR)}(hC`char *psy_fuel_gauge;` Power-supply-class name of the fuel gauge. h](jX)}(h`char *psy_fuel_gauge;`h]j)}(hjh]hchar *psy_fuel_gauge;}(hhhj!hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jWhhhKhjubjh)}(hhh]h)}(h*Power-supply-class name of the fuel gauge.h]h*Power-supply-class name of the fuel gauge.}(hj9hj7hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj4ubah}(h]h ]h"]h$]h&]uh1jghjubeh}(h]h ]h"]h$]h&]uh1jQhhhKhjhhubjR)}(hX`int (*temperature_out_of_range)(int *mC); / bool measure_battery_temp;` This callback returns 0 if the temperature is safe for charging, a positive number if it is too hot to charge, and a negative number if it is too cold to charge. With the variable mC, the callback returns the temperature in 1/1000 of centigrade. The source of temperature can be battery or ambient one according to the value of measure_battery_temp. h](jX)}(hH`int (*temperature_out_of_range)(int *mC); / bool measure_battery_temp;`h]j)}(hjWh]hFint (*temperature_out_of_range)(int *mC); / bool measure_battery_temp;}(hhhjYhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjUubah}(h]h ]h"]h$]h&]uh1jWhhhKhjQubjh)}(hhh]h)}(hX]This callback returns 0 if the temperature is safe for charging, a positive number if it is too hot to charge, and a negative number if it is too cold to charge. With the variable mC, the callback returns the temperature in 1/1000 of centigrade. The source of temperature can be battery or ambient one according to the value of measure_battery_temp.h]hX]This callback returns 0 if the temperature is safe for charging, a positive number if it is too hot to charge, and a negative number if it is too cold to charge. With the variable mC, the callback returns the temperature in 1/1000 of centigrade. The source of temperature can be battery or ambient one according to the value of measure_battery_temp.}(hjqhjohhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjlubah}(h]h ]h"]h$]h&]uh1jghjQubeh}(h]h ]h"]h$]h&]uh1jQhhhKhjhhubeh}(h]h ]h"]h$]h&]uh1jLhjhhhhhNubeh}(h](charger-manager-data-struct-charger-descah ]h"]-4. charger-manager data (struct charger_desc)ah$]h&]uh1hhhhhhhhKnubh)}(hhh](h)}(h>5. Notify Charger-Manager of charger events: cm_notify_event()h]h>5. Notify Charger-Manager of charger events: cm_notify_event()}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubh)}(hXIf there is an charger event is required to notify Charger Manager, a charger device driver that triggers the event can call cm_notify_event(psy, type, msg) to notify the corresponding Charger Manager. In the function, psy is the charger driver's power_supply pointer, which is associated with Charger-Manager. The parameter "type" is the same as irq's type (enum cm_event_types). The event message "msg" is optional and is effective only if the event type is "UNDESCRIBED" or "OTHERS".h]hXIf there is an charger event is required to notify Charger Manager, a charger device driver that triggers the event can call cm_notify_event(psy, type, msg) to notify the corresponding Charger Manager. In the function, psy is the charger driver’s power_supply pointer, which is associated with Charger-Manager. The parameter “type” is the same as irq’s type (enum cm_event_types). The event message “msg” is optional and is effective only if the event type is “UNDESCRIBED” or “OTHERS”.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubeh}(h]8notify-charger-manager-of-charger-events-cm-notify-eventah ]h"]>5. notify charger-manager of charger events: cm_notify_event()ah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(h6. Other Considerationsh]h6. Other Considerations}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubh)}(hXmAt the charger/battery-related events such as battery-pulled-out, charger-pulled-out, charger-inserted, DCIN-over/under-voltage, charger-stopped, and others critical to chargers, the system should be configured to wake up. At least the following should wake up the system from a suspend: a) charger-on/off b) external-power-in/out c) battery-in/out (while charging)h]hXmAt the charger/battery-related events such as battery-pulled-out, charger-pulled-out, charger-inserted, DCIN-over/under-voltage, charger-stopped, and others critical to chargers, the system should be configured to wake up. At least the following should wake up the system from a suspend: a) charger-on/off b) external-power-in/out c) battery-in/out (while charging)}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hFIt is usually accomplished by configuring the PMIC as a wakeup source.h]hFIt is usually accomplished by configuring the PMIC as a wakeup source.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubeh}(h]other-considerationsah ]h"]6. other considerationsah$]h&]uh1hhhhhhhhKubeh}(h]charger-managerah ]h"]charger managerah$]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_handlerjerror_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.confapep_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_spacefile_insertion_enabled raw_enabledKline_length_limitM'syntax_highlightlong smart_quotessmartquotes_locales]character_level_inline_markupdoctitle_xform docinfo_xformKsectsubtitle_xform image_loadinglinkembed_stylesheetcloak_email_addressessection_self_link embed_imagesenvNubreporterNindirect_targets]substitution_defs}substitution_names}refnames}refids}nameids}(jjjsjpjjjjjjjjjju nametypes}(jNjsNjNjNjNjNjNuh}(jhjpj$jjvjjjjjjjju 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: "C" (ordinal 3)h]h>Enumerated list start value not ordinal-1: “C” (ordinal 3)}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubah}(h]h ]h"]h$]h&]levelKtypeINFOsourcehlineKuh1jhhubatransform_messages] transformerN include_log] decorationNhhub.